mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-06-14 19:36:38 +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"???");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user