https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8b5c00c338e3cb508a6a…
commit d8b5c00c338e3cb508a6aabf00cdbfd32906c542
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Sep 13 18:55:17 2020 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Sep 25 09:45:54 2020 +0200
[KERNEL32_VISTA] Move vista.c from kernel32 to kernel32_vista
- Remove duplicated functions
- Use AreFileApisANSI() instead of global variable bIsFileApiAnsi in shared
kernel32_shared
---
dll/win32/kernel32/CMakeLists.txt | 1 -
dll/win32/kernel32/client/file/fileutils.c | 10 +-
dll/win32/kernel32/kernel32_vista/CMakeLists.txt | 3 +
dll/win32/kernel32/kernel32_vista/k32_vista.h | 11 ++
.../kernel32/kernel32_vista/kernel32_vista.spec | 24 ++++
.../kernel32/{client => kernel32_vista}/vista.c | 155 ++-------------------
6 files changed, 57 insertions(+), 147 deletions(-)
diff --git a/dll/win32/kernel32/CMakeLists.txt b/dll/win32/kernel32/CMakeLists.txt
index 616e0f453b5..7d31686837d 100644
--- a/dll/win32/kernel32/CMakeLists.txt
+++ b/dll/win32/kernel32/CMakeLists.txt
@@ -44,7 +44,6 @@ list(APPEND SOURCE
client/vdm.c
client/version.c
client/virtmem.c
- client/vista.c
client/console/alias.c
client/console/console.c
client/console/history.c
diff --git a/dll/win32/kernel32/client/file/fileutils.c
b/dll/win32/kernel32/client/file/fileutils.c
index 078f83006e2..2257608588a 100644
--- a/dll/win32/kernel32/client/file/fileutils.c
+++ b/dll/win32/kernel32/client/file/fileutils.c
@@ -28,7 +28,7 @@ FilenameA2W(LPCSTR NameA, BOOL alloc)
RtlInitAnsiString(&str, NameA);
pstrW = alloc ? &strW : &NtCurrentTeb()->StaticUnicodeString;
- if (bIsFileApiAnsi)
+ if (AreFileApisANSI())
Status= RtlAnsiStringToUnicodeString( pstrW, &str, (BOOLEAN)alloc );
else
Status= RtlOemStringToUnicodeString( pstrW, &str, (BOOLEAN)alloc );
@@ -64,7 +64,7 @@ FilenameU2A_FitOrFail(
/* destLen should never exceed MAX_PATH */
if (destLen > MAX_PATH) destLen = MAX_PATH;
- ret = bIsFileApiAnsi? RtlUnicodeStringToAnsiSize(SourceU) :
RtlUnicodeStringToOemSize(SourceU);
+ ret = AreFileApisANSI() ? RtlUnicodeStringToAnsiSize(SourceU) :
RtlUnicodeStringToOemSize(SourceU);
/* ret incl. nullchar */
if (DestA && (INT)ret <= destLen)
@@ -75,7 +75,7 @@ FilenameU2A_FitOrFail(
str.MaximumLength = (USHORT)destLen;
- if (bIsFileApiAnsi)
+ if (AreFileApisANSI())
RtlUnicodeStringToAnsiString(&str, SourceU, FALSE );
else
RtlUnicodeStringToOemString(&str, SourceU, FALSE );
@@ -129,7 +129,7 @@ FilenameA2W_N(
if (srclen < 0) srclen = strlen( src ) + 1;
- if (bIsFileApiAnsi)
+ if (AreFileApisANSI())
RtlMultiByteToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src,
srclen );
else
RtlOemToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src, srclen );
@@ -154,7 +154,7 @@ FilenameW2A_N(
if (srclen < 0) srclen = wcslen( src ) + 1;
- if (bIsFileApiAnsi)
+ if (AreFileApisANSI())
RtlUnicodeToMultiByteN( dest, destlen, &ret, (LPWSTR) src, srclen *
sizeof(WCHAR));
else
RtlUnicodeToOemN( dest, destlen, &ret, (LPWSTR) src, srclen * sizeof(WCHAR)
);
diff --git a/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
b/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
index 915346689a1..51efae70f8b 100644
--- a/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
+++ b/dll/win32/kernel32/kernel32_vista/CMakeLists.txt
@@ -3,6 +3,7 @@ remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
add_definitions(-D_WIN32_WINNT=0x600 -DWINVER=0x600)
add_definitions(-D_KERNEL32_)
+include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys)
spec2def(kernel32_vista.dll kernel32_vista.spec ADD_IMPORTLIB)
list(APPEND SOURCE
@@ -11,10 +12,12 @@ list(APPEND SOURCE
GetTickCount64.c
InitOnceExecuteOnce.c
sync.c
+ vista.c
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
add_library(kernel32_vista MODULE ${SOURCE})
set_module_type(kernel32_vista win32dll ENTRYPOINT DllMain 12)
+target_link_libraries(kernel32_vista 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/kernel32_vista/k32_vista.h
b/dll/win32/kernel32/kernel32_vista/k32_vista.h
index fff9ba8d0b4..7f78e53e68a 100644
--- a/dll/win32/kernel32/kernel32_vista/k32_vista.h
+++ b/dll/win32/kernel32/kernel32_vista/k32_vista.h
@@ -6,7 +6,18 @@
#include <windef.h>
#include <winbase.h>
+/* Redefine NTDDI_VERSION to 2K3 SP1 to get correct NDK definitions */
+#undef NTDDI_VERSION
+#define NTDDI_VERSION NTDDI_WS03SP1
+
+#include <ndk/iofuncs.h>
#include <ndk/kefuncs.h>
+#include <ndk/obfuncs.h>
#include <ndk/psfuncs.h>
#include <ndk/rtlfuncs.h>
+/* CSRSS Headers */
+#include <win/base.h>
+
+/* Internal Kernel32 Header */
+#include "../include/kernel32.h"
diff --git a/dll/win32/kernel32/kernel32_vista/kernel32_vista.spec
b/dll/win32/kernel32/kernel32_vista/kernel32_vista.spec
index f61e6e6dc36..02c1cb05739 100644
--- a/dll/win32/kernel32/kernel32_vista/kernel32_vista.spec
+++ b/dll/win32/kernel32/kernel32_vista/kernel32_vista.spec
@@ -16,3 +16,27 @@
@ stdcall WakeConditionVariable(ptr)
@ stdcall InitializeCriticalSectionEx(ptr long long)
+
+@ stdcall ApplicationRecoveryFinished(long)
+@ stdcall ApplicationRecoveryInProgress(ptr)
+@ stdcall CreateSymbolicLinkA(str str long)
+@ stdcall CreateSymbolicLinkW(wstr wstr long)
+@ stdcall GetApplicationRecoveryCallback(ptr ptr ptr ptr ptr)
+@ stdcall GetApplicationRestart(ptr wstr ptr ptr)
+@ stdcall GetFileBandwidthReservation(ptr ptr ptr ptr ptr ptr)
+@ stdcall GetFileMUIInfo(long wstr ptr ptr)
+@ stdcall GetFileMUIPath(long wstr wstr ptr wstr ptr ptr)
+@ stdcall GetFinalPathNameByHandleA(ptr str long long)
+@ stdcall GetFinalPathNameByHandleW(ptr wstr long long)
+@ stdcall GetSystemPreferredUILanguages(long ptr wstr ptr)
+@ stdcall GetThreadPreferredUILanguages(long ptr wstr ptr)
+@ stdcall GetThreadUILanguage()
+@ stdcall GetUILanguageInfo(long wstr wstr ptr ptr)
+@ stdcall GetUserPreferredUILanguages(long ptr wstr ptr)
+@ stdcall OpenFileById(ptr ptr long long ptr long)
+@ stdcall QueryFullProcessImageNameA(ptr long str ptr)
+@ stdcall QueryFullProcessImageNameW(ptr long wstr ptr)
+@ stdcall RegisterApplicationRecoveryCallback(ptr ptr long long)
+@ stdcall RegisterApplicationRestart(wstr long)
+@ stdcall SetFileBandwidthReservation(ptr long long long ptr ptr)
+@ stdcall SetThreadPreferredUILanguages(long wstr ptr)
diff --git a/dll/win32/kernel32/client/vista.c
b/dll/win32/kernel32/kernel32_vista/vista.c
similarity index 83%
rename from dll/win32/kernel32/client/vista.c
rename to dll/win32/kernel32/kernel32_vista/vista.c
index 8fa60a995cd..743cb430721 100644
--- a/dll/win32/kernel32/client/vista.c
+++ b/dll/win32/kernel32/kernel32_vista/vista.c
@@ -7,125 +7,19 @@
/* INCLUDES *******************************************************************/
-#include <k32.h>
+#include <k32_vista.h>
-#define NDEBUG
-#include <debug.h>
-
-#if _WIN32_WINNT >= 0x600
-
-/* FIXME: Move these RTL declarations to the NDK */
-NTSTATUS
-NTAPI
-RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable,
- IN OUT PRTL_CRITICAL_SECTION CriticalSection,
- IN PLARGE_INTEGER TimeOut OPTIONAL);
-
-NTSTATUS
-NTAPI
-RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable,
- IN OUT PRTL_SRWLOCK SRWLock,
- IN PLARGE_INTEGER TimeOut OPTIONAL,
- IN ULONG Flags);
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-SleepConditionVariableCS(IN OUT PCONDITION_VARIABLE ConditionVariable,
- IN OUT PCRITICAL_SECTION CriticalSection,
- IN DWORD dwMilliseconds)
-{
- NTSTATUS Status = STATUS_SUCCESS;
-#if 0
- LARGE_INTEGER TimeOut;
- PLARGE_INTEGER TimeOutPtr = NULL;
-
- if (dwMilliseconds != INFINITE)
- {
- TimeOut.QuadPart = dwMilliseconds * -10000LL;
- TimeOutPtr = &TimeOut;
- }
-
- Status = RtlSleepConditionVariableCS((PRTL_CONDITION_VARIABLE)ConditionVariable,
- (PRTL_CRITICAL_SECTION)CriticalSection,
- TimeOutPtr);
+#if _WIN32_WINNT != _WIN32_WINNT_VISTA
+#error "This file must be compiled with _WIN32_WINNT == _WIN32_WINNT_VISTA"
#endif
- if (!NT_SUCCESS(Status))
- {
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-SleepConditionVariableSRW(IN OUT PCONDITION_VARIABLE ConditionVariable,
- IN OUT PSRWLOCK SRWLock,
- IN DWORD dwMilliseconds,
- IN ULONG Flags)
-{
- NTSTATUS Status = STATUS_SUCCESS;
-#if 0
- LARGE_INTEGER TimeOut;
- PLARGE_INTEGER TimeOutPtr = NULL;
- if (dwMilliseconds != INFINITE)
- {
- TimeOut.QuadPart = dwMilliseconds * -10000LL;
- TimeOutPtr = &TimeOut;
- }
+// This is defined only in ntifs.h
+#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER,
GenericReparseBuffer)
- Status = RtlSleepConditionVariableSRW((PRTL_CONDITION_VARIABLE)ConditionVariable,
- (PRTL_SRWLOCK)SRWLock,
- TimeOutPtr,
- Flags);
-#endif
- if (!NT_SUCCESS(Status))
- {
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection,
- IN DWORD dwSpinCount,
- IN DWORD flags)
-{
- NTSTATUS Status;
-
- /* FIXME: Flags ignored */
-
- /* Initialize the critical section */
- Status = RtlInitializeCriticalSectionAndSpinCount(
- (PRTL_CRITICAL_SECTION)lpCriticalSection,
- dwSpinCount);
- if (!NT_SUCCESS(Status))
- {
- /* Set failure code */
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- /* Success */
- return TRUE;
-}
+#define NDEBUG
+#include <debug.h>
+/* PUBLIC FUNCTIONS ***********************************************************/
/*
* @implemented
@@ -267,7 +161,7 @@ GetApplicationRestart(IN HANDLE hProcess,
*/
VOID
WINAPI
-RecoveryFinished(IN BOOL bSuccess)
+ApplicationRecoveryFinished(IN BOOL bSuccess)
{
UNIMPLEMENTED;
}
@@ -278,7 +172,7 @@ RecoveryFinished(IN BOOL bSuccess)
*/
HRESULT
WINAPI
-RecoveryInProgress(OUT PBOOL pbCancelled)
+ApplicationRecoveryInProgress(OUT PBOOL pbCancelled)
{
UNIMPLEMENTED;
return E_FAIL;
@@ -692,30 +586,6 @@ OpenFileById(IN HANDLE hFile,
}
-/*
- * @implemented
- */
-ULONGLONG
-WINAPI
-GetTickCount64(VOID)
-{
- ULARGE_INTEGER TickCount;
-
- while (TRUE)
- {
- TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time;
- TickCount.LowPart = SharedUserData->TickCount.LowPart;
-
- if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time) break;
-
- YieldProcessor();
- }
-
- return (UInt32x32To64(TickCount.LowPart, SharedUserData->TickCountMultiplier)
>> 24) +
- (UInt32x32To64(TickCount.HighPart, SharedUserData->TickCountMultiplier)
<< 8);
-}
-
-#endif
/*
Vista+ MUI support functions
@@ -766,6 +636,7 @@ GetFileMUIPath(
/*
* @unimplemented
*/
+#if 0 // This is Windows 7+
BOOL
WINAPI
GetProcessPreferredUILanguages(
@@ -778,6 +649,7 @@ GetProcessPreferredUILanguages(
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
+#endif
/*
* @unimplemented
@@ -860,6 +732,7 @@ GetUserPreferredUILanguages(
/*
* @unimplemented
*/
+#if 0 // Tis is Windows 7+
BOOL
WINAPI
SetProcessPreferredUILanguages(
@@ -871,7 +744,7 @@ SetProcessPreferredUILanguages(
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
-
+#endif
/*
* @unimplemented