From 1cf4a1c0880f0f39f6d986db53a3b108a6e5c648 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 15 Jul 2020 20:27:57 -0500 Subject: [PATCH] kernelbase: Create DOS drive links as permanent objects. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/kernelbase/volume.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/dlls/kernelbase/volume.c b/dlls/kernelbase/volume.c index 9939ea3bef4..53cc0d49b65 100644 --- a/dlls/kernelbase/volume.c +++ b/dlls/kernelbase/volume.c @@ -972,18 +972,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH DefineDosDeviceW( DWORD flags, const WCHAR *device lstrcatW( link_name, device ); RtlInitUnicodeString( &nt_name, link_name ); - InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE, 0, NULL ); + InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, 0, NULL ); if (flags & DDD_REMOVE_DEFINITION) { if (!set_ntstatus( NtOpenSymbolicLinkObject( &handle, 0, &attr ) )) return FALSE; - SERVER_START_REQ( unlink_object ) - { - req->handle = wine_server_obj_handle( handle ); - status = wine_server_call( req ); - } - SERVER_END_REQ; + status = NtMakeTemporaryObject( handle ); NtClose( handle ); return set_ntstatus( status ); @@ -1000,7 +995,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH DefineDosDeviceW( DWORD flags, const WCHAR *device else RtlInitUnicodeString( &nt_target, target ); - return set_ntstatus( NtCreateSymbolicLinkObject( &handle, SYMBOLIC_LINK_ALL_ACCESS, &attr, &nt_target ) ); + if (!(status = NtCreateSymbolicLinkObject( &handle, SYMBOLIC_LINK_ALL_ACCESS, &attr, &nt_target ))) + NtClose( handle ); + return set_ntstatus( status ); }