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 NTOSKRNL)
|
---|
6 | *
|
---|
7 | * Copyright 1996-1998 Marcus Meissner
|
---|
8 | *
|
---|
9 | * This library is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU Lesser General Public
|
---|
11 | * License as published by the Free Software Foundation; either
|
---|
12 | * version 2.1 of the License, or (at your option) any later version.
|
---|
13 | *
|
---|
14 | * This library is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
17 | * Lesser General Public License for more details.
|
---|
18 | *
|
---|
19 | * You should have received a copy of the GNU Lesser General Public
|
---|
20 | * License along with this library; if not, write to the Free Software
|
---|
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
22 | */
|
---|
23 |
|
---|
24 | #include <stdio.h>
|
---|
25 | #include <stdlib.h>
|
---|
26 | #include <string.h>
|
---|
27 | #include <time.h>
|
---|
28 | #include "wine/debug.h"
|
---|
29 |
|
---|
30 | #include "ntddk.h"
|
---|
31 | #include "ntdll_misc.h"
|
---|
32 | #include "wine/server.h"
|
---|
33 |
|
---|
34 | WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
---|
35 |
|
---|
36 | /*
|
---|
37 | * Timer object
|
---|
38 | */
|
---|
39 |
|
---|
40 | /**************************************************************************
|
---|
41 | * NtCreateTimer [NTDLL.@]
|
---|
42 | * ZwCreateTimer [NTDLL.@]
|
---|
43 | */
|
---|
44 | NTSTATUS WINAPI NtCreateTimer(
|
---|
45 | OUT PHANDLE TimerHandle,
|
---|
46 | IN ACCESS_MASK DesiredAccess,
|
---|
47 | IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
---|
48 | IN TIMER_TYPE TimerType)
|
---|
49 | {
|
---|
50 | FIXME("(%p,0x%08lx,%p,0x%08x) stub\n",
|
---|
51 | TimerHandle,DesiredAccess,ObjectAttributes, TimerType);
|
---|
52 | dump_ObjectAttributes(ObjectAttributes);
|
---|
53 | return 0;
|
---|
54 | }
|
---|
55 | /**************************************************************************
|
---|
56 | * NtSetTimer [NTDLL.@]
|
---|
57 | * ZwSetTimer [NTDLL.@]
|
---|
58 | */
|
---|
59 | NTSTATUS WINAPI NtSetTimer(
|
---|
60 | IN HANDLE TimerHandle,
|
---|
61 | IN PLARGE_INTEGER DueTime,
|
---|
62 | IN PTIMERAPCROUTINE TimerApcRoutine,
|
---|
63 | IN PVOID TimerContext,
|
---|
64 | IN BOOLEAN WakeTimer,
|
---|
65 | IN ULONG Period OPTIONAL,
|
---|
66 | OUT PBOOLEAN PreviousState OPTIONAL)
|
---|
67 | {
|
---|
68 | FIXME("(0x%08x,%p,%p,%p,%08x,0x%08lx,%p) stub\n",
|
---|
69 | TimerHandle,DueTime,TimerApcRoutine,TimerContext,WakeTimer,Period,PreviousState);
|
---|
70 | return 0;
|
---|
71 | }
|
---|
72 |
|
---|
73 | /******************************************************************************
|
---|
74 | * NtQueryTimerResolution [NTDLL.@]
|
---|
75 | */
|
---|
76 | NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3)
|
---|
77 | {
|
---|
78 | FIXME("(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
|
---|
79 | return 1;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * Process object
|
---|
84 | */
|
---|
85 |
|
---|
86 | /******************************************************************************
|
---|
87 | * NtTerminateProcess [NTDLL.@]
|
---|
88 | *
|
---|
89 | * Native applications must kill themselves when done
|
---|
90 | */
|
---|
91 | NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
|
---|
92 | {
|
---|
93 | #ifdef __WIN32OS2__
|
---|
94 | /* win32 (0x7fffffff) to nt (-1) */
|
---|
95 | if ( NtCurrentProcess() == handle )
|
---|
96 | handle = GetCurrentProcess();
|
---|
97 |
|
---|
98 | /* @@@PH return code looks suspicious ! */
|
---|
99 | return (! TerminateProcess( handle, exit_code ));
|
---|
100 | #else
|
---|
101 | NTSTATUS ret;
|
---|
102 | BOOL self;
|
---|
103 | SERVER_START_REQ( terminate_process )
|
---|
104 | {
|
---|
105 | req->handle = handle;
|
---|
106 | req->exit_code = exit_code;
|
---|
107 | ret = wine_server_call( req );
|
---|
108 | self = !ret && reply->self;
|
---|
109 | }
|
---|
110 | SERVER_END_REQ;
|
---|
111 | if (self) exit( exit_code );
|
---|
112 | return ret;
|
---|
113 | #endif
|
---|
114 | }
|
---|
115 |
|
---|
116 | /******************************************************************************
|
---|
117 | * NtQueryInformationProcess [NTDLL.@]
|
---|
118 | * ZwQueryInformationProcess [NTDLL.@]
|
---|
119 | *
|
---|
120 | */
|
---|
121 | NTSTATUS WINAPI NtQueryInformationProcess(
|
---|
122 | IN HANDLE ProcessHandle,
|
---|
123 | IN PROCESSINFOCLASS ProcessInformationClass,
|
---|
124 | OUT PVOID ProcessInformation,
|
---|
125 | IN ULONG ProcessInformationLength,
|
---|
126 | OUT PULONG ReturnLength)
|
---|
127 | {
|
---|
128 | NTSTATUS ret = STATUS_SUCCESS;
|
---|
129 | ULONG len = 0;
|
---|
130 |
|
---|
131 | switch (ProcessInformationClass) {
|
---|
132 | case ProcessDebugPort:
|
---|
133 | /* "These are not the debuggers you are looking for." */
|
---|
134 | /* set it to 0 aka "no debugger" to satisfy copy protections */
|
---|
135 | if (ProcessInformationLength == 4)
|
---|
136 | {
|
---|
137 | memset(ProcessInformation,0,ProcessInformationLength);
|
---|
138 | len = 4;
|
---|
139 | }
|
---|
140 | else
|
---|
141 | ret = STATUS_INFO_LENGTH_MISMATCH;
|
---|
142 | break;
|
---|
143 | default:
|
---|
144 | FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
|
---|
145 | ProcessHandle,ProcessInformationClass,
|
---|
146 | ProcessInformation,ProcessInformationLength,
|
---|
147 | ReturnLength
|
---|
148 | );
|
---|
149 | break;
|
---|
150 | }
|
---|
151 |
|
---|
152 | if (ReturnLength)
|
---|
153 | *ReturnLength = len;
|
---|
154 |
|
---|
155 | return ret;
|
---|
156 | }
|
---|
157 |
|
---|
158 | /******************************************************************************
|
---|
159 | * NtSetInformationProcess [NTDLL.@]
|
---|
160 | * ZwSetInformationProcess [NTDLL.@]
|
---|
161 | */
|
---|
162 | NTSTATUS WINAPI NtSetInformationProcess(
|
---|
163 | IN HANDLE ProcessHandle,
|
---|
164 | IN PROCESSINFOCLASS ProcessInformationClass,
|
---|
165 | IN PVOID ProcessInformation,
|
---|
166 | IN ULONG ProcessInformationLength)
|
---|
167 | {
|
---|
168 | FIXME("(0x%08x,0x%08x,%p,0x%08lx) stub\n",
|
---|
169 | ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
|
---|
170 | return 0;
|
---|
171 | }
|
---|
172 |
|
---|
173 | /*
|
---|
174 | * Thread
|
---|
175 | */
|
---|
176 |
|
---|
177 | /******************************************************************************
|
---|
178 | * NtResumeThread [NTDLL.@]
|
---|
179 | * ZwResumeThread [NTDLL.@]
|
---|
180 | */
|
---|
181 | NTSTATUS WINAPI NtResumeThread(
|
---|
182 | IN HANDLE ThreadHandle,
|
---|
183 | IN PULONG SuspendCount)
|
---|
184 | {
|
---|
185 | FIXME("(0x%08x,%p),stub!\n",
|
---|
186 | ThreadHandle,SuspendCount);
|
---|
187 | return 0;
|
---|
188 | }
|
---|
189 |
|
---|
190 |
|
---|
191 | /******************************************************************************
|
---|
192 | * NtTerminateThread [NTDLL.@]
|
---|
193 | * ZwTerminateThread [NTDLL.@]
|
---|
194 | */
|
---|
195 | NTSTATUS WINAPI NtTerminateThread( HANDLE handle, LONG exit_code )
|
---|
196 | {
|
---|
197 | #ifdef __WIN32OS2__
|
---|
198 | if ( TerminateThread(handle, exit_code) )
|
---|
199 | return 0;
|
---|
200 |
|
---|
201 | return 0xc0000000; /* FIXME: lasterror->ntstatus */
|
---|
202 | #else
|
---|
203 | NTSTATUS ret;
|
---|
204 | BOOL self, last;
|
---|
205 |
|
---|
206 | SERVER_START_REQ( terminate_thread )
|
---|
207 | {
|
---|
208 | req->handle = handle;
|
---|
209 | req->exit_code = exit_code;
|
---|
210 | ret = wine_server_call( req );
|
---|
211 | self = !ret && reply->self;
|
---|
212 | last = reply->last;
|
---|
213 | }
|
---|
214 | SERVER_END_REQ;
|
---|
215 |
|
---|
216 | if (self)
|
---|
217 | {
|
---|
218 | if (last) exit( exit_code );
|
---|
219 | else SYSDEPS_ExitThread( exit_code );
|
---|
220 | }
|
---|
221 | return ret;
|
---|
222 | #endif
|
---|
223 | }
|
---|
224 |
|
---|
225 |
|
---|
226 | /******************************************************************************
|
---|
227 | * NtQueryInformationThread [NTDLL.@]
|
---|
228 | * ZwQueryInformationThread [NTDLL.@]
|
---|
229 | *
|
---|
230 | */
|
---|
231 | NTSTATUS WINAPI NtQueryInformationThread(
|
---|
232 | IN HANDLE ThreadHandle,
|
---|
233 | IN THREADINFOCLASS ThreadInformationClass,
|
---|
234 | OUT PVOID ThreadInformation,
|
---|
235 | IN ULONG ThreadInformationLength,
|
---|
236 | OUT PULONG ReturnLength)
|
---|
237 | {
|
---|
238 | FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
|
---|
239 | ThreadHandle, ThreadInformationClass, ThreadInformation,
|
---|
240 | ThreadInformationLength, ReturnLength);
|
---|
241 | return 0;
|
---|
242 | }
|
---|
243 |
|
---|
244 | /******************************************************************************
|
---|
245 | * NtSetInformationThread [NTDLL.@]
|
---|
246 | * ZwSetInformationThread [NTDLL.@]
|
---|
247 | */
|
---|
248 | NTSTATUS WINAPI NtSetInformationThread(
|
---|
249 | HANDLE ThreadHandle,
|
---|
250 | THREADINFOCLASS ThreadInformationClass,
|
---|
251 | PVOID ThreadInformation,
|
---|
252 | ULONG ThreadInformationLength)
|
---|
253 | {
|
---|
254 | FIXME("(0x%08x,0x%08x,%p,0x%08lx),stub!\n",
|
---|
255 | ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength);
|
---|
256 | return 0;
|
---|
257 | }
|
---|
258 |
|
---|
259 | /*
|
---|
260 | * Token
|
---|
261 | */
|
---|
262 |
|
---|
263 | /******************************************************************************
|
---|
264 | * NtDuplicateToken [NTDLL.@]
|
---|
265 | * ZwDuplicateToken [NTDLL.@]
|
---|
266 | */
|
---|
267 | NTSTATUS WINAPI NtDuplicateToken(
|
---|
268 | IN HANDLE ExistingToken,
|
---|
269 | IN ACCESS_MASK DesiredAccess,
|
---|
270 | IN POBJECT_ATTRIBUTES ObjectAttributes,
|
---|
271 | IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
|
---|
272 | IN TOKEN_TYPE TokenType,
|
---|
273 | OUT PHANDLE NewToken)
|
---|
274 | {
|
---|
275 | FIXME("(0x%08x,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
|
---|
276 | ExistingToken, DesiredAccess, ObjectAttributes,
|
---|
277 | ImpersonationLevel, TokenType, NewToken);
|
---|
278 | dump_ObjectAttributes(ObjectAttributes);
|
---|
279 | return 0;
|
---|
280 | }
|
---|
281 |
|
---|
282 | /******************************************************************************
|
---|
283 | * NtOpenProcessToken [NTDLL.@]
|
---|
284 | * ZwOpenProcessToken [NTDLL.@]
|
---|
285 | */
|
---|
286 | NTSTATUS WINAPI NtOpenProcessToken(
|
---|
287 | HANDLE ProcessHandle,
|
---|
288 | DWORD DesiredAccess,
|
---|
289 | HANDLE *TokenHandle)
|
---|
290 | {
|
---|
291 | FIXME("(0x%08x,0x%08lx,%p): stub\n",
|
---|
292 | ProcessHandle,DesiredAccess, TokenHandle);
|
---|
293 | *TokenHandle = 0xcafe;
|
---|
294 | return 0;
|
---|
295 | }
|
---|
296 |
|
---|
297 | /******************************************************************************
|
---|
298 | * NtOpenThreadToken [NTDLL.@]
|
---|
299 | * ZwOpenThreadToken [NTDLL.@]
|
---|
300 | */
|
---|
301 | NTSTATUS WINAPI NtOpenThreadToken(
|
---|
302 | HANDLE ThreadHandle,
|
---|
303 | DWORD DesiredAccess,
|
---|
304 | BOOLEAN OpenAsSelf,
|
---|
305 | HANDLE *TokenHandle)
|
---|
306 | {
|
---|
307 | FIXME("(0x%08x,0x%08lx,0x%08x,%p): stub\n",
|
---|
308 | ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
|
---|
309 | *TokenHandle = 0xcafe;
|
---|
310 | return 0;
|
---|
311 | }
|
---|
312 |
|
---|
313 | /******************************************************************************
|
---|
314 | * NtAdjustPrivilegesToken [NTDLL.@]
|
---|
315 | * ZwAdjustGroupsToken [NTDLL.@]
|
---|
316 | *
|
---|
317 | * FIXME: parameters unsafe
|
---|
318 | */
|
---|
319 | NTSTATUS WINAPI NtAdjustPrivilegesToken(
|
---|
320 | IN HANDLE TokenHandle,
|
---|
321 | IN BOOLEAN DisableAllPrivileges,
|
---|
322 | IN PTOKEN_PRIVILEGES NewState,
|
---|
323 | IN DWORD BufferLength,
|
---|
324 | OUT PTOKEN_PRIVILEGES PreviousState,
|
---|
325 | OUT PDWORD ReturnLength)
|
---|
326 | {
|
---|
327 | FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
|
---|
328 | TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
|
---|
329 | return 0;
|
---|
330 | }
|
---|
331 |
|
---|
332 | /******************************************************************************
|
---|
333 | * NtQueryInformationToken [NTDLL.@]
|
---|
334 | * ZwQueryInformationToken [NTDLL.@]
|
---|
335 | *
|
---|
336 | * NOTES
|
---|
337 | * Buffer for TokenUser:
|
---|
338 | * 0x00 TOKEN_USER the PSID field points to the SID
|
---|
339 | * 0x08 SID
|
---|
340 | *
|
---|
341 | */
|
---|
342 | NTSTATUS WINAPI NtQueryInformationToken(
|
---|
343 | HANDLE token,
|
---|
344 | DWORD tokeninfoclass,
|
---|
345 | LPVOID tokeninfo,
|
---|
346 | DWORD tokeninfolength,
|
---|
347 | LPDWORD retlen )
|
---|
348 | {
|
---|
349 | unsigned int len = 0;
|
---|
350 |
|
---|
351 | FIXME("(%08x,%ld,%p,%ld,%p): stub\n",
|
---|
352 | token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
|
---|
353 |
|
---|
354 | switch (tokeninfoclass)
|
---|
355 | {
|
---|
356 | case TokenUser:
|
---|
357 | len = sizeof(TOKEN_USER) + sizeof(SID);
|
---|
358 | break;
|
---|
359 | case TokenGroups:
|
---|
360 | len = sizeof(TOKEN_GROUPS);
|
---|
361 | break;
|
---|
362 | case TokenPrivileges:
|
---|
363 | len = sizeof(TOKEN_PRIVILEGES);
|
---|
364 | break;
|
---|
365 | case TokenOwner:
|
---|
366 | len = sizeof(TOKEN_OWNER);
|
---|
367 | break;
|
---|
368 | case TokenPrimaryGroup:
|
---|
369 | len = sizeof(TOKEN_PRIMARY_GROUP);
|
---|
370 | break;
|
---|
371 | case TokenDefaultDacl:
|
---|
372 | len = sizeof(TOKEN_DEFAULT_DACL);
|
---|
373 | break;
|
---|
374 | case TokenSource:
|
---|
375 | len = sizeof(TOKEN_SOURCE);
|
---|
376 | break;
|
---|
377 | case TokenType:
|
---|
378 | len = sizeof (TOKEN_TYPE);
|
---|
379 | break;
|
---|
380 | #if 0
|
---|
381 | case TokenImpersonationLevel:
|
---|
382 | case TokenStatistics:
|
---|
383 | #endif /* 0 */
|
---|
384 | }
|
---|
385 |
|
---|
386 | /* FIXME: what if retlen == NULL ? */
|
---|
387 | *retlen = len;
|
---|
388 |
|
---|
389 | if (tokeninfolength < len)
|
---|
390 | return STATUS_BUFFER_TOO_SMALL;
|
---|
391 |
|
---|
392 | switch (tokeninfoclass)
|
---|
393 | {
|
---|
394 | case TokenUser:
|
---|
395 | if( tokeninfo )
|
---|
396 | {
|
---|
397 | TOKEN_USER * tuser = tokeninfo;
|
---|
398 | PSID sid = (PSID) (tuser + 1);
|
---|
399 | SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
|
---|
400 | RtlInitializeSid(sid, &localSidAuthority, 1);
|
---|
401 | *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
|
---|
402 | tuser->User.Sid = sid;
|
---|
403 | }
|
---|
404 | break;
|
---|
405 | case TokenGroups:
|
---|
406 | if (tokeninfo)
|
---|
407 | {
|
---|
408 | TOKEN_GROUPS *tgroups = tokeninfo;
|
---|
409 | SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
|
---|
410 |
|
---|
411 | /* we need to show admin privileges ! */
|
---|
412 | tgroups->GroupCount = 1;
|
---|
413 | RtlAllocateAndInitializeSid( &sid,
|
---|
414 | 2,
|
---|
415 | SECURITY_BUILTIN_DOMAIN_RID,
|
---|
416 | DOMAIN_ALIAS_RID_ADMINS,
|
---|
417 | 0, 0, 0, 0, 0, 0,
|
---|
418 | &(tgroups->Groups->Sid));
|
---|
419 | }
|
---|
420 | break;
|
---|
421 | case TokenPrivileges:
|
---|
422 | if (tokeninfo)
|
---|
423 | {
|
---|
424 | TOKEN_PRIVILEGES *tpriv = tokeninfo;
|
---|
425 | tpriv->PrivilegeCount = 1;
|
---|
426 | }
|
---|
427 | break;
|
---|
428 | }
|
---|
429 | return 0;
|
---|
430 | }
|
---|
431 |
|
---|
432 | /*
|
---|
433 | * Section
|
---|
434 | */
|
---|
435 |
|
---|
436 | /******************************************************************************
|
---|
437 | * NtCreateSection [NTDLL.@]
|
---|
438 | * ZwCreateSection [NTDLL.@]
|
---|
439 | */
|
---|
440 | NTSTATUS WINAPI NtCreateSection(
|
---|
441 | OUT PHANDLE SectionHandle,
|
---|
442 | IN ACCESS_MASK DesiredAccess,
|
---|
443 | IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
---|
444 | IN PLARGE_INTEGER MaximumSize OPTIONAL,
|
---|
445 | IN ULONG SectionPageProtection OPTIONAL,
|
---|
446 | IN ULONG AllocationAttributes,
|
---|
447 | IN HANDLE FileHandle OPTIONAL)
|
---|
448 | {
|
---|
449 | FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx,0x%08x) stub\n",
|
---|
450 | SectionHandle,DesiredAccess, ObjectAttributes,
|
---|
451 | MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle);
|
---|
452 | dump_ObjectAttributes(ObjectAttributes);
|
---|
453 | return 0;
|
---|
454 | }
|
---|
455 |
|
---|
456 | /******************************************************************************
|
---|
457 | * NtOpenSection [NTDLL.@]
|
---|
458 | * ZwOpenSection [NTDLL.@]
|
---|
459 | */
|
---|
460 | NTSTATUS WINAPI NtOpenSection(
|
---|
461 | PHANDLE SectionHandle,
|
---|
462 | ACCESS_MASK DesiredAccess,
|
---|
463 | POBJECT_ATTRIBUTES ObjectAttributes)
|
---|
464 | {
|
---|
465 | FIXME("(%p,0x%08lx,%p),stub!\n",
|
---|
466 | SectionHandle,DesiredAccess,ObjectAttributes);
|
---|
467 | dump_ObjectAttributes(ObjectAttributes);
|
---|
468 | return 0;
|
---|
469 | }
|
---|
470 |
|
---|
471 | /******************************************************************************
|
---|
472 | * NtQuerySection [NTDLL.@]
|
---|
473 | */
|
---|
474 | NTSTATUS WINAPI NtQuerySection(
|
---|
475 | IN HANDLE SectionHandle,
|
---|
476 | IN PVOID SectionInformationClass,
|
---|
477 | OUT PVOID SectionInformation,
|
---|
478 | IN ULONG Length,
|
---|
479 | OUT PULONG ResultLength)
|
---|
480 | {
|
---|
481 | FIXME("(0x%08x,%p,%p,0x%08lx,%p) stub!\n",
|
---|
482 | SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
|
---|
483 | return 0;
|
---|
484 | }
|
---|
485 |
|
---|
486 | /******************************************************************************
|
---|
487 | * NtMapViewOfSection [NTDLL.@]
|
---|
488 | * ZwMapViewOfSection [NTDLL.@]
|
---|
489 | * FUNCTION: Maps a view of a section into the virtual address space of a process
|
---|
490 | *
|
---|
491 | * ARGUMENTS:
|
---|
492 | * SectionHandle Handle of the section
|
---|
493 | * ProcessHandle Handle of the process
|
---|
494 | * BaseAddress Desired base address (or NULL) on entry
|
---|
495 | * Actual base address of the view on exit
|
---|
496 | * ZeroBits Number of high order address bits that must be zero
|
---|
497 | * CommitSize Size in bytes of the initially committed section of the view
|
---|
498 | * SectionOffset Offset in bytes from the beginning of the section to the beginning of the view
|
---|
499 | * ViewSize Desired length of map (or zero to map all) on entry
|
---|
500 | Actual length mapped on exit
|
---|
501 | * InheritDisposition Specified how the view is to be shared with
|
---|
502 | * child processes
|
---|
503 | * AllocateType Type of allocation for the pages
|
---|
504 | * Protect Protection for the committed region of the view
|
---|
505 | */
|
---|
506 | NTSTATUS WINAPI NtMapViewOfSection(
|
---|
507 | HANDLE SectionHandle,
|
---|
508 | HANDLE ProcessHandle,
|
---|
509 | PVOID* BaseAddress,
|
---|
510 | ULONG ZeroBits,
|
---|
511 | ULONG CommitSize,
|
---|
512 | PLARGE_INTEGER SectionOffset,
|
---|
513 | PULONG ViewSize,
|
---|
514 | SECTION_INHERIT InheritDisposition,
|
---|
515 | ULONG AllocationType,
|
---|
516 | ULONG Protect)
|
---|
517 | {
|
---|
518 | FIXME("(0x%08x,0x%08x,%p,0x%08lx,0x%08lx,%p,%p,0x%08x,0x%08lx,0x%08lx) stub\n",
|
---|
519 | SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,SectionOffset,
|
---|
520 | ViewSize,InheritDisposition,AllocationType,Protect);
|
---|
521 | return 0;
|
---|
522 | }
|
---|
523 |
|
---|
524 | /*
|
---|
525 | * ports
|
---|
526 | */
|
---|
527 |
|
---|
528 | /******************************************************************************
|
---|
529 | * NtCreatePort [NTDLL.@]
|
---|
530 | * ZwCreatePort [NTDLL.@]
|
---|
531 | */
|
---|
532 | NTSTATUS WINAPI NtCreatePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
|
---|
533 | {
|
---|
534 | FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5);
|
---|
535 | return 0;
|
---|
536 | }
|
---|
537 |
|
---|
538 | /******************************************************************************
|
---|
539 | * NtConnectPort [NTDLL.@]
|
---|
540 | * ZwConnectPort [NTDLL.@]
|
---|
541 | */
|
---|
542 | NTSTATUS WINAPI NtConnectPort(DWORD x1,PUNICODE_STRING uni,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
|
---|
543 | {
|
---|
544 | FIXME("(0x%08lx,%s,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
|
---|
545 | x1,debugstr_w(uni->Buffer),x3,x4,x5,x6,x7,x8);
|
---|
546 | return 0;
|
---|
547 | }
|
---|
548 |
|
---|
549 | /******************************************************************************
|
---|
550 | * NtListenPort [NTDLL.@]
|
---|
551 | * ZwListenPort [NTDLL.@]
|
---|
552 | */
|
---|
553 | NTSTATUS WINAPI NtListenPort(DWORD x1,DWORD x2)
|
---|
554 | {
|
---|
555 | FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
|
---|
556 | return 0;
|
---|
557 | }
|
---|
558 |
|
---|
559 | /******************************************************************************
|
---|
560 | * NtAcceptConnectPort [NTDLL.@]
|
---|
561 | * ZwAcceptConnectPort [NTDLL.@]
|
---|
562 | */
|
---|
563 | NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6)
|
---|
564 | {
|
---|
565 | FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
|
---|
566 | return 0;
|
---|
567 | }
|
---|
568 |
|
---|
569 | /******************************************************************************
|
---|
570 | * NtCompleteConnectPort [NTDLL.@]
|
---|
571 | * ZwCompleteConnectPort [NTDLL.@]
|
---|
572 | */
|
---|
573 | NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1)
|
---|
574 | {
|
---|
575 | FIXME("(0x%08lx),stub!\n",x1);
|
---|
576 | return 0;
|
---|
577 | }
|
---|
578 |
|
---|
579 | /******************************************************************************
|
---|
580 | * NtRegisterThreadTerminatePort [NTDLL.@]
|
---|
581 | * ZwRegisterThreadTerminatePort [NTDLL.@]
|
---|
582 | */
|
---|
583 | NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1)
|
---|
584 | {
|
---|
585 | FIXME("(0x%08lx),stub!\n",x1);
|
---|
586 | return 0;
|
---|
587 | }
|
---|
588 |
|
---|
589 | /******************************************************************************
|
---|
590 | * NtRequestWaitReplyPort [NTDLL.@]
|
---|
591 | * ZwRequestWaitReplyPort [NTDLL.@]
|
---|
592 | */
|
---|
593 | NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1,DWORD x2,DWORD x3)
|
---|
594 | {
|
---|
595 | FIXME("(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
|
---|
596 | return 0;
|
---|
597 | }
|
---|
598 |
|
---|
599 | /******************************************************************************
|
---|
600 | * NtReplyWaitReceivePort [NTDLL.@]
|
---|
601 | * ZwReplyWaitReceivePort [NTDLL.@]
|
---|
602 | */
|
---|
603 | NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4)
|
---|
604 | {
|
---|
605 | FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
|
---|
606 | return 0;
|
---|
607 | }
|
---|
608 |
|
---|
609 | /*
|
---|
610 | * Misc
|
---|
611 | */
|
---|
612 |
|
---|
613 | /******************************************************************************
|
---|
614 | * NtSetIntervalProfile [NTDLL.@]
|
---|
615 | * ZwSetIntervalProfile [NTDLL.@]
|
---|
616 | */
|
---|
617 | NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
|
---|
618 | FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
|
---|
619 | return 0;
|
---|
620 | }
|
---|
621 |
|
---|
622 | /******************************************************************************
|
---|
623 | * NtQueryPerformanceCounter [NTDLL.@]
|
---|
624 | */
|
---|
625 | NTSTATUS WINAPI NtQueryPerformanceCounter(
|
---|
626 | IN PLARGE_INTEGER Counter,
|
---|
627 | IN PLARGE_INTEGER Frequency)
|
---|
628 | {
|
---|
629 | FIXME("(%p, 0%p) stub\n",
|
---|
630 | Counter, Frequency);
|
---|
631 | return 0;
|
---|
632 | }
|
---|
633 |
|
---|
634 | /******************************************************************************
|
---|
635 | * NtCreateMailslotFile [NTDLL.@]
|
---|
636 | * ZwCreateMailslotFile [NTDLL.@]
|
---|
637 | */
|
---|
638 | NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
|
---|
639 | {
|
---|
640 | FIXME("(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);
|
---|
641 | return 0;
|
---|
642 | }
|
---|
643 |
|
---|
644 | /******************************************************************************
|
---|
645 | * NtQuerySystemInformation [NTDLL.@]
|
---|
646 | * ZwQuerySystemInformation [NTDLL.@]
|
---|
647 | *
|
---|
648 | * ARGUMENTS:
|
---|
649 | * SystemInformationClass Index to a certain information structure
|
---|
650 | * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
|
---|
651 | * SystemCacheInformation SYSTEM_CACHE_INFORMATION
|
---|
652 | * SystemConfigurationInformation CONFIGURATION_INFORMATION
|
---|
653 | * observed (class/len):
|
---|
654 | * 0x0/0x2c
|
---|
655 | * 0x12/0x18
|
---|
656 | * 0x2/0x138
|
---|
657 | * 0x8/0x600
|
---|
658 | * 0x25/0xc
|
---|
659 | * SystemInformation caller supplies storage for the information structure
|
---|
660 | * Length size of the structure
|
---|
661 | * ResultLength Data written
|
---|
662 | */
|
---|
663 | NTSTATUS WINAPI NtQuerySystemInformation(
|
---|
664 | IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
---|
665 | OUT PVOID SystemInformation,
|
---|
666 | IN ULONG Length,
|
---|
667 | OUT PULONG ResultLength)
|
---|
668 | {
|
---|
669 | switch(SystemInformationClass)
|
---|
670 | {
|
---|
671 | case 0x25:
|
---|
672 | /* Something to do with the size of the registry *
|
---|
673 | * Since we don't have a size limitation, fake it *
|
---|
674 | * This is almost certainly wrong. *
|
---|
675 | * This sets each of the three words in the struct to 32 MB, *
|
---|
676 | * which is enough to make the IE 5 installer happy. */
|
---|
677 | FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
|
---|
678 | SystemInformationClass,SystemInformation,Length,ResultLength);
|
---|
679 | *(DWORD *)SystemInformation = 0x2000000;
|
---|
680 | *(((DWORD *)SystemInformation)+1) = 0x200000;
|
---|
681 | *(((DWORD *)SystemInformation)+2) = 0x200000;
|
---|
682 | break;
|
---|
683 |
|
---|
684 | default:
|
---|
685 | FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
|
---|
686 | SystemInformationClass,SystemInformation,Length,ResultLength);
|
---|
687 | ZeroMemory (SystemInformation, Length);
|
---|
688 | }
|
---|
689 |
|
---|
690 | return STATUS_SUCCESS;
|
---|
691 | }
|
---|
692 |
|
---|
693 |
|
---|
694 | /******************************************************************************
|
---|
695 | * NtCreatePagingFile [NTDLL.@]
|
---|
696 | * ZwCreatePagingFile [NTDLL.@]
|
---|
697 | */
|
---|
698 | NTSTATUS WINAPI NtCreatePagingFile(
|
---|
699 | IN PUNICODE_STRING PageFileName,
|
---|
700 | IN ULONG MiniumSize,
|
---|
701 | IN ULONG MaxiumSize,
|
---|
702 | OUT PULONG ActualSize)
|
---|
703 | {
|
---|
704 | FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
|
---|
705 | PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
|
---|
706 | return 0;
|
---|
707 | }
|
---|
708 |
|
---|
709 | /******************************************************************************
|
---|
710 | * NtDisplayString [NTDLL.@]
|
---|
711 | *
|
---|
712 | * writes a string to the nt-textmode screen eg. during startup
|
---|
713 | */
|
---|
714 | NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
|
---|
715 | {
|
---|
716 | STRING stringA;
|
---|
717 | NTSTATUS ret;
|
---|
718 |
|
---|
719 | if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
|
---|
720 | {
|
---|
721 | MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
|
---|
722 | RtlFreeAnsiString( &stringA );
|
---|
723 | }
|
---|
724 | return ret;
|
---|
725 | }
|
---|
726 |
|
---|
727 | /******************************************************************************
|
---|
728 | * NtPowerInformation [NTDLL.@]
|
---|
729 | *
|
---|
730 | */
|
---|
731 | NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
|
---|
732 | {
|
---|
733 | FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
|
---|
734 | return 0;
|
---|
735 | }
|
---|
736 |
|
---|
737 | /******************************************************************************
|
---|
738 | * NtAllocateLocallyUniqueId (NTDLL.@)
|
---|
739 | *
|
---|
740 | * FIXME: the server should do that
|
---|
741 | */
|
---|
742 | NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
|
---|
743 | {
|
---|
744 | static LUID luid;
|
---|
745 |
|
---|
746 | FIXME("%p (0x%08lx%08lx)\n", Luid, luid.HighPart, luid.LowPart);
|
---|
747 |
|
---|
748 | luid.LowPart++;
|
---|
749 | if (luid.LowPart==0)
|
---|
750 | luid.HighPart++;
|
---|
751 | Luid->HighPart = luid.HighPart;
|
---|
752 | Luid->LowPart = luid.LowPart;
|
---|
753 |
|
---|
754 | return STATUS_SUCCESS;
|
---|
755 | }
|
---|
756 |
|
---|
757 | /******************************************************************************
|
---|
758 | * VerSetConditionMask (NTDLL.@)
|
---|
759 | */
|
---|
760 | ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
|
---|
761 | BYTE dwConditionMask)
|
---|
762 | {
|
---|
763 | if(dwTypeBitMask == 0)
|
---|
764 | return dwlConditionMask;
|
---|
765 | dwConditionMask &= 0x07;
|
---|
766 | if(dwConditionMask == 0)
|
---|
767 | return dwlConditionMask;
|
---|
768 |
|
---|
769 | if(dwTypeBitMask & VER_PRODUCT_TYPE)
|
---|
770 | dwlConditionMask |= dwConditionMask << 7*3;
|
---|
771 | else if (dwTypeBitMask & VER_SUITENAME)
|
---|
772 | dwlConditionMask |= dwConditionMask << 6*3;
|
---|
773 | else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
---|
774 | dwlConditionMask |= dwConditionMask << 5*3;
|
---|
775 | else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
---|
776 | dwlConditionMask |= dwConditionMask << 4*3;
|
---|
777 | else if (dwTypeBitMask & VER_PLATFORMID)
|
---|
778 | dwlConditionMask |= dwConditionMask << 3*3;
|
---|
779 | else if (dwTypeBitMask & VER_BUILDNUMBER)
|
---|
780 | dwlConditionMask |= dwConditionMask << 2*3;
|
---|
781 | else if (dwTypeBitMask & VER_MAJORVERSION)
|
---|
782 | dwlConditionMask |= dwConditionMask << 1*3;
|
---|
783 | else if (dwTypeBitMask & VER_MINORVERSION)
|
---|
784 | dwlConditionMask |= dwConditionMask << 0*3;
|
---|
785 | return dwlConditionMask;
|
---|
786 | }
|
---|