On Wed, 8 Jan 2025, Pali Rohár wrote:

This allows to get msvcrt module also on non-NT systems, on which
GetModuleHandleW() always returns NULL.
---
mingw-w64-crt/include/msvcrt.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/include/msvcrt.h b/mingw-w64-crt/include/msvcrt.h
index de708c60b528..348a8562e82d 100644
--- a/mingw-w64-crt/include/msvcrt.h
+++ b/mingw-w64-crt/include/msvcrt.h
@@ -9,7 +9,7 @@

static inline HANDLE __mingw_get_msvcrt_handle(void)
{
-    return GetModuleHandleW(L"msvcrt.dll");
+    return GetModuleHandleA("msvcrt.dll");
}

I think this change is ok. Except for actually dealing with wchar_t data, the only case I know of for where we'd need to stick to -W functions is for Windows CE, and we don't really maintain anything for the Windows CE targets within mingw-w64, so this should be fine.

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to