source: trunk/include/windllbase.h@ 1659

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

dll renaming

File size: 2.6 KB
Line 
1/* $Id: windllbase.h,v 1.3 1999-11-09 14:14:17 sandervl Exp $ */
2
3/*
4 * Win32 Dll base class
5 *
6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#ifndef __WINDLLBASE_H__
13#define __WINDLLBASE_H__
14
15#include <winimagebase.h>
16#include <odinlx.h>
17
18#ifndef HINSTANCE
19#define HINSTANCE ULONG
20#endif
21
22#define DLL_PROCESS_ATTACH 1
23#define DLL_THREAD_ATTACH 2
24#define DLL_THREAD_DETACH 3
25#define DLL_PROCESS_DETACH 0
26
27#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
28#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
29#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
30
31//odin.ini section names to lookup renamed dlls
32//i.e. OLE32 -> OLE32OS2
33#define DLLRENAMEWIN_SECTION "DLLRENAMEWIN"
34//i.e. OLE32OS2 -> OLE32
35#define DLLRENAMEOS2_SECTION "DLLRENAMEOS2"
36
37class Win32DllBase : public virtual Win32ImageBase
38{
39public:
40 Win32DllBase(HINSTANCE hInstance, WIN32DLLENTRY DllEntryPoint);
41virtual ~Win32DllBase();
42
43 ULONG AddRef() { return ++referenced; };
44 //ASSUMPTION: called by FreeLibrary only
45virtual ULONG Release();
46 char *getName() { return szModule; };
47 void setNoEntryCalls() { fSkipEntryCalls = TRUE; };
48
49 Win32DllBase *getNext() { return next; };
50static Win32DllBase *getFirst();
51
52//Send DLL_THREAD_ATTACH message to all dlls for a new thread
53static void attachThreadToAllDlls();
54
55//Send DLL_THREAD_DETACH message to all dlls for thread that's about to die
56static void detachThreadFromAllDlls();
57
58//Setup TLS structure for all dlls for a new thread
59static void tlsAttachThreadToAllDlls();
60
61//Destroy TLS structure for all dlls for a thread that's about to die
62static void tlsDetachThreadFromAllDlls();
63
64virtual ULONG getApi(char *name) = 0;
65virtual ULONG getApi(int ordinal) = 0;
66
67 BOOL attachProcess();
68 BOOL detachProcess();
69 BOOL attachThread();
70 BOOL detachThread();
71
72// enable / disable thread attach/detach calls
73 void setThreadLibraryCalls(BOOL fEnable);
74
75static void deleteAll();
76
77static BOOL isSystemDll(char *szFileName);
78
79virtual BOOL isLxDll() = 0;
80virtual BOOL isDll();
81
82static void renameDll(char *dllname, BOOL fWinToOS2=TRUE);
83
84static Win32DllBase *findModule(char *dllname);
85static Win32DllBase *findModule(HINSTANCE hinstance);
86static Win32DllBase *findModule(WIN32DLLENTRY DllEntryPoint);
87
88protected:
89 BOOL fSkipEntryCalls, fUnloaded, fAttachedToProcess;
90
91 WIN32DLLENTRY dllEntryPoint;
92
93 ULONG referenced;
94
95private:
96static Win32DllBase *head;
97 Win32DllBase *next;
98};
99
100#endif
Note: See TracBrowser for help on using the repository browser.