Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * NT basis DLL |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3 | * |
Marcus Meissner | 51505b1 | 1998-11-01 14:00:21 +0000 | [diff] [blame] | 4 | * This file contains the Rtl* API functions. These should be implementable. |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 5 | * |
Marcus Meissner | 51505b1 | 1998-11-01 14:00:21 +0000 | [diff] [blame] | 6 | * Copyright 1996-1998 Marcus Meissner |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 7 | * 1999 Alex Korobka |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 8 | * |
| 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2.1 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public |
| 20 | * License along with this library; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 22 | */ |
| 23 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 24 | #include <stdlib.h> |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 25 | #include <stdio.h> |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 26 | #include <string.h> |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 27 | #include "wine/debug.h" |
Jeremy White | d3e22d9 | 2000-02-10 19:03:02 +0000 | [diff] [blame] | 28 | #include "windef.h" |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 29 | #include "winerror.h" |
| 30 | #include "stackframe.h" |
| 31 | |
Juergen Schmied | 026d9db | 1999-03-09 17:47:51 +0000 | [diff] [blame] | 32 | #include "ntddk.h" |
Dietmar Kling | 8285371 | 1998-10-16 14:28:45 +0000 | [diff] [blame] | 33 | #include "winreg.h" |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 34 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 35 | WINE_DEFAULT_DEBUG_CHANNEL(ntdll); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 36 | |
Marcus Meissner | 317af32 | 1999-02-17 13:51:06 +0000 | [diff] [blame] | 37 | |
Alexandre Julliard | 301df6b | 2001-08-16 18:12:56 +0000 | [diff] [blame] | 38 | static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT("peb_lock"); |
Alexandre Julliard | 361943a | 2000-12-11 03:41:19 +0000 | [diff] [blame] | 39 | |
Juergen Schmied | 026d9db | 1999-03-09 17:47:51 +0000 | [diff] [blame] | 40 | /* |
| 41 | * resource functions |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 42 | */ |
| 43 | |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 44 | /*********************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 45 | * RtlInitializeResource (NTDLL.@) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 46 | * |
| 47 | * xxxResource() functions implement multiple-reader-single-writer lock. |
| 48 | * The code is based on information published in WDJ January 1999 issue. |
| 49 | */ |
| 50 | void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl) |
| 51 | { |
| 52 | if( rwl ) |
| 53 | { |
| 54 | rwl->iNumberActive = 0; |
| 55 | rwl->uExclusiveWaiters = 0; |
| 56 | rwl->uSharedWaiters = 0; |
| 57 | rwl->hOwningThreadId = 0; |
| 58 | rwl->dwTimeoutBoost = 0; /* no info on this one, default value is 0 */ |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 59 | RtlInitializeCriticalSection( &rwl->rtlCS ); |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 60 | NtCreateSemaphore( &rwl->hExclusiveReleaseSemaphore, 0, NULL, 0, 65535 ); |
| 61 | NtCreateSemaphore( &rwl->hSharedReleaseSemaphore, 0, NULL, 0, 65535 ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 62 | } |
| 63 | } |
| 64 | |
| 65 | |
| 66 | /*********************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 67 | * RtlDeleteResource (NTDLL.@) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 68 | */ |
| 69 | void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl) |
| 70 | { |
| 71 | if( rwl ) |
| 72 | { |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 73 | RtlEnterCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 74 | if( rwl->iNumberActive || rwl->uExclusiveWaiters || rwl->uSharedWaiters ) |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 75 | MESSAGE("Deleting active MRSW lock (%p), expect failure\n", rwl ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 76 | rwl->hOwningThreadId = 0; |
| 77 | rwl->uExclusiveWaiters = rwl->uSharedWaiters = 0; |
| 78 | rwl->iNumberActive = 0; |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 79 | NtClose( rwl->hExclusiveReleaseSemaphore ); |
| 80 | NtClose( rwl->hSharedReleaseSemaphore ); |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 81 | RtlLeaveCriticalSection( &rwl->rtlCS ); |
| 82 | RtlDeleteCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 83 | } |
| 84 | } |
| 85 | |
| 86 | |
| 87 | /*********************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 88 | * RtlAcquireResourceExclusive (NTDLL.@) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 89 | */ |
| 90 | BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait) |
| 91 | { |
| 92 | BYTE retVal = 0; |
| 93 | if( !rwl ) return 0; |
| 94 | |
| 95 | start: |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 96 | RtlEnterCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 97 | if( rwl->iNumberActive == 0 ) /* lock is free */ |
| 98 | { |
| 99 | rwl->iNumberActive = -1; |
| 100 | retVal = 1; |
| 101 | } |
| 102 | else if( rwl->iNumberActive < 0 ) /* exclusive lock in progress */ |
| 103 | { |
Alexandre Julliard | 7375597 | 2002-07-31 19:26:03 +0000 | [diff] [blame] | 104 | if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() ) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 105 | { |
| 106 | retVal = 1; |
| 107 | rwl->iNumberActive--; |
| 108 | goto done; |
| 109 | } |
| 110 | wait: |
| 111 | if( fWait ) |
| 112 | { |
| 113 | rwl->uExclusiveWaiters++; |
| 114 | |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 115 | RtlLeaveCriticalSection( &rwl->rtlCS ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 116 | if( WaitForSingleObject( rwl->hExclusiveReleaseSemaphore, INFINITE ) == WAIT_FAILED ) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 117 | goto done; |
| 118 | goto start; /* restart the acquisition to avoid deadlocks */ |
| 119 | } |
| 120 | } |
| 121 | else /* one or more shared locks are in progress */ |
| 122 | if( fWait ) |
| 123 | goto wait; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 124 | |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 125 | if( retVal == 1 ) |
Alexandre Julliard | 7375597 | 2002-07-31 19:26:03 +0000 | [diff] [blame] | 126 | rwl->hOwningThreadId = (HANDLE)GetCurrentThreadId(); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 127 | done: |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 128 | RtlLeaveCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 129 | return retVal; |
| 130 | } |
| 131 | |
| 132 | /*********************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 133 | * RtlAcquireResourceShared (NTDLL.@) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 134 | */ |
| 135 | BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait) |
| 136 | { |
| 137 | DWORD dwWait = WAIT_FAILED; |
| 138 | BYTE retVal = 0; |
| 139 | if( !rwl ) return 0; |
| 140 | |
| 141 | start: |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 142 | RtlEnterCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 143 | if( rwl->iNumberActive < 0 ) |
| 144 | { |
Alexandre Julliard | 7375597 | 2002-07-31 19:26:03 +0000 | [diff] [blame] | 145 | if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() ) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 146 | { |
| 147 | rwl->iNumberActive--; |
| 148 | retVal = 1; |
| 149 | goto done; |
| 150 | } |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 151 | |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 152 | if( fWait ) |
| 153 | { |
| 154 | rwl->uSharedWaiters++; |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 155 | RtlLeaveCriticalSection( &rwl->rtlCS ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 156 | if( (dwWait = WaitForSingleObject( rwl->hSharedReleaseSemaphore, INFINITE )) == WAIT_FAILED ) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 157 | goto done; |
| 158 | goto start; |
| 159 | } |
| 160 | } |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 161 | else |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 162 | { |
| 163 | if( dwWait != WAIT_OBJECT_0 ) /* otherwise RtlReleaseResource() has already done it */ |
| 164 | rwl->iNumberActive++; |
| 165 | retVal = 1; |
| 166 | } |
| 167 | done: |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 168 | RtlLeaveCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 169 | return retVal; |
| 170 | } |
| 171 | |
| 172 | |
| 173 | /*********************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 174 | * RtlReleaseResource (NTDLL.@) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 175 | */ |
| 176 | void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl) |
| 177 | { |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 178 | RtlEnterCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 179 | |
| 180 | if( rwl->iNumberActive > 0 ) /* have one or more readers */ |
| 181 | { |
| 182 | if( --rwl->iNumberActive == 0 ) |
| 183 | { |
| 184 | if( rwl->uExclusiveWaiters ) |
| 185 | { |
| 186 | wake_exclusive: |
| 187 | rwl->uExclusiveWaiters--; |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 188 | NtReleaseSemaphore( rwl->hExclusiveReleaseSemaphore, 1, NULL ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | } |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 192 | else |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 193 | if( rwl->iNumberActive < 0 ) /* have a writer, possibly recursive */ |
| 194 | { |
| 195 | if( ++rwl->iNumberActive == 0 ) |
| 196 | { |
| 197 | rwl->hOwningThreadId = 0; |
| 198 | if( rwl->uExclusiveWaiters ) |
| 199 | goto wake_exclusive; |
| 200 | else |
| 201 | if( rwl->uSharedWaiters ) |
| 202 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 203 | UINT n = rwl->uSharedWaiters; |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 204 | rwl->iNumberActive = rwl->uSharedWaiters; /* prevent new writers from joining until |
| 205 | * all queued readers have done their thing */ |
| 206 | rwl->uSharedWaiters = 0; |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 207 | NtReleaseSemaphore( rwl->hSharedReleaseSemaphore, n, NULL ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 208 | } |
| 209 | } |
| 210 | } |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 211 | RtlLeaveCriticalSection( &rwl->rtlCS ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | |
| 215 | /*********************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 216 | * RtlDumpResource (NTDLL.@) |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 217 | */ |
| 218 | void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl) |
| 219 | { |
| 220 | if( rwl ) |
| 221 | { |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 222 | MESSAGE("RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers = %i\n\twaiting writers = %i\n", |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 223 | rwl, rwl->iNumberActive, rwl->uSharedWaiters, rwl->uExclusiveWaiters ); |
| 224 | if( rwl->iNumberActive ) |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 225 | MESSAGE("\towner thread = %08x\n", rwl->hOwningThreadId ); |
Alex Korobka | 6479f0f | 1999-01-31 09:24:44 +0000 | [diff] [blame] | 226 | } |
| 227 | } |
| 228 | |
Juergen Schmied | 026d9db | 1999-03-09 17:47:51 +0000 | [diff] [blame] | 229 | /* |
Juergen Schmied | 026d9db | 1999-03-09 17:47:51 +0000 | [diff] [blame] | 230 | * misc functions |
| 231 | */ |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 232 | |
| 233 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 234 | * DbgPrint [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 235 | */ |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 236 | void WINAPIV DbgPrint(LPCSTR fmt, ...) |
| 237 | { |
| 238 | char buf[512]; |
Patrik Stridvall | a4b80d4 | 1999-07-04 11:05:57 +0000 | [diff] [blame] | 239 | va_list args; |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 240 | |
Patrik Stridvall | a4b80d4 | 1999-07-04 11:05:57 +0000 | [diff] [blame] | 241 | va_start(args, fmt); |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 242 | vsprintf(buf,fmt, args); |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 243 | va_end(args); |
Patrik Stridvall | a4b80d4 | 1999-07-04 11:05:57 +0000 | [diff] [blame] | 244 | |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 245 | MESSAGE("DbgPrint says: %s",buf); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 246 | /* hmm, raise exception? */ |
| 247 | } |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 248 | |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 249 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 250 | * RtlAcquirePebLock [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 251 | */ |
Alexandre Julliard | 361943a | 2000-12-11 03:41:19 +0000 | [diff] [blame] | 252 | VOID WINAPI RtlAcquirePebLock(void) |
| 253 | { |
| 254 | RtlEnterCriticalSection( &peb_lock ); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 258 | * RtlReleasePebLock [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 259 | */ |
Alexandre Julliard | 361943a | 2000-12-11 03:41:19 +0000 | [diff] [blame] | 260 | VOID WINAPI RtlReleasePebLock(void) |
| 261 | { |
| 262 | RtlLeaveCriticalSection( &peb_lock ); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 266 | * RtlIntegerToChar [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 267 | */ |
| 268 | DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 269 | FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 270 | return 0; |
| 271 | } |
| 272 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 273 | * RtlSetEnvironmentVariable [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 274 | */ |
| 275 | DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 276 | FIXME("(0x%08lx,%s,%s),stub!\n",x1,debugstr_w(key->Buffer),debugstr_w(val->Buffer)); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 277 | return 0; |
| 278 | } |
| 279 | |
| 280 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 281 | * RtlNewSecurityObject [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 282 | */ |
| 283 | DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 284 | FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 285 | return 0; |
| 286 | } |
| 287 | |
| 288 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 289 | * RtlDeleteSecurityObject [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 290 | */ |
| 291 | DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 292 | FIXME("(0x%08lx),stub!\n",x1); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 293 | return 0; |
| 294 | } |
| 295 | |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 296 | /************************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 297 | * RtlNormalizeProcessParams [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 298 | */ |
| 299 | LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x) |
| 300 | { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 301 | FIXME("(%p), stub\n",x); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 302 | return x; |
| 303 | } |
| 304 | |
| 305 | /************************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 306 | * RtlGetNtProductType [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 307 | */ |
| 308 | BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type) |
| 309 | { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 310 | FIXME("(%p): stub\n", type); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 311 | *type=3; /* dunno. 1 for client, 3 for server? */ |
| 312 | return 1; |
| 313 | } |
| 314 | |
| 315 | /************************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 316 | * _chkstk [NTDLL.@] |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 317 | * |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 318 | * Glorified "enter xxxx". |
| 319 | */ |
Ulrich Weigand | eb94c7d | 1999-11-13 23:54:04 +0000 | [diff] [blame] | 320 | void WINAPI NTDLL_chkstk( CONTEXT86 *context ) |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 321 | { |
Alexandre Julliard | d8fab2e | 2000-09-25 23:53:07 +0000 | [diff] [blame] | 322 | context->Esp -= context->Eax; |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 323 | } |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 324 | |
| 325 | /************************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 326 | * _alloca_probe [NTDLL.@] |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 327 | * |
| 328 | * Glorified "enter xxxx". |
| 329 | */ |
Ulrich Weigand | eb94c7d | 1999-11-13 23:54:04 +0000 | [diff] [blame] | 330 | void WINAPI NTDLL_alloca_probe( CONTEXT86 *context ) |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 331 | { |
Alexandre Julliard | d8fab2e | 2000-09-25 23:53:07 +0000 | [diff] [blame] | 332 | context->Esp -= context->Eax; |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 335 | /************************************************************************** |
Patrik Stridvall | 8b216b3 | 2001-06-19 18:20:47 +0000 | [diff] [blame] | 336 | * RtlDosPathNameToNtPathName_U [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 337 | * |
| 338 | * FIXME: convert to UNC or whatever is expected here |
| 339 | */ |
| 340 | BOOLEAN WINAPI RtlDosPathNameToNtPathName_U( |
| 341 | LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3) |
| 342 | { |
Alexandre Julliard | cc9cfdf | 2000-09-29 00:31:57 +0000 | [diff] [blame] | 343 | FIXME("(%s,%p,%08lx,%08lx)\n",debugstr_w(from),us,x2,x3); |
| 344 | if (us) RtlCreateUnicodeString( us, from ); |
| 345 | return TRUE; |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 346 | } |
| 347 | |
Alexandre Julliard | 0aa6cc2 | 2000-07-29 21:56:59 +0000 | [diff] [blame] | 348 | |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 349 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 350 | * RtlCreateEnvironment [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 351 | */ |
| 352 | DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 353 | FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 354 | return 0; |
| 355 | } |
| 356 | |
| 357 | |
| 358 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 359 | * RtlDestroyEnvironment [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 360 | */ |
| 361 | DWORD WINAPI RtlDestroyEnvironment(DWORD x) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 362 | FIXME("(0x%08lx),stub!\n",x); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 363 | return 0; |
| 364 | } |
| 365 | |
| 366 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 367 | * RtlQueryEnvironmentVariable_U [NTDLL.@] |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 368 | */ |
| 369 | DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 370 | FIXME("(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val); |
Juergen Schmied | 3426d85 | 1999-02-19 16:29:05 +0000 | [diff] [blame] | 371 | return 0; |
| 372 | } |
Juergen Schmied | 02d45e5 | 2000-01-23 22:35:33 +0000 | [diff] [blame] | 373 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 374 | * RtlInitializeGenericTable [NTDLL.@] |
Juergen Schmied | 02d45e5 | 2000-01-23 22:35:33 +0000 | [diff] [blame] | 375 | */ |
| 376 | DWORD WINAPI RtlInitializeGenericTable(void) |
| 377 | { |
| 378 | FIXME("\n"); |
| 379 | return 0; |
| 380 | } |
| 381 | |
| 382 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 383 | * RtlInitializeBitMap [NTDLL.@] |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 384 | * |
Juergen Schmied | 02d45e5 | 2000-01-23 22:35:33 +0000 | [diff] [blame] | 385 | */ |
| 386 | NTSTATUS WINAPI RtlInitializeBitMap(DWORD x1,DWORD x2,DWORD x3) |
| 387 | { |
| 388 | FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3); |
| 389 | return 0; |
| 390 | } |
| 391 | |
| 392 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 393 | * RtlSetBits [NTDLL.@] |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 394 | * |
Juergen Schmied | 02d45e5 | 2000-01-23 22:35:33 +0000 | [diff] [blame] | 395 | */ |
| 396 | NTSTATUS WINAPI RtlSetBits(DWORD x1,DWORD x2,DWORD x3) |
| 397 | { |
| 398 | FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3); |
| 399 | return 0; |
| 400 | } |
| 401 | |
| 402 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 403 | * RtlFindClearBits [NTDLL.@] |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 404 | * |
Juergen Schmied | 02d45e5 | 2000-01-23 22:35:33 +0000 | [diff] [blame] | 405 | */ |
| 406 | NTSTATUS WINAPI RtlFindClearBits(DWORD x1,DWORD x2,DWORD x3) |
| 407 | { |
| 408 | FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3); |
| 409 | return 0; |
| 410 | } |
| 411 | |
| 412 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 413 | * RtlClearBits [NTDLL.@] |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 414 | * |
Juergen Schmied | 02d45e5 | 2000-01-23 22:35:33 +0000 | [diff] [blame] | 415 | */ |
| 416 | NTSTATUS WINAPI RtlClearBits(DWORD x1,DWORD x2,DWORD x3) |
| 417 | { |
| 418 | FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3); |
| 419 | return 0; |
| 420 | } |
| 421 | |
Andreas Mohr | 63e8bd5 | 2000-02-20 13:47:28 +0000 | [diff] [blame] | 422 | /****************************************************************************** |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 423 | * RtlCopyMemory [NTDLL] |
| 424 | * |
Juergen Schmied | 9f50d04 | 2000-02-26 19:35:50 +0000 | [diff] [blame] | 425 | */ |
| 426 | #undef RtlCopyMemory |
| 427 | VOID WINAPI RtlCopyMemory( VOID *Destination, CONST VOID *Source, SIZE_T Length ) |
| 428 | { |
| 429 | memcpy(Destination, Source, Length); |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 430 | } |
Juergen Schmied | 9f50d04 | 2000-02-26 19:35:50 +0000 | [diff] [blame] | 431 | |
| 432 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 433 | * RtlMoveMemory [NTDLL.@] |
Juergen Schmied | 9f50d04 | 2000-02-26 19:35:50 +0000 | [diff] [blame] | 434 | */ |
| 435 | #undef RtlMoveMemory |
| 436 | VOID WINAPI RtlMoveMemory( VOID *Destination, CONST VOID *Source, SIZE_T Length ) |
| 437 | { |
| 438 | memmove(Destination, Source, Length); |
| 439 | } |
| 440 | |
| 441 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 442 | * RtlFillMemory [NTDLL.@] |
Juergen Schmied | 9f50d04 | 2000-02-26 19:35:50 +0000 | [diff] [blame] | 443 | */ |
| 444 | #undef RtlFillMemory |
| 445 | VOID WINAPI RtlFillMemory( VOID *Destination, SIZE_T Length, BYTE Fill ) |
| 446 | { |
| 447 | memset(Destination, Fill, Length); |
| 448 | } |
| 449 | |
| 450 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 451 | * RtlZeroMemory [NTDLL.@] |
Juergen Schmied | 9f50d04 | 2000-02-26 19:35:50 +0000 | [diff] [blame] | 452 | */ |
| 453 | #undef RtlZeroMemory |
| 454 | VOID WINAPI RtlZeroMemory( VOID *Destination, SIZE_T Length ) |
| 455 | { |
| 456 | memset(Destination, 0, Length); |
| 457 | } |
| 458 | |
| 459 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 460 | * RtlCompareMemory [NTDLL.@] |
Juergen Schmied | 9f50d04 | 2000-02-26 19:35:50 +0000 | [diff] [blame] | 461 | */ |
| 462 | SIZE_T WINAPI RtlCompareMemory( const VOID *Source1, const VOID *Source2, SIZE_T Length) |
| 463 | { |
| 464 | int i; |
| 465 | for(i=0; (i<Length) && (((LPBYTE)Source1)[i]==((LPBYTE)Source2)[i]); i++); |
| 466 | return i; |
| 467 | } |
| 468 | |
| 469 | /****************************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 470 | * RtlAssert [NTDLL.@] |
Andreas Mohr | 63e8bd5 | 2000-02-20 13:47:28 +0000 | [diff] [blame] | 471 | * |
| 472 | * Not implemented in non-debug versions. |
| 473 | */ |
| 474 | void WINAPI RtlAssert(LPVOID x1,LPVOID x2,DWORD x3, DWORD x4) |
| 475 | { |
| 476 | FIXME("(%p,%p,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4); |
| 477 | } |
Ryan Cumming | 08be8f0 | 2002-07-28 17:49:26 +0000 | [diff] [blame] | 478 | |
| 479 | /****************************************************************************** |
| 480 | * RtlGetNtVersionNumbers [NTDLL.@] |
| 481 | * |
| 482 | * Introduced in Windows XP (NT5.1) |
| 483 | */ |
| 484 | void WINAPI RtlGetNtVersionNumbers(LPDWORD major, LPDWORD minor, LPDWORD build) |
| 485 | { |
| 486 | OSVERSIONINFOEXW versionInfo; |
| 487 | versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); |
| 488 | GetVersionExW((OSVERSIONINFOW*)&versionInfo); |
| 489 | |
| 490 | if (major) |
| 491 | { |
| 492 | *major = versionInfo.dwMajorVersion; |
| 493 | } |
| 494 | |
| 495 | if (minor) |
| 496 | { |
| 497 | *minor = versionInfo.dwMinorVersion; |
| 498 | } |
| 499 | |
| 500 | if (build) |
| 501 | { |
| 502 | /* FIXME: Does anybody know the real formula? */ |
| 503 | *build = (0xF0000000 | versionInfo.dwBuildNumber); |
| 504 | } |
| 505 | } |