Author: hpoussin
Date: Sun Oct 5 19:46:00 2014
New Revision: 64548
URL:
http://svn.reactos.org/svn/reactos?rev=64548&view=rev
Log:
[MKHIVE] Remove dead code and unused structure fields
Use MEMKEY/PMEMKEY names to represent registry key node in memory.
Modified:
trunk/reactos/tools/mkhive/registry.c
trunk/reactos/tools/mkhive/registry.h
Modified: trunk/reactos/tools/mkhive/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/registry.c?re…
==============================================================================
--- trunk/reactos/tools/mkhive/registry.c [iso-8859-1] (original)
+++ trunk/reactos/tools/mkhive/registry.c [iso-8859-1] Sun Oct 5 19:46:00 2014
@@ -41,35 +41,27 @@
#define REG_DATA_IN_OFFSET 0x80000000
static CMHIVE RootHive;
-static MEMKEY RootKey;
+static PMEMKEY RootKey;
CMHIVE DefaultHive; /* \Registry\User\.DEFAULT */
CMHIVE SamHive; /* \Registry\Machine\SAM */
CMHIVE SecurityHive; /* \Registry\Machine\SECURITY */
CMHIVE SoftwareHive; /* \Registry\Machine\SOFTWARE */
CMHIVE SystemHive; /* \Registry\Machine\SYSTEM */
-static MEMKEY
+static PMEMKEY
CreateInMemoryStructure(
IN PCMHIVE RegistryHive,
IN HCELL_INDEX KeyCellOffset,
IN PCUNICODE_STRING KeyName)
{
- MEMKEY Key;
-
- Key = (MEMKEY) malloc (sizeof(KEY));
+ PMEMKEY Key;
+
+ Key = (PMEMKEY) malloc (sizeof(MEMKEY));
if (!Key)
return NULL;
InitializeListHead (&Key->SubKeyList);
- InitializeListHead (&Key->ValueList);
InitializeListHead (&Key->KeyList);
-
- Key->SubKeyCount = 0;
- Key->ValueCount = 0;
-
- Key->DataType = 0;
- Key->DataSize = 0;
- Key->Data = NULL;
Key->RegistryHive = RegistryHive;
Key->KeyCellOffset = Key->KeyCellOffsetInParentHive = KeyCellOffset;
@@ -81,7 +73,6 @@
}
Key->KeyCell->SubKeyLists[Stable] = HCELL_NIL;
Key->KeyCell->SubKeyLists[Volatile] = HCELL_NIL;
- Key->LinkedKey = NULL;
return Key;
}
@@ -96,8 +87,8 @@
PWSTR End;
UNICODE_STRING KeyString;
NTSTATUS Status;
- MEMKEY ParentKey;
- MEMKEY CurrentKey;
+ PMEMKEY ParentKey;
+ PMEMKEY CurrentKey;
PLIST_ENTRY Ptr;
PCM_KEY_NODE SubKeyCell;
HCELL_INDEX BlockOffset;
@@ -163,7 +154,7 @@
Ptr = ParentKey->SubKeyList.Flink;
while (Ptr != &ParentKey->SubKeyList)
{
- CurrentKey = CONTAINING_RECORD(Ptr, KEY, KeyList);
+ CurrentKey = CONTAINING_RECORD(Ptr, MEMKEY, KeyList);
if (CurrentKey->KeyCellOffsetInParentHive == BlockOffset)
{
goto nextsubkey;
@@ -196,7 +187,6 @@
return ERROR_OUTOFMEMORY;
/* Add CurrentKey in ParentKey */
InsertTailList(&ParentKey->SubKeyList, &CurrentKey->KeyList);
- ParentKey->SubKeyCount++;
}
}
if (!NT_SUCCESS(Status))
@@ -240,24 +230,6 @@
}
LONG WINAPI
-RegCreateKeyA(
- IN HKEY hKey,
- IN LPCSTR lpSubKey,
- OUT PHKEY phkResult)
-{
- PWSTR lpSubKeyW;
- LONG rc;
-
- lpSubKeyW = MultiByteToWideChar(lpSubKey);
- if (!lpSubKeyW)
- return ERROR_OUTOFMEMORY;
-
- rc = RegCreateKeyW(hKey, lpSubKeyW, phkResult);
- free(lpSubKeyW);
- return rc;
-}
-
-LONG WINAPI
RegDeleteKeyW(
IN HKEY hKey,
IN LPCWSTR lpSubKey)
@@ -327,7 +299,7 @@
OUT PCM_KEY_VALUE *ValueCell,
OUT PHCELL_INDEX ValueCellOffset)
{
- MEMKEY ParentKey;
+ PMEMKEY ParentKey;
UNICODE_STRING ValueString;
NTSTATUS Status;
@@ -364,7 +336,7 @@
IN const UCHAR* lpData,
IN USHORT cbData)
{
- MEMKEY Key, DestKey;
+ PMEMKEY Key, DestKey;
PHKEY phKey;
PCM_KEY_VALUE ValueCell;
HCELL_INDEX ValueCellOffset;
@@ -381,10 +353,6 @@
Key = HKEY_TO_MEMKEY(hKey);
DestKey = HKEY_TO_MEMKEY(*phKey);
- /* Create the link in memory */
- Key->DataType = REG_LINK;
- Key->LinkedKey = DestKey;
-
/* Create the link in registry hive (if applicable) */
if (Key->RegistryHive != DestKey->RegistryHive)
return STATUS_SUCCESS;
@@ -467,59 +435,6 @@
DPRINT("Return status 0x%08x\n", Status);
return Status;
-}
-
-LONG WINAPI
-RegSetValueExA(
- IN HKEY hKey,
- IN LPCSTR lpValueName OPTIONAL,
- IN ULONG Reserved,
- IN ULONG dwType,
- IN const UCHAR* lpData,
- IN ULONG cbData)
-{
- LPWSTR lpValueNameW = NULL;
- const UCHAR* lpDataW;
- USHORT cbDataW;
- LONG rc = ERROR_SUCCESS;
-
- DPRINT("RegSetValueA(%s)\n", lpValueName);
- if (lpValueName)
- {
- lpValueNameW = MultiByteToWideChar(lpValueName);
- if (!lpValueNameW)
- return ERROR_OUTOFMEMORY;
- }
-
- if ((dwType == REG_SZ || dwType == REG_EXPAND_SZ || dwType == REG_MULTI_SZ)
- && cbData != 0)
- {
- ANSI_STRING AnsiString;
- UNICODE_STRING Data;
-
- if (lpData[cbData - 1] != '\0')
- cbData++;
- RtlInitAnsiString(&AnsiString, NULL);
- AnsiString.Buffer = (PSTR)lpData;
- AnsiString.Length = (USHORT)cbData - 1;
- AnsiString.MaximumLength = (USHORT)cbData;
- RtlAnsiStringToUnicodeString (&Data, &AnsiString, TRUE);
- lpDataW = (const UCHAR*)Data.Buffer;
- cbDataW = Data.MaximumLength;
- }
- else
- {
- lpDataW = lpData;
- cbDataW = (USHORT)cbData;
- }
-
- if (rc == ERROR_SUCCESS)
- rc = RegSetValueExW(hKey, lpValueNameW, 0, dwType, lpDataW, cbDataW);
- if (lpValueNameW)
- free(lpValueNameW);
- if (lpData != lpDataW)
- free((PVOID)lpDataW);
- return rc;
}
LONG WINAPI
@@ -552,58 +467,12 @@
}
LONG WINAPI
-RegQueryValueExA(
- IN HKEY hKey,
- IN LPCSTR lpValueName,
- IN PULONG lpReserved,
- OUT PULONG lpType,
- OUT PUCHAR lpData,
- OUT PSIZE_T lpcbData)
-{
- LPWSTR lpValueNameW = NULL;
- LONG rc;
-
- if (lpValueName)
- {
- lpValueNameW = MultiByteToWideChar(lpValueName);
- if (!lpValueNameW)
- return ERROR_OUTOFMEMORY;
- }
-
- rc = RegQueryValueExW(hKey, lpValueNameW, lpReserved, lpType, lpData, lpcbData);
- if (lpValueNameW)
- free(lpValueNameW);
- return rc;
-}
-
-LONG WINAPI
RegDeleteValueW(
IN HKEY hKey,
IN LPCWSTR lpValueName OPTIONAL)
{
DPRINT1("RegDeleteValueW() unimplemented\n");
return ERROR_UNSUCCESSFUL;
-}
-
-LONG WINAPI
-RegDeleteValueA(
- IN HKEY hKey,
- IN LPCSTR lpValueName OPTIONAL)
-{
- LPWSTR lpValueNameW;
- LONG rc;
-
- if (lpValueName)
- {
- lpValueNameW = MultiByteToWideChar(lpValueName);
- if (!lpValueNameW)
- return ERROR_OUTOFMEMORY;
- rc = RegDeleteValueW(hKey, lpValueNameW);
- free(lpValueNameW);
- }
- else
- rc = RegDeleteValueW(hKey, NULL);
- return rc;
}
static BOOL
@@ -613,7 +482,7 @@
IN LPCWSTR Path)
{
NTSTATUS Status;
- MEMKEY NewKey;
+ PMEMKEY NewKey;
LONG rc;
Status = CmiInitializeTempHive(HiveToConnect);
Modified: trunk/reactos/tools/mkhive/registry.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/registry.h?re…
==============================================================================
--- trunk/reactos/tools/mkhive/registry.h [iso-8859-1] (original)
+++ trunk/reactos/tools/mkhive/registry.h [iso-8859-1] Sun Oct 5 19:46:00 2014
@@ -6,45 +6,19 @@
#pragma once
-typedef struct _REG_VALUE
-{
- LIST_ENTRY ValueList;
-
- /* value name */
- ULONG NameSize;
- PCHAR Name;
-
- /* value data */
- ULONG DataType;
- ULONG DataSize;
- PCHAR Data;
-} VALUE, *PVALUE;
-
-typedef struct _REG_KEY
+typedef struct _MEMKEY
{
LIST_ENTRY KeyList;
LIST_ENTRY SubKeyList;
- LIST_ENTRY ValueList;
-
- ULONG SubKeyCount;
- ULONG ValueCount;
-
- /* default data */
- ULONG DataType;
- ULONG DataSize;
- PCHAR Data;
/* Information on hard disk structure */
HCELL_INDEX KeyCellOffsetInParentHive;
HCELL_INDEX KeyCellOffset;
PCM_KEY_NODE KeyCell;
PCMHIVE RegistryHive;
+} MEMKEY, *PMEMKEY;
- /* Used when linking to another key */
- struct _REG_KEY* LinkedKey;
-} KEY, *FRLDRHKEY, **PFRLDRHKEY, *MEMKEY, **PMEMKEY;
-
-#define HKEY_TO_MEMKEY(hKey) ((MEMKEY)(hKey))
+#define HKEY_TO_MEMKEY(hKey) ((PMEMKEY)(hKey))
#define MEMKEY_TO_HKEY(memKey) ((HKEY)(memKey))
extern CMHIVE DefaultHive; /* \Registry\User\.DEFAULT */
@@ -73,49 +47,6 @@
#define REG_FULL_RESOURCE_DESCRIPTOR 9
#define REG_RESOURCE_REQUIREMENTS_LIST 10
-LONG WINAPI
-RegCreateKeyA(
- IN HKEY hKey,
- IN LPCSTR lpSubKey,
- OUT PHKEY phkResult);
-
-LONG WINAPI
-RegOpenKeyA(
- IN HKEY hKey,
- IN LPCSTR lpSubKey,
- OUT PHKEY phkResult);
-
-LONG WINAPI
-RegQueryValueExA(HKEY Key,
- LPCSTR ValueName,
- PULONG Reserved,
- PULONG Type,
- PUCHAR Data,
- PSIZE_T DataSize);
-
-LONG WINAPI
-RegSetValueExA(
- IN HKEY hKey,
- IN LPCSTR lpValueName OPTIONAL,
- ULONG Reserved,
- IN ULONG dwType,
- IN const UCHAR* lpData,
- IN ULONG cbData);
-
-LONG WINAPI
-RegDeleteValueA(HKEY Key,
- LPCSTR ValueName);
-
-LONG WINAPI
-RegDeleteKeyA(HKEY Key,
- LPCSTR Name);
-
-USHORT
-RegGetSubKeyCount (HKEY Key);
-
-ULONG
-RegGetValueCount (HKEY Key);
-
VOID
RegInitializeRegistry(VOID);