Проблемы с реализацией расширения оболочки Property Sheet Handler ⇐ C++
-
Anonymous
Проблемы с реализацией расширения оболочки Property Sheet Handler
I’m currently working on a project that involves creating property handlers for .txt files. My goal is to add a new page to the properties of a .txt file using a property handler. However, I’m facing some issues and the handler isn’t functioning as expected.
I have added logging but explorer.exe keeps crashing AddRef: Reference count incremented to 1 AddPages called. Adding property page. Creating property sheet page... The property page handle was obtained successfully. Adding property sheet page...
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { if (!IsEqualCLSID(rclsid, CLSID_MyPropertySheetHandler)) { // The CLSID does not match the CLSID of our shell extension return CLASS_E_CLASSNOTAVAILABLE; } CMyPropertySheetHandler* pClassFactory = new CMyPropertySheetHandler(); if (pClassFactory == nullptr) { return E_OUTOFMEMORY; } ULONG refCount = pClassFactory->AddRef(); if (refCount == 1) { // We're transferring ownership to the caller, so no need to call Release *ppv = static_cast(pClassFactory); return S_OK; } else { // Decrement the reference count since we're not transferring ownership pClassFactory->Release(); return E_FAIL; } } STDMETHODIMP CMyPropertySheetHandler::QueryInterface(REFIID riid, void** ppv) { *ppv = nullptr; if (ppv == nullptr) return E_POINTER; if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, __uuidof(IShellExtInit)) || IsEqualIID(riid, __uuidof(IShellPropSheetExt)) || IsEqualIID(riid, __uuidof(IClassFactory))) { *ppv = static_cast(this); AddRef(); return S_OK; } return E_NOINTERFACE; }
Источник: https://stackoverflow.com/questions/780 ... -extension
I’m currently working on a project that involves creating property handlers for .txt files. My goal is to add a new page to the properties of a .txt file using a property handler. However, I’m facing some issues and the handler isn’t functioning as expected.
I have added logging but explorer.exe keeps crashing AddRef: Reference count incremented to 1 AddPages called. Adding property page. Creating property sheet page... The property page handle was obtained successfully. Adding property sheet page...
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { if (!IsEqualCLSID(rclsid, CLSID_MyPropertySheetHandler)) { // The CLSID does not match the CLSID of our shell extension return CLASS_E_CLASSNOTAVAILABLE; } CMyPropertySheetHandler* pClassFactory = new CMyPropertySheetHandler(); if (pClassFactory == nullptr) { return E_OUTOFMEMORY; } ULONG refCount = pClassFactory->AddRef(); if (refCount == 1) { // We're transferring ownership to the caller, so no need to call Release *ppv = static_cast(pClassFactory); return S_OK; } else { // Decrement the reference count since we're not transferring ownership pClassFactory->Release(); return E_FAIL; } } STDMETHODIMP CMyPropertySheetHandler::QueryInterface(REFIID riid, void** ppv) { *ppv = nullptr; if (ppv == nullptr) return E_POINTER; if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, __uuidof(IShellExtInit)) || IsEqualIID(riid, __uuidof(IShellPropSheetExt)) || IsEqualIID(riid, __uuidof(IClassFactory))) { *ppv = static_cast(this); AddRef(); return S_OK; } return E_NOINTERFACE; }
Источник: https://stackoverflow.com/questions/780 ... -extension
Мобильная версия