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

Patch: return size and structure NtQuerySystemInformation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • None
    • NTCore
    • None
    • Operating System: ReactOS
      Platform: x86 Hardware

    Description

      Created an attachment (id=3488)
      Patch file for return size and structure NtQuerySystemInformation

      1.
      const
      SystemProcessesAndThreadsInformation = 5;
      STATUS_INFO_LENGTH_MISMATCH = $C0000004;

      If you call the procedure in Windows as follows:
      Status := NtQuerySystemInformation(SystemProcessesAndThreadsInformation,
      nil, 0, ReturnLength);
      or:
      Status := NtQuerySystemInformation(SystemProcessesAndThreadsInformation,
      nil, 200, ReturnLength);
      or:
      Status := NtQuerySystemInformation(SystemProcessesAndThreadsInformation,
      SystemInformation, ReturnLength*0+100, ReturnLength);
      Windows return status STATUS_INFO_LENGTH_MISMATCH and size into ReturnLength necessary buffer
      if Status <> STATUS_INFO_LENGTH_MISMATCH then Exit;

      2.
      Debug trace value Windows.
      In any event, returns the desired size into ReturnLength.
      And never writes in the buffer until you determine the size into ReturnLength
      See attach ProcessDebug.jpg

      3.
      The amount depends on the size of the buffer allocated by ProcessName/SpiCurrent-> ImageName.Buffer
      In a detailed review found that the multiplicity of 8 bytes, and calculate:
      ImageNameLength = strlen(Process->ImageFileName) * sizeof(WCHAR);
      ImageNameMaximumLength = (ImageNameLength > 0
      ? (ImageNameLength / 8 * 8 + ((ImageNameLength % 8) >= 0 ? 1 : 0)*8)
      : 0);

      See Process.jpg

      4.And finally the most important thing is the result of my patches.

      See sysinfo.patch and execute file ProcessInfo.zip

      Attachments

        1. audit.c.patch
          0.8 kB
        2. bootcd-39648-dbg.JPG
          bootcd-39648-dbg.JPG
          66 kB
        3. bootcd-39648-dbg.JPG
          bootcd-39648-dbg.JPG
          66 kB
        4. perfdata.c.patch
          2 kB
        5. perfdata.c.patch
          0.9 kB
        6. perfdata.c.patch
          2 kB
        7. Process.jpg
          Process.jpg
          793 kB
        8. ProcessDebug.jpg
          ProcessDebug.jpg
          359 kB
        9. ProcessInfo.zip
          985 kB
        10. ProcessInfo error.jpg
          ProcessInfo error.jpg
          144 kB
        11. ProcessNameLength20090131.diff
          8 kB
        12. ProcessNameLength20090131.jpg
          ProcessNameLength20090131.jpg
          154 kB
        13. ProcessNameLength20090221.diff
          17 kB
        14. ProcessTest.jpg
          ProcessTest.jpg
          360 kB
        15. sysinfo.patch
          5 kB

        Issue Links

          Activity

            People

              fireball fireball
              bolt bolt
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: