Browse code

Replace TEXT(__FUNCTION__) by __FUNCTION__ in openvpnmscia.c

TEXT(__FUNCTION__) does not work in mingw as __FUNCTION__
is not a macro. Instead, use __FUNCTION__ as a narrow
string in both UNICODE and ANSI builds.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210526224919.511-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22461.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Selva Nair authored on 2021/05/27 07:49:19
Showing 1 changed files
... ...
@@ -102,13 +102,13 @@ setup_sequence(
102 102
  *                        title.
103 103
  */
104 104
 static void
105
-_debug_popup(_In_z_ LPCTSTR szFunctionName)
105
+_debug_popup(_In_z_ LPCSTR szFunctionName)
106 106
 {
107 107
     TCHAR szTitle[0x100], szMessage[0x100+MAX_PATH], szProcessPath[MAX_PATH];
108 108
 
109 109
     /* Compose pop-up title. The dialog title will contain function name to ease the process
110 110
      * locating. Mind that Visual Studio displays window titles on the process list. */
111
-    _stprintf_s(szTitle, _countof(szTitle), TEXT("%") TEXT(PRIsLPTSTR) TEXT("v%") TEXT(PRIsLPTSTR),
111
+    _stprintf_s(szTitle, _countof(szTitle), TEXT("%hs v%") TEXT(PRIsLPTSTR),
112 112
                 szFunctionName, TEXT(PACKAGE_VERSION));
113 113
 
114 114
     /* Get process name. */
... ...
@@ -119,8 +119,8 @@ _debug_popup(_In_z_ LPCTSTR szFunctionName)
119 119
     /* Compose the pop-up message. */
120 120
     _stprintf_s(
121 121
         szMessage, _countof(szMessage),
122
-        TEXT("The %") TEXT(PRIsLPTSTR) TEXT(" process (PID: %u) has started to execute the %")
123
-        TEXT(PRIsLPTSTR) TEXT(" custom action.\r\n")
122
+        TEXT("The %") TEXT(PRIsLPTSTR) TEXT(" process (PID: %u) has started to execute the %hs")
123
+        TEXT(" custom action.\r\n")
124 124
         TEXT("\r\n")
125 125
         TEXT("If you would like to debug the custom action, attach a debugger to this process and set breakpoints before dismissing this dialog.\r\n")
126 126
         TEXT("\r\n")
... ...
@@ -407,7 +407,7 @@ FindSystemInfo(_In_ MSIHANDLE hInstall)
407 407
 #pragma comment(linker, DLLEXP_EXPORT)
408 408
 #endif
409 409
 
410
-    debug_popup(TEXT(__FUNCTION__));
410
+    debug_popup(__FUNCTION__);
411 411
 
412 412
     BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
413 413
 
... ...
@@ -441,7 +441,7 @@ CloseOpenVPNGUI(_In_ MSIHANDLE hInstall)
441 441
 #endif
442 442
     UNREFERENCED_PARAMETER(hInstall); /* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
443 443
 
444
-    debug_popup(TEXT(__FUNCTION__));
444
+    debug_popup(__FUNCTION__);
445 445
 
446 446
     /* Find OpenVPN GUI window. */
447 447
     HWND hWnd = FindWindow(TEXT("OpenVPN-GUI"), NULL);
... ...
@@ -463,7 +463,7 @@ StartOpenVPNGUI(_In_ MSIHANDLE hInstall)
463 463
 #pragma comment(linker, DLLEXP_EXPORT)
464 464
 #endif
465 465
 
466
-    debug_popup(TEXT(__FUNCTION__));
466
+    debug_popup(__FUNCTION__);
467 467
 
468 468
     UINT uiResult;
469 469
     BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
... ...
@@ -736,7 +736,7 @@ EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall)
736 736
 #pragma comment(linker, DLLEXP_EXPORT)
737 737
 #endif
738 738
 
739
-    debug_popup(TEXT(__FUNCTION__));
739
+    debug_popup(__FUNCTION__);
740 740
 
741 741
     UINT uiResult;
742 742
     BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
... ...
@@ -1065,7 +1065,7 @@ ProcessDeferredAction(_In_ MSIHANDLE hInstall)
1065 1065
 #pragma comment(linker, DLLEXP_EXPORT)
1066 1066
 #endif
1067 1067
 
1068
-    debug_popup(TEXT(__FUNCTION__));
1068
+    debug_popup(__FUNCTION__);
1069 1069
 
1070 1070
     UINT uiResult;
1071 1071
     BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
... ...
@@ -1265,7 +1265,7 @@ CheckAndScheduleReboot(_In_ MSIHANDLE hInstall)
1265 1265
 #pragma comment(linker, DLLEXP_EXPORT)
1266 1266
 #endif
1267 1267
 
1268
-    debug_popup(TEXT(__FUNCTION__));
1268
+    debug_popup(__FUNCTION__);
1269 1269
 
1270 1270
     UINT ret = ERROR_SUCCESS;
1271 1271
     BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));