我在WIFI加载的时候,在走到NdisReadConfiguration这个函数时,NdisReadConfiguration调用失败,谁知道是什么原因呀?
LZ,你看看函数的返回值、或用GetLastError()
看不到代码,如果能知道原因,可真是神奇!
早上好,/////////////////////////////////////////////////////////////////////////////
NDIS_STATUS SDNdisGetSDDeviceHandle(PMRVDRV_ADAPTER pAdapter)
{
NDIS_STATUS status; // intermediate status
NDIS_HANDLE configHandle;
NDIS_STRING activePathKey = NDIS_STRING_CONST("Active");//ActivePath
PNDIS_CONFIGURATION_PARAMETER pConfigParm;
// open a handle to our configuration in the registry
NdisOpenConfiguration(&status,
&configHandle,
pAdapter->ConfigurationHandle);
if (!NDIS_SUCCESS(status)) {
DBGPRINT(DBG_LOAD | DBG_ERROR,
(L"SDNdis: NdisOpenConfiguration failed (0x%08X)\n",
status));
return status;
}
// read the ActivePath key set by the NDIS loader driver
NdisReadConfiguration(&status,
&pConfigParm,
configHandle,
&activePathKey,
NdisParameterString);
if (!NDIS_SUCCESS(status))
{
if(NDIS_STATUS_RESOURCES == status)
{
RETAILMSG(1, (L"***!!!!!!!!!!!!!!!NdisReadConfiguration NDIS_STATUS_RESOURCES\r\n"));
}
DBGPRINT(DBG_LOAD | DBG_ERROR,
(L"SDNdis: Failed to get active path key (0x%08X)\n",
status));
// close our registry configuration
NdisCloseConfiguration(configHandle);
return status;
}
if (NdisParameterString != pConfigParm->ParameterType) {
DBGPRINT(DBG_LOAD | DBG_ERROR,
(L"SDNdis: PARAMETER TYPE NOT STRING!!!\n"));
// close our registry configuration
NdisCloseConfiguration(configHandle);
return status;
}
if (pConfigParm->ParameterData.StringData.Length > sizeof(pAdapter->ActivePath)) {
DBGPRINT(DBG_LOAD | DBG_ERROR,
(L"SDNdis: Active path too long!\n"));
NdisCloseConfiguration(configHandle);
return NDIS_STATUS_FAILURE;
}
// copy the counted string over
memcpy(pAdapter->ActivePath,
pConfigParm->ParameterData.StringData.Buffer,
pConfigParm->ParameterData.StringData.Length);
if ( pConfigParm->ParameterData.StringData.Length == 0 )
{
DBGPRINT(DBG_LOAD | DBG_WARNING,
(L"SDNdis: Active path str length is 0, perhaps no card!\n"));
NdisCloseConfiguration(configHandle);
return NDIS_STATUS_FAILURE;
}else{
DBGPRINT(DBG_LOAD | DBG_WARNING,
(L"SDNdis: Active path str == %s\n",pConfigParm->ParameterData.StringData.Buffer));
}
NdisCloseConfiguration(configHandle);
DBGPRINT(DBG_LOAD | DBG_LOAD,
(L"SDNdis: Active Path Retrieved: %s \n",pAdapter->ActivePath));
// now get the device handle
pAdapter->hDevice = SDGetDeviceHandle((DWORD)pAdapter->ActivePath, NULL);
return NDIS_STATUS_SUCCESS;
}
这个函数走到NdisReadConfiguration时失败,请问这是什么原因呀?谢谢 !
我把嵌入式板块的wifi所有帖子都看完,不信搞不懂。哈哈哈。