MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / UnregisterShellExtThumbnailHandler

Function UnregisterShellExtThumbnailHandler

GTE_Win/Reg.cpp:269–303  ·  view source on GitHub ↗

FUNCTION: UnregisterShellExtThumbnailHandler PURPOSE: Unregister the thumbnail handler. PARAMETERS: pszFileType - The file type that the thumbnail handler is associated with. For example, '*' means all file types; '.txt' means all .txt files. The parameter must not be NULL. NOTE: The function removes the registry key HKCR\ \shellex\{e357fccd-a995-4576-b01f-234630154e96}.

Source from the content-addressed store, hash-verified

267// HKCR\<File Type>\shellex\{e357fccd-a995-4576-b01f-234630154e96}.
268//
269HRESULT UnregisterShellExtThumbnailHandler(PCWSTR pszFileType)
270{
271 if (pszFileType == nullptr) {
272 return E_INVALIDARG;
273 }
274
275 HRESULT hr;
276
277 wchar_t szSubkey[MAX_PATH];
278
279 // If pszFileType starts with '.', try to read the default value of the
280 // HKCR\<File Type> key which contains the ProgID to which the file type
281 // is linked.
282 if (*pszFileType == L'.') {
283 wchar_t szDefaultVal[260];
284 hr = GetHKCRRegistryKeyAndValue(pszFileType, nullptr, szDefaultVal, sizeof(szDefaultVal));
285
286 // If the key exists and its default value is not empty, use the
287 // ProgID as the file type.
288 if (SUCCEEDED(hr) && szDefaultVal[0] != L'\0') {
289 pszFileType = szDefaultVal;
290 }
291 }
292
293 // Remove the registry key:
294 // HKCR\<File Type>\shellex\{e357fccd-a995-4576-b01f-234630154e96}
295 hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
296 L"%s\\shellex\\{e357fccd-a995-4576-b01f-234630154e96}", pszFileType);
297 if (SUCCEEDED(hr)) {
298 hr = HRESULT_FROM_WIN32(static_cast<unsigned>(RegDeleteTree(HKEY_CLASSES_ROOT, szSubkey)));
299 ;
300 }
301
302 return hr;
303}

Callers 1

DllUnregisterServerFunction · 0.85

Calls 1

Tested by

no test coverage detected