blob: b07b25d16584b8f3b486112cbdd45c5f9f96cb3d [file] [log] [blame]
Alexandre Julliardb1bac321996-12-15 19:45:59 +00001/*
2 * NT basis DLL
Vincent Béron9a624912002-05-31 23:06:46 +00003 *
Marcus Meissner51505b11998-11-01 14:00:21 +00004 * This file contains the Rtl* API functions. These should be implementable.
Vincent Béron9a624912002-05-31 23:06:46 +00005 *
Marcus Meissner51505b11998-11-01 14:00:21 +00006 * Copyright 1996-1998 Marcus Meissner
Alex Korobka6479f0f1999-01-31 09:24:44 +00007 * 1999 Alex Korobka
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00008 *
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 Julliardb1bac321996-12-15 19:45:59 +000022 */
23
Alexandre Julliardb1bac321996-12-15 19:45:59 +000024#include <stdlib.h>
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +000025#include <stdio.h>
Alexandre Julliardb1bac321996-12-15 19:45:59 +000026#include <string.h>
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000027#include "wine/debug.h"
Jeremy Whited3e22d92000-02-10 19:03:02 +000028#include "windef.h"
Juergen Schmied3426d851999-02-19 16:29:05 +000029#include "winerror.h"
30#include "stackframe.h"
31
Juergen Schmied026d9db1999-03-09 17:47:51 +000032#include "ntddk.h"
Dietmar Kling82853711998-10-16 14:28:45 +000033#include "winreg.h"
Alexandre Julliardb1bac321996-12-15 19:45:59 +000034
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000035WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000036
Marcus Meissner317af321999-02-17 13:51:06 +000037
Alexandre Julliard301df6b2001-08-16 18:12:56 +000038static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT("peb_lock");
Alexandre Julliard361943a2000-12-11 03:41:19 +000039
Juergen Schmied026d9db1999-03-09 17:47:51 +000040/*
41 * resource functions
Juergen Schmied3426d851999-02-19 16:29:05 +000042 */
43
Alex Korobka6479f0f1999-01-31 09:24:44 +000044/***********************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +000045 * RtlInitializeResource (NTDLL.@)
Alex Korobka6479f0f1999-01-31 09:24:44 +000046 *
47 * xxxResource() functions implement multiple-reader-single-writer lock.
48 * The code is based on information published in WDJ January 1999 issue.
49 */
50void 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 Julliardcc9cfdf2000-09-29 00:31:57 +000059 RtlInitializeCriticalSection( &rwl->rtlCS );
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +000060 NtCreateSemaphore( &rwl->hExclusiveReleaseSemaphore, 0, NULL, 0, 65535 );
61 NtCreateSemaphore( &rwl->hSharedReleaseSemaphore, 0, NULL, 0, 65535 );
Alex Korobka6479f0f1999-01-31 09:24:44 +000062 }
63}
64
65
66/***********************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +000067 * RtlDeleteResource (NTDLL.@)
Alex Korobka6479f0f1999-01-31 09:24:44 +000068 */
69void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
70{
71 if( rwl )
72 {
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +000073 RtlEnterCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +000074 if( rwl->iNumberActive || rwl->uExclusiveWaiters || rwl->uSharedWaiters )
Alexandre Julliard15657091999-05-23 10:25:25 +000075 MESSAGE("Deleting active MRSW lock (%p), expect failure\n", rwl );
Alex Korobka6479f0f1999-01-31 09:24:44 +000076 rwl->hOwningThreadId = 0;
77 rwl->uExclusiveWaiters = rwl->uSharedWaiters = 0;
78 rwl->iNumberActive = 0;
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +000079 NtClose( rwl->hExclusiveReleaseSemaphore );
80 NtClose( rwl->hSharedReleaseSemaphore );
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +000081 RtlLeaveCriticalSection( &rwl->rtlCS );
82 RtlDeleteCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +000083 }
84}
85
86
87/***********************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +000088 * RtlAcquireResourceExclusive (NTDLL.@)
Alex Korobka6479f0f1999-01-31 09:24:44 +000089 */
90BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait)
91{
92 BYTE retVal = 0;
93 if( !rwl ) return 0;
94
95start:
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +000096 RtlEnterCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +000097 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 Julliard73755972002-07-31 19:26:03 +0000104 if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() )
Alex Korobka6479f0f1999-01-31 09:24:44 +0000105 {
106 retVal = 1;
107 rwl->iNumberActive--;
108 goto done;
109 }
110wait:
111 if( fWait )
112 {
113 rwl->uExclusiveWaiters++;
114
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000115 RtlLeaveCriticalSection( &rwl->rtlCS );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000116 if( WaitForSingleObject( rwl->hExclusiveReleaseSemaphore, INFINITE ) == WAIT_FAILED )
Alex Korobka6479f0f1999-01-31 09:24:44 +0000117 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éron9a624912002-05-31 23:06:46 +0000124
Alex Korobka6479f0f1999-01-31 09:24:44 +0000125 if( retVal == 1 )
Alexandre Julliard73755972002-07-31 19:26:03 +0000126 rwl->hOwningThreadId = (HANDLE)GetCurrentThreadId();
Alex Korobka6479f0f1999-01-31 09:24:44 +0000127done:
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000128 RtlLeaveCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000129 return retVal;
130}
131
132/***********************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000133 * RtlAcquireResourceShared (NTDLL.@)
Alex Korobka6479f0f1999-01-31 09:24:44 +0000134 */
135BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait)
136{
137 DWORD dwWait = WAIT_FAILED;
138 BYTE retVal = 0;
139 if( !rwl ) return 0;
140
141start:
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000142 RtlEnterCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000143 if( rwl->iNumberActive < 0 )
144 {
Alexandre Julliard73755972002-07-31 19:26:03 +0000145 if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() )
Alex Korobka6479f0f1999-01-31 09:24:44 +0000146 {
147 rwl->iNumberActive--;
148 retVal = 1;
149 goto done;
150 }
Vincent Béron9a624912002-05-31 23:06:46 +0000151
Alex Korobka6479f0f1999-01-31 09:24:44 +0000152 if( fWait )
153 {
154 rwl->uSharedWaiters++;
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000155 RtlLeaveCriticalSection( &rwl->rtlCS );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000156 if( (dwWait = WaitForSingleObject( rwl->hSharedReleaseSemaphore, INFINITE )) == WAIT_FAILED )
Alex Korobka6479f0f1999-01-31 09:24:44 +0000157 goto done;
158 goto start;
159 }
160 }
Vincent Béron9a624912002-05-31 23:06:46 +0000161 else
Alex Korobka6479f0f1999-01-31 09:24:44 +0000162 {
163 if( dwWait != WAIT_OBJECT_0 ) /* otherwise RtlReleaseResource() has already done it */
164 rwl->iNumberActive++;
165 retVal = 1;
166 }
167done:
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000168 RtlLeaveCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000169 return retVal;
170}
171
172
173/***********************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000174 * RtlReleaseResource (NTDLL.@)
Alex Korobka6479f0f1999-01-31 09:24:44 +0000175 */
176void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl)
177{
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000178 RtlEnterCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000179
180 if( rwl->iNumberActive > 0 ) /* have one or more readers */
181 {
182 if( --rwl->iNumberActive == 0 )
183 {
184 if( rwl->uExclusiveWaiters )
185 {
186wake_exclusive:
187 rwl->uExclusiveWaiters--;
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +0000188 NtReleaseSemaphore( rwl->hExclusiveReleaseSemaphore, 1, NULL );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000189 }
190 }
191 }
Vincent Béron9a624912002-05-31 23:06:46 +0000192 else
Alex Korobka6479f0f1999-01-31 09:24:44 +0000193 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 Julliarda3960291999-02-26 11:11:13 +0000203 UINT n = rwl->uSharedWaiters;
Alex Korobka6479f0f1999-01-31 09:24:44 +0000204 rwl->iNumberActive = rwl->uSharedWaiters; /* prevent new writers from joining until
205 * all queued readers have done their thing */
206 rwl->uSharedWaiters = 0;
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +0000207 NtReleaseSemaphore( rwl->hSharedReleaseSemaphore, n, NULL );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000208 }
209 }
210 }
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000211 RtlLeaveCriticalSection( &rwl->rtlCS );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000212}
213
214
215/***********************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000216 * RtlDumpResource (NTDLL.@)
Alex Korobka6479f0f1999-01-31 09:24:44 +0000217 */
218void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl)
219{
220 if( rwl )
221 {
Vincent Béron9a624912002-05-31 23:06:46 +0000222 MESSAGE("RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers = %i\n\twaiting writers = %i\n",
Alex Korobka6479f0f1999-01-31 09:24:44 +0000223 rwl, rwl->iNumberActive, rwl->uSharedWaiters, rwl->uExclusiveWaiters );
224 if( rwl->iNumberActive )
Alexandre Julliard15657091999-05-23 10:25:25 +0000225 MESSAGE("\towner thread = %08x\n", rwl->hOwningThreadId );
Alex Korobka6479f0f1999-01-31 09:24:44 +0000226 }
227}
228
Juergen Schmied026d9db1999-03-09 17:47:51 +0000229/*
Juergen Schmied026d9db1999-03-09 17:47:51 +0000230 * misc functions
231 */
Juergen Schmied3426d851999-02-19 16:29:05 +0000232
233/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000234 * DbgPrint [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000235 */
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +0000236void WINAPIV DbgPrint(LPCSTR fmt, ...)
237{
238 char buf[512];
Patrik Stridvalla4b80d41999-07-04 11:05:57 +0000239 va_list args;
Juergen Schmied3426d851999-02-19 16:29:05 +0000240
Patrik Stridvalla4b80d41999-07-04 11:05:57 +0000241 va_start(args, fmt);
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +0000242 vsprintf(buf,fmt, args);
Vincent Béron9a624912002-05-31 23:06:46 +0000243 va_end(args);
Patrik Stridvalla4b80d41999-07-04 11:05:57 +0000244
Alexandre Julliard15657091999-05-23 10:25:25 +0000245 MESSAGE("DbgPrint says: %s",buf);
Juergen Schmied3426d851999-02-19 16:29:05 +0000246 /* hmm, raise exception? */
247}
Juergen Schmied3426d851999-02-19 16:29:05 +0000248
Juergen Schmied3426d851999-02-19 16:29:05 +0000249/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000250 * RtlAcquirePebLock [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000251 */
Alexandre Julliard361943a2000-12-11 03:41:19 +0000252VOID WINAPI RtlAcquirePebLock(void)
253{
254 RtlEnterCriticalSection( &peb_lock );
Juergen Schmied3426d851999-02-19 16:29:05 +0000255}
256
257/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000258 * RtlReleasePebLock [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000259 */
Alexandre Julliard361943a2000-12-11 03:41:19 +0000260VOID WINAPI RtlReleasePebLock(void)
261{
262 RtlLeaveCriticalSection( &peb_lock );
Juergen Schmied3426d851999-02-19 16:29:05 +0000263}
264
265/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000266 * RtlIntegerToChar [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000267 */
268DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000269 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
Juergen Schmied3426d851999-02-19 16:29:05 +0000270 return 0;
271}
272/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000273 * RtlSetEnvironmentVariable [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000274 */
275DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000276 FIXME("(0x%08lx,%s,%s),stub!\n",x1,debugstr_w(key->Buffer),debugstr_w(val->Buffer));
Juergen Schmied3426d851999-02-19 16:29:05 +0000277 return 0;
278}
279
280/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000281 * RtlNewSecurityObject [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000282 */
283DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000284 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
Juergen Schmied3426d851999-02-19 16:29:05 +0000285 return 0;
286}
287
288/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000289 * RtlDeleteSecurityObject [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000290 */
291DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000292 FIXME("(0x%08lx),stub!\n",x1);
Juergen Schmied3426d851999-02-19 16:29:05 +0000293 return 0;
294}
295
Juergen Schmied3426d851999-02-19 16:29:05 +0000296/**************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000297 * RtlNormalizeProcessParams [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000298 */
299LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
300{
Alexandre Julliard15657091999-05-23 10:25:25 +0000301 FIXME("(%p), stub\n",x);
Juergen Schmied3426d851999-02-19 16:29:05 +0000302 return x;
303}
304
305/**************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000306 * RtlGetNtProductType [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000307 */
308BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type)
309{
Alexandre Julliard15657091999-05-23 10:25:25 +0000310 FIXME("(%p): stub\n", type);
Juergen Schmied3426d851999-02-19 16:29:05 +0000311 *type=3; /* dunno. 1 for client, 3 for server? */
312 return 1;
313}
314
315/**************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +0000316 * _chkstk [NTDLL.@]
Patrik Stridvall17fd4e32001-06-28 18:04:41 +0000317 *
Juergen Schmied3426d851999-02-19 16:29:05 +0000318 * Glorified "enter xxxx".
319 */
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +0000320void WINAPI NTDLL_chkstk( CONTEXT86 *context )
Juergen Schmied3426d851999-02-19 16:29:05 +0000321{
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +0000322 context->Esp -= context->Eax;
Juergen Schmied3426d851999-02-19 16:29:05 +0000323}
Patrik Stridvall17fd4e32001-06-28 18:04:41 +0000324
325/**************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +0000326 * _alloca_probe [NTDLL.@]
Patrik Stridvall17fd4e32001-06-28 18:04:41 +0000327 *
328 * Glorified "enter xxxx".
329 */
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +0000330void WINAPI NTDLL_alloca_probe( CONTEXT86 *context )
Juergen Schmied3426d851999-02-19 16:29:05 +0000331{
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +0000332 context->Esp -= context->Eax;
Juergen Schmied3426d851999-02-19 16:29:05 +0000333}
334
Juergen Schmied3426d851999-02-19 16:29:05 +0000335/**************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000336 * RtlDosPathNameToNtPathName_U [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000337 *
338 * FIXME: convert to UNC or whatever is expected here
339 */
340BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(
341 LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3)
342{
Alexandre Julliardcc9cfdf2000-09-29 00:31:57 +0000343 FIXME("(%s,%p,%08lx,%08lx)\n",debugstr_w(from),us,x2,x3);
344 if (us) RtlCreateUnicodeString( us, from );
345 return TRUE;
Juergen Schmied3426d851999-02-19 16:29:05 +0000346}
347
Alexandre Julliard0aa6cc22000-07-29 21:56:59 +0000348
Juergen Schmied3426d851999-02-19 16:29:05 +0000349/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000350 * RtlCreateEnvironment [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000351 */
352DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000353 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
Juergen Schmied3426d851999-02-19 16:29:05 +0000354 return 0;
355}
356
357
358/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000359 * RtlDestroyEnvironment [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000360 */
361DWORD WINAPI RtlDestroyEnvironment(DWORD x) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000362 FIXME("(0x%08lx),stub!\n",x);
Juergen Schmied3426d851999-02-19 16:29:05 +0000363 return 0;
364}
365
366/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000367 * RtlQueryEnvironmentVariable_U [NTDLL.@]
Juergen Schmied3426d851999-02-19 16:29:05 +0000368 */
369DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) {
Alexandre Julliard15657091999-05-23 10:25:25 +0000370 FIXME("(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val);
Juergen Schmied3426d851999-02-19 16:29:05 +0000371 return 0;
372}
Juergen Schmied02d45e52000-01-23 22:35:33 +0000373/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000374 * RtlInitializeGenericTable [NTDLL.@]
Juergen Schmied02d45e52000-01-23 22:35:33 +0000375 */
376DWORD WINAPI RtlInitializeGenericTable(void)
377{
378 FIXME("\n");
379 return 0;
380}
381
382/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000383 * RtlInitializeBitMap [NTDLL.@]
Vincent Béron9a624912002-05-31 23:06:46 +0000384 *
Juergen Schmied02d45e52000-01-23 22:35:33 +0000385 */
386NTSTATUS 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 Stridvall3ca98232001-06-20 23:03:14 +0000393 * RtlSetBits [NTDLL.@]
Vincent Béron9a624912002-05-31 23:06:46 +0000394 *
Juergen Schmied02d45e52000-01-23 22:35:33 +0000395 */
396NTSTATUS 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 Stridvall3ca98232001-06-20 23:03:14 +0000403 * RtlFindClearBits [NTDLL.@]
Vincent Béron9a624912002-05-31 23:06:46 +0000404 *
Juergen Schmied02d45e52000-01-23 22:35:33 +0000405 */
406NTSTATUS 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 Stridvall3ca98232001-06-20 23:03:14 +0000413 * RtlClearBits [NTDLL.@]
Vincent Béron9a624912002-05-31 23:06:46 +0000414 *
Juergen Schmied02d45e52000-01-23 22:35:33 +0000415 */
416NTSTATUS 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 Mohr63e8bd52000-02-20 13:47:28 +0000422/******************************************************************************
Vincent Béron9a624912002-05-31 23:06:46 +0000423 * RtlCopyMemory [NTDLL]
424 *
Juergen Schmied9f50d042000-02-26 19:35:50 +0000425 */
426#undef RtlCopyMemory
427VOID WINAPI RtlCopyMemory( VOID *Destination, CONST VOID *Source, SIZE_T Length )
428{
429 memcpy(Destination, Source, Length);
Vincent Béron9a624912002-05-31 23:06:46 +0000430}
Juergen Schmied9f50d042000-02-26 19:35:50 +0000431
432/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000433 * RtlMoveMemory [NTDLL.@]
Juergen Schmied9f50d042000-02-26 19:35:50 +0000434 */
435#undef RtlMoveMemory
436VOID WINAPI RtlMoveMemory( VOID *Destination, CONST VOID *Source, SIZE_T Length )
437{
438 memmove(Destination, Source, Length);
439}
440
441/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000442 * RtlFillMemory [NTDLL.@]
Juergen Schmied9f50d042000-02-26 19:35:50 +0000443 */
444#undef RtlFillMemory
445VOID WINAPI RtlFillMemory( VOID *Destination, SIZE_T Length, BYTE Fill )
446{
447 memset(Destination, Fill, Length);
448}
449
450/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000451 * RtlZeroMemory [NTDLL.@]
Juergen Schmied9f50d042000-02-26 19:35:50 +0000452 */
453#undef RtlZeroMemory
454VOID WINAPI RtlZeroMemory( VOID *Destination, SIZE_T Length )
455{
456 memset(Destination, 0, Length);
457}
458
459/******************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +0000460 * RtlCompareMemory [NTDLL.@]
Juergen Schmied9f50d042000-02-26 19:35:50 +0000461 */
462SIZE_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 Stridvall3ca98232001-06-20 23:03:14 +0000470 * RtlAssert [NTDLL.@]
Andreas Mohr63e8bd52000-02-20 13:47:28 +0000471 *
472 * Not implemented in non-debug versions.
473 */
474void 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 Cumming08be8f02002-07-28 17:49:26 +0000478
479/******************************************************************************
480 * RtlGetNtVersionNumbers [NTDLL.@]
481 *
482 * Introduced in Windows XP (NT5.1)
483 */
484void 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}