Требуется помощь с проблемой обработчика недвижимости [закрыто]C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 Требуется помощь с проблемой обработчика недвижимости [закрыто]

Сообщение Anonymous »


I am currently working on a project involving property handlers, specifically targeting .txt files. As a newcomer to this field, I have encountered an issue that I'm struggling to resolve and would greatly appreciate your guidance.

My objective is to add a new page to the properties of a .txt file using a property handler. However, despite my efforts, the handler is not functioning as expected. I have implemented extensive logging in my source code to pinpoint the failure, but unfortunately, I have been unable to identify the root cause.

To provide more context, I have shared the relevant portion of my source code Here

Error happens at QueryInterface log file

DllGetClassObject called. QueryInterface called. Requested IID: {00000001-0000-0000-C000-000000000046} No matching interface was found. Release called.

this is the error I get when trying to debug with Visual Studio when I attach to the explorer.exe

Unhandled exception at 0x00007FFAC237DE84 (Microsoft.UI.Windowing.Core.dll) in explorer.exe: 0xC0000005: Access violation reading location 0x0000000000000030.
STDMETHODIMP_(ULONG) CMyPropertySheetHandler::AddRef() { LogMessage(L"AddRef called\n"); return InterlockedIncrement(&m_refCount); } STDMETHODIMP_(ULONG) CMyPropertySheetHandler::Release() { LogMessage(L"Release called."); ULONG refCount = InterlockedDecrement(&m_refCount); if (refCount == 0) { LogMessage(L"Deleting this."); delete this; } else if (refCount < 0) { LogMessage(L"Error: Negative reference count."); return 0; } return refCount; } STDMETHODIMP CMyPropertySheetHandler::QueryInterface(REFIID riid, void** ppv) { LogMessage(L"QueryInterface called with IID: " + GuidToString(riid)); 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); // Cast to IClassFactory when riid is IID_IClassFactory AddRef(); return S_OK; } LogMessage(L"No matching interface found for IID: " + GuidToString(riid)); *ppv = nullptr; return E_NOINTERFACE; } HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { LogMessage(L"DllGetClassObject called."); 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; } HRESULT hr = pClassFactory->QueryInterface(riid, ppv); // pClassFactory->Release(); return hr; }

Источник: https://stackoverflow.com/questions/780 ... dler-issue
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C++»