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
RevLine 
[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]19typedef ULONG PDB;
[1067]20#endif
[127]21#include <thread.h>
[9909]22#include <FastInfoBlocks.h>
[127]23
[10279]24#define SELECTOR_OS2_FS 0x150b
25
[8017]26#define MAKE_THREADID(processid, threadid) ((processid << 16) | threadid)
27#define ODIN_TO_OS2_THREADID(threadid) (threadid & 0xFFFF)
28
[9909]29#define ODIN_GetCurrentThreadId() MAKE_THREADID(fibGetPid(), fibGetTid())
30#define ODIN_GetCurrentProcessId() fibGetPid()
31
[21916]32#ifdef __cplusplus
33extern "C" {
34#endif
35
[8645]36TEB *WIN32API CreateTEB(HANDLE hThread, DWORD dwThreadId);
37TEB *WIN32API InitializeMainThread();
38
39//******************************************************************************
40// Set up the TEB structure of the CURRENT (!) thread
41//******************************************************************************
[21941]42BOOL WIN32API InitializeThread(TEB *teb, BOOL fMainThread DEF_VAL(FALSE));
[8645]43
44void WIN32API DestroyTEB(TEB *teb);
[5335]45ULONG WIN32API GetProcessTIBSel();
[124]46
[7829]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)
[7810]49//
50//Switch to WIN32 TIB (FS selector)
51//NOTE: This is not done for Odin32 applications (LX), unless
52// fForceSwitch is TRUE)
[21941]53USHORT WIN32API SetWin32TIB(BOOL fForceSwitch DEF_VAL(TIB_SWITCH_DEFAULT));
[281]54void WIN32API RestoreOS2TIB();
[7810]55
[1891]56void SetPDBInstance(HINSTANCE hInstance);
[127]57
58extern BOOL fExeStarted;
[953]59extern BOOL fFreeLibrary;
[9798]60extern BOOL fIsOS2Image; //TRUE -> Odin32 OS/2 application (not converted!)
61 //FALSE -> otherwise
62extern BOOL fSwitchTIBSel; // TRUE -> switch TIB selectors
63 // FALSE -> don't
[21999]64extern BOOL fForceWin32TIB;// TRUE -> SEH support enabled
[21381]65 // FALSE -> not enabled
[4232]66extern BOOL fExitProcess;
[127]67
[281]68//Flat pointer to thread TIB structure
69extern DWORD *TIBFlatPtr;
70
[1885]71extern PDB ProcessPDB;
72
73#define NtCurrentTeb GetThreadTEB
[21352]74TEB *WIN32API GetThreadTEB(void);
[4657]75TEB *WIN32API GetTEBFromThreadId(ULONG threadId);
76TEB *WIN32API GetTEBFromThreadHandle(HANDLE hThread);
[320]77
[1887]78#ifndef OS2_INCLUDED
79inline PDB * PROCESS_Current(void)
[1885]80{
81 return NtCurrentTeb()->process;
82}
[1887]83#endif
[1885]84
[4234]85ULONG InitCommandLine(const char *pszPeExe);
[9494]86BOOL InitLoaders();
[4234]87
[10294]88UINT WIN32API GetProcModuleFileNameA(ULONG lpvAddress, LPSTR lpszFileName, UINT cchFileNameMax);
89
[21916]90#ifdef __cplusplus
91} // extern "C"
92#endif
93
[21941]94#endif
Note: See TracBrowser for help on using the repository browser.