- Timestamp:
- Nov 21, 2000, 12:36:09 PM (25 years ago)
- Location:
- trunk/src
- Files:
-
- 17 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) -
trunk/src/user32/HOOK.CPP
r4430 r4658 1 /* $Id: HOOK.CPP,v 1.1 5 2000-10-05 13:47:06sandervl Exp $ */1 /* $Id: HOOK.CPP,v 1.16 2000-11-21 11:36:07 sandervl Exp $ */ 2 2 3 3 /* … … 240 240 MESSAGEQUEUE *queue; 241 241 HANDLE hook = 0; 242 T HDB *thdb;243 244 t hdb = GetTHDBFromThreadId(threadId);245 if(t hdb) {246 hook = t hdb->hooks[id - WH_MINHOOK];242 TEB *teb; 243 244 teb = GetTEBFromThreadId(threadId); 245 if(teb) { 246 hook = teb->o.odin.hooks[id - WH_MINHOOK]; 247 247 } 248 248 if (!hook) hook = HOOK_systemHooks[id - WH_MINHOOK]; … … 261 261 { 262 262 HOOKDATA *data; 263 T HDB *thdb;263 TEB *teb; 264 264 265 265 if ((id < WH_MINHOOK) || (id > WH_MAXHOOK) || !proc ) … … 301 301 if(dwThreadId) 302 302 { 303 t hdb = GetTHDBFromThreadId(dwThreadId);304 if(!t hdb) {303 teb = GetTEBFromThreadId(dwThreadId); 304 if(!teb) { 305 305 dprintf(("HOOK_SetHook: can't find thread database for thread %x", dwThreadId)); 306 306 return 0; 307 307 } 308 308 threadHookMutex.enter(); 309 data->next = t hdb->hooks[id - WH_MINHOOK];310 t hdb->hooks[id - WH_MINHOOK] = (DWORD)data;309 data->next = teb->o.odin.hooks[id - WH_MINHOOK]; 310 teb->o.odin.hooks[id - WH_MINHOOK] = (DWORD)data; 311 311 threadHookMutex.leave(); 312 312 } … … 331 331 { 332 332 HOOKDATA **prevHook; 333 T HDB *thdb;333 TEB *teb; 334 334 335 335 dprintf(("Removing hook %08x\n", data)); … … 351 351 if (data->ownerThread) 352 352 { 353 t hdb = GetTHDBFromThreadId(data->ownerThread);354 if(!t hdb) {353 teb = GetTEBFromThreadId(data->ownerThread); 354 if(!teb) { 355 355 dprintf(("HOOK_RemoveHook: can't find thread database for thread %x", data->ownerThread)); 356 356 return FALSE; 357 357 } 358 358 threadHookMutex.enter(); 359 prevHook = (HOOKDATA **)&t hdb->hooks[data->id - WH_MINHOOK];359 prevHook = (HOOKDATA **)&teb->o.odin.hooks[data->id - WH_MINHOOK]; 360 360 } 361 361 else { -
trunk/src/user32/oslibmsg.cpp
r3525 r4658 1 /* $Id: oslibmsg.cpp,v 1.3 3 2000-05-12 18:09:40sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.34 2000-11-21 11:36:08 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 78 78 WM_CHAR, WINWM_KEYLAST, 79 79 80 WM_COMMAND, WINWM_COMMAND,81 WM_SYSCOMMAND, WINWM_SYSCOMMAND,82 80 // 83 81 WM_TIMER, WINWM_TIMER, 84 WM_INITMENU, WINWM_INITMENU, 82 85 83 // 86 84 WM_MOUSEMOVE, WINWM_MOUSEMOVE, … … 99 97 #define MAX_MSGTRANSTAB (sizeof(MsgTransTab)/sizeof(MsgTransTab[0])) 100 98 101 LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);102 103 99 //****************************************************************************** 104 100 //****************************************************************************** … … 134 130 } 135 131 136 return 0; 132 //not found, probaby WIN32APP_POSTMSG 133 return WIN32APP_POSTMSG; 137 134 } 138 135 //****************************************************************************** … … 149 146 LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode) 150 147 { 151 T HDB *thdb;148 TEB *teb; 152 149 QMSG os2msg; 153 150 LONG rc; 154 151 155 t hdb = GetThreadTHDB();156 if(t hdb == NULL) {152 teb = GetThreadTEB(); 153 if(teb == NULL) { 157 154 DebugInt3(); 158 155 return FALSE; … … 162 159 // WinToOS2MsgTranslate(msg, &qmsg, isUnicode); 163 160 164 if(!memcmp(msg, &t hdb->winmsg, sizeof(MSG)) || msg->hwnd == 0) {165 memcpy(&os2msg, &t hdb->os2msg, sizeof(QMSG));166 t hdb->os2msg.time = -1;167 t hdb->winmsg.time = -1;161 if(!memcmp(msg, &teb->o.odin.winmsg, sizeof(MSG)) || msg->hwnd == 0) { 162 memcpy(&os2msg, &teb->o.odin.os2msg, sizeof(QMSG)); 163 teb->o.odin.os2msg.time = -1; 164 teb->o.odin.winmsg.time = -1; 168 165 if(msg->hwnd) { 169 t hdb->nrOfMsgs = 1;170 t hdb->msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg171 memcpy(&t hdb->msg, msg, sizeof(MSG));166 teb->o.odin.nrOfMsgs = 1; 167 teb->o.odin.msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg 168 memcpy(&teb->o.odin.msg, msg, sizeof(MSG)); 172 169 } 173 170 if(os2msg.hwnd || os2msg.msg == WM_QUIT) { 174 memset(&t hdb->os2msg, 0, sizeof(thdb->os2msg));175 memset(&t hdb->winmsg, 0, sizeof(thdb->winmsg));176 return (LONG)WinDispatchMsg(t hdb->hab, &os2msg);171 memset(&teb->o.odin.os2msg, 0, sizeof(teb->o.odin.os2msg)); 172 memset(&teb->o.odin.winmsg, 0, sizeof(teb->o.odin.winmsg)); 173 return (LONG)WinDispatchMsg(teb->o.odin.hab, &os2msg); 177 174 } 178 175 //SvL: Don't dispatch messages sent by PostThreadMessage (correct??) … … 192 189 { 193 190 BOOL rc, eaten; 194 T HDB *thdb;191 TEB *teb; 195 192 QMSG os2msg; 196 193 HWND hwndOS2 = 0; 194 ULONG filtermin, filtermax; 197 195 198 196 if(hwnd) { … … 206 204 } 207 205 208 t hdb = GetThreadTHDB();209 if(t hdb == NULL) {206 teb = GetThreadTEB(); 207 if(teb == NULL) { 210 208 DebugInt3(); 211 209 return TRUE; 212 210 } 213 211 214 if(t hdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) {212 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) { 215 213 if(uMsgFilterMin) { 216 if(t hdb->msgWCHAR.message < uMsgFilterMin)214 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 217 215 goto continuegetmsg; 218 216 } 219 217 if(uMsgFilterMax) { 220 if(t hdb->msgWCHAR.message > uMsgFilterMax)218 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 221 219 goto continuegetmsg; 222 220 } 223 t hdb->fTranslated = FALSE;224 memcpy(pMsg, &t hdb->msgWCHAR, sizeof(MSG));225 t hdb->os2msg.msg = 0;226 t hdb->os2msg.hwnd = 0;221 teb->o.odin.fTranslated = FALSE; 222 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 223 teb->o.odin.os2msg.msg = 0; 224 teb->o.odin.os2msg.hwnd = 0; 227 225 return (pMsg->message != WINWM_QUIT); 228 226 } … … 230 228 continuegetmsg: 231 229 if(hwnd) { 230 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 231 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 232 if(filtermin > filtermax) { 233 ULONG tmp = filtermin; 234 filtermin = filtermax; 235 filtermax = filtermin; 236 } 232 237 do { 233 WinWaitMsg(thdb->hab, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE));234 rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode);238 WinWaitMsg(teb->o.odin.hab, filtermin, filtermax); 239 rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode); 235 240 } 236 241 while(rc == FALSE); … … 240 245 else 241 246 { 242 do { 243 eaten = FALSE; 244 rc = WinGetMsg(thdb->hab, &os2msg, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE), 0); 245 if (os2msg.msg == WM_TIMER) 246 eaten = TIMER_HandleTimer(&os2msg); 247 } while (eaten); 248 } 249 250 OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, MSG_REMOVE); 251 memcpy(&thdb->os2msg, &os2msg, sizeof(QMSG)); 252 memcpy(&thdb->winmsg, pMsg, sizeof(MSG)); 247 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 248 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 249 if(filtermin > filtermax) { 250 ULONG tmp = filtermin; 251 filtermin = filtermax; 252 filtermax = filtermin; 253 } 254 do { 255 eaten = FALSE; 256 rc = WinGetMsg(teb->o.odin.hab, &os2msg, filtermin, filtermax, 0); 257 if (os2msg.msg == WM_TIMER) 258 eaten = TIMER_HandleTimer(&os2msg); 259 } while (eaten); 260 } 261 262 OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, MSG_REMOVE); 263 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 264 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 253 265 254 266 if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN) … … 275 287 { 276 288 BOOL rc, eaten; 277 T HDB *thdb;289 TEB *teb; 278 290 QMSG os2msg; 279 291 HWND hwndOS2 = 0; … … 288 300 } 289 301 290 t hdb = GetThreadTHDB();291 if(t hdb == NULL) {302 teb = GetThreadTEB(); 303 if(teb == NULL) { 292 304 DebugInt3(); 293 305 return FALSE; 294 306 } 295 307 296 if(t hdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) {308 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) { 297 309 if(uMsgFilterMin) { 298 if(t hdb->msgWCHAR.message < uMsgFilterMin)310 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 299 311 goto continuepeekmsg; 300 312 } 301 313 if(uMsgFilterMax) { 302 if(t hdb->msgWCHAR.message > uMsgFilterMax)314 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 303 315 goto continuepeekmsg; 304 316 } 305 317 306 318 if(fRemove & PM_REMOVE_W) { 307 t hdb->fTranslated = FALSE;308 t hdb->os2msg.msg = 0;309 t hdb->os2msg.hwnd = 0;310 } 311 memcpy(pMsg, &t hdb->msgWCHAR, sizeof(MSG));319 teb->o.odin.fTranslated = FALSE; 320 teb->o.odin.os2msg.msg = 0; 321 teb->o.odin.os2msg.hwnd = 0; 322 } 323 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 312 324 return TRUE; 313 325 } … … 316 328 do { 317 329 eaten = FALSE; 318 rc = WinPeekMsg(t hdb->hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE),330 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE), 319 331 TranslateWinMsg(uMsgFilterMax, FALSE), (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 320 332 … … 329 341 } 330 342 331 OS2ToWinMsgTranslate((PVOID)t hdb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE);343 OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE); 332 344 //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message 333 345 if(fRemove & PM_REMOVE_W) { 334 memcpy(&t hdb->os2msg, &os2msg, sizeof(QMSG));335 memcpy(&t hdb->winmsg, pMsg, sizeof(MSG));346 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 347 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 336 348 } 337 349 … … 460 472 BOOL OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode) 461 473 { 462 // T HDB *thdb = GetTHDBFromThreadId(threadid);474 // TEB *teb = GetTEBFromThreadId(threadid); 463 475 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 464 476 465 // if(t hdb == NULL) {477 // if(teb == NULL) { 466 478 // dprintf(("OSLibPostThreadMessage: thread %x not found!", threadid)); 467 479 // return FALSE; -
trunk/src/user32/oslibmsgtranslate.cpp
r4599 r4658 1 /* $Id: oslibmsgtranslate.cpp,v 1.3 8 2000-11-15 20:30:46sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.39 2000-11-21 11:36:08 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 132 132 //****************************************************************************** 133 133 //****************************************************************************** 134 BOOL OS2ToWinMsgTranslate(void *pT hdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved)134 BOOL OS2ToWinMsgTranslate(void *pTeb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved) 135 135 { 136 136 Win32BaseWindow *win32wnd = 0; 137 137 OSLIBPOINT point, ClientPoint; 138 138 POSTMSG_PACKET *packet; 139 T HDB *thdb = (THDB *)pThdb;139 TEB *teb = (TEB *)pTeb; 140 140 BOOL fWasDisabled = FALSE; 141 141 int i; … … 176 176 case WM_CREATE: 177 177 { 178 if(t hdb->newWindow == 0) {178 if(teb->o.odin.newWindow == 0) { 179 179 DebugInt3(); 180 180 goto dummymessage; 181 181 } 182 182 183 win32wnd = (Win32BaseWindow *)t hdb->newWindow;183 win32wnd = (Win32BaseWindow *)teb->o.odin.newWindow; 184 184 185 185 winMsg->message = WINWM_CREATE; … … 233 233 } 234 234 if(win32wnd->getParent()) { 235 OSLibMapSWPtoWINDOWPOS(pswp, &t hdb->wp, &swpOld, win32wnd->getParent()->getWindowHeight(),235 OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 236 236 win32wnd->getParent()->getClientRectPtr()->left, 237 237 win32wnd->getParent()->getClientRectPtr()->top, 238 238 win32wnd->getOS2WindowHandle()); 239 239 } 240 else OSLibMapSWPtoWINDOWPOS(pswp, &t hdb->wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, win32wnd->getOS2WindowHandle());240 else OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, win32wnd->getOS2WindowHandle()); 241 241 242 242 if (!win32wnd->CanReceiveSizeMsgs()) goto dummymessage; … … 246 246 ///// win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy); 247 247 248 t hdb->wp.hwnd = win32wnd->getWindowHandle();248 teb->o.odin.wp.hwnd = win32wnd->getWindowHandle(); 249 249 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 250 250 { 251 251 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 252 252 if(wndAfter) 253 t hdb->wp.hwndInsertAfter = wndAfter->getWindowHandle();254 else t hdb->wp.hwndInsertAfter = HWND_TOP_W;253 teb->o.odin.wp.hwndInsertAfter = wndAfter->getWindowHandle(); 254 else teb->o.odin.wp.hwndInsertAfter = HWND_TOP_W; 255 255 } 256 256 } 257 257 winMsg->message = WINWM_WINDOWPOSCHANGED; 258 winMsg->lParam = (LPARAM)&t hdb->wp;258 winMsg->lParam = (LPARAM)&teb->o.odin.wp; 259 259 break; 260 260 } … … 496 496 char c; 497 497 498 t hdb->fTranslated = FALSE;498 teb->o.odin.fTranslated = FALSE; 499 499 repeatCount = CHAR3FROMMP(os2Msg->mp1); 500 500 scanCode = CHAR4FROMMP(os2Msg->mp1); … … 694 694 case WM_RENDERALLFMTS: 695 695 winMsg->message = WINWM_RENDERALLFORMATS; 696 break; 697 698 case WM_DESTROYCLIPBOARD: 699 winMsg->message = WINWM_DESTROYCLIPBOARD; 696 700 break; 697 701 … … 733 737 BOOL OSLibWinTranslateMessage(MSG *msg) 734 738 { 735 T HDB *thdb;736 737 t hdb = GetThreadTHDB();738 if(!t hdb) {739 TEB *teb; 740 741 teb = GetThreadTEB(); 742 if(!teb) { 739 743 return FALSE; 740 744 } 741 745 //NOTE: These actually need to be posted so that the next message retrieved by GetMessage contains 742 746 // the newly generated WM_CHAR message. 743 if(!t hdb->fTranslated && thdb->os2msg.msg == WM_CHAR && !((SHORT1FROMMP(thdb->os2msg.mp1) & KC_KEYUP) == KC_KEYUP))747 if(!teb->o.odin.fTranslated && teb->o.odin.os2msg.msg == WM_CHAR && !((SHORT1FROMMP(teb->o.odin.os2msg.mp1) & KC_KEYUP) == KC_KEYUP)) 744 748 {//TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message 745 ULONG fl = SHORT1FROMMP(t hdb->os2msg.mp1);749 ULONG fl = SHORT1FROMMP(teb->o.odin.os2msg.mp1); 746 750 MSG extramsg; 747 751 748 752 memcpy(&extramsg, msg, sizeof(MSG)); 749 extramsg.wParam = SHORT1FROMMP(t hdb->os2msg.mp2);753 extramsg.wParam = SHORT1FROMMP(teb->o.odin.os2msg.mp2); 750 754 extramsg.lParam = 0; 751 755 … … 757 761 if(msg->wParam) 758 762 extramsg.wParam = msg->wParam; 759 else extramsg.wParam = SHORT2FROMMP(t hdb->os2msg.mp2);763 else extramsg.wParam = SHORT2FROMMP(teb->o.odin.os2msg.mp2); 760 764 } 761 765 … … 778 782 extramsg.lParam |= (1<<31); 779 783 780 t hdb->fTranslated = TRUE;781 memcpy(&t hdb->msgWCHAR, &extramsg, sizeof(MSG));784 teb->o.odin.fTranslated = TRUE; 785 memcpy(&teb->o.odin.msgWCHAR, &extramsg, sizeof(MSG)); 782 786 return TRUE; 783 787 } -
trunk/src/user32/oslibutil.cpp
r2804 r4658 1 /* $Id: oslibutil.cpp,v 1. 5 2000-02-16 14:34:28 sandervl Exp $ */1 /* $Id: oslibutil.cpp,v 1.6 2000-11-21 11:36:08 sandervl Exp $ */ 2 2 /* 3 3 * Window API utility functions for OS/2 … … 22 22 HAB GetThreadHAB() 23 23 { 24 T HDB *thdb;24 TEB *teb; 25 25 26 t hdb = GetThreadTHDB();27 if(t hdb)26 teb = GetThreadTEB(); 27 if(teb) 28 28 { 29 return (HAB)t hdb->hab;29 return (HAB)teb->o.odin.hab; 30 30 } 31 31 32 dprintf(("GetThreadHAB: t hdb == NULL!!"));32 dprintf(("GetThreadHAB: teb == NULL!!")); 33 33 return 0; 34 34 } … … 37 37 void SetThreadHAB(HAB hab) 38 38 { 39 T HDB *thdb;39 TEB *teb; 40 40 41 t hdb = GetThreadTHDB();42 if(t hdb)41 teb = GetThreadTEB(); 42 if(teb) 43 43 { 44 t hdb->hab = (ULONG)hab;44 teb->o.odin.hab = (ULONG)hab; 45 45 } 46 else dprintf(("SetThreadHAB: t hdb == NULL!!"));46 else dprintf(("SetThreadHAB: teb == NULL!!")); 47 47 } 48 48 //****************************************************************************** … … 50 50 HMQ GetThreadMessageQueue() 51 51 { 52 T HDB *thdb;52 TEB *teb; 53 53 54 t hdb = GetThreadTHDB();55 if(t hdb)54 teb = GetThreadTEB(); 55 if(teb) 56 56 { 57 return (HMQ)t hdb->hmq;57 return (HMQ)teb->o.odin.hmq; 58 58 } 59 59 60 dprintf(("GetThreadMessageQueue: t hdb == NULL!!"));60 dprintf(("GetThreadMessageQueue: teb == NULL!!")); 61 61 return 0; 62 62 } … … 65 65 void SetThreadMessageQueue(HMQ hmq) 66 66 { 67 T HDB *thdb;67 TEB *teb; 68 68 69 t hdb = GetThreadTHDB();70 if(t hdb)69 teb = GetThreadTEB(); 70 if(teb) 71 71 { 72 t hdb->hmq = (ULONG)hmq;72 teb->o.odin.hmq = (ULONG)hmq; 73 73 } 74 else dprintf(("SetThreadMessageQueue: t hdb == NULL!!"));74 else dprintf(("SetThreadMessageQueue: teb == NULL!!")); 75 75 } 76 76 //****************************************************************************** … … 78 78 DWORD GetThreadMessageExtraInfo() 79 79 { 80 T HDB *thdb;80 TEB *teb; 81 81 82 t hdb = GetThreadTHDB();83 if(t hdb)82 teb = GetThreadTEB(); 83 if(teb) 84 84 { 85 return t hdb->lParam;85 return teb->o.odin.lParam; 86 86 } 87 87 88 dprintf(("GetThreadMessageExtraInfo: t hdb == NULL!!"));88 dprintf(("GetThreadMessageExtraInfo: teb == NULL!!")); 89 89 return 0; 90 90 } … … 93 93 DWORD SetThreadMessageExtraInfo(DWORD lParam) 94 94 { 95 T HDB *thdb;95 TEB *teb; 96 96 97 t hdb = GetThreadTHDB();98 if(t hdb)97 teb = GetThreadTEB(); 98 if(teb) 99 99 { 100 t hdb->lParam = lParam;100 teb->o.odin.lParam = lParam; 101 101 } 102 else dprintf(("SetThreadMessageExtraInfo: t hdb == NULL!!"));102 else dprintf(("SetThreadMessageExtraInfo: teb == NULL!!")); 103 103 return 0; 104 104 } -
trunk/src/user32/pmframe.cpp
r3603 r4658 1 /* $Id: pmframe.cpp,v 1.5 5 2000-05-24 19:30:05sandervl Exp $ */1 /* $Id: pmframe.cpp,v 1.56 2000-11-21 11:36:08 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 68 68 PFNWP OldFrameProc; 69 69 MRESULT rc; 70 T HDB *thdb;70 TEB *teb; 71 71 MSG *pWinMsg,winMsg; 72 72 73 73 SetWin32TIB(); 74 74 75 t hdb = GetThreadTHDB();75 teb = GetThreadTEB(); 76 76 win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd); 77 77 78 if (!t hdb || (win32wnd == NULL) || !win32wnd->getOldFrameProc())78 if (!teb || (win32wnd == NULL) || !win32wnd->getOldFrameProc()) 79 79 { 80 80 dprintf(("Invalid win32wnd pointer for frame %x!!", hwnd)); … … 82 82 } 83 83 84 if((t hdb->msgstate & 1) == 0)84 if((teb->o.odin.msgstate & 1) == 0) 85 85 {//message that was sent directly to our window proc handler; translate it here 86 86 QMSG qmsg; … … 90 90 qmsg.mp1 = mp1; 91 91 qmsg.mp2 = mp2; 92 qmsg.time = WinQueryMsgTime(t hdb->hab);93 WinQueryMsgPos(t hdb->hab, &qmsg.ptl);92 qmsg.time = WinQueryMsgTime(teb->o.odin.hab); 93 WinQueryMsgPos(teb->o.odin.hab, &qmsg.ptl); 94 94 qmsg.reserved = 0; 95 95 96 if(OS2ToWinMsgTranslate((PVOID)t hdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)96 if(OS2ToWinMsgTranslate((PVOID)teb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE) 97 97 {//message was not translated 98 98 memset(&winMsg, 0, sizeof(MSG)); … … 101 101 } 102 102 else { 103 pWinMsg = &t hdb->msg;104 t hdb->msgstate++;103 pWinMsg = &teb->o.odin.msg; 104 teb->o.odin.msgstate++; 105 105 } 106 106 … … 357 357 //TODO: Get rid of SWP_SHOW; needed for winhlp32 button bar for now 358 358 swpClient.fl = (pswp->fl & ~SWP_ZORDER) | SWP_MOVE | SWP_SHOW; 359 WinSetMultWindowPos(t hdb->hab, &swpClient, 1);359 WinSetMultWindowPos(teb->o.odin.hab, &swpClient, 1); 360 360 361 361 //update child positions: rectWindow is in window coordinates -
trunk/src/user32/pmwindow.cpp
r4599 r4658 1 /* $Id: pmwindow.cpp,v 1.10 7 2000-11-15 20:30:46sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.108 2000-11-21 11:36:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 144 144 OSLIBPOINT point, ClientPoint; 145 145 Win32BaseWindow *win32wnd; 146 T HDB *thdb;146 TEB *teb; 147 147 APIRET rc = 0; 148 148 MSG winMsg, *pWinMsg; … … 151 151 SetWin32TIB(); 152 152 153 t hdb = GetThreadTHDB();153 teb = GetThreadTEB(); 154 154 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 155 155 156 if(!t hdb || (msg != WM_CREATE && win32wnd == NULL)) {156 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 157 157 dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 158 158 goto RunDefWndProc; 159 159 } 160 160 161 if((t hdb->msgstate & 1) == 0)161 if((teb->o.odin.msgstate & 1) == 0) 162 162 {//message that was sent directly to our window proc handler; translate it here 163 163 QMSG qmsg; … … 167 167 qmsg.mp1 = mp1; 168 168 qmsg.mp2 = mp2; 169 qmsg.time = WinQueryMsgTime(t hdb->hab);170 WinQueryMsgPos(t hdb->hab, &qmsg.ptl);169 qmsg.time = WinQueryMsgTime(teb->o.odin.hab); 170 WinQueryMsgPos(teb->o.odin.hab, &qmsg.ptl); 171 171 qmsg.reserved = 0; 172 172 173 if(OS2ToWinMsgTranslate((PVOID)t hdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)173 if(OS2ToWinMsgTranslate((PVOID)teb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE) 174 174 {//message was not translated 175 175 memset(&winMsg, 0, sizeof(MSG)); … … 178 178 } 179 179 else { 180 pWinMsg = &t hdb->msg;181 t hdb->msgstate++;180 pWinMsg = &teb->o.odin.msg; 181 teb->o.odin.msgstate++; 182 182 } 183 183 … … 197 197 case WM_CREATE: 198 198 { 199 if(t hdb->newWindow == 0)199 if(teb->o.odin.newWindow == 0) 200 200 goto createfail; 201 201 202 202 //Processing is done in after WinCreateWindow returns 203 203 dprintf(("OS2: WM_CREATE %x", hwnd)); 204 win32wnd = (Win32BaseWindow *)t hdb->newWindow;205 t hdb->newWindow = 0;204 win32wnd = (Win32BaseWindow *)teb->o.odin.newWindow; 205 teb->o.odin.newWindow = 0; 206 206 if(win32wnd->MsgCreate(hwnd) == FALSE) 207 207 { … … 794 794 case WM_RENDERFMT: 795 795 case WM_RENDERALLFMTS: 796 case WM_DESTROYCLIPBOARD: 796 797 win32wnd->DispatchMsgA(pWinMsg); 797 798 break; -
trunk/src/user32/win32wbase.cpp
r4628 r4658 1 /* $Id: win32wbase.cpp,v 1.22 3 2000-11-19 11:52:40sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.224 2000-11-21 11:36:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 496 496 497 497 //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it 498 T HDB *thdb = GetThreadTHDB();499 500 if(t hdb == NULL) {501 dprintf(("Window creation failed - t hdb == NULL")); //this is VERY bad498 TEB *teb = GetThreadTEB(); 499 500 if(teb == NULL) { 501 dprintf(("Window creation failed - teb == NULL")); //this is VERY bad 502 502 ExitProcess(666); 503 503 return FALSE; 504 504 } 505 505 506 t hdb->newWindow = (ULONG)this;506 teb->o.odin.newWindow = (ULONG)this; 507 507 508 508 DWORD dwOSWinStyle;
Note:
See TracChangeset
for help on using the changeset viewer.