Added basic working stubs of new Windows 2000 API functions.

diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index a2ef252..713435a 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -191,6 +191,7 @@
 @ 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 24560e2..5018e83 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -248,6 +248,19 @@
 }
 
 
+/******************************************************************************
+ *           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 9ec0476..9d1df99 100644
--- a/dlls/kernel/kernel32.spec
+++ b/dlls/kernel/kernel32.spec
@@ -928,3 +928,10 @@
 
 #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 b40fa10..4793b96 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -148,6 +148,20 @@
     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 f73e40a..7799499 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -411,6 +411,7 @@
 @ 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 @@
 @ 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 @@
 @ 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 f7461d6..b86ea44 100644
--- a/dlls/user/user32.spec
+++ b/dlls/user/user32.spec
@@ -642,3 +642,7 @@
 @ 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 e1fe0e7..71ca1c6 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -283,6 +283,24 @@
 
 
 /***********************************************************************
+ *           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)
  */
 UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
diff --git a/include/ntddk.h b/include/ntddk.h
index 8bc5160..06bd083 100644
--- a/include/ntddk.h
+++ b/include/ntddk.h
@@ -897,6 +897,7 @@
 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 24560e2..5018e83 100644
--- a/memory/registry.c
+++ b/memory/registry.c
@@ -248,6 +248,19 @@
 }
 
 
+/******************************************************************************
+ *           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 dabc37c..585ffce 100644
--- a/scheduler/critsection.c
+++ b/scheduler/critsection.c
@@ -28,6 +28,29 @@
 }
 
 /***********************************************************************
+ *           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)
  */
 void WINAPI MakeCriticalSectionGlobal( CRITICAL_SECTION *crit )
diff --git a/scheduler/thread.c b/scheduler/thread.c
index debf4fa..9647432 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -844,6 +844,20 @@
 }
 
 
+/***********************************************************************
+ * 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 0e94562..0184d4e 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -1297,3 +1297,19 @@
     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 f8feddd..109b73e 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -986,6 +986,28 @@
 
 
 /*******************************************************************
+ *         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)
  */
 HWND16 WINAPI GetShellWindow16(void)