Vitaliy Margolen : ntdll: Implement RtlWriteRegistryValue and forward ntoskrnl to it.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 22 06:59:48 CDT 2007


Module: wine
Branch: master
Commit: 311c001654b31a8031a4cccfa9675b94c44a3334
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=311c001654b31a8031a4cccfa9675b94c44a3334

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sat May 19 10:56:51 2007 -0600

ntdll: Implement RtlWriteRegistryValue and forward ntoskrnl to it.

---

 dlls/ntdll/ntdll.spec               |    2 +-
 dlls/ntdll/reg.c                    |   41 +++++++++++++++++++++++++++++++++++
 dlls/ntoskrnl.exe/ntoskrnl.exe.spec |    2 +-
 include/winternl.h                  |    1 +
 4 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 3b26880..535f375 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -910,7 +910,7 @@
 @ stub RtlWalkFrameChain
 @ stdcall RtlWalkHeap(long ptr)
 @ stub RtlWriteMemoryStream
-@ stub RtlWriteRegistryValue
+@ stdcall RtlWriteRegistryValue(long ptr ptr long ptr long)
 @ stub RtlZeroHeap
 @ stdcall RtlZeroMemory(ptr long)
 # @ stub RtlZombifyActivationContext
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 99a46c0..2127888 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -1334,3 +1334,44 @@ NTSTATUS WINAPI RtlDeleteRegistryValue(IN ULONG RelativeTo, IN PCWSTR Path, IN P
     NtClose(handle);
     return status;
 }
+
+/*************************************************************************
+ * RtlWriteRegistryValue   [NTDLL.@]
+ *
+ * Sets the registry value with provided data.
+ *
+ * PARAMS
+ *  RelativeTo [I] Registry path that path parameter refers to
+ *  path       [I] Path to the key (or handle - see RTL_GetKeyHandle)
+ *  name       [I] Name of the registry value to set
+ *  type       [I] Type of the registry key to set
+ *  data       [I] Pointer to the user data to be set
+ *  length     [I] Length of the user data pointed by data
+ *
+ * RETURNS
+ *  STATUS_SUCCESS if the specified key is successfully set,
+ *  or an NTSTATUS error code.
+ */
+NTSTATUS WINAPI RtlWriteRegistryValue( ULONG RelativeTo, PCWSTR path, PCWSTR name,
+                                       ULONG type, PVOID data, ULONG length )
+{
+    HANDLE hkey;
+    NTSTATUS status;
+    UNICODE_STRING str;
+
+    TRACE( "(%d, %s, %s) -> %d: %p [%d]\n", RelativeTo, debugstr_w(path), debugstr_w(name),
+           type, data, length );
+
+    RtlInitUnicodeString( &str, name );
+
+    if (RelativeTo == RTL_REGISTRY_HANDLE)
+        return NtSetValueKey( (HANDLE)path, &str, 0, type, data, length );
+
+    status = RTL_GetKeyHandle( RelativeTo, path, &hkey );
+    if (status != STATUS_SUCCESS) return status;
+
+    status = NtSetValueKey( hkey, &str, 0, type, data, length );
+    NtClose( hkey );
+
+    return status;
+}
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index f199602..192e255 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1197,7 +1197,7 @@
 @ stdcall RtlVerifyVersionInfo(ptr long double) ntdll.RtlVerifyVersionInfo
 @ stub RtlVolumeDeviceToDosName
 @ stub RtlWalkFrameChain
-@ stub RtlWriteRegistryValue
+@ stdcall RtlWriteRegistryValue(long ptr ptr long ptr long) ntdll.RtlWriteRegistryValue
 @ stub RtlZeroHeap
 @ stdcall RtlZeroMemory(ptr long) ntdll.RtlZeroMemory
 @ stdcall RtlxAnsiStringToUnicodeSize(ptr) ntdll.RtlxAnsiStringToUnicodeSize
diff --git a/include/winternl.h b/include/winternl.h
index 8b650a9..1580535 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2240,6 +2240,7 @@ BOOLEAN   WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
 NTSTATUS  WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
 
 NTSTATUS  WINAPI RtlWalkHeap(HANDLE,PVOID);
+NTSTATUS  WINAPI RtlWriteRegistryValue(ULONG,PCWSTR,PCWSTR,ULONG,PVOID,ULONG);
 
 NTSTATUS  WINAPI RtlpNtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
 NTSTATUS  WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);




More information about the wine-cvs mailing list