Changed CBGetDroppedControlRect to be compliant with Windows API.
[wine/testsucceed.git] / dlls / ntdll / nt.c
blobea62a5dd96e2efb2900425422d7cfa5d2a280853
1 /*
2 * NT basis DLL
3 *
4 * This file contains the Nt* API functions of NTDLL.DLL.
5 * In the original ntdll.dll they all seem to just call int 0x2e (down to the HAL)
7 * Copyright 1996-1998 Marcus Meissner
8 */
10 #include <stdlib.h>
11 #include <string.h>
12 #include <time.h>
13 #include "debugstr.h"
14 #include "debug.h"
16 #include "ntddk.h"
18 DEFAULT_DEBUG_CHANNEL(ntdll)
20 /* move to winbase.h */
21 typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue);
24 * Timer object
27 /**************************************************************************
28 * NtCreateTimer [NTDLL.87]
30 NTSTATUS WINAPI NtCreateTimer(
31 OUT PHANDLE TimerHandle,
32 IN ACCESS_MASK DesiredAccess,
33 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
34 IN TIMER_TYPE TimerType)
36 FIXME(ntdll,"(%p,0x%08lx,%p(%s),0x%08x) stub\n",
37 TimerHandle,DesiredAccess,ObjectAttributes,
38 ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
39 TimerType);
40 return 0;
42 /**************************************************************************
43 * NtSetTimer [NTDLL.221]
45 NTSTATUS WINAPI NtSetTimer(
46 IN HANDLE TimerHandle,
47 IN PLARGE_INTEGER DueTime,
48 IN PTIMERAPCROUTINE TimerApcRoutine,
49 IN PVOID TimerContext,
50 IN BOOLEAN WakeTimer,
51 IN ULONG Period OPTIONAL,
52 OUT PBOOLEAN PreviousState OPTIONAL)
54 FIXME(ntdll,"(0x%08x,%p,%p,%p,%08x,0x%08lx,%p) stub\n",
55 TimerHandle,DueTime,TimerApcRoutine,TimerContext,WakeTimer,Period,PreviousState);
56 return 0;
59 /******************************************************************************
60 * NtQueryTimerResolution [NTDLL.129]
62 NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3)
64 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
65 return 1;
69 * Process object
72 /******************************************************************************
73 * NtTerminateProcess [NTDLL.]
75 * Native applications must kill themselves when done
76 * FIXME: return value 0-success
78 NTSTATUS WINAPI NtTerminateProcess(
79 HANDLE ProcessHandle,
80 LONG ExitStatus)
82 TRACE(ntdll, "0x%08x 0x%08lx\n", ProcessHandle, ExitStatus );
84 /* win32 (0x7fffffff) to nt (-1) */
85 if ( NtCurrentProcess() == ProcessHandle )
86 ProcessHandle = GetCurrentProcess();
88 return (! TerminateProcess( ProcessHandle, ExitStatus ));
91 /******************************************************************************
92 * NtQueryInformationProcess [NTDLL.]
95 NTSTATUS WINAPI NtQueryInformationProcess(
96 IN HANDLE ProcessHandle,
97 IN PROCESSINFOCLASS ProcessInformationClass,
98 OUT PVOID ProcessInformation,
99 IN ULONG ProcessInformationLength,
100 OUT PULONG ReturnLength)
102 FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
103 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength,ReturnLength);
104 return 0;
107 /******************************************************************************
108 * NtSetInformationProcess [NTDLL.207]
110 NTSTATUS WINAPI NtSetInformationProcess(
111 IN HANDLE ProcessHandle,
112 IN PROCESSINFOCLASS ProcessInformationClass,
113 IN PVOID ProcessInformation,
114 IN ULONG ProcessInformationLength)
116 FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx) stub\n",
117 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
118 return 0;
122 * Thread
125 /******************************************************************************
126 * NtResumeThread [NTDLL]
128 NTSTATUS WINAPI NtResumeThread(
129 IN HANDLE ThreadHandle,
130 IN PULONG SuspendCount)
132 FIXME(ntdll,"(0x%08x,%p),stub!\n",
133 ThreadHandle,SuspendCount);
134 return 0;
137 /******************************************************************************
138 * NtTerminateThread [NTDLL]
140 NTSTATUS WINAPI NtTerminateThread(
141 IN HANDLE ThreadHandle,
142 IN NTSTATUS ExitStatus)
144 if ( TerminateThread(ThreadHandle,ExitStatus) )
145 return 0;
147 return 0xc0000000; /* FIXME: lasterror->ntstatus */
150 /******************************************************************************
151 * NtQueryInformationThread [NTDLL.]
154 NTSTATUS WINAPI NtQueryInformationThread(
155 IN HANDLE ThreadHandle,
156 IN THREADINFOCLASS ThreadInformationClass,
157 OUT PVOID ThreadInformation,
158 IN ULONG ThreadInformationLength,
159 OUT PULONG ReturnLength)
161 FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
162 ThreadHandle, ThreadInformationClass, ThreadInformation,
163 ThreadInformationLength, ReturnLength);
164 return 0;
167 /******************************************************************************
168 * NtSetInformationThread [NTDLL]
170 NTSTATUS WINAPI NtSetInformationThread(
171 HANDLE ThreadHandle,
172 THREADINFOCLASS ThreadInformationClass,
173 PVOID ThreadInformation,
174 ULONG ThreadInformationLength)
176 FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx),stub!\n",
177 ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength);
178 return 0;
182 * Token
185 /******************************************************************************
186 * NtDuplicateToken [NTDLL]
188 NTSTATUS WINAPI NtDuplicateToken(
189 IN HANDLE ExistingToken,
190 IN ACCESS_MASK DesiredAccess,
191 IN POBJECT_ATTRIBUTES ObjectAttributes,
192 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
193 IN TOKEN_TYPE TokenType,
194 OUT PHANDLE NewToken)
196 FIXME(ntdll,"(0x%08x,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
197 ExistingToken, DesiredAccess, ObjectAttributes, ImpersonationLevel,
198 TokenType, NewToken);
199 return 0;
202 /******************************************************************************
203 * NtOpenProcessToken [NTDLL]
205 NTSTATUS WINAPI NtOpenProcessToken(
206 HANDLE ProcessHandle,
207 DWORD DesiredAccess,
208 HANDLE *TokenHandle)
210 FIXME(ntdll,"(0x%08x,0x%08lx,%p): stub\n",
211 ProcessHandle,DesiredAccess, TokenHandle);
212 *TokenHandle = 0xcafe;
213 return 0;
216 /******************************************************************************
217 * NtOpenThreadToken [NTDLL]
219 NTSTATUS WINAPI NtOpenThreadToken(
220 HANDLE ThreadHandle,
221 DWORD DesiredAccess,
222 BOOLEAN OpenAsSelf,
223 HANDLE *TokenHandle)
225 FIXME(ntdll,"(0x%08x,0x%08lx,0x%08x,%p): stub\n",
226 ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
227 *TokenHandle = 0xcafe;
228 return 0;
231 /******************************************************************************
232 * NtAdjustPrivilegesToken [NTDLL]
234 * FIXME: parameters unsafe
236 NTSTATUS WINAPI NtAdjustPrivilegesToken(
237 IN HANDLE TokenHandle,
238 IN BOOLEAN DisableAllPrivileges,
239 IN PTOKEN_PRIVILEGES NewState,
240 IN DWORD BufferLength,
241 OUT PTOKEN_PRIVILEGES PreviousState,
242 OUT PDWORD ReturnLength)
244 FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
245 TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
246 return 0;
249 /******************************************************************************
250 * NtQueryInformationToken [NTDLL.156]
253 NTSTATUS WINAPI NtQueryInformationToken(
254 HANDLE token,
255 DWORD tokeninfoclass,
256 LPVOID tokeninfo,
257 DWORD tokeninfolength,
258 LPDWORD retlen )
260 FIXME(ntdll,"(%08x,%ld,%p,%ld,%p): stub\n",
261 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
263 switch (tokeninfoclass)
264 { case TokenGroups: /* 2 */
265 *retlen = sizeof (TOKEN_GROUPS);
266 #if 0
267 case TokenUser: /* 1 */
268 case TokenPrivileges:
269 case TokenOwner:
270 case TokenPrimaryGroup:
271 case TokenDefaultDacl:
272 case TokenSource:
273 case TokenType:
274 case TokenImpersonationLevel:
275 case TokenStatistics:
276 #endif /* 0 */
279 return 0;
283 * Section
286 /******************************************************************************
287 * NtCreateSection [NTDLL]
289 NTSTATUS WINAPI NtCreateSection(
290 OUT PHANDLE SectionHandle,
291 IN ACCESS_MASK DesiredAccess,
292 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
293 IN PLARGE_INTEGER MaximumSize OPTIONAL,
294 IN ULONG SectionPageProtection OPTIONAL,
295 IN ULONG AllocationAttributes,
296 IN HANDLE FileHandle OPTIONAL)
298 FIXME(ntdll,"(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx,0x%08x) stub\n",
299 SectionHandle,DesiredAccess,ObjectAttributes,
300 ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
301 MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle);
302 return 0;
305 /******************************************************************************
306 * NtOpenSection [NTDLL]
308 NTSTATUS WINAPI NtOpenSection(
309 PHANDLE SectionHandle,
310 ACCESS_MASK DesiredAccess,
311 POBJECT_ATTRIBUTES ObjectAttributes)
313 FIXME(ntdll,"(%p,0x%08lx,%p(%s)),stub!\n",
314 SectionHandle,DesiredAccess,ObjectAttributes,
315 ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
316 return 0;
319 /******************************************************************************
320 * NtQuerySection [NTDLL]
322 NTSTATUS WINAPI NtQuerySection(
323 IN HANDLE SectionHandle,
324 IN PVOID SectionInformationClass,
325 OUT PVOID SectionInformation,
326 IN ULONG Length,
327 OUT PULONG ResultLength)
329 FIXME(ntdll,"(0x%08x,%p,%p,0x%08lx,%p) stub!\n",
330 SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
331 return 0;
334 /******************************************************************************
335 * NtMapViewOfSection [NTDLL]
336 * FUNCTION: Maps a view of a section into the virtual address space of a process
338 * ARGUMENTS:
339 * SectionHandle Handle of the section
340 * ProcessHandle Handle of the process
341 * BaseAddress Desired base address (or NULL) on entry
342 * Actual base address of the view on exit
343 * ZeroBits Number of high order address bits that must be zero
344 * CommitSize Size in bytes of the initially committed section of the view
345 * SectionOffset Offset in bytes from the beginning of the section to the beginning of the view
346 * ViewSize Desired length of map (or zero to map all) on entry
347 Actual length mapped on exit
348 * InheritDisposition Specified how the view is to be shared with
349 * child processes
350 * AllocateType Type of allocation for the pages
351 * Protect Protection for the committed region of the view
353 NTSTATUS WINAPI NtMapViewOfSection(
354 HANDLE SectionHandle,
355 HANDLE ProcessHandle,
356 PVOID* BaseAddress,
357 ULONG ZeroBits,
358 ULONG CommitSize,
359 PLARGE_INTEGER SectionOffset,
360 PULONG ViewSize,
361 SECTION_INHERIT InheritDisposition,
362 ULONG AllocationType,
363 ULONG Protect)
365 FIXME(ntdll,"(0x%08x,0x%08x,%p,0x%08lx,0x%08lx,%p,%p,0x%08x,0x%08lx,0x%08lx) stub\n",
366 SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,SectionOffset,
367 ViewSize,InheritDisposition,AllocationType,Protect);
368 return 0;
372 * ports
375 /******************************************************************************
376 * NtCreatePort [NTDLL]
378 NTSTATUS WINAPI NtCreatePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
380 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5);
381 return 0;
384 /******************************************************************************
385 * NtConnectPort [NTDLL]
387 NTSTATUS WINAPI NtConnectPort(DWORD x1,PUNICODE_STRING uni,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
389 FIXME(ntdll,"(0x%08lx,%s,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
390 x1,debugstr_w(uni->Buffer),x3,x4,x5,x6,x7,x8);
391 return 0;
394 /******************************************************************************
395 * NtListenPort [NTDLL]
397 NTSTATUS WINAPI NtListenPort(DWORD x1,DWORD x2)
399 FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
400 return 0;
403 /******************************************************************************
404 * NtAcceptConnectPort [NTDLL]
406 NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6)
408 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
409 return 0;
412 /******************************************************************************
413 * NtCompleteConnectPort [NTDLL]
415 NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1)
417 FIXME(ntdll,"(0x%08lx),stub!\n",x1);
418 return 0;
421 /******************************************************************************
422 * NtRegisterThreadTerminatePort [NTDLL]
424 NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1)
426 FIXME(ntdll,"(0x%08lx),stub!\n",x1);
427 return 0;
430 /******************************************************************************
431 * NtRequestWaitReplyPort [NTDLL]
433 NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1,DWORD x2,DWORD x3)
435 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
436 return 0;
439 /******************************************************************************
440 * NtReplyWaitReceivePort [NTDLL]
442 NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4)
444 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
445 return 0;
449 * Misc
452 /******************************************************************************
453 * NtSetIntervalProfile [NTDLL]
455 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
456 FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
457 return 0;
460 /******************************************************************************
461 * NtQueryPerformanceCounter [NTDLL]
463 NTSTATUS WINAPI NtQueryPerformanceCounter(
464 IN PLARGE_INTEGER Counter,
465 IN PLARGE_INTEGER Frequency)
467 FIXME(ntdll,"(%p, 0%p) stub\n",
468 Counter, Frequency);
469 return 0;
472 /******************************************************************************
473 * NtCreateMailSlotFile [NTDLL]
475 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
477 FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6,x7,x8);
478 return 0;
481 /******************************************************************************
482 * NtQuerySystemInformation [NTDLL.168]
484 * ARGUMENTS:
485 * SystemInformationClass Index to a certain information structure
486 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
487 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
488 * SystemConfigurationInformation CONFIGURATION_INFORMATION
489 * observed (class/len):
490 * 0x0/0x2c
491 * 0x12/0x18
492 * 0x2/0x138
493 * 0x8/0x600
494 * SystemInformation caller supplies storage for the information structure
495 * Length size of the structure
496 * ResultLength Data written
498 NTSTATUS WINAPI NtQuerySystemInformation(
499 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
500 OUT PVOID SystemInformation,
501 IN ULONG Length,
502 OUT PULONG ResultLength)
504 FIXME(ntdll,"(0x%08x,%p,0x%08lx,%p) stub\n",
505 SystemInformationClass,SystemInformation,Length,ResultLength);
506 ZeroMemory (SystemInformation, Length);
507 return 0;
511 /******************************************************************************
512 * NtCreatePagingFile [NTDLL]
514 NTSTATUS WINAPI NtCreatePagingFile(
515 IN PUNICODE_STRING PageFileName,
516 IN ULONG MiniumSize,
517 IN ULONG MaxiumSize,
518 OUT PULONG ActualSize)
520 FIXME(ntdll,"(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
521 PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
522 return 0;
525 /******************************************************************************
526 * NtDisplayString [NTDLL.95]
528 * writes a string to the nt-textmode screen eg. during startup
530 NTSTATUS WINAPI NtDisplayString (
531 PUNICODE_STRING string)
533 TRACE(ntdll,"%p(%s)\n",string->Buffer, debugstr_w(string->Buffer));
534 WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string->Buffer, string->Length, 0, 0);
535 return 0;