PipCommitPendingService

INT64 __fastcall PipCommitPendingService(
        const WCHAR *ServiceName,
        VOID *hPendingServicesRoot,
        VOID *hPendingService,
        VOID *Context,
        INT64 a5,
        INT64 a6,
        UINT8 a7){
  char *v8; 
  __int64 v10; 
  int CachedContextBaseKey; 
  int v12; 
  int v13; 
  INT64 v14; 
  char *v16; 
  VOID *SourceKeyHandle; 
  VOID *v18; 
  VOID *TargetKeyHandle; 
  char *v20; 
  void *v21; 
  char *v22; 
  __int64 v23; 
  v22 = 0i64;
  v8 = (char *)hPendingServicesRoot;
  TargetKeyHandle = 0i64;
  v18 = 0i64;
  v23 = 0i64;
  v16 = 0i64;
  SourceKeyHandle = 0i64;
  v20 = 0i64;
  v21 = 0i64;
  if( !hPendingServicesRoot )
  {
    CachedContextBaseKey = PnpCtxGetCachedContextBaseKey(PiPnpRtlCtx, 4, (__int64 *)&v22);
    if( CachedContextBaseKey < 0 )
      goto LABEL_28;
    CachedContextBaseKey = PnpCtxRegOpenKey(
                             PiPnpRtlCtx,
                             v22,
                             L"Control\\PendingDriverOperations\\Services",
                             0,
                             0x2001Fu,
                             (void **)&v20);
    if( CachedContextBaseKey < 0 )
      goto LABEL_28;
    v8 = v20;
  }
  if( !hPendingService )
  {
    CachedContextBaseKey = PnpCtxRegOpenKey(PiPnpRtlCtx, v8, ServiceName, 0, 0x20019u, &v21);
    if( CachedContextBaseKey < 0 )
      goto LABEL_28;
    hPendingService = v21;
  }
  v12 = PnpCtxRegOpenKey(PiPnpRtlCtx, v8, L"EventLog", 0, 0x2001Fu, (void **)&v16);
  CachedContextBaseKey = v12;
  if( v12 == -1073741772 || v12 == -1073741444 || v12 >= 0 )
  {
    v13 = PnpCtxRegOpenKey(PiPnpRtlCtx, v16, ServiceName, 0, 0x20019u, &SourceKeyHandle);
    CachedContextBaseKey = v13;
    if( v13 == -1073741772 || v13 == -1073741444 || v13 >= 0 )
    {
      CachedContextBaseKey = PnpCtxGetCachedContextBaseKey(PiPnpRtlCtx, 6, &v23);
      if( CachedContextBaseKey >= 0 )
      {
        CachedContextBaseKey = PnpCtxRegCreateKey(PiPnpRtlCtx, v23, ServiceName, 0, 0x20006u, 0i64, &v18, 0i64);
        if( CachedContextBaseKey >= 0 )
        {
          if( !SourceKeyHandle
            || (CachedContextBaseKey = PnpCtxRegCreateKey(
                                         PiPnpRtlCtx,
                                         v23,
                                         L"EventLog",
                                         0,
                                         0x20006u,
                                         0i64,
                                         &TargetKeyHandle,
                                         0i64),
                CachedContextBaseKey >= 0)
            && (!SourceKeyHandle
             || (CachedContextBaseKey = PiDevCfgCopyDeviceKeys(SourceKeyHandle, TargetKeyHandle, v14, 0i64),
                 CachedContextBaseKey >= 0)) )
          {
            CachedContextBaseKey = PiDevCfgCopyDeviceKeys(hPendingService, v18, v14, 0i64);
            if( CachedContextBaseKey >= 0 )
            {
              if( SourceKeyHandle )
              {
                CachedContextBaseKey = PnpCtxRegDeleteTree(PiPnpRtlCtx, v16, ServiceName);
                if( CachedContextBaseKey < 0 )
                  goto LABEL_28;
                LODWORD(v23) = 0;
                if( (unsigned int)PnpCtxRegEnumKey(v10, v16, 0, 0i64, (unsigned int *)&v23) == -2147483622 )
                  PnpCtxRegDeleteKey(PiPnpRtlCtx, v16, 0i64);
              }
              CachedContextBaseKey = PnpCtxRegDeleteTree(PiPnpRtlCtx, v8, ServiceName);
              if( CachedContextBaseKey >= 0 )
              {
                LODWORD(v23) = 0;
                if( (unsigned int)PnpCtxRegEnumKey(v10, v8, 0, 0i64, (unsigned int *)&v23) == -2147483622 )
                  PnpCtxRegDeleteKey(PiPnpRtlCtx, v8, 0i64);
              }
            }
          }
        }
      }
    }
  }
LABEL_28:
  if( v18 )
    PnpCtxRegCloseKey(v10, v18);
  if( TargetKeyHandle )
    PnpCtxRegCloseKey(v10, TargetKeyHandle);
  if( v16 )
    PnpCtxRegCloseKey(v10, v16);
  if( SourceKeyHandle )
    PnpCtxRegCloseKey(v10, SourceKeyHandle);
  if( v20 )
    PnpCtxRegCloseKey(v10, v20);
  if( v21 )
    PnpCtxRegCloseKey(v10, v21);
  return(unsigned int)CachedContextBaseKey;
}

Referenced by:

No references.