source: trunk/include/windll.h@ 689

Last change on this file since 689 was 653, checked in by sandervl, 26 years ago

Stupid compiler; if you don't like virtual inline methods, then complain..

File size: 2.5 KB
Line 
1/* $Id: windll.h,v 1.7 1999-08-23 18:06:45 sandervl Exp $ */
2
3/*
4 *
5 * Project Odin Software License can be found in LICENSE.TXT
6 *
7 */
8/*
9 * Win32 PE Dll class
10 *
11 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
12 *
13 */
14#ifndef __WINDLL_H__
15#define __WINDLL_H__
16
17#include "winimage.h"
18
19#ifndef HINSTANCE
20#define HINSTANCE ULONG
21#endif
22
23#define DLL_PROCESS_ATTACH 1
24#define DLL_THREAD_ATTACH 2
25#define DLL_THREAD_DETACH 3
26#define DLL_PROCESS_DETACH 0
27
28#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
29#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
30#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
31
32typedef ULONG (* WIN32API WIN32DLLENTRY)(ULONG hInstance, ULONG reason, ULONG reserved);
33
34class Win32Dll : public Win32Image
35{
36public:
37 Win32Dll(HINSTANCE hinstance, int NameTableId, int Win32TableId, WIN32DLLENTRY DllEntryPoint);
38 Win32Dll(char *szDllName, Win32Image *parentImage = NULL);
39 ~Win32Dll();
40
41 void OS2DllInit(HINSTANCE hinstance, int NameTableId, int Win32TableId,
42 WIN32DLLENTRY DllEntryPoint);
43
44 BOOL init(ULONG reservedMem);
45
46 ULONG AddRef() { return ++referenced; };
47 //ASSUMPTION: called by FreeLibrary only
48 ULONG Release();
49 char *getName() { return szModule; };
50 void setNoEntryCalls() { fSkipEntryCalls = TRUE; };
51
52 Win32Dll *getNext() { return next; };
53static Win32Dll *getFirst();
54
55//Send DLL_THREAD_ATTACH message to all dlls for a new thread
56static void attachThreadToAllDlls();
57
58//Send DLL_THREAD_DETACH message to all dlls for thread that's about to die
59static void detachThreadFromAllDlls();
60
61//Setup TLS structure for all dlls for a new thread
62static void tlsAttachThreadToAllDlls();
63
64//Destroy TLS structure for all dlls for a thread that's about to die
65static void tlsDetachThreadFromAllDlls();
66
67 ULONG getApi(char *name);
68 ULONG getApi(int ordinal);
69 BOOL attachProcess();
70 BOOL detachProcess();
71 BOOL attachThread();
72 BOOL detachThread();
73
74static void deleteAll();
75
76static BOOL isSystemDll(char *szFileName);
77
78static Win32Dll *findModule(char *dllname);
79static Win32Dll *findModule(HINSTANCE hinstance);
80static Win32Dll *findModule(WIN32DLLENTRY DllEntryPoint);
81
82
83virtual BOOL isDll();
84
85protected:
86 BOOL fSystemDll, fSkipEntryCalls, fUnloaded, fAttachedToProcess;
87
88 WIN32DLLENTRY dllEntryPoint;
89private:
90 ULONG referenced;
91
92
93static Win32Dll *head;
94 Win32Dll *next;
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.