mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
fixed GetFileAttributes()
svn path=/trunk/; revision=404
This commit is contained in:
parent
73a193b7fe
commit
36322cffcd
4 changed files with 91 additions and 53 deletions
|
@ -1609,7 +1609,26 @@ NTSTATUS FsdGetPositionInformation(PFILE_OBJECT FileObject,
|
||||||
PositionInfo->CurrentByteOffset));
|
PositionInfo->CurrentByteOffset));
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS FsdGetBasicInformation(PFILE_OBJECT FileObject,
|
||||||
|
PVfatFCB FCB,
|
||||||
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
PFILE_BASIC_INFORMATION BasicInfo)
|
||||||
|
{
|
||||||
|
DPRINT("FsdGetBasicInformation()\n");
|
||||||
|
|
||||||
|
// BasicInfo->CreationTime =
|
||||||
|
// BasicInfo->LastAccessTime =
|
||||||
|
// BasicInfo->LastWriteTime =
|
||||||
|
// BasicInfo->ChangeTime =
|
||||||
|
|
||||||
|
BasicInfo->FileAttributes = FCB->entry.Attrib;
|
||||||
|
|
||||||
|
DPRINT("Getting attributes %x\n", BasicInfo->FileAttributes);
|
||||||
|
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS FsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
NTSTATUS FsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
/*
|
/*
|
||||||
|
@ -1655,10 +1674,20 @@ NTSTATUS FsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
SystemBuffer);
|
SystemBuffer);
|
||||||
break;
|
break;
|
||||||
|
case FileBasicInformation:
|
||||||
|
RC = FsdGetBasicInformation(FileObject,
|
||||||
|
FCB,
|
||||||
|
DeviceObject,
|
||||||
|
SystemBuffer);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
RC=STATUS_NOT_IMPLEMENTED;
|
RC=STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = RC;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return RC;
|
return RC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1710,11 +1739,13 @@ NTSTATUS FsdSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
RC = STATUS_NOT_IMPLEMENTED;
|
RC = STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = RC;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return RC;
|
return RC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STDCALL NTSTATUS DriverEntry(PDRIVER_OBJECT _DriverObject,
|
STDCALL NTSTATUS DriverEntry(PDRIVER_OBJECT _DriverObject,
|
||||||
PUNICODE_STRING RegistryPath)
|
PUNICODE_STRING RegistryPath)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <kernel32/kernel32.h>
|
#include <kernel32/kernel32.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
|
@ -402,7 +402,7 @@ DWORD STDCALL GetFileAttributesW(LPCWSTR lpFileName)
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
|
|
||||||
hFile = CreateFileW(lpFileName,
|
hFile = CreateFileW(lpFileName,
|
||||||
GENERIC_READ,
|
FILE_READ_ATTRIBUTES,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
NULL,
|
NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
|
@ -419,7 +419,7 @@ DWORD STDCALL GetFileAttributesW(LPCWSTR lpFileName)
|
||||||
{
|
{
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
SetLastError(RtlNtStatusToDosError(errCode));
|
SetLastError(RtlNtStatusToDosError(errCode));
|
||||||
return 0;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return (DWORD)FileBasic.FileAttributes;
|
return (DWORD)FileBasic.FileAttributes;
|
||||||
|
|
|
@ -37,58 +37,65 @@ NTSTATUS STDCALL ZwQueryInformationFile(HANDLE FileHandle,
|
||||||
ULONG Length,
|
ULONG Length,
|
||||||
FILE_INFORMATION_CLASS FileInformationClass)
|
FILE_INFORMATION_CLASS FileInformationClass)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
PIRP Irp;
|
||||||
PFILE_OBJECT FileObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PIRP Irp;
|
PFILE_OBJECT FileObject;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
PIO_STACK_LOCATION StackPtr;
|
||||||
|
|
||||||
DPRINT("ZwQueryInformation(Handle %x StatBlk %x FileInfo %x Length %d Class %d)\n",
|
DPRINT("ZwQueryInformationFile(Handle %x StatBlk %x FileInfo %x Length %d Class %d)\n",
|
||||||
FileHandle,
|
FileHandle,
|
||||||
IoStatusBlock,
|
IoStatusBlock,
|
||||||
FileInformation,
|
FileInformation,
|
||||||
Length,
|
Length,
|
||||||
FileInformationClass);
|
FileInformationClass);
|
||||||
|
|
||||||
/* Get the file object from the file handle */
|
Status = ObReferenceObjectByHandle(FileHandle,
|
||||||
Status = ObReferenceObjectByHandle(FileHandle,
|
FILE_READ_ATTRIBUTES,
|
||||||
FILE_READ_ATTRIBUTES,
|
IoFileType,
|
||||||
IoFileType,
|
UserMode,
|
||||||
UserMode,
|
(PVOID *)&FileObject,
|
||||||
(PVOID *) &FileObject,
|
NULL);
|
||||||
NULL);
|
if (!NT_SUCCESS(Status))
|
||||||
if (!NT_SUCCESS(Status))
|
{
|
||||||
{
|
return(Status);
|
||||||
return Status;
|
}
|
||||||
}
|
DPRINT("FileObject %x\n", FileObject);
|
||||||
DPRINT("FileObject %x\n", FileObject);
|
|
||||||
|
|
||||||
/* initialize an event object to wait on for the request */
|
|
||||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
||||||
|
|
||||||
/* build the IRP to be sent to the driver for the request */
|
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_QUERY_INFORMATION,
|
DeviceObject = FileObject->DeviceObject;
|
||||||
FileObject->DeviceObject,
|
|
||||||
FileInformation,
|
|
||||||
Length,
|
|
||||||
0,
|
|
||||||
&Event,
|
|
||||||
IoStatusBlock);
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
|
||||||
StackPtr->FileObject = FileObject;
|
|
||||||
StackPtr->Parameters.QueryFile.Length = Length;
|
|
||||||
StackPtr->Parameters.QueryFile.FileInformationClass = FileInformationClass;
|
|
||||||
|
|
||||||
/* Pass the IRP to the FSD (and wait for it if required) */
|
Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
|
||||||
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
|
if (Irp==NULL)
|
||||||
Status = IoCallDriver(FileObject->DeviceObject, Irp);
|
{
|
||||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
ObDereferenceObject(FileObject);
|
||||||
{
|
return STATUS_UNSUCCESSFUL;
|
||||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
}
|
||||||
Status = Irp->IoStatus.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
Irp->UserIosb = IoStatusBlock;
|
||||||
|
Irp->UserEvent = &Event;
|
||||||
|
Irp->UserBuffer=FileInformation;
|
||||||
|
|
||||||
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
|
StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION;
|
||||||
|
StackPtr->MinorFunction = 0;
|
||||||
|
StackPtr->Flags = 0;
|
||||||
|
StackPtr->Control = 0;
|
||||||
|
StackPtr->DeviceObject = DeviceObject;
|
||||||
|
StackPtr->FileObject = FileObject;
|
||||||
|
|
||||||
|
StackPtr->Parameters.QueryFile.FileInformationClass =
|
||||||
|
FileInformationClass;
|
||||||
|
StackPtr->Parameters.QueryFile.Length = Length;
|
||||||
|
|
||||||
|
Status = IoCallDriver(FileObject->DeviceObject,Irp);
|
||||||
|
if (Status==STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||||
|
Status = Irp->IoStatus.Status;
|
||||||
|
}
|
||||||
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS NtSetInformationFile(HANDLE FileHandle,
|
NTSTATUS NtSetInformationFile(HANDLE FileHandle,
|
||||||
|
@ -116,7 +123,7 @@ NTSTATUS ZwSetInformationFile(HANDLE FileHandle,
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
|
||||||
DPRINT("ZwSetInformation(Handle %x StatBlk %x FileInfo %x Length %d Class %d)\n",
|
DPRINT("ZwSetInformationFile(Handle %x StatBlk %x FileInfo %x Length %d Class %d)\n",
|
||||||
FileHandle,
|
FileHandle,
|
||||||
IoStatusBlock,
|
IoStatusBlock,
|
||||||
FileInformation,
|
FileInformation,
|
||||||
|
|
Loading…
Reference in a new issue