PipResetDevice
NTSTATUS __stdcall PipResetDevice(HPNPCTX *hPnpCtx, WCHAR *DeviceInstanceId){
__int64 v4;
NTSTATUS v5;
NTSTATUS v6;
NTSTATUS v7;
int v8;
int v9;
UINT64 *CmRegPropType;
UINT64 *PropertySize;
UINT64 v13;
UINT64 v14;
UINT64 v15;
UINT64 v16;
UINT8 v17[4];
_UNICODE_STRING DestinationString;
_GUID Guid;
UINT8 PropertyBuffer[80];
*(_DWORD *)v17 = 0;
HIDWORD(v16) = 0;
Guid = 0i64;
DestinationString = 0i64;
DbgPrintEx(0x20u, 0, "Resetting device '%ws'\n", DeviceInstanceId);
if( PipResetDeviceBreakOnReset )
__debugbreak();
LODWORD(v13) = 0;
LODWORD(v16) = 78;
if( CmGetDeviceRegProp(
hPnpCtx,
DeviceInstanceId,
0i64,
9i64,
(UINT64 *)((char *)&v16 + 4),
PropertyBuffer,
&v16,
v13) < 0
|| HIDWORD(v16) != 1
|| (unsigned int)v16 < 2
|| RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)PropertyBuffer) < 0
|| RtlGUIDFromString(&DestinationString, &Guid) < 0 )
{
Guid = 0i64;
}
if( CmIsRootEnumeratedDevice(DeviceInstanceId) )
goto LABEL_14;
v4 = *(_QWORD *)&Guid.Data1 - 0x11CEE3254D36E968i64;
if( *(_QWORD *)&Guid.Data1 == 0x11CEE3254D36E968i64 )
v4 = *(_QWORD *)Guid.Data4 - 0x1803E12B0008C1BFi64;
if( v4 )
return CmDeleteDevice(hPnpCtx, DeviceInstanceId, 0i64);
LABEL_14:
v6 = CmDeleteDeviceRegKey((INT64)hPnpCtx, DeviceInstanceId, 0x11ui64, 0i64);
v5 = 0;
if( v6 < 0 )
v5 = v6;
v7 = CmDeleteDeviceRegKey((INT64)hPnpCtx, DeviceInstanceId, 0x12ui64, 0i64);
if( v5 >= 0 && v7 < 0 )
v5 = v7;
LODWORD(v14) = 0;
LODWORD(v16) = 4;
if( CmGetDeviceRegProp(hPnpCtx, DeviceInstanceId, 0i64, 11i64, (UINT64 *)((char *)&v16 + 4), v17, &v16, v14) >= 0
&& v16 == 0x400000004i64 )
{
v8 = *(_DWORD *)v17;
}
else
{
v8 = 0;
}
if( (v8 & 0x20) == 0 )
{
LODWORD(v15) = 0;
*(_DWORD *)v17 = v8 | 0x20;
LODWORD(PropertySize) = 4;
LODWORD(CmRegPropType) = 4;
v9 = CmSetDeviceRegProp(
hPnpCtx,
DeviceInstanceId,
0i64,
CM_REG_PROP_CONFIGFLAGS,
(UINT64)CmRegPropType,
v17,
(UINT64)PropertySize,
v15);
if( v5 >= 0 && v9 < 0 )
return v9;
}
return v5;
}Referenced by:
PipResetDevices