From 804a455fed710b065084172d7c71edb09cab789f 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: [PATCH] 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 4e43b4516e..d2b39ebbef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3758,6 +3758,7 @@ WINE_CONFIG_MAKEFILE(dlls/wevtapi)
 WINE_CONFIG_MAKEFILE(dlls/wiaservc)
 WINE_CONFIG_MAKEFILE(dlls/wiaservc/tests)
 WINE_CONFIG_MAKEFILE(dlls/wimgapi)
+WINE_CONFIG_MAKEFILE(dlls/win32k.sys)
 WINE_CONFIG_MAKEFILE(dlls/win32s16.dll16,enable_win16)
 WINE_CONFIG_MAKEFILE(dlls/win87em.dll16,enable_win16)
 WINE_CONFIG_MAKEFILE(dlls/winaspi.dll16,enable_win16)
diff --git a/dlls/win32k.sys/Makefile.in b/dlls/win32k.sys/Makefile.in
new file mode 100644
index 0000000000..7fac5d557e
--- /dev/null
+++ b/dlls/win32k.sys/Makefile.in
@@ -0,0 +1,6 @@
+MODULE    = win32k.sys
+IMPORTS   = ntoskrnl
+EXTRADLLFLAGS = -mno-cygwin -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 0000000000..a1ec2d4fa3
--- /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 0000000000..c79439151e
--- /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 -norelay 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 -norelay 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 7fef3a6821..9dc0fe3afc 100755
--- a/tools/make_specfiles
+++ b/tools/make_specfiles
@@ -482,6 +482,7 @@ my @dll_groups =
  [
   "ntoskrnl.exe",
   "hal",
+  "win32k.sys",
  ],
  [
   "mscoree",
-- 
2.17.1

