MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / DllUnregisterServer

Method DllUnregisterServer

PathCopyCopy/src/dllmain.cpp:138–167  ·  view source on GitHub ↗

CPathCopyCopyModule::DllUnregisterServer Unregisters this module's classes and type libraries. @param p_UnregisterTypeLib Whether to unregister type libraries. @return Result code.

Source from the content-addressed store, hash-verified

136// @return Result code.
137//
138[[gsl::suppress(c.128)]]
139HRESULT CPathCopyCopyModule::DllUnregisterServer(BOOL p_UnregisterTypeLib /*= TRUE*/) throw()
140{
141 try {
142 // Setup per-user unregistration if needed.
143 bool perUserRegistration = false;
144 HRESULT hRes = ATL::AtlGetPerUserRegistration(&perUserRegistration);
145 if (SUCCEEDED(hRes)) {
146 hRes = ATL::CAtlDllModuleT<CPathCopyCopyModule>::DllUnregisterServer(p_UnregisterTypeLib);
147 if (SUCCEEDED(hRes)) {
148 // Unregister our approved shell extensions. We do this here so that
149 // it can work in per-user installations.
150 // Note that if it doesn't exist, we consider it a success.
151 AtlRegKey approvedKey;
152 const LONG regRes = approvedKey.Open(perUserRegistration ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
153 L"Software\\Microsoft\\Windows\\CurrentVersion\\Extensions\\Approved",
154 false, KEY_QUERY_VALUE | KEY_SET_VALUE);
155 if (regRes != ERROR_SUCCESS && regRes != ERROR_FILE_NOT_FOUND) {
156 hRes = HRESULT_FROM_WIN32(regRes);
157 } else if (regRes == ERROR_SUCCESS) {
158 approvedKey.DeleteValue(L"{82CB99A2-2F18-4D5D-9476-54347E3B6720}");
159 approvedKey.DeleteValue(L"{16170CA5-25CA-4e6d-928C-7A3A974F4B56}");
160 }
161 }
162 }
163 return hRes;
164 } catch (...) {
165 return E_UNEXPECTED;
166 }
167}
168
169//
170// CPathCopyCopyModule::HInstance

Callers 1

DllUnregisterServerFunction · 0.45

Calls 3

OpenMethod · 0.80
DllUnregisterServerFunction · 0.70
DeleteValueMethod · 0.45

Tested by

no test coverage detected