source: trunk/include/windllbase.h@ 1566

Last change on this file since 1566 was 1134, checked in by phaller, 26 years ago

Fix: DisableThreadLibraryCalls added

File size: 2.3 KB
RevLine 
[1134]1/* $Id: windllbase.h,v 1.2 1999-10-04 22:25:02 phaller Exp $ */
[953]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
[1134]22#define DLL_PROCESS_ATTACH 1
23#define DLL_THREAD_ATTACH 2
24#define DLL_THREAD_DETACH 3
25#define DLL_PROCESS_DETACH 0
[953]26
27#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
28#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
29#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
30
31class Win32DllBase : public virtual Win32ImageBase
32{
33public:
34 Win32DllBase(HINSTANCE hInstance, WIN32DLLENTRY DllEntryPoint);
35virtual ~Win32DllBase();
36
37 ULONG AddRef() { return ++referenced; };
38 //ASSUMPTION: called by FreeLibrary only
39virtual ULONG Release();
40 char *getName() { return szModule; };
41 void setNoEntryCalls() { fSkipEntryCalls = TRUE; };
42
43 Win32DllBase *getNext() { return next; };
44static Win32DllBase *getFirst();
45
46//Send DLL_THREAD_ATTACH message to all dlls for a new thread
47static void attachThreadToAllDlls();
48
49//Send DLL_THREAD_DETACH message to all dlls for thread that's about to die
50static void detachThreadFromAllDlls();
51
52//Setup TLS structure for all dlls for a new thread
53static void tlsAttachThreadToAllDlls();
54
55//Destroy TLS structure for all dlls for a thread that's about to die
56static void tlsDetachThreadFromAllDlls();
57
58virtual ULONG getApi(char *name) = 0;
59virtual ULONG getApi(int ordinal) = 0;
60
61 BOOL attachProcess();
62 BOOL detachProcess();
63 BOOL attachThread();
64 BOOL detachThread();
65
[1134]66// enable / disable thread attach/detach calls
67 void setThreadLibraryCalls(BOOL fEnable);
68
[953]69static void deleteAll();
70
71static BOOL isSystemDll(char *szFileName);
72
73virtual BOOL isLxDll() = 0;
74virtual BOOL isDll();
75
76static Win32DllBase *findModule(char *dllname);
77static Win32DllBase *findModule(HINSTANCE hinstance);
78static Win32DllBase *findModule(WIN32DLLENTRY DllEntryPoint);
79
80protected:
81 BOOL fSkipEntryCalls, fUnloaded, fAttachedToProcess;
82
83 WIN32DLLENTRY dllEntryPoint;
84
85 ULONG referenced;
86
87private:
88static Win32DllBase *head;
89 Win32DllBase *next;
90};
91
[1134]92#endif
Note: See TracBrowser for help on using the repository browser.