In general you can't use multiple strings as argument
to TEXT() since it just adds a L in front of the argument.
So if you specifiy multiple arguments the later argument
strings do not get the L.
This does not seem to directly cause problems with our
ASCII strings, but make the usage consistent with all
the other code. That will help in case we remove the
usage of TEXT().
Also include tapctl/basic.h in openvpnserv to make
the macro environment consistent with tapctl and
openvpnmsica.
Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20250127091102.26983-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30603.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
| ... | ... |
@@ -45,7 +45,7 @@ GetRegString(HKEY key, LPCTSTR value, LPTSTR data, DWORD size, LPCTSTR default_v |
| 45 | 45 |
if (status != ERROR_SUCCESS) |
| 46 | 46 |
{
|
| 47 | 47 |
SetLastError(status); |
| 48 |
- return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value);
|
|
| 48 |
+ return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance, value);
|
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
return ERROR_SUCCESS; |
| ... | ... |
@@ -63,7 +63,7 @@ GetOpenvpnSettings(settings_t *s) |
| 63 | 63 |
TCHAR install_path[MAX_PATH]; |
| 64 | 64 |
TCHAR default_value[MAX_PATH]; |
| 65 | 65 |
|
| 66 |
- swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME "%ls"), service_instance);
|
|
| 66 |
+ swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls"), service_instance);
|
|
| 67 | 67 |
|
| 68 | 68 |
LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key); |
| 69 | 69 |
if (status != ERROR_SUCCESS) |
| ... | ... |
@@ -60,9 +60,9 @@ static HANDLE rdns_semaphore = NULL; |
| 60 | 60 |
|
| 61 | 61 |
openvpn_service_t interactive_service = {
|
| 62 | 62 |
interactive, |
| 63 |
- TEXT(PACKAGE_NAME "ServiceInteractive"), |
|
| 64 |
- TEXT(PACKAGE_NAME " Interactive Service"), |
|
| 65 |
- TEXT(SERVICE_DEPENDENCIES), |
|
| 63 |
+ TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"),
|
|
| 64 |
+ TEXT(PACKAGE_NAME) TEXT(" Interactive Service"),
|
|
| 65 |
+ SERVICE_DEPENDENCIES, |
|
| 66 | 66 |
SERVICE_AUTO_START |
| 67 | 67 |
}; |
| 68 | 68 |
|
| ... | ... |
@@ -1973,7 +1973,7 @@ RunOpenvpn(LPVOID p) |
| 1973 | 1973 |
} |
| 1974 | 1974 |
|
| 1975 | 1975 |
swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name), |
| 1976 |
- TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_instance, GetCurrentThreadId());
|
|
| 1976 |
+ TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId());
|
|
| 1977 | 1977 |
ovpn_pipe = CreateNamedPipe(ovpn_pipe_name, |
| 1978 | 1978 |
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED, |
| 1979 | 1979 |
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1, 128, 128, 0, NULL); |
| ... | ... |
@@ -2173,7 +2173,7 @@ CreateClientPipeInstance(VOID) |
| 2173 | 2173 |
} |
| 2174 | 2174 |
|
| 2175 | 2175 |
TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */ |
| 2176 |
- swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service"), service_instance);
|
|
| 2176 |
+ swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_instance);
|
|
| 2177 | 2177 |
HANDLE pipe = CreateNamedPipe(pipe_name, flags, |
| 2178 | 2178 |
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS, |
| 2179 | 2179 |
PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa); |
| ... | ... |
@@ -282,8 +282,8 @@ _tmain(int argc, TCHAR *argv[]) |
| 282 | 282 |
wprintf(TEXT("-instance interactive <id>\n")
|
| 283 | 283 |
TEXT(" Runs the service as an alternate instance.\n")
|
| 284 | 284 |
TEXT(" The service settings will be loaded from\n")
|
| 285 |
- TEXT(" HKLM\\Software\\" PACKAGE_NAME "<id> registry key, and the service will accept\n")
|
|
| 286 |
- TEXT(" requests on \\\\.\\pipe\\" PACKAGE "<id>\\service named pipe.\n"));
|
|
| 285 |
+ TEXT(" HKLM\\Software\\") TEXT(PACKAGE_NAME) TEXT("<id> registry key, and the service will accept\n")
|
|
| 286 |
+ TEXT(" requests on \\\\.\\pipe\\") TEXT(PACKAGE) TEXT("<id>\\service named pipe.\n"));
|
|
| 287 | 287 |
|
| 288 | 288 |
return 0; |
| 289 | 289 |
} |
| ... | ... |
@@ -37,9 +37,10 @@ |
| 37 | 37 |
#include <windows.h> |
| 38 | 38 |
#include <stdlib.h> |
| 39 | 39 |
#include <tchar.h> |
| 40 |
+#include "../tapctl/basic.h" |
|
| 40 | 41 |
|
| 41 |
-#define APPNAME TEXT(PACKAGE "serv") |
|
| 42 |
-#define SERVICE_DEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0" |
|
| 42 |
+#define APPNAME TEXT(PACKAGE) TEXT("serv")
|
|
| 43 |
+#define SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0")
|
|
| 43 | 44 |
|
| 44 | 45 |
/* |
| 45 | 46 |
* Message handling |