From 0b8444d0eef50d1ee4e0d0b51e174fa5b447d802 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期三, 17 七月 2024 17:50:35 +0800
Subject: [PATCH] base code
---
jrj/xframe/wobject/xutil.hpp | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/jrj/xframe/wobject/xutil.hpp b/jrj/xframe/wobject/xutil.hpp
index 8ce0f0e..5a702e7 100644
--- a/jrj/xframe/wobject/xutil.hpp
+++ b/jrj/xframe/wobject/xutil.hpp
@@ -2,8 +2,13 @@
#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:
@@ -32,9 +37,9 @@
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)
{
@@ -57,7 +62,7 @@
static xstring GetModulePath()
{
wchar_t buf[255];
- GetModuleFileName(0, buf, 255);
+ ::GetModuleFileNameW(nullptr, buf, 255);
PathRemoveFileSpec(buf);
return xstring(buf);
}
@@ -69,4 +74,11 @@
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;
+ }
};
\ No newline at end of file
--
Gitblit v1.9.3