| [124] | 1 | /* | 
|---|
|  | 2 | * Process help functions | 
|---|
|  | 3 | * | 
|---|
|  | 4 | * Copyright (C) 1999 Sander van Leeuwen | 
|---|
|  | 5 | * | 
|---|
|  | 6 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
|  | 7 | * | 
|---|
|  | 8 | */ | 
|---|
|  | 9 |  | 
|---|
|  | 10 | #ifndef _WPROCESS_H__ | 
|---|
|  | 11 | #define _WPROCESS_H__ | 
|---|
|  | 12 |  | 
|---|
| [130] | 13 | #define WIN32_TIBSEL | 
|---|
| [125] | 14 |  | 
|---|
| [1067] | 15 | #ifndef OS2_INCLUDED | 
|---|
| [1887] | 16 | #include <winprocess.h> | 
|---|
|  | 17 | #else | 
|---|
| [2086] | 18 | #include <winconst.h> | 
|---|
| [1887] | 19 | typedef ULONG PDB; | 
|---|
| [1067] | 20 | #endif | 
|---|
| [127] | 21 | #include <thread.h> | 
|---|
|  | 22 |  | 
|---|
| [8017] | 23 | #define MAKE_THREADID(processid, threadid)      ((processid << 16) | threadid) | 
|---|
|  | 24 | #define ODIN_TO_OS2_THREADID(threadid)          (threadid & 0xFFFF) | 
|---|
|  | 25 |  | 
|---|
| [8645] | 26 | TEB   *WIN32API CreateTEB(HANDLE hThread, DWORD dwThreadId); | 
|---|
|  | 27 | TEB   *WIN32API InitializeMainThread(); | 
|---|
|  | 28 |  | 
|---|
|  | 29 | //****************************************************************************** | 
|---|
|  | 30 | // Set up the TEB structure of the CURRENT (!) thread | 
|---|
|  | 31 | //****************************************************************************** | 
|---|
|  | 32 | BOOL   WIN32API InitializeThread(TEB *teb, BOOL fMainThread = FALSE); | 
|---|
|  | 33 |  | 
|---|
|  | 34 | void   WIN32API DestroyTEB(TEB *teb); | 
|---|
| [5335] | 35 | ULONG  WIN32API GetProcessTIBSel(); | 
|---|
| [124] | 36 |  | 
|---|
| [7829] | 37 | #define TIB_SWITCH_DEFAULT      0  //executable type determines whether or not FS is changed | 
|---|
|  | 38 | #define TIB_SWITCH_FORCE_WIN32  1  //always switch to win32 TIB (FS is changed) | 
|---|
| [7810] | 39 | // | 
|---|
|  | 40 | //Switch to WIN32 TIB (FS selector) | 
|---|
|  | 41 | //NOTE: This is not done for Odin32 applications (LX), unless | 
|---|
|  | 42 | //      fForceSwitch is TRUE) | 
|---|
|  | 43 | USHORT WIN32API SetWin32TIB(BOOL fForceSwitch = TIB_SWITCH_DEFAULT); | 
|---|
| [281] | 44 | void   WIN32API RestoreOS2TIB(); | 
|---|
| [7810] | 45 |  | 
|---|
| [1891] | 46 | void   SetPDBInstance(HINSTANCE hInstance); | 
|---|
| [127] | 47 |  | 
|---|
|  | 48 | extern BOOL fExeStarted; | 
|---|
| [953] | 49 | extern BOOL fFreeLibrary; | 
|---|
| [1222] | 50 | extern BOOL fIsOS2Image; //TRUE  -> Odin32 OS/2 application (not converted!) | 
|---|
|  | 51 | //FALSE -> otherwise | 
|---|
| [4232] | 52 | extern BOOL fExitProcess; | 
|---|
| [127] | 53 |  | 
|---|
| [281] | 54 | //Flat pointer to thread TIB structure | 
|---|
|  | 55 | extern DWORD  *TIBFlatPtr; | 
|---|
|  | 56 |  | 
|---|
| [1885] | 57 | extern PDB ProcessPDB; | 
|---|
|  | 58 |  | 
|---|
|  | 59 | #define NtCurrentTeb GetThreadTEB | 
|---|
| [320] | 60 | TEB  *WIN32API GetThreadTEB(); | 
|---|
| [4657] | 61 | TEB  *WIN32API GetTEBFromThreadId(ULONG threadId); | 
|---|
|  | 62 | TEB  *WIN32API GetTEBFromThreadHandle(HANDLE hThread); | 
|---|
| [320] | 63 |  | 
|---|
| [1887] | 64 | #ifndef OS2_INCLUDED | 
|---|
|  | 65 | inline PDB * PROCESS_Current(void) | 
|---|
| [1885] | 66 | { | 
|---|
|  | 67 | return NtCurrentTeb()->process; | 
|---|
|  | 68 | } | 
|---|
| [1887] | 69 | #endif | 
|---|
| [1885] | 70 |  | 
|---|
| [4234] | 71 | ULONG InitCommandLine(const char *pszPeExe); | 
|---|
|  | 72 |  | 
|---|
|  | 73 | #endif | 
|---|