From c0add4aee86b61cb384c10845a1bbadd1dc410a5 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 30 Mar 2010 03:26:35 +0000 Subject: [PATCH] [RTL] - Fall back to the default user key if RtlFormatCurrentUserKeyPath fails (perhaps we are in a system process) svn path=/trunk/; revision=46578 --- reactos/lib/rtl/registry.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/reactos/lib/rtl/registry.c b/reactos/lib/rtl/registry.c index e302590ebcc..d6e4458981b 100644 --- a/reactos/lib/rtl/registry.c +++ b/reactos/lib/rtl/registry.c @@ -474,13 +474,23 @@ RtlpGetRegistryHandle(IN ULONG RelativeTo, /* Check if we need the current user key */ if (RelativeTo == RTL_REGISTRY_USER) { - /* Get the path */ + /* Get the user key path */ Status = RtlFormatCurrentUserKeyPath(&KeyPath); - if (!NT_SUCCESS(Status)) return(Status); - /* Append it */ - Status = RtlAppendUnicodeStringToString(&KeyName, &KeyPath); - RtlFreeUnicodeString (&KeyPath); + /* Check if it worked */ + if (NT_SUCCESS(Status)) + { + /* Append the user key path */ + Status = RtlAppendUnicodeStringToString(&KeyName, &KeyPath); + + /* Free the user key path */ + RtlFreeUnicodeString (&KeyPath); + } + else + { + /* It didn't work so fall back to the default user key */ + Status = RtlAppendUnicodeToString(&KeyName, RtlpRegPaths[RTL_REGISTRY_USER]); + } } else {