api: avoid call to CM_Get_DevNode_Status
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
dfa53185d0
commit
99097022fe
@ -1295,22 +1295,12 @@ CreateAdapter(
|
|||||||
goto cleanupTcpipInterfaceRegKey;
|
goto cleanupTcpipInterfaceRegKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG Status, ProblemCode;
|
|
||||||
Result = CM_MapCrToWin32Err(
|
|
||||||
CM_Get_DevNode_Status(&Status, &ProblemCode, DevInfoData.DevInst, 0), ERROR_DEVICE_NOT_AVAILABLE);
|
|
||||||
if (Result != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
LOG_ERROR(L"Failed to get status of adapter", Result);
|
|
||||||
goto cleanupTcpipInterfaceRegKey;
|
|
||||||
}
|
|
||||||
if (Status & DN_HAS_PROBLEM)
|
|
||||||
{
|
|
||||||
/* TODO: This GUIDs is in devpkey.h, but we can't link to it? Which dll? */
|
/* TODO: This GUIDs is in devpkey.h, but we can't link to it? Which dll? */
|
||||||
static const DEVPROPKEY DEVPKEY_Device_ProblemStatus = {
|
static const DEVPROPKEY DEVPKEY_Device_ProblemStatus = {
|
||||||
{ 0x4340a6c5, 0x93fa, 0x4706, { 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7 } }, 12
|
{ 0x4340a6c5, 0x93fa, 0x4706, { 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7 } }, 12
|
||||||
};
|
};
|
||||||
DEVPROPTYPE PropertyType;
|
DEVPROPTYPE PropertyType;
|
||||||
for (int Tries = 0; Tries < 1000; Sleep(10), ++Tries)
|
for (int Tries = 0; Tries < 1000; ++Tries)
|
||||||
{
|
{
|
||||||
NTSTATUS ProblemStatus;
|
NTSTATUS ProblemStatus;
|
||||||
if (SetupDiGetDevicePropertyW(
|
if (SetupDiGetDevicePropertyW(
|
||||||
@ -1330,12 +1320,11 @@ CreateAdapter(
|
|||||||
LOG_ERROR(L"Failed to setup adapter", Result);
|
LOG_ERROR(L"Failed to setup adapter", Result);
|
||||||
goto cleanupTcpipInterfaceRegKey;
|
goto cleanupTcpipInterfaceRegKey;
|
||||||
}
|
}
|
||||||
|
Sleep(10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG(WINTUN_LOG_WARN, L"Adapter setup error code vanished after initially there");
|
|
||||||
}
|
|
||||||
|
|
||||||
*Adapter = a;
|
*Adapter = a;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user