diff --git a/Src/StartMenu/StartMenuDLL/LogManager.cpp b/Src/StartMenu/StartMenuDLL/LogManager.cpp index 84d9e14..1d06512 100644 --- a/Src/StartMenu/StartMenuDLL/LogManager.cpp +++ b/Src/StartMenu/StartMenuDLL/LogManager.cpp @@ -7,6 +7,8 @@ #include "stdafx.h" #include "LogManager.h" #include "ResourceHelper.h" +#include "ComHelper.h" +#include int g_LogCategories; static FILE *g_LogFile; @@ -51,3 +53,31 @@ void LogMessage( const wchar_t *text, ... ) fflush(g_LogFile); } + +void LogPropertyStore(TLogCategory category, IPropertyStore* store) +{ + if (!store) + return; + + DWORD count = 0; + store->GetCount(&count); + for (DWORD i = 0; i < count; i++) + { + PROPERTYKEY key{}; + store->GetAt(i, &key); + + PROPVARIANT val; + PropVariantInit(&val); + + store->GetValue(key, &val); + + CComString valueStr; + PropVariantToStringAlloc(val, &valueStr); + PropVariantClear(&val); + + wchar_t guidStr[100]{}; + StringFromGUID2(key.fmtid, guidStr, _countof(guidStr)); + + LOG_MENU(category, L"Property: {%s, %u} = %s", guidStr, key.pid, valueStr ? valueStr : L"???"); + } +} diff --git a/Src/StartMenu/StartMenuDLL/LogManager.h b/Src/StartMenu/StartMenuDLL/LogManager.h index a6e4885..6509889 100644 --- a/Src/StartMenu/StartMenuDLL/LogManager.h +++ b/Src/StartMenu/StartMenuDLL/LogManager.h @@ -4,6 +4,8 @@ #pragma once +#include + // LogManager.h - logging functionality (for debugging) // Logs different events in the start menu // Turn it on by setting the LogLevel setting in the registry @@ -33,3 +35,5 @@ void CloseLog( void ); void LogMessage( const wchar_t *text, ... ); #define STARTUP_LOG L"Software\\OpenShell\\StartMenu\\Settings|LogStartup|%LOCALAPPDATA%\\OpenShell\\StartupLog.txt" + +void LogPropertyStore(TLogCategory category, IPropertyStore* store);