From patchwork Mon Oct 15 23:26:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Rozman X-Patchwork-Id: 557 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id UGYiMSq9xVvCDQAAIUCqbw for ; Tue, 16 Oct 2018 06:27:54 -0400 Received: from proxy7.mail.iad3b.rsapps.net ([172.31.255.6]) by director12.mail.ord1d.rsapps.net with LMTP id qJSZLiq9xVuWdAAAIasKDg ; Tue, 16 Oct 2018 06:27:54 -0400 Received: from smtp21.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy7.mail.iad3b.rsapps.net with LMTP id CBCSKCq9xVseDQAAQkQ5tQ ; Tue, 16 Oct 2018 06:27:54 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp21.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=rozman.si; dmarc=fail (p=none; dis=none) header.from=rozman.si X-Suspicious-Flag: YES X-Classification-ID: 23b45a66-d12e-11e8-8e35-525400cdc90a-1-1 Received: from [216.105.38.7] ([216.105.38.7:32689] helo=lists.sourceforge.net) by smtp21.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 48/70-29799-92DB5CB5; Tue, 16 Oct 2018 06:27:54 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gCMYr-0006qu-Q4; Tue, 16 Oct 2018 10:26:49 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gCMYq-0006qQ-BK for openvpn-devel@lists.sourceforge.net; Tue, 16 Oct 2018 10:26:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=emB+S2+0lH9otGt6cMWq6y6UyZs0+oDqWDqg1HkXx1w=; b=MmCtAman5du7GQfAbC2Gm9lRYh ZZFHm6WGeRnTvVjobcYMOmDr9QzNLogBm5oA9PxF6alP+kFlwM0o44oRPqQGNsLRKcJLp/nAH9uOm b7LnvSz/CNoUWdmT+o3UT4aDIX/kUblnfTDzmzJqARMVWTr1552hSbP8EAPJgatfwn7E=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=emB+S2+0lH9otGt6cMWq6y6UyZs0+oDqWDqg1HkXx1w=; b=bD5le0mw2C3T7kzhbivyEU2Sip 04DGx2RVjoJP0IWRkbn/qrrGrQG4On/TDjuVL/+Jzsza96jnnxoRn2uEW8UNg8Wu7M4WoufVKxzH9 AZM/Dp3hMzGU+ZOS9SDiWIG2u9Ec090eKQYA9csSEm/lWLtsQ73/nFC9fq5f7/+RNhHE=; Received: from pub5.amebis.si ([213.250.55.21]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1gCMYm-002cZB-HH for openvpn-devel@lists.sourceforge.net; Tue, 16 Oct 2018 10:26:48 +0000 Received: from s0.selo.doma (unknown [213.250.22.160]) by pub5.amebis.si (Postfix) with ESMTPS id 6A89220AA7 for ; Tue, 16 Oct 2018 12:26:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rozman.si; s=default; t=1539685595; bh=b+CHJvD+NC0Ofcplbzg76o6tafDwn1WtdYWcncg9tyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G5lxTaw3+mYeAHW4RC0mxseac2jdp1lB+4Ps+SlO3ssthXtgOC/l8nepRwg5AJRcD Kuw6+83dqsZffhtfDUPM5OR9CXRXevIsR28oN8j9YA5+SszL0+oiImmHDTimj19SI2 rOpTftDieZ0+3BanxTVVUXmEwTP1D4vZaCk4P0cU= Received: from s0.selo.doma ([127.0.0.1]) by s0.selo.doma with Microsoft SMTPSVC(10.0.14393.0); Tue, 16 Oct 2018 12:26:35 +0200 From: Simon Rozman To: openvpn-devel@lists.sourceforge.net Date: Tue, 16 Oct 2018 12:26:24 +0200 Message-Id: <20181016102627.18676-2-simon@rozman.si> X-Mailer: git-send-email 2.19.0.windows.1 In-Reply-To: <20181016102627.18676-1-simon@rozman.si> References: <20181010192337.6984-1-simon@rozman.si> <20181016102627.18676-1-simon@rozman.si> MIME-Version: 1.0 X-OriginalArrivalTime: 16 Oct 2018 10:26:35.0147 (UTC) FILETIME=[B6E3ADB0:01D4653A] X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1gCMYm-002cZB-HH Subject: [Openvpn-devel] [PATCH 2/5] Prevent __stdcall name mangling of MSVC X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Using `extern "C" __declspec(dllexport) __stdcall`, Win32 MSVC compiler exports the functions are as `_name@N`. Exporting functions using `/EXPORT` linker flag allows us to specify exact function name. Note: The 64-bit MSVC compiler does not exhibit `__stdcall` name- mangling. Acked-by: Jon Kunkee --- src/openvpnmsica/openvpnmsica.c | 12 ++++++++++++ src/openvpnmsica/openvpnmsica.h | 14 +++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c index 82333991..3b90ce05 100644 --- a/src/openvpnmsica/openvpnmsica.c +++ b/src/openvpnmsica/openvpnmsica.c @@ -145,6 +145,10 @@ openvpnmsica_setup_sequence_filename( UINT __stdcall FindTAPInterfaces(_In_ MSIHANDLE hInstall) { +#ifdef _MSC_VER +#pragma comment(linker, DLLEXP_EXPORT) +#endif + #ifdef _DEBUG MessageBox(NULL, TEXT("Attach debugger!"), TEXT(__FUNCTION__) TEXT(" v") TEXT(PACKAGE_VERSION), MB_OK); #endif @@ -247,6 +251,10 @@ cleanup_CoInitialize: UINT __stdcall EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall) { +#ifdef _MSC_VER +#pragma comment(linker, DLLEXP_EXPORT) +#endif + #ifdef _DEBUG MessageBox(NULL, TEXT("Attach debugger!"), TEXT(__FUNCTION__) TEXT(" v") TEXT(PACKAGE_VERSION), MB_OK); #endif @@ -505,6 +513,10 @@ cleanup_exec_seq: UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { +#ifdef _MSC_VER +#pragma comment(linker, DLLEXP_EXPORT) +#endif + #ifdef _DEBUG MessageBox(NULL, TEXT("Attach debugger!"), TEXT(__FUNCTION__) TEXT(" v") TEXT(PACKAGE_VERSION), MB_OK); #endif diff --git a/src/openvpnmsica/openvpnmsica.h b/src/openvpnmsica/openvpnmsica.h index 3a64fbaa..bb8e28ec 100644 --- a/src/openvpnmsica/openvpnmsica.h +++ b/src/openvpnmsica/openvpnmsica.h @@ -55,6 +55,14 @@ extern DWORD openvpnmsica_tlsidx_session; extern "C" { #endif +#ifdef __GNUC__ +#define DLLEXP_DECL __declspec(dllexport) +#else +#define DLLEXP_DECL +#define DLLEXP_EXPORT "/EXPORT:"__FUNCTION__"="__FUNCDNAME__ +#endif + + /** * Find existing TAP interfaces and set TAPINTERFACES property with semicolon delimited list * of installed TAP interface GUIDs. @@ -64,7 +72,7 @@ extern "C" { * @return ERROR_SUCCESS on success; An error code otherwise * See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx */ -__declspec(dllexport) UINT __stdcall +DLLEXP_DECL UINT __stdcall FindTAPInterfaces(_In_ MSIHANDLE hInstall); @@ -77,7 +85,7 @@ FindTAPInterfaces(_In_ MSIHANDLE hInstall); * @return ERROR_SUCCESS on success; An error code otherwise * See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx */ -__declspec(dllexport) UINT __stdcall +DLLEXP_DECL UINT __stdcall EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall); @@ -89,7 +97,7 @@ EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall); * @return ERROR_SUCCESS on success; An error code otherwise * See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx */ -__declspec(dllexport) UINT __stdcall +DLLEXP_DECL UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall); #ifdef __cplusplus