From: Lev Stipakov <l...@openvpn.net>

WinAPI uses __stdcall calling convention on x86. Wrong
calling convention causes UB, which in this case breaks
dco-win functionality.

Signed-off-by: Lev Stipakov <l...@openvpn.net>
---
 v2:
  - use WINAPI instead of __stdcall
  - replace another existing occurence of __stdcall with WINAPI
  - uncrustify

 src/openvpn/dco_win.c | 2 +-
 src/openvpn/win32.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c
index 7594024c..0931fb30 100644
--- a/src/openvpn/dco_win.c
+++ b/src/openvpn/dco_win.c
@@ -110,7 +110,7 @@ dco_connect_wait(HANDLE handle, OVERLAPPED *ov, int 
timeout, struct signal_info
 {
     volatile int *signal_received = &sig_info->signal_received;
     /* GetOverlappedResultEx is available starting from Windows 8 */
-    typedef BOOL (*get_overlapped_result_ex_t) (HANDLE, LPOVERLAPPED, LPDWORD, 
DWORD, BOOL);
+    typedef BOOL (WINAPI *get_overlapped_result_ex_t)(HANDLE, LPOVERLAPPED, 
LPDWORD, DWORD, BOOL);
     get_overlapped_result_ex_t get_overlapped_result_ex =
         
(get_overlapped_result_ex_t)GetProcAddress(GetModuleHandle("Kernel32.dll"),
                                                    "GetOverlappedResultEx");
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index 44176936..6d482ef8 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -1352,7 +1352,7 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
     *process_arch = ARCH_UNKNOWN;
     *host_arch = ARCH_NATIVE;
 
-    typedef BOOL (__stdcall *is_wow64_process2_t)(HANDLE, USHORT *, USHORT *);
+    typedef BOOL (WINAPI *is_wow64_process2_t)(HANDLE, USHORT *, USHORT *);
     is_wow64_process2_t is_wow64_process2 = (is_wow64_process2_t)
                                             
GetProcAddress(GetModuleHandle("Kernel32.dll"), "IsWow64Process2");
 
-- 
2.38.1.windows.1



_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to