Skip to content

Commit 935600a

Browse files
committed
Add LogPropertyStore helper
1 parent d3bf4b6 commit 935600a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Src/StartMenu/StartMenuDLL/LogManager.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "stdafx.h"
88
#include "LogManager.h"
99
#include "ResourceHelper.h"
10+
#include "ComHelper.h"
11+
#include <propvarutil.h>
1012

1113
int g_LogCategories;
1214
static FILE *g_LogFile;
@@ -51,3 +53,31 @@ void LogMessage( const wchar_t *text, ... )
5153

5254
fflush(g_LogFile);
5355
}
56+
57+
void LogPropertyStore(TLogCategory category, IPropertyStore* store)
58+
{
59+
if (!store)
60+
return;
61+
62+
DWORD count = 0;
63+
store->GetCount(&count);
64+
for (DWORD i = 0; i < count; i++)
65+
{
66+
PROPERTYKEY key{};
67+
store->GetAt(i, &key);
68+
69+
PROPVARIANT val;
70+
PropVariantInit(&val);
71+
72+
store->GetValue(key, &val);
73+
74+
CComString valueStr;
75+
PropVariantToStringAlloc(val, &valueStr);
76+
PropVariantClear(&val);
77+
78+
wchar_t guidStr[100]{};
79+
StringFromGUID2(key.fmtid, guidStr, _countof(guidStr));
80+
81+
LOG_MENU(category, L"Property: {%s, %u} = %s", guidStr, key.pid, valueStr ? valueStr : L"???");
82+
}
83+
}

Src/StartMenu/StartMenuDLL/LogManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#pragma once
66

7+
#include <propsys.h>
8+
79
// LogManager.h - logging functionality (for debugging)
810
// Logs different events in the start menu
911
// Turn it on by setting the LogLevel setting in the registry
@@ -33,3 +35,5 @@ void CloseLog( void );
3335
void LogMessage( const wchar_t *text, ... );
3436

3537
#define STARTUP_LOG L"Software\\OpenShell\\StartMenu\\Settings|LogStartup|%LOCALAPPDATA%\\OpenShell\\StartupLog.txt"
38+
39+
void LogPropertyStore(TLogCategory category, IPropertyStore* store);

0 commit comments

Comments
 (0)