Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenfinfo.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS kernel 00003 * Copyright (C) 2002 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * COPYRIGHT: See COPYING in the top level directory 00020 * PROJECT: ReactOS kernel 00021 * FILE: drivers/filesystem/ntfs/dirctl.c 00022 * PURPOSE: NTFS filesystem driver 00023 * PROGRAMMER: Eric Kohl 00024 */ 00025 00026 /* INCLUDES *****************************************************************/ 00027 00028 #include "ntfs.h" 00029 00030 #define NDEBUG 00031 #include <debug.h> 00032 00033 /* GLOBALS *****************************************************************/ 00034 00035 00036 /* FUNCTIONS ****************************************************************/ 00037 00038 static NTSTATUS 00039 NtfsGetStandardInformation(PNTFS_FCB Fcb, 00040 PDEVICE_OBJECT DeviceObject, 00041 PFILE_STANDARD_INFORMATION StandardInfo, 00042 PULONG BufferLength) 00043 /* 00044 * FUNCTION: Retrieve the standard file information 00045 */ 00046 { 00047 DPRINT("NtfsGetStandardInformation() called\n"); 00048 00049 if (*BufferLength < sizeof(FILE_STANDARD_INFORMATION)) 00050 return(STATUS_BUFFER_OVERFLOW); 00051 00052 /* PRECONDITION */ 00053 ASSERT(StandardInfo != NULL); 00054 ASSERT(Fcb != NULL); 00055 00056 RtlZeroMemory(StandardInfo, 00057 sizeof(FILE_STANDARD_INFORMATION)); 00058 00059 StandardInfo->AllocationSize = Fcb->RFCB.AllocationSize; 00060 StandardInfo->EndOfFile = Fcb->RFCB.FileSize; 00061 StandardInfo->NumberOfLinks = 0; 00062 StandardInfo->DeletePending = FALSE; 00063 StandardInfo->Directory = NtfsFCBIsDirectory(Fcb); 00064 00065 *BufferLength -= sizeof(FILE_STANDARD_INFORMATION); 00066 return(STATUS_SUCCESS); 00067 } 00068 00069 00070 static NTSTATUS 00071 NtfsGetPositionInformation(PFILE_OBJECT FileObject, 00072 PFILE_POSITION_INFORMATION PositionInfo, 00073 PULONG BufferLength) 00074 { 00075 DPRINT("NtfsGetPositionInformation() called\n"); 00076 00077 if (*BufferLength < sizeof(FILE_POSITION_INFORMATION)) 00078 return(STATUS_BUFFER_OVERFLOW); 00079 00080 PositionInfo->CurrentByteOffset.QuadPart = 00081 0; 00082 // FileObject->CurrentByteOffset.QuadPart; 00083 00084 DPRINT("Getting position %I64x\n", 00085 PositionInfo->CurrentByteOffset.QuadPart); 00086 00087 *BufferLength -= sizeof(FILE_POSITION_INFORMATION); 00088 return(STATUS_SUCCESS); 00089 } 00090 00091 00092 static NTSTATUS 00093 NtfsGetBasicInformation(PFILE_OBJECT FileObject, 00094 PNTFS_FCB Fcb, 00095 PDEVICE_OBJECT DeviceObject, 00096 PFILE_BASIC_INFORMATION BasicInfo, 00097 PULONG BufferLength) 00098 { 00099 DPRINT("NtfsGetBasicInformation() called\n"); 00100 00101 if (*BufferLength < sizeof(FILE_BASIC_INFORMATION)) 00102 return(STATUS_BUFFER_OVERFLOW); 00103 00104 #if 0 00105 CdfsDateTimeToFileTime(Fcb, 00106 &BasicInfo->CreationTime); 00107 CdfsDateTimeToFileTime(Fcb, 00108 &BasicInfo->LastAccessTime); 00109 CdfsDateTimeToFileTime(Fcb, 00110 &BasicInfo->LastWriteTime); 00111 CdfsDateTimeToFileTime(Fcb, 00112 &BasicInfo->ChangeTime); 00113 00114 CdfsFileFlagsToAttributes(Fcb, 00115 &BasicInfo->FileAttributes); 00116 #endif 00117 00118 *BufferLength -= sizeof(FILE_BASIC_INFORMATION); 00119 00120 return(STATUS_SUCCESS); 00121 } 00122 00123 00124 static NTSTATUS 00125 NtfsGetNameInformation(PFILE_OBJECT FileObject, 00126 PNTFS_FCB Fcb, 00127 PDEVICE_OBJECT DeviceObject, 00128 PFILE_NAME_INFORMATION NameInfo, 00129 PULONG BufferLength) 00130 /* 00131 * FUNCTION: Retrieve the file name information 00132 */ 00133 { 00134 ULONG NameLength; 00135 00136 DPRINT("NtfsGetNameInformation() called\n"); 00137 00138 ASSERT(NameInfo != NULL); 00139 ASSERT(Fcb != NULL); 00140 00141 NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR); 00142 // NameLength = 2; 00143 if (*BufferLength < sizeof(FILE_NAME_INFORMATION) + NameLength) 00144 return(STATUS_BUFFER_OVERFLOW); 00145 00146 NameInfo->FileNameLength = NameLength; 00147 memcpy(NameInfo->FileName, 00148 Fcb->PathName, 00149 NameLength + sizeof(WCHAR)); 00150 // wcscpy(NameInfo->FileName, L"\\"); 00151 00152 *BufferLength -= 00153 (sizeof(FILE_NAME_INFORMATION) + NameLength + sizeof(WCHAR)); 00154 00155 return(STATUS_SUCCESS); 00156 } 00157 00158 00159 static NTSTATUS 00160 NtfsGetInternalInformation(PNTFS_FCB Fcb, 00161 PFILE_INTERNAL_INFORMATION InternalInfo, 00162 PULONG BufferLength) 00163 { 00164 DPRINT("NtfsGetInternalInformation() called\n"); 00165 00166 ASSERT(InternalInfo); 00167 ASSERT(Fcb); 00168 00169 if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION)) 00170 return(STATUS_BUFFER_OVERFLOW); 00171 00172 /* FIXME: get a real index, that can be used in a create operation */ 00173 InternalInfo->IndexNumber.QuadPart = 0; 00174 00175 *BufferLength -= sizeof(FILE_INTERNAL_INFORMATION); 00176 00177 return(STATUS_SUCCESS); 00178 } 00179 00180 00181 NTSTATUS NTAPI 00182 NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject, 00183 PIRP Irp) 00184 /* 00185 * FUNCTION: Retrieve the specified file information 00186 */ 00187 { 00188 FILE_INFORMATION_CLASS FileInformationClass; 00189 PIO_STACK_LOCATION Stack; 00190 PFILE_OBJECT FileObject; 00191 PNTFS_FCB Fcb; 00192 PVOID SystemBuffer; 00193 ULONG BufferLength; 00194 00195 NTSTATUS Status = STATUS_SUCCESS; 00196 00197 DPRINT("NtfsQueryInformation() called\n"); 00198 00199 Stack = IoGetCurrentIrpStackLocation(Irp); 00200 FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass; 00201 FileObject = Stack->FileObject; 00202 Fcb = FileObject->FsContext; 00203 00204 SystemBuffer = Irp->AssociatedIrp.SystemBuffer; 00205 BufferLength = Stack->Parameters.QueryFile.Length; 00206 00207 switch (FileInformationClass) 00208 { 00209 case FileStandardInformation: 00210 Status = NtfsGetStandardInformation(Fcb, 00211 DeviceObject, 00212 SystemBuffer, 00213 &BufferLength); 00214 break; 00215 00216 case FilePositionInformation: 00217 Status = NtfsGetPositionInformation(FileObject, 00218 SystemBuffer, 00219 &BufferLength); 00220 break; 00221 00222 case FileBasicInformation: 00223 Status = NtfsGetBasicInformation(FileObject, 00224 Fcb, 00225 DeviceObject, 00226 SystemBuffer, 00227 &BufferLength); 00228 break; 00229 00230 case FileNameInformation: 00231 Status = NtfsGetNameInformation(FileObject, 00232 Fcb, 00233 DeviceObject, 00234 SystemBuffer, 00235 &BufferLength); 00236 break; 00237 00238 case FileInternalInformation: 00239 Status = NtfsGetInternalInformation(Fcb, 00240 SystemBuffer, 00241 &BufferLength); 00242 break; 00243 00244 case FileAlternateNameInformation: 00245 case FileAllInformation: 00246 Status = STATUS_NOT_IMPLEMENTED; 00247 break; 00248 00249 default: 00250 DPRINT("Unimplemented information class %u\n", FileInformationClass); 00251 Status = STATUS_INVALID_PARAMETER; 00252 } 00253 00254 Irp->IoStatus.Status = Status; 00255 if (NT_SUCCESS(Status)) 00256 Irp->IoStatus.Information = 00257 Stack->Parameters.QueryFile.Length - BufferLength; 00258 else 00259 Irp->IoStatus.Information = 0; 00260 00261 IoCompleteRequest(Irp, IO_NO_INCREMENT); 00262 00263 return(Status); 00264 } 00265 00266 /* EOF */ Generated on Sat May 26 2012 04:26:16 for ReactOS by
1.7.6.1
|