summaryrefslogtreecommitdiff
path: root/network/wlan/ihvsampleui
diff options
context:
space:
mode:
authorkarlf <[email protected]>2016-08-11 13:28:13 -0700
committerkarlf <[email protected]>2016-08-11 13:28:13 -0700
commit96eb96dfb613e4c745db6bd1f53a92fe7e2290fc (patch)
treead5f3ede5cbcd6b598677ce41bcf8318471bdd92 /network/wlan/ihvsampleui
parent687b274aa38fd05c8c26e3068932121876d7f745 (diff)
Updated for "Windows 10 Anniversary Update" (Version 1607)
Diffstat (limited to 'network/wlan/ihvsampleui')
-rw-r--r--network/wlan/ihvsampleui/IHVClassFactory.cpp166
-rw-r--r--network/wlan/ihvsampleui/IHVClassFactory.h28
-rw-r--r--network/wlan/ihvsampleui/IHVRegistryHelper.cpp284
-rw-r--r--network/wlan/ihvsampleui/IHVRegistryHelper.h40
-rw-r--r--network/wlan/ihvsampleui/IHVSample.idl71
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUI.cpp971
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUI.h238
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUICon.cpp345
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUICon.h103
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUIKey.cpp462
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUIKey.h104
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUISec.cpp434
-rw-r--r--network/wlan/ihvsampleui/IHVSampleExtUISec.h105
-rw-r--r--network/wlan/ihvsampleui/IHVSampleProfile.cpp918
-rw-r--r--network/wlan/ihvsampleui/IHVSampleProfile.h296
-rw-r--r--network/wlan/ihvsampleui/IHVSampleUI.cpp122
-rw-r--r--network/wlan/ihvsampleui/IHVSampleUI.def7
-rw-r--r--network/wlan/ihvsampleui/IHVSampleUI.rc129
-rw-r--r--network/wlan/ihvsampleui/IHVSampleUI.vcxproj257
-rw-r--r--network/wlan/ihvsampleui/IHVSampleUI.vcxproj.Filters60
-rw-r--r--network/wlan/ihvsampleui/IHVUIInc.idl1
-rw-r--r--network/wlan/ihvsampleui/iunk.h54
-rw-r--r--network/wlan/ihvsampleui/precomp.h44
-rw-r--r--network/wlan/ihvsampleui/resource.h31
-rw-r--r--network/wlan/ihvsampleui/utils.cpp408
-rw-r--r--network/wlan/ihvsampleui/utils.h98
26 files changed, 5776 insertions, 0 deletions
diff --git a/network/wlan/ihvsampleui/IHVClassFactory.cpp b/network/wlan/ihvsampleui/IHVClassFactory.cpp
new file mode 100644
index 00000000..7da337d5
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVClassFactory.cpp
@@ -0,0 +1,166 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+#include "ihvuiinc_i.c"
+
+extern long g_serverLock; //lock count on server
+
+//
+// IUnknown Implementation
+//
+CIHVClassFactory::CIHVClassFactory() : m_refCount(1)
+{
+}
+
+CIHVClassFactory::~CIHVClassFactory()
+{
+}
+
+STDMETHODIMP_(ULONG)
+CIHVClassFactory::AddRef()
+{
+ return InterlockedIncrement(&m_refCount);
+}
+
+STDMETHODIMP_(ULONG)
+CIHVClassFactory::Release()
+{
+ ULONG refCount = InterlockedDecrement(&m_refCount);
+ if (refCount == 0)
+ {
+ delete this;
+ }
+ return refCount;
+}
+
+STDMETHODIMP
+CIHVClassFactory::QueryInterface(
+ REFIID riid,
+ void **ppvObject
+ )
+{
+ HRESULT hr = E_INVALIDARG;
+ if (NULL != ppvObject)
+ {
+ hr = S_OK;
+ if (riid == IID_IUnknown)
+ {
+ *ppvObject = static_cast<IUnknown *>(this);
+ }
+ else if (riid == IID_IClassFactory)
+ {
+ *ppvObject = static_cast<IClassFactory *>(this);
+ }
+ else
+ {
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
+ }
+ reinterpret_cast<IUnknown *>(*ppvObject)->AddRef();
+ }
+
+ return hr;
+}
+
+
+//
+// IClassFactory Implementaion
+//
+STDMETHODIMP
+CIHVClassFactory::CreateInstance(
+ IUnknown *pUnkOuter,
+ REFIID riid,
+ void **ppvObject
+ )
+{
+ HRESULT hr = E_NOINTERFACE;
+
+ // aggregation not supported
+ if (pUnkOuter != NULL)
+ {
+ return CLASS_E_NOAGGREGATION;
+ }
+
+ if (NULL == ppvObject)
+ {
+ return E_INVALIDARG;
+ }
+
+ // Figure out which interface is wanted
+ // the ui will call us only as IID_IDot11ExtUI
+ if (IID_IDot11SampleExtUI == riid ||
+ IID_IDot11ExtUI == riid ||
+ IID_IWizardExtension == riid)
+ {
+ CDot11SampleExtUI *pExtUI = new(std::nothrow) CDot11SampleExtUI();
+ if (NULL == pExtUI)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ pExtUI->AddRef();
+ hr = pExtUI->QueryInterface(riid, ppvObject);
+
+ pExtUI->Release();
+ }
+ else if (IID_IDot11SampleExtUIConProperty == riid)
+ {
+ CDot11SampleExtUIConProperty *pCDot11SampleExtUIConProperty = new(std::nothrow) CDot11SampleExtUIConProperty();
+ if (NULL == pCDot11SampleExtUIConProperty)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ pCDot11SampleExtUIConProperty->AddRef();
+ hr = pCDot11SampleExtUIConProperty->QueryInterface(riid, ppvObject);
+
+ pCDot11SampleExtUIConProperty->Release();
+ }
+ else if (IID_IDot11SampleExtUISecProperty == riid)
+ {
+ CDot11SampleExtUISecProperty *pCDot11SampleExtUISecProperty = new(std::nothrow) CDot11SampleExtUISecProperty();
+ if (NULL == pCDot11SampleExtUISecProperty)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ pCDot11SampleExtUISecProperty->AddRef();
+ hr = pCDot11SampleExtUISecProperty->QueryInterface(riid, ppvObject);
+
+ pCDot11SampleExtUISecProperty->Release();
+ }
+ else if (IID_IDot11SampleExtUIKeyProperty == riid)
+ {
+ CDot11SampleExtUIKeyProperty *pCDot11SampleExtUIKeyProperty = new(std::nothrow) CDot11SampleExtUIKeyProperty();
+ if (NULL == pCDot11SampleExtUIKeyProperty)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ pCDot11SampleExtUIKeyProperty->AddRef();
+ hr = pCDot11SampleExtUIKeyProperty->QueryInterface(riid, ppvObject);
+
+ pCDot11SampleExtUIKeyProperty->Release();
+ }
+
+ return hr;
+}
+
+
+STDMETHODIMP
+CIHVClassFactory::LockServer(BOOL fLock)
+{
+ if (fLock)
+ {
+ InterlockedIncrement(&g_serverLock);
+ }
+ else
+ {
+ InterlockedDecrement(&g_serverLock);
+ }
+
+ return S_OK;
+}
diff --git a/network/wlan/ihvsampleui/IHVClassFactory.h b/network/wlan/ihvsampleui/IHVClassFactory.h
new file mode 100644
index 00000000..60f814c3
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVClassFactory.h
@@ -0,0 +1,28 @@
+
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#pragma once
+
+// The class factory
+class CIHVClassFactory : public IClassFactory
+{
+public:
+ // Constructor
+ CIHVClassFactory();
+ ~CIHVClassFactory();
+
+ // IUnknown
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+ STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject);
+
+ // IClassFactory
+ STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject);
+ STDMETHODIMP LockServer(BOOL fLock);
+
+private:
+ long m_refCount;
+};
diff --git a/network/wlan/ihvsampleui/IHVRegistryHelper.cpp b/network/wlan/ihvsampleui/IHVRegistryHelper.cpp
new file mode 100644
index 00000000..ebe8622c
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVRegistryHelper.cpp
@@ -0,0 +1,284 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+
+#define CLSIDSTR_CALLBACK L"{4A01f9f9-6012-4343-A8C4-10B5DF32672A}" // IHV Ext UI CLSID
+#define CLSID_CALLBACK_FRIENDLY_NAME L"Wireless 802.11 IHV Sample Config UI"
+
+#define REGCLSID L"CLSID"
+#define INPROCSERVER32 L"InprocServer32"
+#define THREADINGMODEL L"ThreadingModel"
+#define FREETHREADING L"Both"
+
+#define ARRAY_SIZE(s) (sizeof(s) / sizeof(s[0]))
+
+extern HINSTANCE g_hInst;
+
+
+typedef HRESULT (APIENTRY *RegisterPageWithPageProc) (
+ const GUID *pguidParentPage,
+ const GUID *pguidChildPage,
+ const LPWSTR pszChildModuleFileName,
+ const LPWSTR pszFriendlyName,
+ const DWORD dwBehaviorFlags,
+ const DWORD dwUserFlags,
+ const LPWSTR pszCommandLine);
+
+typedef HRESULT (APIENTRY *UnregisterPageProc) (
+ const GUID *pguidPage,
+ const BOOL fUnregisterFromCOM);
+
+
+
+//
+// RegisterServer - Register the COM Server by creating required keys
+//
+
+#pragma warning (push)
+#pragma warning (disable:6262)
+
+HRESULT
+CRegHelper::RegisterServer ()
+{
+ HRESULT hr = S_OK;
+ wchar_t wszModule[_MAX_PATH] = {0};
+ DWORD result = 0;
+
+ result = GetModuleFileName(g_hInst, wszModule, ARRAY_SIZE(wszModule));
+
+ if (result == 0)
+ {
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ wchar_t wszCLSIDKey[MAX_LENGTH] = {0}; // CLSID\\wszCLSID.
+ wchar_t wszInprocKey[MAX_LENGTH + 2] = {0}; // CLSID\\InprocServer32
+
+ // get the class ID strings.
+ StringCchCopyW(wszCLSIDKey, MAX_LENGTH, REGCLSID);
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, L"\\");
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, CLSIDSTR_CALLBACK);
+
+ // create entries under CLSID.
+ // Description
+ FAILHR(SetKeyAndValue(wszCLSIDKey, NULL, CLSID_CALLBACK_FRIENDLY_NAME));
+ // set the server path.
+ FAILHR(SetKeyAndValue(wszCLSIDKey, INPROCSERVER32, wszModule));
+
+ // add the threading model information.
+ hr = StringCchPrintfW(wszInprocKey, MAX_LENGTH + 2, L"%s\\%s", wszCLSIDKey, INPROCSERVER32);
+ if(FAILED(hr))
+ {
+ hr = S_FALSE;
+ return hr;
+ }
+
+ FAILHR(SetRegValue(wszInprocKey, THREADINGMODEL, FREETHREADING));
+
+ // register the extension UI wizard page
+ HINSTANCE hinstLib = LoadLibrary(TEXT("connect.dll"));
+ if (hinstLib != NULL)
+ {
+
+ // get the export function used for registering
+ RegisterPageWithPageProc registerPageWithPageProc =
+ (RegisterPageWithPageProc) GetProcAddress(hinstLib, (LPCSTR)("RegisterPageWithPage"));
+
+ if (NULL != registerPageWithPageProc)
+ {
+ hr = (registerPageWithPageProc) (NULL, // stand alone page (no parent)
+ &GUID_SAMPLE_IHVUI_CLSID, // clsid of the extension UI wizard page
+ NULL, // filename already registered through COM
+ CLSID_CALLBACK_FRIENDLY_NAME, // friendly name
+ 0x2, // allow duplicate instances
+ 0, // no user flags
+ NULL); // no command line
+ }
+
+ FreeLibrary(hinstLib);
+ }
+
+ return hr;
+}
+#pragma warning (pop)
+
+//
+// UnRegisterServer - Register the COM Server by creating required keys
+//
+HRESULT
+CRegHelper::UnregisterServer()
+{
+ HRESULT hr = S_OK;
+ wchar_t wszCLSIDKey[MAX_LENGTH] = {0}; // CLSID\\wszCLSID.
+
+
+ // get the class ID strings.
+ StringCchCopyW(wszCLSIDKey,MAX_LENGTH, REGCLSID);
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, L"\\");
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, CLSIDSTR_CALLBACK);
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, L"\\");
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, INPROCSERVER32);
+
+
+ // delete the sub key of the Class ID key
+ FAILHR(DeleteKey(wszCLSIDKey));
+
+ StringCchCopyW(wszCLSIDKey,MAX_LENGTH, REGCLSID);
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, L"\\");
+ StringCchCatW(wszCLSIDKey, MAX_LENGTH, CLSIDSTR_CALLBACK);
+
+ // delete Class ID key
+ FAILHR(DeleteKey(wszCLSIDKey));
+
+ // unregister the extension UI wizard page
+ HINSTANCE hinstLib = LoadLibrary(TEXT("connect.dll"));
+ if (hinstLib != NULL)
+ {
+
+ // get the export function used for unregistering
+ UnregisterPageProc unregisterPageProc =
+ (UnregisterPageProc) GetProcAddress(hinstLib, (LPCSTR)("UnregisterPage"));
+
+ if (NULL != unregisterPageProc)
+ {
+ hr = (unregisterPageProc) (&GUID_SAMPLE_IHVUI_CLSID, // clsid of the extension UI wizard page
+ FALSE); // already unregistered from COM
+ }
+
+ FreeLibrary(hinstLib);
+ }
+
+ return hr;
+
+}
+
+//
+// Set an entry in the registry of the form:
+// HKEY_CLASSES_ROOT\wszKey\wszSubkey = wszValue
+//
+BOOL
+CRegHelper::SetKeyAndValue(
+ const wchar_t* pwszKey,
+ const wchar_t* pwszSubkey,
+ const wchar_t* pwszValue
+ )
+{
+ HKEY hKey; // handle to the new reg key.
+ wchar_t wszRegKey[MAX_LENGTH] = {0}; // buffer for the full key name.
+
+
+ // init the key with the base key name.
+ StringCchCopyW(wszRegKey, MAX_LENGTH, pwszKey);
+ // append the subkey name (if there is one).
+ if (pwszSubkey != NULL)
+ {
+ StringCchCatW(wszRegKey, MAX_LENGTH, L"\\");
+ StringCchCatW(wszRegKey, MAX_LENGTH, pwszSubkey);
+ }
+
+ // create the registry key.
+ if (RegCreateKeyEx(
+ HKEY_CLASSES_ROOT,
+ wszRegKey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS,
+ NULL,
+ &hKey,
+ NULL) == ERROR_SUCCESS)
+ {
+ // set the value (if there is one).
+ if (pwszValue != NULL)
+ {
+ RegSetValueEx(
+ hKey,
+ NULL,
+ 0,
+ REG_SZ,
+ (BYTE *)pwszValue,
+ (DWORD) ((wcslen(pwszValue) + 1) * sizeof (wchar_t))
+ );
+ }
+
+ RegCloseKey(hKey);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+//
+// SetRegValue - Open the key, create a new keyword and value pair under it.
+//
+BOOL
+CRegHelper::SetRegValue(
+ const wchar_t* pwszKeyName,
+ const wchar_t* pwszKeyword,
+ const wchar_t* pwszValue
+ )
+{
+ HKEY hKey; // handle to the new reg key.
+
+ // create the registration key.
+ if (RegCreateKeyEx(
+ HKEY_CLASSES_ROOT,
+ pwszKeyName,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS,
+ NULL,
+ &hKey,
+ NULL) == ERROR_SUCCESS)
+ {
+ // set the value (if there is one).
+ if (pwszValue != NULL)
+ {
+ RegSetValueEx(
+ hKey,
+ pwszKeyword,
+ 0,
+ REG_SZ,
+ (BYTE *)pwszValue,
+ (DWORD) ((wcslen(pwszValue) + 1) * sizeof (wchar_t))
+ );
+ }
+
+ RegCloseKey(hKey);
+
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+//
+// Delete an entry in the registry of the form:
+// HKEY_CLASSES_ROOT\wszKey\wszSubkey = wszValue
+//
+BOOL
+CRegHelper::DeleteKey(const wchar_t* pwszSubkey)
+{
+ DWORD result = 0;
+
+ if (pwszSubkey != NULL)
+ {
+ // delete the registry key.
+ result = RegDeleteKey(HKEY_CLASSES_ROOT, pwszSubkey);
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ return ((ERROR_SUCCESS == result)?TRUE:FALSE);
+}
+
+
diff --git a/network/wlan/ihvsampleui/IHVRegistryHelper.h b/network/wlan/ihvsampleui/IHVRegistryHelper.h
new file mode 100644
index 00000000..76c85b1c
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVRegistryHelper.h
@@ -0,0 +1,40 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#pragma once
+
+#define FAILHR(result) \
+ if (result == FALSE) \
+ {\
+ hr = S_FALSE;\
+ return hr;\
+ }
+
+
+#define MAX_LENGTH 256
+
+
+class CRegHelper
+{
+ public:
+ static HRESULT STDMETHODCALLTYPE RegisterServer();
+ static HRESULT STDMETHODCALLTYPE UnregisterServer();
+
+private:
+ static BOOL SetKeyAndValue(
+ const wchar_t *pszKey,
+ const wchar_t *pszSubkey,
+ const wchar_t *pszValue
+ );
+
+ static BOOL DeleteKey(const wchar_t *pszSubkey);
+
+ static BOOL SetRegValue(
+ const wchar_t *pszKeyName,
+ const wchar_t *pszKeyword,
+ const wchar_t *pszValue
+ );
+};
+
diff --git a/network/wlan/ihvsampleui/IHVSample.idl b/network/wlan/ihvsampleui/IHVSample.idl
new file mode 100644
index 00000000..81e05140
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSample.idl
@@ -0,0 +1,71 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+import "unknwn.idl";
+import "wtypes.idl";
+import "ihvuiinc.idl"; // For wireless UI extensions
+
+interface IWizardExtension;
+interface IObjectWithSite;
+
+interface IDot11SampleExtUI;
+interface IDot11SampleExtUIConProperty;
+interface IDot11SampleExtUISecProperty;
+
+[
+ uuid(7ca89d4b-2c5b-4368-b53a-ffa14e031179),
+ helpstring(" Dot11 IHV Extensibility UI Interface"),
+ dual
+]
+
+interface IDot11SampleExtUI: IDot11ExtUI
+{
+}
+
+
+
+[
+ uuid(61055513-2f27-4962-b29c-d6d7d1500fec),
+ helpstring(" Dot11 IHV Extensibility UI Connection Properties Interface"),
+ dual
+]
+
+interface IDot11SampleExtUIConProperty: IDot11ExtUIProperty
+{
+ [id(1), hidden, helpstring("method Initialize")]
+ HRESULT
+ Initialize([in] BSTR bstrPropertyName);
+}
+
+
+[
+ uuid(12c211ae-1b6d-471c-9c1b-698bcc9b9d97),
+ helpstring(" Dot11 IHV Extensibility UI Security Properties Interface"),
+ dual
+]
+
+interface IDot11SampleExtUISecProperty: IDot11ExtUIProperty
+{
+ [id(1), hidden, helpstring("method Initialize")]
+ HRESULT
+ Initialize([in] BSTR bstrPropertyName, [in] DWORD dwIhvSecurity);
+}
+
+
+[
+ uuid(a18bae3c-39c2-4b34-ba49-0130e431d2ca),
+ helpstring(" Dot11 IHV Extensibility UI Key Properties Interface"),
+ dual
+]
+
+interface IDot11SampleExtUIKeyProperty: IDot11ExtUIProperty
+{
+ [id(1), hidden, helpstring("method Initialize")]
+ HRESULT
+ Initialize([in] BYTE* pvData);
+}
+
+
+
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUI.cpp b/network/wlan/ihvsampleui/IHVSampleExtUI.cpp
new file mode 100644
index 00000000..a5e60d7a
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUI.cpp
@@ -0,0 +1,971 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+#include "ihvsample_i.c"
+
+extern HINSTANCE g_hInst;
+
+LPWSTR g_IHVAuthFriendlyName[] = {
+ L"IHVAuth V1",
+ L"IHVAuth V2",
+ L"IHVAuth V3"
+};
+
+LPWSTR g_IHVCipherFriendlyName[] = {
+ L"None",
+ L"IHVCipher 1",
+ L"IHVCipher 2",
+ L"IHVCipher 3"
+};
+
+IHV_AUTH_CIPHER_CAPABILITY g_IHVOneXExtCapability =
+{
+ 3,
+ {
+ {
+ IHVAuthV1,
+ 1,
+ {IHVCipher1}
+ },
+ {
+ IHVAuthV2,
+ 3,
+ {None, IHVCipher1, IHVCipher2}
+ },
+ {
+ IHVAuthV3,
+ 2,
+ {IHVCipher2, IHVCipher3}
+ }
+ }
+};
+
+
+static const WCHAR c_szIhvUIRequest[] = L"_UI_Request";
+static const WCHAR c_szIhvUIResponse[] = L"_UI_Response";
+
+template<typename T>
+T* GetThis(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ static const WCHAR c_szThisPointer[]= L"_Win32_this_";
+ UNREFERENCED_PARAMETER(wParam);
+
+ T* pThis = NULL;
+ if (uMsg == WM_INITDIALOG)
+ {
+ if (sizeof(PROPSHEETPAGE) == ((LPPROPSHEETPAGE)lParam)->dwSize)
+ {
+ // This corresponds to MSDN
+ pThis = (T *)((LPPROPSHEETPAGE)lParam)->lParam;
+ }
+ else
+ {
+ // TODO: Need to determine when this abnormality happens...
+ pThis = (T *)lParam;
+ }
+
+ SetProp(hwnd, c_szThisPointer, (HANDLE)pThis);
+
+ }
+ else if (uMsg == WM_DESTROY)
+ {
+ RemoveProp(hwnd, c_szThisPointer);
+ }
+ else
+ {
+ pThis = (T *)GetProp(hwnd, c_szThisPointer);
+ }
+
+ return pThis;
+}
+
+
+CDot11SampleExtUI::CDot11SampleExtUI(): m_crefCount(0)
+{
+ InterlockedIncrement(&g_objRefCount);
+
+ m_pUnkSite = NULL;
+ m_hFirstPagePsp = NULL;
+ m_hLastPagePsp = NULL;
+ m_pUIRequest = NULL;
+}
+
+CDot11SampleExtUI::~CDot11SampleExtUI()
+{
+ InterlockedDecrement(&g_objRefCount);
+
+ if( m_pUIRequest)
+ {
+ delete m_pUIRequest;
+ }
+
+ if( m_pUnkSite)
+ {
+ m_pUnkSite ->Release();
+ m_pUnkSite = NULL;
+ }
+}
+
+// Used to get the IHV friendly name
+STDMETHODIMP
+CDot11SampleExtUI::GetDot11ExtUIFriendlyName(
+ BSTR* bstrFriendlyName)
+{
+ HRESULT hr = E_INVALIDARG;
+
+ if (NULL != bstrFriendlyName)
+ {
+ *bstrFriendlyName = SysAllocString(IHV_SAMPLE_IHV_NAME);
+ hr = S_OK;
+ }
+
+ return hr;
+}
+
+
+// Returns the requested property type
+STDMETHODIMP
+CDot11SampleExtUI::GetDot11ExtUIProperties(
+ DOT11_EXT_UI_PROPERTY_TYPE ExtType,
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ )
+{
+ HRESULT hr = S_OK;
+ if (!pcExtensions || !ppDot11ExtUIProperty)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ // Initialize the out parameters
+ *pcExtensions = 0;
+ *ppDot11ExtUIProperty = NULL;
+
+ switch(ExtType)
+ {
+ case DOT11_EXT_UI_CONNECTION:
+ hr = CreateConnectionProperties(pcExtensions, ppDot11ExtUIProperty);
+ break;
+
+ case DOT11_EXT_UI_SECURITY:
+ hr = CreateSecurityProperties(pcExtensions, ppDot11ExtUIProperty);
+ break;
+
+ case DOT11_EXT_UI_KEYEXTENSION:
+ hr = CreateKeyProperties(pcExtensions, ppDot11ExtUIProperty);
+ break;
+
+ default:
+ hr = E_NOTIMPL;
+ break;
+ }
+
+error:
+ return hr;
+}
+
+#define IHV_BALLOON_TEXT L"Please enter key information"
+
+STDMETHODIMP
+CDot11SampleExtUI::GetDot11ExtUIBalloonText(
+ BSTR pIHVUIRequest, // the UI request structure from IHV
+ BSTR* pwszBalloonText // the balloon text to be displayed
+ )
+{
+ HRESULT hr = E_INVALIDARG;
+ PDOT11EXT_IHV_UI_REQUEST pIhvUiRequest = (PDOT11EXT_IHV_UI_REQUEST) pIHVUIRequest;
+
+ if (NULL != pwszBalloonText)
+ {
+ // Ihv could choose to parse the UI request data here ...
+ UNREFERENCED_PARAMETER( pIhvUiRequest );
+
+ *pwszBalloonText = SysAllocString( IHV_BALLOON_TEXT );
+ hr = S_OK;
+ }
+
+ return hr;
+}
+
+
+
+HRESULT
+CDot11SampleExtUI::CreateConnectionProperties(
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ )
+{
+ HRESULT hr = ERROR_SUCCESS;
+ BSTR strName = NULL;
+ ULONG uCount = 0;
+
+ IDot11SampleExtUIConProperty **pprgProps = NULL;
+
+ uCount = PROP_COUNT_CONNECTION;
+ pprgProps = (IDot11SampleExtUIConProperty**)
+ CoTaskMemAlloc(sizeof(IDot11SampleExtUIConProperty*) * uCount);
+
+ if (!pprgProps)
+ {
+ hr = E_UNEXPECTED;
+ goto error;
+ }
+
+ // Since we just have one property of each, we'll
+ // create one interface first and initialize it separately
+ IDot11SampleExtUIConProperty *pTempIProp = NULL;
+ hr = CoCreateInstance(
+ GUID_SAMPLE_IHVUI_CLSID,
+ NULL,
+ CLSCTX_INPROC,
+ IID_IDot11SampleExtUIConProperty,
+ (PVOID*)&pTempIProp
+ );
+
+ if (FAILED(hr))
+ {
+ goto error;
+ }
+
+ // this will probably never be displayed
+ strName = SysAllocString(L"IHV Connection Settings");
+ hr = pTempIProp->Initialize(strName);
+ pprgProps[0] = pTempIProp;
+
+ if (SUCCEEDED(hr))
+ {
+ *pcExtensions = uCount;
+ *ppDot11ExtUIProperty = (IDot11ExtUIProperty*)pprgProps;
+
+ // Set the current pointer to NULL so it doesn't get freed at the bottom
+ pprgProps = NULL;
+ }
+
+error:
+ if (FAILED(hr) && pprgProps)
+ {
+ CoTaskMemFree(pprgProps);
+ pprgProps = NULL;
+ }
+ SysFreeString(strName);
+ return hr;
+}
+
+HRESULT
+CDot11SampleExtUI::CreateSecurityProperties(
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ )
+{
+ HRESULT hr = ERROR_SUCCESS;
+ BSTR strName = NULL;
+ ULONG uCount = 0;
+ DWORD i = 0;
+ WCHAR wbuf[128];
+
+ IDot11SampleExtUISecProperty **pprgProps = NULL;
+
+ uCount = PROP_COUNT_SECURITY;
+ pprgProps = (IDot11SampleExtUISecProperty**)
+ CoTaskMemAlloc(sizeof(IDot11SampleExtUISecProperty*) * uCount);
+
+ if (!pprgProps)
+ {
+ hr = E_UNEXPECTED;
+ goto error;
+ }
+
+ // Since we just have one property of each, we'll
+ // create one interface first and initialize it separately
+ IDot11SampleExtUISecProperty *pTempIProp = NULL;
+
+ for (i = 0; i < uCount; ++i)
+ {
+ ZeroMemory(
+ wbuf,
+ 128
+ );
+ pTempIProp = NULL;
+ SysFreeString(strName);
+ strName = NULL;
+
+ hr = CoCreateInstance(
+ GUID_SAMPLE_IHVUI_CLSID,
+ NULL,
+ CLSCTX_INPROC,
+ IID_IDot11SampleExtUISecProperty,
+ (PVOID*)&pTempIProp
+ );
+
+ if (FAILED(hr))
+ {
+ continue;
+ }
+
+ StringCchPrintf(
+ wbuf,
+ 128,
+ wstrSecurityTypes[i]
+ );
+
+ strName = SysAllocString(wbuf);
+ hr = pTempIProp->Initialize(strName, i);
+ pprgProps[i] = pTempIProp;
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ *pcExtensions = uCount;
+ *ppDot11ExtUIProperty = (IDot11ExtUIProperty*)pprgProps;
+
+ // Set the current pointer to NULL so it doesn't get freed at the bottom
+ pprgProps = NULL;
+ }
+
+error:
+ if (FAILED(hr) && pprgProps)
+ {
+ CoTaskMemFree(pprgProps);
+ pprgProps = NULL;
+ }
+ SysFreeString(strName);
+ return hr;
+}
+
+HRESULT
+CDot11SampleExtUI::CreateKeyProperties(
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ )
+{
+ HRESULT hr = ERROR_SUCCESS;
+ BSTR strName = NULL;
+ ULONG uCount = 0;
+ DWORD i = 0;
+ WCHAR wbuf[128];
+ IDot11SampleExtUIKeyProperty **pprgProps = NULL;
+
+ uCount = g_IHVOneXExtCapability.dwAuthCount;
+
+ pprgProps = (IDot11SampleExtUIKeyProperty**)
+ CoTaskMemAlloc(sizeof(IDot11SampleExtUIKeyProperty*) * uCount);
+
+ if (!pprgProps)
+ {
+ hr = E_UNEXPECTED;
+ goto error;
+ }
+
+ // Since we just have one property of each, we'll
+ // create one interface first and initialize it separately
+ IDot11SampleExtUIKeyProperty *pTempIProp = NULL;
+
+ for (i = 0; i < uCount; ++i)
+ {
+ ZeroMemory(
+ wbuf,
+ 128
+ );
+ pTempIProp = NULL;
+ SysFreeString(strName);
+ strName = NULL;
+
+ hr = CoCreateInstance(
+ GUID_SAMPLE_IHVUI_CLSID,
+ NULL,
+ CLSCTX_INPROC,
+ IID_IDot11SampleExtUIKeyProperty,
+ (PVOID*)&pTempIProp
+ );
+
+ if (FAILED(hr))
+ {
+ continue;
+ }
+
+ StringCchPrintf(
+ wbuf,
+ 128,
+ g_IHVAuthFriendlyName[g_IHVOneXExtCapability.IhvAuthCiphers[i].IHVAuth]
+ );
+
+ strName = SysAllocString(wbuf);
+ hr = pTempIProp->Initialize((BYTE *) &(g_IHVOneXExtCapability.IhvAuthCiphers[i]));
+ pprgProps[i] = pTempIProp;
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ *pcExtensions = uCount;
+ *ppDot11ExtUIProperty = (IDot11ExtUIProperty*)pprgProps;
+
+ // Set the current pointer to NULL so it doesn't get freed at the bottom
+ pprgProps = NULL;
+ }
+
+error:
+ if (FAILED(hr) && pprgProps)
+ {
+ CoTaskMemFree(pprgProps);
+ pprgProps = NULL;
+ }
+ SysFreeString(strName);
+ return hr;
+}
+
+
+HRESULT
+CDot11SampleExtUI::FinalConstruct()
+{
+ m_pUnkSite = NULL;
+ m_hFirstPagePsp = NULL;
+ m_hLastPagePsp = NULL;
+ m_pUIRequest = NULL;
+
+ return S_OK;
+}
+
+VOID
+CDot11SampleExtUI::FinalRelease()
+{
+ if( m_pUnkSite)
+ {
+ m_pUnkSite ->Release();
+ m_pUnkSite = NULL;
+ }
+
+ if( m_pUIRequest)
+ {
+ delete m_pUIRequest;
+ m_pUIRequest = NULL;
+ }
+
+}
+
+// IObjectWithSite
+STDMETHODIMP
+CDot11SampleExtUI::SetSite (
+ IUnknown* pUnkSite
+ )
+{
+ if( m_pUnkSite)
+ m_pUnkSite ->Release();
+
+ m_pUnkSite = pUnkSite;
+
+ if( m_pUnkSite)
+ m_pUnkSite ->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP
+CDot11SampleExtUI::GetSite (
+ REFIID riid,
+ void** ppvSite
+ )
+{
+ *ppvSite = NULL;
+
+ if( m_pUnkSite == NULL)
+ return E_FAIL;
+
+ return m_pUnkSite ->QueryInterface(riid, ppvSite);
+}
+
+//IWizardExtension
+STDMETHODIMP CDot11SampleExtUI::AddPages (
+ HPROPSHEETPAGE* aPages,
+ UINT cPages,
+ UINT *pnPagesAdded
+ )
+{
+ IPropertyBag *pIPropertyBag = NULL;
+
+ UNREFERENCED_PARAMETER(cPages);
+
+ HRESULT hr = m_pUnkSite->QueryInterface(IID_IPropertyBag,
+ (VOID **)&pIPropertyBag);
+ if (SUCCEEDED(hr))
+ {
+ VARIANT v;
+ VariantInit(&v);
+
+ WCHAR ihvKeyName[IHV_KEY_LENGTH];
+ GetClsidPropertyName (
+ & GUID_SAMPLE_IHVUI_CLSID,
+ (LPWSTR) c_szIhvUIRequest,
+ ihvKeyName,
+ IHV_KEY_LENGTH
+ );
+ hr = pIPropertyBag->Read(
+ ihvKeyName,
+ &v,
+ NULL);
+
+ if (SUCCEEDED(hr) && (VT_BSTR == V_VT(&v)))
+ {
+ if( m_pUIRequest == NULL)
+ {
+ m_pUIRequest = new(std::nothrow) IHV_UI_REQUEST;
+ if (m_pUIRequest == NULL)
+ {
+ VariantClear(&v);
+ pIPropertyBag->Release();
+ return E_OUTOFMEMORY;
+ }
+ }
+ memcpy(m_pUIRequest, v.bstrVal, sizeof(IHV_UI_REQUEST));
+ }
+
+ VariantClear(&v);
+
+ pIPropertyBag->Release();
+ }
+
+ ////////////////
+
+ *pnPagesAdded = 0;
+
+ PROPSHEETPAGE psp = {0};
+
+ psp.dwSize = sizeof( psp);
+ psp.hInstance = g_hInst;
+ psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_USEHEADERTITLE;
+ psp.lParam = (LPARAM) this;
+
+ psp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_SHOWHELP);
+ psp.pfnDlgProc = (DLGPROC) CDot11SampleExtUI::HelpDlgProc;
+ psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE_SHOWHELP);
+ m_hFirstPagePsp = CreatePropertySheetPage(& psp);
+
+ psp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_GETKEY);
+ psp.pfnDlgProc = (DLGPROC) CDot11SampleExtUI::GetKeyDlgProc;
+ psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE_GETKEY);
+ HPROPSHEETPAGE hPsp= CreatePropertySheetPage(& psp);
+
+ psp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_LASTPAGE);
+ psp.pfnDlgProc = (DLGPROC) CDot11SampleExtUI::LastPageDlgProc;
+ psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE_LASTPAGE);
+ m_hLastPagePsp = CreatePropertySheetPage(& psp);
+
+ if( m_hFirstPagePsp
+ && hPsp
+ && m_hLastPagePsp)
+ {
+ aPages[0] = m_hFirstPagePsp;
+ aPages[1] = hPsp;
+ aPages[2] = m_hLastPagePsp;
+
+ *pnPagesAdded = 3;
+
+ return S_OK;
+ }
+ else
+ {
+ if(m_hFirstPagePsp)
+ {
+ DestroyPropertySheetPage(m_hFirstPagePsp);
+ }
+
+ if(hPsp)
+ {
+ DestroyPropertySheetPage(hPsp);
+ }
+
+ if(m_hLastPagePsp)
+ {
+ DestroyPropertySheetPage(m_hLastPagePsp);
+ }
+
+ m_hFirstPagePsp = hPsp = m_hLastPagePsp = NULL;
+
+ return E_FAIL;
+ }
+}
+
+STDMETHODIMP CDot11SampleExtUI::GetFirstPage (
+ HPROPSHEETPAGE *phpage
+ )
+{
+ *phpage = m_hFirstPagePsp;
+ return S_OK;
+}
+
+STDMETHODIMP
+CDot11SampleExtUI::GetLastPage (HPROPSHEETPAGE *phpage)
+{
+ * phpage = m_hLastPagePsp;
+ return S_OK;
+}
+
+
+BOOL CALLBACK
+CDot11SampleExtUI::HelpDlgProc (
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+ )
+{
+ CDot11SampleExtUI* pthis = NULL;
+
+ switch (uMsg)
+ {
+
+ case WM_INITDIALOG:
+ {
+ pthis = GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ if(pthis && pthis->m_pUIRequest)
+ {
+ //
+ // Convert the ANSI string into a WCHAR string and display it
+ //
+ int iBufferSize = MultiByteToWideChar(CP_ACP, 0, pthis->m_pUIRequest->title, -1, NULL, 0);
+ if (iBufferSize > 0)
+ {
+ WCHAR *pwszBuffer = new WCHAR[iBufferSize];
+
+ if (NULL != pwszBuffer)
+ {
+ pwszBuffer[0] = 0;
+
+ (VOID)MultiByteToWideChar(CP_ACP, 0, pthis->m_pUIRequest->title, -1, pwszBuffer, iBufferSize);
+
+ SetDlgItemText(hwndDlg, IDC_EDIT_HELPER, pwszBuffer);
+
+ delete[] pwszBuffer;
+ }
+ }
+ }
+ }
+ return TRUE;
+
+ case WM_DESTROY:
+ {
+ // Don't release our properties here, wait
+ // rather for Abort or Commit event notifications.
+ // Then we will have the same values when resurrected.
+ }
+ return TRUE;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR pnmh = (LPNMHDR) lParam;
+ switch (pnmh->code)
+ {
+
+ case PSN_SETACTIVE :
+ PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
+ return TRUE;
+
+ case PSN_QUERYCANCEL:
+ {
+ IWizardSite *pIWizardSite = NULL;
+ HRESULT hr = S_OK;
+
+ pthis = GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ if(pthis != NULL)
+ {
+ hr = pthis->m_pUnkSite->QueryInterface(IID_IWizardSite, (VOID **)&pIWizardSite);
+ if (SUCCEEDED(hr))
+ {
+ HPROPSHEETPAGE hpage = NULL;
+
+ hr = pIWizardSite->GetCancelledPage(&hpage);
+ if (SUCCEEDED(hr))
+ {
+ PropSheet_SetCurSel(GetParent(hwndDlg), hpage, 0);
+ }
+ pIWizardSite->Release();
+ }
+ }
+ }
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+ return FALSE;
+
+}
+
+BOOL CALLBACK
+CDot11SampleExtUI::GetKeyDlgProc (
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+ )
+
+{
+ CDot11SampleExtUI* pthis = NULL;
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ (VOID)GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ }
+ return TRUE;
+
+ case WM_DESTROY:
+ {
+ // Don't release our properties here, wait
+ // rather for Abort or Commit event notifications.
+ // Then we will have the same values when resurrected.
+ }
+ return TRUE;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR pnmh = (LPNMHDR) lParam;
+ switch (pnmh->code)
+ {
+ case PSN_SETACTIVE :
+
+ PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
+ return TRUE;
+
+ case PSN_WIZNEXT :
+ {
+ WCHAR szBuffer[50 + 1] = {0};
+ HRESULT hr = S_OK;
+ IPropertyBag *pIPropertyBag = NULL;
+
+ GetDlgItemText(hwndDlg, IDC_EDIT_KEY, szBuffer, 50);
+ pthis = GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+
+ if(pthis)
+ {
+ hr = pthis->m_pUnkSite->QueryInterface(IID_IPropertyBag, (VOID **)&pIPropertyBag);
+ if (SUCCEEDED(hr))
+ {
+ VARIANT v;
+ VariantInit(&v);
+
+ WCHAR ihvKeyName[IHV_KEY_LENGTH] = {0};
+ pthis->GetClsidPropertyName(
+ &GUID_SAMPLE_IHVUI_CLSID,
+ (LPWSTR) c_szIhvUIResponse,
+ ihvKeyName,
+ IHV_KEY_LENGTH
+ );
+
+ // Make sure we remove the previous property if any
+ hr = pIPropertyBag->Read(ihvKeyName, &v, NULL);
+
+ VariantClear(&v);
+ V_VT(&v) = VT_BSTR;
+ v.bstrVal = SysAllocStringByteLen((LPCSTR)szBuffer, IHV_KEY_LENGTH);
+
+ // Write the updated property if any
+ hr = pIPropertyBag->Write(ihvKeyName, &v);
+ pIPropertyBag->Release();
+
+ //
+ // hr is not used below
+ //
+ hr;
+ }
+ }
+ }
+ return TRUE;
+
+ case PSN_QUERYCANCEL:
+ {
+ IWizardSite *pIWizardSite = NULL;
+ HRESULT hr = S_OK;
+
+ pthis = GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+
+ if(pthis)
+ {
+ hr = pthis->m_pUnkSite->QueryInterface(IID_IWizardSite,(VOID **)&pIWizardSite);
+ if (SUCCEEDED(hr))
+ {
+ HPROPSHEETPAGE hpage = NULL;
+ hr = pIWizardSite->GetCancelledPage(&hpage);
+ if (SUCCEEDED(hr))
+ {
+ PropSheet_SetCurSel(GetParent(hwndDlg), hpage, 0);
+ }
+ pIWizardSite->Release();
+ }
+ }
+ }
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+ return FALSE;
+
+}
+
+BOOL CALLBACK
+CDot11SampleExtUI::LastPageDlgProc(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+ )
+{
+ CDot11SampleExtUI* pthis = NULL;
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ (VOID)GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ }
+ return TRUE;
+
+ case WM_DESTROY:
+ {
+ (VOID)GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ }
+ return TRUE;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR pnmh = (LPNMHDR) lParam;
+ switch (pnmh->code)
+ {
+ case PSN_SETACTIVE :
+ PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
+ return TRUE;
+
+ case PSN_WIZNEXT :
+ {
+ IWizardSite *pIWizardSite = NULL;
+ HRESULT hr = S_OK;
+
+ pthis = GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ if(pthis)
+ {
+ hr = pthis->m_pUnkSite->QueryInterface(IID_IWizardSite,(VOID **)&pIWizardSite);
+ if (SUCCEEDED(hr))
+ {
+ HPROPSHEETPAGE hpage = NULL;
+
+ hr = pIWizardSite->GetNextPage(&hpage);
+ if (SUCCEEDED(hr))
+ {
+ PropSheet_SetCurSel(GetParent(hwndDlg), hpage, 0);
+ }
+ pIWizardSite->Release();
+ }
+ }
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LPARAM)-1);
+ }
+ return TRUE;
+
+ case PSN_QUERYCANCEL:
+ {
+ IWizardSite *pIWizardSite = NULL;
+ HRESULT hr = S_OK;
+
+ pthis = GetThis<CDot11SampleExtUI>(hwndDlg, uMsg, wParam, lParam);
+ if(pthis)
+ {
+ hr = pthis->m_pUnkSite->QueryInterface(IID_IWizardSite,(VOID **)&pIWizardSite);
+ if (SUCCEEDED(hr))
+ {
+ HPROPSHEETPAGE hpage = NULL;
+ hr = pIWizardSite->GetCancelledPage(&hpage);
+ if (SUCCEEDED(hr))
+ {
+ PropSheet_SetCurSel(GetParent(hwndDlg), hpage, 0);
+ }
+ pIWizardSite->Release();
+ }
+ }
+ }
+ return TRUE;
+
+ }
+ }
+ return FALSE;
+ }
+ return FALSE;
+
+}
+
+HRESULT CDot11SampleExtUI::GetClsidPropertyName (
+ _In_ const CLSID* pCLSID,
+ _In_opt_ PCWSTR pwszPropertyName,
+ _Out_writes_(maxResultLen) PWSTR pwszResultStr,
+ _In_ UINT maxResultLen)
+{
+ #define MIN_BUFFER_SIZE 50
+
+ wchar_t *pwszCLSID = NULL;
+ wchar_t *pwszKeyName = NULL;
+ HRESULT hRetCode = S_OK;
+ size_t iCharCount = 0;
+
+ // Sanity
+ //=======
+
+ if( pCLSID == NULL ||
+ pwszResultStr == NULL ||
+ maxResultLen < MIN_BUFFER_SIZE
+ )
+ {
+ return E_INVALIDARG;
+ }
+
+ // Convert CLSID to string
+ //========================
+
+ hRetCode = StringFromCLSID(*pCLSID, &pwszCLSID);
+ if(FAILED(hRetCode))
+ {
+ goto Done;
+ }
+
+ // Allocate buffer for entire CLSID\PropertyName string
+ //=====================================================
+
+ iCharCount = wcslen(pwszCLSID) + 1;
+ if(pwszPropertyName)
+ {
+ iCharCount += wcslen(pwszPropertyName);
+ }
+
+ pwszKeyName = new(std::nothrow) wchar_t[iCharCount];
+ if(pwszKeyName == NULL)
+ {
+ hRetCode = E_OUTOFMEMORY;
+ goto Done;
+ }
+
+ swprintf_s(pwszKeyName, iCharCount, L"%s%s", pwszCLSID, pwszPropertyName ? pwszPropertyName : L"");
+
+ // Copy as much as we can to the target buffer
+ //============================================
+
+ wcsncpy_s(pwszResultStr, maxResultLen, pwszKeyName, _TRUNCATE);
+
+Done:
+
+ if(pwszKeyName != NULL)
+ {
+ delete [] pwszKeyName;
+ }
+
+ if(pwszCLSID != NULL)
+ {
+ CoTaskMemFree(pwszCLSID);
+ }
+
+ return hRetCode;
+}
+
+
+
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUI.h b/network/wlan/ihvsampleui/IHVSampleExtUI.h
new file mode 100644
index 00000000..474c56a3
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUI.h
@@ -0,0 +1,238 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#ifndef _IHVSAMPLEEXTUI_H_
+#define _IHVSAMPLEEXTUI_H_
+
+#include "precomp.h"
+
+// object ref count
+extern long g_objRefCount;
+
+//lock count on server
+extern long g_serverLock;
+
+#define IHV_KEY_LENGTH 64
+
+#define MAX_IHV_CIPHERS 6
+#define MAX_IHV_AUTHS 6
+
+// IHV Auth types
+typedef enum _IHV_AUTH_TYPE {
+ IHVAuthV1,
+ IHVAuthV2,
+ IHVAuthV3,
+ IHVAuthInvalid
+} IHV_AUTH_TYPE, *PIHV_AUTH_TYPE;
+
+// IHV cipher types
+typedef enum _IHV_CIPHER_TYPE {
+ None,
+ IHVCipher1,
+ IHVCipher2,
+ IHVCipher3,
+ IHVCipherInvalid
+} IHV_CIPHER_TYPE, *PIHV_CIPHER_TYPE;
+
+// structure holding valid ciphers for a given auth
+typedef struct _IHV_AUTH_CIPHERS {
+ IHV_AUTH_TYPE IHVAuth;
+ DWORD dwCipherCount;
+ IHV_CIPHER_TYPE IHVCiphers[MAX_IHV_CIPHERS];
+} IHV_AUTH_CIPHERS, *PIHV_AUTH_CIPHERS;
+
+// structure for all auths and corresponding ciphers
+typedef struct _IHV_AUTH_CIPHER_CAPABILITY {
+ DWORD dwAuthCount;
+ IHV_AUTH_CIPHERS IhvAuthCiphers[MAX_IHV_AUTHS];
+} IHV_AUTH_CIPHER_CAPABILITY, *PIHV_AUTH_CIPHER_CAPABILITY;
+
+typedef struct _IHV_SECURITY_CONFIG {
+ IHV_AUTH_TYPE Auth;
+ IHV_CIPHER_TYPE Cipher;
+} IHV_SECURITY_CONFIG, *PIHV_SECURITY_CONFIG;
+
+extern IHV_AUTH_CIPHER_CAPABILITY g_IHVOneXExtCapability;
+
+extern LPWSTR g_IHVAuthFriendlyName[];
+extern LPWSTR g_IHVCipherFriendlyName[];
+
+
+#define PROP_COUNT_CONNECTION 1
+
+#define PROP_COUNT_SECURITY 2
+#define PROP_COUNT_SEC_CIPHERS 2
+typedef enum _IHV_SECURITY_TYPE {
+ IHVSecurityV1,
+ IHVSecurityV2,
+ IHVSecurityInvalid
+} IHV_SECURITY_TYPE, *PIHV_SECURITY_TYPE;
+static LPWSTR wstrSecurityTypes[] = { L"IHV Security v1", L"IHV Security v2" };
+
+#define PROP_COUNT_KEYEXTENSION 3
+static LPWSTR wstrAuthArray[] = { L"IHVAuth Open-with-1X", L"IHVAuth v1", L"IHVAuth v2" };
+
+
+
+
+#define IHV_CIPHER_COUNT 3
+static LPWSTR wstrCipherArray[] = { L"None", L"IHVCipher v1", L"IHVCipher v2" };
+static LPWSTR wstr1XCipherArray[] = { L"IHVCipher WEP"};
+static BSTR bstrCipherArray[IHV_CIPHER_COUNT] = {0};
+
+typedef struct _IHV_CIPHERS_FOR_AUTH_INFO
+{
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO displayInfo[IHV_CIPHER_COUNT];
+} IHV_CIPHERS_FOR_AUTH_INFO;
+static DOT11_EXT_UI_PROPERTY_DISPLAY_INFO cipherOne = {1, DOT11_EXT_UI_DISPLAY_INFO_CIPHER, 0};
+static DOT11_EXT_UI_PROPERTY_DISPLAY_INFO cipherTwo = {2, DOT11_EXT_UI_DISPLAY_INFO_CIPHER, 0};
+static DOT11_EXT_UI_PROPERTY_DISPLAY_INFO cipherThree = {3, DOT11_EXT_UI_DISPLAY_INFO_CIPHER, 0};
+static DOT11_EXT_UI_PROPERTY_DISPLAY_INFO ciphersInfoArray[MAX_IHV_AUTHS][MAX_IHV_CIPHERS] = {0};
+
+
+//////// structures for balloon /////////
+
+struct IHV_UI_REQUEST
+{
+ char title[80];
+ char help[80];
+
+ IHV_UI_REQUEST()
+ {
+ memset(this, 0, sizeof(IHV_UI_REQUEST));
+ }
+};
+
+struct IHV_UI_RESPONSE
+{
+ char key[100];
+ int num[150];
+
+ IHV_UI_RESPONSE()
+ {
+ memset(this, 0, sizeof(IHV_UI_RESPONSE));
+ }
+};
+
+
+class CDot11SampleExtUI: public IDot11SampleExtUI, public IWizardExtension, public IObjectWithSite
+{
+public:
+ CDot11SampleExtUI();
+
+ ~CDot11SampleExtUI();
+
+ // IUnknown Implementation
+ BEGIN_INTERFACE_TABLE()
+ IMPLEMENTS_INTERFACE(IDot11ExtUI)
+ IMPLEMENTS_INTERFACE(IDot11SampleExtUI)
+ IMPLEMENTS_INTERFACE(IWizardExtension)
+ IMPLEMENTS_INTERFACE(IObjectWithSite)
+ END_INTERFACE_TABLE();
+
+ // Used to get the IHV friendly name
+ STDMETHODIMP
+ GetDot11ExtUIFriendlyName(BSTR* bstrFriendlyName);
+
+ // Used to display an IHV specific connection page
+ STDMETHODIMP
+ GetDot11ExtUIProperties(
+ DOT11_EXT_UI_PROPERTY_TYPE ExtType,
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ );
+
+ STDMETHODIMP
+ GetDot11ExtUIBalloonText(
+ BSTR pIHVUIRequest, // the UI request structure from IHV
+ BSTR* pwszBalloonText // the balloon text to be displayed
+ );
+
+ HRESULT
+ CreateConnectionProperties(
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ );
+
+ HRESULT
+ CreateSecurityProperties(
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ );
+
+ HRESULT
+ CreateKeyProperties(
+ ULONG *pcExtensions,
+ IDot11ExtUIProperty **ppDot11ExtUIProperty
+ );
+
+ // IObjectWithSite
+ STDMETHOD (SetSite) (
+ IUnknown* pUnkSite
+ );
+
+ STDMETHOD (GetSite) (
+ REFIID riid,
+ void** ppvSite
+ );
+
+ //IWizardExtension
+ STDMETHOD (AddPages) (
+ HPROPSHEETPAGE* aPages,
+ UINT cPages,
+ UINT *pnPagesAdded
+ );
+
+ STDMETHOD (GetFirstPage) (
+ HPROPSHEETPAGE *phpage
+ );
+
+ STDMETHOD (GetLastPage) (
+ HPROPSHEETPAGE *phpage
+ );
+
+private:
+ HRESULT FinalConstruct();
+ void FinalRelease();
+ static BOOL CALLBACK GetKeyDlgProc (
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
+
+ static BOOL CALLBACK HelpDlgProc (
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
+ static BOOL CALLBACK LastPageDlgProc (
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
+ HRESULT GetClsidPropertyName (
+ _In_ const CLSID* pCLSID,
+ _In_opt_ PCWSTR pwszPropertyName,
+ _Out_writes_(maxResultLen) PWSTR pResultStr,
+ _In_ UINT maxResultLen);
+
+private:
+ IHV_UI_REQUEST* m_pUIRequest;
+ IHV_UI_RESPONSE m_UIResponse;
+
+ IUnknown* m_pUnkSite;
+
+ HPROPSHEETPAGE m_hFirstPagePsp;
+ HPROPSHEETPAGE m_hLastPagePsp;
+};
+
+
+#endif _IHVSAMPLEEXTUI_H_
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUICon.cpp b/network/wlan/ihvsampleui/IHVSampleExtUICon.cpp
new file mode 100644
index 00000000..e5eeb6cd
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUICon.cpp
@@ -0,0 +1,345 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+
+extern HINSTANCE g_hInst;
+
+// used by the con prop extensions
+CIhvConnectivityProfile* pIhvConProfile;
+
+
+CDot11SampleExtUIConProperty::CDot11SampleExtUIConProperty():
+ m_crefCount(0), m_fInitialized(false),
+ m_ExtType(DOT11_EXT_UI_CONNECTION), m_fModified(FALSE)
+{
+ m_bstrFN = NULL;
+ InterlockedIncrement(&g_objRefCount);
+}
+
+CDot11SampleExtUIConProperty::~CDot11SampleExtUIConProperty()
+{
+ SysFreeString(m_bstrFN);
+ InterlockedDecrement(&g_objRefCount);
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIConProperty::GetDot11ExtUIPropertyFriendlyName(BSTR* bstrPropertyName)
+{
+ HRESULT hr = E_INVALIDARG;
+ if (false == m_fInitialized)
+ {
+ return hr;
+ }
+
+ if (NULL != bstrPropertyName)
+ {
+ *bstrPropertyName = SysAllocString(m_bstrFN);
+ hr = S_OK;
+ }
+
+ return hr;
+}
+
+//Used to extend property
+STDMETHODIMP
+CDot11SampleExtUIConProperty::DisplayDot11ExtUIProperty(
+ HWND hParent, // Parent Window Handle
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if (!m_fInitialized)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ // Store the passed-in string in a member variable so dialog box can display it
+ pIhvConProfile = new(std::nothrow) CIhvConnectivityProfile();
+ if (pIhvConProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvConProfile->LoadXml(bstrIHVProfile);
+ m_fModified = FALSE;
+
+ // Dialog will store the string in a member variable
+ DialogBoxParam(
+ g_hInst,
+ MAKEINTRESOURCE(IDD_PROPPAGE_SMALL),
+ hParent,
+ SimpleDialogProcCon,
+ (LPARAM)pIhvConProfile
+ );
+
+ m_fModified = pIhvConProfile->GetModified();
+
+ if (NULL != bstrModifiedIHVProfile)
+ {
+ if (m_fModified)
+ {
+ pIhvConProfile->EmitXml(bstrModifiedIHVProfile);
+ }
+ }
+
+ if (NULL != pbIsModified)
+ {
+ *pbIsModified = m_fModified;
+ }
+
+error:
+ if(pIhvConProfile)
+ {
+ delete pIhvConProfile;
+ pIhvConProfile = NULL;
+ }
+
+ return hr;
+}
+
+
+//Used to get the currently chosen entry to display as selected in the dropdown list
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Dot11ExtUIPropertyGetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BOOL* pfIsSelected // flag denoting if this is the selected profile
+ )
+{
+ HRESULT hr = S_OK;
+ UNREFERENCED_PARAMETER(bstrIHVProfile);
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ // since there is only one connection profile always set it to true
+ *pfIsSelected = TRUE;
+
+ return hr;
+}
+
+//Used to set the current entry as chosen from the dropdown list
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Dot11ExtUIPropertySetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(bstrModifiedIHVProfile == NULL || pbIsModified == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ // in case the profile is NULL this will supply the default
+ pIhvConProfile = new(std::nothrow) CIhvConnectivityProfile();
+ if (pIhvConProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvConProfile->LoadXml(bstrIHVProfile);
+
+ pIhvConProfile->EmitXml(bstrModifiedIHVProfile);
+ *pbIsModified = pIhvConProfile->GetModified();
+
+error:
+ if(pIhvConProfile != NULL)
+ {
+ delete pIhvConProfile;
+ pIhvConProfile = NULL;
+ }
+ return hr;
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Dot11ExtUIPropertyHasConfigurationUI(
+ BOOL *fHasConfigurationUI
+ )
+{
+ // this page always wants to show a config UI
+ *fHasConfigurationUI = TRUE;
+ return S_OK;
+}
+
+//Used to get additional display data (ciphers for auth types)
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Dot11ExtUIPropertyGetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be described
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ ULONG *pcEntries, // number of dependent strings
+ ULONG *puDefaultSelection, // the entry in the array to be selected by default
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO **ppDot11ExtUIProperty // array of returned info structure
+ )
+{
+ UNREFERENCED_PARAMETER(dot11ExtUIDisplayInfoType);
+ UNREFERENCED_PARAMETER(pIHVParams);
+ UNREFERENCED_PARAMETER(bstrIHVProfile);
+ // we have no additional data to display
+ *pcEntries = 0;
+ *puDefaultSelection = 0;
+ *ppDot11ExtUIProperty = NULL;
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Dot11ExtUIPropertySetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be modified
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO *pDot11ExtUIProperty, // selected info structure
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ UNREFERENCED_PARAMETER(dot11ExtUIDisplayInfoType);
+ UNREFERENCED_PARAMETER(bstrIHVProfile);
+ UNREFERENCED_PARAMETER(pIHVParams);
+ UNREFERENCED_PARAMETER(pDot11ExtUIProperty);
+ UNREFERENCED_PARAMETER(bstrModifiedIHVProfile);
+ UNREFERENCED_PARAMETER(pbIsModified);
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Dot11ExtUIPropertyIsStandardSecurity(
+ BOOL *fIsStandardSecurity, // if this interface is a standard auth method
+ DOT11_EXT_UI_SECURITY_TYPE *dot11ExtUISecurityType // which of the standard auth methods it is
+ )
+{
+ UNREFERENCED_PARAMETER(dot11ExtUISecurityType);
+ *fIsStandardSecurity = FALSE;
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP
+CDot11SampleExtUIConProperty::Initialize(BSTR bstrPropertyName)
+{
+ HRESULT hr = E_INVALIDARG;
+ if (false == m_fInitialized)
+ {
+ // Set the FriendlyName
+ m_bstrFN = SysAllocString(bstrPropertyName);
+ m_fInitialized = true;
+ hr = S_OK;
+ }
+ return hr;
+}
+
+INT_PTR CALLBACK
+SimpleDialogProcCon(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+)
+{
+ BOOL fRetVal = FALSE;
+ WCHAR szBuf[256] = {0};
+ DWORD dwValue = 0;
+ BSTR bstrText = NULL;
+
+ UNREFERENCED_PARAMETER(lParam);
+
+ if(!pIhvConProfile)
+ {
+ goto error;
+ }
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ // Dialog title
+ WCHAR strDialogTitle[MAX_PATH] = {0};
+ (VOID)::LoadString(
+ g_hInst,
+ IDS_IHV_DEFAULT_CON_TITLE,
+ strDialogTitle,
+ MAX_PATH
+ );
+
+ SetWindowText(hwndDlg, strDialogTitle);
+ }
+
+ // check the checkbox if needed
+ if(FAILED(pIhvConProfile->GetParamDWORD(&dwValue)))
+ {
+ dwValue = 0;
+ }
+ ::SendMessage(
+ GetDlgItem(hwndDlg, IDC_USE_FASTHANDOFF),
+ BM_SETCHECK,
+ (WPARAM)(int)dwValue,
+ 0L
+ );
+
+ // Set text in the textbox
+ if(FAILED(pIhvConProfile->GetParamBSTR(&bstrText)))
+ {
+ bstrText = NULL;
+ }
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PARAM_BOX), bstrText);
+
+ fRetVal = TRUE;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case ID_OK:
+ GetWindowText(GetDlgItem(hwndDlg, IDC_PARAM_BOX), szBuf, 255);
+ if(szBuf)
+ {
+ DWORD dwNewValue = 0;
+
+ // get the button state and record it
+ dwNewValue = (int)::SendMessage(
+ GetDlgItem(hwndDlg, IDC_USE_FASTHANDOFF),
+ BM_GETCHECK,
+ 0L,
+ 0L
+ );
+
+ pIhvConProfile->SetParamDWORD(dwNewValue);
+ pIhvConProfile->SetParamBSTR(szBuf);
+
+ // Notify the owner window to carry out the task.
+ EndDialog(hwndDlg, 1);
+ fRetVal = TRUE;
+ }
+ break;
+
+ case ID_CANCEL:
+ EndDialog(hwndDlg, 0);
+ fRetVal = TRUE;
+ break;
+ }
+ break;
+ }
+
+error:
+ return fRetVal;
+}
+
+
+
+
+
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUICon.h b/network/wlan/ihvsampleui/IHVSampleExtUICon.h
new file mode 100644
index 00000000..fd58c106
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUICon.h
@@ -0,0 +1,103 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#ifndef _IHVSAMPLEEXTUICON_H_
+#define _IHVSAMPLEEXTUICON_H_
+
+class CDot11SampleExtUIConProperty: public IDot11SampleExtUIConProperty
+{
+public:
+ CDot11SampleExtUIConProperty();
+
+ ~CDot11SampleExtUIConProperty();
+
+ // IUnknown Implementation
+ BEGIN_INTERFACE_TABLE()
+ IMPLEMENTS_INTERFACE(IDot11SampleExtUIConProperty)
+ END_INTERFACE_TABLE();
+
+ STDMETHODIMP
+ GetDot11ExtUIPropertyFriendlyName(
+ BSTR* bstrPropertyName // IHV friendly name
+ );
+
+ //Used to extend property
+ STDMETHODIMP
+ DisplayDot11ExtUIProperty(
+ HWND hParent, // Parent Window Handle
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ //Used to get the currently chosen entry to display as selected in the dropdown list
+ STDMETHODIMP
+ Dot11ExtUIPropertyGetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BOOL* pfIsSelected // flag denoting if this is the selected profile
+ );
+
+ //Used to set the current entry as chosen from the dropdown list
+ STDMETHODIMP
+ Dot11ExtUIPropertySetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertyHasConfigurationUI(BOOL *fHasConfigurationUI);
+
+ //Used to get additional display data (ciphers for auth types)
+ STDMETHODIMP
+ Dot11ExtUIPropertyGetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be described
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ ULONG *pcEntries, // number of dependent strings
+ ULONG *puDefaultSelection, // the entry in the array to be selected by default
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO **ppDot11ExtUIProperty // array of returned info structure
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertySetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be modified
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO *pDot11ExtUIProperty, // selected info structure
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertyIsStandardSecurity(
+ BOOL *fIsStandardSecurity, // if this interface is a standard auth method
+ DOT11_EXT_UI_SECURITY_TYPE *dot11ExtUISecurityType // which of the standard auth methods it is
+ );
+
+ // initialize the connection page
+ STDMETHODIMP
+ Initialize(BSTR bstrPropertyName);
+
+private:
+ bool m_fInitialized;
+ BSTR m_bstrFN;
+ DOT11_EXT_UI_PROPERTY_TYPE m_ExtType;
+ BOOL m_fModified;
+};
+
+
+INT_PTR CALLBACK
+SimpleDialogProcCon(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+);
+
+#endif _IHVSAMPLEEXTUICON_H_
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUIKey.cpp b/network/wlan/ihvsampleui/IHVSampleExtUIKey.cpp
new file mode 100644
index 00000000..19c9610a
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUIKey.cpp
@@ -0,0 +1,462 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+
+extern HINSTANCE g_hInst;
+
+// used by the con prop extensions
+CIhvSecurityProfile* pIhvKeyProfile;
+
+
+CDot11SampleExtUIKeyProperty::CDot11SampleExtUIKeyProperty():
+ m_crefCount(0), m_fInitialized(false),
+ m_ExtType(DOT11_EXT_UI_KEYEXTENSION), m_fModified(FALSE)
+{
+ InterlockedIncrement(&g_objRefCount);
+ memset(
+ &m_IHVAuthCiphers,
+ 0,
+ sizeof(IHV_AUTH_CIPHERS)
+ );
+ m_bstrFN = NULL;
+}
+
+CDot11SampleExtUIKeyProperty::~CDot11SampleExtUIKeyProperty()
+{
+ if(m_bstrFN != NULL) {
+ SysFreeString(m_bstrFN);
+ }
+
+ InterlockedDecrement(&g_objRefCount);
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::GetDot11ExtUIPropertyFriendlyName(BSTR* bstrPropertyName)
+{
+ HRESULT hr = E_INVALIDARG;
+ if (false == m_fInitialized)
+ {
+ return hr;
+ }
+
+ if (NULL != g_IHVAuthFriendlyName[m_IHVAuthCiphers.IHVAuth])
+ {
+ *bstrPropertyName = SysAllocString(g_IHVAuthFriendlyName[m_IHVAuthCiphers.IHVAuth]);
+ hr = S_OK;
+ }
+
+ return hr;
+}
+
+//Used to extend property
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::DisplayDot11ExtUIProperty(
+ HWND hParent, // Parent Window Handle
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if (!m_fInitialized)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ // Store the passed-in string in a member variable so dialog box can display it
+ pIhvKeyProfile = new(std::nothrow) CIhvSecurityProfile();
+ if (pIhvKeyProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvKeyProfile->LoadXml(bstrIHVProfile);
+ m_fModified = FALSE;
+
+ // Dialog will store the string in a member variable
+ DialogBoxParam(
+ g_hInst,
+ MAKEINTRESOURCE(IDD_PROPPAGE_SMALL),
+ hParent,
+ SimpleDialogProcKey,
+ (LPARAM)pIhvKeyProfile
+ );
+
+ m_fModified = pIhvKeyProfile->GetModified();
+
+ if (NULL != bstrModifiedIHVProfile)
+ {
+ if (m_fModified)
+ {
+ pIhvKeyProfile->EmitXml(bstrModifiedIHVProfile);
+ }
+ }
+
+ if (NULL != pbIsModified)
+ {
+ *pbIsModified = m_fModified;
+ }
+
+error:
+ if(pIhvKeyProfile)
+ {
+ delete pIhvKeyProfile;
+ pIhvKeyProfile = NULL;
+ }
+
+ return hr;
+}
+
+
+//Used to get the currently chosen entry to display as selected in the dropdown list
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Dot11ExtUIPropertyGetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BOOL* pfIsSelected // flag denoting if this is the selected profile
+ )
+{
+ HRESULT hr = S_OK;
+ IHV_AUTH_TYPE currentAuthType = IHVAuthInvalid;
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(pfIsSelected == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ *pfIsSelected = FALSE;
+
+ pIhvKeyProfile = new(std::nothrow) CIhvSecurityProfile();
+ if (pIhvKeyProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvKeyProfile->LoadXml(bstrIHVProfile);
+
+ hr = pIhvKeyProfile->GetAuthType(&currentAuthType);
+ if(FAILED(hr))
+ {
+ // if it fails then choose a default selected auth
+ hr = S_OK;
+ if(IHVAuthV1 == m_IHVAuthCiphers.IHVAuth)
+ {
+ *pfIsSelected = TRUE;
+ }
+ }
+ else if(currentAuthType == m_IHVAuthCiphers.IHVAuth)
+ {
+ *pfIsSelected = TRUE;
+ }
+
+error:
+ if(pIhvKeyProfile != NULL)
+ {
+ delete pIhvKeyProfile;
+ pIhvKeyProfile = NULL;
+ }
+ return hr;
+}
+
+//Used to set the current entry as chosen from the dropdown list
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Dot11ExtUIPropertySetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(bstrModifiedIHVProfile == NULL || pbIsModified == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ pIhvKeyProfile = new(std::nothrow) CIhvSecurityProfile();
+ if (pIhvKeyProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvKeyProfile->LoadXml(bstrIHVProfile);
+
+ pIhvKeyProfile->SetAuthType(m_IHVAuthCiphers.IHVAuth);
+ pIhvKeyProfile->SetFullSecurityFlag(FALSE);
+
+ pIhvKeyProfile->EmitXml(bstrModifiedIHVProfile);
+ *pbIsModified = pIhvKeyProfile->GetModified();
+
+error:
+ if(pIhvKeyProfile != NULL)
+ {
+ delete pIhvKeyProfile;
+ pIhvKeyProfile = NULL;
+ }
+ return hr;
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Dot11ExtUIPropertyHasConfigurationUI(
+ BOOL *fHasConfigurationUI)
+{
+ // this page always wants to show a config UI unless its of IHVAuthOpen1X auth
+ *fHasConfigurationUI = (m_IHVAuthCiphers.IHVAuth == IHVAuthV3)?FALSE:TRUE;
+ return S_OK;
+}
+
+//Used to get additional display data (ciphers for auth types)
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Dot11ExtUIPropertyGetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be described
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ ULONG *pcEntries, // number of dependent strings
+ ULONG *puDefaultSelection, // the entry in the array to be selected by default
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO **ppDot11ExtUIProperty // array of returned info structure
+ )
+{
+ HRESULT hr = S_OK;
+ DWORD i = 0;
+ DWORD dwDefaultSelection = 0;
+ CIhvSecurityProfile IhvSecurityProfile;
+ IHV_CIPHER_TYPE cipherType = IHVCipherInvalid;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(dot11ExtUIDisplayInfoType != DOT11_EXT_UI_DISPLAY_INFO_CIPHER)
+ {
+ hr = E_NOTIMPL;
+ goto error;
+ }
+
+ IhvSecurityProfile.LoadXml(bstrIHVProfile);
+ hr = IhvSecurityProfile.GetCipherType(&cipherType);
+ if(FAILED(hr))
+ {
+ goto error;
+ }
+
+ for(i = 0; i < m_IHVAuthCiphers.dwCipherCount; ++i)
+ {
+ ciphersInfoArray[m_IHVAuthCiphers.IHVAuth][i].dwDataKey = m_IHVAuthCiphers.IHVCiphers[i];
+ ciphersInfoArray[m_IHVAuthCiphers.IHVAuth][i].dot11ExtUIDisplayInfoType = DOT11_EXT_UI_DISPLAY_INFO_CIPHER;
+ ciphersInfoArray[m_IHVAuthCiphers.IHVAuth][i].bstrDisplayText = SysAllocString(g_IHVCipherFriendlyName[m_IHVAuthCiphers.IHVCiphers[i]]);
+
+ if(m_IHVAuthCiphers.IHVCiphers[i] == cipherType)
+ {
+ dwDefaultSelection = i;
+ }
+ }
+
+ // for the given auth type we want to return the list of compatible ciphers
+ *ppDot11ExtUIProperty = ciphersInfoArray[m_IHVAuthCiphers.IHVAuth];
+ *pcEntries = m_IHVAuthCiphers.dwCipherCount;
+ *puDefaultSelection = dwDefaultSelection;
+
+error:
+ return hr;
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Dot11ExtUIPropertySetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be modified
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO *pDot11ExtUIProperty, // selected info structure
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+
+ CIhvSecurityProfile IhvSecurityProfile;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(dot11ExtUIDisplayInfoType != DOT11_EXT_UI_DISPLAY_INFO_CIPHER)
+ {
+ hr = E_NOTIMPL;
+ goto error;
+ }
+
+ if(pDot11ExtUIProperty == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ hr = IhvSecurityProfile.LoadXml(bstrIHVProfile);
+ if(FAILED(hr))
+ {
+ goto error;
+ }
+ hr = IhvSecurityProfile.SetCipherType((IHV_CIPHER_TYPE)pDot11ExtUIProperty->dwDataKey);
+ if(FAILED(hr))
+ {
+ goto error;
+ }
+
+ hr = IhvSecurityProfile.EmitXml(bstrModifiedIHVProfile);
+ *pbIsModified = IhvSecurityProfile.GetModified();
+
+error:
+ return hr;
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Dot11ExtUIPropertyIsStandardSecurity(
+ BOOL *fIsStandardSecurity, // if this interface is a standard auth method
+ DOT11_EXT_UI_SECURITY_TYPE *dot11ExtUISecurityType // which of the standard auth methods it is
+ )
+{
+ *fIsStandardSecurity = FALSE;
+
+ if (m_IHVAuthCiphers.IHVAuth == IHVAuthV1)
+ {
+ *fIsStandardSecurity = TRUE;
+ *dot11ExtUISecurityType = DOT11_EXT_UI_SECURITY_8021X;
+ }
+
+ return S_OK;
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUIKeyProperty::Initialize(BYTE* pbData)
+{
+ HRESULT hr = E_INVALIDARG;
+ PIHV_AUTH_CIPHERS pIhvAuthCiphers = NULL;
+ pIhvAuthCiphers = (PIHV_AUTH_CIPHERS) pbData;
+
+ if (false == m_fInitialized)
+ {
+ // Set the FriendlyName
+ m_fInitialized = true;
+ memcpy(
+ &m_IHVAuthCiphers,
+ pIhvAuthCiphers,
+ sizeof(IHV_AUTH_CIPHERS)
+ );
+ hr = S_OK;
+ }
+ return hr;
+}
+
+INT_PTR CALLBACK
+SimpleDialogProcKey(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+)
+{
+ BOOL fRetVal = FALSE;
+ WCHAR szBuf[256] = {0};
+ DWORD dwValue = 0;
+ BSTR bstrText = NULL;
+
+ UNREFERENCED_PARAMETER(lParam);
+
+ if(!pIhvKeyProfile)
+ {
+ goto error;
+ }
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ // Dialog title
+ WCHAR strDialogTitle[MAX_PATH] = {0};
+ (VOID)::LoadString(
+ g_hInst,
+ IDS_IHV_DEFAULT_KEY_TITLE,
+ strDialogTitle,
+ MAX_PATH
+ );
+
+ SetWindowText(hwndDlg, strDialogTitle);
+ }
+
+ // check the checkbox if needed
+ if(FAILED(pIhvKeyProfile->GetParamDWORD(&dwValue)))
+ {
+ dwValue = 0;
+ }
+ ::SendMessage(
+ GetDlgItem(hwndDlg, IDC_USE_FASTHANDOFF),
+ BM_SETCHECK,
+ (WPARAM)(int)dwValue,
+ 0L
+ );
+
+ // Set text in the textbox
+ if(FAILED(pIhvKeyProfile->GetParamBSTR(&bstrText)))
+ {
+ bstrText = NULL;
+ }
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PARAM_BOX), bstrText);
+
+ fRetVal = TRUE;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case ID_OK:
+ GetWindowText(GetDlgItem(hwndDlg, IDC_PARAM_BOX), szBuf, 255);
+ if(szBuf)
+ {
+ DWORD dwNewValue = 0;
+
+ // get the button state and record it
+ dwNewValue = (int)::SendMessage(
+ GetDlgItem(hwndDlg, IDC_USE_FASTHANDOFF),
+ BM_GETCHECK,
+ 0L,
+ 0L
+ );
+
+ pIhvKeyProfile->SetParamDWORD(dwNewValue);
+ pIhvKeyProfile->SetParamBSTR(szBuf);
+ pIhvKeyProfile->SetFullSecurityFlag(FALSE);
+
+ // Notify the owner window to carry out the task.
+ EndDialog(hwndDlg, 1);
+ fRetVal = TRUE;
+ }
+ break;
+
+ case ID_CANCEL:
+ EndDialog(hwndDlg, 0);
+ fRetVal = TRUE;
+ break;
+ }
+ break;
+ }
+
+error:
+ return fRetVal;
+}
+
+
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUIKey.h b/network/wlan/ihvsampleui/IHVSampleExtUIKey.h
new file mode 100644
index 00000000..c106e549
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUIKey.h
@@ -0,0 +1,104 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#ifndef _IHVSAMPLEEXTUIKEY_H_
+#define _IHVSAMPLEEXTUIKEY_H_
+
+class CDot11SampleExtUIKeyProperty: public IDot11SampleExtUIKeyProperty
+{
+public:
+ CDot11SampleExtUIKeyProperty();
+
+ ~CDot11SampleExtUIKeyProperty();
+
+ // IUnknown Implementation
+ BEGIN_INTERFACE_TABLE()
+ IMPLEMENTS_INTERFACE(IDot11SampleExtUIKeyProperty)
+ END_INTERFACE_TABLE();
+
+ STDMETHODIMP
+ GetDot11ExtUIPropertyFriendlyName(
+ BSTR* bstrPropertyName // IHV friendly name
+ );
+
+ //Used to extend property
+ STDMETHODIMP
+ DisplayDot11ExtUIProperty(
+ HWND hParent, // Parent Window Handle
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ //Used to get the currently chosen entry to display as selected in the dropdown list
+ STDMETHODIMP
+ Dot11ExtUIPropertyGetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BOOL* pfIsSelected // flag denoting if this is the selected profile
+ );
+
+ //Used to set the current entry as chosen from the dropdown list
+ STDMETHODIMP
+ Dot11ExtUIPropertySetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertyHasConfigurationUI(BOOL *fHasConfigurationUI);
+
+ //Used to get additional display data (ciphers for auth types)
+ STDMETHODIMP
+ Dot11ExtUIPropertyGetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be described
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ ULONG *pcEntries, // number of dependent strings
+ ULONG *puDefaultSelection, // the entry in the array to be selected by default
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO **ppDot11ExtUIProperty // array of returned info structure
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertySetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be modified
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO *pDot11ExtUIProperty, // selected info structure
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertyIsStandardSecurity(
+ BOOL *fIsStandardSecurity, // if this interface is a standard auth method
+ DOT11_EXT_UI_SECURITY_TYPE *dot11ExtUISecurityType // which of the standard auth methods it is
+ );
+
+ // initialize the key extension page
+ STDMETHODIMP
+ Initialize(BYTE* pbData);
+
+private:
+ bool m_fInitialized;
+ BSTR m_bstrFN;
+ DOT11_EXT_UI_PROPERTY_TYPE m_ExtType;
+ BOOL m_fModified;
+ IHV_AUTH_CIPHERS m_IHVAuthCiphers;
+};
+
+
+INT_PTR CALLBACK
+SimpleDialogProcKey(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+);
+
+#endif _IHVSAMPLEEXTUIKEY_H_
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUISec.cpp b/network/wlan/ihvsampleui/IHVSampleExtUISec.cpp
new file mode 100644
index 00000000..1cfa3714
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUISec.cpp
@@ -0,0 +1,434 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+
+extern HINSTANCE g_hInst;
+
+// used by the con prop extensions
+CIhvSecurityProfile* pIhvSecProfile;
+
+CDot11SampleExtUISecProperty::CDot11SampleExtUISecProperty():
+ m_crefCount(0), m_fInitialized(false),
+ m_ExtType(DOT11_EXT_UI_SECURITY), m_fModified(FALSE),
+ m_IhvSecurityType(IHVSecurityInvalid)
+{
+ m_bstrFN = NULL;
+ InterlockedIncrement(&g_objRefCount);
+}
+
+CDot11SampleExtUISecProperty::~CDot11SampleExtUISecProperty()
+{
+ SysFreeString(m_bstrFN);
+ InterlockedDecrement(&g_objRefCount);
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUISecProperty::GetDot11ExtUIPropertyFriendlyName(BSTR* bstrPropertyName)
+{
+ HRESULT hr = E_INVALIDARG;
+ if (false == m_fInitialized)
+ {
+ return hr;
+ }
+
+ if (NULL != bstrPropertyName)
+ {
+ *bstrPropertyName = SysAllocString(m_bstrFN);
+ hr = S_OK;
+ }
+
+ return hr;
+}
+
+//Used to extend property
+STDMETHODIMP
+CDot11SampleExtUISecProperty::DisplayDot11ExtUIProperty(
+ HWND hParent, // Parent Window Handle
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if (!m_fInitialized)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ // Store the passed-in string in a member variable so dialog box can display it
+ pIhvSecProfile = new(std::nothrow) CIhvSecurityProfile();
+ if (pIhvSecProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+ pIhvSecProfile->LoadXml(bstrIHVProfile);
+ m_fModified = FALSE;
+
+ // Dialog will store the string in a member variable
+ DialogBoxParam(
+ g_hInst,
+ MAKEINTRESOURCE(IDD_PROPPAGE_SMALL),
+ hParent,
+ SimpleDialogProcSec,
+ (LPARAM)pIhvSecProfile
+ );
+
+ m_fModified = pIhvSecProfile->GetModified();
+
+ if (NULL != bstrModifiedIHVProfile)
+ {
+ if (m_fModified)
+ {
+ pIhvSecProfile->EmitXml(bstrModifiedIHVProfile);
+ }
+ }
+
+ if (NULL != pbIsModified)
+ {
+ *pbIsModified = m_fModified;
+ }
+
+error:
+ if(pIhvSecProfile)
+ {
+ delete pIhvSecProfile;
+ pIhvSecProfile = NULL;
+ }
+
+ return hr;
+}
+
+
+//Used to get the currently chosen entry to display as selected in the dropdown list
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Dot11ExtUIPropertyGetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BOOL* pfIsSelected // flag denoting if this is the selected profile
+ )
+{
+ HRESULT hr = S_OK;
+ IHV_SECURITY_TYPE currentSecurityType = IHVSecurityInvalid;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(pfIsSelected == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ *pfIsSelected = FALSE;
+
+ pIhvSecProfile = new(std::nothrow) CIhvSecurityProfile();
+ if (pIhvSecProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvSecProfile->LoadXml(bstrIHVProfile);
+
+ hr = pIhvSecProfile->GetSecurityType(&currentSecurityType);
+ if(FAILED(hr))
+ {
+ hr = S_OK;
+ if(IHVSecurityV1 == m_IhvSecurityType)
+ {
+ *pfIsSelected = TRUE;
+ }
+ }
+ else if(currentSecurityType == m_IhvSecurityType)
+ {
+ *pfIsSelected = TRUE;
+ }
+
+error:
+ if(pIhvSecProfile != NULL)
+ {
+ delete pIhvSecProfile;
+ pIhvSecProfile = NULL;
+ }
+ return hr;
+}
+
+//Used to set the current entry as chosen from the dropdown list
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Dot11ExtUIPropertySetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(bstrModifiedIHVProfile == NULL || pbIsModified == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ pIhvSecProfile = new(std::nothrow) CIhvSecurityProfile();
+ if (pIhvSecProfile == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ goto error;
+ }
+
+ pIhvSecProfile->LoadXml(bstrIHVProfile);
+
+ pIhvSecProfile->SetSecurityType(m_IhvSecurityType);
+ pIhvSecProfile->SetFullSecurityFlag(TRUE);
+
+ pIhvSecProfile->EmitXml(bstrModifiedIHVProfile );
+ *pbIsModified = pIhvSecProfile->GetModified();
+
+error:
+ if(pIhvSecProfile != NULL)
+ {
+ delete pIhvSecProfile;
+ pIhvSecProfile = NULL;
+ }
+ return hr;
+}
+
+
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Dot11ExtUIPropertyHasConfigurationUI(
+ BOOL *fHasConfigurationUI)
+{
+ // this page always wants to show a config UI
+ *fHasConfigurationUI = TRUE;
+ return S_OK;
+}
+
+//Used to get additional display data (ciphers for auth types)
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Dot11ExtUIPropertyGetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be described
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ ULONG *pcEntries, // number of dependent strings
+ ULONG *puDefaultSelection, // the entry in the array to be selected by default
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO **ppDot11ExtUIProperty // array of returned info structure
+ )
+{
+ HRESULT hr = S_OK;
+ DWORD i = 0;
+ CIhvSecurityProfile IhvSecurityProfile;
+ IHV_CIPHER_TYPE cipherType = IHVCipherInvalid;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ if(dot11ExtUIDisplayInfoType != DOT11_EXT_UI_DISPLAY_INFO_CIPHER)
+ {
+ hr = E_NOTIMPL;
+ goto error;
+ }
+
+ IhvSecurityProfile.LoadXml(bstrIHVProfile);
+ hr = IhvSecurityProfile.GetCipherType(&cipherType);
+ if(FAILED(hr))
+ {
+ goto error;
+ }
+
+ for(i = 0; i < PROP_COUNT_SEC_CIPHERS; ++i)
+ {
+ ciphersInfoArray[m_IhvSecurityType][i].dwDataKey = i;
+ ciphersInfoArray[m_IhvSecurityType][i].dot11ExtUIDisplayInfoType = DOT11_EXT_UI_DISPLAY_INFO_CIPHER;
+ ciphersInfoArray[m_IhvSecurityType][i].bstrDisplayText = SysAllocString(g_IHVCipherFriendlyName[i]);
+ }
+
+ // for the given auth type we want to return the list of compatible ciphers
+ *ppDot11ExtUIProperty = ciphersInfoArray[m_IhvSecurityType];
+ *pcEntries = PROP_COUNT_SEC_CIPHERS;
+ *puDefaultSelection = cipherType >= IHVCipherInvalid ? 0 : cipherType;
+
+error:
+ return hr;
+}
+
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Dot11ExtUIPropertySetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be modified
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO *pDot11ExtUIProperty, // selected info structure
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ )
+{
+ HRESULT hr = S_OK;
+
+ UNREFERENCED_PARAMETER(pIHVParams);
+
+ CIhvSecurityProfile IhvSecurityProfile;
+
+ if(dot11ExtUIDisplayInfoType != DOT11_EXT_UI_DISPLAY_INFO_CIPHER)
+ {
+ hr = E_NOTIMPL;
+ goto error;
+ }
+
+ if(pDot11ExtUIProperty == NULL)
+ {
+ hr = E_INVALIDARG;
+ goto error;
+ }
+
+ hr = IhvSecurityProfile.LoadXml(bstrIHVProfile);
+ if(FAILED(hr))
+ {
+ goto error;
+ }
+ hr = IhvSecurityProfile.SetCipherType((IHV_CIPHER_TYPE)pDot11ExtUIProperty->dwDataKey);
+ if(FAILED(hr))
+ {
+ goto error;
+ }
+
+ hr = IhvSecurityProfile.EmitXml(bstrModifiedIHVProfile);
+ *pbIsModified = IhvSecurityProfile.GetModified();
+
+error:
+ return hr;
+}
+
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Dot11ExtUIPropertyIsStandardSecurity(
+ BOOL *fIsStandardSecurity, // if this interface is a standard auth method
+ DOT11_EXT_UI_SECURITY_TYPE *dot11ExtUISecurityType // which of the standard auth methods it is
+ )
+{
+ UNREFERENCED_PARAMETER(dot11ExtUISecurityType);
+ *fIsStandardSecurity = FALSE;
+ return S_OK;
+}
+
+STDMETHODIMP
+CDot11SampleExtUISecProperty::Initialize(BSTR bstrPropertyName, DWORD dwIhvSecurity)
+{
+ HRESULT hr = E_INVALIDARG;
+ if (false == m_fInitialized)
+ {
+ // Set the FriendlyName
+ m_bstrFN = SysAllocString(bstrPropertyName);
+ m_IhvSecurityType = (IHV_SECURITY_TYPE)dwIhvSecurity;
+ m_fInitialized = true;
+ hr = S_OK;
+ }
+ return hr;
+}
+
+INT_PTR CALLBACK
+SimpleDialogProcSec(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+)
+{
+ BOOL fRetVal = FALSE;
+ WCHAR szBuf[256] = {0};
+ DWORD dwValue = 0;
+ BSTR bstrText = NULL;
+
+ UNREFERENCED_PARAMETER(lParam);
+
+ if(!pIhvSecProfile)
+ {
+ goto error;
+ }
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ // Dialog title
+ WCHAR strDialogTitle[MAX_PATH] = {0};
+ (VOID)::LoadString(
+ g_hInst,
+ IDS_IHV_DEFAULT_SEC_TITLE,
+ strDialogTitle,
+ MAX_PATH
+ );
+
+ SetWindowText(hwndDlg, strDialogTitle);
+ }
+
+ // check the checkbox if needed
+ if(FAILED(pIhvSecProfile->GetParamDWORD(&dwValue)))
+ {
+ dwValue = 0;
+ }
+ ::SendMessage(
+ GetDlgItem(hwndDlg, IDC_USE_FASTHANDOFF),
+ BM_SETCHECK,
+ (WPARAM)(int)dwValue,
+ 0L
+ );
+
+ // Set text in the textbox
+ if(FAILED(pIhvSecProfile->GetParamBSTR(&bstrText)))
+ {
+ bstrText = NULL;
+ }
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PARAM_BOX), bstrText);
+
+ fRetVal = TRUE;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case ID_OK:
+ GetWindowText(GetDlgItem(hwndDlg, IDC_PARAM_BOX), szBuf, 255);
+ if(szBuf)
+ {
+ DWORD dwNewValue = 0;
+
+ // get the button state and record it
+ dwNewValue = (int)::SendMessage(
+ GetDlgItem(hwndDlg, IDC_USE_FASTHANDOFF),
+ BM_GETCHECK,
+ 0L,
+ 0L
+ );
+
+ pIhvSecProfile->SetParamDWORD(dwNewValue);
+ pIhvSecProfile->SetParamBSTR(szBuf);
+ pIhvSecProfile->SetFullSecurityFlag(TRUE);
+
+ // Notify the owner window to carry out the task.
+ EndDialog(hwndDlg, 1);
+ fRetVal = TRUE;
+ }
+ break;
+
+ case ID_CANCEL:
+ EndDialog(hwndDlg, 0);
+ fRetVal = TRUE;
+ break;
+ }
+ break;
+ }
+
+error:
+ return fRetVal;
+}
+
+
diff --git a/network/wlan/ihvsampleui/IHVSampleExtUISec.h b/network/wlan/ihvsampleui/IHVSampleExtUISec.h
new file mode 100644
index 00000000..fc8caa2e
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleExtUISec.h
@@ -0,0 +1,105 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#ifndef _IHVSAMPLEEXTUISEC_H_
+#define _IHVSAMPLEEXTUISEC_H_
+
+class CDot11SampleExtUISecProperty: public IDot11SampleExtUISecProperty
+{
+public:
+ CDot11SampleExtUISecProperty();
+
+ ~CDot11SampleExtUISecProperty();
+
+ // IUnknown Implementation
+ BEGIN_INTERFACE_TABLE()
+ IMPLEMENTS_INTERFACE(IDot11SampleExtUISecProperty)
+ END_INTERFACE_TABLE();
+
+ STDMETHODIMP
+ GetDot11ExtUIPropertyFriendlyName(
+ BSTR* bstrPropertyName // IHV friendly name
+ );
+
+ //Used to extend property
+ STDMETHODIMP
+ DisplayDot11ExtUIProperty(
+ HWND hParent, // Parent Window Handle
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ //Used to get the currently chosen entry to display as selected in the dropdown list
+ STDMETHODIMP
+ Dot11ExtUIPropertyGetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BOOL* pfIsSelected // flag denoting if this is the selected profile
+ );
+
+ //Used to set the current entry as chosen from the dropdown list
+ STDMETHODIMP
+ Dot11ExtUIPropertySetSelected(
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertyHasConfigurationUI(BOOL *fHasConfigurationUI);
+
+ //Used to get additional display data (ciphers for auth types)
+ STDMETHODIMP
+ Dot11ExtUIPropertyGetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be described
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ ULONG *pcEntries, // number of dependent strings
+ ULONG *puDefaultSelection, // the entry in the array to be selected by default
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO **ppDot11ExtUIProperty // array of returned info structure
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertySetDisplayInfo(
+ DOT11_EXT_UI_DISPLAY_INFO_TYPE dot11ExtUIDisplayInfoType, // the diapaly type to be modified
+ BSTR bstrIHVProfile, // IHV data from the profile
+ PDOT11EXT_IHV_PARAMS pIHVParams, // Select profile MS security settings
+ DOT11_EXT_UI_PROPERTY_DISPLAY_INFO *pDot11ExtUIProperty, // selected info structure
+ BSTR* bstrModifiedIHVProfile, // modified IHV data to be stored in the profile
+ BOOL* pbIsModified // flag to denote if profile was modified
+ );
+
+ STDMETHODIMP
+ Dot11ExtUIPropertyIsStandardSecurity(
+ BOOL *fIsStandardSecurity, // if this interface is a standard auth method
+ DOT11_EXT_UI_SECURITY_TYPE *dot11ExtUISecurityType // which of the standard auth methods it is
+ );
+
+ // initialize the security page
+ STDMETHODIMP
+ Initialize(BSTR bstrPropertyName, DWORD dwIhvSecurity);
+
+private:
+ bool m_fInitialized;
+ BSTR m_bstrFN;
+ DOT11_EXT_UI_PROPERTY_TYPE m_ExtType;
+ BOOL m_fModified;
+ IHV_SECURITY_TYPE m_IhvSecurityType;
+ IHV_CIPHER_TYPE m_IHVCipherList[MAX_CIPHER_TYPES];
+};
+
+
+INT_PTR CALLBACK
+SimpleDialogProcSec(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+);
+
+#endif _IHVSAMPLEEXTUISEC_H_
diff --git a/network/wlan/ihvsampleui/IHVSampleProfile.cpp b/network/wlan/ihvsampleui/IHVSampleProfile.cpp
new file mode 100644
index 00000000..0b9bb8a2
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleProfile.cpp
@@ -0,0 +1,918 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+
+HRESULT
+CIhvProfileBase::GetTextFromNode
+(
+ IN LPCWSTR pszQuery,
+ OUT BSTR* pbstrText
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrQuery = NULL;
+ IXMLDOMNode* pQueryNode = NULL;
+
+ if ( !m_pRootNode )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( (!pszQuery) || (!pbstrText) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr =
+ Wstr2Bstr
+ (
+ pszQuery,
+ &bstrQuery
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr = m_pRootNode->selectSingleNode( bstrQuery, &pQueryNode );
+ BAIL_ON_FAILURE( hr );
+
+ if (!pQueryNode)
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr = pQueryNode->get_text( pbstrText );
+ BAIL_ON_FAILURE( hr );
+
+ if ( !(*pbstrText) )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ RELEASE_INTERFACE( pQueryNode );
+ SYS_FREE_STRING( bstrQuery );
+ return hr;
+}
+
+
+HRESULT
+CIhvProfileBase::PutTextInNode
+(
+ IN LPCWSTR pszQuery,
+ IN BSTR bstrText
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrQuery = NULL;
+ BSTR bstrOrig = NULL;
+ BOOL bPut = TRUE;
+ IXMLDOMNode* pQueryNode = NULL;
+
+ if ( !m_pRootNode )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( (!pszQuery) || (!bstrText) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr =
+ Wstr2Bstr
+ (
+ pszQuery,
+ &bstrQuery
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr = m_pRootNode->selectSingleNode( bstrQuery, &pQueryNode );
+ BAIL_ON_FAILURE( hr );
+
+ if (!pQueryNode)
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr = pQueryNode->get_text( &bstrOrig );
+ BAIL_ON_FAILURE( hr );
+
+ if ( bstrOrig && ( 0 == wcscmp( bstrOrig, bstrText ) ) )
+ {
+ bPut = FALSE;
+ }
+
+ if ( bPut )
+ {
+ hr = pQueryNode->put_text( bstrText );
+ BAIL_ON_FAILURE( hr );
+
+ SetModified( );
+ }
+
+error:
+ RELEASE_INTERFACE( pQueryNode );
+ SYS_FREE_STRING( bstrQuery );
+ SYS_FREE_STRING( bstrOrig );
+ return hr;
+}
+
+
+HRESULT
+CIhvProfileBase::LoadXml
+(
+ IN BSTR bstrProfileData
+)
+{
+ HRESULT hr = S_OK;
+ IXMLDOMDocument* pDOMDoc = NULL;
+ IXMLDOMElement* pDocElem = NULL;
+ BSTR bstrIhvProfile = NULL;
+ VARIANT_BOOL vfSuccess;
+
+ if ( !bstrProfileData )
+ {
+ hr = GetDefaultXml( &bstrIhvProfile );
+ BAIL_ON_FAILURE( hr );
+ }
+ else
+ {
+ bstrIhvProfile = bstrProfileData;
+ }
+
+ if ( m_pRootNode )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr =
+ CoCreateInstance
+ (
+ CLSID_DOMDocument60,
+ NULL,
+ CLSCTX_ALL,
+ IID_IXMLDOMDocument,
+ (LPVOID *) &pDOMDoc
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ pDOMDoc->loadXML
+ (
+ bstrIhvProfile,
+ &vfSuccess
+ );
+ BAIL_ON_FAILURE( hr );
+
+ if ( VARIANT_TRUE != vfSuccess )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr =
+ pDOMDoc->get_documentElement
+ (
+ &pDocElem
+ );
+ BAIL_ON_FAILURE( hr );
+
+ // Caching the pointer to the document element
+ // in a member variable.
+ m_pRootNode = pDocElem;
+ pDocElem = NULL;
+
+
+error:
+ if ( !bstrProfileData )
+ {
+ SYS_FREE_STRING( bstrIhvProfile );
+ }
+ RELEASE_INTERFACE( pDOMDoc );
+ RELEASE_INTERFACE( pDocElem );
+ return hr;
+}
+
+
+HRESULT
+CIhvProfileBase::EmitXml
+(
+ OUT BSTR* pbstrIhvProfile
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !pbstrIhvProfile )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( !m_pRootNode )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr = m_pRootNode->get_xml( pbstrIhvProfile );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ return hr;
+}
+
+
+//////////////////////////////////////////////////////////
+
+WCHAR g_szDefaultConnectivityProfile[] =
+L"<IhvConnectivity xmlns=\"http://www.sampleihv.com/nwifi/profile\">"
+L" <IHVConnectivityParam1>0</IHVConnectivityParam1>"
+L" <IHVConnectivityParam2>parameter value</IHVConnectivityParam2>"
+L"</IhvConnectivity>"
+;
+
+
+
+HRESULT
+CIhvConnectivityProfile::GetDefaultXml
+(
+ BSTR* pbstrDefault
+)
+{
+ SetModified();
+ return Wstr2Bstr( g_szDefaultConnectivityProfile, pbstrDefault );
+}
+
+
+
+HRESULT
+CIhvConnectivityProfile::GetParamDWORD
+(
+ DWORD* pdwParam1
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrData = NULL;
+
+ hr =
+ GetTextFromNode
+ (
+ CON_PARAM2_XPATH,
+ &bstrData
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2Dword
+ (
+ bstrData,
+ pdwParam1
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrData );
+ return hr;
+}
+
+
+HRESULT
+CIhvConnectivityProfile::SetParamDWORD
+(
+ DWORD dwNewValue
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrText = NULL;
+
+ hr =
+ Dword2Bstr
+ (
+ dwNewValue,
+ &bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ PutTextInNode
+ (
+ CON_PARAM2_XPATH,
+ bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrText );
+ return hr;
+}
+
+
+
+HRESULT
+CIhvConnectivityProfile::GetParamBSTR
+(
+ BSTR* pbstrValue
+)
+{
+ HRESULT hr = S_OK;
+
+ hr =
+ GetTextFromNode
+ (
+ CON_PARAM1_XPATH,
+ pbstrValue
+ );
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+
+
+HRESULT
+CIhvConnectivityProfile::SetParamBSTR
+(
+ BSTR bstrNewValue
+)
+{
+ HRESULT hr = S_OK;
+
+ hr =
+ PutTextInNode
+ (
+ CON_PARAM1_XPATH,
+ bstrNewValue
+ );
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+HRESULT
+CIhvConnectivityProfile::GetNativeData
+(
+ LPVOID* ppvData
+)
+{
+ HRESULT hr = S_OK;
+ PIHV_CONNECTIVITY_PROFILE pIhvProfile = NULL;
+ BSTR bstrParam2 = NULL;
+
+ if ( !ppvData )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ pIhvProfile = (PIHV_CONNECTIVITY_PROFILE) malloc( sizeof( IHV_CONNECTIVITY_PROFILE ) );
+ if ( !pIhvProfile )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+ ZeroMemory( pIhvProfile, sizeof( IHV_CONNECTIVITY_PROFILE ) );
+
+ hr =
+ GetParamBSTR
+ (
+ &bstrParam2
+ );
+ BAIL_ON_FAILURE( hr );
+
+ if ( NULL == bstrParam2 ) {
+ hr = E_POINTER;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr =
+ Wstr2Wstr
+ (
+ bstrParam2,
+ &(pIhvProfile->pszParam2)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ GetParamDWORD
+ (
+ &(pIhvProfile->dwParam1)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ // Transfering local cache to OUT parameter.
+ (*ppvData) = pIhvProfile;
+ pIhvProfile = NULL;
+
+error:
+ if ( pIhvProfile )
+ {
+ free( pIhvProfile->pszParam2 ); // NULL Safe.
+ free( pIhvProfile );
+ }
+ SYS_FREE_STRING( bstrParam2 );
+ return hr;
+}
+
+
+
+///////////////////////////////////////////
+
+LPCWSTR gppszIhvAuthTypes[] =
+{
+ L"IHVAuthV1",
+ L"IHVAuthV2",
+ L"IHVAuthV3"
+};
+
+LPCWSTR gppszIhvSecurityTypes[] =
+{
+ L"IHVSecurityV1",
+ L"IHVSecurityV2",
+};
+
+LPCWSTR gppszIhvCipherTypes[] =
+{
+ L"None",
+ L"IHVCipher1",
+ L"IHVCipher2",
+ L"IHVCipher3"
+};
+
+
+WCHAR g_szDefaultSecurityProfile[] =
+L"<IhvSecurity xmlns=\"http://www.sampleihv.com/nwifi/profile\">"
+L" <IHVUsesFullSecurity>TRUE</IHVUsesFullSecurity>"
+L" <IHVAuthentication>IHVAuthV1</IHVAuthentication>"
+L" <IHVEncryption>IHVCipher1</IHVEncryption>"
+L" <IHVSecurityParam1>0</IHVSecurityParam1>"
+L" <IHVSecurityParam2>parameter value</IHVSecurityParam2>"
+L"</IhvSecurity>";
+
+
+
+HRESULT
+CIhvSecurityProfile::GetDefaultXml
+(
+ BSTR* pbstrDefault
+)
+{
+ SetModified();
+ return Wstr2Bstr( g_szDefaultSecurityProfile, pbstrDefault );
+}
+
+HRESULT
+CIhvSecurityProfile::GetNativeData
+(
+ LPVOID* ppvData
+)
+{
+ HRESULT hr = S_OK;
+ PIHV_SECURITY_PROFILE pIhvProfile = NULL;
+ BSTR bstrParam2 = NULL;
+
+ if ( !ppvData )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ pIhvProfile = (PIHV_SECURITY_PROFILE) malloc( sizeof( IHV_SECURITY_PROFILE ) );
+ if ( !pIhvProfile )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+ ZeroMemory( pIhvProfile, sizeof( IHV_SECURITY_PROFILE ) );
+
+ hr =
+ GetFullSecurityFlag
+ (
+ &(pIhvProfile->bUseFullSecurity)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ GetAuthType
+ (
+ &(pIhvProfile->AuthType)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ GetCipherType
+ (
+ &(pIhvProfile->CipherType)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ GetParamDWORD
+ (
+ &(pIhvProfile->dwParam1)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ GetParamBSTR
+ (
+ &bstrParam2
+ );
+ BAIL_ON_FAILURE( hr );
+
+ if ( NULL == bstrParam2 ) {
+ hr = E_POINTER;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ hr =
+ Wstr2Wstr
+ (
+ bstrParam2,
+ &(pIhvProfile->pszParam2)
+ );
+ BAIL_ON_FAILURE( hr );
+
+ // Transfering local cache to OUT parameter.
+ (*ppvData) = pIhvProfile;
+ pIhvProfile = NULL;
+
+error:
+ if ( pIhvProfile )
+ {
+ free( pIhvProfile->pszParam2 ); // NULL Safe.
+ free( pIhvProfile );
+ }
+ SYS_FREE_STRING( bstrParam2 );
+ return hr;
+
+}
+
+
+
+HRESULT
+CIhvSecurityProfile::GetFullSecurityFlag
+(
+ BOOL* pbUseFullSecurity
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrData = NULL;
+
+ hr =
+ GetTextFromNode
+ (
+ SEC_FSFLAG_XPATH,
+ &bstrData
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2Bool
+ (
+ bstrData,
+ pbUseFullSecurity
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrData );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::SetFullSecurityFlag
+(
+ BOOL bUseFullSecurity
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrText = NULL;
+
+ hr =
+ Bool2Bstr
+ (
+ bUseFullSecurity,
+ &bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ PutTextInNode
+ (
+ SEC_FSFLAG_XPATH,
+ bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrText );
+ return hr;
+}
+
+
+
+HRESULT
+CIhvSecurityProfile::GetAuthType
+(
+ PIHV_AUTH_TYPE pAuthType
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrData = NULL;
+
+ hr =
+ GetTextFromNode
+ (
+ SEC_ATYPE_XPATH,
+ &bstrData
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2AuthType
+ (
+ bstrData,
+ pAuthType
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrData );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::SetAuthType
+(
+ IHV_AUTH_TYPE AuthType
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrText = NULL;
+
+ hr =
+ AuthType2Bstr
+ (
+ AuthType,
+ &bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ PutTextInNode
+ (
+ SEC_ATYPE_XPATH,
+ bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrText );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::GetSecurityType
+(
+ PIHV_SECURITY_TYPE pSecurityType
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrData = NULL;
+
+ hr =
+ GetTextFromNode
+ (
+ SEC_ATYPE_XPATH,
+ &bstrData
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2SecurityType
+ (
+ bstrData,
+ pSecurityType
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrData );
+ return hr;
+}
+
+HRESULT
+CIhvSecurityProfile::SetSecurityType
+(
+ IHV_SECURITY_TYPE SecurityType
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrText = NULL;
+
+ hr =
+ SecurityType2Bstr
+ (
+ SecurityType,
+ &bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ PutTextInNode
+ (
+ SEC_ATYPE_XPATH,
+ bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrText );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::GetCipherType
+(
+ PIHV_CIPHER_TYPE pCipherType
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrData = NULL;
+
+ hr =
+ GetTextFromNode
+ (
+ SEC_ETYPE_XPATH,
+ &bstrData
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2CipherType
+ (
+ bstrData,
+ pCipherType
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrData );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::SetCipherType
+(
+ IHV_CIPHER_TYPE CipherType
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrText = NULL;
+
+ hr =
+ CipherType2Bstr
+ (
+ CipherType,
+ &bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ PutTextInNode
+ (
+ SEC_ETYPE_XPATH,
+ bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrText );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::GetParamDWORD
+(
+ DWORD* pdwParam1
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrData = NULL;
+
+ hr =
+ GetTextFromNode
+ (
+ SEC_PARAM2_XPATH,
+ &bstrData
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2Dword
+ (
+ bstrData,
+ pdwParam1
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrData );
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::SetParamDWORD
+(
+ DWORD dwNewValue
+)
+{
+ HRESULT hr = S_OK;
+ BSTR bstrText = NULL;
+
+ hr =
+ Dword2Bstr
+ (
+ dwNewValue,
+ &bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ PutTextInNode
+ (
+ SEC_PARAM2_XPATH,
+ bstrText
+ );
+ BAIL_ON_FAILURE( hr );
+
+error:
+ SYS_FREE_STRING( bstrText );
+ return hr;
+}
+
+
+
+HRESULT
+CIhvSecurityProfile::GetParamBSTR
+(
+ BSTR* pbstrValue
+)
+{
+ HRESULT hr = S_OK;
+
+ hr =
+ GetTextFromNode
+ (
+ SEC_PARAM1_XPATH,
+ pbstrValue
+ );
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+
+HRESULT
+CIhvSecurityProfile::SetParamBSTR
+(
+ BSTR bstrNewValue
+)
+{
+ HRESULT hr = S_OK;
+
+ hr =
+ PutTextInNode
+ (
+ SEC_PARAM1_XPATH,
+ bstrNewValue
+ );
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
diff --git a/network/wlan/ihvsampleui/IHVSampleProfile.h b/network/wlan/ihvsampleui/IHVSampleProfile.h
new file mode 100644
index 00000000..66e8ce3f
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleProfile.h
@@ -0,0 +1,296 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#pragma once
+
+#ifndef _IHVSAMPLEPROFILE_H
+#define _IHVSAMPLEPROFILE_H
+
+#define RELEASE_INTERFACE( _p ) if ( _p ) { (_p)->Release( ); (_p) = NULL;}
+
+
+class CIhvProfileBase
+{
+public:
+
+ // Constructor
+ CIhvProfileBase( )
+ {
+ m_bModified = FALSE;
+ m_pRootNode = NULL;
+ }
+
+ // Destructor
+ ~CIhvProfileBase( )
+ {
+ RELEASE_INTERFACE( m_pRootNode );
+ }
+
+ HRESULT
+ LoadXml
+ (
+ IN BSTR bstrIhvProfile
+ );
+
+ HRESULT
+ EmitXml
+ (
+ OUT BSTR* pbstrIhvProfile
+ );
+
+ BOOL GetModified( ) { return m_bModified; }
+
+ // Caller needs to know what type to
+ // cast the pointer to depending upon
+ // the type of the derived class.
+ // Caller needs to free memory recursively
+ // by using the free( ) function.
+ virtual
+ HRESULT
+ GetNativeData
+ (
+ LPVOID* ppvData
+ )
+ = 0;
+
+protected:
+
+ virtual
+ HRESULT
+ GetDefaultXml
+ (
+ BSTR* pbstrDefault
+ )
+ = 0;
+
+ HRESULT
+ GetTextFromNode
+ (
+ IN LPCWSTR pszQuery,
+ OUT BSTR* pbstrText
+ );
+
+ HRESULT
+ PutTextInNode
+ (
+ IN LPCWSTR pszQuery,
+ IN BSTR bstrText
+ );
+
+
+ VOID SetModified( ) { m_bModified = TRUE; }
+
+ IXMLDOMElement* m_pRootNode;
+
+private:
+ BOOL m_bModified;
+};
+
+///////////////////////////////////////////
+
+
+typedef struct _IHV_CONNECTIVITY_PROFILE
+{
+#define CON_PARAM1_XPATH L"/IhvConnectivity/IHVConnectivityParam1"
+#define CON_PARAM2_XPATH L"/IhvConnectivity/IHVConnectivityParam2"
+
+ DWORD dwParam1;
+ LPWSTR pszParam2;
+}
+IHV_CONNECTIVITY_PROFILE, *PIHV_CONNECTIVITY_PROFILE;
+
+
+extern WCHAR g_szDefaultConnectivityProfile[];
+
+class CIhvConnectivityProfile
+ : public CIhvProfileBase
+{
+protected:
+ HRESULT
+ GetDefaultXml
+ (
+ BSTR* pbstrDefault
+ );
+
+public:
+
+ // Constructor Destructor
+ CIhvConnectivityProfile( ) { }
+ ~CIhvConnectivityProfile( ) { }
+
+ // Caller needs to know what type to
+ // cast the pointer to depending upon
+ // the type of the derived class.
+ // Caller needs to free memory recursively
+ // by using the free( ) function.
+ HRESULT
+ GetNativeData
+ (
+ LPVOID* ppvData
+ );
+
+
+ // Accessor and Modifier for dwParam1
+ HRESULT
+ GetParamDWORD
+ (
+ DWORD* pdwParam1
+ );
+ HRESULT
+ SetParamDWORD
+ (
+ DWORD dwNewValue
+ );
+
+ // Accessor and Modifier for pszParam2
+ HRESULT
+ GetParamBSTR
+ (
+ BSTR* pbstrValue
+ );
+ HRESULT
+ SetParamBSTR
+ (
+ BSTR bstrNewValue
+ );
+
+};
+
+
+
+///////////////////////////////////////////
+
+extern LPCWSTR gppszIhvSecurityTypes[];
+
+#define MAX_AUTH_TYPES 3
+extern LPCWSTR gppszIhvAuthTypes[];
+
+#define MAX_CIPHER_TYPES 4
+extern LPCWSTR gppszIhvCipherTypes[];
+
+typedef struct _IHV_SECURITY_PROFILE
+{
+#define SEC_FSFLAG_XPATH L"/IhvSecurity/IHVUsesFullSecurity"
+#define SEC_ATYPE_XPATH L"/IhvSecurity/IHVAuthentication"
+#define SEC_ETYPE_XPATH L"/IhvSecurity/IHVEncryption"
+#define SEC_PARAM1_XPATH L"/IhvSecurity/IHVSecurityParam1"
+#define SEC_PARAM2_XPATH L"/IhvSecurity/IHVSecurityParam2"
+
+ BOOL bUseFullSecurity;
+ IHV_AUTH_TYPE AuthType;
+ IHV_CIPHER_TYPE CipherType;
+ DWORD dwParam1;
+ LPWSTR pszParam2;
+}
+IHV_SECURITY_PROFILE, *PIHV_SECURITY_PROFILE;
+
+
+extern WCHAR g_szDefaultSecurityProfile[];
+
+class CIhvSecurityProfile
+ : public CIhvProfileBase
+{
+protected:
+ HRESULT
+ GetDefaultXml
+ (
+ BSTR* pbstrDefault
+ );
+
+public:
+
+ // Constructor Destructor
+ CIhvSecurityProfile( ) { }
+ ~CIhvSecurityProfile( ) { }
+
+ // Caller needs to know what type to
+ // cast the pointer to depending upon
+ // the type of the derived class.
+ // Caller needs to free memory recursively
+ // by using the free( ) function.
+ HRESULT
+ GetNativeData
+ (
+ LPVOID* ppvData
+ );
+
+
+ // Accessor and Modifier for bUseFullSecurity
+ HRESULT
+ GetFullSecurityFlag
+ (
+ BOOL* pbUseFullSecurity
+ );
+ HRESULT
+ SetFullSecurityFlag
+ (
+ BOOL bUseFullSecurity
+ );
+
+
+ // Accessor and Modifier for AuthType
+ HRESULT
+ GetAuthType
+ (
+ PIHV_AUTH_TYPE pAuthType
+ );
+ HRESULT
+ SetAuthType
+ (
+ IHV_AUTH_TYPE AuthType
+ );
+
+ // Accessor and Modifier for SecurityType
+ HRESULT
+ GetSecurityType
+ (
+ PIHV_SECURITY_TYPE pSecurityType
+ );
+ HRESULT
+ SetSecurityType
+ (
+ IHV_SECURITY_TYPE SecurityType
+ );
+
+ // Accessor and Modifier for CipherType
+ HRESULT
+ GetCipherType
+ (
+ PIHV_CIPHER_TYPE pCipherType
+ );
+ HRESULT
+ SetCipherType
+ (
+ IHV_CIPHER_TYPE CipherType
+ );
+
+ // Accessor and Modifier for dwParam1
+ HRESULT
+ GetParamDWORD
+ (
+ DWORD* pdwParam1
+ );
+ HRESULT
+ SetParamDWORD
+ (
+ DWORD dwNewValue
+ );
+
+ // Accessor and Modifier for pszParam2
+ HRESULT
+ GetParamBSTR
+ (
+ BSTR* pbstrValue
+ );
+ HRESULT
+ SetParamBSTR
+ (
+ BSTR bstrNewValue
+ );
+
+};
+
+#endif _IHVSAMPLEPROFILE_H
+
diff --git a/network/wlan/ihvsampleui/IHVSampleUI.cpp b/network/wlan/ihvsampleui/IHVSampleUI.cpp
new file mode 100644
index 00000000..f93218bc
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleUI.cpp
@@ -0,0 +1,122 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+
+#include "precomp.h"
+
+CIHVClassFactory *g_pIHVClassFactory = NULL;
+
+// instance handle to dll
+HINSTANCE g_hInst;
+
+// object ref count
+long g_objRefCount = 0;
+long g_serverLock = 0; //lock count on server
+
+//
+// DllRegisterServer - Adds entries to the system registry
+//
+STDAPI DllRegisterServer()
+{
+ HRESULT hr = S_OK;
+
+ hr = CRegHelper::RegisterServer();
+
+ return hr;
+}
+
+//
+// DllUnregisterServer - Removes entries from the system registry
+//
+STDAPI DllUnregisterServer()
+{
+ HRESULT hr = S_OK;
+
+ hr = CRegHelper::UnregisterServer();
+
+ return hr;
+}
+
+
+
+//
+// Used to determine whether the DLL can be unloaded by COM
+//
+STDAPI DllCanUnloadNow(void)
+{
+ if ((g_objRefCount == 0) && (g_serverLock == 0) /*&& (_Module.GetLockCount() == 0)*/)
+ {
+ return S_OK;
+ }
+ else
+ {
+ return S_FALSE;
+ }
+}
+
+
+
+STDAPI
+DllGetClassObject(
+ _In_ REFCLSID rclsid,
+ _In_ REFIID riid,
+ _Outptr_ LPVOID *ppv)
+{
+ HRESULT hr = E_NOINTERFACE;
+
+ if (NULL == g_pIHVClassFactory)
+ {
+ g_pIHVClassFactory = new(std::nothrow) CIHVClassFactory();
+ if (NULL == g_pIHVClassFactory)
+ {
+ hr = E_OUTOFMEMORY;
+ }
+ }
+
+ if(NULL != g_pIHVClassFactory &&
+ (rclsid == GUID_SAMPLE_IHVUI_CLSID || rclsid == IID_IWizardExtension))
+ {
+ hr = g_pIHVClassFactory->QueryInterface(riid, ppv);
+ }
+ return hr;
+}
+
+
+//+----------------------------------------------------------------------------
+//
+// Function: DllMain
+//
+// Synopsis: Main entry point into the DLL.
+//
+// Arguments: HINSTANCE hinstDLL - Our HINSTANCE
+// DWORD fdwReason - The reason we are being called.
+// LPVOID lpvReserved - Reserved
+//
+// Returns: BOOL WINAPI - TRUE - always
+//
+//+----------------------------------------------------------------------------
+extern "C"
+BOOL WINAPI
+DllMain(
+ HINSTANCE hInstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved
+ )
+{
+ UNREFERENCED_PARAMETER(lpvReserved);
+
+ if (DLL_PROCESS_ATTACH == fdwReason)
+ {
+ // Set our global instance handle
+ g_hInst = hInstDLL;
+ (VOID)DisableThreadLibraryCalls(hInstDLL);
+ }
+ else if (DLL_PROCESS_DETACH == fdwReason)
+ {
+ }
+
+ return TRUE;
+}
+
diff --git a/network/wlan/ihvsampleui/IHVSampleUI.def b/network/wlan/ihvsampleui/IHVSampleUI.def
new file mode 100644
index 00000000..2882c292
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleUI.def
@@ -0,0 +1,7 @@
+LIBRARY "IhvSampleUI.dll"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/network/wlan/ihvsampleui/IHVSampleUI.rc b/network/wlan/ihvsampleui/IHVSampleUI.rc
new file mode 100644
index 00000000..2c6563d8
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleUI.rc
@@ -0,0 +1,129 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "TODO: <Company name>"
+ VALUE "FileDescription", "TODO: <File description>"
+ VALUE "FileVersion", "1.0.0.1"
+ VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved."
+ VALUE "InternalName", "IHVSampleUI.dll"
+ VALUE "OriginalFilename", "IHVSampleUI.dll"
+ VALUE "ProductName", "TODO: <Product name>"
+ VALUE "ProductVersion", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_PROPPAGE_SMALL DIALOGEX 0, 0, 227, 244
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "IHV Profile String"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ LTEXT "This is a sample IHV extended dialog.",IDC_TITLE_TXT,
+ 20,19,135,8
+ LTEXT "Parameter 1",IDC_PARAM_TXT,20,49,80,8
+ EDITTEXT IDC_PARAM_BOX,101,48,96,14
+ CONTROL "Parameter 2",IDC_USE_FASTHANDOFF,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,20,72,178,10
+ PUSHBUTTON "OK",ID_OK,96,210,49,14
+ PUSHBUTTON "Cancel",ID_CANCEL,167,209,50,14
+END
+
+IDD_DIALOG_SHOWHELP DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Dialog"
+FONT 9, "Segoe UI", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_EDIT_HELPER,8,7,171,81,ES_AUTOHSCROLL
+END
+
+IDD_DIALOG_GETKEY DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Dialog"
+FONT 9, "Segoe UI", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_EDIT_KEY,23,46,142,14,ES_AUTOHSCROLL
+ LTEXT "Please enter IHV keys:",IDC_STATIC,25,17,74,8
+END
+
+IDD_DIALOG_LASTPAGE DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Dialog"
+FONT 9, "Segoe UI", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_DATETIMEPICKER1,"SysDateTimePick32",
+ DTS_RIGHTALIGN | WS_TABSTOP,7,7,172,12
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_PROJNAME "SampleIHVExt"
+ IDS_TITLE_GETKEY "IHV Get Key Page"
+ IDS_TITLE_SHOWHELP "IHV Helper Page"
+ IDS_TITLE_LASTPAGE "IHV Last Page"
+ IDS_IHV_DEFAULT_TITLE "IHV Properties"
+ IDS_IHV_DEFAULT_CON_TITLE "IHV Connection Properties"
+ IDS_IHV_DEFAULT_KEY_TITLE "IHV Security Properties"
+ IDS_IHV_DEFAULT_SEC_TITLE "IHV Security Properties"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
diff --git a/network/wlan/ihvsampleui/IHVSampleUI.vcxproj b/network/wlan/ihvsampleui/IHVSampleUI.vcxproj
new file mode 100644
index 00000000..36ff1126
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleUI.vcxproj
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{1EE6DF41-8C0B-4C74-98D2-FCDF020E7128}</ProjectGuid>
+ <RootNamespace>$(MSBuildProjectName)</RootNamespace>
+ <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
+ <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+ <SampleGuid>{C7745B6F-E931-4E1C-A12B-5BF1C854C635}</SampleGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>False</UseDebugLibraries>
+ <DriverTargetPlatform>Desktop</DriverTargetPlatform>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>True</UseDebugLibraries>
+ <DriverTargetPlatform>Desktop</DriverTargetPlatform>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>False</UseDebugLibraries>
+ <DriverTargetPlatform>Desktop</DriverTargetPlatform>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>True</UseDebugLibraries>
+ <DriverTargetPlatform>Desktop</DriverTargetPlatform>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <PropertyGroup>
+ <OutDir>$(IntDir)</OutDir>
+ </PropertyGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ItemGroup Label="WrappedTaskItems" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetName>IHVSampleUI</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetName>IHVSampleUI</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetName>IHVSampleUI</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetName>IHVSampleUI</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <AdditionalOptions>%(AdditionalOptions) /EHa</AdditionalOptions>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);ole32.lib;oleaut32.lib;user32.lib;uuid.lib;Kernel32.lib;Advapi32.lib;comctl32.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>IHVSampleUI.def</ModuleDefinitionFile>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Midl>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </Midl>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <AdditionalOptions>%(AdditionalOptions) /EHa</AdditionalOptions>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);ole32.lib;oleaut32.lib;user32.lib;uuid.lib;Kernel32.lib;Advapi32.lib;comctl32.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>IHVSampleUI.def</ModuleDefinitionFile>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Midl>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </Midl>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalOptions>%(AdditionalOptions) /EHa</AdditionalOptions>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);ole32.lib;oleaut32.lib;user32.lib;uuid.lib;Kernel32.lib;Advapi32.lib;comctl32.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>IHVSampleUI.def</ModuleDefinitionFile>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Midl>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </Midl>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalOptions>%(AdditionalOptions) /EHa</AdditionalOptions>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);ole32.lib;oleaut32.lib;user32.lib;uuid.lib;Kernel32.lib;Advapi32.lib;comctl32.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>IHVSampleUI.def</ModuleDefinitionFile>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Midl>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+ </Midl>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="IHVClassFactory.cpp" />
+ <ClCompile Include="IHVRegistryHelper.cpp" />
+ <ClCompile Include="IHVSampleExtUI.cpp" />
+ <ClCompile Include="IHVSampleExtUICon.cpp" />
+ <ClCompile Include="IHVSampleExtUIKey.cpp" />
+ <ClCompile Include="IHVSampleExtUISec.cpp" />
+ <ClCompile Include="IHVSampleProfile.cpp" />
+ <ClCompile Include="IHVSampleUI.cpp" />
+ <ClCompile Include="utils.cpp" />
+ <Midl Include="IHVSample.idl" />
+ <Midl Include="IhvUIInc.idl" />
+ <ResourceCompile Include="IHVSampleUI.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Inf Exclude="@(Inf)" Include="*.inf" />
+ <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
+ <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
+ <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+</Project> \ No newline at end of file
diff --git a/network/wlan/ihvsampleui/IHVSampleUI.vcxproj.Filters b/network/wlan/ihvsampleui/IHVSampleUI.vcxproj.Filters
new file mode 100644
index 00000000..72360872
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVSampleUI.vcxproj.Filters
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
+ <UniqueIdentifier>{3E231056-27BE-4B0F-9726-4C0460ABF1EB}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ <UniqueIdentifier>{3CBB5BFF-1597-48F7-B4B5-F3A3CCA72B25}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Resource Files">
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
+ <UniqueIdentifier>{064BBA6C-0573-47BF-B800-6384C27EB50B}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="IHVClassFactory.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVRegistryHelper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVSampleExtUI.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVSampleExtUICon.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVSampleExtUIKey.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVSampleExtUISec.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVSampleProfile.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IHVSampleUI.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <Midl Include="IHVSample.idl">
+ <Filter>Source Files</Filter>
+ </Midl>
+ <Midl Include="IhvUIInc.idl">
+ <Filter>Source Files</Filter>
+ </Midl>
+ <None Include="IHVSampleUI.def">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="IHVSampleUI.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/network/wlan/ihvsampleui/IHVUIInc.idl b/network/wlan/ihvsampleui/IHVUIInc.idl
new file mode 100644
index 00000000..1ef82407
--- /dev/null
+++ b/network/wlan/ihvsampleui/IHVUIInc.idl
@@ -0,0 +1 @@
+#include "wlanihvui.idl" \ No newline at end of file
diff --git a/network/wlan/ihvsampleui/iunk.h b/network/wlan/ihvsampleui/iunk.h
new file mode 100644
index 00000000..9b8242c5
--- /dev/null
+++ b/network/wlan/ihvsampleui/iunk.h
@@ -0,0 +1,54 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+// Common macro based implementation of IUnknown
+// using a interface table approach
+
+#define IMPLEMENT_REFCOUNT()\
+ ULONG m_crefCount;\
+ \
+ STDMETHODIMP_(ULONG) AddRef(void)\
+ {\
+ return InterlockedIncrement((PLONG)&m_crefCount);\
+ }\
+ \
+ _At_(this, __drv_aliasesMem)\
+ STDMETHODIMP_(ULONG) Release(void)\
+ {\
+ ULONG res = InterlockedDecrement((PLONG)&m_crefCount);\
+ if (res == 0)\
+ {\
+ delete this;\
+ }\
+ return res;\
+ }
+
+#define BEGIN_INTERFACE_TABLE()\
+ IMPLEMENT_REFCOUNT()\
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject)\
+ {\
+ if (riid == IID_IUnknown)\
+ {\
+ *ppvObject = reinterpret_cast<IUnknown*>(this);\
+ }
+
+#define IMPLEMENTS_INTERFACE(Itf)\
+ else if (riid == IID_ ## Itf)\
+ {\
+ *ppvObject = static_cast<Itf*>(this);\
+ }
+
+#define END_INTERFACE_TABLE()\
+ else \
+ {\
+ *ppvObject = NULL;\
+ return E_NOINTERFACE;\
+ }\
+ \
+ reinterpret_cast<IUnknown *>(*ppvObject)->AddRef();\
+ \
+ return S_OK;\
+ }
+
diff --git a/network/wlan/ihvsampleui/precomp.h b/network/wlan/ihvsampleui/precomp.h
new file mode 100644
index 00000000..b7bff11f
--- /dev/null
+++ b/network/wlan/ihvsampleui/precomp.h
@@ -0,0 +1,44 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#pragma once
+
+#include <driverspecs.h>
+_Analysis_mode_(_Analysis_code_type_user_code_)
+
+#include <shlobj.h>
+#include <windows.h>
+#include <objbase.h>
+#include <unknwn.h>
+#include <strsafe.h>
+#include <assert.h>
+#include <wlanihv.h>
+#include <msxml6.h>
+
+// MIDL generated
+#include "ihvsample.h"
+
+#include "iunk.h"
+#include "resource.h"
+#include "utils.h"
+#include "IHVRegistryHelper.h"
+#include "IHVSampleExtUI.h"
+#include "IHVSampleProfile.h"
+#include "IHVSampleExtUICon.h"
+#include "IHVSampleExtUISec.h"
+#include "IHVSampleExtUIKey.h"
+#include "IHVClassFactory.h"
+#include <new>
+
+const GUID GUID_SAMPLE_IHVUI_CLSID =
+{ 0x4a01f9f9, 0x6012, 0x4343, { 0xa8, 0xc4, 0x10, 0xb5, 0xdf, 0x32, 0x67, 0x2a } };
+
+
+#define IHV_SAMPLE_IHV_NAME L"IHV"
+
+#define BAIL_ON_FAILURE( _hr ) if (FAILED(_hr)) goto error;
+#define BAIL( ) goto error;
+#define SYS_FREE_STRING( _s ) if ( _s ) { SysFreeString( _s ); (_s) = NULL;}
+
diff --git a/network/wlan/ihvsampleui/resource.h b/network/wlan/ihvsampleui/resource.h
new file mode 100644
index 00000000..e60f854e
--- /dev/null
+++ b/network/wlan/ihvsampleui/resource.h
@@ -0,0 +1,31 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by TestIHV.rc
+//
+#define IDD_PROPPAGE_SMALL 502
+
+#define IDC_PARAM_BOX 1000
+#define IDC_PARAM_TXT 1001
+#define IDC_USE_FASTHANDOFF 1002
+#define ID_OK 1003
+#define ID_CANCEL 1004
+#define IDC_TITLE_TXT 1005
+
+#define IDS_PROJNAME 100
+#define IDR_SAMPLEIHVEXT 101
+#define IDS_TITLE_GETKEY 101
+#define IDR_IHVBALLOONHANDLER 102
+#define IDS_TITLE_SHOWHELP 102
+#define IDS_TITLE_LASTPAGE 103
+#define IDC_EDIT_KEY 201
+#define IDC_EDIT_HELPER 203
+#define IDD_DIALOG_GETKEY 204
+#define IDC_DATETIMEPICKER1 204
+#define IDD_DIALOG_SHOWHELP 205
+#define IDD_DIALOG_LASTPAGE 206
+
+
+#define IDS_IHV_DEFAULT_TITLE 300
+#define IDS_IHV_DEFAULT_CON_TITLE 301
+#define IDS_IHV_DEFAULT_KEY_TITLE 302
+#define IDS_IHV_DEFAULT_SEC_TITLE 303
diff --git a/network/wlan/ihvsampleui/utils.cpp b/network/wlan/ihvsampleui/utils.cpp
new file mode 100644
index 00000000..1f9bbe10
--- /dev/null
+++ b/network/wlan/ihvsampleui/utils.cpp
@@ -0,0 +1,408 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+#include "precomp.h"
+
+HRESULT
+Wstr2Bstr
+(
+ _In_ LPCWSTR pszSrc,
+ _Outptr_ BSTR* pbstrDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !pbstrDest )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ (*pbstrDest) = NULL;
+ if ( !pszSrc )
+ {
+ BAIL( );
+ }
+
+ (*pbstrDest) = SysAllocString( pszSrc );
+ if ( !(*pbstrDest) )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ return hr;
+}
+
+
+
+
+HRESULT
+Wstr2Wstr
+(
+ _In_ LPCWSTR pszSrc,
+ _Outptr_ LPWSTR* ppszDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !ppszDest )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ (*ppszDest) = NULL;
+ if ( !pszSrc )
+ {
+ BAIL( );
+ }
+
+ *ppszDest = _wcsdup( pszSrc );
+
+ if ( !(*ppszDest) )
+ {
+ hr = E_OUTOFMEMORY;
+ }
+
+error:
+ return hr;
+}
+
+
+
+
+HRESULT
+Wstr2Dword
+(
+ IN LPCWSTR pszSrc,
+ OUT DWORD* pdwDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( (!pdwDest) || (!pszSrc) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ (*pdwDest) = (DWORD) _wtol( pszSrc );
+
+error:
+ return hr;
+}
+
+/*
+Note:
+2^32 = 2^(4*8) = 16^8 < 100^8 = 10^16
+This implies that 20 decimal digits
+are more than enough for a DWORD.
+*/
+
+HRESULT
+Dword2Bstr
+(
+ IN DWORD dwSrc,
+ OUT BSTR* pbstrDest
+)
+{
+ HRESULT hr = S_OK;
+ WCHAR szBuffer[25] = {0};
+
+ hr =
+ StringCchPrintf
+ (
+ szBuffer,
+ sizeof(szBuffer)/sizeof(szBuffer[0]),
+ L"%u",
+ dwSrc
+ );
+ BAIL_ON_FAILURE( hr );
+
+ hr =
+ Wstr2Bstr
+ (
+ szBuffer,
+ pbstrDest
+ );
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+
+HRESULT
+Wstr2Bool
+(
+ IN LPCWSTR pszSrc,
+ OUT BOOL* pbDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( (!pbDest) || (!pszSrc) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( 0 == wcscmp( L"TRUE", pszSrc ) )
+ {
+ (*pbDest) = TRUE;
+ }
+ else if ( 0 == wcscmp( L"FALSE", pszSrc ) )
+ {
+ (*pbDest) = FALSE;
+ }
+ else
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ return hr;
+}
+
+
+HRESULT
+Bool2Bstr
+(
+ IN BOOL bSrc,
+ OUT BSTR* pbstrDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !pbstrDest )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( bSrc )
+ {
+ (*pbstrDest) = SysAllocString( L"TRUE" );
+ }
+ else
+ {
+ (*pbstrDest) = SysAllocString( L"FALSE" );
+ }
+ if ( !(*pbstrDest) )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ return hr;
+}
+
+
+
+
+HRESULT
+Wstr2AuthType
+(
+ IN LPCWSTR pszSrc,
+ OUT PIHV_AUTH_TYPE pAuthType
+)
+{
+ HRESULT hr = S_OK;
+ DWORD dwIndex = 0;
+
+ if ( (!pAuthType) || (!pszSrc) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ for ( dwIndex = 0; dwIndex < MAX_AUTH_TYPES; dwIndex++ )
+ {
+ if ( 0 == wcscmp( gppszIhvAuthTypes[dwIndex], pszSrc ) )
+ {
+ (*pAuthType) = (IHV_AUTH_TYPE) dwIndex;
+ BAIL( );
+ }
+ }
+
+ // String not found.
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+HRESULT
+AuthType2Bstr
+(
+ IN IHV_AUTH_TYPE AuthType,
+ OUT BSTR* pbstrDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !pbstrDest )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( AuthType < 0 || AuthType >= IHVAuthInvalid )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ (*pbstrDest) = SysAllocString( gppszIhvAuthTypes[(DWORD) AuthType] );
+ if ( !(*pbstrDest) )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ return hr;
+}
+
+
+HRESULT
+Wstr2SecurityType
+(
+ IN LPCWSTR pszSrc,
+ OUT PIHV_SECURITY_TYPE pSecurityType
+)
+{
+ HRESULT hr = S_OK;
+ DWORD dwIndex = 0;
+
+ if ( (!pSecurityType) || (!pszSrc) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ for ( dwIndex = 0; dwIndex < MAX_AUTH_TYPES; dwIndex++ )
+ {
+ if ( 0 == wcscmp( gppszIhvSecurityTypes[dwIndex], pszSrc ) )
+ {
+ (*pSecurityType) = (IHV_SECURITY_TYPE) dwIndex;
+ BAIL( );
+ }
+ }
+
+ // String not found.
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+HRESULT
+SecurityType2Bstr
+(
+ IN IHV_SECURITY_TYPE SecurityType,
+ OUT BSTR* pbstrDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !pbstrDest )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( SecurityType < 0 || SecurityType >= IHVSecurityInvalid )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ (*pbstrDest) = SysAllocString( gppszIhvSecurityTypes[(DWORD) SecurityType] );
+ if ( !(*pbstrDest) )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ return hr;
+}
+
+HRESULT
+Wstr2CipherType
+(
+ IN LPCWSTR pszSrc,
+ OUT PIHV_CIPHER_TYPE pCipherType
+)
+{
+ HRESULT hr = S_OK;
+ DWORD dwIndex = 0;
+
+ if ( (!pCipherType) || (!pszSrc) )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ for ( dwIndex = 0; dwIndex < MAX_CIPHER_TYPES; dwIndex++ )
+ {
+ if ( 0 == wcscmp( gppszIhvCipherTypes[dwIndex], pszSrc ) )
+ {
+ (*pCipherType) = (IHV_CIPHER_TYPE) dwIndex;
+ BAIL( );
+ }
+ }
+
+ // String not found.
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+
+
+error:
+ return hr;
+}
+
+
+HRESULT
+CipherType2Bstr
+(
+ IN IHV_CIPHER_TYPE CipherType,
+ OUT BSTR* pbstrDest
+)
+{
+ HRESULT hr = S_OK;
+
+ if ( !pbstrDest )
+ {
+ hr = E_INVALIDARG;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ if ( CipherType < None || CipherType >= IHVCipherInvalid )
+ {
+ hr = E_UNEXPECTED;
+ BAIL_ON_FAILURE( hr );
+ }
+
+ (*pbstrDest) = SysAllocString( gppszIhvCipherTypes[(DWORD) CipherType] );
+ if ( !(*pbstrDest) )
+ {
+ hr = E_OUTOFMEMORY;
+ BAIL_ON_FAILURE( hr );
+ }
+
+error:
+ return hr;
+}
diff --git a/network/wlan/ihvsampleui/utils.h b/network/wlan/ihvsampleui/utils.h
new file mode 100644
index 00000000..015e94dd
--- /dev/null
+++ b/network/wlan/ihvsampleui/utils.h
@@ -0,0 +1,98 @@
+//
+// Copyright (C) Microsoft Corporation 2005
+// IHV UI Extension sample
+//
+
+
+typedef enum _IHV_SECURITY_TYPE IHV_SECURITY_TYPE, *PIHV_SECURITY_TYPE;
+typedef enum _IHV_AUTH_TYPE IHV_AUTH_TYPE, *PIHV_AUTH_TYPE;
+typedef enum _IHV_CIPHER_TYPE IHV_CIPHER_TYPE, *PIHV_CIPHER_TYPE;
+
+
+HRESULT
+Wstr2Bstr
+(
+ _In_ LPCWSTR pszSrc,
+ _Outptr_ BSTR* pbstrDest
+);
+
+HRESULT
+Wstr2Wstr
+(
+ _In_ LPCWSTR pszSrc,
+ _Outptr_ LPWSTR* ppszDest
+);
+
+
+HRESULT
+Wstr2Dword
+(
+ IN LPCWSTR pszSrc,
+ OUT DWORD* pdwDest
+);
+
+
+HRESULT
+Dword2Bstr
+(
+ IN DWORD dwSrc,
+ OUT BSTR* pbstrDest
+);
+
+
+HRESULT
+Wstr2Bool
+(
+ IN LPCWSTR pszSrc,
+ OUT BOOL* pbDest
+);
+
+HRESULT
+Bool2Bstr
+(
+ IN BOOL bSrc,
+ OUT BSTR* pbstrDest
+);
+
+
+HRESULT
+Wstr2AuthType
+(
+ IN LPCWSTR pszSrc,
+ OUT PIHV_AUTH_TYPE pAuthType
+);
+
+HRESULT
+AuthType2Bstr
+(
+ IN IHV_AUTH_TYPE AuthType,
+ OUT BSTR* pbstrDest
+);
+
+HRESULT
+Wstr2SecurityType
+(
+ IN LPCWSTR pszSrc,
+ OUT PIHV_SECURITY_TYPE pSecurityType
+);
+
+HRESULT
+SecurityType2Bstr
+(
+ IN IHV_SECURITY_TYPE SecurityType,
+ OUT BSTR* pbstrDest
+);
+
+HRESULT
+Wstr2CipherType
+(
+ IN LPCWSTR pszSrc,
+ OUT PIHV_CIPHER_TYPE pCipherType
+);
+
+HRESULT
+CipherType2Bstr
+(
+ IN IHV_CIPHER_TYPE CipherType,
+ OUT BSTR* pbstrDest
+);