[Common-dev] CR-Client: support custom display name in Windows' firewall exception list
Henry Ping ping at real.comThe current HXWinFirewallControlManager::OpenApp() ingores its 1st input
parameter(pszAppName) and always sets "HelixDNAClient" as the display name
shown in Windows' firewall exception list.
The change is to honor the pszAppName input as the display name if it's not
NULL, otherwise, we still fallback to use internal "HelixDNAClient".
Branches:
HEAD, Cayenne150 and Neptune123
Diffs:
Index: platform/win/win_fwctlmgr.cpp
===================================================================
RCS file: /cvsroot/common/netio/platform/win/win_fwctlmgr.cpp,v
retrieving revision 1.5
diff -u -w -4 -r1.5 win_fwctlmgr.cpp
--- platform/win/win_fwctlmgr.cpp 2 Nov 2004 18:36:00 -0000 1.5
+++ platform/win/win_fwctlmgr.cpp 3 Aug 2005 20:18:21 -0000
@@ -218,8 +218,9 @@
HRESULT hr = S_OK;
HX_RESULT rc = HXR_OK;
wchar_t pOutWideBuf[MAX_PATH];
BSTR appBstrName = NULL;
+ BSTR appDisplayBstrName = NULL;
INetFwAuthorizedApplication* fwAuthorizedApp = NULL;
INetFwAuthorizedApplications* fwAuthorizedApps = NULL;
if (!m_bInitialized)
@@ -252,9 +253,20 @@
{
goto exit;
}
+ if (pszAppName)
+ {
+ // convert string to unicode
+ MultiByteToWideChar(0, 0, pszAppName, strlen(pszAppName) +
1, pOutWideBuf, MAX_PATH);
+ appDisplayBstrName = SysAllocString((const unsigned
short*)pOutWideBuf);
+ hr = fwAuthorizedApp->put_Name(appDisplayBstrName);
+ }
+ else
+ {
hr = fwAuthorizedApp->put_Name(m_fwBstrName);
+ }
+
if (FAILED(hr))
{
goto exit;
}
@@ -278,8 +290,9 @@
exit:
SysFreeString(appBstrName);
+ SysFreeString(appDisplayBstrName);
HX_RELEASE(fwAuthorizedApp);
HX_RELEASE(fwAuthorizedApps);
if (S_OK != hr && E_UNEXPECTED != hr)
-->Henry