PipHardwareConfigActivateService

NTSTATUS __stdcall PipHardwareConfigActivateService(WCHAR *ServiceName){
  __int64 v1; 
  int v2; 
  int v3; 
  __int64 v4; 
  VOID *v5; 
  VOID *v6; 
  _UNICODE_STRING ServiceKeyName; 
  VOID *ServiceHandle; 

  ServiceHandle = 0i64;
  ServiceKeyName = 0i64;
  if( !ServiceName )
    return -1073741811;
  RtlInitUnicodeString(&ServiceKeyName, ServiceName);
  v2 = PiOpenDriverRedirectedStateKey(&ServiceKeyName.Length, v1, &ServiceHandle);
  if( v2 == -1073741275 )
  {
    v3 = 0;
  }
  else if( v2 >= 0 || (v3 = PipOpenServiceEnumKeys(&ServiceKeyName, 0x10000ui64, &ServiceHandle, 0i64, 0), v3 >= 0) )
  {
    if( *(&stru_140CF2E80 + 607) && (v4 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64)) != 0 )
      v5 = *(VOID **)(v4 + 8);
    else
      v5 = 0i64;
    v6 = ServiceHandle;
    v3 = RegRtlDeleteTreeInternal(ServiceHandle, (WCHAR *)L"StartOverride", v5, 0);
    if( v3 == -1073741772 )
      v3 = 0;
    goto LABEL_10;
  }
  v6 = ServiceHandle;
LABEL_10:
  if( v6 )
    ZwClose((_HANDLE)v6);
  return v3;
}

Referenced by:

PiDevCfgConfigureDevice