From: "cron2 (Code Review)" Date: Mon, 27 Jan 2025 09:36:07 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <49c93b2e6e54d04148f84825a4c84b9166a8105f-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="nNj/4pimD+k="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: openvpnserv: Fix some inconsistent usages of TEXT() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: stipa , plaisthos , openvpn-devel --nNj/4pimD+k= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/85= 1?usp=3Demail ) Change subject: openvpnserv: Fix some inconsistent usages of TEXT() ...................................................................... openvpnserv: Fix some inconsistent usages of TEXT() 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 Acked-by: Lev Stipakov Message-Id: <20250127091102.26983-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 603.html Signed-off-by: Gert Doering --- M src/openvpnserv/CMakeLists.txt M src/openvpnserv/common.c M src/openvpnserv/interactive.c M src/openvpnserv/service.c M src/openvpnserv/service.h 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/openvpnserv/CMakeLists.txt b/src/openvpnserv/CMakeLists.txt index 154e17c..ff03867 100644 --- a/src/openvpnserv/CMakeLists.txt +++ b/src/openvpnserv/CMakeLists.txt @@ -17,6 +17,7 @@ interactive.c service.c service.h validate.c validate.h + ../tapctl/basic.h ../openvpn/wfp_block.c ../openvpn/wfp_block.h openvpnserv_resources.rc ../openvpn/ring_buffer.h diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c index 61a7296..a88a724 100644 --- a/src/openvpnserv/common.c +++ b/src/openvpnserv/common.c @@ -45,7 +45,7 @@ if (status !=3D ERROR_SUCCESS) { SetLastError(status); - return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value= : HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value); + return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value= : HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance,= value); } return ERROR_SUCCESS; @@ -63,7 +63,7 @@ TCHAR install_path[MAX_PATH]; TCHAR default_value[MAX_PATH]; - swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME = "%ls"), service_instance); + swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE= _NAME) TEXT("%ls"), service_instance); LONG status =3D RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ= , &key); if (status !=3D ERROR_SUCCESS) diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 67f5bbc..35753b7 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -60,9 +60,9 @@ openvpn_service_t interactive_service =3D { interactive, - TEXT(PACKAGE_NAME "ServiceInteractive"), - TEXT(PACKAGE_NAME " Interactive Service"), - TEXT(SERVICE_DEPENDENCIES), + TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"), + TEXT(PACKAGE_NAME) TEXT(" Interactive Service"), + SERVICE_DEPENDENCIES, SERVICE_AUTO_START }; @@ -1973,7 +1973,7 @@ } swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name), - TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_ins= tance, GetCurrentThreadId()); + TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"),= service_instance, GetCurrentThreadId()); ovpn_pipe =3D CreateNamedPipe(ovpn_pipe_name, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_= INSTANCE | FILE_FLAG_OVERLAPPED, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE = | PIPE_WAIT, 1, 128, 128, 0, NULL); @@ -2173,7 +2173,7 @@ } TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 = characters long according to MSDN. */ - swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE = "%ls\\service"), service_instance); + swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PA= CKAGE) TEXT("%ls\\service"), service_instance); HANDLE pipe =3D CreateNamedPipe(pipe_name, flags, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAG= E | PIPE_REJECT_REMOTE_CLIENTS, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0,= &sa); diff --git a/src/openvpnserv/service.c b/src/openvpnserv/service.c index a71f5c6..054fc5f 100644 --- a/src/openvpnserv/service.c +++ b/src/openvpnserv/service.c @@ -282,8 +282,8 @@ wprintf(TEXT("-instance interactive \n") TEXT(" Runs the service as an alternate instance= .\n") TEXT(" The service settings will be loaded from\= n") - TEXT(" HKLM\\Software\\" PACKAGE_NAME " regi= stry key, and the service will accept\n") - TEXT(" requests on \\\\.\\pipe\\" PACKAGE "\= \service named pipe.\n")); + TEXT(" HKLM\\Software\\") TEXT(PACKAGE_NAME) TEX= T(" registry key, and the service will accept\n") + TEXT(" requests on \\\\.\\pipe\\") TEXT(PACKAGE)= TEXT("\\service named pipe.\n")); return 0; } diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h index 6b559a5..da20433 100644 --- a/src/openvpnserv/service.h +++ b/src/openvpnserv/service.h @@ -37,9 +37,10 @@ #include #include #include +#include "../tapctl/basic.h" -#define APPNAME TEXT(PACKAGE "serv") -#define SERVICE_DEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0" +#define APPNAME TEXT(PACKAGE) TEXT("serv") +#define SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0") /* * Message handling -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/851?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3 Gerrit-Change-Number: 851 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --nNj/4pimD+k= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

openvpnserv: Fix some inconsistent usages of T=
EXT()

In general you can't use multiple strings as argument
t= o TEXT() since it just adds a L in front of the argument.
So if you spec= ifiy 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 an= d
openvpnmsica.

Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5= dd3
Signed-off-by: Frank Lichtenheld <frank@...2641...>
Acked-b= y: Lev Stipakov <lstipakov@...277...>
Message-Id: <202501270911= 02.26983-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn= -devel@lists.sourceforge.net/msg30603.html
Signed-off-by: Gert Doering &= lt;gert@...1296...>
---
M src/openvpnserv/CMakeLists.txt
M src/= openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/openvpnser= v/service.c
M src/openvpnserv/service.h
5 files changed, 13 insertion= s(+), 11 deletions(-)

diff --git a/src/openvpnserv/CMakeLists.txt b/src/openvpnserv/CMakeLists=
.txt
index 154e17c..ff03867 100644
--- a/sr= c/openvpnserv/CMakeLists.txt
+++ b/src/openvpnserv/CMakeLis= ts.txt
@@ -17,6 +17,7 @@
interactive.c=
service.c service.h
validate.c v= alidate.h
+ ../tap= ctl/basic.h
../openvpn/wfp_block.c ../openvpn/wfp_bloc= k.h
openvpnserv_resources.rc
../o= penvpn/ring_buffer.h
diff --git a/src/openvpnserv/common.c = b/src/openvpnserv/common.c
index 61a7296..a88a724 100644
--- a/src/openvpnserv/common.c
+++ b/src/open= vpnserv/common.c
@@ -45,7 +45,7 @@
if = (status !=3D ERROR_SUCCESS)
{
= SetLastError(status);
= - return MsgToEventLog(M_SYSERR, TEXT("Error querying registry = value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_i= nstance, value);
+ = return MsgToEventLog(M_SYSERR, TEXT("Error querying registry valu= e: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), s= ervice_instance, value);
}
return ERROR_SUCCESS;
@@ -63,7 +63,7 @@<= br> TCHAR install_path[MAX_PATH];
TCHAR defa= ult_value[MAX_PATH];

- swprintf(reg_path, _countof(reg_path), TEXT("SOFT= WARE\\" PACKAGE_NAME "%ls"), service_instance);
+ swprintf(reg_path, _countof(= reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls&q= uot;), service_instance);


LONG statu= s =3D RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key);
if (status !=3D ERROR_SUCCESS)
diff --gi= t a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.cindex 67f5bbc..35753b7 100644
--- a/src/openvpnserv/= interactive.c
+++ b/src/openvpnserv/interactive.c@@ -60,9 +60,9 @@

openvpn_service= _t interactive_service =3D {
interactive,
- TEXT(PACKAGE_NAME "Servic= eInteractive"),

- = TEXT(PACKAGE_NAME " Interactive Service"),
- TEXT(SERVICE_DEPENDENCIES),+ TEXT(PACKAGE_NAME) TEXT(&= quot;ServiceInteractive"),
+ TEXT(PACKAGE_NAME) TEXT(" Interactive Service"),<= /span>
+ SERVICE_DEPENDEN= CIES,
SERVICE_AUTO_START
};
@@ -1973,7 +1973,7 @@
}

swprintf(ovpn_pipe_name, _countof(ovpn_pi= pe_name),
- = TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), serv= ice_instance, GetCurrentThreadId());
+ TEXT("\\\\.\\pipe\\") TEXT(PACKAGE)= TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId()= );
ovpn_pipe =3D CreateNamedPipe(ovpn_pipe_name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_= FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
= PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1,= 128, 128, 0, NULL);
@@ -2173,7 +2173,7 @@
= }

TCHAR pipe_name[256]; /* The = entire pipe name string can be up to 256 characters long according to MSDN.= */
- swprintf(pipe_= name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls= \\service"), service_instance);
+ swprintf(pipe_name, _countof(pipe_name), TEXT("\\= \\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_in= stance);
HANDLE pipe =3D CreateNamedPipe(pipe_name, fl= ags,
PIPE_TYPE_MESSAGE |= PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS,
= PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &= sa);
diff --git a/src/openvpnserv/service.c b/src/openvpnse= rv/service.c
index a71f5c6..054fc5f 100644
= --- a/src/openvpnserv/service.c
+++ b/src/openvpnserv/servi= ce.c
@@ -282,8 +282,8 @@
w= printf(TEXT("-instance interactive <id>\n")
TEXT(" Runs the service as an alternate in= stance.\n")

TEXT(" The= service settings will be loaded from\n")
- TEXT(" HKLM\\Softwa= re\\" PACKAGE_NAME "<id> registry key, and the service will= accept\n")
- = TEXT(" requests on \\\\.\\pipe\\" PACKAGE &q= uot;<id>\\service named pipe.\n"));
+ TEXT(" HKLM\\Soft= ware\\") TEXT(PACKAGE_NAME) TEXT("<id> registry key, and th= e service will accept\n")
+ TEXT(" requests on \\\\.\\pipe\\&= quot;) TEXT(PACKAGE) TEXT("<id>\\service named pipe.\n"));<= /span>

return 0;
}

diff --git a/src/openvpnserv/service.h b/s= rc/openvpnserv/service.h
index 6b559a5..da20433 100644
--- a/src/openvpnserv/service.h
+++ b/src/openv= pnserv/service.h
@@ -37,9 +37,10 @@
#inclu= de <windows.h>
#include <stdlib.h>
<= span> #include <tchar.h>

+#include "../tapctl/basic.h"
<= br>-#define APPNAME TEXT(PACKAGE= "serv")
-#de= fine SERVICE_DEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
+#define APPNAME TEXT(PA= CKAGE) TEXT("serv")
+#define SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT(&qu= ot;\0Dhcp\0\0")

/*
= * Message handling

To view, visit change 851. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iea477ac96b0dbaee24ca8d097a2= e1958f70c5dd3
Gerrit-Change-Number: 851
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--nNj/4pimD+k=--