[ros-dev] [ros-diffs] [hbelusca] 58235: [SMSS] Load the Win32k driver from the path mentioned in the Kmode value of the registry, not via a hardcoded value.

Alex Ionescu ionucu at videotron.ca
Mon Jan 28 05:11:35 UTC 2013


It existed because back in the day this interface was thought to be
generic for all subsystem drivers.

Then hackers abused it, so it was changed to be hardcoded -- the value
remained only for compatibility and correctness.

Subsystem drivers (such as psxdrv.sys) are now regular automatic-start services.

Best regards,
Alex Ionescu


On Mon, Jan 28, 2013 at 12:53 AM, Hermès BÉLUSCA - MAÏTO
<hermes.belusca at sfr.fr> wrote:
> That's strange indeed, as if Windows only accepted the win32k module be
> present only in \SystemRoot\System32 and be named win32k.sys.
> I'm thus wondering why the KMode value exists, so.
>
> Regards,
> Hermès
>
> PS: I'm going to revert the change asap.
>
> -----Message d'origine-----
> De : ros-dev-bounces at reactos.org [mailto:ros-dev-bounces at reactos.org] De la
> part de Alex Ionescu
> Envoyé : dimanche 27 janvier 2013 07:59
> À : ros-dev at reactos.org
> Cc : ros-diffs at reactos.org
> Objet : Re: [ros-dev] [ros-diffs] [hbelusca] 58235: [SMSS] Load the Win32k
> driver from the path mentioned in the Kmode value of the registry, not via a
> hardcoded value.
>
> This change is not correct. The kmode value is ignored and the system call
> only accepts the hardcoded path.
>
> I've asked you repeatedly to review with me before you change my code.
>
> Best regards,
> Alex Ionescu
>
>
> On Sat, Jan 26, 2013 at 3:43 PM,  <hbelusca at svn.reactos.org> wrote:
>> Author: hbelusca
>> Date: Sat Jan 26 23:43:28 2013
>> New Revision: 58235
>>
>> URL: http://svn.reactos.org/svn/reactos?rev=58235&view=rev
>> Log:
>> [SMSS]
>> Load the Win32k driver from the path mentioned in the Kmode value of the
> registry, not via a hardcoded value.
>>
>> Modified:
>>     trunk/reactos/base/system/smss/smsubsys.c
>>
>> Modified: trunk/reactos/base/system/smss/smsubsys.c
>> URL:
>> http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/smsu
>> bsys.c?rev=58235&r1=58234&r2=58235&view=diff
>> ======================================================================
>> ========
>> --- trunk/reactos/base/system/smss/smsubsys.c [iso-8859-1] (original)
>> +++ trunk/reactos/base/system/smss/smsubsys.c [iso-8859-1] Sat Jan 26
>> +++ 23:43:28 2013
>> @@ -515,7 +515,7 @@
>>  {
>>      NTSTATUS Status = STATUS_SUCCESS, Status2;
>>      PSMP_REGISTRY_VALUE RegEntry;
>> -    UNICODE_STRING DestinationString, NtPath;
>> +    UNICODE_STRING NtPath;
>>      PLIST_ENTRY NextEntry;
>>      LARGE_INTEGER Timeout;
>>      PVOID State;
>> @@ -539,7 +539,7 @@
>>      {
>>          /* Get the entry and check if this is the special Win32k entry */
>>          RegEntry = CONTAINING_RECORD(NextEntry, SMP_REGISTRY_VALUE,
> Entry);
>> -        if (!_wcsicmp(RegEntry->Name.Buffer, L"Kmode"))
>> +        if (_wcsicmp(RegEntry->Name.Buffer, L"Kmode") == 0)
>>          {
>>              /* Translate it */
>>              if (!RtlDosPathNameToNtPathName_U(RegEntry->Value.Buffer,
>> @@ -571,11 +571,9 @@
>>                      AttachedSessionId = *MuSessionId;
>>
>>                      /* Start Win32k.sys on this session */
>> -                    RtlInitUnicodeString(&DestinationString,
>> -
> L"\\SystemRoot\\System32\\win32k.sys");
>>                      Status =
> NtSetSystemInformation(SystemExtendServiceTableInformation,
>> -                                                    &DestinationString,
>> -
> sizeof(DestinationString));
>> +                                                    &NtPath,
>> +                                                    sizeof(NtPath));
>>                      RtlFreeHeap(RtlGetProcessHeap(), 0, NtPath.Buffer);
>>                      SmpReleasePrivilege(State);
>>                      if (!NT_SUCCESS(Status)) @@ -597,21 +595,21 @@
>>      {
>>          /* Get each entry and check if it's the internal debug or not */
>>          RegEntry = CONTAINING_RECORD(NextEntry, SMP_REGISTRY_VALUE,
> Entry);
>> -        if (_wcsicmp(RegEntry->Name.Buffer, L"debug"))
>> +        if (_wcsicmp(RegEntry->Name.Buffer, L"debug") == 0)
>> +        {
>> +            /* Load the internal debug system */
>> +            Status = SmpExecuteCommand(&RegEntry->Value,
>> +                                       *MuSessionId,
>> +                                       ProcessId,
>> +                                       SMP_DEBUG_FLAG |
> SMP_SUBSYSTEM_FLAG);
>> +        }
>> +        else
>>          {
>>              /* Load the required subsystem */
>>              Status = SmpExecuteCommand(&RegEntry->Value,
>>                                         *MuSessionId,
>>                                         ProcessId,
>>                                         SMP_SUBSYSTEM_FLAG);
>> -        }
>> -        else
>> -        {
>> -            /* Load the internal debug system */
>> -            Status = SmpExecuteCommand(&RegEntry->Value,
>> -                                       *MuSessionId,
>> -                                       ProcessId,
>> -                                       SMP_DEBUG_FLAG |
> SMP_SUBSYSTEM_FLAG);
>>          }
>>          if (!NT_SUCCESS(Status))
>>          {
>>
>>
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev



More information about the Ros-dev mailing list