PnprLoadPluginDriver

INT64 __stdcall PnprLoadPluginDriver(PVOID *ImageHandle, _PNP_REPLACE_DRIVER_INTERFACE *DriverInterface){
  WCHAR v2; 
  int PluginDriverImagePath; 
  UINT64 v6; 
  int v7; 
  int v8; 
  ULONG_PTR v9; 
  int v10; 
  struct _UNICODE_STRING DestinationString; 
  ULONG_PTR BugCheckParameter2; 
  INT64 a6; 
  a6 = 0i64;
  BugCheckParameter2 = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, 0i64, v2);
  PluginDriverImagePath = PnprGetPluginDriverImagePath(&DestinationString);
  if( PluginDriverImagePath >= 0 )
  {
    PluginDriverImagePath = MmLoadSystemImageEx(
                              &DestinationString,
                              0i64,
                              0i64,
                              2ui64,
                              (INT64)&BugCheckParameter2,
                              (INT64)&a6);
    if( PluginDriverImagePath >= 0 )
    {
      memset((INT64)&DriverInterface->Flags, 0i64);
      v9 = BugCheckParameter2;
      DriverInterface->Version = 1;
      DriverInterface->Size = 96;
      PluginDriverImagePath = (*(__int64(__fastcall **)(_PNP_REPLACE_DRIVER_INTERFACE *, _QWORD))(v9 + 56))(
                                DriverInterface,
                                0i64);
      if( PluginDriverImagePath >= 0 )
      {
        if( DriverInterface->Size >= 0x40
          && DriverInterface->Swap
          && DriverInterface->BeginReplace
          && DriverInterface->EndReplace )
        {
          PluginDriverImagePath = 0;
          *ImageHandle = (PVOID)BugCheckParameter2;
          goto LABEL_23;
        }
        v6 = PnprContext;
        PluginDriverImagePath = -1073741637;
        v7 = *(_DWORD *)(PnprContext + 20984);
        if( !v7 )
          v7 = 4887;
        v8 = 9;
      }
      else
      {
        v6 = PnprContext;
        v7 = *(_DWORD *)(PnprContext + 20984);
        if( !v7 )
          v7 = 4871;
        v8 = 8;
      }
    }
    else
    {
      v6 = PnprContext;
      v7 = *(_DWORD *)(PnprContext + 20984);
      if( !v7 )
        v7 = 4857;
      v8 = 10;
    }
    *(_DWORD *)(v6 + 20984) = v7;
    v10 = *(_DWORD *)(v6 + 20988);
    if( !v10 )
      v10 = v8;
    *(_DWORD *)(v6 + 20988) = v10;
  }
  if( BugCheckParameter2 )
    MmUnloadSystemImage((VOID *)BugCheckParameter2);
LABEL_23:
  if( DestinationString.Buffer )
    ExFreePoolWithTag(DestinationString.Buffer, 0x51706E50u);
  return(unsigned int)PluginDriverImagePath;
}

Referenced by:

No references.