the follows is my coding, who can tell me where is wrong,
and how to correct it?
DWORD myinfo::IoctlNdisQueryTest(LPCTSTR lpAdapterName)
{
UCHAR OidData[4096];
DWORD nResult, ReturnedCount = 0;
nResult = Test_IoctlNdisQueryGlobalStats
(lpAdapterName,OID_802_11_STATISTICS,OidData,sizeof
(OidData),&ReturnedCount);
if( nResult != ERROR_SUCCESS )
sprintf(sLabel,"%s","The driver
unsupported");
else
/* ****************************************** */
sprintf(sLabel,"%d,%d",OidData[1],OidData
[10]);// wrong message
/* ******************************************* */
m_temp.SetWindowText(sLabel);
nResult = Test_IoctlNdisQueryGlobalStats
(lpAdapterName,OID_802_11_SSID,OidData,sizeof
(OidData),&ReturnedCount);
if( nResult != ERROR_SUCCESS )
sprintf(sLabel,"%s","The driver
unsupported");
else
/* ***************************************** */
sprintf(sLabel,"%d-%s",OidData[],OidData
[1]);//wrong message
/* ****************************************** */
m_temp.SetWindowText(sLabel);
return( nResult );
}DWORD myinfo::Test_IoctlNdisQueryGlobalStats(
LPCTSTR lpAdapterName,
ULONG OidCode,
PVOID InformationBuffer,
UINT InformationBufferLength,
PULONG pBytesWritten)
{
CHAR LinkName[512];
CHAR szMACFileName[512];
BOOLEAN bCreatedDevice = FALSE;
DWORD ErrorNumber, nResult = ERROR_SUCCESS;
HANDLE hMAC;
*pBytesWritten = 0;
strcpy( LinkName, "\\Device\\" );
strcat( LinkName, lpAdapterName );
strcpy(szMACFileName, DEVICE_PREFIX);
strcat(szMACFileName, lpAdapterName);
hMAC = CreateFile
(szMACFileName,0,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,INVAL
ID_HANDLE_VALUE);
if (hMAC != INVALID_HANDLE_VALUE)
if(!DeviceIoControl
(hMAC,IOCTL_NDIS_QUERY_GLOBAL_STATS,&OidCode,
sizeof
(OidCode),InformationBuffer,InformationBufferLength,
pBytesWritten,NULL))
printf(" DeviceIoControl returned an
error = %d\n",nResult = GetLastError());
else
printf(" CreateFile returned an error = %
d\n",nResult = GetLastError());
if (bCreatedDevice)
if (!DefineDosDevice(DDD_RAW_TARGET_PATH |
DDD_REMOVE_DEFINITION
|DDD_EXACT_MATCH_ON_REMOVE,lpAdapterName,LinkName))
{
ErrorNumber = GetLastError();
printf("DefineDosDevice returned an
error creating the device = %d\n", ErrorNumber);
return( ErrorNumber );
}
return( nResult );
}