mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 04:07:16 +00:00
[KERNEL32]
Implement BaseMarkFileForDelete. This will be used later. svn path=/trunk/; revision=54803
This commit is contained in:
parent
f6149178f5
commit
206722861c
2 changed files with 49 additions and 0 deletions
|
@ -827,6 +827,51 @@ AreFileApisANSI(VOID)
|
|||
return Basep8BitStringToUnicodeString == RtlAnsiStringToUnicodeString;
|
||||
}
|
||||
|
||||
/*
|
||||
* @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
|
||||
*/
|
||||
|
|
|
@ -323,3 +323,7 @@ BasepLocateExeLdrEntry(IN PLDR_DATA_TABLE_ENTRY Entry,
|
|||
IN PVOID Context,
|
||||
OUT BOOLEAN *StopEnumeration);
|
||||
|
||||
VOID
|
||||
WINAPI
|
||||
BaseMarkFileForDelete(IN HANDLE FileHandle,
|
||||
IN ULONG FileAttributes);
|
||||
|
|
Loading…
Reference in a new issue