CmAddPanelDeviceWorker
NTSTATUS __fastcall CmAddPanelDeviceWorker(VOID *ProcessHandle, VOID *BaseAddress, const WCHAR *a3, _BYTE *a4){
NTSTATUS v8;
UINT64 v9;
int v10;
int Value;
__int64 v12;
VOID *v13;
_BYTE *arg20;
_BYTE *arg20a;
UINT64 pRegDisposition;
UINT64 v18;
VOID *Handle;
char v20;
v18 = 0i64;
Handle = 0i64;
LODWORD(pRegDisposition) = 0;
*a4 = 0;
v20 = 0;
v8 = CmCreateDevicePanel((HPNPCTX *)ProcessHandle, (WCHAR *)BaseAddress, (INT64)a3, (VOID **)&v18, &v20);
v9 = v18;
v10 = v8;
if( v8 >= 0 )
{
LODWORD(arg20) = 7;
v10 = PnpCtxRegCreateKey(
(HPNPCTX *)ProcessHandle,
(VOID *)v18,
(WCHAR *)L"Devices",
0i64,
(UINT64)arg20,
0i64,
&Handle,
&pRegDisposition);
if( v10 >= 0 )
{
if( (_DWORD)pRegDisposition == 2 )
{
LODWORD(v18) = 0;
Value = RegRtlQueryValue(Handle, a3, 0i64, 0i64, (__int64)&v18);
v10 = Value;
if( Value == -1073741772 || Value == -1073741444 )
{
v10 = 0;
}
else if( !Value )
{
*a4 = 1;
goto LABEL_24;
}
}
if( v10 >= 0 && !*a4 )
{
LODWORD(arg20a) = 0;
v10 = RegRtlSetValue(Handle, a3, 0, 0i64, (UINT64)arg20a);
if( v10 >= 0 )
PnpObjectRaisePropertyChangeEvent(
(__int64)ProcessHandle,
(INT64)a3,
1i64,
0i64,
0i64,
(__int64)&DEVPKEY_Device_PanelId);
}
}
}
if( v10 == -1073741444 )
v10 = -1073741772;
if( v10 < 0 )
{
if( (_DWORD)pRegDisposition == 1 )
{
if( ProcessHandle && (v12 = *((_QWORD *)ProcessHandle + 28)) != 0 )
v13 = *(VOID **)(v12 + 8);
else
v13 = 0i64;
RegRtlDeleteKeyTransacted(Handle, 0i64, v13);
}
if( v20 == 1 )
CmDeleteDevicePanel(ProcessHandle, BaseAddress);
}
LABEL_24:
if( Handle )
ZwClose((_HANDLE)Handle);
if( v9 )
ZwClose(v9);
return v10;
}Referenced by:
CmAddPanelDevice