Module: wine Branch: master Commit: 6b7adb3d5dd52fa3e78304382241c6563e7997d2 URL: https://gitlab.winehq.org/wine/wine/-/commit/6b7adb3d5dd52fa3e78304382241c65... Author: Sven Baars <sbaars(a)codeweavers.com> Date: Fri Dec 2 13:24:37 2022 +0100 kernelbase: Add a fast path to create_key(). --- dlls/kernelbase/registry.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c index a74a4d8e411..c690d659eb4 100644 --- a/dlls/kernelbase/registry.c +++ b/dlls/kernelbase/registry.c @@ -258,7 +258,18 @@ static NTSTATUS create_key( HKEY *retkey, HKEY root, UNICODE_STRING name, ULONG attr.SecurityQualityOfService = NULL; if (options & REG_OPTION_OPEN_LINK) attr.Attributes |= OBJ_OPENLINK; - if (!force_wow32) status = NtCreateKey( &subkey, access, &attr, 0, class, options, dispos ); + if (!force_wow32) + { + status = NtCreateKey( (HANDLE *)retkey, access, &attr, 0, class, options, dispos ); + if (status == STATUS_PREDEFINED_HANDLE) + { + *retkey = get_perflib_key( *retkey ); + status = STATUS_SUCCESS; + } + + if (!status || status != STATUS_OBJECT_NAME_NOT_FOUND) + return status; + } if (status == STATUS_OBJECT_NAME_NOT_FOUND) {