From 1d30b617c14194c899072b810219235d9c0235f6 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sat, 7 Oct 2023 13:59:01 +0200 Subject: [PATCH] windows.cfg: Fixed wrong configuration of GetModuleHandle(A|W)-functions (#5525) This fixes a FP: `Variable 'path' can be declared as const array [constVariable]` The reason was the wrong direction attribute of GetModuleHandle() --- cfg/windows.cfg | 2 +- test/cfg/windows.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 53dc335e4..47a428c82 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -4825,7 +4825,7 @@ HFONT CreateFont( - + diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index 55eb21ecd..7c90898fd 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -8,14 +8,23 @@ // #include -#include +#include #include -#include -#include +#include +#include #include #include #include #include +#include + +/// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew +std::string constVariable_GetModuleFileName(void) { + char path[42]; + if (GetModuleFileNameA(NULL, path, sizeof(path))==0) + return std::string(); + return std::string{path}; +} int stringCompare_mbscmp(const unsigned char *string1, const unsigned char *string2) { @@ -1117,4 +1126,4 @@ void invalidPrintfArgType_StructMember(double d) { // #9672 BOOL MyEnableWindow(HWND hWnd, BOOL bEnable) { return EnableWindow(hWnd, bEnable); -} \ No newline at end of file +}