- Timestamp:
- Dec 18, 1999, 10:45:13 PM (26 years ago)
- Location:
- trunk/src/NTDLL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/NTDLL/nt.cpp
r2122 r2128 1 /* $Id: nt.cpp,v 1. 3 1999-12-18 20:01:13 sandervl Exp $ */1 /* $Id: nt.cpp,v 1.4 1999-12-18 21:45:13 sandervl Exp $ */ 2 2 3 3 … … 15 15 #include <string.h> 16 16 #include <time.h> 17 #include <os2win.h> 18 #include <handlemanager.h> 17 19 18 20 #include "ntdll.h" … … 258 260 PHANDLE TokenHandle) 259 261 { 260 dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not implemented.\n",262 dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not correctly implemented.\n", 261 263 ProcessHandle, 262 264 DesiredAccess, 263 265 TokenHandle)); 264 266 265 *TokenHandle = 0xcafe; 266 return 0; 267 if(ProcessHandle == GetCurrentProcess()) { 268 HMOpenProcessToken(ProcessHandle, DesiredAccess, (ULONG)&ProcSecInfo, TokenHandle); 269 return STATUS_SUCCESS; 270 } 271 *TokenHandle = 0; 272 return ERROR_INVALID_HANDLE; 267 273 } 268 274 … … 282 288 TokenHandle)); 283 289 284 *TokenHandle = 0 xcafe;285 return 0;290 *TokenHandle = 0; 291 return ERROR_INVALID_HANDLE; 286 292 } 287 293 … … 321 327 LPDWORD ReturnLength) 322 328 { 323 dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n", 329 PROCESSTHREAD_SECURITYINFO *pSecInfo; 330 331 dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not correctly implemented.\n", 324 332 Token, 325 333 TokenInformationClass, … … 328 336 ReturnLength)); 329 337 338 pSecInfo = (PROCESSTHREAD_SECURITYINFO*)HMHandleGetUserData(Token); 339 if((ULONG)pSecInfo == -1) { 340 return ERROR_INVALID_HANDLE; 341 } 330 342 switch (TokenInformationClass) 331 343 { … … 335 347 return STATUS_BUFFER_TOO_SMALL; 336 348 } 337 mem set(TokenInformation, 0, sizeof(TOKEN_GROUPS));349 memcpy(TokenInformation, (LPVOID)pSecInfo->pTokenGroups, sizeof(TOKEN_GROUPS)); 338 350 break; 339 351 case TokenUser: /* 1 */ -
trunk/src/NTDLL/ntdll.cpp
r2122 r2128 1 /* $Id: ntdll.cpp,v 1. 4 1999-12-18 20:01:14sandervl Exp $ */1 /* $Id: ntdll.cpp,v 1.5 1999-12-18 21:45:13 sandervl Exp $ */ 2 2 3 3 /* … … 38 38 #include <string.h> 39 39 #include <ctype.h> 40 #include "misc.h"40 #include <misc.h> 41 41 #include "unicode.h" 42 42 … … 52 52 //SvL: per process heap for NTDLL 53 53 HANDLE NTDLL_hHeap = 0; 54 55 PROCESSTHREAD_SECURITYINFO ProcSecInfo = {0}; 54 56 55 57 /***************************************************************************** … … 87 89 switch (fdwReason) { 88 90 case DLL_PROCESS_ATTACH: 89 NTDLL_hHeap = HeapCreate(0, 0x10000, 0); 91 { 92 SID_IDENTIFIER_AUTHORITY sidIdAuth = {0}; 93 94 NTDLL_hHeap = HeapCreate(0, 0x10000, 0); 95 96 ProcSecInfo.dwType = SECTYPE_PROCESS; 97 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &ProcSecInfo.SidUser.User.Sid); 98 ProcSecInfo.SidUser.User.Attributes = 0; //????????? 99 100 ProcSecInfo.pTokenGroups = (TOKEN_GROUPS*)Heap_Alloc(sizeof(TOKEN_GROUPS)); 101 ProcSecInfo.pTokenGroups->GroupCount = 1; 102 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &ProcSecInfo.PrimaryGroup.PrimaryGroup); 103 ProcSecInfo.pTokenGroups->Groups[0].Sid = ProcSecInfo.PrimaryGroup.PrimaryGroup; 104 ProcSecInfo.pTokenGroups->Groups[0].Attributes = 0; //???? 105 106 // pPrivilegeSet = NULL; 107 // pTokenPrivileges= NULL; 108 // TokenOwner = {0}; 109 // DefaultDACL = {0}; 110 // TokenSource = {0}; 111 ProcSecInfo.TokenType = TokenPrimary; 90 112 break; 113 } 91 114 case DLL_PROCESS_DETACH: 92 115 HeapDestroy(NTDLL_hHeap); -
trunk/src/NTDLL/ntdll.h
r2122 r2128 1 /* $Id: ntdll.h,v 1. 8 1999-12-18 20:01:14sandervl Exp $ */1 /* $Id: ntdll.h,v 1.9 1999-12-18 21:45:13 sandervl Exp $ */ 2 2 3 3 /* … … 655 655 PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID); 656 656 657 //SvL: Security data for win32 process (nothing fancy; just trying to fool apps 658 // into thinking the security subsystem is in perfect shape. 659 #define SECTYPE_THREAD 0 660 #define SECTYPE_PROCESS 1 661 662 typedef struct { 663 DWORD dwType; 664 TOKEN_USER SidUser; 665 TOKEN_GROUPS *pTokenGroups; 666 PRIVILEGE_SET *pPrivilegeSet; 667 TOKEN_PRIVILEGES *pTokenPrivileges; 668 TOKEN_OWNER TokenOwner; 669 TOKEN_PRIMARY_GROUP PrimaryGroup; 670 TOKEN_DEFAULT_DACL DefaultDACL; 671 TOKEN_SOURCE TokenSource; 672 TOKEN_TYPE TokenType; 673 } PROCESSTHREAD_SECURITYINFO; 674 675 //Per process info; Should probably be stored in process database structure 676 extern PROCESSTHREAD_SECURITYINFO ProcSecInfo; 677 657 678 #ifdef __cplusplus 658 679 }
Note:
See TracChangeset
for help on using the changeset viewer.