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
          Jan Roeloffzen
        2. bootcd-39648-dbg.JPG
          66 kB
          Jan Roeloffzen
        3. bootcd-39648-dbg.JPG
          66 kB
          Jan Roeloffzen
        4. perfdata.c.patch
          2 kB
          Jan Roeloffzen
        5. perfdata.c.patch
          0.9 kB
          Jan Roeloffzen
        6. perfdata.c.patch
          2 kB
          Jan Roeloffzen
        7. Process.jpg
          793 kB
          bolt
        8. ProcessDebug.jpg
          359 kB
          bolt
        9. ProcessInfo error.jpg
          144 kB
          bolt
        10. ProcessNameLength20090131.diff
          8 kB
          bolt
        11. ProcessNameLength20090131.jpg
          154 kB
          bolt
        12. ProcessNameLength20090221.diff
          17 kB
          bolt
        13. ProcessTest.jpg
          360 kB
          bolt
        14. sysinfo.patch
          5 kB
          bolt

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: