other-licenses/7zstub/src/Windows/DLL.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Windows/DLL.h
michael@0 2
michael@0 3 #ifndef __WINDOWS_DLL_H
michael@0 4 #define __WINDOWS_DLL_H
michael@0 5
michael@0 6 #include "../Common/String.h"
michael@0 7
michael@0 8 namespace NWindows {
michael@0 9 namespace NDLL {
michael@0 10
michael@0 11 class CLibrary
michael@0 12 {
michael@0 13 bool LoadOperations(HMODULE newModule);
michael@0 14 protected:
michael@0 15 HMODULE _module;
michael@0 16 public:
michael@0 17 operator HMODULE() const { return _module; }
michael@0 18 HMODULE* operator&() { return &_module; }
michael@0 19
michael@0 20 CLibrary():_module(NULL) {};
michael@0 21 ~CLibrary();
michael@0 22 void Attach(HMODULE m)
michael@0 23 {
michael@0 24 Free();
michael@0 25 _module = m;
michael@0 26 }
michael@0 27 HMODULE Detach()
michael@0 28 {
michael@0 29 HMODULE m = _module;
michael@0 30 _module = NULL;
michael@0 31 return m;
michael@0 32 }
michael@0 33
michael@0 34 // operator HMODULE() const { return _module; };
michael@0 35 // bool IsLoaded() const { return (_module != NULL); };
michael@0 36 bool Free();
michael@0 37 bool LoadEx(LPCTSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE);
michael@0 38 bool Load(LPCTSTR fileName);
michael@0 39 #ifndef _UNICODE
michael@0 40 bool LoadEx(LPCWSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE);
michael@0 41 bool Load(LPCWSTR fileName);
michael@0 42 #endif
michael@0 43 FARPROC GetProcAddress(LPCSTR procName) const
michael@0 44 { return ::GetProcAddress(_module, procName); }
michael@0 45 };
michael@0 46
michael@0 47 bool MyGetModuleFileName(HMODULE hModule, CSysString &result);
michael@0 48 #ifndef _UNICODE
michael@0 49 bool MyGetModuleFileName(HMODULE hModule, UString &result);
michael@0 50 #endif
michael@0 51
michael@0 52 }}
michael@0 53
michael@0 54 #endif

mercurial