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

Inconsistent TEB definitions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Fix Version/s: 0.4.12
    • Component/s: None
    • Labels:
      None

      Description

      While implementing service tag support in advapi32 I felt on something really weird.

      I set service tag that way:

          /* Set service tag */
          Teb = NtCurrentTeb();
          Teb->SubProcessTag = (PVOID)ThreadParams->dwServiceTag;
      

      Then, in advapi32_apitest, I read it that way:

          Teb = NtCurrentTeb();
          service_ok(Teb->SubProcessTag != 0, "SubProcessTag is not defined!\n");
      

      The test works fine in W2K3 SP2, but fails in ReactOS, in spite of my code properly setting it.

      Reversing both advapi32 and advapi32_apitest built with GCC Lin shows that:
      advapi32 modifies:

      7c47be64         mov        esi, dword [fs:0x18]
      7c47be6b         mov        edi, dword [ebx+0xc]
      7c47be6e         mov        dword [esi+0xf60], edi
      

      advapi32_apitest reads:

      0040f828         mov        ebx, dword [fs:0x18]
      0040f82f         mov        esi, dword [ebx+0xf64]
       

      Either we have a major build issue, or, we rather have a TEB definition issue.
      Whatever the reason, advapi32_apitest is right. SubProcessTag is at offset 0xf64, hence the fact the test works on W2K3 SP2.

        Attachments

          Activity

            People

            • Assignee:
              Heis Spiter Pierre Schweitzer
              Reporter:
              Heis Spiter Pierre Schweitzer
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: