source: trunk/include/wprocess.h@ 21999

Last change on this file since 21999 was 21999, checked in by dmik, 13 years ago

kernel32: Make SEH work in OS/2 context.

See #82 for details.

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