From ce287e9c1bfb130d0b61b644a0027b8625b91e9a Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 19 Feb 2024 12:19:15 +0100 Subject: [PATCH] Add RegistryInterface include directories, update main.cpp to use RegistryInterface instead of RegistryHelper. - Updated project files to include ../RegistryInterface in AdditionalIncludeDirectories. - Modified main.cpp to use RegistryInterface instead of RegistryHelper for registry operations. --- Example/Example.vcxproj | 6 ++++-- Example/main.cpp | 8 +++++--- Example/pch.h | 1 + RegistryHelper.sln | 5 ++++- RegistryInterface/RegistryInterface.h | 2 +- RegistryInterface/framework.h | 1 - 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Example/Example.vcxproj b/Example/Example.vcxproj index 0842e0c..b7d6c3d 100644 --- a/Example/Example.vcxproj +++ b/Example/Example.vcxproj @@ -90,6 +90,7 @@ true Use pch.h + ../RegistryInterface Console @@ -106,6 +107,7 @@ true Use pch.h + ../RegistryInterface Console @@ -120,7 +122,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\RegistryHelper;%(AdditionalIncludeDirectories) + ../RegistryInterface Use pch.h @@ -137,7 +139,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\RegistryHelper; + ../RegistryInterface stdcpplatest Use pch.h diff --git a/Example/main.cpp b/Example/main.cpp index f8320a6..42f2adc 100644 --- a/Example/main.cpp +++ b/Example/main.cpp @@ -1,12 +1,13 @@ #include "pch.h" -#include "../RegistryHelper.h" +#include "RegistryInterface.h" int main() { try { RegistryHelper registryHelper; + RegistryInterface registryInterface; std::wstring subKey = L"SYSTEM\\CurrentControlSet\\Control"; HKEY hKey = HKEY_LOCAL_MACHINE; @@ -59,8 +60,9 @@ main() std::wcout << L"Values: " << std::endl; for (const auto& valuePair : values) { - std::wcout << L" " << valuePair.first << L" (Type: " << valuePair.second - << L")" << std::endl; + std::wcout << L" " << valuePair.first << L" (Type: " + << registryInterface.GetDataTypeName(valuePair.second) << L")" + << std::endl; } } catch (const RegistryError& ex) { std::cerr << "Registry Error: " << ex.what() diff --git a/Example/pch.h b/Example/pch.h index 172cd69..5b7391b 100644 --- a/Example/pch.h +++ b/Example/pch.h @@ -3,6 +3,7 @@ // add headers that you want to pre-compile here +#include "../RegistryHelper.h" #include #endif // PCH_H diff --git a/RegistryHelper.sln b/RegistryHelper.sln index fc199ce..53fa3b3 100644 --- a/RegistryHelper.sln +++ b/RegistryHelper.sln @@ -6,11 +6,13 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3587BC45-E1D1-4FCE-9F36-D4BD660FB262}" ProjectSection(SolutionItems) = preProject .clang-format = .clang-format - .gitignore = .gitignore RegistryHelper.h = RegistryHelper.h EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example", "Example\Example.vcxproj", "{FD807556-B9F5-4D19-814A-FE0F51F514E1}" + ProjectSection(ProjectDependencies) = postProject + {40299226-5106-4793-A43D-9BBB17111B64} = {40299226-5106-4793-A43D-9BBB17111B64} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegistryInterface", "RegistryInterface\RegistryInterface.vcxproj", "{40299226-5106-4793-A43D-9BBB17111B64}" EndProject @@ -22,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Repository", "Repository", "{1FF7BFD7-87F0-4612-8468-FB56B6A0DAF0}" ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore LICENSE.md = LICENSE.md README.md = README.md EndProjectSection diff --git a/RegistryInterface/RegistryInterface.h b/RegistryInterface/RegistryInterface.h index 086d446..34f1f11 100644 --- a/RegistryInterface/RegistryInterface.h +++ b/RegistryInterface/RegistryInterface.h @@ -34,7 +34,7 @@ struct ServiceInfo class RegistryInterface { public: - RegistryInterface(); + // RegistryInterface(); not implemented // Methods related to service information std::vector EnumerateServices(); diff --git a/RegistryInterface/framework.h b/RegistryInterface/framework.h index 3249e2c..559267c 100644 --- a/RegistryInterface/framework.h +++ b/RegistryInterface/framework.h @@ -3,6 +3,5 @@ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include "../RegistryHelper.h" - #include #include