Load the Win32k driver from the path mentioned in the Kmode value of the registry, not via a hardcoded value.

svn path=/trunk/; revision=58235
This commit is contained in:
Hermès Bélusca-Maïto 2013-01-26 23:43:28 +00:00
parent 4ad0f2245b
commit 3f7404e73b

View file

@ -515,7 +515,7 @@ SmpLoadSubSystemsForMuSession(IN PULONG MuSessionId,
{ {
NTSTATUS Status = STATUS_SUCCESS, Status2; NTSTATUS Status = STATUS_SUCCESS, Status2;
PSMP_REGISTRY_VALUE RegEntry; PSMP_REGISTRY_VALUE RegEntry;
UNICODE_STRING DestinationString, NtPath; UNICODE_STRING NtPath;
PLIST_ENTRY NextEntry; PLIST_ENTRY NextEntry;
LARGE_INTEGER Timeout; LARGE_INTEGER Timeout;
PVOID State; PVOID State;
@ -539,7 +539,7 @@ SmpLoadSubSystemsForMuSession(IN PULONG MuSessionId,
{ {
/* Get the entry and check if this is the special Win32k entry */ /* Get the entry and check if this is the special Win32k entry */
RegEntry = CONTAINING_RECORD(NextEntry, SMP_REGISTRY_VALUE, 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 */ /* Translate it */
if (!RtlDosPathNameToNtPathName_U(RegEntry->Value.Buffer, if (!RtlDosPathNameToNtPathName_U(RegEntry->Value.Buffer,
@ -571,11 +571,9 @@ SmpLoadSubSystemsForMuSession(IN PULONG MuSessionId,
AttachedSessionId = *MuSessionId; AttachedSessionId = *MuSessionId;
/* Start Win32k.sys on this session */ /* Start Win32k.sys on this session */
RtlInitUnicodeString(&DestinationString,
L"\\SystemRoot\\System32\\win32k.sys");
Status = NtSetSystemInformation(SystemExtendServiceTableInformation, Status = NtSetSystemInformation(SystemExtendServiceTableInformation,
&DestinationString, &NtPath,
sizeof(DestinationString)); sizeof(NtPath));
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPath.Buffer); RtlFreeHeap(RtlGetProcessHeap(), 0, NtPath.Buffer);
SmpReleasePrivilege(State); SmpReleasePrivilege(State);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -597,15 +595,7 @@ SmpLoadSubSystemsForMuSession(IN PULONG MuSessionId,
{ {
/* Get each entry and check if it's the internal debug or not */ /* Get each entry and check if it's the internal debug or not */
RegEntry = CONTAINING_RECORD(NextEntry, SMP_REGISTRY_VALUE, Entry); 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 required subsystem */
Status = SmpExecuteCommand(&RegEntry->Value,
*MuSessionId,
ProcessId,
SMP_SUBSYSTEM_FLAG);
}
else
{ {
/* Load the internal debug system */ /* Load the internal debug system */
Status = SmpExecuteCommand(&RegEntry->Value, Status = SmpExecuteCommand(&RegEntry->Value,
@ -613,6 +603,14 @@ SmpLoadSubSystemsForMuSession(IN PULONG MuSessionId,
ProcessId, ProcessId,
SMP_DEBUG_FLAG | SMP_SUBSYSTEM_FLAG); SMP_DEBUG_FLAG | SMP_SUBSYSTEM_FLAG);
} }
else
{
/* Load the required subsystem */
Status = SmpExecuteCommand(&RegEntry->Value,
*MuSessionId,
ProcessId,
SMP_SUBSYSTEM_FLAG);
}
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint("SMSS: Subsystem execute failed (%WZ)\n", &RegEntry->Value); DbgPrint("SMSS: Subsystem execute failed (%WZ)\n", &RegEntry->Value);