Lots of stubs to get winlogon.exe from nt3.51 and other NT3.51 applets
[wine/multimedia.git] / misc / ntdll.c
blob3e863f15813dcaba2c78f780f30ca34156d89163
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(LPANSI_STRING oem,LPUNICODE_STRING uni,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 BOOL32 WINAPI RtlGetNtProductType(LPDWORD type)
459 FIXME(ntdll, "(%p): stub\n", type);
460 *type=3; /* dunno. 1 for client, 3 for server? */
461 return 1;
464 /**************************************************************************
465 * RtlUpcaseUnicodeString [NTDLL.520]
467 DWORD WINAPI RtlUpcaseUnicodeString(LPUNICODE_STRING dest,LPUNICODE_STRING src,BOOL32 doalloc)
469 LPWSTR s,t;
470 DWORD i,len;
472 len = src->Length;
473 if (doalloc) {
474 dest->MaximumLength = len;
475 dest->Buffer = (LPWSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,len);
476 if (!dest->Buffer)
477 return STATUS_NO_MEMORY;
480 if (dest->MaximumLength < len)
481 return STATUS_BUFFER_OVERFLOW;
482 s=dest->Buffer;t=src->Buffer;
483 /* len is in bytes */
484 for (i=0;i<len/2;i++)
485 s[i] = towupper(t[i]);
486 return STATUS_SUCCESS;
489 /**************************************************************************
490 * RtlxOemStringToUnicodeSize [NTDLL.549]
492 UINT32 WINAPI RtlxOemStringToUnicodeSize(LPSTRING str)
494 return str->Length*2+2;
497 /**************************************************************************
498 * RtlxAnsiStringToUnicodeSize [NTDLL.548]
500 UINT32 WINAPI RtlxAnsiStringToUnicodeSize(LPANSI_STRING str)
502 return str->Length*2+2;
505 /**************************************************************************
506 * RtlIsTextUnicode [NTDLL.417]
508 * Apply various feeble heuristics to guess whether
509 * the text buffer contains Unicode.
510 * FIXME: should implement more tests.
512 DWORD WINAPI RtlIsTextUnicode(LPVOID buf, DWORD len, DWORD *pf)
514 LPWSTR s = buf;
515 DWORD flags = -1, out_flags = 0;
517 if (!len)
518 goto out;
519 if (pf)
520 flags = *pf;
522 * Apply various tests to the text string. According to the
523 * docs, each test "passed" sets the corresponding flag in
524 * the output flags. But some of the tests are mutually
525 * exclusive, so I don't see how you could pass all tests ...
528 /* Check for an odd length ... pass if even. */
529 if (!(len & 1))
530 out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
532 /* Check for the special unicode marker byte. */
533 if (*s == 0xFEFF)
534 out_flags |= IS_TEXT_UNICODE_SIGNATURE;
537 * Check whether the string passed all of the tests.
539 flags &= ITU_IMPLEMENTED_TESTS;
540 if ((out_flags & flags) != flags)
541 len = 0;
542 out:
543 if (pf)
544 *pf = out_flags;
545 return len;
548 /**************************************************************************
549 * RtlDosPathNameToNtPathName_U [NTDLL.338]
551 * FIXME: convert to UNC or whatever is expected here
553 BOOL32 WINAPI RtlDosPathNameToNtPathName_U(
554 LPWSTR from,LPUNICODE_STRING us,DWORD x2,DWORD x3)
556 LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from);
558 FIXME(ntdll,"(%s,%p,%08lx,%08lx)\n",fromA,us,x2,x3);
559 if (us)
560 RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from));
561 return TRUE;
564 /**************************************************************************
565 * NtOpenFile [NTDLL.127]
567 DWORD WINAPI NtOpenFile(DWORD x1,DWORD flags,DWORD x3,DWORD x4,DWORD alignment,DWORD x6)
569 FIXME(ntdll,"(%08lx,0x%08lx,%08lx,%08lx,%08lx,%08lx): stub\n",
570 x1,flags,x3,x4,alignment,x6);
571 /* returns file io completion status */
572 return 0;
575 /**************************************************************************
576 * NtCreateFile [NTDLL.73]
578 DWORD /* NTSTATUS */
579 WINAPI NtCreateFile(PHANDLE filehandle,DWORD access,LPLONG attributes,
580 LPLONG status,LPVOID x5,DWORD x6,DWORD x7,
581 LPLONG x8,DWORD x9,DWORD x10,LPLONG x11)
583 /* parameter count checked with wine debugger */
584 FIXME(ntdll,"(%p,%lx,%lx,%lx,%p,%08lx,%08lx,%p,%08lx,%08lx,%p): empty stub\n",
585 filehandle,access,*attributes,*status,x5,x6,x7,x8,x9,x10,x11);
586 return 0;
588 /**************************************************************************
589 * NtCreateTimer [NTDLL.87]
591 DWORD WINAPI NtCreateTimer(DWORD x1, DWORD x2, DWORD x3)
593 /* parameter count checked (obscure doc from internet said 4, debugger showed only 3) */
594 FIXME(ntdll,"(%08lx,%08lx,%08lx): empty stub\n",
595 x1,x2,x3);
596 return 0;
598 /**************************************************************************
599 * NtSetTimer [NTDLL.221]
601 DWORD WINAPI NtSetTimer(DWORD x1,DWORD x2,DWORD x3,DWORD x4,
602 DWORD x5,DWORD x6)
604 /* parameter count checked (obscure doc from internet said 7, debugger showed only 6) */
605 FIXME(ntdll,"(%08lx,%08lx,%08lx,%08lx,%08lx,%08lx): empty stub\n",
606 x1,x2,x3,x4,x5,x6);
607 return 0;
610 /**************************************************************************
611 * NtCreateEvent [NTDLL.71]
613 DWORD /* NTSTATUS */
614 WINAPI NtCreateEvent(PHANDLE eventhandle, DWORD desiredaccess,
615 DWORD attributes, DWORD eventtype, DWORD initialstate)
617 /* parameter count checked with wine debugger */
618 FIXME(ntdll,"(%p,%08lx,%08lx,%08lx,%08lx): empty stub\n",
619 eventhandle,desiredaccess,attributes,eventtype,initialstate);
620 return 0;
622 /**************************************************************************
623 * NtDeviceIoControlFile [NTDLL.94]
625 DWORD /* NTSTATUS */
626 WINAPI NtDeviceIoControlFile(HANDLE32 filehandle, HANDLE32 event,
627 DWORD x3, DWORD x4, DWORD x5, UINT32 iocontrolcode,
628 LPVOID inputbuffer, DWORD inputbufferlength,
629 LPVOID outputbuffer, DWORD outputbufferlength)
631 /* parameter count checked with wine debugger */
632 FIXME(ntdll,"(%x,%x,%08lx,%08lx,%08lx,%08x,%lx,%lx): empty stub\n",
633 filehandle,event,x3,x4,x5,iocontrolcode,inputbufferlength,outputbufferlength);
634 return 0;
636 /**************************************************************************
637 * NTDLL_chkstk [NTDLL.862]
640 VOID WINAPI NTDLL_chkstk (DWORD x1, DWORD x2, DWORD x3, DWORD x4,
641 DWORD x5, DWORD x6, DWORD x7, DWORD x8,
642 DWORD x9, DWORD x10)
644 /* FIXME: should subtract %eax bytes from stack pointer */
645 FIXME(ntdll, "(void): stub\n");
649 /**************************************************************************
650 * NtOpenDirectoryObject [NTDLL.124]
652 DWORD WINAPI NtOpenDirectoryObject(DWORD x1,DWORD x2,DWORD x3)
654 FIXME(ntdll,"(%lx,%lx,%lx): stub\n",x1,x2,x3);
655 return 0;
659 /******************************************************************************
660 * NtQueryDirectoryObject [NTDLL.149]
662 DWORD WINAPI NtQueryDirectoryObject( DWORD x1, DWORD x2, DWORD x3, DWORD x4,
663 DWORD x5, DWORD x6, DWORD x7 )
665 FIXME(ntdll,"(%lx,%lx,%lx,%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4,x5,x6,x7);
666 return 0;
670 /**************************************************************************
671 * RtlFreeAnsiString [NTDLL.373]
673 VOID WINAPI RtlFreeAnsiString(LPANSI_STRING AnsiString)
675 if( AnsiString->Buffer )
676 HeapFree( GetProcessHeap(),0,AnsiString->Buffer );
680 /******************************************************************************
681 * NtQuerySystemInformation [NTDLL.168]
683 DWORD WINAPI NtQuerySystemInformation( DWORD x1, DWORD x2, DWORD x3, DWORD x4 )
685 FIXME(ntdll,"(%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4);
686 return 0;
690 /******************************************************************************
691 * NtQueryObject [NTDLL.161]
693 DWORD WINAPI NtQueryObject( DWORD x1, DWORD x2 ,DWORD x3, DWORD x4, DWORD x5 )
695 FIXME(ntdll,"(0x%lx,%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4,x5);
696 return 0;
700 /******************************************************************************
701 * RtlTimeToElapsedTimeFields [NTDLL.502]
703 DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 )
705 FIXME(ntdll,"(%lx,%lx): stub\n",x1,x2);
706 return 0;
710 /******************************************************************************
711 * NtSetInformationProcess [NTDLL.207]
713 DWORD WINAPI NtSetInformationProcess( DWORD x1, DWORD x2, DWORD x3, DWORD x4 )
715 FIXME(ntdll,"(%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4);
716 return 0;
719 /******************************************************************************
720 * NtFsControlFile [NTDLL.108]
722 VOID WINAPI NtFsControlFile(VOID)
724 FIXME(ntdll,"(void): stub\n");
727 /******************************************************************************
728 * RtlExtendedLargeIntegerDivide [NTDLL.359]
730 INT32 WINAPI RtlExtendedLargeIntegerDivide(
731 LARGE_INTEGER dividend,
732 DWORD divisor,
733 LPDWORD rest
735 #if SIZEOF_LONG_LONG==8
736 long long x1 = *(long long*)&dividend;
738 if (*rest)
739 *rest = x1 % divisor;
740 return x1/divisor;
741 #else
742 FIXME(ntdll,"((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest);
743 return 0;
744 #endif
747 /******************************************************************************
748 * RtlExtendedLargeIntegerMultiply [NTDLL.359]
749 * Note: This even works, since gcc returns 64bit values in eax/edx just like
750 * the caller expects. However... The relay code won't grok this I think.
752 long long /*LARGE_INTEGER*/
753 WINAPI RtlExtendedIntegerMultiply(
754 LARGE_INTEGER factor1,INT32 factor2
756 #if SIZEOF_LONG_LONG==8
757 return (*(long long*)&factor1)*factor2;
758 #else
759 FIXME(ntdll,"((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2);
760 return 0;
761 #endif
764 DWORD WINAPI NtOpenKey(DWORD x1,DWORD x2,LPUNICODE_STRING key) {
765 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx(%s)),stub!\n",x1,x2,key,key->Buffer);
766 return RegOpenKey32W(HKEY_LOCAL_MACHINE,key->Buffer,x1);
769 DWORD WINAPI NtQueryValueKey(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
770 FIXME(ntdll,"(%08lx,%08lx,%08lx,%08lx,%08lx,%08lx),stub!\n",
771 x1,x2,x3,x4,x5,x6
773 return 0;
776 DWORD WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3) {
777 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
778 return 1;
781 /**************************************************************************
782 * NtClose [NTDLL.65]
784 DWORD WINAPI NtClose(DWORD x1) {
785 FIXME(ntdll,"(0x%08lx),stub!\n",x1);
786 return 1;
788 /******************************************************************************
789 * NtQueryInformationProcess [NTDLL.]
792 DWORD WINAPI NtQueryInformationProcess(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
793 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
794 x1,x2,x3,x4,x5
796 return 0;
798 /******************************************************************************
799 * NtQueryInformationThread [NTDLL.]
802 DWORD WINAPI NtQueryInformationThread(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
803 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
804 x1,x2,x3,x4,x5
806 return 0;
808 /******************************************************************************
809 * NtQueryInformationToken [NTDLL.156]
812 DWORD WINAPI NtQueryInformationToken(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
813 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
814 x1,x2,x3,x4,x5
816 return 0;
818 /******************************************************************************
819 * RtlFormatCurrentUserKeyPath [NTDLL.371]
822 DWORD WINAPI RtlFormatCurrentUserKeyPath()
824 FIXME(ntdll,"(): stub\n");
825 return 1;
827 DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2)
829 /* Note: this is not the correct solution,
830 * But this works pretty good on wine and NT4.0 binaries
832 if ( x1 == 0x2000000 ) {
833 *x2 = HKEY_CURRENT_USER;
834 return TRUE;
837 return FALSE;
839 /******************************************************************************
840 * RtlAllocateAndInitializeSid [NTDLL.265]
843 BOOL32 WINAPI RtlAllocateAndInitializeSid (LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,DWORD nSubAuthorityCount,
844 DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8,DWORD x9,DWORD x10, LPSID pSid)
845 { FIXME(ntdll,"(%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p),stub!\n",
846 pIdentifierAuthority,nSubAuthorityCount,x3,x4,x5,x6,x7,x8,x9,x10,pSid);
847 return 0;
849 /******************************************************************************
850 * RtlEqualSid [NTDLL.352]
853 DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2)
854 { FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n", x1,x2);
855 return TRUE;
858 /******************************************************************************
859 * RtlFreeSid [NTDLL.376]
861 DWORD WINAPI RtlFreeSid(DWORD x1)
862 { FIXME(ntdll,"(0x%08lx),stub!\n", x1);
863 return TRUE;
866 /******************************************************************************
867 * NtCreatePagingFile [NTDLL]
869 DWORD WINAPI NtCreatePagingFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
870 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
871 return 0;
874 /******************************************************************************
875 * RtlGetDaclSecurityDescriptor [NTDLL]
877 DWORD WINAPI RtlGetDaclSecurityDescriptor(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
878 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
879 return 0;
882 /******************************************************************************
883 * NtDuplicateObject [NTDLL]
885 DWORD WINAPI NtDuplicateObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,
886 DWORD x6,DWORD x7
888 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6,x7);
889 return 0;
892 /******************************************************************************
893 * RtlCreateEnvironment [NTDLL]
895 DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) {
896 FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
897 return 0;
900 /******************************************************************************
901 * RtlDestroyEnvironment [NTDLL]
903 DWORD WINAPI RtlDestroyEnvironment(DWORD x) {
904 FIXME(ntdll,"(0x%08lx),stub!\n",x);
905 return 0;
908 /******************************************************************************
909 * RtlQueryEnvironmentVariable_U [NTDLL]
911 DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,DWORD x2,DWORD x3) {
912 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
913 return 0;
916 /******************************************************************************
917 * RtlSetEnvironmentVariable [NTDLL]
919 DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,DWORD x2,DWORD x3) {
920 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
921 return 0;
924 /******************************************************************************
925 * NtDuplicateToken [NTDLL]
927 DWORD WINAPI NtDuplicateToken(
928 DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6
930 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
931 return 0;
934 /******************************************************************************
935 * NtAdjustPrivilegesToken [NTDLL]
937 DWORD WINAPI NtAdjustPrivilegesToken(
938 DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6
940 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
941 return 0;
944 /******************************************************************************
945 * NtOpenProcessToken [NTDLL]
947 DWORD WINAPI NtOpenProcessToken(DWORD x1,DWORD x2,DWORD x3) {
948 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
949 return 0;
952 /******************************************************************************
953 * NtSetInformationThread [NTDLL]
955 DWORD WINAPI NtSetInformationThread(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
956 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
957 return 0;
960 /******************************************************************************
961 * NtOpenThreadToken [NTDLL]
963 DWORD WINAPI NtOpenThreadToken(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
964 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
965 return 0;
968 /******************************************************************************
969 * RtlNewSecurityObject [NTDLL]
971 DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
972 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
973 return 0;
976 /******************************************************************************
977 * RtlDeleteSecurityObject [NTDLL]
979 DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) {
980 FIXME(ntdll,"(0x%08lx),stub!\n",x1);
981 return 0;
984 /******************************************************************************
985 * NtSetVolumeInformationFile [NTDLL]
987 DWORD WINAPI NtSetVolumeInformationFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,
988 DWORD x5
990 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5);
991 return 0;
994 /******************************************************************************
995 * NtCreatePort [NTDLL]
997 DWORD WINAPI NtCreatePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5) {
998 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5);
999 return 0;