Am 07.01.2024 um 18:03 schrieb Eli Zaretskii: >> Date: Sun, 7 Jan 2024 17:07:06 +0100 >> Cc: iant@google.com, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org >> From: Björn Schäpers >> >>> That was about GetModuleHandle, not about GetModuleHandleEx. For the >>> latter, all Windows versions that support it also support "wide" APIs. >>> So my suggestion is to use GetModuleHandleExW here. However, you will >>> need to make sure that notification_data->dll_base is declared as >>> 'wchar_t *', not 'char *'. If dll_base is declared as 'char *', then >>> only GetModuleHandleExA will work, and you will lose the ability to >>> support file names with non-ASCII characters outside of the current >>> system codepage. >> >> The dll_base is a PVOID. With the GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS flag >> GetModuleHandleEx does not look for a name, but uses an adress in the module to >> get the HMODULE, so you cast it to char* or wchar_t* depending on which function >> you call. Actually one could just cast the dll_base to HMODULE, at least in >> win32 on x86 the HMODULE of a dll is always its base adress. But to make it >> safer and future proof I went the way through GetModuleHandeEx. > > In that case, you an call either GetModuleHandeExA or > GetModuleHandeExW, the difference is minor. Here an updated version without relying on TEXT or TCHAR, directly calling GetModuleHandleExW. Kind regards, Björn.