Added patch to simulate a more realistic kernel environment in ntoskrnl/winedevice.

This commit is contained in:
Sebastian Lackner 2017-06-10 20:24:36 +02:00
parent 630ff35489
commit 05f510a1be
8 changed files with 898 additions and 2 deletions

View File

@ -0,0 +1,194 @@
From 276f9cb5ec799bb0919d8ae06609260daddc52cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 8 Jun 2017 23:54:59 +0200
Subject: ntoskrnl.exe/tests: Check ldr module order and some common kernel
drivers.
---
dlls/ntoskrnl.exe/tests/driver.sys/driver.c | 60 +++++++++++++++++++++++++++++
dlls/ntoskrnl.exe/tests/driver.sys/driver.h | 1 +
dlls/ntoskrnl.exe/tests/driver.sys/util.h | 18 +++++++++
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 7 ++++
include/ddk/ntddk.h | 1 +
5 files changed, 87 insertions(+)
diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/driver.c b/dlls/ntoskrnl.exe/tests/driver.sys/driver.c
index 39c2fb2aa50..c512f3c3f31 100644
--- a/dlls/ntoskrnl.exe/tests/driver.sys/driver.c
+++ b/dlls/ntoskrnl.exe/tests/driver.sys/driver.c
@@ -31,6 +31,7 @@
#include "winbase.h"
#include "winternl.h"
#include "winioctl.h"
+#include "ddk/ntddk.h"
#include "ddk/wdm.h"
#define WINE_KERNEL
@@ -45,6 +46,8 @@ const WCHAR driver_device[] = {'\\','D','e','v','i','c','e',
const WCHAR driver_link[] = {'\\','D','o','s','D','e','v','i','c','e','s',
'\\','W','i','n','e','T','e','s','t','D','r','i','v','e','r',0};
+static LDR_MODULE *ldr_module;
+
static void *get_system_routine(const char *name)
{
UNICODE_STRING name_u;
@@ -128,6 +131,60 @@ KERNEL_TESTCASE(ExInitializeNPagedLookasideList)
return STATUS_SUCCESS;
}
+static BOOL equal_string(ANSI_STRING *str1, const char *str2)
+{
+ if (str1->Length != kernel_strlen(str2)) return FALSE;
+ return !kernel_strncmp(str1->Buffer, str2, str1->Length);
+}
+
+KERNEL_TESTCASE(LdrModules)
+{
+ BOOL win32k = FALSE, dxgkrnl = FALSE, dxgmms1 = FALSE;
+ LIST_ENTRY *start, *entry;
+ ANSI_STRING name_a;
+ LDR_MODULE *mod;
+ NTSTATUS status;
+
+ /* Try to find start of the InLoadOrderModuleList list */
+ for (start = ldr_module->InLoadOrderModuleList.Flink; ; start = start->Flink)
+ {
+ mod = CONTAINING_RECORD(start, LDR_MODULE, InLoadOrderModuleList);
+
+ if (!MmIsAddressValid(&mod->BaseAddress) || !mod->BaseAddress) break;
+ if (!MmIsAddressValid(&mod->LoadCount) || !mod->LoadCount) break;
+ if (!MmIsAddressValid(&mod->SizeOfImage) || !mod->SizeOfImage) break;
+ if (!MmIsAddressValid(&mod->EntryPoint) || mod->EntryPoint < mod->BaseAddress ||
+ (DWORD_PTR)mod->EntryPoint > (DWORD_PTR)mod->BaseAddress + mod->SizeOfImage) break;
+ }
+
+ for (entry = start->Flink; entry != start; entry = entry->Flink)
+ {
+ mod = CONTAINING_RECORD(entry, LDR_MODULE, InLoadOrderModuleList);
+
+ status = RtlUnicodeStringToAnsiString(&name_a, &mod->BaseDllName, TRUE);
+ ok(!status, "RtlUnicodeStringToAnsiString failed with %08x\n", status);
+ if (status) continue;
+
+ if (entry == start->Flink)
+ {
+ ok(equal_string(&name_a, "ntoskrnl.exe"),
+ "Expected ntoskrnl.exe, got %.*s\n", name_a.Length, name_a.Buffer);
+ }
+
+ if (equal_string(&name_a, "win32k.sys")) win32k = TRUE;
+ if (equal_string(&name_a, "dxgkrnl.sys")) dxgkrnl = TRUE;
+ if (equal_string(&name_a, "dxgmms1.sys")) dxgmms1 = TRUE;
+
+ RtlFreeAnsiString(&name_a);
+ }
+
+ ok(win32k, "Failed to find win32k.sys\n");
+ ok(dxgkrnl, "Failed to find dxgkrnl.sys\n");
+ ok(dxgmms1, "Failed to find dxgmms1.sys\n");
+
+ return STATUS_SUCCESS;
+}
+
static NTSTATUS WINAPI driver_Create(DEVICE_OBJECT *device, IRP *irp)
{
irp->IoStatus.u.Status = STATUS_SUCCESS;
@@ -167,6 +224,7 @@ static NTSTATUS WINAPI driver_IoControl(DEVICE_OBJECT *device, IRP *irp)
DECLARE_TEST(PsGetCurrentThread);
DECLARE_TEST(NtBuildNumber);
DECLARE_TEST(ExInitializeNPagedLookasideList);
+ DECLARE_TEST(LdrModules);
default:
break;
@@ -211,6 +269,8 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry)
DbgPrint("loading driver\n");
+ ldr_module = (LDR_MODULE*)driver->DriverSection;
+
/* Allow unloading of the driver */
driver->DriverUnload = driver_Unload;
diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/driver.h b/dlls/ntoskrnl.exe/tests/driver.sys/driver.h
index b5b3ef4e027..7442aa55286 100644
--- a/dlls/ntoskrnl.exe/tests/driver.sys/driver.h
+++ b/dlls/ntoskrnl.exe/tests/driver.sys/driver.h
@@ -26,6 +26,7 @@
#define WINE_IOCTL_PsGetCurrentThread WINE_TEST_IOCTL(1)
#define WINE_IOCTL_NtBuildNumber WINE_TEST_IOCTL(2)
#define WINE_IOCTL_ExInitializeNPagedLookasideList WINE_TEST_IOCTL(3)
+#define WINE_IOCTL_LdrModules WINE_TEST_IOCTL(4)
struct test_PsGetCurrentProcessId
{
diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/util.h b/dlls/ntoskrnl.exe/tests/driver.sys/util.h
index 881a4a2952f..07c04da40fe 100644
--- a/dlls/ntoskrnl.exe/tests/driver.sys/util.h
+++ b/dlls/ntoskrnl.exe/tests/driver.sys/util.h
@@ -31,6 +31,24 @@ static inline const char* kernel_strrchr(const char *str, int character)
return ret;
}
+static inline size_t kernel_strlen(const char *str)
+{
+ const char *ptr = str;
+ while (*ptr) ptr++;
+ return ptr - str;
+}
+
+static inline int kernel_strncmp(const char *str1, const char *str2, size_t len)
+{
+ if (!len) return 0;
+ while (--len && *str1 && *str1 == *str2)
+ {
+ str1++;
+ str2++;
+ }
+ return *str1 - *str2;
+}
+
static inline void* kernel_memcpy(void *destination, const void *source, size_t num)
{
const char *src = source;
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 40e62053150..abd62520b95 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -214,6 +214,12 @@ static void test_ExInitializeNPagedLookasideList(void)
wine_run_kernel_test(device_path, WINE_IOCTL_ExInitializeNPagedLookasideList, NULL);
}
+static void test_LdrModules(void)
+{
+ trace("Running tests for LdrModules\n");
+ wine_run_kernel_test(device_path, WINE_IOCTL_LdrModules, NULL);
+}
+
START_TEST(ntoskrnl)
{
char filename[MAX_PATH];
@@ -229,6 +235,7 @@ START_TEST(ntoskrnl)
test_PsGetCurrentThread();
test_NtBuildNumber();
test_ExInitializeNPagedLookasideList();
+ test_LdrModules();
unload_driver(service, filename);
}
diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h
index 6aae257770d..7a565aae105 100644
--- a/include/ddk/ntddk.h
+++ b/include/ddk/ntddk.h
@@ -196,6 +196,7 @@ NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE,PULONG,PCONFIGURATION_
PCONFIGURATION_TYPE,PULONG,PIO_QUERY_DEVICE_ROUTINE,PVOID);
void WINAPI IoRegisterDriverReinitialization(PDRIVER_OBJECT,PDRIVER_REINITIALIZE,PVOID);
NTSTATUS WINAPI IoRegisterShutdownNotification(PDEVICE_OBJECT);
+BOOLEAN WINAPI MmIsAddressValid(void *);
NTSTATUS WINAPI PsSetLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE);
void WINAPI RtlInitializeGenericTableAvl(PRTL_AVL_TABLE,PRTL_AVL_COMPARE_ROUTINE,PRTL_AVL_ALLOCATE_ROUTINE, PRTL_AVL_FREE_ROUTINE,void *);
void WINAPI RtlInsertElementGenericTableAvl(PRTL_AVL_TABLE,void *,ULONG,BOOL*);
--
2.13.1

View File

@ -1,2 +1,3 @@
Fixes: Implement ntoskrnl driver testing framework.
Depends: ntoskrnl-Stubs
Depends: winedevice-Default_Drivers

View File

@ -434,6 +434,7 @@ patch_enable_all ()
enable_wined3d_buffer_create="$1"
enable_wined3d_wined3d_guess_gl_vendor="$1"
enable_winedbg_Process_Arguments="$1"
enable_winedevice_Default_Drivers="$1"
enable_winedevice_Fix_Relocation="$1"
enable_winemenubuilder_Desktop_Icon_Path="$1"
enable_winemp3_acm_MPEG3_StreamOpen="$1"
@ -1538,6 +1539,9 @@ patch_enable ()
winedbg-Process_Arguments)
enable_winedbg_Process_Arguments="$2"
;;
winedevice-Default_Drivers)
enable_winedevice_Default_Drivers="$2"
;;
winedevice-Fix_Relocation)
enable_winedevice_Fix_Relocation="$2"
;;
@ -2313,7 +2317,18 @@ if test "$enable_ntoskrnl_DriverTest" -eq 1; then
if test "$enable_ntoskrnl_Stubs" -gt 1; then
abort "Patchset ntoskrnl-Stubs disabled, but ntoskrnl-DriverTest depends on that."
fi
if test "$enable_winedevice_Default_Drivers" -gt 1; then
abort "Patchset winedevice-Default_Drivers disabled, but ntoskrnl-DriverTest depends on that."
fi
enable_ntoskrnl_Stubs=1
enable_winedevice_Default_Drivers=1
fi
if test "$enable_winedevice_Default_Drivers" -eq 1; then
if test "$enable_dxva2_Video_Decoder" -gt 1; then
abort "Patchset dxva2-Video_Decoder disabled, but winedevice-Default_Drivers depends on that."
fi
enable_dxva2_Video_Decoder=1
fi
if test "$enable_ntoskrnl_Stubs" -eq 1; then
@ -6316,17 +6331,41 @@ if test "$enable_ntoskrnl_Stubs" -eq 1; then
) >> "$patchlist"
fi
# Patchset winedevice-Default_Drivers
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * dxva2-Video_Decoder
# |
# | Modified files:
# | * configure.ac, dlls/dxgkrnl.sys/Makefile.in, dlls/dxgkrnl.sys/dxgkrnl.sys.spec, dlls/dxgkrnl.sys/main.c,
# | dlls/dxgmms1.sys/Makefile.in, dlls/dxgmms1.sys/dxgmms1.sys.spec, dlls/dxgmms1.sys/main.c, dlls/win32k.sys/Makefile.in,
# | dlls/win32k.sys/main.c, dlls/win32k.sys/win32k.sys.spec, loader/wine.inf.in, programs/winedevice/device.c,
# | tools/make_specfiles
# |
if test "$enable_winedevice_Default_Drivers" -eq 1; then
patch_apply winedevice-Default_Drivers/0001-win32k.sys-Add-stub-driver.patch
patch_apply winedevice-Default_Drivers/0002-dxgkrnl.sys-Add-stub-driver.patch
patch_apply winedevice-Default_Drivers/0003-dxgmms1.sys-Add-stub-driver.patch
patch_apply winedevice-Default_Drivers/0004-programs-winedevice-Load-some-common-drivers-and-fix.patch
(
printf '%s\n' '+ { "Michael Müller", "win32k.sys: Add stub driver.", 1 },';
printf '%s\n' '+ { "Michael Müller", "dxgkrnl.sys: Add stub driver.", 1 },';
printf '%s\n' '+ { "Michael Müller", "dxgmms1.sys: Add stub driver.", 1 },';
printf '%s\n' '+ { "Michael Müller", "programs/winedevice: Load some common drivers and fix ldr order.", 1 },';
) >> "$patchlist"
fi
# Patchset ntoskrnl-DriverTest
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * Compiler_Warnings, ntdll-NtAllocateUuids, ntoskrnl-Stubs
# | * Compiler_Warnings, ntdll-NtAllocateUuids, ntoskrnl-Stubs, dxva2-Video_Decoder, winedevice-Default_Drivers
# |
# | Modified files:
# | * aclocal.m4, configure.ac, dlls/ntoskrnl.exe/ntoskrnl.exe.spec, dlls/ntoskrnl.exe/tests/Makefile.in,
# | dlls/ntoskrnl.exe/tests/driver.sys/Makefile.in, dlls/ntoskrnl.exe/tests/driver.sys/driver.c,
# | dlls/ntoskrnl.exe/tests/driver.sys/driver.h, dlls/ntoskrnl.exe/tests/driver.sys/driver.sys.spec,
# | dlls/ntoskrnl.exe/tests/driver.sys/test.c, dlls/ntoskrnl.exe/tests/driver.sys/test.h,
# | dlls/ntoskrnl.exe/tests/driver.sys/util.h, dlls/ntoskrnl.exe/tests/ntoskrnl.c, include/wine/test.h,
# | dlls/ntoskrnl.exe/tests/driver.sys/util.h, dlls/ntoskrnl.exe/tests/ntoskrnl.c, include/ddk/ntddk.h, include/wine/test.h,
# | tools/make_makefiles, tools/makedep.c
# |
if test "$enable_ntoskrnl_DriverTest" -eq 1; then
@ -6334,11 +6373,13 @@ if test "$enable_ntoskrnl_DriverTest" -eq 1; then
patch_apply ntoskrnl-DriverTest/0002-ntoskrnl.exe-tests-Add-kernel-compliant-test-functio.patch
patch_apply ntoskrnl-DriverTest/0003-ntoskrnl.exe-tests-Add-tests-for-NtBuildNumber.patch
patch_apply ntoskrnl-DriverTest/0004-ntoskrnl.exe-tests-Add-tests-for-ExInitializeNPagedL.patch
patch_apply ntoskrnl-DriverTest/0005-ntoskrnl.exe-tests-Check-ldr-module-order-and-some-c.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "ntoskrnl.exe/tests: Add initial driver testing framework and corresponding changes to Makefile system.", 2 },';
printf '%s\n' '+ { "Michael Müller", "ntoskrnl.exe/tests: Add kernel compliant test functions.", 1 },';
printf '%s\n' '+ { "Michael Müller", "ntoskrnl.exe/tests: Add tests for NtBuildNumber.", 1 },';
printf '%s\n' '+ { "Michael Müller", "ntoskrnl.exe/tests: Add tests for ExInitializeNPagedLookasideList.", 1 },';
printf '%s\n' '+ { "Michael Müller", "ntoskrnl.exe/tests: Check ldr module order and some common kernel drivers.", 1 },';
) >> "$patchlist"
fi

View File

@ -0,0 +1,352 @@
From c0f0394525325d11a1bb6dce7329ea46b802e032 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 8 Jun 2017 23:38:38 +0200
Subject: win32k.sys: Add stub driver.
---
configure.ac | 1 +
dlls/win32k.sys/Makefile.in | 6 +
dlls/win32k.sys/main.c | 39 +++++++
dlls/win32k.sys/win32k.sys.spec | 246 ++++++++++++++++++++++++++++++++++++++++
tools/make_specfiles | 1 +
5 files changed, 293 insertions(+)
create mode 100644 dlls/win32k.sys/Makefile.in
create mode 100644 dlls/win32k.sys/main.c
create mode 100644 dlls/win32k.sys/win32k.sys.spec
diff --git a/configure.ac b/configure.ac
index 5b9af9eece1..34f2a1af63d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3621,6 +3621,7 @@ WINE_CONFIG_DLL(wiaservc,,[clean])
WINE_CONFIG_TEST(dlls/wiaservc/tests)
WINE_CONFIG_DLL(wimgapi)
WINE_CONFIG_DLL(win32s16.dll16,enable_win16)
+WINE_CONFIG_DLL(win32k.sys)
WINE_CONFIG_DLL(win87em.dll16,enable_win16)
WINE_CONFIG_DLL(winaspi.dll16,enable_win16)
WINE_CONFIG_DLL(windebug.dll16,enable_win16)
diff --git a/dlls/win32k.sys/Makefile.in b/dlls/win32k.sys/Makefile.in
new file mode 100644
index 00000000000..615d8335c36
--- /dev/null
+++ b/dlls/win32k.sys/Makefile.in
@@ -0,0 +1,6 @@
+MODULE = win32k.sys
+IMPORTS = ntoskrnl
+EXTRADLLFLAGS = -Wb,--subsystem,native
+
+C_SRCS = \
+ main.c
diff --git a/dlls/win32k.sys/main.c b/dlls/win32k.sys/main.c
new file mode 100644
index 00000000000..a1ec2d4fa3f
--- /dev/null
+++ b/dlls/win32k.sys/main.c
@@ -0,0 +1,39 @@
+/*
+ * win32k.sys driver
+ *
+ * Copyright 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define NONAMELESSUNION
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "ddk/wdm.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(win32k);
+
+NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
+{
+ TRACE( "(%p, %s)\n", driver, debugstr_w(path->Buffer) );
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/win32k.sys/win32k.sys.spec b/dlls/win32k.sys/win32k.sys.spec
new file mode 100644
index 00000000000..f73b4984a6a
--- /dev/null
+++ b/dlls/win32k.sys/win32k.sys.spec
@@ -0,0 +1,246 @@
+@ stub BRUSHOBJ_hGetColorTransform
+@ stub BRUSHOBJ_pvAllocRbrush
+@ stub BRUSHOBJ_pvGetRbrush
+@ stub BRUSHOBJ_ulGetBrushColor
+@ stub CLIPOBJ_GetRgn
+@ stub CLIPOBJ_bEnum
+@ stub CLIPOBJ_cEnumStart
+@ stub CLIPOBJ_ppoGetPath
+@ stub EngAcquireFastMutex
+@ stub EngAcquireSemaphore
+@ stub EngAcquireSemaphoreNoWait
+@ stub EngAcquireSemaphoreShared
+@ stub EngAcquireSemaphoreSharedNoWait
+@ stub EngAllocMem
+@ stub EngAllocPrivateUserMem
+@ stub EngAllocSectionMem
+@ stub EngAllocUserMem
+@ stub EngAlphaBlend
+@ stub EngAssociateSurface
+@ stub EngBitBlt
+@ stub EngBugCheckEx
+@ stub EngCTGetCurrentGamma
+@ stub EngCTGetGammaTable
+@ stub EngCheckAbort
+@ stub EngClearEvent
+@ stub EngCombineRgn
+@ stub EngComputeGlyphSet
+@ stub EngControlSprites
+@ stub EngCopyBits
+@ stub EngCopyRgn
+@ stub EngCreateBitmap
+@ stub EngCreateClip
+@ stub EngCreateDeviceBitmap
+@ stub EngCreateDeviceSurface
+@ stub EngCreateDriverObj
+@ stub EngCreateEvent
+@ stub EngCreateFastMutex
+@ stub EngCreatePalette
+@ stub EngCreatePath
+@ stub EngCreateRectRgn
+@ stub EngCreateRedirectionDeviceBitmap
+@ stub EngCreateSemaphore
+@ stub EngCreateWnd
+@ stub EngDebugBreak
+@ stub EngDebugPrint
+@ stub EngDeleteClip
+@ stub EngDeleteDriverObj
+@ stub EngDeleteEvent
+@ stub EngDeleteFastMutex
+@ stub EngDeleteFile
+@ stub EngDeletePalette
+@ stub EngDeletePath
+@ stub EngDeleteRgn
+@ stub EngDeleteSafeSemaphore
+@ stub EngDeleteSemaphore
+@ stub EngDeleteSurface
+@ stub EngDeleteWnd
+@ stub EngDeviceIoControl
+@ stub EngDitherColor
+@ stub EngDxIoctl
+@ stub EngEnumForms
+@ stub EngEqualRgn
+@ stub EngEraseSurface
+@ stub EngFileIoControl
+@ stub EngFileWrite
+@ stub EngFillPath
+@ stub EngFindImageProcAddress
+@ stub EngFindResource
+@ stub EngFntCacheAlloc
+@ stub EngFntCacheFault
+@ stub EngFntCacheLookUp
+@ stub EngFreeMem
+@ stub EngFreeModule
+@ stub EngFreePrivateUserMem
+@ stub EngFreeSectionMem
+@ stub EngFreeUserMem
+@ stub EngGetCurrentCodePage
+@ stub EngGetCurrentProcessId
+@ stub EngGetCurrentThreadId
+@ stub EngGetDriverName
+@ stub EngGetFileChangeTime
+@ stub EngGetFilePath
+@ stub EngGetForm
+@ stub EngGetLastError
+@ stub EngGetPrinter
+@ stub EngGetPrinterData
+@ stub EngGetPrinterDataFileName
+@ stub EngGetPrinterDriver
+@ stub EngGetProcessHandle
+@ stub EngGetRgnBox
+@ stub EngGetRgnData
+@ stub EngGetTickCount
+@ stub EngGetType1FontList
+@ stub EngGradientFill
+@ stub EngHangNotification
+@ stub EngInitializeSafeSemaphore
+@ stub EngIntersectRgn
+@ stub EngIsSemaphoreOwned
+@ stub EngIsSemaphoreOwnedByCurrentThread
+@ stub EngIsSemaphoreSharedByCurrentThread
+@ stub EngLineTo
+@ stub EngLoadImage
+@ stub EngLoadModule
+@ stub EngLoadModuleForWrite
+@ stub EngLockDirectDrawSurface
+@ stub EngLockDriverObj
+@ stub EngLockSurface
+@ stub EngLpkInstalled
+@ stub EngMapEvent
+@ stub EngMapFile
+@ stub EngMapFontFile
+@ stub EngMapFontFileFD
+@ stub EngMapModule
+@ stub EngMapSection
+@ stub EngMarkBandingSurface
+@ stub EngModifySurface
+@ stub EngMovePointer
+@ stub EngMulDiv
+@ stub EngMultiByteToUnicodeN
+@ stub EngMultiByteToWideChar
+@ stub EngNineGrid
+@ stub EngOffsetRgn
+@ stub EngPaint
+@ stub EngPlgBlt
+@ stub EngProbeForRead
+@ stub EngProbeForReadAndWrite
+@ stub EngQueryDeviceAttribute
+@ stub EngQueryLocalTime
+@ stub EngQueryPalette
+@ stub EngQueryPerformanceCounter
+@ stub EngQueryPerformanceFrequency
+@ stub EngQuerySystemAttribute
+@ stub EngQueryW32kCddInterface
+@ stub EngReadStateEvent
+@ stub EngRectInRgn
+@ stub EngReleaseFastMutex
+@ stub EngReleaseSemaphore
+@ stub EngRestoreFloatingPointState
+@ stub EngSaveFloatingPointState
+@ stub EngSecureMem
+@ stub EngSetEvent
+@ stub EngSetLastError
+@ stub EngSetPointerShape
+@ stub EngSetPointerTag
+@ stub EngSetPrinterData
+@ stub EngSetRectRgn
+@ stub EngSort
+@ stub EngStretchBlt
+@ stub EngStretchBltROP
+@ stub EngStrokeAndFillPath
+@ stub EngStrokePath
+@ stub EngSubtractRgn
+@ stub EngTextOut
+@ stub EngTransparentBlt
+@ stub EngUnicodeToMultiByteN
+@ stub EngUnionRgn
+@ stub EngUnloadImage
+@ stub EngUnlockDirectDrawSurface
+@ stub EngUnlockDriverObj
+@ stub EngUnlockSurface
+@ stub EngUnmapEvent
+@ stub EngUnmapFile
+@ stub EngUnmapFontFile
+@ stub EngUnmapFontFileFD
+@ stub EngUnsecureMem
+@ stub EngUpdateDeviceSurface
+@ stub EngWaitForSingleObject
+@ stub EngWideCharToMultiByte
+@ stub EngWritePrinter
+@ stub EngXorRgn
+@ stub FONTOBJ_cGetAllGlyphHandles
+@ stub FONTOBJ_cGetGlyphs
+@ stub FONTOBJ_pQueryGlyphAttrs
+@ stub FONTOBJ_pfdg
+@ stub FONTOBJ_pifi
+@ stub FONTOBJ_pjOpenTypeTablePointer
+@ stub FONTOBJ_pvTrueTypeFontFile
+@ stub FONTOBJ_pwszFontFilePaths
+@ stub FONTOBJ_pxoGetXform
+@ stub FONTOBJ_vGetInfo
+@ stub HT_ComputeRGBGammaTable
+@ stub HT_Get8BPPFormatPalette
+@ stub HT_Get8BPPMaskPalette
+@ stub HeapVidMemAllocAligned
+@ stub PALOBJ_cGetColors
+@ stub PATHOBJ_bCloseFigure
+@ stub PATHOBJ_bEnum
+@ stub PATHOBJ_bEnumClipLines
+@ stub PATHOBJ_bMoveTo
+@ stub PATHOBJ_bPolyBezierTo
+@ stub PATHOBJ_bPolyLineTo
+@ stub PATHOBJ_vEnumStart
+@ stub PATHOBJ_vEnumStartClipLines
+@ stub PATHOBJ_vGetBounds
+@ stdcall RtlAnsiCharToUnicodeChar(ptr) ntoskrnl.exe.RtlAnsiCharToUnicodeChar
+@ stdcall -norelay RtlCaptureContext(ptr) ntoskrnl.exe.RtlCaptureContext
+@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr long) ntoskrnl.exe.RtlCopyMemory
+@ stub RtlCopyMemoryNonTemporal
+@ stdcall RtlFillMemory(ptr long long) ntoskrnl.exe.RtlFillMemory
+@ stub RtlLookupFunctionEntry
+@ stdcall RtlMoveMemory(ptr ptr long) ntoskrnl.exe.RtlMoveMemory
+@ stdcall RtlMultiByteToUnicodeN(ptr long ptr ptr long) ntoskrnl.exe.RtlMultiByteToUnicodeN
+@ stub RtlPcToFileHeader
+@ stdcall -register RtlRaiseException(ptr) ntoskrnl.exe.RtlRaiseException
+@ stub RtlRestoreContext
+@ stdcall RtlUnicodeToMultiByteN(ptr long ptr ptr long) ntoskrnl.exe.RtlUnicodeToMultiByteN
+@ stdcall RtlUnicodeToMultiByteSize(ptr ptr long) ntoskrnl.exe.RtlUnicodeToMultiByteSize
+@ stdcall -register RtlUnwind(ptr ptr ptr ptr) ntoskrnl.exe.RtlUnwind
+@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntoskrnl.exe.RtlUnwindEx
+@ stdcall RtlUpcaseUnicodeChar(long) ntoskrnl.exe.RtlUpcaseUnicodeChar
+@ stdcall RtlUpcaseUnicodeToMultiByteN(ptr long ptr ptr long) ntoskrnl.exe.RtlUpcaseUnicodeToMultiByteN
+@ stub RtlVirtualUnwind
+@ stdcall RtlZeroMemory(ptr long) ntoskrnl.exe.RtlZeroMemory
+@ stub STROBJ_bEnum
+@ stub STROBJ_bEnumPositionsOnly
+@ stub STROBJ_bGetAdvanceWidths
+@ stub STROBJ_dwGetCodePage
+@ stub STROBJ_fxBreakExtra
+@ stub STROBJ_fxCharacterExtra
+@ stub STROBJ_vEnumStart
+@ stub VidMemFree
+@ stub W32pArgumentTable
+@ stub W32pServiceLimit
+@ stub W32pServiceTable
+@ stub WNDOBJ_bEnum
+@ stub WNDOBJ_cEnumStart
+@ stub WNDOBJ_vSetConsumer
+@ stub XFORMOBJ_bApplyXform
+@ stub XFORMOBJ_iGetFloatObjXform
+@ stub XFORMOBJ_iGetXform
+@ stub XLATEOBJ_cGetPalette
+@ stub XLATEOBJ_hGetColorTransform
+@ stub XLATEOBJ_iXlate
+@ stub XLATEOBJ_piVector
+@ stub __C_specific_handler
+@ stub __chkstk
+@ cdecl -private _itoa(long ptr long) ntoskrnl.exe._itoa
+@ cdecl -private _itow(long ptr long) ntoskrnl.exe._itow
+@ cdecl -private -arch=x86_64 _local_unwind(ptr ptr) ntoskrnl.exe._local_unwind
+@ stub _setjmp
+@ stub _setjmpex
+@ stub longjmp
+@ stub memcmp
+@ cdecl -private memcpy(ptr ptr long) ntoskrnl.exe.memcpy
+@ cdecl -private memmove(ptr ptr long) ntoskrnl.exe.memmove
+@ cdecl -private memset(ptr long long) ntoskrnl.exe.memset
diff --git a/tools/make_specfiles b/tools/make_specfiles
index 71ad3b30ea2..0b30f9f93e8 100755
--- a/tools/make_specfiles
+++ b/tools/make_specfiles
@@ -390,6 +390,7 @@ my @dll_groups =
[
"ntoskrnl.exe",
"hal",
+ "win32k.sys",
],
);
--
2.13.1

View File

@ -0,0 +1,140 @@
From bb9c9298a20f26135492ded2056eb2e49e72c024 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 8 Jun 2017 23:41:02 +0200
Subject: dxgkrnl.sys: Add stub driver.
---
configure.ac | 1 +
dlls/dxgkrnl.sys/Makefile.in | 6 ++++++
dlls/dxgkrnl.sys/dxgkrnl.sys.spec | 26 ++++++++++++++++++++++++++
dlls/dxgkrnl.sys/main.c | 39 +++++++++++++++++++++++++++++++++++++++
loader/wine.inf.in | 2 ++
5 files changed, 74 insertions(+)
create mode 100644 dlls/dxgkrnl.sys/Makefile.in
create mode 100644 dlls/dxgkrnl.sys/dxgkrnl.sys.spec
create mode 100644 dlls/dxgkrnl.sys/main.c
diff --git a/configure.ac b/configure.ac
index 34f2a1af63d..90ea217e887 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3158,6 +3158,7 @@ WINE_CONFIG_LIB(dxerr8)
WINE_CONFIG_LIB(dxerr9)
WINE_CONFIG_DLL(dxgi,,[implib])
WINE_CONFIG_TEST(dlls/dxgi/tests)
+WINE_CONFIG_DLL(dxgkrnl.sys)
WINE_CONFIG_LIB(dxguid)
WINE_CONFIG_DLL(dxva2,,[clean])
WINE_CONFIG_TEST(dlls/dxva2/tests)
diff --git a/dlls/dxgkrnl.sys/Makefile.in b/dlls/dxgkrnl.sys/Makefile.in
new file mode 100644
index 00000000000..e18ea70a995
--- /dev/null
+++ b/dlls/dxgkrnl.sys/Makefile.in
@@ -0,0 +1,6 @@
+MODULE = dxgkrnl.sys
+IMPORTS = ntoskrnl
+EXTRADLLFLAGS = -Wb,--subsystem,native
+
+C_SRCS = \
+ main.c
diff --git a/dlls/dxgkrnl.sys/dxgkrnl.sys.spec b/dlls/dxgkrnl.sys/dxgkrnl.sys.spec
new file mode 100644
index 00000000000..8487664f8a7
--- /dev/null
+++ b/dlls/dxgkrnl.sys/dxgkrnl.sys.spec
@@ -0,0 +1,26 @@
+@ stub TdrCompleteRecoveryContext
+@ stub TdrCreateRecoveryContext
+@ stub TdrIsRecoveryRequired
+@ stub TdrIsTimeoutForcedFlip
+@ stub TdrResetFromTimeout
+@ stub g_TdrConfig
+@ stub g_TdrForceTimeout
+@ stub DpSynchronizeExecution
+@ stub DpiGetDriverVersion
+@ stub DpiGetDxgAdapter
+@ stub DpiGetSchedulerCallbackState
+@ stub DpiSetSchedulerCallbackState
+@ stub DxgCoreInterface
+@ stub DxgkSqmAddToStream
+@ stub DxgkSqmCommonGeneric
+@ stub DxgkSqmCreateDwordStreamEntry
+@ stub DxgkSqmCreateStringStreamEntry
+@ stub DxgkSqmGenericDword
+@ stub DxgkSqmGenericDword64
+@ stub TraceDxgkBlockThread
+@ stub TraceDxgkContext
+@ stub TraceDxgkDevice
+@ stub TraceDxgkFunctionProfiler
+@ stub TraceDxgkPerformanceWarning
+@ stub TraceDxgkPresentHistory
+@ stub g_loggerInfo
diff --git a/dlls/dxgkrnl.sys/main.c b/dlls/dxgkrnl.sys/main.c
new file mode 100644
index 00000000000..c5639c237c8
--- /dev/null
+++ b/dlls/dxgkrnl.sys/main.c
@@ -0,0 +1,39 @@
+/*
+ * dxgkrnl.sys driver
+ *
+ * Copyright 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define NONAMELESSUNION
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "ddk/wdm.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dxgkrnl);
+
+NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
+{
+ TRACE( "(%p, %s)\n", driver, debugstr_w(path->Buffer) );
+ return STATUS_SUCCESS;
+}
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 275862845d1..654858f7537 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -2595,6 +2595,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
10,syswow64,stdole2.tlb
11,,iexplore.exe
11,,winetest.exe,-
+12,,dxgkrnl.sys,-
12,,fltmgr.sys,-
12,,mountmgr.sys,-
12,,ndis.sys,-
@@ -2639,6 +2640,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
11,,iexplore.exe
11,,notepad.exe
11,,winetest.exe,-
+12,,dxgkrnl.sys
12,,fltmgr.sys
12,,mountmgr.sys
12,,ndis.sys
--
2.13.1

View File

@ -0,0 +1,116 @@
From 0a1d6232f852b4ff869786aff4ec20e78ac2ce72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 8 Jun 2017 23:42:32 +0200
Subject: dxgmms1.sys: Add stub driver.
---
configure.ac | 1 +
dlls/dxgmms1.sys/Makefile.in | 6 ++++++
dlls/dxgmms1.sys/dxgmms1.sys.spec | 2 ++
dlls/dxgmms1.sys/main.c | 39 +++++++++++++++++++++++++++++++++++++++
loader/wine.inf.in | 2 ++
5 files changed, 50 insertions(+)
create mode 100644 dlls/dxgmms1.sys/Makefile.in
create mode 100644 dlls/dxgmms1.sys/dxgmms1.sys.spec
create mode 100644 dlls/dxgmms1.sys/main.c
diff --git a/configure.ac b/configure.ac
index 90ea217e887..5aaa20c22b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3159,6 +3159,7 @@ WINE_CONFIG_LIB(dxerr9)
WINE_CONFIG_DLL(dxgi,,[implib])
WINE_CONFIG_TEST(dlls/dxgi/tests)
WINE_CONFIG_DLL(dxgkrnl.sys)
+WINE_CONFIG_DLL(dxgmms1.sys)
WINE_CONFIG_LIB(dxguid)
WINE_CONFIG_DLL(dxva2,,[clean])
WINE_CONFIG_TEST(dlls/dxva2/tests)
diff --git a/dlls/dxgmms1.sys/Makefile.in b/dlls/dxgmms1.sys/Makefile.in
new file mode 100644
index 00000000000..affb9ce95f8
--- /dev/null
+++ b/dlls/dxgmms1.sys/Makefile.in
@@ -0,0 +1,6 @@
+MODULE = dxgmms1.sys
+IMPORTS = ntoskrnl
+EXTRADLLFLAGS = -Wb,--subsystem,native
+
+C_SRCS = \
+ main.c
diff --git a/dlls/dxgmms1.sys/dxgmms1.sys.spec b/dlls/dxgmms1.sys/dxgmms1.sys.spec
new file mode 100644
index 00000000000..124b0bf944d
--- /dev/null
+++ b/dlls/dxgmms1.sys/dxgmms1.sys.spec
@@ -0,0 +1,2 @@
+@ stub VidMmInterface
+@ stub VidSchInterface
diff --git a/dlls/dxgmms1.sys/main.c b/dlls/dxgmms1.sys/main.c
new file mode 100644
index 00000000000..686493d3296
--- /dev/null
+++ b/dlls/dxgmms1.sys/main.c
@@ -0,0 +1,39 @@
+/*
+ * dxgmms1.sys driver
+ *
+ * Copyright 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define NONAMELESSUNION
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "ddk/wdm.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dxgmms1);
+
+NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
+{
+ TRACE( "(%p, %s)\n", driver, debugstr_w(path->Buffer) );
+ return STATUS_SUCCESS;
+}
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 654858f7537..176647b8beb 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -2596,6 +2596,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
11,,iexplore.exe
11,,winetest.exe,-
12,,dxgkrnl.sys,-
+12,,dxgmms1.sys,-
12,,fltmgr.sys,-
12,,mountmgr.sys,-
12,,ndis.sys,-
@@ -2641,6 +2642,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
11,,notepad.exe
11,,winetest.exe,-
12,,dxgkrnl.sys
+12,,dxgmms1.sys
12,,fltmgr.sys
12,,mountmgr.sys
12,,ndis.sys
--
2.13.1

View File

@ -0,0 +1,50 @@
From 5148db493d915193f38d4b7f4f555030a8e9c476 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 8 Jun 2017 23:50:03 +0200
Subject: programs/winedevice: Load some common drivers and fix ldr order.
---
programs/winedevice/device.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index b2eb0eed7f2..90bf9d6f9cc 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -583,7 +583,33 @@ static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, LPVOID event_
static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
{
+ static const WCHAR ntoskrnlW[] = {'n','t','o','s','k','r','n','l','.','e','x','e',0};
+ static const WCHAR win32kW[] = {'w','i','n','3','2','k','.','s','y','s',0};
+ static const WCHAR dxgkrnlW[] = {'d','x','g','k','r','n','l','.','s','y','s',0};
+ static const WCHAR dxgmms1W[] = {'d','x','g','m','m','s','1','.','s','y','s',0};
+ static const WCHAR *stubs[] = { win32kW, dxgkrnlW, dxgmms1W };
const WCHAR *service_group = (argc >= 2) ? argv[1] : argv[0];
+ LDR_MODULE *ldr;
+ ULONG_PTR magic;
+ int i;
+
+ /* Load some default drivers (required by anticheat drivers) */
+ for (i = 0; i < sizeof(stubs)/sizeof(stubs[0]); i++)
+ {
+ if (!LoadLibraryW( stubs[i] ))
+ ERR( "Failed to load %s\n", debugstr_w( stubs[i] ) );
+ }
+
+ /* ntoskrnl.exe must be the first module */
+ LdrLockLoaderLock( 0, NULL, &magic );
+ if (!LdrFindEntryForAddress( GetModuleHandleW( ntoskrnlW ), &ldr ))
+ {
+ RemoveEntryList( &ldr->InLoadOrderModuleList );
+ InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList, &ldr->InLoadOrderModuleList );
+ RemoveEntryList( &ldr->InMemoryOrderModuleList);
+ InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &ldr->InMemoryOrderModuleList );
+ }
+ LdrUnlockLoaderLock( 0, magic );
if (!(stop_event = CreateEventW( NULL, TRUE, FALSE, NULL )))
return;
--
2.13.1

View File

@ -0,0 +1,2 @@
Fixes: Simulate a more realistic kernel environment in ntoskrnl/winedevice
Depends: dxva2-Video_Decoder