| 1 | /* $Id: nt.cpp,v 1.8 2000-07-07 19:06:18 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 | /* | 
|---|
| 5 | * NT basis DLL | 
|---|
| 6 | * | 
|---|
| 7 | * This file contains the Nt* API functions of NTDLL.DLL. | 
|---|
| 8 | * In the original ntdll.dll they all seem to just call int 0x2e (down to the HAL) | 
|---|
| 9 | * | 
|---|
| 10 | * Copyright 1996-1998 Marcus Meissner | 
|---|
| 11 | * Copyright 1999      Patrick Haller | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | #include <stdlib.h> | 
|---|
| 15 | #include <string.h> | 
|---|
| 16 | #include <time.h> | 
|---|
| 17 | #include <os2win.h> | 
|---|
| 18 | #include <handlemanager.h> | 
|---|
| 19 |  | 
|---|
| 20 | #include "ntdll.h" | 
|---|
| 21 | #include <ntdllsec.h> | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | /* move to winbase.h */ | 
|---|
| 25 |  | 
|---|
| 26 | // @@@PH can't compile this WINE code | 
|---|
| 27 | //typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue); | 
|---|
| 28 | typedef PVOID PTIMERAPCROUTINE; | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | /* | 
|---|
| 32 | * Timer object | 
|---|
| 33 | */ | 
|---|
| 34 |  | 
|---|
| 35 | /************************************************************************** | 
|---|
| 36 | *    NtCreateTimer                               [NTDLL.87] | 
|---|
| 37 | */ | 
|---|
| 38 | NTSTATUS WINAPI NtCreateTimer(PHANDLE            TimerHandle, | 
|---|
| 39 | ACCESS_MASK        DesiredAccess, | 
|---|
| 40 | POBJECT_ATTRIBUTES ObjectAttributes, | 
|---|
| 41 | TIMER_TYPE         TimerType) | 
|---|
| 42 | { | 
|---|
| 43 | dprintf(("NTDLL: NtCreateTimer(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 44 | TimerHandle, | 
|---|
| 45 | DesiredAccess, | 
|---|
| 46 | ObjectAttributes, | 
|---|
| 47 | TimerType)); | 
|---|
| 48 |  | 
|---|
| 49 | return 0; | 
|---|
| 50 | } | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | /************************************************************************** | 
|---|
| 54 | *    NtSetTimer                               [NTDLL.221] | 
|---|
| 55 | */ | 
|---|
| 56 | NTSTATUS WINAPI NtSetTimer(HANDLE           TimerHandle, | 
|---|
| 57 | PLARGE_INTEGER   DueTime, | 
|---|
| 58 | PTIMERAPCROUTINE TimerApcRoutine, | 
|---|
| 59 | PVOID            TimerContext, | 
|---|
| 60 | BOOLEAN          WakeTimer, | 
|---|
| 61 | ULONG            Period, | 
|---|
| 62 | PBOOLEAN         PreviousState) | 
|---|
| 63 | { | 
|---|
| 64 | dprintf(("NTDLL: NtSetTimer(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 65 | TimerHandle, | 
|---|
| 66 | DueTime, | 
|---|
| 67 | TimerApcRoutine, | 
|---|
| 68 | TimerContext, | 
|---|
| 69 | WakeTimer, | 
|---|
| 70 | Period, | 
|---|
| 71 | PreviousState)); | 
|---|
| 72 |  | 
|---|
| 73 | return 0; | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 |  | 
|---|
| 77 | /****************************************************************************** | 
|---|
| 78 | * NtQueryTimerResolution [NTDLL.129] | 
|---|
| 79 | */ | 
|---|
| 80 | NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1, | 
|---|
| 81 | DWORD x2, | 
|---|
| 82 | DWORD x3) | 
|---|
| 83 | { | 
|---|
| 84 | dprintf(("NTDLL: NtQueryTimerResolution(%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 85 | x1, | 
|---|
| 86 | x2, | 
|---|
| 87 | x3)); | 
|---|
| 88 |  | 
|---|
| 89 | return 1; | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | /* | 
|---|
| 94 | * Process object | 
|---|
| 95 | */ | 
|---|
| 96 |  | 
|---|
| 97 | /****************************************************************************** | 
|---|
| 98 | *  NtTerminateProcess                         [NTDLL.] | 
|---|
| 99 | * | 
|---|
| 100 | *  Native applications must kill themselves when done | 
|---|
| 101 | * FIXME: return value 0-success | 
|---|
| 102 | */ | 
|---|
| 103 | NTSTATUS WINAPI NtTerminateProcess(HANDLE ProcessHandle, | 
|---|
| 104 | LONG   ExitStatus) | 
|---|
| 105 | { | 
|---|
| 106 | dprintf(("NTDLL: NtTerminateProcess(%08xh,%08xh)", | 
|---|
| 107 | ProcessHandle, | 
|---|
| 108 | ExitStatus)); | 
|---|
| 109 |  | 
|---|
| 110 | /* win32 (0x7fffffff) to nt (-1) */ | 
|---|
| 111 | if ( NtCurrentProcess() == ProcessHandle ) | 
|---|
| 112 | ProcessHandle = GetCurrentProcess(); | 
|---|
| 113 |  | 
|---|
| 114 | /* @@@PH return code looks suspicious ! */ | 
|---|
| 115 | return (! TerminateProcess( ProcessHandle, ExitStatus )); | 
|---|
| 116 | } | 
|---|
| 117 |  | 
|---|
| 118 |  | 
|---|
| 119 | /****************************************************************************** | 
|---|
| 120 | *  NtQueryInformationProcess                [NTDLL.] | 
|---|
| 121 | * | 
|---|
| 122 | */ | 
|---|
| 123 | NTSTATUS WINAPI NtQueryInformationProcess(HANDLE           ProcessHandle, | 
|---|
| 124 | PROCESSINFOCLASS ProcessInformationClass, | 
|---|
| 125 | PVOID            ProcessInformation, | 
|---|
| 126 | ULONG            ProcessInformationLength, | 
|---|
| 127 | PULONG           ReturnLength) | 
|---|
| 128 | { | 
|---|
| 129 | dprintf(("NTDLL: NtQueryInformationProcess(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 130 | ProcessHandle, | 
|---|
| 131 | ProcessInformationClass, | 
|---|
| 132 | ProcessInformation, | 
|---|
| 133 | ProcessInformationLength, | 
|---|
| 134 | ReturnLength)); | 
|---|
| 135 |  | 
|---|
| 136 | // fake application, no debugger is running :) | 
|---|
| 137 | if(ProcessInformationClass == ProcessDebugPort) | 
|---|
| 138 | { | 
|---|
| 139 | memset(ProcessInformation, 0, ProcessInformationLength); | 
|---|
| 140 | return TRUE; | 
|---|
| 141 | } | 
|---|
| 142 |  | 
|---|
| 143 | return 0; | 
|---|
| 144 | } | 
|---|
| 145 |  | 
|---|
| 146 | /****************************************************************************** | 
|---|
| 147 | * NtSetInformationProcess [NTDLL.207] | 
|---|
| 148 | */ | 
|---|
| 149 | NTSTATUS WINAPI NtSetInformationProcess(HANDLE           ProcessHandle, | 
|---|
| 150 | PROCESSINFOCLASS ProcessInformationClass, | 
|---|
| 151 | PVOID            ProcessInformation, | 
|---|
| 152 | ULONG            ProcessInformationLength) | 
|---|
| 153 | { | 
|---|
| 154 | dprintf(("NTDLL: NtSetInformationProcess(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 155 | ProcessHandle, | 
|---|
| 156 | ProcessInformationClass, | 
|---|
| 157 | ProcessInformation, | 
|---|
| 158 | ProcessInformationLength)); | 
|---|
| 159 |  | 
|---|
| 160 | return 0; | 
|---|
| 161 | } | 
|---|
| 162 |  | 
|---|
| 163 |  | 
|---|
| 164 | /* | 
|---|
| 165 | * Thread | 
|---|
| 166 | */ | 
|---|
| 167 |  | 
|---|
| 168 | /****************************************************************************** | 
|---|
| 169 | *  NtResumeThread                       [NTDLL] | 
|---|
| 170 | */ | 
|---|
| 171 | NTSTATUS WINAPI NtResumeThread(HANDLE ThreadHandle, | 
|---|
| 172 | PULONG SuspendCount) | 
|---|
| 173 | { | 
|---|
| 174 | dprintf(("NTDLL: NtResumeThread(%08xh,%08x) not implemented.\n", | 
|---|
| 175 | ThreadHandle, | 
|---|
| 176 | SuspendCount)); | 
|---|
| 177 |  | 
|---|
| 178 | return 0; | 
|---|
| 179 | } | 
|---|
| 180 |  | 
|---|
| 181 |  | 
|---|
| 182 | /****************************************************************************** | 
|---|
| 183 | *  NtTerminateThread                    [NTDLL] | 
|---|
| 184 | */ | 
|---|
| 185 | NTSTATUS WINAPI NtTerminateThread(HANDLE ThreadHandle, | 
|---|
| 186 | NTSTATUS ExitStatus) | 
|---|
| 187 | { | 
|---|
| 188 | dprintf(("NTDLL: NtTerminateThread(%08xh,%08xh) not correctly implemented.\n", | 
|---|
| 189 | ThreadHandle, | 
|---|
| 190 | ExitStatus)); | 
|---|
| 191 |  | 
|---|
| 192 | if ( TerminateThread(ThreadHandle,ExitStatus) ) | 
|---|
| 193 | return 0; | 
|---|
| 194 |  | 
|---|
| 195 | return 0xc0000000; /* FIXME: lasterror->ntstatus */ | 
|---|
| 196 | } | 
|---|
| 197 |  | 
|---|
| 198 |  | 
|---|
| 199 | /****************************************************************************** | 
|---|
| 200 | *  NtQueryInformationThread                 [NTDLL.] | 
|---|
| 201 | * | 
|---|
| 202 | */ | 
|---|
| 203 | NTSTATUS WINAPI NtQueryInformationThread(HANDLE          ThreadHandle, | 
|---|
| 204 | THREADINFOCLASS ThreadInformationClass, | 
|---|
| 205 | PVOID           ThreadInformation, | 
|---|
| 206 | ULONG           ThreadInformationLength, | 
|---|
| 207 | PULONG          ReturnLength) | 
|---|
| 208 | { | 
|---|
| 209 | dprintf(("NTDLL: NtQueryInformationThread(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 210 | ThreadHandle, | 
|---|
| 211 | ThreadInformationClass, | 
|---|
| 212 | ThreadInformation, | 
|---|
| 213 | ThreadInformationLength, | 
|---|
| 214 | ReturnLength)); | 
|---|
| 215 |  | 
|---|
| 216 | return 0; | 
|---|
| 217 | } | 
|---|
| 218 |  | 
|---|
| 219 |  | 
|---|
| 220 | /****************************************************************************** | 
|---|
| 221 | *  NtSetInformationThread                  [NTDLL] | 
|---|
| 222 | */ | 
|---|
| 223 | NTSTATUS WINAPI NtSetInformationThread(HANDLE          ThreadHandle, | 
|---|
| 224 | THREADINFOCLASS ThreadInformationClass, | 
|---|
| 225 | PVOID           ThreadInformation, | 
|---|
| 226 | ULONG           ThreadInformationLength) | 
|---|
| 227 | { | 
|---|
| 228 | dprintf(("NTDLL: NtSetInformationThread(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 229 | ThreadHandle, | 
|---|
| 230 | ThreadInformationClass, | 
|---|
| 231 | ThreadInformation, | 
|---|
| 232 | ThreadInformationLength)); | 
|---|
| 233 |  | 
|---|
| 234 | return 0; | 
|---|
| 235 | } | 
|---|
| 236 |  | 
|---|
| 237 |  | 
|---|
| 238 | /* | 
|---|
| 239 | * Token | 
|---|
| 240 | */ | 
|---|
| 241 |  | 
|---|
| 242 | /****************************************************************************** | 
|---|
| 243 | *  NtDuplicateToken                        [NTDLL] | 
|---|
| 244 | */ | 
|---|
| 245 | NTSTATUS WINAPI NtDuplicateToken(HANDLE                       ExistingToken, | 
|---|
| 246 | ACCESS_MASK                  DesiredAccess, | 
|---|
| 247 | POBJECT_ATTRIBUTES           ObjectAttributes, | 
|---|
| 248 | SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, | 
|---|
| 249 | TOKEN_TYPE                   TokenType, | 
|---|
| 250 | PHANDLE                      NewToken) | 
|---|
| 251 | { | 
|---|
| 252 | dprintf(("NTDLL: NtDuplicateToken(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 253 | ExistingToken, | 
|---|
| 254 | DesiredAccess, | 
|---|
| 255 | ObjectAttributes, | 
|---|
| 256 | ImpersonationLevel, | 
|---|
| 257 | TokenType, | 
|---|
| 258 | NewToken)); | 
|---|
| 259 |  | 
|---|
| 260 | return 0; | 
|---|
| 261 | } | 
|---|
| 262 |  | 
|---|
| 263 | /****************************************************************************** | 
|---|
| 264 | *  NtOpenProcessToken                      [NTDLL] | 
|---|
| 265 | */ | 
|---|
| 266 | NTSTATUS WINAPI NtOpenProcessToken(HANDLE  ProcessHandle, | 
|---|
| 267 | DWORD   DesiredAccess, | 
|---|
| 268 | PHANDLE TokenHandle) | 
|---|
| 269 | { | 
|---|
| 270 | dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not correctly implemented.\n", | 
|---|
| 271 | ProcessHandle, | 
|---|
| 272 | DesiredAccess, | 
|---|
| 273 | TokenHandle)); | 
|---|
| 274 |  | 
|---|
| 275 | if(ProcessHandle == GetCurrentProcess()) { | 
|---|
| 276 | HMOpenProcessToken(ProcessHandle, DesiredAccess, (ULONG)&ProcSecInfo, TokenHandle); | 
|---|
| 277 | return STATUS_SUCCESS; | 
|---|
| 278 | } | 
|---|
| 279 | *TokenHandle = 0; | 
|---|
| 280 | return ERROR_INVALID_HANDLE; | 
|---|
| 281 | } | 
|---|
| 282 |  | 
|---|
| 283 |  | 
|---|
| 284 | /****************************************************************************** | 
|---|
| 285 | *  NtOpenThreadToken                       [NTDLL] | 
|---|
| 286 | */ | 
|---|
| 287 | NTSTATUS WINAPI NtOpenThreadToken(HANDLE  ThreadHandle, | 
|---|
| 288 | DWORD   DesiredAccess, | 
|---|
| 289 | BOOLEAN OpenAsSelf, | 
|---|
| 290 | PHANDLE TokenHandle) | 
|---|
| 291 | { | 
|---|
| 292 | dprintf(("NTDLL: NtOpenThreadToken(%08xh,%08xh,%08xh,%08xh) partly implemented.\n", | 
|---|
| 293 | ThreadHandle, | 
|---|
| 294 | DesiredAccess, | 
|---|
| 295 | OpenAsSelf, | 
|---|
| 296 | TokenHandle)); | 
|---|
| 297 |  | 
|---|
| 298 | return HMOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle); | 
|---|
| 299 | } | 
|---|
| 300 |  | 
|---|
| 301 |  | 
|---|
| 302 | /****************************************************************************** | 
|---|
| 303 | *  NtAdjustPrivilegesToken                 [NTDLL] | 
|---|
| 304 | * | 
|---|
| 305 | * FIXME: parameters unsafe | 
|---|
| 306 | */ | 
|---|
| 307 | NTSTATUS WINAPI NtAdjustPrivilegesToken(HANDLE            TokenHandle, | 
|---|
| 308 | BOOLEAN           DisableAllPrivileges, | 
|---|
| 309 | PTOKEN_PRIVILEGES NewState, | 
|---|
| 310 | DWORD             BufferLength, | 
|---|
| 311 | PTOKEN_PRIVILEGES PreviousState, | 
|---|
| 312 | PDWORD            ReturnLength) | 
|---|
| 313 | { | 
|---|
| 314 | dprintf(("NTDLL: NtAdjustPrivilegesToken(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 315 | TokenHandle, | 
|---|
| 316 | DisableAllPrivileges, | 
|---|
| 317 | NewState, | 
|---|
| 318 | BufferLength, | 
|---|
| 319 | PreviousState, | 
|---|
| 320 | ReturnLength)); | 
|---|
| 321 |  | 
|---|
| 322 | return 0; | 
|---|
| 323 | } | 
|---|
| 324 |  | 
|---|
| 325 |  | 
|---|
| 326 | /****************************************************************************** | 
|---|
| 327 | *  NtQueryInformationToken                  [NTDLL.156] | 
|---|
| 328 | * | 
|---|
| 329 | */ | 
|---|
| 330 | NTSTATUS WINAPI NtQueryInformationToken(HANDLE  Token, | 
|---|
| 331 | DWORD   TokenInformationClass, | 
|---|
| 332 | LPVOID  TokenInformation, | 
|---|
| 333 | DWORD   TokenInformationLength, | 
|---|
| 334 | LPDWORD ReturnLength) | 
|---|
| 335 | { | 
|---|
| 336 | PROCESSTHREAD_SECURITYINFO *pSecInfo; | 
|---|
| 337 |  | 
|---|
| 338 | dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not correctly implemented.\n", | 
|---|
| 339 | Token, | 
|---|
| 340 | TokenInformationClass, | 
|---|
| 341 | TokenInformation, | 
|---|
| 342 | TokenInformationLength, | 
|---|
| 343 | ReturnLength)); | 
|---|
| 344 |  | 
|---|
| 345 | pSecInfo = (PROCESSTHREAD_SECURITYINFO*)HMHandleGetUserData(Token); | 
|---|
| 346 | if((ULONG)pSecInfo == -1) { | 
|---|
| 347 | return ERROR_INVALID_HANDLE; | 
|---|
| 348 | } | 
|---|
| 349 | switch (TokenInformationClass) | 
|---|
| 350 | { | 
|---|
| 351 | case TokenGroups:                    /* 2 */ | 
|---|
| 352 | *ReturnLength = sizeof (TOKEN_GROUPS); | 
|---|
| 353 | if(TokenInformationLength < sizeof (TOKEN_GROUPS)) { | 
|---|
| 354 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 355 | } | 
|---|
| 356 | memcpy(TokenInformation, (LPVOID)pSecInfo->pTokenGroups, sizeof(TOKEN_GROUPS)); | 
|---|
| 357 | break; | 
|---|
| 358 | case TokenUser:                     /* 1 */ | 
|---|
| 359 | { | 
|---|
| 360 | int len = sizeof (TOKEN_USER) + sizeof(SID); | 
|---|
| 361 | *ReturnLength = len; | 
|---|
| 362 | if(len <= TokenInformationLength) { | 
|---|
| 363 | if(TokenInformation) | 
|---|
| 364 | { | 
|---|
| 365 | TOKEN_USER *tuser = (TOKEN_USER *)TokenInformation; | 
|---|
| 366 | PSID sid = (PSID) &((LPBYTE)TokenInformation)[sizeof(TOKEN_USER)]; | 
|---|
| 367 | SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY}; | 
|---|
| 368 | RtlInitializeSid(sid, &localSidAuthority, 1); | 
|---|
| 369 | *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID; | 
|---|
| 370 | tuser->User.Sid = sid; | 
|---|
| 371 | } | 
|---|
| 372 | } | 
|---|
| 373 | else { | 
|---|
| 374 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 375 | } | 
|---|
| 376 | break; | 
|---|
| 377 | } | 
|---|
| 378 | case TokenPrivileges: | 
|---|
| 379 | *ReturnLength = sizeof (TOKEN_PRIVILEGES); | 
|---|
| 380 | if(TokenInformationLength < sizeof (TOKEN_PRIVILEGES)) { | 
|---|
| 381 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 382 | } | 
|---|
| 383 | memset(TokenInformation, 0, sizeof(TOKEN_PRIVILEGES)); | 
|---|
| 384 | break; | 
|---|
| 385 | case TokenOwner: | 
|---|
| 386 | *ReturnLength = sizeof (TOKEN_OWNER); | 
|---|
| 387 | if(TokenInformationLength < sizeof (TOKEN_OWNER)) { | 
|---|
| 388 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 389 | } | 
|---|
| 390 | memset(TokenInformation, 0, sizeof(TOKEN_OWNER)); | 
|---|
| 391 | break; | 
|---|
| 392 | case TokenPrimaryGroup: | 
|---|
| 393 | *ReturnLength = sizeof (TOKEN_PRIMARY_GROUP); | 
|---|
| 394 | if(TokenInformationLength < sizeof (TOKEN_PRIMARY_GROUP)) { | 
|---|
| 395 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 396 | } | 
|---|
| 397 | memset(TokenInformation, 0, sizeof(TOKEN_PRIMARY_GROUP)); | 
|---|
| 398 | break; | 
|---|
| 399 | case TokenDefaultDacl: | 
|---|
| 400 | *ReturnLength = sizeof (TOKEN_DEFAULT_DACL); | 
|---|
| 401 | if(TokenInformationLength < sizeof (TOKEN_DEFAULT_DACL)) { | 
|---|
| 402 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 403 | } | 
|---|
| 404 | memset(TokenInformation, 0, sizeof(TOKEN_DEFAULT_DACL)); | 
|---|
| 405 | break; | 
|---|
| 406 | case TokenSource: | 
|---|
| 407 | *ReturnLength = sizeof (TOKEN_SOURCE); | 
|---|
| 408 | if(TokenInformationLength < sizeof (TOKEN_SOURCE)) { | 
|---|
| 409 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 410 | } | 
|---|
| 411 | memset(TokenInformation, 0, sizeof(TOKEN_SOURCE)); | 
|---|
| 412 | break; | 
|---|
| 413 | case TokenType: | 
|---|
| 414 | *ReturnLength = sizeof (TOKEN_TYPE); | 
|---|
| 415 | if(TokenInformationLength < sizeof (TOKEN_TYPE)) { | 
|---|
| 416 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 417 | } | 
|---|
| 418 | memset(TokenInformation, 0, sizeof(TOKEN_TYPE)); | 
|---|
| 419 | break; | 
|---|
| 420 | #if 0 | 
|---|
| 421 | case TokenImpersonationLevel: | 
|---|
| 422 | case TokenStatistics: | 
|---|
| 423 | #endif /* 0 */ | 
|---|
| 424 | } | 
|---|
| 425 |  | 
|---|
| 426 | return STATUS_SUCCESS; | 
|---|
| 427 | } | 
|---|
| 428 |  | 
|---|
| 429 |  | 
|---|
| 430 | /* | 
|---|
| 431 | * Section | 
|---|
| 432 | */ | 
|---|
| 433 |  | 
|---|
| 434 | /****************************************************************************** | 
|---|
| 435 | *  NtCreateSection                      [NTDLL] | 
|---|
| 436 | */ | 
|---|
| 437 | NTSTATUS WINAPI NtCreateSection(PHANDLE SectionHandle, | 
|---|
| 438 | ACCESS_MASK DesiredAccess, | 
|---|
| 439 | POBJECT_ATTRIBUTES ObjectAttributes, | 
|---|
| 440 | PLARGE_INTEGER MaximumSize, | 
|---|
| 441 | ULONG SectionPageProtection, | 
|---|
| 442 | ULONG AllocationAttributes, | 
|---|
| 443 | HANDLE FileHandle) | 
|---|
| 444 | { | 
|---|
| 445 | dprintf(("NTDLL: NtCreateSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 446 | SectionHandle, | 
|---|
| 447 | DesiredAccess, | 
|---|
| 448 | ObjectAttributes, | 
|---|
| 449 | MaximumSize, | 
|---|
| 450 | SectionPageProtection, | 
|---|
| 451 | AllocationAttributes, | 
|---|
| 452 | FileHandle)); | 
|---|
| 453 |  | 
|---|
| 454 | return 0; | 
|---|
| 455 | } | 
|---|
| 456 |  | 
|---|
| 457 |  | 
|---|
| 458 | /****************************************************************************** | 
|---|
| 459 | *  NtOpenSection [NTDLL] | 
|---|
| 460 | */ | 
|---|
| 461 | NTSTATUS WINAPI NtOpenSection(PHANDLE SectionHandle, | 
|---|
| 462 | ACCESS_MASK DesiredAccess, | 
|---|
| 463 | POBJECT_ATTRIBUTES ObjectAttributes) | 
|---|
| 464 | { | 
|---|
| 465 | dprintf(("NTDLL: NtOpenSection(%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 466 | SectionHandle, | 
|---|
| 467 | DesiredAccess, | 
|---|
| 468 | ObjectAttributes)); | 
|---|
| 469 |  | 
|---|
| 470 | return 0; | 
|---|
| 471 | } | 
|---|
| 472 |  | 
|---|
| 473 |  | 
|---|
| 474 | /****************************************************************************** | 
|---|
| 475 | *  NtQuerySection                       [NTDLL] | 
|---|
| 476 | */ | 
|---|
| 477 | NTSTATUS WINAPI NtQuerySection(HANDLE SectionHandle, | 
|---|
| 478 | PVOID SectionInformationClass, | 
|---|
| 479 | PVOID SectionInformation, | 
|---|
| 480 | ULONG Length, | 
|---|
| 481 | PULONG ResultLength) | 
|---|
| 482 | { | 
|---|
| 483 | dprintf(("NTDLL: NtQuerySection(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 484 | SectionHandle, | 
|---|
| 485 | SectionInformationClass, | 
|---|
| 486 | SectionInformation, | 
|---|
| 487 | Length, | 
|---|
| 488 | ResultLength)); | 
|---|
| 489 |  | 
|---|
| 490 | return 0; | 
|---|
| 491 | } | 
|---|
| 492 |  | 
|---|
| 493 |  | 
|---|
| 494 | /****************************************************************************** | 
|---|
| 495 | * NtMapViewOfSection                    [NTDLL] | 
|---|
| 496 | * FUNCTION: Maps a view of a section into the virtual address space of a process | 
|---|
| 497 | * | 
|---|
| 498 | * ARGUMENTS: | 
|---|
| 499 | *  SectionHandle Handle of the section | 
|---|
| 500 | *  ProcessHandle Handle of the process | 
|---|
| 501 | *  BaseAddress                          Desired base address (or NULL) on entry | 
|---|
| 502 | *       Actual base address of the view on exit | 
|---|
| 503 | *  ZeroBits      Number of high order address bits that must be zero | 
|---|
| 504 | *  CommitSize    Size bytes of the initially committed section of the view | 
|---|
| 505 | *  SectionOffset Offset bytes from the beginning of the section to the beginning of the view | 
|---|
| 506 | *  ViewSize      Desired length of map (or zero to map all) on entry | 
|---|
| 507 | Actual length mapped on exit | 
|---|
| 508 | *  InheritDisposition                   Specified how the view is to be shared with | 
|---|
| 509 | *       child processes | 
|---|
| 510 | *  AllocateType  Type of allocation for the pages | 
|---|
| 511 | *  Protect    Protection for the committed region of the view | 
|---|
| 512 | */ | 
|---|
| 513 | NTSTATUS WINAPI NtMapViewOfSection(HANDLE          SectionHandle, | 
|---|
| 514 | HANDLE          ProcessHandle, | 
|---|
| 515 | PVOID*          BaseAddress, | 
|---|
| 516 | ULONG           ZeroBits, | 
|---|
| 517 | ULONG           CommitSize, | 
|---|
| 518 | PLARGE_INTEGER  SectionOffset, | 
|---|
| 519 | PULONG          ViewSize, | 
|---|
| 520 | SECTION_INHERIT InheritDisposition, | 
|---|
| 521 | ULONG           AllocationType, | 
|---|
| 522 | ULONG           Protect) | 
|---|
| 523 | { | 
|---|
| 524 | dprintf(("NTDLL: NtMapViewOfSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 525 | SectionHandle, | 
|---|
| 526 | ProcessHandle, | 
|---|
| 527 | BaseAddress, | 
|---|
| 528 | ZeroBits, | 
|---|
| 529 | CommitSize, | 
|---|
| 530 | SectionOffset, | 
|---|
| 531 | ViewSize, | 
|---|
| 532 | InheritDisposition, | 
|---|
| 533 | AllocationType, | 
|---|
| 534 | Protect)); | 
|---|
| 535 |  | 
|---|
| 536 | return 0; | 
|---|
| 537 | } | 
|---|
| 538 |  | 
|---|
| 539 |  | 
|---|
| 540 | /* | 
|---|
| 541 | * ports | 
|---|
| 542 | */ | 
|---|
| 543 |  | 
|---|
| 544 | /****************************************************************************** | 
|---|
| 545 | *  NtCreatePort                         [NTDLL] | 
|---|
| 546 | */ | 
|---|
| 547 | NTSTATUS WINAPI NtCreatePort(DWORD x1, | 
|---|
| 548 | DWORD x2, | 
|---|
| 549 | DWORD x3, | 
|---|
| 550 | DWORD x4, | 
|---|
| 551 | DWORD x5) | 
|---|
| 552 | { | 
|---|
| 553 | dprintf(("NTDLL: NtCreatePort(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 554 | x1, | 
|---|
| 555 | x2, | 
|---|
| 556 | x3, | 
|---|
| 557 | x4, | 
|---|
| 558 | x5)); | 
|---|
| 559 |  | 
|---|
| 560 | return 0; | 
|---|
| 561 | } | 
|---|
| 562 |  | 
|---|
| 563 |  | 
|---|
| 564 | /****************************************************************************** | 
|---|
| 565 | *  NtConnectPort                        [NTDLL] | 
|---|
| 566 | */ | 
|---|
| 567 | NTSTATUS WINAPI NtConnectPort(DWORD           x1, | 
|---|
| 568 | PUNICODE_STRING uni, | 
|---|
| 569 | DWORD           x3, | 
|---|
| 570 | DWORD           x4, | 
|---|
| 571 | DWORD           x5, | 
|---|
| 572 | DWORD           x6, | 
|---|
| 573 | DWORD           x7, | 
|---|
| 574 | DWORD           x8) | 
|---|
| 575 | { | 
|---|
| 576 | dprintf(("NTDLL: NtConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 577 | x1, | 
|---|
| 578 | uni, | 
|---|
| 579 | x3, | 
|---|
| 580 | x4, | 
|---|
| 581 | x5, | 
|---|
| 582 | x6, | 
|---|
| 583 | x7, | 
|---|
| 584 | x8)); | 
|---|
| 585 |  | 
|---|
| 586 | return 0; | 
|---|
| 587 | } | 
|---|
| 588 |  | 
|---|
| 589 |  | 
|---|
| 590 | /****************************************************************************** | 
|---|
| 591 | *  NtListenPort                         [NTDLL] | 
|---|
| 592 | */ | 
|---|
| 593 | NTSTATUS WINAPI NtListenPort(DWORD x1, | 
|---|
| 594 | DWORD x2) | 
|---|
| 595 | { | 
|---|
| 596 | dprintf(("NTDLL: NtListenPort(%08xh,%08xh) not implemented.\n", | 
|---|
| 597 | x1, | 
|---|
| 598 | x2)); | 
|---|
| 599 |  | 
|---|
| 600 | return 0; | 
|---|
| 601 | } | 
|---|
| 602 |  | 
|---|
| 603 |  | 
|---|
| 604 | /****************************************************************************** | 
|---|
| 605 | *  NtAcceptConnectPort                  [NTDLL] | 
|---|
| 606 | */ | 
|---|
| 607 | NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1, | 
|---|
| 608 | DWORD x2, | 
|---|
| 609 | DWORD x3, | 
|---|
| 610 | DWORD x4, | 
|---|
| 611 | DWORD x5, | 
|---|
| 612 | DWORD x6) | 
|---|
| 613 | { | 
|---|
| 614 | dprintf(("NTDLL: NtAcceptConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 615 | x1, | 
|---|
| 616 | x2, | 
|---|
| 617 | x3, | 
|---|
| 618 | x4, | 
|---|
| 619 | x5, | 
|---|
| 620 | x6)); | 
|---|
| 621 |  | 
|---|
| 622 | return 0; | 
|---|
| 623 | } | 
|---|
| 624 |  | 
|---|
| 625 |  | 
|---|
| 626 | /****************************************************************************** | 
|---|
| 627 | *  NtCompleteConnectPort                [NTDLL] | 
|---|
| 628 | */ | 
|---|
| 629 | NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1) | 
|---|
| 630 | { | 
|---|
| 631 | dprintf(("NTDLL: NtCompleteConnectPort(%08xh) not implemented.\n", | 
|---|
| 632 | x1)); | 
|---|
| 633 |  | 
|---|
| 634 | return 0; | 
|---|
| 635 | } | 
|---|
| 636 |  | 
|---|
| 637 |  | 
|---|
| 638 | /****************************************************************************** | 
|---|
| 639 | *  NtRegisterThreadTerminatePort        [NTDLL] | 
|---|
| 640 | */ | 
|---|
| 641 | NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1) | 
|---|
| 642 | { | 
|---|
| 643 | dprintf(("NTDLL: NtRegisterThreadTerminatePort(%08xh) not implemented.\n", | 
|---|
| 644 | x1)); | 
|---|
| 645 |  | 
|---|
| 646 | return 0; | 
|---|
| 647 | } | 
|---|
| 648 |  | 
|---|
| 649 |  | 
|---|
| 650 | /****************************************************************************** | 
|---|
| 651 | *  NtRequestWaitReplyPort                  [NTDLL] | 
|---|
| 652 | */ | 
|---|
| 653 | NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1, | 
|---|
| 654 | DWORD x2, | 
|---|
| 655 | DWORD x3) | 
|---|
| 656 | { | 
|---|
| 657 | dprintf(("NTDLL: NtRequestWaitReplyPort(%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 658 | x1, | 
|---|
| 659 | x2, | 
|---|
| 660 | x3)); | 
|---|
| 661 |  | 
|---|
| 662 | return 0; | 
|---|
| 663 | } | 
|---|
| 664 |  | 
|---|
| 665 |  | 
|---|
| 666 | /****************************************************************************** | 
|---|
| 667 | *  NtReplyWaitReceivePort               [NTDLL] | 
|---|
| 668 | */ | 
|---|
| 669 | NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1, | 
|---|
| 670 | DWORD x2, | 
|---|
| 671 | DWORD x3, | 
|---|
| 672 | DWORD x4) | 
|---|
| 673 | { | 
|---|
| 674 | dprintf(("NTDLL: NtReplyWaitReceivePort(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 675 | x1, | 
|---|
| 676 | x2, | 
|---|
| 677 | x3, | 
|---|
| 678 | x4)); | 
|---|
| 679 |  | 
|---|
| 680 | return 0; | 
|---|
| 681 | } | 
|---|
| 682 |  | 
|---|
| 683 |  | 
|---|
| 684 | /* | 
|---|
| 685 | * Misc | 
|---|
| 686 | */ | 
|---|
| 687 |  | 
|---|
| 688 | /****************************************************************************** | 
|---|
| 689 | *  NtSetIntervalProfile                 [NTDLL] | 
|---|
| 690 | */ | 
|---|
| 691 | NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1, | 
|---|
| 692 | DWORD x2) | 
|---|
| 693 | { | 
|---|
| 694 | dprintf(("NTDLL: NtSetIntervalProfile(%08xh,%08xh) not implemented.\n", | 
|---|
| 695 | x1, | 
|---|
| 696 | x2)); | 
|---|
| 697 |  | 
|---|
| 698 | return 0; | 
|---|
| 699 | } | 
|---|
| 700 |  | 
|---|
| 701 |  | 
|---|
| 702 | /****************************************************************************** | 
|---|
| 703 | *  NtQueryPerformanceCounter            [NTDLL] | 
|---|
| 704 | */ | 
|---|
| 705 | NTSTATUS WINAPI NtQueryPerformanceCounter(PLARGE_INTEGER Counter, | 
|---|
| 706 | PLARGE_INTEGER Frequency) | 
|---|
| 707 | { | 
|---|
| 708 | dprintf(("NTDLL: NtQueryPerformanceCounter(%08xh,%08xh) not implemented.\n", | 
|---|
| 709 | Counter, | 
|---|
| 710 | Frequency)); | 
|---|
| 711 |  | 
|---|
| 712 | return 0; | 
|---|
| 713 | } | 
|---|
| 714 |  | 
|---|
| 715 |  | 
|---|
| 716 | /****************************************************************************** | 
|---|
| 717 | *  NtCreateMailSlotFile                 [NTDLL] | 
|---|
| 718 | */ | 
|---|
| 719 | NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1, | 
|---|
| 720 | DWORD x2, | 
|---|
| 721 | DWORD x3, | 
|---|
| 722 | DWORD x4, | 
|---|
| 723 | DWORD x5, | 
|---|
| 724 | DWORD x6, | 
|---|
| 725 | DWORD x7, | 
|---|
| 726 | DWORD x8) | 
|---|
| 727 | { | 
|---|
| 728 | dprintf(("NTDLL: NtCreateMailslotFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 729 | x1, | 
|---|
| 730 | x2, | 
|---|
| 731 | x3, | 
|---|
| 732 | x4, | 
|---|
| 733 | x5, | 
|---|
| 734 | x6, | 
|---|
| 735 | x7, | 
|---|
| 736 | x8)); | 
|---|
| 737 |  | 
|---|
| 738 | return 0; | 
|---|
| 739 | } | 
|---|
| 740 |  | 
|---|
| 741 |  | 
|---|
| 742 | /****************************************************************************** | 
|---|
| 743 | * NtQuerySystemInformation [NTDLL.168] | 
|---|
| 744 | * | 
|---|
| 745 | * ARGUMENTS: | 
|---|
| 746 | *  SystemInformationClass               Index to a certain information structure | 
|---|
| 747 | * SystemTimeAdjustmentInformation       SYSTEM_TIME_ADJUSTMENT | 
|---|
| 748 | * SystemCacheInformation                   SYSTEM_CACHE_INFORMATION | 
|---|
| 749 | * SystemConfigurationInformation        CONFIGURATION_INFORMATION | 
|---|
| 750 | * observed (class/len): | 
|---|
| 751 | *    0x0/0x2c | 
|---|
| 752 | *    0x12/0x18 | 
|---|
| 753 | *    0x2/0x138 | 
|---|
| 754 | *    0x8/0x600 | 
|---|
| 755 | *  SystemInformation                    caller supplies storage for the information structure | 
|---|
| 756 | *  Length     size of the structure | 
|---|
| 757 | *  ResultLength  Data written | 
|---|
| 758 | */ | 
|---|
| 759 | NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, | 
|---|
| 760 | PVOID                    SystemInformation, | 
|---|
| 761 | ULONG                    Length, | 
|---|
| 762 | PULONG                   ResultLength) | 
|---|
| 763 | { | 
|---|
| 764 | dprintf(("NTDLL: NtQuerySystemInformation(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 765 | SystemInformationClass, | 
|---|
| 766 | SystemInformation, | 
|---|
| 767 | Length, | 
|---|
| 768 | ResultLength)); | 
|---|
| 769 |  | 
|---|
| 770 | ZeroMemory (SystemInformation, Length); | 
|---|
| 771 | return 0; | 
|---|
| 772 | } | 
|---|
| 773 |  | 
|---|
| 774 |  | 
|---|
| 775 | /****************************************************************************** | 
|---|
| 776 | *  NtCreatePagingFile                      [NTDLL] | 
|---|
| 777 | */ | 
|---|
| 778 | NTSTATUS WINAPI NtCreatePagingFile(PUNICODE_STRING PageFileName, | 
|---|
| 779 | ULONG MinimumSize, | 
|---|
| 780 | ULONG MaximumSize, | 
|---|
| 781 | PULONG ActualSize) | 
|---|
| 782 | { | 
|---|
| 783 | dprintf(("NTDLL: NtCreatePagingFile(%08xh, %08xh, %08xh, %08xh) not implemented.\n", | 
|---|
| 784 | PageFileName, | 
|---|
| 785 | MinimumSize, | 
|---|
| 786 | MaximumSize, | 
|---|
| 787 | ActualSize)); | 
|---|
| 788 |  | 
|---|
| 789 | return 0; | 
|---|
| 790 | } | 
|---|
| 791 |  | 
|---|
| 792 |  | 
|---|
| 793 | /****************************************************************************** | 
|---|
| 794 | *  NtDisplayString                               [NTDLL.95] | 
|---|
| 795 | * | 
|---|
| 796 | * writes a string to the nt-textmode screen eg. during startup | 
|---|
| 797 | */ | 
|---|
| 798 | NTSTATUS WINAPI NtDisplayString (PUNICODE_STRING string) | 
|---|
| 799 | { | 
|---|
| 800 | dprintf(("NTDLL: NtDisplayString(%08xh\n", | 
|---|
| 801 | string)); | 
|---|
| 802 |  | 
|---|
| 803 | WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), | 
|---|
| 804 | string->Buffer, | 
|---|
| 805 | string->Length, | 
|---|
| 806 | 0, | 
|---|
| 807 | 0); | 
|---|
| 808 |  | 
|---|
| 809 | return 0; | 
|---|
| 810 | } | 
|---|