WmipSecurityMethod

NTSTATUS __stdcall WmipSecurityMethod(
        VOID *Object,
        _SECURITY_OPERATION_CODE OperationCode,
        UINT64 *SecurityInformation,
        VOID *SecurityDescriptor,
        UINT64 *CapturedLength,
        VOID **ObjectsSecurityDescriptor,
        POOL_TYPE PoolType,
        PGENERIC_MAPPING GenericMapping,
        CHAR Mode){
  __int32 v10; 
  __int32 v11; 
  int v13; 
  UINT64 v14; 
  VOID **PoolWithTag; 
  VOID **v16; 
  VOID **v17; 
  VOID **v18; 
  UINT64 Length; 
  _UNICODE_STRING DestinationString; 
  WCHAR pszDest[40]; 

  if( OperationCode )
  {
    v10 = OperationCode - 1;
    if( v10 )
    {
      v11 = v10 - 1;
      if( v11 )
      {
        if( v11 != 1 )
          KeBugCheckEx(0x29u, (PVOID)1, (PVOID)0xFFFFFFFFC000000Di64, 0i64, 0i64);
        return ObAssignObjectSecurityDescriptor(Object, SecurityDescriptor, (POOL_TYPE)GenericMapping);
      }
      else
      {
        return ObDeassignSecurity(ObjectsSecurityDescriptor);
      }
    }
    else
    {
      return ObQuerySecurityDescriptorInfo(Object, SecurityInformation, SecurityDescriptor, CapturedLength, v17);
    }
  }
  else
  {
    DestinationString = 0i64;
    v13 = ObSetSecurityDescriptorInfo(
            Object,
            SecurityInformation,
            SecurityDescriptor,
            ObjectsSecurityDescriptor,
            PoolType,
            GenericMapping);
    if( v13 >= 0 )
    {
      v14 = 1024i64;
      LODWORD(Length) = 1024;
      while( 1 )
      {
        PoolWithTag = ExAllocatePoolWithTag((unsigned int)PoolType, v14, 1885957463i64);
        v16 = PoolWithTag;
        if( !PoolWithTag )
          break;
        HIDWORD(Length) = -1;
        v13 = ObQuerySecurityDescriptorInfo(Object, (UINT64 *)((char *)&Length + 4), PoolWithTag, &Length, v18);
        if( v13 != -1073741789 )
          goto LABEL_12;
        ExFreePoolWithTag(v16, 0);
        v14 = (unsigned int)Length;
      }
      v13 = -1073741670;
LABEL_12:
      if( v13 >= 0 )
      {
        RtlStringCbPrintfW(pszDest, 0x4Cui64, (WCHAR *)L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x");
        RtlInitUnicodeString(&DestinationString, pszDest);
        v13 = WmipSaveGuidSecurityDescriptor(&DestinationString, v16);
        ExFreePoolWithTag(v16, 0);
      }
    }
    return v13;
  }
}

Referenced by:

No references.