kernel32: Move RemoveDirectoryA/W() implementation to kernelbase.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
518decf16b
commit
f8699c0a71
|
@ -1268,8 +1268,8 @@
|
|||
@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) ntdll.TpCallbackReleaseSemaphoreOnCompletion
|
||||
@ stdcall ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive
|
||||
@ stdcall ReleaseSRWLockShared(ptr) ntdll.RtlReleaseSRWLockShared
|
||||
@ stdcall RemoveDirectoryA(str)
|
||||
@ stdcall RemoveDirectoryW(wstr)
|
||||
@ stdcall -import RemoveDirectoryA(str)
|
||||
@ stdcall -import RemoveDirectoryW(wstr)
|
||||
# @ stub RemoveLocalAlternateComputerNameA
|
||||
# @ stub RemoveLocalAlternateComputerNameW
|
||||
@ stdcall RemoveVectoredContinueHandler(ptr) ntdll.RtlRemoveVectoredContinueHandler
|
||||
|
|
|
@ -228,68 +228,6 @@ BOOL WINAPI CreateDirectoryExA( LPCSTR template, LPCSTR path, LPSECURITY_ATTRIBU
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RemoveDirectoryW (KERNEL32.@)
|
||||
*/
|
||||
BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nt_name;
|
||||
ANSI_STRING unix_name;
|
||||
IO_STATUS_BLOCK io;
|
||||
NTSTATUS status;
|
||||
HANDLE handle;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE( "%s\n", debugstr_w(path) );
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL ))
|
||||
{
|
||||
SetLastError( ERROR_PATH_NOT_FOUND );
|
||||
return FALSE;
|
||||
}
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
attr.ObjectName = &nt_name;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
if (!set_ntstatus( NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT )))
|
||||
{
|
||||
RtlFreeUnicodeString( &nt_name );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN );
|
||||
RtlFreeUnicodeString( &nt_name );
|
||||
if (!set_ntstatus( status ))
|
||||
{
|
||||
NtClose( handle );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(ret = (rmdir( unix_name.Buffer ) != -1))) FILE_SetDosError();
|
||||
RtlFreeAnsiString( &unix_name );
|
||||
NtClose( handle );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RemoveDirectoryA (KERNEL32.@)
|
||||
*/
|
||||
BOOL WINAPI RemoveDirectoryA( LPCSTR path )
|
||||
{
|
||||
WCHAR *pathW;
|
||||
|
||||
if (!(pathW = FILE_name_AtoW( path, FALSE ))) return FALSE;
|
||||
return RemoveDirectoryW( pathW );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetSystemDirectoryW (KERNEL32.@)
|
||||
*
|
||||
|
|
|
@ -3448,6 +3448,50 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFileScatter( HANDLE file, FILE_SEGMENT_ELEMENT
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RemoveDirectoryA (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH RemoveDirectoryA( LPCSTR path )
|
||||
{
|
||||
WCHAR *pathW;
|
||||
|
||||
if (!(pathW = file_name_AtoW( path, FALSE ))) return FALSE;
|
||||
return RemoveDirectoryW( pathW );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RemoveDirectoryW (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH RemoveDirectoryW( LPCWSTR path )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nt_name;
|
||||
IO_STATUS_BLOCK io;
|
||||
NTSTATUS status;
|
||||
HANDLE handle;
|
||||
|
||||
TRACE( "%s\n", debugstr_w(path) );
|
||||
|
||||
status = RtlDosPathNameToNtPathName_U_WithStatus( path, &nt_name, NULL, NULL );
|
||||
if (!set_ntstatus( status )) return FALSE;
|
||||
|
||||
InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE, 0, NULL );
|
||||
status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
|
||||
RtlFreeUnicodeString( &nt_name );
|
||||
|
||||
if (!status)
|
||||
{
|
||||
FILE_DISPOSITION_INFORMATION info = { TRUE };
|
||||
status = NtSetInformationFile( handle, &io, &info, sizeof(info), FileDispositionInformation );
|
||||
NtClose( handle );
|
||||
}
|
||||
return set_ntstatus( status );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* SetEndOfFile (kernelbase.@)
|
||||
*/
|
||||
|
|
|
@ -1331,8 +1331,8 @@
|
|||
@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) ntdll.TpCallbackReleaseSemaphoreOnCompletion
|
||||
# @ stub ReleaseStateLock
|
||||
@ stdcall RemapPredefinedHandleInternal(long long)
|
||||
@ stdcall RemoveDirectoryA(str) kernel32.RemoveDirectoryA
|
||||
@ stdcall RemoveDirectoryW(wstr) kernel32.RemoveDirectoryW
|
||||
@ stdcall RemoveDirectoryA(str)
|
||||
@ stdcall RemoveDirectoryW(wstr)
|
||||
@ stdcall RemoveDllDirectory(ptr)
|
||||
# @ stub RemovePackageStatus
|
||||
# @ stub RemovePackageStatusForUser
|
||||
|
|
|
@ -3082,16 +3082,17 @@ todo_wine
|
|||
fileDeleted = RemoveDirectoryA( buffer );
|
||||
ok( fileDeleted, "Directory should have been deleted\n" );
|
||||
fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND;
|
||||
todo_wine
|
||||
ok( !fileDeleted, "Directory shouldn't have been deleted\n" );
|
||||
res = nt_get_file_attrs( buffer, &fdi2 );
|
||||
todo_wine
|
||||
ok( res == STATUS_DELETE_PENDING, "got %#x\n", res );
|
||||
/* can't open the deleted directory */
|
||||
handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||
todo_wine
|
||||
ok( handle2 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" );
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError());
|
||||
if (handle2 != INVALID_HANDLE_VALUE) CloseHandle( handle2 );
|
||||
CloseHandle( handle );
|
||||
fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND;
|
||||
ok( fileDeleted, "Directory should have been deleted\n" );
|
||||
|
|
Loading…
Reference in New Issue