mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-04-11 17:37:22 +10:00
Add LogPropertyStore helper
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "LogManager.h"
|
||||
#include "ResourceHelper.h"
|
||||
#include "ComHelper.h"
|
||||
#include <propvarutil.h>
|
||||
|
||||
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"???");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <propsys.h>
|
||||
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user