1 | /* $Id: rtl.cpp,v 1.3 1999-06-25 13:59:02 phaller Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
5 | * Win32 NT Runtime / NTDLL for OS/2
|
---|
6 | *
|
---|
7 | * Copyright 1998 original WINE Author
|
---|
8 | * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
|
---|
9 | *
|
---|
10 | * NT basis DLL
|
---|
11 | *
|
---|
12 | * This file contains the Rtl* API functions. These should be implementable.
|
---|
13 | *
|
---|
14 | * Copyright 1996-1998 Marcus Meissner
|
---|
15 | * 1999 Alex Korobka
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include <stdlib.h>
|
---|
19 | #include <string.h>
|
---|
20 |
|
---|
21 | #include "ntdll.h"
|
---|
22 |
|
---|
23 | #include "winuser.h"
|
---|
24 | #include "winerror.h"
|
---|
25 | #include "winreg.h"
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * resource functions
|
---|
31 | */
|
---|
32 |
|
---|
33 | /***********************************************************************
|
---|
34 | * RtlInitializeResource (NTDLL.409)
|
---|
35 | *
|
---|
36 | * xxxResource() functions implement multiple-reader-single-writer lock.
|
---|
37 | * The code is based on information published in WDJ January 1999 issue.
|
---|
38 | */
|
---|
39 | void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl)
|
---|
40 | {
|
---|
41 | dprintf(("NTDLL: RtlInitializeResource(%08xh)\n",
|
---|
42 | rwl));
|
---|
43 |
|
---|
44 | if( rwl )
|
---|
45 | {
|
---|
46 | rwl->iNumberActive = 0;
|
---|
47 | rwl->uExclusiveWaiters = 0;
|
---|
48 | rwl->uSharedWaiters = 0;
|
---|
49 | rwl->hOwningThreadId = 0;
|
---|
50 | rwl->dwTimeoutBoost = 0; /* no info on this one, default value is 0 */
|
---|
51 | InitializeCriticalSection( &rwl->rtlCS );
|
---|
52 | rwl->hExclusiveReleaseSemaphore = CreateSemaphoreA( NULL, 0, 65535, NULL );
|
---|
53 | rwl->hSharedReleaseSemaphore = CreateSemaphoreA( NULL, 0, 65535, NULL );
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | /***********************************************************************
|
---|
59 | * RtlDeleteResource (NTDLL.330)
|
---|
60 | */
|
---|
61 | void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
|
---|
62 | {
|
---|
63 | dprintf(("NTDLL: RtlDeleteResource(%08xh)\n",
|
---|
64 | rwl));
|
---|
65 |
|
---|
66 | if( rwl )
|
---|
67 | {
|
---|
68 | EnterCriticalSection( &rwl->rtlCS );
|
---|
69 | if( rwl->iNumberActive || rwl->uExclusiveWaiters || rwl->uSharedWaiters )
|
---|
70 | dprintf(("NTDLL: RtlDeleteResource active MRSW lock (%p), expect failure\n",
|
---|
71 | rwl));
|
---|
72 |
|
---|
73 | rwl->hOwningThreadId = 0;
|
---|
74 | rwl->uExclusiveWaiters = rwl->uSharedWaiters = 0;
|
---|
75 | rwl->iNumberActive = 0;
|
---|
76 | CloseHandle( rwl->hExclusiveReleaseSemaphore );
|
---|
77 | CloseHandle( rwl->hSharedReleaseSemaphore );
|
---|
78 | LeaveCriticalSection( &rwl->rtlCS );
|
---|
79 | DeleteCriticalSection( &rwl->rtlCS );
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | /***********************************************************************
|
---|
85 | * RtlAcquireResourceExclusive (NTDLL.256)
|
---|
86 | */
|
---|
87 | BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl,
|
---|
88 | BYTE fWait)
|
---|
89 | {
|
---|
90 | BYTE retVal = 0;
|
---|
91 |
|
---|
92 | if( !rwl )
|
---|
93 | return 0;
|
---|
94 |
|
---|
95 | dprintf(("NTDLL: RtlAcquireResourceExclusive(%08xh,%08xh)\n",
|
---|
96 | rwl,
|
---|
97 | fWait));
|
---|
98 |
|
---|
99 | start:
|
---|
100 | EnterCriticalSection( &rwl->rtlCS );
|
---|
101 | if( rwl->iNumberActive == 0 ) /* lock is free */
|
---|
102 | {
|
---|
103 | rwl->iNumberActive = -1;
|
---|
104 | retVal = 1;
|
---|
105 | }
|
---|
106 | else if( rwl->iNumberActive < 0 ) /* exclusive lock in progress */
|
---|
107 | {
|
---|
108 | if( rwl->hOwningThreadId == GetCurrentThreadId() )
|
---|
109 | {
|
---|
110 | retVal = 1;
|
---|
111 | rwl->iNumberActive--;
|
---|
112 | goto done;
|
---|
113 | }
|
---|
114 | wait:
|
---|
115 | if( fWait )
|
---|
116 | {
|
---|
117 | rwl->uExclusiveWaiters++;
|
---|
118 |
|
---|
119 | LeaveCriticalSection( &rwl->rtlCS );
|
---|
120 | if( WaitForSingleObject( rwl->hExclusiveReleaseSemaphore, INFINITE ) == WAIT_FAILED )
|
---|
121 | goto done;
|
---|
122 | goto start; /* restart the acquisition to avoid deadlocks */
|
---|
123 | }
|
---|
124 | }
|
---|
125 | else /* one or more shared locks are in progress */
|
---|
126 | if( fWait )
|
---|
127 | goto wait;
|
---|
128 |
|
---|
129 | if( retVal == 1 )
|
---|
130 | rwl->hOwningThreadId = GetCurrentThreadId();
|
---|
131 | done:
|
---|
132 | LeaveCriticalSection( &rwl->rtlCS );
|
---|
133 | return retVal;
|
---|
134 | }
|
---|
135 |
|
---|
136 | /***********************************************************************
|
---|
137 | * RtlAcquireResourceShared (NTDLL.257)
|
---|
138 | */
|
---|
139 | BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl,
|
---|
140 | BYTE fWait)
|
---|
141 | {
|
---|
142 | DWORD dwWait = WAIT_FAILED;
|
---|
143 | BYTE retVal = 0;
|
---|
144 |
|
---|
145 | if( !rwl )
|
---|
146 | return 0;
|
---|
147 |
|
---|
148 | dprintf(("NTDLL: RtlAcquireResourceShared(%08xh,%08xh)\n",
|
---|
149 | rwl,
|
---|
150 | fWait));
|
---|
151 |
|
---|
152 | start:
|
---|
153 | EnterCriticalSection( &rwl->rtlCS );
|
---|
154 | if( rwl->iNumberActive < 0 )
|
---|
155 | {
|
---|
156 | if( rwl->hOwningThreadId == GetCurrentThreadId() )
|
---|
157 | {
|
---|
158 | rwl->iNumberActive--;
|
---|
159 | retVal = 1;
|
---|
160 | goto done;
|
---|
161 | }
|
---|
162 |
|
---|
163 | if( fWait )
|
---|
164 | {
|
---|
165 | rwl->uSharedWaiters++;
|
---|
166 | LeaveCriticalSection( &rwl->rtlCS );
|
---|
167 | if( (dwWait = WaitForSingleObject( rwl->hSharedReleaseSemaphore, INFINITE )) == WAIT_FAILED )
|
---|
168 | goto done;
|
---|
169 | goto start;
|
---|
170 | }
|
---|
171 | }
|
---|
172 | else
|
---|
173 | {
|
---|
174 | if( dwWait != WAIT_OBJECT_0 ) /* otherwise RtlReleaseResource() has already done it */
|
---|
175 | rwl->iNumberActive++;
|
---|
176 | retVal = 1;
|
---|
177 | }
|
---|
178 | done:
|
---|
179 | LeaveCriticalSection( &rwl->rtlCS );
|
---|
180 | return retVal;
|
---|
181 | }
|
---|
182 |
|
---|
183 |
|
---|
184 | /***********************************************************************
|
---|
185 | * RtlReleaseResource (NTDLL.471)
|
---|
186 | */
|
---|
187 | void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl)
|
---|
188 | {
|
---|
189 | dprintf(("NTDLL: RtlReleaseResource(%08xh)\n",
|
---|
190 | rwl));
|
---|
191 |
|
---|
192 | EnterCriticalSection( &rwl->rtlCS );
|
---|
193 |
|
---|
194 | if( rwl->iNumberActive > 0 ) /* have one or more readers */
|
---|
195 | {
|
---|
196 | if( --rwl->iNumberActive == 0 )
|
---|
197 | {
|
---|
198 | if( rwl->uExclusiveWaiters )
|
---|
199 | {
|
---|
200 | wake_exclusive:
|
---|
201 | rwl->uExclusiveWaiters--;
|
---|
202 | ReleaseSemaphore( rwl->hExclusiveReleaseSemaphore, 1, NULL );
|
---|
203 | }
|
---|
204 | }
|
---|
205 | }
|
---|
206 | else
|
---|
207 | if( rwl->iNumberActive < 0 ) /* have a writer, possibly recursive */
|
---|
208 | {
|
---|
209 | if( ++rwl->iNumberActive == 0 )
|
---|
210 | {
|
---|
211 | rwl->hOwningThreadId = 0;
|
---|
212 | if( rwl->uExclusiveWaiters )
|
---|
213 | goto wake_exclusive;
|
---|
214 | else
|
---|
215 | if( rwl->uSharedWaiters )
|
---|
216 | {
|
---|
217 | UINT n = rwl->uSharedWaiters;
|
---|
218 | rwl->iNumberActive = rwl->uSharedWaiters; /* prevent new writers from joining until
|
---|
219 | * all queued readers have done their thing */
|
---|
220 | rwl->uSharedWaiters = 0;
|
---|
221 | ReleaseSemaphore( rwl->hSharedReleaseSemaphore, n, NULL );
|
---|
222 | }
|
---|
223 | }
|
---|
224 | }
|
---|
225 | LeaveCriticalSection( &rwl->rtlCS );
|
---|
226 | }
|
---|
227 |
|
---|
228 |
|
---|
229 | /***********************************************************************
|
---|
230 | * RtlDumpResource (NTDLL.340)
|
---|
231 | */
|
---|
232 | void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl)
|
---|
233 | {
|
---|
234 | dprintf(("NTDLL: RtlDumpResource(%08x)\n",
|
---|
235 | rwl));
|
---|
236 |
|
---|
237 | if( rwl )
|
---|
238 | {
|
---|
239 | dprintf(("NTDLL: RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers = %i\n\twaiting writers = %i\n",
|
---|
240 | rwl,
|
---|
241 | rwl->iNumberActive,
|
---|
242 | rwl->uSharedWaiters,
|
---|
243 | rwl->uExclusiveWaiters));
|
---|
244 |
|
---|
245 | if( rwl->iNumberActive )
|
---|
246 | dprintf(("NTDLL: \towner thread = %08x\n",
|
---|
247 | rwl->hOwningThreadId ));
|
---|
248 | }
|
---|
249 | }
|
---|
250 |
|
---|
251 |
|
---|
252 | /*
|
---|
253 | * heap functions
|
---|
254 | */
|
---|
255 |
|
---|
256 | /******************************************************************************
|
---|
257 | * RtlCreateHeap [NTDLL]
|
---|
258 | */
|
---|
259 | HANDLE WINAPI RtlCreateHeap(ULONG Flags,
|
---|
260 | PVOID BaseAddress,
|
---|
261 | ULONG SizeToReserve,
|
---|
262 | ULONG SizeToCommit,
|
---|
263 | PVOID Unknown,
|
---|
264 | PRTL_HEAP_DEFINITION Definition)
|
---|
265 | {
|
---|
266 | dprintf(("NTDLL: RtlCreateHeap(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh).\n",
|
---|
267 | Flags,
|
---|
268 | BaseAddress,
|
---|
269 | SizeToReserve,
|
---|
270 | SizeToCommit,
|
---|
271 | Unknown,
|
---|
272 | Definition));
|
---|
273 |
|
---|
274 | return HeapCreate(Flags,
|
---|
275 | SizeToCommit,
|
---|
276 | SizeToReserve);
|
---|
277 | }
|
---|
278 |
|
---|
279 |
|
---|
280 | /******************************************************************************
|
---|
281 | * RtlAllocateHeap [NTDLL]
|
---|
282 | */
|
---|
283 | PVOID WINAPI RtlAllocateHeap(HANDLE Heap,
|
---|
284 | ULONG Flags,
|
---|
285 | ULONG Size)
|
---|
286 | {
|
---|
287 | dprintf(("NTDLL: RtlAllocateHeap(%08xh,%08xh,%08xh).\n",
|
---|
288 | Heap,
|
---|
289 | Flags,
|
---|
290 | Size));
|
---|
291 |
|
---|
292 | return HeapAlloc(Heap,
|
---|
293 | Flags,
|
---|
294 | Size);
|
---|
295 | }
|
---|
296 |
|
---|
297 |
|
---|
298 | /******************************************************************************
|
---|
299 | * RtlFreeHeap [NTDLL]
|
---|
300 | */
|
---|
301 | BOOLEAN WINAPI RtlFreeHeap(HANDLE Heap,
|
---|
302 | ULONG Flags,
|
---|
303 | PVOID Address)
|
---|
304 | {
|
---|
305 | dprintf(("NTDLL: RtlFreeHeap(%08xh,%08xh,%08xh)\n",
|
---|
306 | Heap,
|
---|
307 | Flags,
|
---|
308 | Address));
|
---|
309 |
|
---|
310 | return HeapFree(Heap, Flags, Address);
|
---|
311 | }
|
---|
312 |
|
---|
313 |
|
---|
314 | /******************************************************************************
|
---|
315 | * RtlDestroyHeap [NTDLL]
|
---|
316 | *
|
---|
317 | * FIXME: prototype guessed
|
---|
318 | */
|
---|
319 | BOOLEAN WINAPI RtlDestroyHeap(HANDLE Heap)
|
---|
320 | {
|
---|
321 | dprintf(("NTDLL: RtlDestroyHeap(%08xh)\n",
|
---|
322 | Heap));
|
---|
323 |
|
---|
324 | return HeapDestroy(Heap);
|
---|
325 | }
|
---|
326 |
|
---|
327 |
|
---|
328 | /*
|
---|
329 | * misc functions
|
---|
330 | */
|
---|
331 |
|
---|
332 | /******************************************************************************
|
---|
333 | * DbgPrint [NTDLL]
|
---|
334 | */
|
---|
335 | /* @@@PH how to port ? */
|
---|
336 | #if 0
|
---|
337 | void __cdecl DbgPrint(LPCSTR fmt,LPVOID args)
|
---|
338 | {
|
---|
339 | dprintf(("NTDLL: DbgPrint(%s,08xh) not supported.\n",
|
---|
340 | fmt,
|
---|
341 | args));
|
---|
342 |
|
---|
343 | /* hmm, raise exception? */
|
---|
344 | }
|
---|
345 |
|
---|
346 | DWORD WINAPI NtRaiseException (DWORD dwExceptionCode,
|
---|
347 | DWORD dwExceptionFlags,
|
---|
348 | DWORD nNumberOfArguments,
|
---|
349 | CONST ULONG_PTR *lpArguments)
|
---|
350 | {
|
---|
351 | dprintf(("NTDLL: NtRaiseException(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
352 | dwExceptionCode,
|
---|
353 | dwExceptionFlags,
|
---|
354 | nNumberOfArguments,
|
---|
355 | lpArguments));
|
---|
356 |
|
---|
357 | return 0;
|
---|
358 | }
|
---|
359 |
|
---|
360 |
|
---|
361 | DWORD WINAPI RtlRaiseException (DWORD x)
|
---|
362 | {
|
---|
363 | dprintf(("NTDLL: RtlRaiseException(%08xh) not implemented.\n",
|
---|
364 | x));
|
---|
365 |
|
---|
366 | return 0;
|
---|
367 | }
|
---|
368 | #endif
|
---|
369 |
|
---|
370 |
|
---|
371 | /******************************************************************************
|
---|
372 | * RtlAcquirePebLock [NTDLL]
|
---|
373 | */
|
---|
374 | VOID WINAPI RtlAcquirePebLock(void)
|
---|
375 | {
|
---|
376 | dprintf(("NTDLL: RtlAcquirePebLock() not implemented.\n"));
|
---|
377 |
|
---|
378 | /* enter critical section ? */
|
---|
379 | }
|
---|
380 |
|
---|
381 |
|
---|
382 | /******************************************************************************
|
---|
383 | * RtlReleasePebLock [NTDLL]
|
---|
384 | */
|
---|
385 | VOID WINAPI RtlReleasePebLock(void)
|
---|
386 | {
|
---|
387 | dprintf(("NTDLL: RtlReleasePebLock() not implemented.\n"));
|
---|
388 |
|
---|
389 | /* leave critical section ? */
|
---|
390 | }
|
---|
391 |
|
---|
392 |
|
---|
393 | /******************************************************************************
|
---|
394 | * RtlIntegerToChar [NTDLL]
|
---|
395 | */
|
---|
396 | DWORD WINAPI RtlIntegerToChar(DWORD x1,
|
---|
397 | DWORD x2,
|
---|
398 | DWORD x3,
|
---|
399 | DWORD x4)
|
---|
400 | {
|
---|
401 | dprintf(("NTDLL: RtlIntegerToChar(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
402 | x1,
|
---|
403 | x2,
|
---|
404 | x3,
|
---|
405 | x4));
|
---|
406 |
|
---|
407 | return 0;
|
---|
408 | }
|
---|
409 |
|
---|
410 |
|
---|
411 | /******************************************************************************
|
---|
412 | * RtlSetEnvironmentVariable [NTDLL]
|
---|
413 | */
|
---|
414 | DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,
|
---|
415 | PUNICODE_STRING key,
|
---|
416 | PUNICODE_STRING val)
|
---|
417 | {
|
---|
418 | dprintf(("NTDLL: RtlSetEnvironmentVariable(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
419 | x1,
|
---|
420 | key,
|
---|
421 | val));
|
---|
422 |
|
---|
423 | return 0;
|
---|
424 | }
|
---|
425 |
|
---|
426 |
|
---|
427 | /******************************************************************************
|
---|
428 | * RtlNewSecurityObject [NTDLL]
|
---|
429 | */
|
---|
430 | DWORD WINAPI RtlNewSecurityObject(DWORD x1,
|
---|
431 | DWORD x2,
|
---|
432 | DWORD x3,
|
---|
433 | DWORD x4,
|
---|
434 | DWORD x5,
|
---|
435 | DWORD x6)
|
---|
436 | {
|
---|
437 | dprintf(("NTDLL: RtlNewSecurityObject(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
438 | x1,
|
---|
439 | x2,
|
---|
440 | x3,
|
---|
441 | x4,
|
---|
442 | x5,
|
---|
443 | x6));
|
---|
444 |
|
---|
445 | return 0;
|
---|
446 | }
|
---|
447 |
|
---|
448 |
|
---|
449 | /******************************************************************************
|
---|
450 | * RtlDeleteSecurityObject [NTDLL]
|
---|
451 | */
|
---|
452 | DWORD WINAPI RtlDeleteSecurityObject(DWORD x1)
|
---|
453 | {
|
---|
454 | dprintf(("NTDLL: RtlDeleteSecurityObject(%08xh) not implemented.\n",
|
---|
455 | x1));
|
---|
456 |
|
---|
457 | return 0;
|
---|
458 | }
|
---|
459 |
|
---|
460 |
|
---|
461 | /**************************************************************************
|
---|
462 | * RtlNormalizeProcessParams [NTDLL.441]
|
---|
463 | */
|
---|
464 | LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
|
---|
465 | {
|
---|
466 | dprintf(("NTDLL: RtlNormalizeProcessParams(%08xh) not implemented.\n",
|
---|
467 | x));
|
---|
468 |
|
---|
469 | return x;
|
---|
470 | }
|
---|
471 |
|
---|
472 |
|
---|
473 | /**************************************************************************
|
---|
474 | * RtlNtStatusToDosError [NTDLL.442]
|
---|
475 | */
|
---|
476 | DWORD WINAPI RtlNtStatusToDosError(DWORD error)
|
---|
477 | {
|
---|
478 | dprintf(("NTDLL: RtlNtStatusToDosError(%08xh) partially implemented.\n",
|
---|
479 | error));
|
---|
480 |
|
---|
481 | switch (error)
|
---|
482 | {
|
---|
483 | case STATUS_SUCCESS: return ERROR_SUCCESS;
|
---|
484 | case STATUS_INVALID_PARAMETER: return ERROR_BAD_ARGUMENTS;
|
---|
485 | case STATUS_BUFFER_TOO_SMALL: return ERROR_INSUFFICIENT_BUFFER;
|
---|
486 | /* case STATUS_INVALID_SECURITY_DESCR: return ERROR_INVALID_SECURITY_DESCR;*/
|
---|
487 | case STATUS_NO_MEMORY: return ERROR_NOT_ENOUGH_MEMORY;
|
---|
488 | /* case STATUS_UNKNOWN_REVISION:
|
---|
489 | case STATUS_BUFFER_OVERFLOW:*/
|
---|
490 | }
|
---|
491 |
|
---|
492 | dprintf(("NTDLL: RtlNtStatusToDosError(%08xh is unknown !)\n",
|
---|
493 | error));
|
---|
494 |
|
---|
495 | return ERROR_SUCCESS;
|
---|
496 | }
|
---|
497 |
|
---|
498 |
|
---|
499 | /**************************************************************************
|
---|
500 | * RtlGetNtProductType [NTDLL.390]
|
---|
501 | */
|
---|
502 | BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type)
|
---|
503 | {
|
---|
504 | dprintf(("NTDLL: RtlGetNtProductType(%08xh) not correctly implemented.\n",
|
---|
505 | type));
|
---|
506 |
|
---|
507 | *type=3; /* dunno. 1 for client, 3 for server? */
|
---|
508 | return 1;
|
---|
509 | }
|
---|
510 |
|
---|
511 |
|
---|
512 | /**************************************************************************
|
---|
513 | * NTDLL_chkstk [NTDLL.862]
|
---|
514 | * NTDLL_alloca_probe [NTDLL.861]
|
---|
515 | * Glorified "enter xxxx".
|
---|
516 | */
|
---|
517 | /* @@@PH how to port this to VAC ?
|
---|
518 | REGS_ENTRYPOINT(NTDLL_chkstk)
|
---|
519 | {
|
---|
520 | ESP_reg(context) -= EAX_reg(context);
|
---|
521 | }
|
---|
522 |
|
---|
523 | REGS_ENTRYPOINT(NTDLL_alloca_probe)
|
---|
524 | {
|
---|
525 | ESP_reg(context) -= EAX_reg(context);
|
---|
526 | }
|
---|
527 | */
|
---|
528 |
|
---|
529 | /******************************************************************************
|
---|
530 | * RtlEnlargedIntegerMultiply [NTDLL.341]
|
---|
531 | * Note: This even works, since gcc returns 64bit values in eax/edx just like
|
---|
532 | * the caller expects. However... The relay code won't grok this I think.
|
---|
533 | *
|
---|
534 | * @@@PH: Parameters are unknown
|
---|
535 | */
|
---|
536 | /* longlong in VAC++ ? */
|
---|
537 |
|
---|
538 | INT WINAPI RtlEnlargedIntegerMultiply(INT factor1,
|
---|
539 | INT factor2)
|
---|
540 | {
|
---|
541 | dprintf(("NTDLL: RtlEnlargedIntegerMultiply(%08xh,%08xh) not implemented.\n",
|
---|
542 | factor1,
|
---|
543 | factor2));
|
---|
544 |
|
---|
545 | return factor1 * factor2;
|
---|
546 | }
|
---|
547 |
|
---|
548 |
|
---|
549 | /******************************************************************************
|
---|
550 | * RtlExtendedLargeIntegerDivide [NTDLL.359]
|
---|
551 | */
|
---|
552 | INT WINAPI RtlExtendedLargeIntegerDivide(LARGE_INTEGER dividend,
|
---|
553 | DWORD divisor,
|
---|
554 | LPDWORD rest)
|
---|
555 | {
|
---|
556 | #if SIZEOF_LONG_LONG==8
|
---|
557 | long long x1 = *(long long*)÷nd;
|
---|
558 |
|
---|
559 | if (*rest)
|
---|
560 | *rest = x1 % divisor;
|
---|
561 | return x1/divisor;
|
---|
562 | #else
|
---|
563 | dprintf(("NTDLL: RtlExtendedLargeIntegerDevice(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
564 | dividend,
|
---|
565 | divisor,
|
---|
566 | rest));
|
---|
567 |
|
---|
568 | return 0;
|
---|
569 | #endif
|
---|
570 | }
|
---|
571 |
|
---|
572 | /******************************************************************************
|
---|
573 | * RtlExtendedLargeIntegerMultiply [NTDLL.358]
|
---|
574 | * Note: This even works, since gcc returns 64bit values in eax/edx just like
|
---|
575 | * the caller expects. However... The relay code won't grok this I think.
|
---|
576 | */
|
---|
577 | /* longlong in VAC++ ? */
|
---|
578 |
|
---|
579 | LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(LARGE_INTEGER factor1,
|
---|
580 | INT factor2)
|
---|
581 | {
|
---|
582 | LARGE_INTEGER li;
|
---|
583 |
|
---|
584 | dprintf(("NTDLL: RtlExtendedIntegerMultiply(%08xh,%08xh) not implemented.\n",
|
---|
585 | factor1,
|
---|
586 | factor2));
|
---|
587 |
|
---|
588 | li.LowPart = factor1.LowPart * factor2;
|
---|
589 | li.HighPart = factor1.HighPart * factor2;
|
---|
590 | // note: overflow from LowPart To HighPart NOT handled !
|
---|
591 |
|
---|
592 | return li;
|
---|
593 | }
|
---|
594 |
|
---|
595 |
|
---|
596 | /******************************************************************************
|
---|
597 | * RtlFormatCurrentUserKeyPath [NTDLL.371]
|
---|
598 | */
|
---|
599 | DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x)
|
---|
600 | {
|
---|
601 | dprintf(("NTDLL: RtlFormatCurrentUserKeyPath(%08xh) not implemented.\n",
|
---|
602 | x));
|
---|
603 |
|
---|
604 | return 1;
|
---|
605 | }
|
---|
606 |
|
---|
607 |
|
---|
608 | /******************************************************************************
|
---|
609 | * RtlOpenCurrentUser [NTDLL]
|
---|
610 | */
|
---|
611 | DWORD WINAPI RtlOpenCurrentUser(DWORD x1,
|
---|
612 | DWORD *x2)
|
---|
613 | {
|
---|
614 | /* Note: this is not the correct solution,
|
---|
615 | * But this works pretty good on wine and NT4.0 binaries
|
---|
616 | */
|
---|
617 | if (x1 == 0x2000000 )
|
---|
618 | {
|
---|
619 | *x2 = HKEY_CURRENT_USER;
|
---|
620 | return TRUE;
|
---|
621 | }
|
---|
622 |
|
---|
623 | return FALSE;
|
---|
624 | }
|
---|
625 |
|
---|
626 |
|
---|
627 | /**************************************************************************
|
---|
628 | * RtlDosPathNameToNtPathName_U [NTDLL.338]
|
---|
629 | *
|
---|
630 | * FIXME: convert to UNC or whatever is expected here
|
---|
631 | */
|
---|
632 | BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(LPWSTR from,
|
---|
633 | PUNICODE_STRING us,
|
---|
634 | DWORD x2,
|
---|
635 | DWORD x3)
|
---|
636 | {
|
---|
637 | LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from);
|
---|
638 |
|
---|
639 | dprintf(("NTDLL: RtlDosPathNameToNtPathName_U(%08xh,%08h,%08xh,%08xh) not implemented.\n",
|
---|
640 | from,
|
---|
641 | us,
|
---|
642 | x2,
|
---|
643 | x3));
|
---|
644 |
|
---|
645 | if (us)
|
---|
646 | RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from));
|
---|
647 |
|
---|
648 | return TRUE;
|
---|
649 | }
|
---|
650 |
|
---|
651 |
|
---|
652 | /******************************************************************************
|
---|
653 | * RtlCreateEnvironment [NTDLL]
|
---|
654 | */
|
---|
655 | DWORD WINAPI RtlCreateEnvironment(DWORD x1,
|
---|
656 | DWORD x2)
|
---|
657 | {
|
---|
658 | dprintf(("NTDLL: RtlCreateEnvironment(%08xh, %08xh) not implemented.\n",
|
---|
659 | x1,
|
---|
660 | x2));
|
---|
661 |
|
---|
662 | return 0;
|
---|
663 | }
|
---|
664 |
|
---|
665 |
|
---|
666 | /******************************************************************************
|
---|
667 | * RtlDestroyEnvironment [NTDLL]
|
---|
668 | */
|
---|
669 | DWORD WINAPI RtlDestroyEnvironment(DWORD x)
|
---|
670 | {
|
---|
671 | dprintf(("NTDLL: RtlDestroyEnvironment(%08xh) not implemented.\n",
|
---|
672 | x));
|
---|
673 |
|
---|
674 | return 0;
|
---|
675 | }
|
---|
676 |
|
---|
677 |
|
---|
678 | /******************************************************************************
|
---|
679 | * RtlQueryEnvironmentVariable_U [NTDLL]
|
---|
680 | */
|
---|
681 | DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,
|
---|
682 | PUNICODE_STRING key,
|
---|
683 | PUNICODE_STRING val)
|
---|
684 | {
|
---|
685 | dprintf(("NTDLL: RtlQueryEnvironmentVariable_U(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
686 | x1,
|
---|
687 | key,
|
---|
688 | val));
|
---|
689 |
|
---|
690 | return 0;
|
---|
691 | }
|
---|
692 |
|
---|