diff options
Diffstat (limited to 'src/ext/NetFx/be/NetfxBundleExtension.cpp')
| -rw-r--r-- | src/ext/NetFx/be/NetfxBundleExtension.cpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/ext/NetFx/be/NetfxBundleExtension.cpp b/src/ext/NetFx/be/NetfxBundleExtension.cpp deleted file mode 100644 index 838a97c1..00000000 --- a/src/ext/NetFx/be/NetfxBundleExtension.cpp +++ /dev/null | |||
| @@ -1,102 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | #include "BextBaseBundleExtension.h" | ||
| 5 | |||
| 6 | class CWixNetfxBundleExtension : public CBextBaseBundleExtension | ||
| 7 | { | ||
| 8 | public: // IBundleExtension | ||
| 9 | virtual STDMETHODIMP Search( | ||
| 10 | __in LPCWSTR wzId, | ||
| 11 | __in LPCWSTR wzVariable | ||
| 12 | ) | ||
| 13 | { | ||
| 14 | HRESULT hr = S_OK; | ||
| 15 | |||
| 16 | hr = NetfxSearchExecute(&m_searches, wzId, wzVariable, m_pEngine, m_sczBaseDirectory); | ||
| 17 | |||
| 18 | return hr; | ||
| 19 | } | ||
| 20 | |||
| 21 | public: //CBextBaseBundleExtension | ||
| 22 | virtual STDMETHODIMP Initialize( | ||
| 23 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pCreateArgs | ||
| 24 | ) | ||
| 25 | { | ||
| 26 | HRESULT hr = S_OK; | ||
| 27 | LPWSTR sczModulePath = NULL; | ||
| 28 | IXMLDOMDocument* pixdManifest = NULL; | ||
| 29 | IXMLDOMNode* pixnBundleExtension = NULL; | ||
| 30 | |||
| 31 | hr = __super::Initialize(pCreateArgs); | ||
| 32 | BextExitOnFailure(hr, "CBextBaseBundleExtension initialization failed."); | ||
| 33 | |||
| 34 | hr = PathForCurrentProcess(&sczModulePath, m_hInstance); | ||
| 35 | BextExitOnFailure(hr, "Failed to get bundle extension path."); | ||
| 36 | |||
| 37 | hr = PathGetDirectory(sczModulePath, &m_sczBaseDirectory); | ||
| 38 | BextExitOnFailure(hr, "Failed to get bundle extension base directory."); | ||
| 39 | |||
| 40 | hr = XmlLoadDocumentFromFile(m_sczBundleExtensionDataPath, &pixdManifest); | ||
| 41 | BextExitOnFailure(hr, "Failed to load bundle extension manifest from path: %ls", m_sczBundleExtensionDataPath); | ||
| 42 | |||
| 43 | hr = BextGetBundleExtensionDataNode(pixdManifest, NETFX_BUNDLE_EXTENSION_ID, &pixnBundleExtension); | ||
| 44 | BextExitOnFailure(hr, "Failed to get BundleExtension '%ls'", NETFX_BUNDLE_EXTENSION_ID); | ||
| 45 | |||
| 46 | hr = NetfxSearchParseFromXml(&m_searches, pixnBundleExtension); | ||
| 47 | BextExitOnFailure(hr, "Failed to parse searches from bundle extension manifest."); | ||
| 48 | |||
| 49 | LExit: | ||
| 50 | ReleaseObject(pixnBundleExtension); | ||
| 51 | ReleaseObject(pixdManifest); | ||
| 52 | ReleaseStr(sczModulePath); | ||
| 53 | |||
| 54 | return hr; | ||
| 55 | } | ||
| 56 | |||
| 57 | public: | ||
| 58 | CWixNetfxBundleExtension( | ||
| 59 | __in HINSTANCE hInstance, | ||
| 60 | __in IBundleExtensionEngine* pEngine | ||
| 61 | ) : CBextBaseBundleExtension(pEngine) | ||
| 62 | { | ||
| 63 | m_searches = { }; | ||
| 64 | m_hInstance = hInstance; | ||
| 65 | m_sczBaseDirectory = NULL; | ||
| 66 | } | ||
| 67 | |||
| 68 | ~CWixNetfxBundleExtension() | ||
| 69 | { | ||
| 70 | NetfxSearchUninitialize(&m_searches); | ||
| 71 | ReleaseStr(m_sczBaseDirectory); | ||
| 72 | } | ||
| 73 | |||
| 74 | private: | ||
| 75 | NETFX_SEARCHES m_searches; | ||
| 76 | HINSTANCE m_hInstance; | ||
| 77 | LPWSTR m_sczBaseDirectory; | ||
| 78 | }; | ||
| 79 | |||
| 80 | HRESULT NetfxBundleExtensionCreate( | ||
| 81 | __in HINSTANCE hInstance, | ||
| 82 | __in IBundleExtensionEngine* pEngine, | ||
| 83 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
| 84 | __out IBundleExtension** ppBundleExtension | ||
| 85 | ) | ||
| 86 | { | ||
| 87 | HRESULT hr = S_OK; | ||
| 88 | CWixNetfxBundleExtension* pExtension = NULL; | ||
| 89 | |||
| 90 | pExtension = new CWixNetfxBundleExtension(hInstance, pEngine); | ||
| 91 | BextExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CWixNetfxBundleExtension."); | ||
| 92 | |||
| 93 | hr = pExtension->Initialize(pArgs); | ||
| 94 | BextExitOnFailure(hr, "CWixNetfxBundleExtension initialization failed."); | ||
| 95 | |||
| 96 | *ppBundleExtension = pExtension; | ||
| 97 | pExtension = NULL; | ||
| 98 | |||
| 99 | LExit: | ||
| 100 | ReleaseObject(pExtension); | ||
| 101 | return hr; | ||
| 102 | } | ||
