Commit 6d0712a3 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Moved kernel32.DeleteFileW core implementation to ntdll.NtDeleteFile.

parent 40556880
......@@ -1362,16 +1362,32 @@ HANDLE WINAPI CreateFileA( LPCSTR filename, DWORD access, DWORD sharing,
*/
BOOL WINAPI DeleteFileW( LPCWSTR path )
{
HANDLE hFile;
UNICODE_STRING nameW;
OBJECT_ATTRIBUTES attr;
NTSTATUS status;
TRACE("%s\n", debugstr_w(path) );
hFile = CreateFileW( path, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0 );
if (hFile == INVALID_HANDLE_VALUE) return FALSE;
if (!RtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL ))
{
SetLastError( ERROR_PATH_NOT_FOUND );
return FALSE;
}
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.Attributes = OBJ_CASE_INSENSITIVE;
attr.ObjectName = &nameW;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
CloseHandle(hFile); /* last close will delete the file */
status = NtDeleteFile(&attr);
RtlFreeUnicodeString( &nameW );
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
return TRUE;
}
......
......@@ -1647,8 +1647,17 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE FileHandle, ULONG DesiredAccess,
*/
NTSTATUS WINAPI NtDeleteFile( POBJECT_ATTRIBUTES ObjectAttributes )
{
FIXME("%p\n", ObjectAttributes);
return STATUS_NOT_IMPLEMENTED;
NTSTATUS status;
HANDLE hFile;
IO_STATUS_BLOCK io;
TRACE("%p\n", ObjectAttributes);
status = NtCreateFile( &hFile, GENERIC_READ | GENERIC_WRITE, ObjectAttributes,
&io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE, NULL, 0 );
if (status == STATUS_SUCCESS) status = NtClose(hFile);
return status;
}
/******************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment