https://git.reactos.org/?p=reactos.git;a=commitdiff;h=81d435a181db3d7d0b931…
commit 81d435a181db3d7d0b93149dd61c971f5a0147ae
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Oct 14 00:29:04 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Oct 14 15:59:41 2018 +0200
[MKHIVE] Implement and use RegCloseKey().
---
sdk/tools/mkhive/mkhive.h | 4 ++++
sdk/tools/mkhive/reginf.c | 3 +++
sdk/tools/mkhive/registry.c | 14 ++++++++++++++
3 files changed, 21 insertions(+)
diff --git a/sdk/tools/mkhive/mkhive.h b/sdk/tools/mkhive/mkhive.h
index 517925a6b6..82c8ecc2c3 100644
--- a/sdk/tools/mkhive/mkhive.h
+++ b/sdk/tools/mkhive/mkhive.h
@@ -89,6 +89,10 @@ RegSetValueExW(
IN const UCHAR* lpData,
IN ULONG cbData);
+LONG WINAPI
+RegCloseKey(
+ IN HKEY hKey);
+
LONG WINAPI
RegDeleteKeyW(
IN HKEY hKey,
diff --git a/sdk/tools/mkhive/reginf.c b/sdk/tools/mkhive/reginf.c
index c6087a96ba..47f0d8525b 100644
--- a/sdk/tools/mkhive/reginf.c
+++ b/sdk/tools/mkhive/reginf.c
@@ -463,8 +463,11 @@ registry_callback(HINF hInf, PWCHAR Section, BOOL Delete)
/* and now do it */
if (!do_reg_operation(KeyHandle, ValuePtr, Context, Flags))
{
+ RegCloseKey(KeyHandle);
return FALSE;
}
+
+ RegCloseKey(KeyHandle);
}
InfHostFreeContext(Context);
diff --git a/sdk/tools/mkhive/registry.c b/sdk/tools/mkhive/registry.c
index 1686fca08d..cd238dcd95 100644
--- a/sdk/tools/mkhive/registry.c
+++ b/sdk/tools/mkhive/registry.c
@@ -485,6 +485,18 @@ RegpCreateOrOpenKey(
return ERROR_SUCCESS;
}
+LONG WINAPI
+RegCloseKey(
+ IN HKEY hKey)
+{
+ PMEMKEY Key = HKEY_TO_MEMKEY(hKey); // ParentKey
+
+ /* Free the object */
+ free(Key);
+
+ return ERROR_SUCCESS;
+}
+
LONG WINAPI
RegCreateKeyW(
IN HKEY hKey,
@@ -942,6 +954,8 @@ RegInitializeRegistry(
CreateSymLink(L"Registry\\Machine\\SYSTEM\\CurrentControlSet",
NULL, ControlSetKey);
+ RegCloseKey(ControlSetKey);
+
#if 0
/* Link SECURITY to SAM */
CmpLinkKeyToHive(L"\\Registry\\Machine\\Security\\SAM",
L"\\Registry\\Machine\\SAM\\SAM");