Wallpaper (Windows): add new module

This commit is contained in:
李通洲
2023-06-06 15:48:24 +08:00
parent 7934c16bca
commit 77b93a904f
10 changed files with 82 additions and 1 deletions
+10
View File
@@ -0,0 +1,10 @@
#pragma once
#ifndef FF_INCLUDED_detection_wallpaper
#define FF_INCLUDED_detection_wallpaper
#include "fastfetch.h"
const char* ffDetectWallpaper(const FFinstance* instance, FFstrbuf* result);
#endif
@@ -0,0 +1,6 @@
#include "wallpaper.h"
const char* ffDetectWallpaper(FF_MAYBE_UNUSED const FFinstance* instance, FF_MAYBE_UNUSED FFstrbuf* result)
{
return "Not supported on this platform";
}
@@ -0,0 +1,14 @@
#include "wallpaper.h"
#include "util/windows/registry.h"
const char* ffDetectWallpaper(FF_MAYBE_UNUSED const FFinstance* instance, FFstrbuf* result)
{
FF_HKEY_AUTO_DESTROY hKey = NULL;
if(!ffRegOpenKeyForRead(HKEY_CURRENT_USER, L"Control Panel\\Desktop", &hKey, NULL))
return "ffRegOpenKeyForRead(Control Panel\\Desktop) failed";
if(!ffRegReadStrbuf(hKey, L"WallPaper", result, NULL))
return "ffRegReadStrbuf(WallPaper) failed";
return NULL;
}