source: trunk/include/wprocess.h@ 9798

Last change on this file since 9798 was 9798, checked in by sandervl, 23 years ago

header updates

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