https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2549e10c3808b2f4dcd66…
commit 2549e10c3808b2f4dcd66a42e35bc7f0df56b4eb
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Aug 5 15:19:15 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Aug 11 19:00:42 2023 +0300
[KERNEL32] Export more Vista APIs
Create kernel32_vista_static library and link both kernel32_vista and kernel32 to it.
Export some vista functions from kernel32.
Export BaseProcessInitPostImport for Vista+, too, because ntdll needs to dynamically
link to it.
---
dll/win32/kernel32/CMakeLists.txt | 2 +-
dll/win32/kernel32/kernel32.spec | 81 ++++++++++++------------
dll/win32/kernel32/kernel32_vista/CMakeLists.txt | 10 +--
dll/win32/kernel32/winnls/string/lang.c | 6 ++
dll/win32/kernel32/winnls/string/lcformat.c | 14 ++++
5 files changed, 67 insertions(+), 46 deletions(-)
diff --git a/dll/win32/kernel32/CMakeLists.txt b/dll/win32/kernel32/CMakeLists.txt
index 1cc82f9d42b..555aaab31dc 100644
--- a/dll/win32/kernel32/CMakeLists.txt
+++ b/dll/win32/kernel32/CMakeLists.txt
@@ -125,7 +125,7 @@ set_module_type(kernel32 win32dll ENTRYPOINT DllMain 12)
set_subsystem(kernel32 console)
################# END HACK #################
-target_link_libraries(kernel32 kernel32_shared wine chkstk ${PSEH_LIB})
+target_link_libraries(kernel32 kernel32_vista_static kernel32_shared wine chkstk
${PSEH_LIB})
add_importlibs(kernel32 ntdll)
add_pch(kernel32 k32.h SOURCE)
add_dependencies(kernel32 psdk errcodes asm)
diff --git a/dll/win32/kernel32/kernel32.spec b/dll/win32/kernel32/kernel32.spec
index ebf7e91adcb..f1b6314052c 100644
--- a/dll/win32/kernel32/kernel32.spec
+++ b/dll/win32/kernel32/kernel32.spec
@@ -1,5 +1,5 @@
-@ stdcall -stub -version=0x600+ AcquireSRWLockExclusive(ptr)
NTDLL.RtlAcquireSRWLockExclusive
-@ stdcall -stub -version=0x600+ AcquireSRWLockShared(ptr) NTDLL.RtlAcquireSRWLockShared
+@ stdcall -version=0x600+ AcquireSRWLockExclusive(ptr) NTDLL.RtlAcquireSRWLockExclusive
+@ stdcall -version=0x600+ AcquireSRWLockShared(ptr) NTDLL.RtlAcquireSRWLockShared
@ stdcall ActivateActCtx(ptr ptr)
@ stdcall AddAtomA(str)
@ stdcall AddAtomW(wstr)
@@ -16,8 +16,8 @@
@ stdcall AllocConsole()
@ stdcall AllocateUserPhysicalPages(long ptr ptr)
@ stdcall -stub -version=0x600+ AllocateUserPhysicalPagesNuma(ptr ptr ptr long)
-@ stdcall -stub -version=0x600+ ApplicationRecoveryFinished(long)
-@ stdcall -stub -version=0x600+ ApplicationRecoveryInProgress(ptr)
+@ stdcall -version=0x600+ ApplicationRecoveryFinished(long)
+@ stdcall -version=0x600+ ApplicationRecoveryInProgress(ptr)
@ stdcall AreFileApisANSI()
@ stdcall AssignProcessToJobObject(ptr ptr)
@ stdcall AttachConsole(long)
@@ -33,6 +33,7 @@
@ stdcall BaseInitAppcompatCacheSupport()
@ stdcall BaseIsAppcompatInfrastructureDisabled() IsShimInfrastructureDisabled
@ stdcall -version=0x501-0x502 BaseProcessInitPostImport()
+@ stdcall -version=0x600+ BaseProcessInitPostImport() # HACK: This export is dynamicaly
imported by ntdll
;@ stdcall -version=0x502 -arch=x86_64 BaseProcessStart()
@ stdcall BaseQueryModuleData(str str ptr ptr ptr) ;check
@ stub -version=0x600+ BaseThreadInitThunk
@@ -344,7 +345,7 @@
@ stdcall FreeUserPhysicalPages(long long long)
@ stdcall GenerateConsoleCtrlEvent(long long)
@ stdcall GetACP()
-@ stub -version=0x600+ GetApplicationRecoveryCallback
+@ stdcall -version=0x600+ GetApplicationRecoveryCallback(ptr ptr ptr ptr ptr)
@ stub -version=0x600+ GetApplicationRestartSettings
@ stdcall GetAtomNameA(long ptr long)
@ stdcall GetAtomNameW(long ptr long)
@@ -423,7 +424,7 @@
@ stdcall GetConsoleTitleW(ptr long)
@ stdcall GetConsoleWindow()
@ stdcall GetCurrencyFormatA(long long str ptr str long)
-@ stub -version=0x600+ GetCurrencyFormatEx
+@ stdcall -version=0x600+ GetCurrencyFormatEx(wstr long wstr ptr wstr long)
@ stdcall GetCurrencyFormatW(long long wstr ptr wstr long)
@ stdcall GetCurrentActCtx(ptr)
@ stdcall GetCurrentConsoleFont(long long ptr)
@@ -459,7 +460,7 @@
@ stdcall GetEnvironmentStringsW()
@ stdcall GetEnvironmentVariableA(str ptr long)
@ stdcall GetEnvironmentVariableW(wstr ptr long)
-@ stub -version=0x600+ GetErrorMode
+@ stdcall -version=0x600+ GetErrorMode()
@ stdcall GetExitCodeProcess(long ptr)
@ stdcall GetExitCodeThread(long ptr)
@ stdcall GetExpandedNameA(str ptr)
@@ -470,17 +471,17 @@
@ stub -version=0x600+ GetFileAttributesTransactedA
@ stub -version=0x600+ GetFileAttributesTransactedW
@ stdcall GetFileAttributesW(wstr)
-@ stub -version=0x600+ GetFileBandwidthReservation
+@ stdcall -version=0x600+ GetFileBandwidthReservation(ptr ptr ptr ptr ptr ptr)
@ stdcall GetFileInformationByHandle(long ptr)
-@ stub -version=0x600+ GetFileInformationByHandleEx
-@ stub -version=0x600+ GetFileMUIInfo
-@ stub -version=0x600+ GetFileMUIPath
+@ stdcall -version=0x600+ GetFileInformationByHandleEx(ptr long ptr long)
+@ stdcall -version=0x600+ GetFileMUIInfo(long wstr ptr ptr)
+@ stdcall -version=0x600+ GetFileMUIPath(long wstr wstr ptr wstr ptr ptr)
@ stdcall GetFileSize(long ptr)
@ stdcall GetFileSizeEx(long ptr)
@ stdcall GetFileTime(long ptr ptr ptr)
@ stdcall GetFileType(long)
-@ stub -version=0x600+ GetFinalPathNameByHandleA
-@ stub -version=0x600+ GetFinalPathNameByHandleW
+@ stdcall -version=0x600+ GetFinalPathNameByHandleA(ptr str long long)
+@ stdcall -version=0x600+ GetFinalPathNameByHandleW(ptr wstr long long)
@ stdcall GetFirmwareEnvironmentVariableA(str str ptr long)
@ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long)
@ stdcall GetFullPathNameA(str long ptr ptr)
@@ -600,7 +601,7 @@
@ stdcall GetSystemFirmwareTable(long long ptr long)
@ stdcall GetSystemInfo(ptr)
@ stdcall GetSystemPowerStatus(ptr)
-@ stub -version=0x600+ GetSystemPreferredUILanguages
+@ stdcall -version=0x600+ GetSystemPreferredUILanguages(long ptr wstr ptr)
@ stdcall GetSystemRegistryQuota(ptr ptr)
@ stdcall GetSystemTime(ptr)
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr)
@@ -623,26 +624,26 @@
@ stdcall GetThreadIOPendingFlag(long ptr)
@ stdcall GetThreadId(ptr)
@ stdcall GetThreadLocale()
-@ stub -version=0x600+ GetThreadPreferredUILanguages
+@ stdcall -version=0x600+ GetThreadPreferredUILanguages(long ptr wstr ptr)
@ stdcall GetThreadPriority(long)
@ stdcall GetThreadPriorityBoost(long ptr)
@ stdcall GetThreadSelectorEntry(long long ptr)
@ stdcall GetThreadTimes(long ptr ptr ptr ptr)
-@ stub -version=0x600+ GetThreadUILanguage
+@ stdcall -version=0x600+ GetThreadUILanguage()
@ stdcall GetTickCount()
-@ stub -version=0x600+ GetTickCount64
+@ stdcall -version=0x600+ -ret64 GetTickCount64()
@ stdcall GetTimeFormatA(long long ptr str ptr long)
@ stdcall -version=0x600+ GetTimeFormatEx(wstr long ptr wstr wstr long)
@ stdcall GetTimeFormatW(long long ptr wstr ptr long)
@ stdcall GetTimeZoneInformation(ptr)
@ stub -version=0x600+ GetTimeZoneInformationForYear
-@ stub -version=0x600+ GetUILanguageInfo
+@ stdcall -version=0x600+ GetUILanguageInfo(long wstr wstr ptr ptr)
@ stdcall GetUserDefaultLCID()
@ stdcall GetUserDefaultLangID()
@ stdcall -version=0x600+ GetUserDefaultLocaleName(wstr long)
@ stdcall GetUserDefaultUILanguage()
@ stdcall GetUserGeoID(long)
-@ stub -version=0x600+ GetUserPreferredUILanguages
+@ stdcall -version=0x600+ GetUserPreferredUILanguages(long ptr wstr ptr)
@ stdcall GetVDMCurrentDirectories(long long)
@ stdcall GetVersion()
@ stdcall GetVersionExA(ptr)
@@ -709,15 +710,15 @@
@ stdcall InitAtomTable(long)
@ stub -version=0x600+ InitOnceBeginInitialize
@ stub -version=0x600+ InitOnceComplete
-@ stub -version=0x600+ InitOnceExecuteOnce
+@ stdcall -version=0x600+ InitOnceExecuteOnce(ptr ptr ptr ptr)
@ stub -version=0x600+ InitOnceInitialize
-@ stub -version=0x600+ InitializeConditionVariable
+@ stdcall -version=0x600+ InitializeConditionVariable(ptr)
ntdll.RtlInitializeConditionVariable
@ stdcall InitializeCriticalSection(ptr)
@ stdcall InitializeCriticalSectionAndSpinCount(ptr long)
-@ stub -version=0x600+ InitializeCriticalSectionEx
+@ stdcall -version=0x600+ InitializeCriticalSectionEx(ptr long long)
@ stub -version=0x600+ InitializeProcThreadAttributeList
@ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead
-@ stub -version=0x600+ InitializeSRWLock
+@ stdcall -version=0x600+ InitializeSRWLock(ptr) ntdll.RtlInitializeSRWLock
@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr double double)
ntdll.RtlInterlockedCompareExchange64
@ stdcall -arch=i386 InterlockedCompareExchange(ptr long long)
@ stdcall -arch=i386 InterlockedDecrement(ptr)
@@ -727,7 +728,7 @@
@ stdcall -arch=i386 InterlockedIncrement(ptr)
@ stdcall InterlockedPopEntrySList(ptr) ntdll.RtlInterlockedPopEntrySList
@ stdcall InterlockedPushEntrySList(ptr ptr) ntdll.RtlInterlockedPushEntrySList
-@ stub -version=0x600+ InterlockedPushListSList
+@ fastcall -version=0x600+ InterlockedPushListSList(ptr ptr ptr long)
ntdll.RtlInterlockedPushListSList
@ stdcall InvalidateConsoleDIBits(long long)
@ stdcall IsBadCodePtr(ptr)
@ stdcall IsBadHugeReadPtr(ptr long)
@@ -747,7 +748,7 @@
@ stdcall IsProcessInJob(long long ptr)
@ stdcall IsProcessorFeaturePresent(long)
@ stdcall IsSystemResumeAutomatic()
-@ stub -version=0x600+ IsThreadAFiber
+@ stdcall -version=0x600+ IsThreadAFiber()
@ stub -version=0x600+ IsThreadpoolTimerSet
@ stdcall IsTimeZoneRedirectionEnabled()
@ stub -version=0x600+ IsValidCalDateTime
@@ -756,7 +757,7 @@
@ stdcall IsValidLocale(long long)
@ stdcall -version=0x501-0x502 IsValidUILanguage(long)
@ stdcall IsWow64Process(ptr ptr)
-@ stub -version=0x600+ LCIDToLocaleName
+@ stdcall -version=0x600+ LCIDToLocaleName(long wstr long long)
@ stdcall LCMapStringA(long long str long ptr long)
@ stdcall -version=0x600+ LCMapStringEx(long long wstr long ptr long ptr ptr long)
@ stdcall LCMapStringW(long long wstr long ptr long)
@@ -792,7 +793,7 @@
@ stdcall LocalShrink(long long)
@ stdcall LocalSize(long)
@ stdcall LocalUnlock(long)
-@ stub -version=0x600+ LocaleNameToLCID
+@ stdcall -version=0x600+ LocaleNameToLCID(wstr long)
@ stdcall LockFile(long long long long long)
@ stdcall LockFileEx(long long long long long ptr)
@ stdcall LockResource(long)
@@ -832,7 +833,7 @@
@ stdcall OpenEventA(long long str)
@ stdcall OpenEventW(long long wstr)
@ stdcall OpenFile(str ptr long)
-@ stub -version=0x600+ OpenFileById
+@ stdcall -version=0x600+ OpenFileById(ptr ptr long long ptr long)
@ stdcall OpenFileMappingA(long long str)
@ stdcall OpenFileMappingW(long long wstr)
@ stdcall OpenJobObjectA(long long str)
@@ -869,8 +870,8 @@
@ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList
@ stdcall QueryDosDeviceA(str ptr long)
@ stdcall QueryDosDeviceW(wstr ptr long)
-@ stub -version=0x600+ QueryFullProcessImageNameA
-@ stub -version=0x600+ QueryFullProcessImageNameW
+@ stdcall -version=0x600+ QueryFullProcessImageNameA(ptr long str ptr)
+@ stdcall -version=0x600+ QueryFullProcessImageNameW(ptr long wstr ptr)
@ stub -version=0x600+ QueryIdleProcessorCycleTime
@ stdcall QueryInformationJobObject(long long ptr long ptr)
@ stdcall QueryMemoryResourceNotification(ptr ptr)
@@ -899,8 +900,8 @@
@ stdcall ReadFileEx(long ptr long ptr ptr)
@ stdcall ReadFileScatter(long ptr long ptr ptr)
@ stdcall ReadProcessMemory(long ptr ptr long ptr)
-@ stub -version=0x600+ RegisterApplicationRecoveryCallback
-@ stub -version=0x600+ RegisterApplicationRestart
+@ stdcall -version=0x600+ RegisterApplicationRecoveryCallback(ptr ptr long long)
+@ stdcall -version=0x600+ RegisterApplicationRestart(wstr long)
@ stdcall RegisterConsoleIME(ptr ptr)
@ stdcall RegisterConsoleOS2(long)
@ stdcall RegisterConsoleVDM(long long long long long long long long long long long)
@@ -912,8 +913,8 @@
@ stdcall ReleaseActCtx(ptr)
@ stdcall ReleaseMutex(long)
@ stub -version=0x600+ ReleaseMutexWhenCallbackReturns
-@ stub -version=0x600+ ReleaseSRWLockExclusive
-@ stub -version=0x600+ ReleaseSRWLockShared
+@ stdcall -version=0x600+ ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive
+@ stdcall -version=0x600+ ReleaseSRWLockShared(ptr) ntdll.RtlReleaseSRWLockShared
@ stdcall ReleaseSemaphore(long long ptr)
@ stub -version=0x600+ ReleaseSemaphoreWhenCallbackReturns
@ stdcall RemoveDirectoryA(str)
@@ -1025,7 +1026,7 @@
@ stub -version=0x600+ SetFileAttributesTransactedA
@ stub -version=0x600+ SetFileAttributesTransactedW
@ stdcall SetFileAttributesW(wstr long)
-@ stub -version=0x600+ SetFileBandwidthReservation
+@ stdcall -version=0x600+ SetFileBandwidthReservation(ptr long long long ptr ptr)
@ stdcall SetFileCompletionNotificationModes(ptr long)
@ stub -version=0x600+ SetFileInformationByHandle
@ stub -version=0x600+ SetFileIoOverlappedRange
@@ -1075,7 +1076,7 @@
@ stdcall SetThreadExecutionState(long)
@ stdcall SetThreadIdealProcessor(long long)
@ stdcall SetThreadLocale(long)
-@ stub -version=0x600+ SetThreadPreferredUILanguages
+@ stdcall -version=0x600+ SetThreadPreferredUILanguages(long wstr ptr)
@ stdcall SetThreadPriority(long long)
@ stdcall SetThreadPriorityBoost(long long)
@ stdcall SetThreadStackGuarantee(ptr)
@@ -1099,8 +1100,8 @@
@ stdcall SignalObjectAndWait(long long long long)
@ stdcall SizeofResource(long long)
@ stdcall Sleep(long)
-@ stub -version=0x600+ SleepConditionVariableCS
-@ stub -version=0x600+ SleepConditionVariableSRW
+@ stdcall -version=0x600+ SleepConditionVariableCS(ptr ptr long)
+@ stdcall -version=0x600+ SleepConditionVariableSRW(ptr ptr long long)
@ stdcall SleepEx(long long)
@ stub -version=0x600+ StartThreadpoolIo
@ stub -version=0x600+ SubmitThreadpoolWork
@@ -1175,8 +1176,8 @@
@ stub -version=0x600+ WaitForThreadpoolWorkCallbacks
@ stdcall WaitNamedPipeA(str long)
@ stdcall WaitNamedPipeW(wstr long)
-@ stub -version=0x600+ WakeAllConditionVariable
-@ stub -version=0x600+ WakeConditionVariable
+@ stdcall -version=0x600+ WakeAllConditionVariable(ptr)
ntdll.RtlWakeAllConditionVariable
+@ stdcall -version=0x600+ WakeConditionVariable(ptr) ntdll.RtlWakeConditionVariable
@ stub -version=0x600+ WerGetFlags
@ stub -version=0x600+ WerRegisterFile
@ stub -version=0x600+ WerRegisterMemoryBlock
diff --git a/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
b/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
index 51efae70f8b..acc53b9d80a 100644
--- a/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
+++ b/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
@@ -7,17 +7,17 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys)
spec2def(kernel32_vista.dll kernel32_vista.spec ADD_IMPORTLIB)
list(APPEND SOURCE
- DllMain.c
GetFileInformationByHandleEx.c
GetTickCount64.c
InitOnceExecuteOnce.c
sync.c
- vista.c
- ${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
+ vista.c)
-add_library(kernel32_vista MODULE ${SOURCE})
+add_library(kernel32_vista_static ${SOURCE})
+add_dependencies(kernel32_vista_static psdk)
+add_library(kernel32_vista MODULE DllMain.c
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
set_module_type(kernel32_vista win32dll ENTRYPOINT DllMain 12)
-target_link_libraries(kernel32_vista kernel32_shared)
+target_link_libraries(kernel32_vista kernel32_vista_static kernel32_shared)
add_importlibs(kernel32_vista kernel32 ntdll_vista ntdll)
add_delay_importlibs(kernel32_vista ntdll_vista)
add_dependencies(kernel32_vista psdk)
diff --git a/dll/win32/kernel32/winnls/string/lang.c
b/dll/win32/kernel32/winnls/string/lang.c
index b75bd4972c2..51f1edf0175 100644
--- a/dll/win32/kernel32/winnls/string/lang.c
+++ b/dll/win32/kernel32/winnls/string/lang.c
@@ -32,6 +32,12 @@ DEBUG_CHANNEL(nls);
#include "japanese.h"
#endif
+#undef WINVER
+#define WINVER 0x600
+
+/* From winnls.h */
+#define LOCALE_NAME_USER_DEFAULT NULL
+
#define REG_SZ 1
extern int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int
dstlen);
extern int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int
dstlen);
diff --git a/dll/win32/kernel32/winnls/string/lcformat.c
b/dll/win32/kernel32/winnls/string/lcformat.c
index 5e5b529df9e..5761035109f 100644
--- a/dll/win32/kernel32/winnls/string/lcformat.c
+++ b/dll/win32/kernel32/winnls/string/lcformat.c
@@ -31,6 +31,20 @@
#include <debug.h>
DEBUG_CHANNEL(nls);
+#undef _WIN32_WINNT
+#undef WINVER
+#define _WIN32_WINNT DLL_EXPORT_VERSION
+#define WINVER DLL_EXPORT_VERSION
+
+LCID WINAPI LocaleNameToLCID(_In_ LPCWSTR, _In_ DWORD);
+#define LOCALE_SSHORTESTDAYNAME1 96
+#define LOCALE_SSHORTESTDAYNAME2 97
+#define LOCALE_SSHORTESTDAYNAME3 98
+#define LOCALE_SSHORTESTDAYNAME4 99
+#define LOCALE_SSHORTESTDAYNAME5 100
+#define LOCALE_SSHORTESTDAYNAME6 101
+#define LOCALE_SSHORTESTDAYNAME7 102
+
#define CRITICAL_SECTION RTL_CRITICAL_SECTION
#define CRITICAL_SECTION_DEBUG RTL_CRITICAL_SECTION_DEBUG
#define CALINFO_MAX_YEAR 2029