Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-11978

[PATCH] Fixing the returned handle count in QSISystemHandleInformation(...) (72609)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • NTCore

    Description

      Hello,

      This patch fixes the rogue handle count in QSISystemHandleInformation(...). As of now the handles count is incremented even if ExpLockHandleTableEntry() returns FALSE:

      /* Increase of count of handles */
                      ++HandleInformation->NumberOfHandles;
       
                      /* Lock the entry */
                      if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
                      {
                          /* Increase required buffer size */
                          *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
       
                          /* Check user's buffer size */
                          if (*ReqSize > Size)
                          {
                              Status = STATUS_INFO_LENGTH_MISMATCH;
                          }
                          else
                          {
                              POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
       
                              /* Filling handle information */
                              HandleInformation->Handles[Index].UniqueProcessId =
                                  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
       
                              HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
       
      #if 0 /* FIXME!!! Type field currupted */
                              HandleInformation->Handles[Index].ObjectTypeIndex =
                                  (UCHAR) ObjectHeader->Type->Index;
      #else
                              HandleInformation->Handles[Index].ObjectTypeIndex = 0;
      #endif
       
                              HandleInformation->Handles[Index].HandleAttributes =
                                  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
       
                              HandleInformation->Handles[Index].HandleValue =
                                  (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
       
                              HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
       
                              HandleInformation->Handles[Index].GrantedAccess =
                                  HandleTableEntry->GrantedAccess;
       
                              ++Index;
                          }

      This results in a mismatch between data in HandleInformation->Handles and HandleInformation->NumberOfHandles.

      Attachments

        Issue Links

          Activity

            People

              bug zilla Bug Zilla
              vshcherbyna vshcherbyna
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: