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.

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

mercurial