Author: pschweitzer
Date: Sun Jan 1 17:19:31 2012
New Revision: 54803
URL:
http://svn.reactos.org/svn/reactos?rev=54803&view=rev
Log:
[KERNEL32]
Implement BaseMarkFileForDelete. This will be used later.
Modified:
trunk/reactos/dll/win32/kernel32/client/utils.c
trunk/reactos/dll/win32/kernel32/include/kernel32.h
Modified: trunk/reactos/dll/win32/kernel32/client/utils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/utils.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/utils.c [iso-8859-1] Sun Jan 1 17:19:31 2012
@@ -828,6 +828,51 @@
}
/*
+ * @implemented
+ */
+VOID
+WINAPI
+BaseMarkFileForDelete(IN HANDLE FileHandle,
+ IN ULONG FileAttributes)
+{
+ IO_STATUS_BLOCK IoStatusBlock;
+ FILE_BASIC_INFORMATION FileBasicInfo;
+ FILE_DISPOSITION_INFORMATION FileDispositionInfo;
+
+ /* If no attributes were given, get them */
+ if (!FileAttributes)
+ {
+ FileBasicInfo.FileAttributes = 0;
+ NtQueryInformationFile(FileHandle,
+ &IoStatusBlock,
+ &FileBasicInfo,
+ sizeof(FileBasicInfo),
+ FileBasicInformation);
+ FileAttributes = FileBasicInfo.FileAttributes;
+ }
+
+ /* If file is marked as RO, reset its attributes */
+ if (FileAttributes & FILE_ATTRIBUTE_READONLY)
+ {
+ RtlZeroMemory(&FileBasicInfo, sizeof(FileBasicInfo));
+ FileBasicInfo.FileAttributes = FILE_ATTRIBUTE_NORMAL;
+ NtSetInformationFile(FileHandle,
+ &IoStatusBlock,
+ &FileBasicInfo,
+ sizeof(FileBasicInfo),
+ FileBasicInformation);
+ }
+
+ /* Finally, mark the file for deletion */
+ FileDispositionInfo.DeleteFile = TRUE;
+ NtSetInformationFile(FileHandle,
+ &IoStatusBlock,
+ &FileDispositionInfo,
+ sizeof(FileDispositionInfo),
+ FileDispositionInformation);
+}
+
+/*
* @unimplemented
*/
BOOL
Modified: trunk/reactos/dll/win32/kernel32/include/kernel32.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Sun Jan 1 17:19:31
2012
@@ -323,3 +323,7 @@
IN PVOID Context,
OUT BOOLEAN *StopEnumeration);
+VOID
+WINAPI
+BaseMarkFileForDelete(IN HANDLE FileHandle,
+ IN ULONG FileAttributes);