source: trunk/include/wprocess.h@ 21381

Last change on this file since 21381 was 21381, checked in by dmik, 15 years ago

Implemented compiler-level SEH (try/catch) support for GCC.

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