| | |
| | | |
| | | #include "xbase.hpp" |
| | | #include "kobject/kutil.hpp" |
| | | #include "wobject/xaserver.hpp" |
| | | #include "win32/win.hpp" |
| | | |
| | | using kutil = Hxsoft::XFrame::IXFUtil; |
| | | extern "C" { |
| | | void* WINAPI GetProcAddressW(HMODULE hModule, const char* lpText); |
| | | } |
| | | class xutil |
| | | { |
| | | public: |
| | |
| | | return kutil::CacheUrlData((LPWSTR)url,(LPWSTR)data); |
| | | } |
| | | |
| | | static int SaveToFile(const LPTSTR pFile,const LPTSTR pData,const LPTSTR ext, const LPTSTR pFilter, const LPTSTR pFileName=NULL) |
| | | static int SaveToFile(xstring pFile,xstring pData,xstring ext, xstring pFilter, const LPTSTR pFileName=NULL) |
| | | { |
| | | return kutil::SaveToFile((LPWSTR)pFile,(LPWSTR)pData,(LPWSTR)ext,(LPWSTR)pFileName); |
| | | return kutil::SaveToFile((LPWSTR)pFile.c_str(), (LPWSTR)pData.c_str(), (LPWSTR)ext.c_str(), (LPWSTR)pFileName); |
| | | } |
| | | static LPWSTR MD5(const wchar_t* pStr) |
| | | { |
| | |
| | | return Hxsoft::XUtil::FormatDecimalString(str, format, bfree); |
| | | } |
| | | |
| | | public: |
| | | static xstring GetModulePath() |
| | | { |
| | | wchar_t buf[255]; |
| | | ::GetModuleFileNameW(nullptr, buf, 255); |
| | | PathRemoveFileSpec(buf); |
| | | return xstring(buf); |
| | | } |
| | | |
| | | static xstring GetModuleTmpPath() |
| | | { |
| | | xstring tmp = GetModulePath() + L"\\Temp"; |
| | | xaserver::CreateDirectory(tmp); |
| | | return tmp; |
| | | } |
| | | |
| | | static void* GetFuncPtr(const wchar_t* dll, const char* name) |
| | | { |
| | | void* fnAttachEvent = nullptr; |
| | | HMODULE hModule = LoadLibraryW(dll); |
| | | if (hModule)fnAttachEvent = ::GetProcAddressW(hModule, name); |
| | | return fnAttachEvent; |
| | | } |
| | | }; |