From 44f84b55f3a3e94e0f4693410dadd005f609f58e Mon Sep 17 00:00:00 2001 From: David Elliott Date: Sun, 29 Oct 2000 01:24:54 +0000 Subject: [PATCH] Added basic working stubs of new Windows 2000 API functions. --- dlls/advapi32/advapi32.spec | 1 + dlls/advapi32/registry.c | 13 +++++++++++++ dlls/kernel/kernel32.spec | 7 +++++++ dlls/ntdll/critsection.c | 14 ++++++++++++++ dlls/ntdll/ntdll.spec | 3 +++ dlls/user/user32.spec | 4 ++++ files/directory.c | 18 ++++++++++++++++++ include/ntddk.h | 1 + memory/registry.c | 13 +++++++++++++ scheduler/critsection.c | 23 +++++++++++++++++++++++ scheduler/thread.c | 14 ++++++++++++++ windows/clipboard.c | 16 ++++++++++++++++ windows/winpos.c | 22 ++++++++++++++++++++++ 13 files changed, 149 insertions(+) diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec index a2ef2525384..713435a3243 100644 --- a/dlls/advapi32/advapi32.spec +++ b/dlls/advapi32/advapi32.spec @@ -191,6 +191,7 @@ import ntdll.dll @ stdcall RegLoadKeyA(long str str) RegLoadKeyA @ stdcall RegLoadKeyW(long wstr wstr) RegLoadKeyW @ stdcall RegNotifyChangeKeyValue(long long long long long) RegNotifyChangeKeyValue +@ stdcall RegOpenCurrentUser(long ptr) RegOpenCurrentUser @ stdcall RegOpenKeyA(long str ptr) RegOpenKeyA @ stdcall RegOpenKeyExA(long str long long ptr) RegOpenKeyExA @ stdcall RegOpenKeyExW(long wstr long long ptr) RegOpenKeyExW diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 24560e295b8..5018e83d099 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -248,6 +248,19 @@ DWORD WINAPI RegOpenKeyA( HKEY hkey, LPCSTR name, LPHKEY retkey ) } +/****************************************************************************** + * RegOpenCurrentUser [ADVAPI32] + * FIXME: This function is supposed to retrieve a handle to the + * HKEY_CURRENT_USER for the user the current thread is impersonating. + * Since Wine does not currently allow threads to impersonate other users, + * this stub should work fine. + */ +DWORD WINAPI RegOpenCurrentUser( REGSAM access, PHKEY retkey ) +{ + return RegOpenKeyExA( HKEY_CURRENT_USER, "", 0, access, retkey ); +} + + /****************************************************************************** * RegEnumKeyExW [ADVAPI32.139] diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec index 9ec04762b93..9d1df99954d 100644 --- a/dlls/kernel/kernel32.spec +++ b/dlls/kernel/kernel32.spec @@ -928,3 +928,10 @@ import ntdll.dll #1599 wrong ordinal (249 in Win32s's W32SCOMB.DLL) ! 1599 stdcall Get16DLLAddress(long str) Get16DLLAddress + +# Windows 2000, Terminal Server 4.0 SP4 functions +@ stdcall GetSystemWindowsDirectoryA(ptr long) GetSystemWindowsDirectoryA +@ stdcall GetSystemWindowsDirectoryW(ptr long) GetSystemWindowsDirectoryW +@ stdcall InitializeCriticalSectionAndSpinCount(ptr long) InitializeCriticalSectionAndSpinCount +@ stdcall SetCriticalSectionSpinCount(ptr long) SetCriticalSectionSpinCount +@ stdcall ProcessIdToSessionId(long ptr) ProcessIdToSessionId diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c index b40fa10eb4b..4793b965061 100644 --- a/dlls/ntdll/critsection.c +++ b/dlls/ntdll/critsection.c @@ -148,6 +148,20 @@ NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit ) return STATUS_SUCCESS; } +/*********************************************************************** + * RtlInitializeCriticalSectionAndSpinCount (NTDLL.@) + * The InitializeCriticalSectionAndSpinCount (KERNEL32) function is + * available on NT4SP3 or later, and Win98 or later. + * I am assuming that this is the correct definition given the MSDN + * docs for the kernel32 functions. + */ +NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount( RTL_CRITICAL_SECTION *crit, DWORD spincount ) +{ + if(spincount) FIXME("critsection=%p: spincount=%ld not supported\n", crit, spincount); + crit->SpinCount = spincount; + return RtlInitializeCriticalSection( crit ); +} + /*********************************************************************** * RtlDeleteCriticalSection (NTDLL.@) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index f73e40a5559..77994993d41 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -411,6 +411,7 @@ type win32 @ stdcall RtlInitializeBitMap(long long long) RtlInitializeBitMap @ stub RtlInitializeContext @ stdcall RtlInitializeCriticalSection(ptr) RtlInitializeCriticalSection +@ stdcall RtlInitializeCriticalSectionAndSpinCount(ptr long) RtlInitializeCriticalSectionAndSpinCount @ stdcall RtlInitializeGenericTable() RtlInitializeGenericTable @ stub RtlInitializeRXact @ stdcall RtlInitializeResource(ptr) RtlInitializeResource @@ -887,6 +888,7 @@ type win32 @ cdecl _strnicmp(str str long) strncasecmp @ cdecl _strupr(str) _strupr @ cdecl _ultoa(long ptr long) _ultoa +@ stub _ultow @ cdecl _vsnprintf(ptr long ptr ptr) vsnprintf @ cdecl _wcsicmp(wstr wstr) NTDLL__wcsicmp @ cdecl _wcslwr(wstr) NTDLL__wcslwr @@ -936,6 +938,7 @@ type win32 @ cdecl strrchr(str long) strrchr @ cdecl strspn(str str) strspn @ cdecl strstr(str str) strstr +@ cdecl strtol(str ptr long) strtol @ varargs swprintf(wstr wstr) wsprintfW @ stub tan @ cdecl tolower(long) tolower diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index f7461d6cfb8..b86ea445894 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -642,3 +642,7 @@ import ntdll.dll @ stdcall RegisterDeviceNotificationA(long ptr long) RegisterDeviceNotificationA @ stub RegisterDeviceNotificationW @ stub UnregisterDeviceNotification +# win98/win2k +@ stdcall GetClipboardSequenceNumber () GetClipboardSequenceNumber +@ stdcall AllowSetForegroundWindow (long) AllowSetForegroundWindow +@ stdcall LockSetForegroundWindow (long) LockSetForegroundWindow diff --git a/files/directory.c b/files/directory.c index e1fe0e7877d..71ca1c61348 100644 --- a/files/directory.c +++ b/files/directory.c @@ -282,6 +282,24 @@ UINT WINAPI GetWindowsDirectoryW( LPWSTR path, UINT count ) } +/*********************************************************************** + * GetSystemWindowsDirectoryA (KERNEL32) W2K, TS4.0SP4 + */ +UINT WINAPI GetSystemWindowsDirectoryA( LPSTR path, UINT count ) +{ + return GetWindowsDirectoryA( path, count ); +} + + +/*********************************************************************** + * GetSystemWindowsDirectoryW (KERNEL32) W2K, TS4.0SP4 + */ +UINT WINAPI GetSystemWindowsDirectoryW( LPWSTR path, UINT count ) +{ + return GetWindowsDirectoryW( path, count ); +} + + /*********************************************************************** * GetSystemDirectory16 (KERNEL.135) */ diff --git a/include/ntddk.h b/include/ntddk.h index 8bc5160122e..06bd0837398 100644 --- a/include/ntddk.h +++ b/include/ntddk.h @@ -897,6 +897,7 @@ NTSTATUS WINAPI NtResetEvent(HANDLE,PULONG); NTSTATUS WINAPI NtSetEvent(HANDLE,PULONG); NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit ); +NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount( RTL_CRITICAL_SECTION *crit, DWORD spincount ); NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit ); NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit ); NTSTATUS WINAPI RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION *crit ); diff --git a/memory/registry.c b/memory/registry.c index 24560e295b8..5018e83d099 100644 --- a/memory/registry.c +++ b/memory/registry.c @@ -248,6 +248,19 @@ DWORD WINAPI RegOpenKeyA( HKEY hkey, LPCSTR name, LPHKEY retkey ) } +/****************************************************************************** + * RegOpenCurrentUser [ADVAPI32] + * FIXME: This function is supposed to retrieve a handle to the + * HKEY_CURRENT_USER for the user the current thread is impersonating. + * Since Wine does not currently allow threads to impersonate other users, + * this stub should work fine. + */ +DWORD WINAPI RegOpenCurrentUser( REGSAM access, PHKEY retkey ) +{ + return RegOpenKeyExA( HKEY_CURRENT_USER, "", 0, access, retkey ); +} + + /****************************************************************************** * RegEnumKeyExW [ADVAPI32.139] diff --git a/scheduler/critsection.c b/scheduler/critsection.c index dabc37c4ef6..585ffcef260 100644 --- a/scheduler/critsection.c +++ b/scheduler/critsection.c @@ -27,6 +27,29 @@ void WINAPI InitializeCriticalSection( CRITICAL_SECTION *crit ) if (ret) RtlRaiseStatus( ret ); } +/*********************************************************************** + * InitializeCriticalSectionAndSpinCount (KERNEL32) + */ +BOOL WINAPI InitializeCriticalSectionAndSpinCount( CRITICAL_SECTION *crit, DWORD spincount ) +{ + NTSTATUS ret = RtlInitializeCriticalSectionAndSpinCount( crit, spincount ); + if (ret) RtlRaiseStatus( ret ); + return !ret; +} + +/*********************************************************************** + * SetCriticalSectionSpinCount (KERNEL32) + * This function is available on NT4SP3 or later, but not Win98 + * It is SMP related + */ +DWORD WINAPI SetCriticalSectionSpinCount( CRITICAL_SECTION *crit, DWORD spincount ) +{ + ULONG_PTR oldspincount = crit->SpinCount; + if(spincount) FIXME("critsection=%p: spincount=%ld not supported\n", crit, spincount); + crit->SpinCount = spincount; + return oldspincount; +} + /*********************************************************************** * MakeCriticalSectionGlobal (KERNEL32.515) */ diff --git a/scheduler/thread.c b/scheduler/thread.c index debf4fa8d24..9647432654a 100644 --- a/scheduler/thread.c +++ b/scheduler/thread.c @@ -844,6 +844,20 @@ HANDLE WINAPI GetCurrentThread(void) } +/*********************************************************************** + * ProcessIdToSessionId (KERNEL32) + * This function is available on Terminal Server 4SP4 and Windows 2000 + */ +BOOL WINAPI ProcessIdToSessionId( DWORD procid, DWORD *sessionid_ptr ) +{ + /* According to MSDN, if the calling process is not in a terminal + * services environment, then the sessionid returned is zero. + */ + *sessionid_ptr = 0; + return TRUE; +} + + #ifdef __i386__ /* void WINAPI SetLastError( DWORD error ); */ diff --git a/windows/clipboard.c b/windows/clipboard.c index 0e9456203bf..0184d4e3e3b 100644 --- a/windows/clipboard.c +++ b/windows/clipboard.c @@ -1297,3 +1297,19 @@ INT WINAPI GetPriorityClipboardFormat( UINT *lpPriorityList, INT nCount ) return -1; } + +/************************************************************************** + * GetClipboardSequenceNumber (USER32) + * Supported on Win2k/Win98 + * MSDN: Windows clipboard code keeps a serial number for the clipboard + * for each window station. The number is incremented whenever the + * contents change or are emptied. + * If you do not have WINSTA_ACCESSCLIPBOARD then the function returns 0 + */ +DWORD WINAPI GetClipboardSequenceNumber(VOID) +{ + FIXME("Returning 0, see windows/clipboard.c\n"); + /* FIXME: Use serial numbers */ + return 0; +} + diff --git a/windows/winpos.c b/windows/winpos.c index f8feddd5722..109b73eefd4 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -985,6 +985,28 @@ BOOL WINAPI SetForegroundWindow( HWND hwnd ) } +/******************************************************************* + * AllowSetForegroundWindow (USER32) + */ +BOOL WINAPI AllowSetForegroundWindow( DWORD procid ) +{ + /* FIXME: If Win98/2000 style SetForegroundWindow behavior is + * implemented, then fix this function. */ + return TRUE; +} + + +/******************************************************************* + * LockSetForegroundWindow (USER32) + */ +BOOL WINAPI LockSetForegroundWindow( UINT lockcode ) +{ + /* FIXME: If Win98/2000 style SetForegroundWindow behavior is + * implemented, then fix this function. */ + return TRUE; +} + + /******************************************************************* * GetShellWindow16 (USER.600) */