Changeset 4658 for trunk/src/kernel32
- Timestamp:
- Nov 21, 2000, 12:36:09 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r4587 r4658 1 ; $Id: KERNEL32.DEF,v 1.9 3 2000-11-13 06:48:54 phallerExp $1 ; $Id: KERNEL32.DEF,v 1.94 2000-11-21 11:35:07 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 1083 1083 1084 1084 _GetThreadTEB@0 @1234 1085 _GetThreadTHDB@0 @1235 1086 _GetTHDBFromThreadId@4 @1255 1087 _GetTHDBFromThreadHandle@4 @1256 1085 _GetTEBFromThreadId@4 @1255 1086 _GetTEBFromThreadHandle@4 @1256 1088 1087 1089 1088 ; HEAP Management (heap.cpp, heapstring.cpp) -
trunk/src/kernel32/hmtoken.cpp
r2802 r4658 1 /* $Id: hmtoken.cpp,v 1. 3 2000-02-16 14:24:00sandervl Exp $ */1 /* $Id: hmtoken.cpp,v 1.4 2000-11-21 11:35:08 sandervl Exp $ */ 2 2 3 3 /* … … 52 52 BOOL OpenAsSelf) 53 53 { 54 T HDB *thdb = GetTHDBFromThreadHandle(ThreadHandle);54 TEB *teb = GetTEBFromThreadHandle(ThreadHandle); 55 55 56 if(t hdb == 0) {56 if(teb == 0) { 57 57 dprintf(("HMDeviceTokenClass::OpenThreadToken: thread handle %x not found", ThreadHandle)); 58 58 return ERROR_INVALID_PARAMETER; 59 59 } 60 pHMHandleData->dwUserData = (DWORD)&t hdb->threadinfo;60 pHMHandleData->dwUserData = (DWORD)&teb->o.odin.threadinfo; 61 61 pHMHandleData->dwInternalType = HMTYPE_THREADTOKEN; 62 62 return STATUS_SUCCESS; -
trunk/src/kernel32/lang.cpp
r4575 r4658 1 /* $Id: lang.cpp,v 1.3 0 2000-11-09 18:18:10sandervl Exp $ */1 /* $Id: lang.cpp,v 1.31 2000-11-21 11:35:08 sandervl Exp $ */ 2 2 /* 3 3 * Win32 language API functions for OS/2 … … 888 888 LCID WIN32API GetThreadLocale() 889 889 { 890 T HDB *thdb = GetThreadTHDB();891 892 if(t hdb == NULL) {893 dprintf(("KERNEL32: ERROR: GetThreadLocale t hdb == NULL!"));890 TEB *teb = GetThreadTEB(); 891 892 if(teb == NULL) { 893 dprintf(("KERNEL32: ERROR: GetThreadLocale teb == NULL!")); 894 894 return FALSE; 895 895 } 896 dprintf(("KERNEL32: GetThreadLocale returned %x", t hdb->lcid));897 return(t hdb->lcid);896 dprintf(("KERNEL32: GetThreadLocale returned %x", teb->o.odin.lcid)); 897 return(teb->o.odin.lcid); 898 898 } 899 899 //****************************************************************************** … … 901 901 BOOL WIN32API SetThreadLocale(LCID locale) 902 902 { 903 T HDB *thdb = GetThreadTHDB();903 TEB *teb = GetThreadTEB(); 904 904 905 if(t hdb == NULL) {906 dprintf(("KERNEL32: ERROR SetThreadLocale t hdb == NULL!"));905 if(teb == NULL) { 906 dprintf(("KERNEL32: ERROR SetThreadLocale teb == NULL!")); 907 907 return FALSE; 908 908 } 909 909 dprintf(("KERNEL32: SetThreadLocale %x", locale)); 910 t hdb->lcid = locale;910 teb->o.odin.lcid = locale; 911 911 return(TRUE); 912 912 } -
trunk/src/kernel32/misc.cpp
r4496 r4658 1 /* $Id: misc.cpp,v 1.2 7 2000-10-18 17:09:33sandervl Exp $ */1 /* $Id: misc.cpp,v 1.28 2000-11-21 11:35:08 sandervl Exp $ */ 2 2 3 3 /* … … 289 289 if(fLogging && flog && (dwEnableLogging > 0)) 290 290 { 291 T HDB *thdb = GetThreadTHDB();291 TEB *teb = GetThreadTEB(); 292 292 293 293 va_start(argptr, tekst); 294 if(t hdb) {295 thdb->logfile = (DWORD)flog;294 if(teb) { 295 teb->o.odin.logfile = (DWORD)flog; 296 296 if(sel == 0x150b && !fIsOS2Image) { 297 fprintf(flog, "t%d: (FS=150B) ", t hdb->threadId);298 } 299 else fprintf(flog, "t%d: ", t hdb->threadId);297 fprintf(flog, "t%d: (FS=150B) ", teb->o.odin.threadId); 298 } 299 else fprintf(flog, "t%d: ", teb->o.odin.threadId); 300 300 } 301 301 vfprintf(flog, tekst, argptr); 302 if(t hdb) thdb->logfile = 0;302 if(teb) teb->o.odin.logfile = 0; 303 303 va_end(argptr); 304 304 … … 342 342 if(fLogging && flog && (dwEnableLogging > 0)) 343 343 { 344 T HDB *thdb = GetThreadTHDB();344 TEB *teb = GetThreadTEB(); 345 345 346 346 va_start(argptr, tekst); 347 if(t hdb) {348 t hdb->logfile = (DWORD)flog;347 if(teb) { 348 teb->o.odin.logfile = (DWORD)flog; 349 349 } 350 350 vfprintf(flog, tekst, argptr); 351 if(t hdb) thdb->logfile = 0;351 if(teb) teb->o.odin.logfile = 0; 352 352 va_end(argptr); 353 353 } … … 376 376 if(fLogging && logfile) 377 377 { 378 T HDB *thdb = GetThreadTHDB();378 TEB *teb = GetThreadTEB(); 379 379 380 380 va_start(argptr, tekst); 381 if(t hdb) {382 t hdb->logfile = (DWORD)flog;381 if(teb) { 382 teb->o.odin.logfile = (DWORD)flog; 383 383 } 384 384 vfprintf((FILE *)logfile, tekst, argptr); 385 if(t hdb) thdb->logfile = 0;385 if(teb) teb->o.odin.logfile = 0; 386 386 va_end(argptr); 387 387 … … 400 400 void LogException(int state) 401 401 { 402 T HDB *thdb = GetThreadTHDB();402 TEB *teb = GetThreadTEB(); 403 403 USHORT *lock; 404 404 405 if(!t hdb) return;406 407 if(t hdb->logfile) {405 if(!teb) return; 406 407 if(teb->o.odin.logfile) { 408 408 if(state == ENTER_EXCEPTION) { 409 409 #if (__IBMCPP__ == 300) || (__IBMC__ == 300) 410 lock = (USHORT *)(t hdb->logfile+0x1C);410 lock = (USHORT *)(teb->o.odin.logfile+0x1C); 411 411 #else 412 412 #error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!! … … 416 416 else { //LEAVE_EXCEPTION 417 417 #if (__IBMCPP__ == 300) || (__IBMC__ == 300) 418 lock = (USHORT *)(t hdb->logfile+0x1C);418 lock = (USHORT *)(teb->o.odin.logfile+0x1C); 419 419 #else 420 420 #error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!! … … 431 431 void CheckLogException() 432 432 { 433 T HDB *thdb = GetThreadTHDB();433 TEB *teb = GetThreadTEB(); 434 434 USHORT *lock; 435 435 436 if(!t hdb) return;437 438 if(t hdb->logfile) {436 if(!teb) return; 437 438 if(teb->o.odin.logfile) { 439 439 //oops, exception in vfprintf; let's clear the lock count 440 440 #if (__IBMCPP__ == 300) || (__IBMC__ == 300) 441 lock = (USHORT *)(t hdb->logfile+0x1C);441 lock = (USHORT *)(teb->o.odin.logfile+0x1C); 442 442 #else 443 443 #error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!! -
trunk/src/kernel32/oslibexcept.cpp
r4229 r4658 1 /* $Id: oslibexcept.cpp,v 1. 4 2000-09-09 08:59:55sandervl Exp $ */1 /* $Id: oslibexcept.cpp,v 1.5 2000-11-21 11:35:08 sandervl Exp $ */ 2 2 /* 3 3 * Exception handler util. procedures … … 128 128 } 129 129 130 TEB *winteb = GetThreadTEB(); 131 THDB *thdb = (THDB *)(winteb+1); 130 TEB *winteb = GetThreadTEB(); 132 131 133 132 if(pContextRec->ContextFlags & CONTEXT_SEGMENTS) { … … 136 135 // This resets FS to 0x150B - we DON'T want that!! 137 136 // wincontextrec.SegFs = pContextRec->ctx_SegFs; 138 wincontextrec.SegFs = thdb->teb_sel;137 wincontextrec.SegFs = winteb->teb_sel; 139 138 wincontextrec.SegEs = pContextRec->ctx_SegEs; 140 139 wincontextrec.SegDs = pContextRec->ctx_SegDs; … … 153 152 // fuck up the Win32 exception handlers. They could end up using the wrong 154 153 // exception chain if they access FS:[0] directly. 155 DWORD oldsel = SetReturnFS( thdb->teb_sel);154 DWORD oldsel = SetReturnFS(winteb->teb_sel); 156 155 157 156 switch(pReportRec->ExceptionNum) { -
trunk/src/kernel32/process.cpp
r4496 r4658 1 /* $Id: process.cpp,v 1. 7 2000-10-18 17:09:33sandervl Exp $ */1 /* $Id: process.cpp,v 1.8 2000-11-21 11:35:09 sandervl Exp $ */ 2 2 3 3 /* … … 322 322 case GPD_THDB: 323 323 if ( process != PROCESS_Current() ) return 0; 324 return (DWORD)GetThreadT HDB();324 return (DWORD)GetThreadTEB() + 0x30; 325 325 326 326 case GPD_PDB: -
trunk/src/kernel32/thread.cpp
r3422 r4658 1 /* $Id: thread.cpp,v 1.2 5 2000-04-18 20:06:38sandervl Exp $ */1 /* $Id: thread.cpp,v 1.26 2000-11-21 11:35:09 sandervl Exp $ */ 2 2 3 3 /* … … 48 48 HANDLE WIN32API GetCurrentThread() 49 49 { 50 T HDB *thdb;50 TEB *teb; 51 51 52 t hdb = GetThreadTHDB();53 if(t hdb == 0) {52 teb = GetThreadTEB(); 53 if(teb == 0) { 54 54 SetLastError(ERROR_INVALID_HANDLE); //todo 55 55 return 0; 56 56 } 57 return t hdb->hThread;57 return teb->o.odin.hThread; 58 58 } 59 59 //****************************************************************************** … … 62 62 { 63 63 EXCEPTION_FRAME *exceptFrame; 64 T HDB *thdb;64 TEB *teb; 65 65 66 66 dprintf(("ExitThread %x (%x)", GetCurrentThread(), exitcode)); 67 67 68 t hdb = GetThreadTHDB();69 if(t hdb != 0) {70 exceptFrame = (EXCEPTION_FRAME *)t hdb->exceptFrame;68 teb = GetThreadTEB(); 69 if(teb != 0) { 70 exceptFrame = (EXCEPTION_FRAME *)teb->o.odin.exceptFrame; 71 71 } 72 72 else DebugInt3(); … … 113 113 winteb->flags = me->dwFlags; 114 114 115 THDB *thdb = (THDB *)(winteb+1); 116 thdb->entry_point = (void *)winthread; 117 thdb->entry_arg = (void *)userdata; 118 thdb->hThread = hThread; 115 winteb->entry_point = (void *)winthread; 116 winteb->entry_arg = (void *)userdata; 117 winteb->o.odin.hThread = hThread; 119 118 120 thdb->hab = OSLibWinInitialize();121 thdb->hmq = OSLibWinQueryMsgQueue(thdb->hab);122 dprintf(("Win32ThreadProc: hab %x hmq %x", thdb->hab, thdb->hmq));119 winteb->o.odin.hab = OSLibWinInitialize(); 120 winteb->o.odin.hmq = OSLibWinQueryMsgQueue(winteb->o.odin.hab); 121 dprintf(("Win32ThreadProc: hab %x hmq %x", winteb->o.odin.hab, winteb->o.odin.hmq)); 123 122 124 123 //Note: The Win32 exception structure referenced by FS:[0] is the same 125 124 // in OS/2 126 125 OS2SetExceptionHandler((void *)&exceptFrame); 127 thdb->exceptFrame = (ULONG)&exceptFrame;126 winteb->o.odin.exceptFrame = (ULONG)&exceptFrame; 128 127 129 128 SetWin32TIB(); … … 137 136 138 137 HMSetThreadTerminated(GetCurrentThread()); 139 thdb->exceptFrame = 0;138 winteb->o.odin.exceptFrame = 0; 140 139 Win32DllBase::detachThreadFromAllDlls(); //send DLL_THREAD_DETACH message to all dlls 141 140 Win32DllBase::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls -
trunk/src/kernel32/windllbase.cpp
r4545 r4658 1 /* $Id: windllbase.cpp,v 1.2 1 2000-10-30 16:38:54sandervl Exp $ */1 /* $Id: windllbase.cpp,v 1.22 2000-11-21 11:35:09 sandervl Exp $ */ 2 2 3 3 /* … … 387 387 WINEXCEPTION_FRAME exceptFrame; 388 388 USHORT sel; 389 T HDB *thdb;389 TEB *teb; 390 390 BOOL rc, fSetExceptionHandler; 391 391 … … 395 395 fAttachedToProcess = TRUE; 396 396 397 t hdb = GetThreadTHDB();398 fSetExceptionHandler = (!t hdb || thdb->teb_sel != GetFS());397 teb = GetThreadTEB(); 398 fSetExceptionHandler = (!teb || teb->teb_sel != GetFS()); 399 399 400 400 //Note: The Win32 exception structure references by FS:[0] is the same … … 440 440 } 441 441 else 442 if(t hdb) {443 if(t hdb->teb_sel != GetFS()) {442 if(teb) { 443 if(teb->teb_sel != GetFS()) { 444 444 dprintf(("Win32DllBase::attachProcess: FS was changed by dll entrypoint!!!!")); 445 445 DebugInt3(); -
trunk/src/kernel32/wintls.cpp
r4481 r4658 1 /* $Id: wintls.cpp,v 1.1 5 2000-10-11 07:22:29 sandervl Exp $ */1 /* $Id: wintls.cpp,v 1.16 2000-11-21 11:35:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 TLS API functions … … 140 140 { 141 141 DWORD index = -1; 142 T HDB *thdb;142 TEB *teb; 143 143 PDB *pdb; 144 144 DWORD mask, tibidx; 145 145 int i; 146 146 147 t hdb = GetThreadTHDB();147 teb = GetThreadTEB(); 148 148 pdb = PROCESS_Current(); 149 149 … … 167 167 } 168 168 LeaveCriticalSection(&pdb->crit_section); 169 t hdb->tls_array[index] = 0;169 teb->tls_array[index] = 0; 170 170 171 171 dprintf(("KERNEL32: TlsAlloc returned %d", index)); … … 176 176 BOOL WIN32API TlsFree(DWORD index) 177 177 { 178 T HDB *thdb;178 TEB *teb; 179 179 PDB *pdb; 180 180 int tlsidx; … … 188 188 } 189 189 190 t hdb = GetThreadTHDB();191 pdb 190 teb = GetThreadTEB(); 191 pdb = PROCESS_Current(); 192 192 193 193 EnterCriticalSection(&pdb->crit_section); … … 200 200 LeaveCriticalSection(&pdb->crit_section); 201 201 pdb->tls_bits[tlsidx] &= ~mask; 202 t hdb->tls_array[index] = 0;202 teb->tls_array[index] = 0; 203 203 SetLastError(ERROR_SUCCESS); 204 204 return TRUE; … … 213 213 { 214 214 LPVOID rc; 215 T HDB *thdb;215 TEB *teb; 216 216 217 217 if(index >= TLS_MINIMUM_AVAILABLE) … … 222 222 SetLastError(ERROR_SUCCESS); 223 223 224 t hdb = GetThreadTHDB();225 rc = t hdb->tls_array[index];224 teb = GetThreadTEB(); 225 rc = teb->tls_array[index]; 226 226 227 227 dprintf2(("KERNEL32: TlsGetValue %d returned %X\n", index, rc)); … … 232 232 BOOL WIN32API TlsSetValue(DWORD index, LPVOID val) 233 233 { 234 T HDB *thdb;234 TEB *teb; 235 235 236 236 dprintf2(("KERNEL32: TlsSetValue %d %x", index, val)); … … 242 242 SetLastError(ERROR_SUCCESS); 243 243 244 t hdb = GetThreadTHDB();245 t hdb->tls_array[index] = val;244 teb = GetThreadTEB(); 245 teb->tls_array[index] = val; 246 246 return TRUE; 247 247 } -
trunk/src/kernel32/wprocess.cpp
r4555 r4658 1 /* $Id: wprocess.cpp,v 1.10 7 2000-11-05 13:40:47sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.108 2000-11-21 11:35:09 sandervl Exp $ */ 2 2 3 3 /* … … 71 71 72 72 //list of thread database structures 73 static T HDB*threadList = 0;73 static TEB *threadList = 0; 74 74 static VMutex threadListMutex; 75 75 … … 100 100 //****************************************************************************** 101 101 //****************************************************************************** 102 THDB *WIN32API GetThreadTHDB() 103 { 104 TEB *winteb; 105 THDB *thdb; 106 107 if(TIBFlatPtr == NULL) 108 return 0; 109 110 winteb = (TEB *)*TIBFlatPtr; 111 if(winteb == NULL) { 112 return NULL; 113 } 114 thdb = (THDB *)(winteb+1); 115 116 return thdb; 117 } 118 //****************************************************************************** 119 //****************************************************************************** 120 THDB *WIN32API GetTHDBFromThreadId(ULONG threadId) 121 { 122 THDB *thdb = threadList; 102 TEB *WIN32API GetTEBFromThreadId(ULONG threadId) 103 { 104 TEB *teb = threadList; 123 105 124 106 threadListMutex.enter(); 125 while(t hdb) {126 if(t hdb->threadId == threadId) {107 while(teb) { 108 if(teb->o.odin.threadId == threadId) { 127 109 break; 128 110 } 129 t hdb = thdb->next;111 teb = teb->o.odin.next; 130 112 } 131 113 threadListMutex.leave(); 132 return t hdb;133 } 134 //****************************************************************************** 135 //****************************************************************************** 136 T HDB *WIN32API GetTHDBFromThreadHandle(HANDLE hThread)137 { 138 T HDB *thdb = threadList;114 return teb; 115 } 116 //****************************************************************************** 117 //****************************************************************************** 118 TEB *WIN32API GetTEBFromThreadHandle(HANDLE hThread) 119 { 120 TEB *teb = threadList; 139 121 140 122 threadListMutex.enter(); 141 while(t hdb) {142 if(t hdb->hThread == hThread) {123 while(teb) { 124 if(teb->o.odin.hThread == hThread) { 143 125 break; 144 126 } 145 t hdb = thdb->next;127 teb = teb->o.odin.next; 146 128 } 147 129 threadListMutex.leave(); 148 return t hdb;130 return teb; 149 131 } 150 132 //****************************************************************************** … … 154 136 { 155 137 TEB *winteb; 156 THDB *thdb;157 138 ULONG hThreadMain; 158 139 USHORT tibsel; … … 170 151 hThreadMain = HMCreateThread(NULL, 0, 0, 0, 0, 0, TRUE); 171 152 } 172 if(OSLibAllocSel( PAGE_SIZE, &tibsel) == FALSE)153 if(OSLibAllocSel(sizeof(TEB), &tibsel) == FALSE) 173 154 { 174 155 dprintf(("InitializeTIB: selector alloc failed!!")); … … 183 164 return NULL; 184 165 } 185 memset(winteb, 0, PAGE_SIZE); 186 thdb = (THDB *)(winteb+1); 166 memset(winteb, 0, sizeof(TEB)); 187 167 *TIBFlatPtr = (DWORD)winteb; 188 168 … … 195 175 winteb->flags = TEBF_WIN32; /* 1c Flags */ 196 176 winteb->queue = 0; /* 28 Message queue */ 197 winteb->tls_ptr = & thdb->tls_array[0];/* 2c Pointer to TLS array */177 winteb->tls_ptr = &winteb->tls_array[0]; /* 2c Pointer to TLS array */ 198 178 winteb->process = &ProcessPDB; /* 30 owning process (used by NT3.51 applets)*/ 199 179 200 memcpy(&thdb->teb, winteb, sizeof(TEB)); 201 thdb->process = &ProcessPDB; 202 thdb->exit_code = 0x103; /* STILL_ACTIVE */ 203 thdb->teb_sel = tibsel; 204 thdb->OrgTIBSel = GetFS(); 205 thdb->pWsockData = NULL; 206 thdb->threadId = GetCurrentThreadId(); 180 winteb->process = &ProcessPDB; 181 winteb->exit_code = 0x103; /* STILL_ACTIVE */ 182 winteb->teb_sel = tibsel; 183 winteb->o.odin.OrgTIBSel = GetFS(); 184 winteb->o.odin.pWsockData = NULL; 185 winteb->o.odin.threadId = GetCurrentThreadId(); 207 186 if(fMainThread) { 208 thdb->hThread = hThreadMain;209 } 210 else thdb->hThread = GetCurrentThread();211 thdb->lcid = GetUserDefaultLCID();187 winteb->o.odin.hThread = hThreadMain; 188 } 189 else winteb->o.odin.hThread = GetCurrentThread(); 190 winteb->o.odin.lcid = GetUserDefaultLCID(); 212 191 213 192 threadListMutex.enter(); 214 T HDB *thdblast = threadList;215 if(!t hdblast) {216 threadList = thdb;193 TEB *teblast = threadList; 194 if(!teblast) { 195 threadList = winteb; 217 196 } 218 197 else { 219 while(t hdblast->next) {220 t hdblast = thdblast->next;221 } 222 t hdblast->next = thdb;223 } 224 thdb->next= NULL;198 while(teblast->o.odin.next) { 199 teblast = teblast->o.odin.next; 200 } 201 teblast->o.odin.next = winteb; 202 } 203 winteb->o.odin.next = NULL; 225 204 threadListMutex.leave(); 226 205 227 206 if(OSLibGetPIB(PIB_TASKTYPE) == TASKTYPE_PM) 228 207 { 229 thdb->flags = 0; //todo gui230 } 231 else thdb->flags = 0; //todo textmode208 winteb->flags = 0; //todo gui 209 } 210 else winteb->flags = 0; //todo textmode 232 211 233 212 //Initialize thread security objects (TODO: Not complete) … … 240 219 } 241 220 SID_IDENTIFIER_AUTHORITY sidIdAuth = {0}; 242 thdb->threadinfo.dwType = SECTYPE_PROCESS | SECTYPE_INITIALIZED;243 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, & thdb->threadinfo.SidUser.User.Sid);244 thdb->threadinfo.SidUser.User.Attributes = 0; //?????????245 246 thdb->threadinfo.pTokenGroups = (TOKEN_GROUPS*)malloc(sizeof(TOKEN_GROUPS));247 thdb->threadinfo.pTokenGroups->GroupCount = 1;248 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, & thdb->threadinfo.PrimaryGroup.PrimaryGroup);249 thdb->threadinfo.pTokenGroups->Groups[0].Sid = thdb->threadinfo.PrimaryGroup.PrimaryGroup;250 thdb->threadinfo.pTokenGroups->Groups[0].Attributes = 0; //????221 winteb->o.odin.threadinfo.dwType = SECTYPE_PROCESS | SECTYPE_INITIALIZED; 222 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &winteb->o.odin.threadinfo.SidUser.User.Sid); 223 winteb->o.odin.threadinfo.SidUser.User.Attributes = 0; //????????? 224 225 winteb->o.odin.threadinfo.pTokenGroups = (TOKEN_GROUPS*)malloc(sizeof(TOKEN_GROUPS)); 226 winteb->o.odin.threadinfo.pTokenGroups->GroupCount = 1; 227 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &winteb->o.odin.threadinfo.PrimaryGroup.PrimaryGroup); 228 winteb->o.odin.threadinfo.pTokenGroups->Groups[0].Sid = winteb->o.odin.threadinfo.PrimaryGroup.PrimaryGroup; 229 winteb->o.odin.threadinfo.pTokenGroups->Groups[0].Attributes = 0; //???? 251 230 // pPrivilegeSet = NULL; 252 231 // pTokenPrivileges= NULL; … … 254 233 // DefaultDACL = {0}; 255 234 // TokenSource = {0}; 256 thdb->threadinfo.TokenType = TokenPrimary;235 winteb->o.odin.threadinfo.TokenType = TokenPrimary; 257 236 258 237 if(fMainThread) … … 293 272 SHORT orgtibsel; 294 273 TEB *winteb; 295 THDB *thdb;296 274 297 275 dprintf(("DestroyTIB: FS = %x", GetFS())); … … 300 278 winteb = (TEB *)*TIBFlatPtr; 301 279 if(winteb) { 302 thdb = (THDB *)(winteb+1); 303 orgtibsel = thdb->OrgTIBSel; 280 orgtibsel = winteb->o.odin.OrgTIBSel; 281 282 dprintf(("DestroyTIB: OSLibFreeSel %x", winteb->teb_sel)); 304 283 305 284 threadListMutex.enter(); 306 T HDB *curthdb = threadList;307 if(curt hdb == thdb) {308 threadList = thdb->next;285 TEB *curteb = threadList; 286 if(curteb == winteb) { 287 threadList = winteb->o.odin.next; 309 288 } 310 289 else { 311 while(curt hdb->next != thdb) {312 curt hdb = curthdb->next;313 if(curt hdb == NULL) {314 dprintf(("DestroyTIB: couldn't find t hdb %x", thdb));290 while(curteb->o.odin.next != winteb) { 291 curteb = curteb->o.odin.next; 292 if(curteb == NULL) { 293 dprintf(("DestroyTIB: couldn't find teb %x", winteb)); 315 294 DebugInt3(); 316 295 break; 317 296 } 318 297 } 319 if(curt hdb) {320 curt hdb->next = thdb->next;298 if(curteb) { 299 curteb->o.odin.next = winteb->o.odin.next; 321 300 } 322 301 } … … 327 306 328 307 //And free our own 329 OSLibFreeSel( thdb->teb_sel);308 OSLibFreeSel(winteb->teb_sel); 330 309 331 310 *TIBFlatPtr = 0; … … 348 327 SHORT orgtibsel; 349 328 TEB *winteb; 350 THDB *thdb;351 329 352 330 //If we're running an Odin32 OS/2 application (not converted!), then we … … 358 336 winteb = (TEB *)*TIBFlatPtr; 359 337 if(winteb) { 360 thdb = (THDB *)(winteb+1); 361 orgtibsel = thdb->OrgTIBSel; 338 orgtibsel = winteb->o.odin.OrgTIBSel; 362 339 363 340 //Restore our original FS selector … … 371 348 SHORT win32tibsel; 372 349 TEB *winteb; 373 THDB *thdb;374 350 375 351 //If we're running an Odin32 OS/2 application (not converted!), then we … … 381 357 winteb = (TEB *)*TIBFlatPtr; 382 358 if(winteb) { 383 thdb = (THDB *)(winteb+1); 384 win32tibsel = thdb->teb_sel; 359 win32tibsel = winteb->teb_sel; 385 360 386 361 //Restore our win32 FS selector … … 395 370 return GetFS(); 396 371 } 397 thdb = (THDB *)(winteb+1); 398 win32tibsel = thdb->teb_sel; 372 win32tibsel = winteb->teb_sel; 399 373 400 374 //Restore our win32 FS selector … … 1538 1512 LPPROCESS_INFORMATION lpProcessInfo ) 1539 1513 { 1540 T HDB *pThreadDB = (THDB*)GetThreadTHDB();1514 TEB *pThreadDB = (TEB*)GetThreadTEB(); 1541 1515 char *cmdline = NULL; 1542 1516 BOOL rc; … … 1557 1531 if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL) 1558 1532 { 1559 if(pThreadDB-> pidDebuggee != 0)1533 if(pThreadDB->o.odin.pidDebuggee != 0) 1560 1534 { 1561 1535 // TODO: handle this … … 1564 1538 else 1565 1539 { 1566 pThreadDB-> pidDebuggee = lpProcessInfo->dwProcessId;1567 OSLibStartDebugger((ULONG*)&pThreadDB-> pidDebuggee);1540 pThreadDB->o.odin.pidDebuggee = lpProcessInfo->dwProcessId; 1541 OSLibStartDebugger((ULONG*)&pThreadDB->o.odin.pidDebuggee); 1568 1542 } 1569 1543 } 1570 else pThreadDB-> pidDebuggee = 0;1544 else pThreadDB->o.odin.pidDebuggee = 0; 1571 1545 1572 1546 return(TRUE); … … 1648 1622 if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL) 1649 1623 { 1650 if(pThreadDB-> pidDebuggee != 0)1624 if(pThreadDB->o.odin.pidDebuggee != 0) 1651 1625 { 1652 1626 // TODO: handle this … … 1655 1629 else 1656 1630 { 1657 pThreadDB-> pidDebuggee = lpProcessInfo->dwProcessId;1658 OSLibStartDebugger((ULONG*)&pThreadDB-> pidDebuggee);1631 pThreadDB->o.odin.pidDebuggee = lpProcessInfo->dwProcessId; 1632 OSLibStartDebugger((ULONG*)&pThreadDB->o.odin.pidDebuggee); 1659 1633 } 1660 1634 } 1661 1635 else 1662 pThreadDB-> pidDebuggee = 0;1636 pThreadDB->o.odin.pidDebuggee = 0; 1663 1637 } 1664 1638 if(cmdline)
Note:
See TracChangeset
for help on using the changeset viewer.