Skip to content

Commit 3c86537

Browse files
Add files via upload
1 parent 63a53dd commit 3c86537

8 files changed

Lines changed: 207 additions & 0 deletions

File tree

Config/FilterPlugin.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[FilterPlugin]
2+
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
3+
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
4+
;
5+
; Examples:
6+
; /README.txt
7+
; /Extras/...
8+
; /Binaries/ThirdParty/*.dll

Resources/Icon128.png

11.8 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
#include "WindowsRegistryReadLibrary.h"
3+
#include "Windows/AllowWindowsPlatformTypes.h"
4+
#include <windows.h>
5+
6+
FString UWindowsRegistryReadLibrary::ReadRegistryValue(const FString& RegistryPath, const FString& ValueName, bool bIs64BitKey, bool& bSuccess)
7+
{
8+
#if PLATFORM_WINDOWS
9+
HKEY hKey;
10+
DWORD dwType = REG_SZ;
11+
TCHAR Data[1024]; //Should be plenty for most situations
12+
DWORD dwSize = sizeof(Data);
13+
bSuccess = false; //Success is not default
14+
15+
// Define registry access mode
16+
REGSAM samDesired = KEY_READ;
17+
if (bIs64BitKey)
18+
{
19+
samDesired |= KEY_WOW64_64KEY;
20+
}
21+
else
22+
{
23+
samDesired |= KEY_WOW64_32KEY;
24+
}
25+
26+
// Open the registry key
27+
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, *RegistryPath, 0, samDesired, &hKey) != ERROR_SUCCESS)
28+
{
29+
return TEXT("ERROR: Cannot open registry key.");
30+
}
31+
32+
// Query the value
33+
LONG result = RegQueryValueEx(hKey, ValueName.IsEmpty() ? nullptr : *ValueName, nullptr, &dwType, (LPBYTE)&Data, &dwSize);
34+
35+
// Close the key
36+
RegCloseKey(hKey);
37+
38+
// Return result
39+
if (result == ERROR_SUCCESS)
40+
{
41+
bSuccess = true;
42+
return FString(Data);
43+
}
44+
else
45+
{
46+
return TEXT("ERROR: Cannot read registry value.");
47+
}
48+
49+
#else
50+
bSuccess = false;
51+
return TEXT("ERROR: Unsupported platform.");
52+
#endif
53+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
#include "WindowsRegistryReadPlugin.h"
4+
5+
#define LOCTEXT_NAMESPACE "FWindowsRegistryReadPluginModule"
6+
7+
void FWindowsRegistryReadPluginModule::StartupModule()
8+
{
9+
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
10+
}
11+
12+
void FWindowsRegistryReadPluginModule::ShutdownModule()
13+
{
14+
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
15+
// we call this function before unloading the module.
16+
}
17+
18+
#undef LOCTEXT_NAMESPACE
19+
20+
IMPLEMENT_MODULE(FWindowsRegistryReadPluginModule, WindowsRegistryReadPlugin)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
#pragma once
3+
4+
#include "CoreMinimal.h"
5+
#include "Kismet/BlueprintFunctionLibrary.h"
6+
#include "WindowsRegistryReadLibrary.generated.h"
7+
8+
/**
9+
*
10+
*/
11+
UCLASS()
12+
class WINDOWSREGISTRYREADPLUGIN_API UWindowsRegistryReadLibrary : public UBlueprintFunctionLibrary
13+
{
14+
GENERATED_BODY()
15+
16+
public:
17+
/** Reads a registry key value from Windows Registry.
18+
* @param RegistryPath - The full registry path (e.g., "SOFTWARE\Microsoft\Windows\CurrentVersion").
19+
* @param ValueName - The name of the value to retrieve (leave empty for default).
20+
* @param bIs64BitKey - If true, reads from the 64-bit registry.
21+
* @return The registry value as a string. (returns the error instead of registry value on fail)
22+
* @param bSuccess - Output boolean indicating if the function was successful.
23+
*/
24+
UFUNCTION(BlueprintCallable, Category = "Windows Registry")
25+
static FString ReadRegistryValue(const FString& RegistryPath, const FString& ValueName, bool bIs64BitKey, bool& bSuccess);
26+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
#pragma once
4+
5+
#include "Modules/ModuleManager.h"
6+
7+
class FWindowsRegistryReadPluginModule : public IModuleInterface
8+
{
9+
public:
10+
11+
/** IModuleInterface implementation */
12+
virtual void StartupModule() override;
13+
virtual void ShutdownModule() override;
14+
};
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
5+
public class WindowsRegistryReadPlugin : ModuleRules
6+
{
7+
public WindowsRegistryReadPlugin(ReadOnlyTargetRules Target) : base(Target)
8+
{
9+
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
10+
11+
PublicIncludePaths.AddRange(
12+
new string[] {
13+
// ... add public include paths required here ...
14+
}
15+
);
16+
17+
18+
PrivateIncludePaths.AddRange(
19+
new string[] {
20+
// ... add other private include paths required here ...
21+
}
22+
);
23+
24+
25+
PublicDependencyModuleNames.AddRange(
26+
new string[]
27+
{
28+
"Core",
29+
// ... add other public dependencies that you statically link with here ...
30+
}
31+
);
32+
33+
34+
PrivateDependencyModuleNames.AddRange(
35+
new string[]
36+
{
37+
"CoreUObject",
38+
"Engine",
39+
"Slate",
40+
"SlateCore",
41+
// ... add private dependencies that you statically link with here ...
42+
}
43+
);
44+
45+
46+
DynamicallyLoadedModuleNames.AddRange(
47+
new string[]
48+
{
49+
// ... add any modules that your module loads dynamically here ...
50+
}
51+
);
52+
53+
if (Target.Platform == UnrealTargetPlatform.Win64)
54+
{
55+
PrivateDependencyModuleNames.Add("WindowsPlatformFeatures");
56+
PublicDefinitions.Add("PLATFORM_WINDOWS=1");
57+
}
58+
}
59+
}

WindowsRegistryReadPlugin.uplugin

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"FileVersion": 3,
3+
"Version": 1,
4+
"VersionName": "1.0",
5+
"FriendlyName": "Windows Registry Read Plugin",
6+
"Description": "A plugin to read values from the Windows registry.",
7+
"Category": "Windows Utilities",
8+
"CreatedBy": "PixelIndieDev",
9+
"CreatedByURL": "https://github.com/PixelIndieDev/WindowsRegistryReadPluginUnrealEngine",
10+
"DocsURL": "",
11+
"MarketplaceURL": "",
12+
"SupportURL": "",
13+
"CanContainContent": true,
14+
"IsBetaVersion": true,
15+
"IsExperimentalVersion": false,
16+
"Installed": false,
17+
"Modules": [
18+
{
19+
"Name": "WindowsRegistryReadPlugin",
20+
"Type": "Runtime",
21+
"LoadingPhase": "Default",
22+
"PlatformAllowList": [
23+
"Win64"
24+
]
25+
}
26+
]
27+
}

0 commit comments

Comments
 (0)