mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #11786 from akallabeth/null-fix
LoadLibrary Null fix
This commit is contained in:
@@ -387,8 +387,11 @@ static BOOL filter_dyn_channel_intercept(proxyPlugin* plugin, proxyData* pdata,
|
||||
|
||||
if (state->skip())
|
||||
{
|
||||
if (!state->skip(inputDataLength))
|
||||
if (state->skip(inputDataLength))
|
||||
{
|
||||
WLog_WARN(TAG, "skipping data, but %" PRIuz " bytes left", state->remaining());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (state->drop())
|
||||
{
|
||||
@@ -481,8 +484,8 @@ extern "C"
|
||||
return int_proxy_module_entry_point(plugins_manager, userdata);
|
||||
}
|
||||
#else
|
||||
FREERDP_API BOOL demo_proxy_module_entry_point(proxyPluginsManager* plugins_manager,
|
||||
void* userdata);
|
||||
FREERDP_API BOOL bitmap_filter_proxy_module_entry_point(proxyPluginsManager* plugins_manager,
|
||||
void* userdata);
|
||||
BOOL bitmap_filter_proxy_module_entry_point(proxyPluginsManager* plugins_manager, void* userdata)
|
||||
{
|
||||
return int_proxy_module_entry_point(plugins_manager, userdata);
|
||||
|
||||
@@ -70,6 +70,12 @@ static const char* pf_modules_get_filter_type_string(PF_FILTER_TYPE result)
|
||||
return "FILTER_TYPE_SERVER_PEER_LOGON";
|
||||
case FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_CREATE:
|
||||
return "FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_CREATE";
|
||||
case FILTER_TYPE_STATIC_INTERCEPT_LIST:
|
||||
return "FILTER_TYPE_STATIC_INTERCEPT_LIST";
|
||||
case FILTER_TYPE_DYN_INTERCEPT_LIST:
|
||||
return "FILTER_TYPE_DYN_INTERCEPT_LIST";
|
||||
case FILTER_TYPE_INTERCEPT_CHANNEL:
|
||||
return "FILTER_TYPE_INTERCEPT_CHANNEL";
|
||||
case FILTER_LAST:
|
||||
return "FILTER_LAST";
|
||||
default:
|
||||
@@ -484,7 +490,7 @@ static BOOL pf_modules_load_static_module(const char* module_name, proxyModule*
|
||||
{
|
||||
WINPR_ASSERT(module);
|
||||
|
||||
HANDLE handle = LoadLibraryX(NULL);
|
||||
HANDLE handle = GetModuleHandleA(NULL);
|
||||
|
||||
if (handle == NULL)
|
||||
{
|
||||
|
||||
@@ -109,14 +109,14 @@ BOOL SetDefaultDllDirectories(WINPR_ATTR_UNUSED DWORD DirectoryFlags)
|
||||
|
||||
HMODULE LoadLibraryA(LPCSTR lpLibFileName)
|
||||
{
|
||||
if (!lpLibFileName)
|
||||
return NULL;
|
||||
|
||||
#if defined(_UWP)
|
||||
int status;
|
||||
HMODULE hModule = NULL;
|
||||
WCHAR* filenameW = NULL;
|
||||
|
||||
if (!lpLibFileName)
|
||||
return NULL;
|
||||
|
||||
filenameW = ConvertUtf8ToWCharAlloc(lpLibFileName, NULL);
|
||||
if (filenameW)
|
||||
return NULL;
|
||||
@@ -125,8 +125,7 @@ HMODULE LoadLibraryA(LPCSTR lpLibFileName)
|
||||
free(filenameW);
|
||||
return hModule;
|
||||
#else
|
||||
HMODULE library = NULL;
|
||||
library = dlopen(lpLibFileName, RTLD_LOCAL | RTLD_LAZY);
|
||||
HMODULE library = dlopen(lpLibFileName, RTLD_LOCAL | RTLD_LAZY);
|
||||
|
||||
if (!library)
|
||||
{
|
||||
@@ -208,20 +207,19 @@ BOOL FreeLibrary(HMODULE hLibModule)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HMODULE GetModuleHandleA(WINPR_ATTR_UNUSED LPCSTR lpModuleName)
|
||||
HMODULE GetModuleHandleA(LPCSTR lpModuleName)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
WLog_ERR(TAG, "not implemented");
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
return dlopen(lpModuleName, RTLD_NOLOAD | RTLD_LOCAL | RTLD_LAZY);
|
||||
}
|
||||
|
||||
HMODULE GetModuleHandleW(WINPR_ATTR_UNUSED LPCWSTR lpModuleName)
|
||||
HMODULE GetModuleHandleW(LPCWSTR lpModuleName)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
WLog_ERR(TAG, "not implemented");
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
char* name = NULL;
|
||||
if (lpModuleName)
|
||||
name = ConvertWCharToUtf8Alloc(lpModuleName, NULL);
|
||||
HANDLE hdl = GetModuleHandleA(name);
|
||||
free(name);
|
||||
return hdl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user