MCPcopy Create free account
hub / github.com/LegacyUpdate/LegacyUpdate / IsPermitted

Method IsPermitted

LegacyUpdate/LegacyUpdateCtrl.cpp:154–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154STDMETHODIMP CLegacyUpdateCtrl::IsPermitted(void) {
155 CComPtr<IHTMLDocument2> document;
156 CComPtr<IHTMLLocation> location;
157 BSTR host = NULL;
158 HRESULT hr = GetHTMLDocument(&document);
159 if (!SUCCEEDED(hr)) {
160#ifdef _DEBUG
161 // Allow debugging outside of IE (e.g. via PowerShell)
162 TRACE(L"GetHTMLDocument() failed - allowing anyway due to debug build");
163 return S_OK;
164#else
165 goto end;
166#endif
167 }
168
169 hr = document->get_location(&location);
170 CHECK_HR_OR_GOTO_END(L"get_location");
171 if (location == NULL) {
172 hr = E_ACCESSDENIED;
173 goto end;
174 }
175
176 hr = location->get_host(&host);
177 CHECK_HR_OR_GOTO_END(L"get_host");
178
179 for (DWORD i = 0; i < ARRAYSIZE(permittedHosts); i++) {
180 if (wcscmp(host, permittedHosts[i]) == 0) {
181 SysFreeString(host);
182 return S_OK;
183 }
184 }
185
186end:
187 if (host) {
188 SysFreeString(host);
189 }
190 return hr;
191}
192
193STDMETHODIMP CLegacyUpdateCtrl::GetDocumentWindowHWND(HWND *retval) {
194 if (retval == NULL) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected