mirror of
https://github.com/reactos/reactos.git
synced 2024-11-28 05:53:31 +08:00
[KERNEL32_VISTA] Move vista.c from kernel32 to kernel32_vista
- Remove duplicated functions - Use AreFileApisANSI() instead of global variable bIsFileApiAnsi in shared kernel32_shared
This commit is contained in:
parent
fcd83242d4
commit
d8b5c00c33
@ -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
|
||||
|
@ -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) );
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -7,126 +7,20 @@
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <k32.h>
|
||||
#include <k32_vista.h>
|
||||
|
||||
#if _WIN32_WINNT != _WIN32_WINNT_VISTA
|
||||
#error "This file must be compiled with _WIN32_WINNT == _WIN32_WINNT_VISTA"
|
||||
#endif
|
||||
|
||||
// This is defined only in ntifs.h
|
||||
#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
|
||||
|
||||
#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);
|
||||
#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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @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
|
Loading…
Reference in New Issue
Block a user