| 1 | /* $Id: nt.cpp,v 1.6 2000-02-09 23:35:12 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) not 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 | *ReturnLength = sizeof (TOKEN_USER); | 
|---|
| 360 | if(TokenInformationLength < sizeof (TOKEN_USER)) { | 
|---|
| 361 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 362 | } | 
|---|
| 363 | memset(TokenInformation, 0, sizeof(TOKEN_USER)); | 
|---|
| 364 | break; | 
|---|
| 365 | case TokenPrivileges: | 
|---|
| 366 | *ReturnLength = sizeof (TOKEN_PRIVILEGES); | 
|---|
| 367 | if(TokenInformationLength < sizeof (TOKEN_PRIVILEGES)) { | 
|---|
| 368 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 369 | } | 
|---|
| 370 | memset(TokenInformation, 0, sizeof(TOKEN_PRIVILEGES)); | 
|---|
| 371 | break; | 
|---|
| 372 | case TokenOwner: | 
|---|
| 373 | *ReturnLength = sizeof (TOKEN_OWNER); | 
|---|
| 374 | if(TokenInformationLength < sizeof (TOKEN_OWNER)) { | 
|---|
| 375 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 376 | } | 
|---|
| 377 | memset(TokenInformation, 0, sizeof(TOKEN_OWNER)); | 
|---|
| 378 | break; | 
|---|
| 379 | case TokenPrimaryGroup: | 
|---|
| 380 | *ReturnLength = sizeof (TOKEN_PRIMARY_GROUP); | 
|---|
| 381 | if(TokenInformationLength < sizeof (TOKEN_PRIMARY_GROUP)) { | 
|---|
| 382 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 383 | } | 
|---|
| 384 | memset(TokenInformation, 0, sizeof(TOKEN_PRIMARY_GROUP)); | 
|---|
| 385 | break; | 
|---|
| 386 | case TokenDefaultDacl: | 
|---|
| 387 | *ReturnLength = sizeof (TOKEN_DEFAULT_DACL); | 
|---|
| 388 | if(TokenInformationLength < sizeof (TOKEN_DEFAULT_DACL)) { | 
|---|
| 389 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 390 | } | 
|---|
| 391 | memset(TokenInformation, 0, sizeof(TOKEN_DEFAULT_DACL)); | 
|---|
| 392 | break; | 
|---|
| 393 | case TokenSource: | 
|---|
| 394 | *ReturnLength = sizeof (TOKEN_SOURCE); | 
|---|
| 395 | if(TokenInformationLength < sizeof (TOKEN_SOURCE)) { | 
|---|
| 396 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 397 | } | 
|---|
| 398 | memset(TokenInformation, 0, sizeof(TOKEN_SOURCE)); | 
|---|
| 399 | break; | 
|---|
| 400 | case TokenType: | 
|---|
| 401 | *ReturnLength = sizeof (TOKEN_TYPE); | 
|---|
| 402 | if(TokenInformationLength < sizeof (TOKEN_TYPE)) { | 
|---|
| 403 | return STATUS_BUFFER_TOO_SMALL; | 
|---|
| 404 | } | 
|---|
| 405 | memset(TokenInformation, 0, sizeof(TOKEN_TYPE)); | 
|---|
| 406 | break; | 
|---|
| 407 | #if 0 | 
|---|
| 408 | case TokenImpersonationLevel: | 
|---|
| 409 | case TokenStatistics: | 
|---|
| 410 | #endif /* 0 */ | 
|---|
| 411 | } | 
|---|
| 412 |  | 
|---|
| 413 | return STATUS_SUCCESS; | 
|---|
| 414 | } | 
|---|
| 415 |  | 
|---|
| 416 |  | 
|---|
| 417 | /* | 
|---|
| 418 | * Section | 
|---|
| 419 | */ | 
|---|
| 420 |  | 
|---|
| 421 | /****************************************************************************** | 
|---|
| 422 | *  NtCreateSection                      [NTDLL] | 
|---|
| 423 | */ | 
|---|
| 424 | NTSTATUS WINAPI NtCreateSection(PHANDLE SectionHandle, | 
|---|
| 425 | ACCESS_MASK DesiredAccess, | 
|---|
| 426 | POBJECT_ATTRIBUTES ObjectAttributes, | 
|---|
| 427 | PLARGE_INTEGER MaximumSize, | 
|---|
| 428 | ULONG SectionPageProtection, | 
|---|
| 429 | ULONG AllocationAttributes, | 
|---|
| 430 | HANDLE FileHandle) | 
|---|
| 431 | { | 
|---|
| 432 | dprintf(("NTDLL: NtCreateSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 433 | SectionHandle, | 
|---|
| 434 | DesiredAccess, | 
|---|
| 435 | ObjectAttributes, | 
|---|
| 436 | MaximumSize, | 
|---|
| 437 | SectionPageProtection, | 
|---|
| 438 | AllocationAttributes, | 
|---|
| 439 | FileHandle)); | 
|---|
| 440 |  | 
|---|
| 441 | return 0; | 
|---|
| 442 | } | 
|---|
| 443 |  | 
|---|
| 444 |  | 
|---|
| 445 | /****************************************************************************** | 
|---|
| 446 | *  NtOpenSection [NTDLL] | 
|---|
| 447 | */ | 
|---|
| 448 | NTSTATUS WINAPI NtOpenSection(PHANDLE SectionHandle, | 
|---|
| 449 | ACCESS_MASK DesiredAccess, | 
|---|
| 450 | POBJECT_ATTRIBUTES ObjectAttributes) | 
|---|
| 451 | { | 
|---|
| 452 | dprintf(("NTDLL: NtOpenSection(%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 453 | SectionHandle, | 
|---|
| 454 | DesiredAccess, | 
|---|
| 455 | ObjectAttributes)); | 
|---|
| 456 |  | 
|---|
| 457 | return 0; | 
|---|
| 458 | } | 
|---|
| 459 |  | 
|---|
| 460 |  | 
|---|
| 461 | /****************************************************************************** | 
|---|
| 462 | *  NtQuerySection                       [NTDLL] | 
|---|
| 463 | */ | 
|---|
| 464 | NTSTATUS WINAPI NtQuerySection(HANDLE SectionHandle, | 
|---|
| 465 | PVOID SectionInformationClass, | 
|---|
| 466 | PVOID SectionInformation, | 
|---|
| 467 | ULONG Length, | 
|---|
| 468 | PULONG ResultLength) | 
|---|
| 469 | { | 
|---|
| 470 | dprintf(("NTDLL: NtQuerySection(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 471 | SectionHandle, | 
|---|
| 472 | SectionInformationClass, | 
|---|
| 473 | SectionInformation, | 
|---|
| 474 | Length, | 
|---|
| 475 | ResultLength)); | 
|---|
| 476 |  | 
|---|
| 477 | return 0; | 
|---|
| 478 | } | 
|---|
| 479 |  | 
|---|
| 480 |  | 
|---|
| 481 | /****************************************************************************** | 
|---|
| 482 | * NtMapViewOfSection                    [NTDLL] | 
|---|
| 483 | * FUNCTION: Maps a view of a section into the virtual address space of a process | 
|---|
| 484 | * | 
|---|
| 485 | * ARGUMENTS: | 
|---|
| 486 | *  SectionHandle Handle of the section | 
|---|
| 487 | *  ProcessHandle Handle of the process | 
|---|
| 488 | *  BaseAddress                          Desired base address (or NULL) on entry | 
|---|
| 489 | *       Actual base address of the view on exit | 
|---|
| 490 | *  ZeroBits      Number of high order address bits that must be zero | 
|---|
| 491 | *  CommitSize    Size bytes of the initially committed section of the view | 
|---|
| 492 | *  SectionOffset Offset bytes from the beginning of the section to the beginning of the view | 
|---|
| 493 | *  ViewSize      Desired length of map (or zero to map all) on entry | 
|---|
| 494 | Actual length mapped on exit | 
|---|
| 495 | *  InheritDisposition                   Specified how the view is to be shared with | 
|---|
| 496 | *       child processes | 
|---|
| 497 | *  AllocateType  Type of allocation for the pages | 
|---|
| 498 | *  Protect    Protection for the committed region of the view | 
|---|
| 499 | */ | 
|---|
| 500 | NTSTATUS WINAPI NtMapViewOfSection(HANDLE          SectionHandle, | 
|---|
| 501 | HANDLE          ProcessHandle, | 
|---|
| 502 | PVOID*          BaseAddress, | 
|---|
| 503 | ULONG           ZeroBits, | 
|---|
| 504 | ULONG           CommitSize, | 
|---|
| 505 | PLARGE_INTEGER  SectionOffset, | 
|---|
| 506 | PULONG          ViewSize, | 
|---|
| 507 | SECTION_INHERIT InheritDisposition, | 
|---|
| 508 | ULONG           AllocationType, | 
|---|
| 509 | ULONG           Protect) | 
|---|
| 510 | { | 
|---|
| 511 | dprintf(("NTDLL: NtMapViewOfSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 512 | SectionHandle, | 
|---|
| 513 | ProcessHandle, | 
|---|
| 514 | BaseAddress, | 
|---|
| 515 | ZeroBits, | 
|---|
| 516 | CommitSize, | 
|---|
| 517 | SectionOffset, | 
|---|
| 518 | ViewSize, | 
|---|
| 519 | InheritDisposition, | 
|---|
| 520 | AllocationType, | 
|---|
| 521 | Protect)); | 
|---|
| 522 |  | 
|---|
| 523 | return 0; | 
|---|
| 524 | } | 
|---|
| 525 |  | 
|---|
| 526 |  | 
|---|
| 527 | /* | 
|---|
| 528 | * ports | 
|---|
| 529 | */ | 
|---|
| 530 |  | 
|---|
| 531 | /****************************************************************************** | 
|---|
| 532 | *  NtCreatePort                         [NTDLL] | 
|---|
| 533 | */ | 
|---|
| 534 | NTSTATUS WINAPI NtCreatePort(DWORD x1, | 
|---|
| 535 | DWORD x2, | 
|---|
| 536 | DWORD x3, | 
|---|
| 537 | DWORD x4, | 
|---|
| 538 | DWORD x5) | 
|---|
| 539 | { | 
|---|
| 540 | dprintf(("NTDLL: NtCreatePort(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 541 | x1, | 
|---|
| 542 | x2, | 
|---|
| 543 | x3, | 
|---|
| 544 | x4, | 
|---|
| 545 | x5)); | 
|---|
| 546 |  | 
|---|
| 547 | return 0; | 
|---|
| 548 | } | 
|---|
| 549 |  | 
|---|
| 550 |  | 
|---|
| 551 | /****************************************************************************** | 
|---|
| 552 | *  NtConnectPort                        [NTDLL] | 
|---|
| 553 | */ | 
|---|
| 554 | NTSTATUS WINAPI NtConnectPort(DWORD           x1, | 
|---|
| 555 | PUNICODE_STRING uni, | 
|---|
| 556 | DWORD           x3, | 
|---|
| 557 | DWORD           x4, | 
|---|
| 558 | DWORD           x5, | 
|---|
| 559 | DWORD           x6, | 
|---|
| 560 | DWORD           x7, | 
|---|
| 561 | DWORD           x8) | 
|---|
| 562 | { | 
|---|
| 563 | dprintf(("NTDLL: NtConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 564 | x1, | 
|---|
| 565 | uni, | 
|---|
| 566 | x3, | 
|---|
| 567 | x4, | 
|---|
| 568 | x5, | 
|---|
| 569 | x6, | 
|---|
| 570 | x7, | 
|---|
| 571 | x8)); | 
|---|
| 572 |  | 
|---|
| 573 | return 0; | 
|---|
| 574 | } | 
|---|
| 575 |  | 
|---|
| 576 |  | 
|---|
| 577 | /****************************************************************************** | 
|---|
| 578 | *  NtListenPort                         [NTDLL] | 
|---|
| 579 | */ | 
|---|
| 580 | NTSTATUS WINAPI NtListenPort(DWORD x1, | 
|---|
| 581 | DWORD x2) | 
|---|
| 582 | { | 
|---|
| 583 | dprintf(("NTDLL: NtListenPort(%08xh,%08xh) not implemented.\n", | 
|---|
| 584 | x1, | 
|---|
| 585 | x2)); | 
|---|
| 586 |  | 
|---|
| 587 | return 0; | 
|---|
| 588 | } | 
|---|
| 589 |  | 
|---|
| 590 |  | 
|---|
| 591 | /****************************************************************************** | 
|---|
| 592 | *  NtAcceptConnectPort                  [NTDLL] | 
|---|
| 593 | */ | 
|---|
| 594 | NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1, | 
|---|
| 595 | DWORD x2, | 
|---|
| 596 | DWORD x3, | 
|---|
| 597 | DWORD x4, | 
|---|
| 598 | DWORD x5, | 
|---|
| 599 | DWORD x6) | 
|---|
| 600 | { | 
|---|
| 601 | dprintf(("NTDLL: NtAcceptConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 602 | x1, | 
|---|
| 603 | x2, | 
|---|
| 604 | x3, | 
|---|
| 605 | x4, | 
|---|
| 606 | x5, | 
|---|
| 607 | x6)); | 
|---|
| 608 |  | 
|---|
| 609 | return 0; | 
|---|
| 610 | } | 
|---|
| 611 |  | 
|---|
| 612 |  | 
|---|
| 613 | /****************************************************************************** | 
|---|
| 614 | *  NtCompleteConnectPort                [NTDLL] | 
|---|
| 615 | */ | 
|---|
| 616 | NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1) | 
|---|
| 617 | { | 
|---|
| 618 | dprintf(("NTDLL: NtCompleteConnectPort(%08xh) not implemented.\n", | 
|---|
| 619 | x1)); | 
|---|
| 620 |  | 
|---|
| 621 | return 0; | 
|---|
| 622 | } | 
|---|
| 623 |  | 
|---|
| 624 |  | 
|---|
| 625 | /****************************************************************************** | 
|---|
| 626 | *  NtRegisterThreadTerminatePort        [NTDLL] | 
|---|
| 627 | */ | 
|---|
| 628 | NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1) | 
|---|
| 629 | { | 
|---|
| 630 | dprintf(("NTDLL: NtRegisterThreadTerminatePort(%08xh) not implemented.\n", | 
|---|
| 631 | x1)); | 
|---|
| 632 |  | 
|---|
| 633 | return 0; | 
|---|
| 634 | } | 
|---|
| 635 |  | 
|---|
| 636 |  | 
|---|
| 637 | /****************************************************************************** | 
|---|
| 638 | *  NtRequestWaitReplyPort                  [NTDLL] | 
|---|
| 639 | */ | 
|---|
| 640 | NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1, | 
|---|
| 641 | DWORD x2, | 
|---|
| 642 | DWORD x3) | 
|---|
| 643 | { | 
|---|
| 644 | dprintf(("NTDLL: NtRequestWaitReplyPort(%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 645 | x1, | 
|---|
| 646 | x2, | 
|---|
| 647 | x3)); | 
|---|
| 648 |  | 
|---|
| 649 | return 0; | 
|---|
| 650 | } | 
|---|
| 651 |  | 
|---|
| 652 |  | 
|---|
| 653 | /****************************************************************************** | 
|---|
| 654 | *  NtReplyWaitReceivePort               [NTDLL] | 
|---|
| 655 | */ | 
|---|
| 656 | NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1, | 
|---|
| 657 | DWORD x2, | 
|---|
| 658 | DWORD x3, | 
|---|
| 659 | DWORD x4) | 
|---|
| 660 | { | 
|---|
| 661 | dprintf(("NTDLL: NtReplyWaitReceivePort(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 662 | x1, | 
|---|
| 663 | x2, | 
|---|
| 664 | x3, | 
|---|
| 665 | x4)); | 
|---|
| 666 |  | 
|---|
| 667 | return 0; | 
|---|
| 668 | } | 
|---|
| 669 |  | 
|---|
| 670 |  | 
|---|
| 671 | /* | 
|---|
| 672 | * Misc | 
|---|
| 673 | */ | 
|---|
| 674 |  | 
|---|
| 675 | /****************************************************************************** | 
|---|
| 676 | *  NtSetIntervalProfile                 [NTDLL] | 
|---|
| 677 | */ | 
|---|
| 678 | NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1, | 
|---|
| 679 | DWORD x2) | 
|---|
| 680 | { | 
|---|
| 681 | dprintf(("NTDLL: NtSetIntervalProfile(%08xh,%08xh) not implemented.\n", | 
|---|
| 682 | x1, | 
|---|
| 683 | x2)); | 
|---|
| 684 |  | 
|---|
| 685 | return 0; | 
|---|
| 686 | } | 
|---|
| 687 |  | 
|---|
| 688 |  | 
|---|
| 689 | /****************************************************************************** | 
|---|
| 690 | *  NtQueryPerformanceCounter            [NTDLL] | 
|---|
| 691 | */ | 
|---|
| 692 | NTSTATUS WINAPI NtQueryPerformanceCounter(PLARGE_INTEGER Counter, | 
|---|
| 693 | PLARGE_INTEGER Frequency) | 
|---|
| 694 | { | 
|---|
| 695 | dprintf(("NTDLL: NtQueryPerformanceCounter(%08xh,%08xh) not implemented.\n", | 
|---|
| 696 | Counter, | 
|---|
| 697 | Frequency)); | 
|---|
| 698 |  | 
|---|
| 699 | return 0; | 
|---|
| 700 | } | 
|---|
| 701 |  | 
|---|
| 702 |  | 
|---|
| 703 | /****************************************************************************** | 
|---|
| 704 | *  NtCreateMailSlotFile                 [NTDLL] | 
|---|
| 705 | */ | 
|---|
| 706 | NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1, | 
|---|
| 707 | DWORD x2, | 
|---|
| 708 | DWORD x3, | 
|---|
| 709 | DWORD x4, | 
|---|
| 710 | DWORD x5, | 
|---|
| 711 | DWORD x6, | 
|---|
| 712 | DWORD x7, | 
|---|
| 713 | DWORD x8) | 
|---|
| 714 | { | 
|---|
| 715 | dprintf(("NTDLL: NtCreateMailslotFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 716 | x1, | 
|---|
| 717 | x2, | 
|---|
| 718 | x3, | 
|---|
| 719 | x4, | 
|---|
| 720 | x5, | 
|---|
| 721 | x6, | 
|---|
| 722 | x7, | 
|---|
| 723 | x8)); | 
|---|
| 724 |  | 
|---|
| 725 | return 0; | 
|---|
| 726 | } | 
|---|
| 727 |  | 
|---|
| 728 |  | 
|---|
| 729 | /****************************************************************************** | 
|---|
| 730 | * NtQuerySystemInformation [NTDLL.168] | 
|---|
| 731 | * | 
|---|
| 732 | * ARGUMENTS: | 
|---|
| 733 | *  SystemInformationClass               Index to a certain information structure | 
|---|
| 734 | * SystemTimeAdjustmentInformation       SYSTEM_TIME_ADJUSTMENT | 
|---|
| 735 | * SystemCacheInformation                   SYSTEM_CACHE_INFORMATION | 
|---|
| 736 | * SystemConfigurationInformation        CONFIGURATION_INFORMATION | 
|---|
| 737 | * observed (class/len): | 
|---|
| 738 | *    0x0/0x2c | 
|---|
| 739 | *    0x12/0x18 | 
|---|
| 740 | *    0x2/0x138 | 
|---|
| 741 | *    0x8/0x600 | 
|---|
| 742 | *  SystemInformation                    caller supplies storage for the information structure | 
|---|
| 743 | *  Length     size of the structure | 
|---|
| 744 | *  ResultLength  Data written | 
|---|
| 745 | */ | 
|---|
| 746 | NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, | 
|---|
| 747 | PVOID                    SystemInformation, | 
|---|
| 748 | ULONG                    Length, | 
|---|
| 749 | PULONG                   ResultLength) | 
|---|
| 750 | { | 
|---|
| 751 | dprintf(("NTDLL: NtQuerySystemInformation(%08xh,%08xh,%08xh,%08xh) not implemented.\n", | 
|---|
| 752 | SystemInformationClass, | 
|---|
| 753 | SystemInformation, | 
|---|
| 754 | Length, | 
|---|
| 755 | ResultLength)); | 
|---|
| 756 |  | 
|---|
| 757 | ZeroMemory (SystemInformation, Length); | 
|---|
| 758 | return 0; | 
|---|
| 759 | } | 
|---|
| 760 |  | 
|---|
| 761 |  | 
|---|
| 762 | /****************************************************************************** | 
|---|
| 763 | *  NtCreatePagingFile                      [NTDLL] | 
|---|
| 764 | */ | 
|---|
| 765 | NTSTATUS WINAPI NtCreatePagingFile(PUNICODE_STRING PageFileName, | 
|---|
| 766 | ULONG MinimumSize, | 
|---|
| 767 | ULONG MaximumSize, | 
|---|
| 768 | PULONG ActualSize) | 
|---|
| 769 | { | 
|---|
| 770 | dprintf(("NTDLL: NtCreatePagingFile(%08xh, %08xh, %08xh, %08xh) not implemented.\n", | 
|---|
| 771 | PageFileName, | 
|---|
| 772 | MinimumSize, | 
|---|
| 773 | MaximumSize, | 
|---|
| 774 | ActualSize)); | 
|---|
| 775 |  | 
|---|
| 776 | return 0; | 
|---|
| 777 | } | 
|---|
| 778 |  | 
|---|
| 779 |  | 
|---|
| 780 | /****************************************************************************** | 
|---|
| 781 | *  NtDisplayString                               [NTDLL.95] | 
|---|
| 782 | * | 
|---|
| 783 | * writes a string to the nt-textmode screen eg. during startup | 
|---|
| 784 | */ | 
|---|
| 785 | NTSTATUS WINAPI NtDisplayString (PUNICODE_STRING string) | 
|---|
| 786 | { | 
|---|
| 787 | dprintf(("NTDLL: NtDisplayString(%08xh\n", | 
|---|
| 788 | string)); | 
|---|
| 789 |  | 
|---|
| 790 | WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), | 
|---|
| 791 | string->Buffer, | 
|---|
| 792 | string->Length, | 
|---|
| 793 | 0, | 
|---|
| 794 | 0); | 
|---|
| 795 |  | 
|---|
| 796 | return 0; | 
|---|
| 797 | } | 
|---|