1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// Windows/DLL.h 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __WINDOWS_DLL_H 4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __WINDOWS_DLL_H 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../Common/MyString.h" 7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 8baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NWindows { 9baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NDLL { 10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifdef UNDER_CE 12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define My_GetProcAddress(module, proceName) GetProcAddressA(module, proceName) 13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#else 14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define My_GetProcAddress(module, proceName) ::GetProcAddress(module, proceName) 15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 17baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CLibrary 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool LoadOperations(HMODULE newModule); 20baa3858d3f5d128a5c8466b700098109edcad5f2repo syncprotected: 21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HMODULE _module; 22baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic: 23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CLibrary(): _module(NULL) {}; 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ~CLibrary() { Free(); } 25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync operator HMODULE() const { return _module; } 27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HMODULE* operator&() { return &_module; } 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool IsLoaded() const { return (_module != NULL); }; 29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void Attach(HMODULE m) 31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync Free(); 33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync _module = m; 34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HMODULE Detach() 36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HMODULE m = _module; 38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync _module = NULL; 39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return m; 40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool Free(); 43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool LoadEx(LPCTSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE); 44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool Load(LPCTSTR fileName); 45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #ifndef _UNICODE 46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool LoadEx(LPCWSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE); 47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool Load(LPCWSTR fileName); 48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #endif 49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync FARPROC GetProc(LPCSTR procName) const { return My_GetProcAddress(_module, procName); } 50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 52baa3858d3f5d128a5c8466b700098109edcad5f2repo syncbool MyGetModuleFileName(HMODULE hModule, CSysString &result); 53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef _UNICODE 54baa3858d3f5d128a5c8466b700098109edcad5f2repo syncbool MyGetModuleFileName(HMODULE hModule, UString &result); 55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}} 58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 60