source: trunk/include/wprocess.h@ 9909

Last change on this file since 9909 was 9909, checked in by sandervl, 22 years ago

header updates

File size: 2.2 KB
Line 
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
13#define WIN32_TIBSEL
14
15#ifndef OS2_INCLUDED
16#include <winprocess.h>
17#else
18#include <winconst.h>
19typedef ULONG PDB;
20#endif
21#include <thread.h>
22#include <FastInfoBlocks.h>
23
24#define MAKE_THREADID(processid, threadid) ((processid << 16) | threadid)
25#define ODIN_TO_OS2_THREADID(threadid) (threadid & 0xFFFF)
26
27#define ODIN_GetCurrentThreadId() MAKE_THREADID(fibGetPid(), fibGetTid())
28#define ODIN_GetCurrentProcessId() fibGetPid()
29
30TEB *WIN32API CreateTEB(HANDLE hThread, DWORD dwThreadId);
31TEB *WIN32API InitializeMainThread();
32
33//******************************************************************************
34// Set up the TEB structure of the CURRENT (!) thread
35//******************************************************************************
36BOOL WIN32API InitializeThread(TEB *teb, BOOL fMainThread = FALSE);
37
38void WIN32API DestroyTEB(TEB *teb);
39ULONG WIN32API GetProcessTIBSel();
40
41#define TIB_SWITCH_DEFAULT 0 //executable type determines whether or not FS is changed
42#define TIB_SWITCH_FORCE_WIN32 1 //always switch to win32 TIB (FS is changed)
43//
44//Switch to WIN32 TIB (FS selector)
45//NOTE: This is not done for Odin32 applications (LX), unless
46// fForceSwitch is TRUE)
47USHORT WIN32API SetWin32TIB(BOOL fForceSwitch = TIB_SWITCH_DEFAULT);
48void WIN32API RestoreOS2TIB();
49
50void SetPDBInstance(HINSTANCE hInstance);
51
52extern BOOL fExeStarted;
53extern BOOL fFreeLibrary;
54extern BOOL fIsOS2Image; //TRUE -> Odin32 OS/2 application (not converted!)
55 //FALSE -> otherwise
56extern BOOL fSwitchTIBSel; // TRUE -> switch TIB selectors
57 // FALSE -> don't
58extern BOOL fExitProcess;
59
60//Flat pointer to thread TIB structure
61extern DWORD *TIBFlatPtr;
62
63extern PDB ProcessPDB;
64
65#define NtCurrentTeb GetThreadTEB
66TEB *WIN32API GetThreadTEB();
67TEB *WIN32API GetTEBFromThreadId(ULONG threadId);
68TEB *WIN32API GetTEBFromThreadHandle(HANDLE hThread);
69
70#ifndef OS2_INCLUDED
71inline PDB * PROCESS_Current(void)
72{
73 return NtCurrentTeb()->process;
74}
75#endif
76
77ULONG InitCommandLine(const char *pszPeExe);
78BOOL InitLoaders();
79
80#endif
Note: See TracBrowser for help on using the repository browser.