Skip to content

Commit 2549e10

Browse files
committed
[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.
1 parent 49da1cd commit 2549e10

File tree

5 files changed

+67
-46
lines changed

5 files changed

+67
-46
lines changed

dll/win32/kernel32/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ set_module_type(kernel32 win32dll ENTRYPOINT DllMain 12)
125125
set_subsystem(kernel32 console)
126126
################# END HACK #################
127127

128-
target_link_libraries(kernel32 kernel32_shared wine chkstk ${PSEH_LIB})
128+
target_link_libraries(kernel32 kernel32_vista_static kernel32_shared wine chkstk ${PSEH_LIB})
129129
add_importlibs(kernel32 ntdll)
130130
add_pch(kernel32 k32.h SOURCE)
131131
add_dependencies(kernel32 psdk errcodes asm)

dll/win32/kernel32/kernel32.spec

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@ stdcall -stub -version=0x600+ AcquireSRWLockExclusive(ptr) NTDLL.RtlAcquireSRWLockExclusive
2-
@ stdcall -stub -version=0x600+ AcquireSRWLockShared(ptr) NTDLL.RtlAcquireSRWLockShared
1+
@ stdcall -version=0x600+ AcquireSRWLockExclusive(ptr) NTDLL.RtlAcquireSRWLockExclusive
2+
@ stdcall -version=0x600+ AcquireSRWLockShared(ptr) NTDLL.RtlAcquireSRWLockShared
33
@ stdcall ActivateActCtx(ptr ptr)
44
@ stdcall AddAtomA(str)
55
@ stdcall AddAtomW(wstr)
@@ -16,8 +16,8 @@
1616
@ stdcall AllocConsole()
1717
@ stdcall AllocateUserPhysicalPages(long ptr ptr)
1818
@ stdcall -stub -version=0x600+ AllocateUserPhysicalPagesNuma(ptr ptr ptr long)
19-
@ stdcall -stub -version=0x600+ ApplicationRecoveryFinished(long)
20-
@ stdcall -stub -version=0x600+ ApplicationRecoveryInProgress(ptr)
19+
@ stdcall -version=0x600+ ApplicationRecoveryFinished(long)
20+
@ stdcall -version=0x600+ ApplicationRecoveryInProgress(ptr)
2121
@ stdcall AreFileApisANSI()
2222
@ stdcall AssignProcessToJobObject(ptr ptr)
2323
@ stdcall AttachConsole(long)
@@ -33,6 +33,7 @@
3333
@ stdcall BaseInitAppcompatCacheSupport()
3434
@ stdcall BaseIsAppcompatInfrastructureDisabled() IsShimInfrastructureDisabled
3535
@ stdcall -version=0x501-0x502 BaseProcessInitPostImport()
36+
@ stdcall -version=0x600+ BaseProcessInitPostImport() # HACK: This export is dynamicaly imported by ntdll
3637
;@ stdcall -version=0x502 -arch=x86_64 BaseProcessStart()
3738
@ stdcall BaseQueryModuleData(str str ptr ptr ptr) ;check
3839
@ stub -version=0x600+ BaseThreadInitThunk
@@ -344,7 +345,7 @@
344345
@ stdcall FreeUserPhysicalPages(long long long)
345346
@ stdcall GenerateConsoleCtrlEvent(long long)
346347
@ stdcall GetACP()
347-
@ stub -version=0x600+ GetApplicationRecoveryCallback
348+
@ stdcall -version=0x600+ GetApplicationRecoveryCallback(ptr ptr ptr ptr ptr)
348349
@ stub -version=0x600+ GetApplicationRestartSettings
349350
@ stdcall GetAtomNameA(long ptr long)
350351
@ stdcall GetAtomNameW(long ptr long)
@@ -423,7 +424,7 @@
423424
@ stdcall GetConsoleTitleW(ptr long)
424425
@ stdcall GetConsoleWindow()
425426
@ stdcall GetCurrencyFormatA(long long str ptr str long)
426-
@ stub -version=0x600+ GetCurrencyFormatEx
427+
@ stdcall -version=0x600+ GetCurrencyFormatEx(wstr long wstr ptr wstr long)
427428
@ stdcall GetCurrencyFormatW(long long wstr ptr wstr long)
428429
@ stdcall GetCurrentActCtx(ptr)
429430
@ stdcall GetCurrentConsoleFont(long long ptr)
@@ -459,7 +460,7 @@
459460
@ stdcall GetEnvironmentStringsW()
460461
@ stdcall GetEnvironmentVariableA(str ptr long)
461462
@ stdcall GetEnvironmentVariableW(wstr ptr long)
462-
@ stub -version=0x600+ GetErrorMode
463+
@ stdcall -version=0x600+ GetErrorMode()
463464
@ stdcall GetExitCodeProcess(long ptr)
464465
@ stdcall GetExitCodeThread(long ptr)
465466
@ stdcall GetExpandedNameA(str ptr)
@@ -470,17 +471,17 @@
470471
@ stub -version=0x600+ GetFileAttributesTransactedA
471472
@ stub -version=0x600+ GetFileAttributesTransactedW
472473
@ stdcall GetFileAttributesW(wstr)
473-
@ stub -version=0x600+ GetFileBandwidthReservation
474+
@ stdcall -version=0x600+ GetFileBandwidthReservation(ptr ptr ptr ptr ptr ptr)
474475
@ stdcall GetFileInformationByHandle(long ptr)
475-
@ stub -version=0x600+ GetFileInformationByHandleEx
476-
@ stub -version=0x600+ GetFileMUIInfo
477-
@ stub -version=0x600+ GetFileMUIPath
476+
@ stdcall -version=0x600+ GetFileInformationByHandleEx(ptr long ptr long)
477+
@ stdcall -version=0x600+ GetFileMUIInfo(long wstr ptr ptr)
478+
@ stdcall -version=0x600+ GetFileMUIPath(long wstr wstr ptr wstr ptr ptr)
478479
@ stdcall GetFileSize(long ptr)
479480
@ stdcall GetFileSizeEx(long ptr)
480481
@ stdcall GetFileTime(long ptr ptr ptr)
481482
@ stdcall GetFileType(long)
482-
@ stub -version=0x600+ GetFinalPathNameByHandleA
483-
@ stub -version=0x600+ GetFinalPathNameByHandleW
483+
@ stdcall -version=0x600+ GetFinalPathNameByHandleA(ptr str long long)
484+
@ stdcall -version=0x600+ GetFinalPathNameByHandleW(ptr wstr long long)
484485
@ stdcall GetFirmwareEnvironmentVariableA(str str ptr long)
485486
@ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long)
486487
@ stdcall GetFullPathNameA(str long ptr ptr)
@@ -600,7 +601,7 @@
600601
@ stdcall GetSystemFirmwareTable(long long ptr long)
601602
@ stdcall GetSystemInfo(ptr)
602603
@ stdcall GetSystemPowerStatus(ptr)
603-
@ stub -version=0x600+ GetSystemPreferredUILanguages
604+
@ stdcall -version=0x600+ GetSystemPreferredUILanguages(long ptr wstr ptr)
604605
@ stdcall GetSystemRegistryQuota(ptr ptr)
605606
@ stdcall GetSystemTime(ptr)
606607
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr)
@@ -623,26 +624,26 @@
623624
@ stdcall GetThreadIOPendingFlag(long ptr)
624625
@ stdcall GetThreadId(ptr)
625626
@ stdcall GetThreadLocale()
626-
@ stub -version=0x600+ GetThreadPreferredUILanguages
627+
@ stdcall -version=0x600+ GetThreadPreferredUILanguages(long ptr wstr ptr)
627628
@ stdcall GetThreadPriority(long)
628629
@ stdcall GetThreadPriorityBoost(long ptr)
629630
@ stdcall GetThreadSelectorEntry(long long ptr)
630631
@ stdcall GetThreadTimes(long ptr ptr ptr ptr)
631-
@ stub -version=0x600+ GetThreadUILanguage
632+
@ stdcall -version=0x600+ GetThreadUILanguage()
632633
@ stdcall GetTickCount()
633-
@ stub -version=0x600+ GetTickCount64
634+
@ stdcall -version=0x600+ -ret64 GetTickCount64()
634635
@ stdcall GetTimeFormatA(long long ptr str ptr long)
635636
@ stdcall -version=0x600+ GetTimeFormatEx(wstr long ptr wstr wstr long)
636637
@ stdcall GetTimeFormatW(long long ptr wstr ptr long)
637638
@ stdcall GetTimeZoneInformation(ptr)
638639
@ stub -version=0x600+ GetTimeZoneInformationForYear
639-
@ stub -version=0x600+ GetUILanguageInfo
640+
@ stdcall -version=0x600+ GetUILanguageInfo(long wstr wstr ptr ptr)
640641
@ stdcall GetUserDefaultLCID()
641642
@ stdcall GetUserDefaultLangID()
642643
@ stdcall -version=0x600+ GetUserDefaultLocaleName(wstr long)
643644
@ stdcall GetUserDefaultUILanguage()
644645
@ stdcall GetUserGeoID(long)
645-
@ stub -version=0x600+ GetUserPreferredUILanguages
646+
@ stdcall -version=0x600+ GetUserPreferredUILanguages(long ptr wstr ptr)
646647
@ stdcall GetVDMCurrentDirectories(long long)
647648
@ stdcall GetVersion()
648649
@ stdcall GetVersionExA(ptr)
@@ -709,15 +710,15 @@
709710
@ stdcall InitAtomTable(long)
710711
@ stub -version=0x600+ InitOnceBeginInitialize
711712
@ stub -version=0x600+ InitOnceComplete
712-
@ stub -version=0x600+ InitOnceExecuteOnce
713+
@ stdcall -version=0x600+ InitOnceExecuteOnce(ptr ptr ptr ptr)
713714
@ stub -version=0x600+ InitOnceInitialize
714-
@ stub -version=0x600+ InitializeConditionVariable
715+
@ stdcall -version=0x600+ InitializeConditionVariable(ptr) ntdll.RtlInitializeConditionVariable
715716
@ stdcall InitializeCriticalSection(ptr)
716717
@ stdcall InitializeCriticalSectionAndSpinCount(ptr long)
717-
@ stub -version=0x600+ InitializeCriticalSectionEx
718+
@ stdcall -version=0x600+ InitializeCriticalSectionEx(ptr long long)
718719
@ stub -version=0x600+ InitializeProcThreadAttributeList
719720
@ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead
720-
@ stub -version=0x600+ InitializeSRWLock
721+
@ stdcall -version=0x600+ InitializeSRWLock(ptr) ntdll.RtlInitializeSRWLock
721722
@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr double double) ntdll.RtlInterlockedCompareExchange64
722723
@ stdcall -arch=i386 InterlockedCompareExchange(ptr long long)
723724
@ stdcall -arch=i386 InterlockedDecrement(ptr)
@@ -727,7 +728,7 @@
727728
@ stdcall -arch=i386 InterlockedIncrement(ptr)
728729
@ stdcall InterlockedPopEntrySList(ptr) ntdll.RtlInterlockedPopEntrySList
729730
@ stdcall InterlockedPushEntrySList(ptr ptr) ntdll.RtlInterlockedPushEntrySList
730-
@ stub -version=0x600+ InterlockedPushListSList
731+
@ fastcall -version=0x600+ InterlockedPushListSList(ptr ptr ptr long) ntdll.RtlInterlockedPushListSList
731732
@ stdcall InvalidateConsoleDIBits(long long)
732733
@ stdcall IsBadCodePtr(ptr)
733734
@ stdcall IsBadHugeReadPtr(ptr long)
@@ -747,7 +748,7 @@
747748
@ stdcall IsProcessInJob(long long ptr)
748749
@ stdcall IsProcessorFeaturePresent(long)
749750
@ stdcall IsSystemResumeAutomatic()
750-
@ stub -version=0x600+ IsThreadAFiber
751+
@ stdcall -version=0x600+ IsThreadAFiber()
751752
@ stub -version=0x600+ IsThreadpoolTimerSet
752753
@ stdcall IsTimeZoneRedirectionEnabled()
753754
@ stub -version=0x600+ IsValidCalDateTime
@@ -756,7 +757,7 @@
756757
@ stdcall IsValidLocale(long long)
757758
@ stdcall -version=0x501-0x502 IsValidUILanguage(long)
758759
@ stdcall IsWow64Process(ptr ptr)
759-
@ stub -version=0x600+ LCIDToLocaleName
760+
@ stdcall -version=0x600+ LCIDToLocaleName(long wstr long long)
760761
@ stdcall LCMapStringA(long long str long ptr long)
761762
@ stdcall -version=0x600+ LCMapStringEx(long long wstr long ptr long ptr ptr long)
762763
@ stdcall LCMapStringW(long long wstr long ptr long)
@@ -792,7 +793,7 @@
792793
@ stdcall LocalShrink(long long)
793794
@ stdcall LocalSize(long)
794795
@ stdcall LocalUnlock(long)
795-
@ stub -version=0x600+ LocaleNameToLCID
796+
@ stdcall -version=0x600+ LocaleNameToLCID(wstr long)
796797
@ stdcall LockFile(long long long long long)
797798
@ stdcall LockFileEx(long long long long long ptr)
798799
@ stdcall LockResource(long)
@@ -832,7 +833,7 @@
832833
@ stdcall OpenEventA(long long str)
833834
@ stdcall OpenEventW(long long wstr)
834835
@ stdcall OpenFile(str ptr long)
835-
@ stub -version=0x600+ OpenFileById
836+
@ stdcall -version=0x600+ OpenFileById(ptr ptr long long ptr long)
836837
@ stdcall OpenFileMappingA(long long str)
837838
@ stdcall OpenFileMappingW(long long wstr)
838839
@ stdcall OpenJobObjectA(long long str)
@@ -869,8 +870,8 @@
869870
@ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList
870871
@ stdcall QueryDosDeviceA(str ptr long)
871872
@ stdcall QueryDosDeviceW(wstr ptr long)
872-
@ stub -version=0x600+ QueryFullProcessImageNameA
873-
@ stub -version=0x600+ QueryFullProcessImageNameW
873+
@ stdcall -version=0x600+ QueryFullProcessImageNameA(ptr long str ptr)
874+
@ stdcall -version=0x600+ QueryFullProcessImageNameW(ptr long wstr ptr)
874875
@ stub -version=0x600+ QueryIdleProcessorCycleTime
875876
@ stdcall QueryInformationJobObject(long long ptr long ptr)
876877
@ stdcall QueryMemoryResourceNotification(ptr ptr)
@@ -899,8 +900,8 @@
899900
@ stdcall ReadFileEx(long ptr long ptr ptr)
900901
@ stdcall ReadFileScatter(long ptr long ptr ptr)
901902
@ stdcall ReadProcessMemory(long ptr ptr long ptr)
902-
@ stub -version=0x600+ RegisterApplicationRecoveryCallback
903-
@ stub -version=0x600+ RegisterApplicationRestart
903+
@ stdcall -version=0x600+ RegisterApplicationRecoveryCallback(ptr ptr long long)
904+
@ stdcall -version=0x600+ RegisterApplicationRestart(wstr long)
904905
@ stdcall RegisterConsoleIME(ptr ptr)
905906
@ stdcall RegisterConsoleOS2(long)
906907
@ stdcall RegisterConsoleVDM(long long long long long long long long long long long)
@@ -912,8 +913,8 @@
912913
@ stdcall ReleaseActCtx(ptr)
913914
@ stdcall ReleaseMutex(long)
914915
@ stub -version=0x600+ ReleaseMutexWhenCallbackReturns
915-
@ stub -version=0x600+ ReleaseSRWLockExclusive
916-
@ stub -version=0x600+ ReleaseSRWLockShared
916+
@ stdcall -version=0x600+ ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive
917+
@ stdcall -version=0x600+ ReleaseSRWLockShared(ptr) ntdll.RtlReleaseSRWLockShared
917918
@ stdcall ReleaseSemaphore(long long ptr)
918919
@ stub -version=0x600+ ReleaseSemaphoreWhenCallbackReturns
919920
@ stdcall RemoveDirectoryA(str)
@@ -1025,7 +1026,7 @@
10251026
@ stub -version=0x600+ SetFileAttributesTransactedA
10261027
@ stub -version=0x600+ SetFileAttributesTransactedW
10271028
@ stdcall SetFileAttributesW(wstr long)
1028-
@ stub -version=0x600+ SetFileBandwidthReservation
1029+
@ stdcall -version=0x600+ SetFileBandwidthReservation(ptr long long long ptr ptr)
10291030
@ stdcall SetFileCompletionNotificationModes(ptr long)
10301031
@ stub -version=0x600+ SetFileInformationByHandle
10311032
@ stub -version=0x600+ SetFileIoOverlappedRange
@@ -1075,7 +1076,7 @@
10751076
@ stdcall SetThreadExecutionState(long)
10761077
@ stdcall SetThreadIdealProcessor(long long)
10771078
@ stdcall SetThreadLocale(long)
1078-
@ stub -version=0x600+ SetThreadPreferredUILanguages
1079+
@ stdcall -version=0x600+ SetThreadPreferredUILanguages(long wstr ptr)
10791080
@ stdcall SetThreadPriority(long long)
10801081
@ stdcall SetThreadPriorityBoost(long long)
10811082
@ stdcall SetThreadStackGuarantee(ptr)
@@ -1099,8 +1100,8 @@
10991100
@ stdcall SignalObjectAndWait(long long long long)
11001101
@ stdcall SizeofResource(long long)
11011102
@ stdcall Sleep(long)
1102-
@ stub -version=0x600+ SleepConditionVariableCS
1103-
@ stub -version=0x600+ SleepConditionVariableSRW
1103+
@ stdcall -version=0x600+ SleepConditionVariableCS(ptr ptr long)
1104+
@ stdcall -version=0x600+ SleepConditionVariableSRW(ptr ptr long long)
11041105
@ stdcall SleepEx(long long)
11051106
@ stub -version=0x600+ StartThreadpoolIo
11061107
@ stub -version=0x600+ SubmitThreadpoolWork
@@ -1175,8 +1176,8 @@
11751176
@ stub -version=0x600+ WaitForThreadpoolWorkCallbacks
11761177
@ stdcall WaitNamedPipeA(str long)
11771178
@ stdcall WaitNamedPipeW(wstr long)
1178-
@ stub -version=0x600+ WakeAllConditionVariable
1179-
@ stub -version=0x600+ WakeConditionVariable
1179+
@ stdcall -version=0x600+ WakeAllConditionVariable(ptr) ntdll.RtlWakeAllConditionVariable
1180+
@ stdcall -version=0x600+ WakeConditionVariable(ptr) ntdll.RtlWakeConditionVariable
11801181
@ stub -version=0x600+ WerGetFlags
11811182
@ stub -version=0x600+ WerRegisterFile
11821183
@ stub -version=0x600+ WerRegisterMemoryBlock

dll/win32/kernel32/kernel32_vista/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys)
77
spec2def(kernel32_vista.dll kernel32_vista.spec ADD_IMPORTLIB)
88

99
list(APPEND SOURCE
10-
DllMain.c
1110
GetFileInformationByHandleEx.c
1211
GetTickCount64.c
1312
InitOnceExecuteOnce.c
1413
sync.c
15-
vista.c
16-
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
14+
vista.c)
1715

18-
add_library(kernel32_vista MODULE ${SOURCE})
16+
add_library(kernel32_vista_static ${SOURCE})
17+
add_dependencies(kernel32_vista_static psdk)
18+
add_library(kernel32_vista MODULE DllMain.c ${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
1919
set_module_type(kernel32_vista win32dll ENTRYPOINT DllMain 12)
20-
target_link_libraries(kernel32_vista kernel32_shared)
20+
target_link_libraries(kernel32_vista kernel32_vista_static kernel32_shared)
2121
add_importlibs(kernel32_vista kernel32 ntdll_vista ntdll)
2222
add_delay_importlibs(kernel32_vista ntdll_vista)
2323
add_dependencies(kernel32_vista psdk)

dll/win32/kernel32/winnls/string/lang.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ DEBUG_CHANNEL(nls);
3232
#include "japanese.h"
3333
#endif
3434

35+
#undef WINVER
36+
#define WINVER 0x600
37+
38+
/* From winnls.h */
39+
#define LOCALE_NAME_USER_DEFAULT NULL
40+
3541
#define REG_SZ 1
3642
extern int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen);
3743
extern int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen);

dll/win32/kernel32/winnls/string/lcformat.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@
3131
#include <debug.h>
3232
DEBUG_CHANNEL(nls);
3333

34+
#undef _WIN32_WINNT
35+
#undef WINVER
36+
#define _WIN32_WINNT DLL_EXPORT_VERSION
37+
#define WINVER DLL_EXPORT_VERSION
38+
39+
LCID WINAPI LocaleNameToLCID(_In_ LPCWSTR, _In_ DWORD);
40+
#define LOCALE_SSHORTESTDAYNAME1 96
41+
#define LOCALE_SSHORTESTDAYNAME2 97
42+
#define LOCALE_SSHORTESTDAYNAME3 98
43+
#define LOCALE_SSHORTESTDAYNAME4 99
44+
#define LOCALE_SSHORTESTDAYNAME5 100
45+
#define LOCALE_SSHORTESTDAYNAME6 101
46+
#define LOCALE_SSHORTESTDAYNAME7 102
47+
3448
#define CRITICAL_SECTION RTL_CRITICAL_SECTION
3549
#define CRITICAL_SECTION_DEBUG RTL_CRITICAL_SECTION_DEBUG
3650
#define CALINFO_MAX_YEAR 2029

0 commit comments

Comments
 (0)