Fixed differences between SetRectRgn16 and SetRectRgn32. Also a bug fix for
[wine.git] / misc / ntdll.c
blob5da4944611fca9e6e7d3e27573f852562b256f17
1 /*
2 * NT basis DLL
3 *
4 * Copyright 1996 Marcus Meissner
5 */
7 #include <stdlib.h>
8 #include <string.h>
9 #include <time.h>
10 #include <ctype.h>
11 #include <math.h>
12 #include "win.h"
13 #include "windows.h"
14 #include "winnls.h"
15 #include "ntdll.h"
16 #include "heap.h"
17 #include "debug.h"
18 #include "module.h"
19 #include "heap.h"
20 #include "debugstr.h"
21 #include "winreg.h"
23 /**************************************************************************
24 * RtlLengthRequiredSid [NTDLL.427]
26 DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths)
28 return sizeof(DWORD)*nrofsubauths+sizeof(SID);
31 /**************************************************************************
32 * RtlLengthSid [NTDLL.429]
34 DWORD WINAPI RtlLengthSid(LPSID sid)
35 { TRACE(ntdll,"sid=%p\n",sid);
36 if (!sid)
37 return FALSE;
38 return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID);
41 /**************************************************************************
42 * RtlCreateAcl [NTDLL.306]
44 * NOTES
45 * This should return NTSTATUS
47 DWORD WINAPI RtlCreateAcl(LPACL acl,DWORD size,DWORD rev)
49 if (rev!=ACL_REVISION)
50 return STATUS_INVALID_PARAMETER;
51 if (size<sizeof(ACL))
52 return STATUS_BUFFER_TOO_SMALL;
53 if (size>0xFFFF)
54 return STATUS_INVALID_PARAMETER;
56 memset(acl,'\0',sizeof(ACL));
57 acl->AclRevision = rev;
58 acl->AclSize = size;
59 acl->AceCount = 0;
60 return 0;
63 /**************************************************************************
64 * RtlFirstFreeAce [NTDLL.370]
65 * looks for the AceCount+1 ACE, and if it is still within the alloced
66 * ACL, return a pointer to it
68 BOOL32 WINAPI RtlFirstFreeAce(LPACL acl,LPACE_HEADER *x)
70 LPACE_HEADER ace;
71 int i;
73 *x = 0;
74 ace = (LPACE_HEADER)(acl+1);
75 for (i=0;i<acl->AceCount;i++) {
76 if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
77 return 0;
78 ace = (LPACE_HEADER)(((BYTE*)ace)+ace->AceSize);
80 if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
81 return 0;
82 *x = ace;
83 return 1;
86 /**************************************************************************
87 * RtlAddAce [NTDLL.260]
89 DWORD /* NTSTATUS */
90 WINAPI RtlAddAce(LPACL acl,DWORD rev,DWORD xnrofaces,
91 LPACE_HEADER acestart,DWORD acelen)
93 LPACE_HEADER ace,targetace;
94 int nrofaces;
96 if (acl->AclRevision != ACL_REVISION)
97 return STATUS_INVALID_PARAMETER;
98 if (!RtlFirstFreeAce(acl,&targetace))
99 return STATUS_INVALID_PARAMETER;
100 nrofaces=0;ace=acestart;
101 while (((DWORD)ace-(DWORD)acestart)<acelen) {
102 nrofaces++;
103 ace = (LPACE_HEADER)(((BYTE*)ace)+ace->AceSize);
105 if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
106 return STATUS_INVALID_PARAMETER;
107 memcpy((LPBYTE)targetace,acestart,acelen);
108 acl->AceCount+=nrofaces;
109 return 0;
112 /**************************************************************************
113 * RtlCreateSecurityDescriptor [NTDLL.313]
115 DWORD /* NTSTATUS */
116 WINAPI RtlCreateSecurityDescriptor(LPSECURITY_DESCRIPTOR lpsd,DWORD rev)
118 if (rev!=SECURITY_DESCRIPTOR_REVISION)
119 return STATUS_UNKNOWN_REVISION;
120 memset(lpsd,'\0',sizeof(*lpsd));
121 lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
122 return 0;
125 /**************************************************************************
126 * RtlSetDaclSecurityDescriptor [NTDLL.483]
128 DWORD /* NTSTATUS */
129 WINAPI RtlSetDaclSecurityDescriptor ( LPSECURITY_DESCRIPTOR lpsd,BOOL32 daclpresent,LPACL dacl,BOOL32 dacldefaulted )
131 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
132 return STATUS_UNKNOWN_REVISION;
133 if (lpsd->Control & SE_SELF_RELATIVE)
134 return STATUS_INVALID_SECURITY_DESCR;
135 if (!daclpresent) {
136 lpsd->Control &= ~SE_DACL_PRESENT;
137 return 0;
139 lpsd->Control |= SE_DACL_PRESENT;
140 lpsd->Dacl = dacl;
141 if (dacldefaulted)
142 lpsd->Control |= SE_DACL_DEFAULTED;
143 else
144 lpsd->Control &= ~SE_DACL_DEFAULTED;
145 return 0;
148 /**************************************************************************
149 * RtlSetSaclSecurityDescriptor [NTDLL.488]
151 DWORD /* NTSTATUS */
152 WINAPI RtlSetSaclSecurityDescriptor (
153 LPSECURITY_DESCRIPTOR lpsd,BOOL32 saclpresent,LPACL sacl,BOOL32 sacldefaulted
156 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
157 return STATUS_UNKNOWN_REVISION;
158 if (lpsd->Control & SE_SELF_RELATIVE)
159 return STATUS_INVALID_SECURITY_DESCR;
160 if (!saclpresent) {
161 lpsd->Control &= ~SE_SACL_PRESENT;
162 return 0;
164 lpsd->Control |= SE_SACL_PRESENT;
165 lpsd->Sacl = sacl;
166 if (sacldefaulted)
167 lpsd->Control |= SE_SACL_DEFAULTED;
168 else
169 lpsd->Control &= ~SE_SACL_DEFAULTED;
170 return 0;
173 /**************************************************************************
174 * RtlSetOwnerSecurityDescriptor [NTDLL.487]
176 DWORD /* NTSTATUS */
177 WINAPI RtlSetOwnerSecurityDescriptor (LPSECURITY_DESCRIPTOR lpsd,LPSID owner,BOOL32 ownerdefaulted)
179 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
180 return STATUS_UNKNOWN_REVISION;
181 if (lpsd->Control & SE_SELF_RELATIVE)
182 return STATUS_INVALID_SECURITY_DESCR;
184 lpsd->Owner = owner;
185 if (ownerdefaulted)
186 lpsd->Control |= SE_OWNER_DEFAULTED;
187 else
188 lpsd->Control &= ~SE_OWNER_DEFAULTED;
189 return 0;
192 /**************************************************************************
193 * RtlSetGroupSecurityDescriptor [NTDLL.485]
195 DWORD /* NTSTATUS */
196 WINAPI RtlSetGroupSecurityDescriptor (LPSECURITY_DESCRIPTOR lpsd,LPSID group,BOOL32 groupdefaulted)
198 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
199 return STATUS_UNKNOWN_REVISION;
200 if (lpsd->Control & SE_SELF_RELATIVE)
201 return STATUS_INVALID_SECURITY_DESCR;
203 lpsd->Group = group;
204 if (groupdefaulted)
205 lpsd->Control |= SE_GROUP_DEFAULTED;
206 else
207 lpsd->Control &= ~SE_GROUP_DEFAULTED;
208 return 0;
212 /**************************************************************************
213 * RtlNormalizeProcessParams [NTDLL.441]
215 LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
217 FIXME(ntdll,"(%p), stub\n",x);
218 return x;
221 /**************************************************************************
222 * RtlInitializeSid [NTDLL.410]
224 DWORD WINAPI RtlInitializeSid(LPSID lpsid,LPSID_IDENTIFIER_AUTHORITY lpsidauth,
225 DWORD c)
227 BYTE a = c&0xff;
229 if (a>=SID_MAX_SUB_AUTHORITIES)
230 return a;
231 lpsid->SubAuthorityCount = a;
232 lpsid->Revision = SID_REVISION;
233 memcpy(&(lpsid->IdentifierAuthority),lpsidauth,sizeof(SID_IDENTIFIER_AUTHORITY));
234 return 0;
237 /**************************************************************************
238 * RtlSubAuthoritySid [NTDLL.497]
240 LPDWORD WINAPI RtlSubAuthoritySid(LPSID lpsid,DWORD nr)
242 return &(lpsid->SubAuthority[nr]);
245 /**************************************************************************
246 * RtlSubAuthorityCountSid [NTDLL.496]
248 LPBYTE WINAPI RtlSubAuthorityCountSid(LPSID lpsid)
250 return ((LPBYTE)lpsid)+1;
253 /**************************************************************************
254 * RtlCopySid [NTDLL.302]
256 DWORD WINAPI RtlCopySid(DWORD len,LPSID to,LPSID from)
257 { if (!from)
258 return 0;
259 if (len<(from->SubAuthorityCount*4+8))
260 return STATUS_BUFFER_TOO_SMALL;
261 memmove(to,from,from->SubAuthorityCount*4+8);
262 return STATUS_SUCCESS;
265 /**************************************************************************
266 * RtlAnsiStringToUnicodeString [NTDLL.269]
268 DWORD /* NTSTATUS */
269 WINAPI RtlAnsiStringToUnicodeString(LPUNICODE_STRING uni,LPANSI_STRING ansi,BOOL32 doalloc)
271 DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
273 if (unilen>0xFFFF)
274 return STATUS_INVALID_PARAMETER_2;
275 uni->Length = unilen;
276 if (doalloc) {
277 uni->MaximumLength = unilen;
278 uni->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,unilen);
279 if (!uni->Buffer)
280 return STATUS_NO_MEMORY;
282 if (unilen>uni->MaximumLength)
283 return STATUS_BUFFER_OVERFLOW;
284 lstrcpynAtoW(uni->Buffer,ansi->Buffer,unilen/2);
285 return STATUS_SUCCESS;
288 /**************************************************************************
289 * RtlOemStringToUnicodeString [NTDLL.447]
291 DWORD /* NTSTATUS */
292 WINAPI RtlOemStringToUnicodeString(LPUNICODE_STRING uni,LPSTRING ansi,BOOL32 doalloc)
294 DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
296 if (unilen>0xFFFF)
297 return STATUS_INVALID_PARAMETER_2;
298 uni->Length = unilen;
299 if (doalloc) {
300 uni->MaximumLength = unilen;
301 uni->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,unilen);
302 if (!uni->Buffer)
303 return STATUS_NO_MEMORY;
305 if (unilen>uni->MaximumLength)
306 return STATUS_BUFFER_OVERFLOW;
307 lstrcpynAtoW(uni->Buffer,ansi->Buffer,unilen/2);
308 return STATUS_SUCCESS;
310 /**************************************************************************
311 * RtlMultiByteToUnicodeN [NTDLL.436]
312 * FIXME: multibyte support
314 DWORD /* NTSTATUS */
315 WINAPI RtlMultiByteToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen)
317 DWORD len;
318 LPWSTR x;
320 len = oemlen;
321 if (unilen/2 < len)
322 len = unilen/2;
323 x=(LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(len+1)*sizeof(WCHAR));
324 lstrcpynAtoW(x,oemstr,len+1);
325 memcpy(unistr,x,len*2);
326 if (reslen) *reslen = len*2;
327 return 0;
330 /**************************************************************************
331 * RtlOemToUnicodeN [NTDLL.448]
333 DWORD /* NTSTATUS */
334 WINAPI RtlOemToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen)
336 DWORD len;
337 LPWSTR x;
339 len = oemlen;
340 if (unilen/2 < len)
341 len = unilen/2;
342 x=(LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(len+1)*sizeof(WCHAR));
343 lstrcpynAtoW(x,oemstr,len+1);
344 memcpy(unistr,x,len*2);
345 if (reslen) *reslen = len*2;
346 return 0;
349 /**************************************************************************
350 * RtlInitAnsiString [NTDLL.399]
352 VOID WINAPI RtlInitAnsiString(LPANSI_STRING target,LPCSTR source)
354 target->Length = target->MaximumLength = 0;
355 target->Buffer = (LPSTR)source;
356 if (!source)
357 return;
358 target->Length = lstrlen32A(target->Buffer);
359 target->MaximumLength = target->Length+1;
361 /**************************************************************************
362 * RtlInitString [NTDLL.402]
364 VOID WINAPI RtlInitString(LPSTRING target,LPCSTR source)
366 target->Length = target->MaximumLength = 0;
367 target->Buffer = (LPSTR)source;
368 if (!source)
369 return;
370 target->Length = lstrlen32A(target->Buffer);
371 target->MaximumLength = target->Length+1;
374 /**************************************************************************
375 * RtlInitUnicodeString [NTDLL.403]
377 VOID WINAPI RtlInitUnicodeString(LPUNICODE_STRING target,LPCWSTR source)
379 target->Length = target->MaximumLength = 0;
380 target->Buffer = (LPWSTR)source;
381 if (!source)
382 return;
383 target->Length = lstrlen32W(target->Buffer)*2;
384 target->MaximumLength = target->Length+2;
387 /**************************************************************************
388 * RtlFreeUnicodeString [NTDLL.377]
390 VOID WINAPI RtlFreeUnicodeString(LPUNICODE_STRING str)
392 if (str->Buffer)
393 HeapFree(GetProcessHeap(),0,str->Buffer);
396 /**************************************************************************
397 * RtlUnicodeToOemN [NTDLL.515]
399 DWORD /* NTSTATUS */
400 WINAPI RtlUnicodeToOemN(LPSTR oemstr,DWORD oemlen,LPDWORD reslen,LPWSTR unistr,DWORD unilen)
402 DWORD len;
403 LPSTR x;
405 len = oemlen;
406 if (unilen/2 < len)
407 len = unilen/2;
408 x=(LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,len+1);
409 lstrcpynWtoA(x,unistr,len+1);
410 memcpy(oemstr,x,len);
411 if (reslen) *reslen = len;
412 return 0;
415 /**************************************************************************
416 * RtlUnicodeStringToOemString [NTDLL.511]
418 DWORD /* NTSTATUS */
419 WINAPI RtlUnicodeStringToOemString(LPANSI_STRING oem,LPUNICODE_STRING uni,BOOL32 alloc)
421 if (alloc) {
422 oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
423 oem->MaximumLength = uni->Length/2+1;
425 oem->Length = uni->Length/2;
426 lstrcpynWtoA(oem->Buffer,uni->Buffer,uni->Length/2+1);
427 return 0;
430 /**************************************************************************
431 * RtlUnicodeStringToAnsiString [NTDLL.507]
433 DWORD /* NTSTATUS */
434 WINAPI RtlUnicodeStringToAnsiString(LPUNICODE_STRING uni,LPANSI_STRING oem,BOOL32 alloc)
436 if (alloc) {
437 oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
438 oem->MaximumLength = uni->Length/2+1;
440 oem->Length = uni->Length/2;
441 lstrcpynWtoA(oem->Buffer,uni->Buffer,uni->Length/2+1);
442 return 0;
445 /**************************************************************************
446 * RtlNtStatusToDosErro [NTDLL.442]
448 DWORD WINAPI RtlNtStatusToDosError(DWORD error)
450 FIXME(ntdll, "(%lx): map STATUS_ to ERROR_\n",error);
451 return error;
454 /**************************************************************************
455 * RtlGetNtProductType [NTDLL.390]
457 DWORD WINAPI RtlGetNtProductType(LPVOID x)
459 FIXME(ntdll, "(%p): stub\n", x);
460 return 0;
463 /**************************************************************************
464 * RtlUpcaseUnicodeString [NTDLL.520]
466 DWORD WINAPI RtlUpcaseUnicodeString(LPUNICODE_STRING dest,LPUNICODE_STRING src,BOOL32 doalloc)
468 LPWSTR s,t;
469 DWORD i,len;
471 len = src->Length;
472 if (doalloc) {
473 dest->MaximumLength = len;
474 dest->Buffer = (LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,len);
475 if (!dest->Buffer)
476 return STATUS_NO_MEMORY;
479 if (dest->MaximumLength < len)
480 return STATUS_BUFFER_OVERFLOW;
481 s=dest->Buffer;t=src->Buffer;
482 /* len is in bytes */
483 for (i=0;i<len/2;i++)
484 s[i] = towupper(t[i]);
485 return STATUS_SUCCESS;
488 /**************************************************************************
489 * RtlxOemStringToUnicodeSize [NTDLL.549]
491 UINT32 WINAPI RtlxOemStringToUnicodeSize(LPSTRING str)
493 return str->Length*2+2;
496 /**************************************************************************
497 * RtlxAnsiStringToUnicodeSize [NTDLL.548]
499 UINT32 WINAPI RtlxAnsiStringToUnicodeSize(LPANSI_STRING str)
501 return str->Length*2+2;
504 /**************************************************************************
505 * RtlIsTextUnicode [NTDLL.417]
507 * Apply various feeble heuristics to guess whether
508 * the text buffer contains Unicode.
509 * FIXME: should implement more tests.
511 DWORD WINAPI RtlIsTextUnicode(LPVOID buf, DWORD len, DWORD *pf)
513 LPWSTR s = buf;
514 DWORD flags = -1, out_flags = 0;
516 if (!len)
517 goto out;
518 if (pf)
519 flags = *pf;
521 * Apply various tests to the text string. According to the
522 * docs, each test "passed" sets the corresponding flag in
523 * the output flags. But some of the tests are mutually
524 * exclusive, so I don't see how you could pass all tests ...
527 /* Check for an odd length ... pass if even. */
528 if (!(len & 1))
529 out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
531 /* Check for the special unicode marker byte. */
532 if (*s == 0xFEFF)
533 out_flags |= IS_TEXT_UNICODE_SIGNATURE;
536 * Check whether the string passed all of the tests.
538 flags &= ITU_IMPLEMENTED_TESTS;
539 if ((out_flags & flags) != flags)
540 len = 0;
541 out:
542 if (pf)
543 *pf = out_flags;
544 return len;
547 /**************************************************************************
548 * RtlDosPathNameToNtPathName_U [NTDLL.338]
550 * FIXME: convert to UNC or whatever is expected here
552 BOOL32 WINAPI RtlDosPathNameToNtPathName_U(
553 LPWSTR from,LPUNICODE_STRING us,DWORD x2,DWORD x3)
555 LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from);
557 FIXME(ntdll,"(%s,%p,%08lx,%08lx)\n",fromA,us,x2,x3);
558 if (us)
559 RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from));
560 return TRUE;
563 /**************************************************************************
564 * NtOpenFile [NTDLL.127]
566 DWORD WINAPI NtOpenFile(DWORD x1,DWORD flags,DWORD x3,DWORD x4,DWORD alignment,DWORD x6)
568 FIXME(ntdll,"(%08lx,0x%08lx,%08lx,%08lx,%08lx,%08lx): stub\n",
569 x1,flags,x3,x4,alignment,x6);
570 /* returns file io completion status */
571 return 0;
574 /**************************************************************************
575 * NtCreateFile [NTDLL.73]
577 DWORD /* NTSTATUS */
578 WINAPI NtCreateFile(PHANDLE filehandle,DWORD access,LPLONG attributes,
579 LPLONG status,LPVOID x5,DWORD x6,DWORD x7,
580 LPLONG x8,DWORD x9,DWORD x10,LPLONG x11)
582 /* parameter count checked with wine debugger */
583 FIXME(ntdll,"(%p,%lx,%lx,%lx,%p,%08lx,%08lx,%p,%08lx,%08lx,%p): empty stub\n",
584 filehandle,access,*attributes,*status,x5,x6,x7,x8,x9,x10,x11);
585 return 0;
587 /**************************************************************************
588 * NtCreateTimer [NTDLL.87]
590 DWORD WINAPI NtCreateTimer(DWORD x1, DWORD x2, DWORD x3)
592 /* parameter count checked (obscure doc from internet said 4, debugger showed only 3) */
593 FIXME(ntdll,"(%08lx,%08lx,%08lx): empty stub\n",
594 x1,x2,x3);
595 return 0;
597 /**************************************************************************
598 * NtSetTimer [NTDLL.221]
600 DWORD WINAPI NtSetTimer(DWORD x1,DWORD x2,DWORD x3,DWORD x4,
601 DWORD x5,DWORD x6)
603 /* parameter count checked (obscure doc from internet said 7, debugger showed only 6) */
604 FIXME(ntdll,"(%08lx,%08lx,%08lx,%08lx,%08lx,%08lx): empty stub\n",
605 x1,x2,x3,x4,x5,x6);
606 return 0;
609 /**************************************************************************
610 * NtCreateEvent [NTDLL.71]
612 DWORD /* NTSTATUS */
613 WINAPI NtCreateEvent(PHANDLE eventhandle, DWORD desiredaccess,
614 DWORD attributes, DWORD eventtype, DWORD initialstate)
616 /* parameter count checked with wine debugger */
617 FIXME(ntdll,"(%p,%08lx,%08lx,%08lx,%08lx): empty stub\n",
618 eventhandle,desiredaccess,attributes,eventtype,initialstate);
619 return 0;
621 /**************************************************************************
622 * NtDeviceIoControlFile [NTDLL.94]
624 DWORD /* NTSTATUS */
625 WINAPI NtDeviceIoControlFile(HANDLE32 filehandle, HANDLE32 event,
626 DWORD x3, DWORD x4, DWORD x5, UINT32 iocontrolcode,
627 LPVOID inputbuffer, DWORD inputbufferlength,
628 LPVOID outputbuffer, DWORD outputbufferlength)
630 /* parameter count checked with wine debugger */
631 FIXME(ntdll,"(%x,%x,%08lx,%08lx,%08lx,%08x,%lx,%lx): empty stub\n",
632 filehandle,event,x3,x4,x5,iocontrolcode,inputbufferlength,outputbufferlength);
633 return 0;
635 /**************************************************************************
636 * NTDLL_chkstk [NTDLL.862]
639 VOID WINAPI NTDLL_chkstk (DWORD x1, DWORD x2, DWORD x3, DWORD x4,
640 DWORD x5, DWORD x6, DWORD x7, DWORD x8,
641 DWORD x9, DWORD x10)
643 /* FIXME: should subtract %eax bytes from stack pointer */
644 FIXME(ntdll, "(void): stub\n");
648 /**************************************************************************
649 * NtOpenDirectoryObject [NTDLL.124]
651 DWORD WINAPI NtOpenDirectoryObject(DWORD x1,DWORD x2,DWORD x3)
653 FIXME(ntdll,"(%lx,%lx,%lx): stub\n",x1,x2,x3);
654 return 0;
658 /******************************************************************************
659 * NtQueryDirectoryObject [NTDLL.149]
661 DWORD WINAPI NtQueryDirectoryObject( DWORD x1, DWORD x2, DWORD x3, DWORD x4,
662 DWORD x5, DWORD x6, DWORD x7 )
664 FIXME(ntdll,"(%lx,%lx,%lx,%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4,x5,x6,x7);
665 return 0;
669 /**************************************************************************
670 * RtlFreeAnsiString [NTDLL.373]
672 VOID WINAPI RtlFreeAnsiString(LPANSI_STRING AnsiString)
674 if( AnsiString->Buffer )
675 HeapFree( GetProcessHeap(),0,AnsiString->Buffer );
679 /******************************************************************************
680 * NtQuerySystemInformation [NTDLL.168]
682 DWORD WINAPI NtQuerySystemInformation( DWORD x1, DWORD x2, DWORD x3, DWORD x4 )
684 FIXME(ntdll,"(%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4);
685 return 0;
689 /******************************************************************************
690 * NtQueryObject [NTDLL.161]
692 DWORD WINAPI NtQueryObject( DWORD x1, DWORD x2 ,DWORD x3, DWORD x4, DWORD x5 )
694 FIXME(ntdll,"(0x%lx,%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4,x5);
695 return 0;
699 /******************************************************************************
700 * RtlTimeToElapsedTimeFields [NTDLL.502]
702 DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 )
704 FIXME(ntdll,"(%lx,%lx): stub\n",x1,x2);
705 return 0;
709 /******************************************************************************
710 * NtSetInformationProcess [NTDLL.207]
712 DWORD WINAPI NtSetInformationProcess( DWORD x1, DWORD x2, DWORD x3, DWORD x4 )
714 FIXME(ntdll,"(%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4);
715 return 0;
718 /******************************************************************************
719 * NtFsControlFile [NTDLL.108]
721 VOID WINAPI NtFsControlFile(VOID)
723 FIXME(ntdll,"(void): stub\n");
726 /******************************************************************************
727 * RtlExtendedLargeIntegerDivide [NTDLL.359]
729 INT32 WINAPI RtlExtendedLargeIntegerDivide(
730 LARGE_INTEGER dividend,
731 DWORD divisor,
732 LPDWORD rest
734 #if SIZEOF_LONG_LONG==8
735 long long x1 = *(long long*)&dividend;
737 if (*rest)
738 *rest = x1 % divisor;
739 return x1/divisor;
740 #else
741 FIXME(ntdll,"((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest);
742 return 0;
743 #endif
746 /******************************************************************************
747 * RtlExtendedLargeIntegerMultiply [NTDLL.359]
748 * Note: This even works, since gcc returns 64bit values in eax/edx just like
749 * the caller expects. However... The relay code won't grok this I think.
751 long long /*LARGE_INTEGER*/
752 WINAPI RtlExtendedIntegerMultiply(
753 LARGE_INTEGER factor1,INT32 factor2
755 #if SIZEOF_LONG_LONG==8
756 return (*(long long*)&factor1)*factor2;
757 #else
758 FIXME(ntdll,"((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2);
759 return 0;
760 #endif
763 DWORD WINAPI NtOpenKey(DWORD x1,DWORD x2,DWORD x3) {
764 FIXME(ntdll,"(0x%08lx(%s),0x%08lx,0x%08lx),stub!\n",x1,
765 debugstr_w(*(LPWSTR*)x1),x2,x3);
766 /* hmm... */
767 return RegOpenKey32W(x2,*(LPWSTR*)x1,x3);
770 DWORD WINAPI NtQueryValueKey(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
771 FIXME(ntdll,"(%08lx,%08lx,%08lx,%08lx,%08lx,%08lx),stub!\n",
772 x1,x2,x3,x4,x5,x6
774 return 0;
777 DWORD WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3) {
778 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
779 return 1;
782 /**************************************************************************
783 * NtClose [NTDLL.65]
785 DWORD WINAPI NtClose(DWORD x1) {
786 FIXME(ntdll,"(0x%08lx),stub!\n",x1);
787 return 1;
789 /******************************************************************************
790 * NtQueryInformationProcess [NTDLL.]
793 DWORD WINAPI NtQueryInformationProcess(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
794 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
795 x1,x2,x3,x4,x5
797 return 0;
799 /******************************************************************************
800 * NtQueryInformationThread [NTDLL.]
803 DWORD WINAPI NtQueryInformationThread(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
804 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
805 x1,x2,x3,x4,x5
807 return 0;
809 /******************************************************************************
810 * NtQueryInformationToken [NTDLL.156]
813 DWORD WINAPI NtQueryInformationToken(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
814 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
815 x1,x2,x3,x4,x5
817 return 0;
819 /******************************************************************************
820 * RtlFormatCurrentUserKeyPath [NTDLL.371]
823 DWORD WINAPI RtlFormatCurrentUserKeyPath()
825 FIXME(ntdll,"(): stub\n");
826 return 1;
828 DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2)
830 /* Note: this is not the correct solution,
831 * But this works pretty good on wine and NT4.0 binaries
833 if ( x1 == 0x2000000 ) {
834 *x2 = HKEY_CURRENT_USER;
835 return TRUE;
838 return FALSE;
840 /******************************************************************************
841 * RtlAllocateAndInitializeSid [NTDLL.265]
844 BOOL32 WINAPI RtlAllocateAndInitializeSid (LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,DWORD nSubAuthorityCount,
845 DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8,DWORD x9,DWORD x10, LPSID pSid)
846 { FIXME(ntdll,"(%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p),stub!\n",
847 pIdentifierAuthority,nSubAuthorityCount,x3,x4,x5,x6,x7,x8,x9,x10,pSid);
848 return 0;
850 /******************************************************************************
851 * RtlEqualSid [NTDLL.352]
854 DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2)
855 { FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n", x1,x2);
856 return TRUE;
858 /******************************************************************************
859 * RtlFreeSid [NTDLL.376]
862 DWORD WINAPI RtlFreeSid(DWORD x1)
863 { FIXME(ntdll,"(0x%08lx),stub!\n", x1);
864 return TRUE;