wine-staging/patches/kernel32-UmsStubs/0001-kernel32-Add-a-bunch-of-kernel32-stubs.patch
2018-02-27 12:26:58 +11:00

345 lines
13 KiB
Diff

From 382ce2af9afc78d09793854af6105bde6d7a8151 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 16 Jun 2016 18:56:21 +0800
Subject: [PATCH] kernel32: Add a bunch of kernel32 stubs.
64-bit ACDSee Pro 9.0 on start up queries them with GetProcAddress() and
fails to start if any of these APIs is missing.
---
dlls/kernel32/kernel32.spec | 26 ++++----
dlls/kernel32/sync.c | 145 ++++++++++++++++++++++++++++++++++++++++++++
include/winbase.h | 17 ++++++
include/winnt.h | 22 ++++++-
4 files changed, 196 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index ee11c42..60809f4 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -340,8 +340,8 @@
@ stdcall CreateTimerQueue ()
@ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long)
@ stdcall CreateToolhelp32Snapshot(long long)
-# @ stub -arch=x86_64 CreateUmsCompletionList
-# @ stub -arch=x86_64 CreateUmsThreadContext
+@ stdcall -arch=x86_64 CreateUmsCompletionList(ptr)
+@ stdcall -arch=x86_64 CreateUmsThreadContext(ptr)
@ stub CreateVirtualBuffer
@ stdcall CreateWaitableTimerA(ptr long str)
@ stdcall CreateWaitableTimerExA(ptr str long long)
@@ -373,11 +373,11 @@
@ stdcall DeleteTimerQueue(long)
@ stdcall DeleteTimerQueueEx (long long)
@ stdcall DeleteTimerQueueTimer(long long long)
-# @ stub -arch=x86_64 DeleteUmsCompletionList
-# @ stub -arch=x86_64 DeleteUmsThreadContext
+@ stdcall -arch=x86_64 DeleteUmsCompletionList(ptr)
+@ stdcall -arch=x86_64 DeleteUmsThreadContext(ptr)
@ stdcall DeleteVolumeMountPointA(str)
@ stdcall DeleteVolumeMountPointW(wstr)
-# @ stub -arch=x86_64 DequeueUmsCompletionListItems
+@ stdcall -arch=x86_64 DequeueUmsCompletionListItems(ptr long ptr)
@ stdcall DeviceIoControl(long long ptr long ptr long ptr ptr)
@ stdcall DisableThreadLibraryCalls(long)
@ stdcall DisconnectNamedPipe(long)
@@ -434,10 +434,10 @@
@ stdcall EnumUILanguagesW(ptr long long)
# @ stub EnumerateLocalComputerNamesA
# @ stub EnumerateLocalComputerNamesW
-# @ stub -arch=x86_64 EnterUmsSchedulingMode
+@ stdcall -arch=x86_64 EnterUmsSchedulingMode(ptr)
@ stdcall EraseTape(ptr long long)
@ stdcall EscapeCommFunction(long long)
-# @ stub -arch=x86_64 ExecuteUmsThread
+@ stdcall -arch=x86_64 ExecuteUmsThread(ptr)
@ stdcall ExitProcess(long)
@ stdcall ExitThread(long)
@ stub ExitVDM
@@ -637,7 +637,7 @@
@ stdcall GetCurrentProcessorNumberEx(ptr) ntdll.RtlGetCurrentProcessorNumberEx
@ stdcall -norelay GetCurrentThread()
@ stdcall -norelay GetCurrentThreadId()
-# @ stub -arch=x86_64 GetCurrentUmsThread
+@ stdcall -arch=x86_64 GetCurrentUmsThread()
@ stdcall GetDateFormatA(long long ptr str ptr long)
@ stdcall GetDateFormatEx(wstr long ptr wstr ptr long wstr)
@ stdcall GetDateFormatW(long long ptr wstr ptr long)
@@ -735,7 +735,7 @@
# @ stub GetNamedPipeServerProcessId
# @ stub GetNamedPipeServerSessionId
@ stdcall GetNativeSystemInfo(ptr)
-# @ stub -arch=x86_64 GetNextUmsListItem
+@ stdcall -arch=x86_64 GetNextUmsListItem(ptr)
@ stub GetNextVDMCommand
@ stub GetNlsSectionName
# @ stub GetNLSVersion
@@ -866,7 +866,7 @@
@ stdcall GetTimeZoneInformationForYear(long ptr ptr)
@ stdcall GetThreadUILanguage()
# @ stub GetUILanguageInfo
-# @ stub -arch=x86_64 GetUmsCompletionListEvent
+@ stdcall -arch=x86_64 GetUmsCompletionListEvent(ptr ptr)
# @ stub -arch=x86_64 GetUmsSystemThreadInformation
@ stdcall GetUserDefaultLCID()
@ stdcall GetUserDefaultLangID()
@@ -1175,7 +1175,7 @@
@ stdcall QueryThreadCycleTime(long ptr)
# @ stub QueryThreadProfiling
# @ stub QueryThreadpoolStackInformation
-# @ stub -arch=x86_64 QueryUmsThreadInformation
+@ stdcall -arch=x86_64 QueryUmsThreadInformation(ptr long ptr long ptr)
@ stdcall QueryUnbiasedInterruptTime(ptr)
@ stub QueryWin31IniFilesMappedToRegistry
@ stdcall QueueUserAPC(ptr long long)
@@ -1464,7 +1464,7 @@
@ stdcall SetThreadpoolWait(ptr long ptr)
@ stdcall SetTimeZoneInformation(ptr)
@ stub SetTimerQueueTimer
-# @ stub -arch=x86_64 SetUmsThreadInformation
+@ stdcall -arch=x86_64 SetUmsThreadInformation(ptr long ptr long)
@ stdcall SetUnhandledExceptionFilter(ptr)
@ stdcall SetUserGeoID(long)
@ stub SetVDMCurrentDirectories
@@ -1524,7 +1524,7 @@
# @ stub -arch=x86_64 uaw_wcsicmp
# @ stub -arch=x86_64 uaw_wcslen
# @ stub -arch=x86_64 uaw_wcsrchr
-# @ stub -arch=x86_64 UmsThreadYield
+@ stdcall -arch=x86_64 UmsThreadYield(ptr)
# @ stub -arch=x86_64 __misaligned_access
@ stdcall -i386 -private UTRegister(long str str str ptr ptr ptr) krnl386.exe16.UTRegister
@ stdcall -i386 -private UTUnRegister(long) krnl386.exe16.UTUnRegister
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index d3d46b7..b0ed3c5 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -2454,3 +2454,148 @@ BOOL WINAPI SleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable, RTL_SRW
}
return TRUE;
}
+
+
+/***********************************************************************
+ * CreateUmsCompletionList (KERNEL32.@)
+ */
+BOOL WINAPI CreateUmsCompletionList( PUMS_COMPLETION_LIST *list )
+{
+ FIXME( "%p: stub\n", list );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * DequeueUmsCompletionListItems (KERNEL32.@)
+ */
+BOOL WINAPI DequeueUmsCompletionListItems( void *list, DWORD timeout, PUMS_CONTEXT *ctx )
+{
+ FIXME( "%p,%08x,%p: stub\n", list, timeout, ctx );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * DeleteUmsCompletionList (KERNEL32.@)
+ */
+BOOL WINAPI DeleteUmsCompletionList( PUMS_COMPLETION_LIST list )
+{
+ FIXME( "%p: stub\n", list );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * GetUmsCompletionListEvent (KERNEL32.@)
+ */
+BOOL WINAPI GetUmsCompletionListEvent( PUMS_COMPLETION_LIST list, HANDLE *event )
+{
+ FIXME( "%p,%p: stub\n", list, event );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * CreateUmsThreadContext (KERNEL32.@)
+ */
+BOOL WINAPI CreateUmsThreadContext( PUMS_CONTEXT *ctx )
+{
+ FIXME( "%p: stub\n", ctx );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * DeleteUmsThreadContext (KERNEL32.@)
+ */
+BOOL WINAPI DeleteUmsThreadContext( PUMS_CONTEXT ctx )
+{
+ FIXME( "%p: stub\n", ctx );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * EnterUmsSchedulingMode (KERNEL32.@)
+ */
+BOOL WINAPI EnterUmsSchedulingMode( UMS_SCHEDULER_STARTUP_INFO *info )
+{
+ FIXME( "%p: stub\n", info );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * ExecuteUmsThread (KERNEL32.@)
+ */
+BOOL WINAPI ExecuteUmsThread( PUMS_CONTEXT ctx )
+{
+ FIXME( "%p: stub\n", ctx );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * GetCurrentUmsThread (KERNEL32.@)
+ */
+PUMS_CONTEXT WINAPI GetCurrentUmsThread( void )
+{
+ FIXME( "stub\n" );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * GetNextUmsListItem (KERNEL32.@)
+ */
+PUMS_CONTEXT WINAPI GetNextUmsListItem( PUMS_CONTEXT ctx )
+{
+ FIXME( "%p: stub\n", ctx );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return NULL;
+}
+
+
+/***********************************************************************
+ * QueryUmsThreadInformation (KERNEL32.@)
+ */
+BOOL WINAPI QueryUmsThreadInformation( PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
+ void *buf, ULONG length, ULONG *ret_length )
+{
+ FIXME( "%p,%08x,%p,%08x,%p: stub\n", ctx, class, buf, length, ret_length );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * SetUmsThreadInformation (KERNEL32.@)
+ */
+BOOL WINAPI SetUmsThreadInformation( PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
+ void *buf, ULONG length )
+{
+ FIXME( "%p,%08x,%p,%08x: stub\n", ctx, class, buf, length );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * UmsThreadYield (KERNEL32.@)
+ */
+BOOL WINAPI UmsThreadYield( void *param )
+{
+ FIXME( "%p: stub\n", param );
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+}
diff --git a/include/winbase.h b/include/winbase.h
index e47c87a..8d65d78 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1694,6 +1694,20 @@ typedef enum _PROC_THREAD_ATTRIBUTE_NUM
#define SYMBOLIC_LINK_FLAG_DIRECTORY (0x1)
#define VALID_SYMBOLIC_LINK_FLAGS SYMBOLIC_LINK_FLAG_DIRECTORY
+typedef void *PUMS_CONTEXT;
+typedef void *PUMS_COMPLETION_LIST;
+typedef PRTL_UMS_SCHEDULER_ENTRY_POINT PUMS_SCHEDULER_ENTRY_POINT;
+typedef struct _UMS_SCHEDULER_STARTUP_INFO
+{
+ ULONG UmsVersion;
+ PUMS_COMPLETION_LIST CompletionList;
+ PUMS_SCHEDULER_ENTRY_POINT SchedulerProc;
+ PVOID SchedulerParam;
+} UMS_SCHEDULER_STARTUP_INFO, *PUMS_SCHEDULER_STARTUP_INFO;
+
+typedef enum _RTL_UMS_SCHEDULER_REASON UMS_SCHEDULER_REASON;
+typedef enum _RTL_UMS_THREAD_INFO_CLASS UMS_THREAD_INFO_CLASS, *PUMS_THREAD_INFO_CLASS;
+
WINBASEAPI BOOL WINAPI ActivateActCtx(HANDLE,ULONG_PTR *);
WINADVAPI BOOL WINAPI AddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
WINADVAPI BOOL WINAPI AddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
@@ -1862,6 +1876,8 @@ WINBASEAPI DWORD WINAPI CreateTapePartition(HANDLE,DWORD,DWORD,DWORD);
WINBASEAPI HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES,SIZE_T,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD);
WINBASEAPI HANDLE WINAPI CreateTimerQueue(void);
WINBASEAPI BOOL WINAPI CreateTimerQueueTimer(PHANDLE,HANDLE,WAITORTIMERCALLBACK,PVOID,DWORD,DWORD,ULONG);
+WINBASEAPI BOOL WINAPI CreateUmsCompletionList(PUMS_COMPLETION_LIST*);
+WINBASEAPI BOOL WINAPI CreateUmsThreadContext(PUMS_CONTEXT*);
WINBASEAPI HANDLE WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
WINBASEAPI HANDLE WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES,BOOL,LPCWSTR);
#define CreateWaitableTimer WINELIB_NAME_AW(CreateWaitableTimer)
@@ -1920,6 +1936,7 @@ WINBASEAPI BOOL WINAPI EndUpdateResourceA(HANDLE,BOOL);
WINBASEAPI BOOL WINAPI EndUpdateResourceW(HANDLE,BOOL);
#define EndUpdateResource WINELIB_NAME_AW(EndUpdateResource)
WINBASEAPI void WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit);
+WINBASEAPI BOOL WINAPI EnterUmsSchedulingMode(PUMS_SCHEDULER_STARTUP_INFO);
WINBASEAPI BOOL WINAPI EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG_PTR);
WINBASEAPI BOOL WINAPI EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG_PTR);
#define EnumResourceLanguages WINELIB_NAME_AW(EnumResourceLanguages)
diff --git a/include/winnt.h b/include/winnt.h
index 56b533c..6b598f3 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -6120,9 +6120,29 @@ typedef VOID (CALLBACK *PTP_TIMER_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_TIME
typedef VOID (CALLBACK *PTP_WAIT_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WAIT,TP_WAIT_RESULT);
typedef VOID (CALLBACK *PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PVOID,ULONG,ULONG_PTR,PTP_IO);
-
NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);
+typedef enum _RTL_UMS_THREAD_INFO_CLASS
+{
+ UmsThreadInvalidInfoClass,
+ UmsThreadUserContext,
+ UmsThreadPriority,
+ UmsThreadAffinity,
+ UmsThreadTeb,
+ UmsThreadIsSuspended,
+ UmsThreadIsTerminated,
+ UmsThreadMaxInfoClass
+} RTL_UMS_THREAD_INFO_CLASS, *PRTL_UMS_THREAD_INFO_CLASS;
+
+typedef enum _RTL_UMS_SCHEDULER_REASON
+{
+ UmsSchedulerStartup,
+ UmsSchedulerThreadBlocked,
+ UmsSchedulerThreadYield,
+} RTL_UMS_SCHEDULER_REASON, *PRTL_UMS_SCHEDULER_REASON;
+
+typedef void (CALLBACK *PRTL_UMS_SCHEDULER_ENTRY_POINT)(RTL_UMS_SCHEDULER_REASON,ULONG_PTR,PVOID);
+
#ifdef __cplusplus
}
#endif
--
1.9.1