ntdll-SystemModuleInformation: Add more patches for League of Legends.

This commit is contained in:
Zebediah Figura 2019-04-12 20:10:26 -05:00
parent a36ea2ace3
commit 56174c3307
4 changed files with 135 additions and 2 deletions

View File

@ -0,0 +1,60 @@
From 4ae8c8dcc501081481fd07302f7cba16d19ecda6 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 12 Apr 2019 20:04:03 -0500
Subject: [PATCH 2/3] ntdll: Return ntdll.dll as the first entry for
SystemModuleInformation.
---
dlls/ntdll/nt.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 7cc5d81b2..df3c40fcc 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2352,6 +2352,33 @@ BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
}
+static void get_ntdll_system_module(SYSTEM_MODULE *sm)
+{
+ char *ptr;
+ ANSI_STRING str;
+ PLIST_ENTRY entry;
+ PLDR_MODULE mod;
+
+ /* The first entry must be ntdll. */
+ entry = NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList.Flink;
+ mod = CONTAINING_RECORD(entry, LDR_MODULE, InLoadOrderModuleList);
+
+ sm->Reserved1 = 0;
+ sm->Reserved2 = 0;
+ sm->ImageBaseAddress = mod->BaseAddress;
+ sm->ImageSize = mod->SizeOfImage;
+ sm->Flags = mod->Flags;
+ sm->Id = 0;
+ sm->Rank = 0;
+ sm->Unknown = 0;
+ str.Length = 0;
+ str.MaximumLength = MAXIMUM_FILENAME_LENGTH;
+ str.Buffer = (char*)sm->Name;
+ RtlUnicodeStringToAnsiString(&str, &mod->FullDllName, FALSE);
+ ptr = strrchr(str.Buffer, '\\');
+ sm->NameOffset = (ptr != NULL) ? (ptr - str.Buffer + 1) : 0;
+}
+
/******************************************************************************
* NtQuerySystemInformation [NTDLL.@]
* ZwQuerySystemInformation [NTDLL.@]
@@ -2780,7 +2807,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
FIXME("returning fake driver list\n");
smi->ModulesCount = 1;
- memset(&smi->Modules[0], 0, sizeof(smi->Modules[0]));
+ get_ntdll_system_module(&smi->Modules[0]);
ret = STATUS_SUCCESS;
}
break;
--
2.21.0

View File

@ -0,0 +1,66 @@
From dbe17b07a502aa2fc29f9e382adccf8bdc211824 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 12 Apr 2019 20:06:08 -0500
Subject: [PATCH] ntdll: Add stub for
NtQuerySystemInformation(SystemModuleInformationEx).
---
dlls/ntdll/nt.c | 21 +++++++++++++++++++++
include/winternl.h | 9 +++++++++
2 files changed, 30 insertions(+)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index ea740ac81..77b64cac0 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2622,6 +2622,27 @@ NTSTATUS WINAPI NtQuerySystemInformation(
ret = STATUS_SUCCESS;
}
break;
+ case SystemModuleInformationEx:
+ if (!SystemInformation)
+ ret = STATUS_ACCESS_VIOLATION;
+ else if (Length < sizeof(SYSTEM_MODULE_INFORMATION_EX))
+ {
+ len = sizeof(SYSTEM_MODULE_INFORMATION_EX);
+ ret = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ else
+ {
+ SYSTEM_MODULE_INFORMATION_EX *info = SystemInformation;
+
+ FIXME("info_class SystemModuleInformationEx stub!\n");
+ get_ntdll_system_module(&info->BaseInfo);
+ info->NextOffset = 0;
+ info->ImageCheckSum = 0;
+ info->TimeDateStamp = 0;
+ info->DefaultBase = info->BaseInfo.ImageBaseAddress;
+ ret = STATUS_SUCCESS;
+ }
+ break;
case SystemHandleInformation:
{
struct handle_info *info;
diff --git a/include/winternl.h b/include/winternl.h
index 2b3fb947b..613f55701 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2272,6 +2272,15 @@ typedef struct _SYSTEM_MODULE_INFORMATION
SYSTEM_MODULE Modules[1]; /* FIXME: should be Modules[0] */
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
+typedef struct _SYSTEM_MODULE_INFORMATION_EX
+{
+ ULONG NextOffset;
+ SYSTEM_MODULE BaseInfo;
+ ULONG ImageCheckSum;
+ ULONG TimeDateStamp;
+ void *DefaultBase;
+} SYSTEM_MODULE_INFORMATION_EX, *PSYSTEM_MODULE_INFORMATION_EX;
+
#define THREAD_CREATE_FLAGS_CREATE_SUSPENDED 0x00000001
#define THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH 0x00000002
#define THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER 0x00000004
--
2.21.0

View File

@ -1 +1,2 @@
Fixes: [45550] League of Legends 8.15+ anticheat fails due to incorrect implementation of NtQuerySystemInformation(SystemModuleInformation)
Fixes: [45550] League of Legends 8.15+ anticheat fails due to incorrect implementation of NtQuerySystemInformation(SystemModuleInformation)
Fixes: [45666] League of Legends 8.15+ fails due to missing implementation of NtQuerySystemInformation(SystemModuleInformationEx) in Windows Vista+ mode

View File

@ -5150,14 +5150,20 @@ fi
# | This patchset fixes the following Wine bugs:
# | * [#45550] League of Legends 8.15+ anticheat fails due to incorrect implementation of
# | NtQuerySystemInformation(SystemModuleInformation)
# | * [#45666] League of Legends 8.15+ fails due to missing implementation of
# | NtQuerySystemInformation(SystemModuleInformationEx) in Windows Vista+ mode
# |
# | Modified files:
# | * dlls/ntdll/nt.c
# | * dlls/ntdll/nt.c, include/winternl.h
# |
if test "$enable_ntdll_SystemModuleInformation" -eq 1; then
patch_apply ntdll-SystemModuleInformation/0001-ntdll-Don-t-call-LdrQueryProcessModuleInformation-in.patch
patch_apply ntdll-SystemModuleInformation/0002-ntdll-Return-ntdll.dll-as-the-first-entry-for-System.patch
patch_apply ntdll-SystemModuleInformation/0003-ntdll-Add-stub-for-NtQuerySystemInformation-SystemMo.patch
(
printf '%s\n' '+ { "Zebediah Figura", "ntdll: Don'\''t call LdrQueryProcessModuleInformation in NtQuerySystemInformation(SystemModuleInformation).", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Return ntdll.dll as the first entry for SystemModuleInformation.", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Add stub for NtQuerySystemInformation(SystemModuleInformationEx).", 1 },';
) >> "$patchlist"
fi