From 7cda28d4152f9ccdf687bea18901304a0c343424 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 18 Mar 2004 16:19:26 +0000 Subject: [PATCH] 1. implemented SetFileValidData() 2. updated FILE_INFORMATION_CLASS svn path=/trunk/; revision=8780 --- reactos/include/ddk/fstypes.h | 6 +++++- reactos/include/napi/types.h | 20 ++++++++--------- reactos/lib/kernel32/file/file.c | 36 ++++++++++++++++++++++++++++++- reactos/lib/kernel32/misc/stubs.c | 16 +------------- 4 files changed, 51 insertions(+), 27 deletions(-) diff --git a/reactos/include/ddk/fstypes.h b/reactos/include/ddk/fstypes.h index c8d7519e4d7..ba198a1c0fb 100644 --- a/reactos/include/ddk/fstypes.h +++ b/reactos/include/ddk/fstypes.h @@ -1,6 +1,6 @@ #ifndef __INCLUDE_DDK_FSTYPES_H #define __INCLUDE_DDK_FSTYPES_H -/* $Id: fstypes.h,v 1.14 2004/03/14 09:21:41 weiden Exp $ */ +/* $Id: fstypes.h,v 1.15 2004/03/18 16:19:25 weiden Exp $ */ #ifndef __USE_W32API @@ -21,6 +21,10 @@ typedef struct _FILE_LINK_INFORMATION { WCHAR FileName[1]; } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION; +typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION { + LARGE_INTEGER ValidDataLength; +} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; + typedef NTSTATUS (*PCOMPLETE_LOCK_IRP_ROUTINE) ( IN PVOID Context, IN PIRP Irp diff --git a/reactos/include/napi/types.h b/reactos/include/napi/types.h index d8a35f93997..30287b3492d 100644 --- a/reactos/include/napi/types.h +++ b/reactos/include/napi/types.h @@ -64,19 +64,19 @@ typedef enum _FILE_INFORMATION_CLASS FileMailslotQueryInformation, FileMailslotSetInformation, FileCompressionInformation, - FileCopyOnWriteInformation, + FileObjectIdInformation, FileCompletionInformation, FileMoveClusterInformation, - FileOleClassIdInformation, - FileOleStateBitsInformation, + FileQuotaInformation, + FileReparsePointInformation, FileNetworkOpenInformation, - FileObjectIdInformation, - FileOleAllInformation, - FileOleDirectoryInformation, - FileContentIndexInformation, - FileInheritContentIndexInformation, - FileOleInformation, - FileMaximumInformation, + FileAttributeTagInformation, + FileTrackingInformation, + FileIdBothDirectoryInformation, + FileIdFullDirectoryInformation, + FileValidDataLengthInformation, + FileShortNameInformation, + FileMaximumInformation } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; typedef enum _SECTION_INHERIT { diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c index 731daa1cc55..330ff3975e6 100644 --- a/reactos/lib/kernel32/file/file.c +++ b/reactos/lib/kernel32/file/file.c @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.51 2004/03/14 13:20:10 weiden Exp $ +/* $Id: file.c,v 1.52 2004/03/18 16:19:25 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -13,6 +13,7 @@ /* INCLUDES *****************************************************************/ #include +#include #define NDEBUG #include "../include/debug.h" @@ -1158,4 +1159,37 @@ SetEndOfFile(HANDLE hFile) } + +/* + * @implemented + */ +BOOL +STDCALL +SetFileValidData( + HANDLE hFile, + LONGLONG ValidDataLength + ) +{ + IO_STATUS_BLOCK IoStatusBlock; + FILE_VALID_DATA_LENGTH_INFORMATION ValidDataLengthInformation; + NTSTATUS Status; + + ValidDataLengthInformation.ValidDataLength.QuadPart = ValidDataLength; + + Status = NtSetInformationFile( + hFile, + &IoStatusBlock, //out + &ValidDataLengthInformation, + sizeof(FILE_VALID_DATA_LENGTH_INFORMATION), + FileValidDataLengthInformation + ); + + if (!NT_SUCCESS(Status)){ + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + /* EOF */ diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index db38a68e8b4..df17c38f70a 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.68 2004/03/14 18:16:39 weiden Exp $ +/* $Id: stubs.c,v 1.69 2004/03/18 16:19:26 weiden Exp $ * * KERNEL32.DLL stubs (unimplemented functions) * Remove from this file, if you implement them. @@ -1393,20 +1393,6 @@ SetCriticalSectionSpinCount( return 0; } -/* - * @unimplemented - */ -BOOL -STDCALL -SetFileValidData( - HANDLE hFile, - LONGLONG ValidDataLength - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented */