e71f6d3b4f0d477ea383c2b54c75eeaa245aaf5c
[reactos.git] / reactos / drivers / fs / cdfs / finfo.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id: finfo.c,v 1.1 2002/04/15 20:39:49 ekohl Exp $
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: services/fs/cdfs/dirctl.c
24 * PURPOSE: CDROM (ISO 9660) filesystem driver
25 * PROGRAMMER: Art Yerkes
26 * UPDATE HISTORY:
27 */
28
29 /* INCLUDES *****************************************************************/
30
31 #include <ddk/ntddk.h>
32
33 //#define NDEBUG
34 #include <debug.h>
35
36 #include "cdfs.h"
37
38
39 /* FUNCTIONS ****************************************************************/
40
41 static NTSTATUS
42 CdfsQueryNameInformation(PFILE_OBJECT FileObject,
43 PFCB Fcb,
44 PDEVICE_OBJECT DeviceObject,
45 PFILE_NAME_INFORMATION NameInfo,
46 PULONG BufferLength)
47 /*
48 * FUNCTION: Retrieve the file name information
49 */
50 {
51 ULONG NameLength;
52
53 assert (NameInfo != NULL);
54 assert (Fcb != NULL);
55
56 #if 0
57 NameLength = wcslen(FCB->PathName) * sizeof(WCHAR);
58 if (*BufferLength < sizeof(FILE_NAME_INFORMATION) + NameLength)
59 return STATUS_BUFFER_OVERFLOW;
60
61 NameInfo->FileNameLength = NameLength;
62 memcpy(NameInfo->FileName,
63 FCB->PathName,
64 NameLength + sizeof(WCHAR));
65 #endif
66
67 /* Fake name */
68 NameLength = 2;
69 wcscpy(NameInfo->FileName, L"\\");
70
71 *BufferLength -=
72 (sizeof(FILE_NAME_INFORMATION) + NameLength + sizeof(WCHAR));
73
74 return STATUS_SUCCESS;
75 }
76
77
78 NTSTATUS STDCALL
79 CdfsQueryInformation(PDEVICE_OBJECT DeviceObject,
80 PIRP Irp)
81 /*
82 * FUNCTION: Retrieve the specified file information
83 */
84 {
85 FILE_INFORMATION_CLASS FileInformationClass;
86 PIO_STACK_LOCATION Stack;
87 PFILE_OBJECT FileObject;
88 PFCB Fcb;
89 PVOID SystemBuffer;
90 ULONG BufferLength;
91
92 NTSTATUS Status = STATUS_SUCCESS;
93
94 DPRINT1("CdfsQueryInformation() called\n");
95
96 Stack = IoGetCurrentIrpStackLocation(Irp);
97 FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
98 FileObject = Stack->FileObject;
99 Fcb = FileObject->FsContext;
100
101 SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
102 BufferLength = Stack->Parameters.QueryFile.Length;
103
104 switch (FileInformationClass)
105 {
106 #if 0
107 case FileStandardInformation:
108 Status = CdfsGetStandardInformation(Fcb,
109 IrpContext->DeviceObject,
110 SystemBuffer,
111 &BufferLength);
112 break;
113 case FilePositionInformation:
114 RC = CdfsGetPositionInformation(IrpContext->FileObject,
115 FCB,
116 IrpContext->DeviceObject,
117 SystemBuffer,
118 &BufferLength);
119 break;
120 case FileBasicInformation:
121 RC = CdfsGetBasicInformation(FileObject,
122 FCB,
123 DeviceObject,
124 SystemBuffer,
125 &BufferLength);
126 break;
127 #endif
128
129 case FileNameInformation:
130 Status = CdfsQueryNameInformation(FileObject,
131 Fcb,
132 DeviceObject,
133 SystemBuffer,
134 &BufferLength);
135 break;
136
137 #if 0
138 case FileInternalInformation:
139 Status = CdfsGetInternalInformation(Fcb,
140 SystemBuffer,
141 &BufferLength);
142 break;
143
144 case FileAlternateNameInformation:
145 case FileAllInformation:
146 Status = STATUS_NOT_IMPLEMENTED;
147 break;
148 #endif
149 default:
150 DPRINT("Unimplemented information class %u\n", FileInformationClass);
151 Status = STATUS_NOT_SUPPORTED;
152 }
153
154 Irp->IoStatus.Status = Status;
155 if (NT_SUCCESS(Status))
156 Irp->IoStatus.Information =
157 Stack->Parameters.QueryFile.Length - BufferLength;
158 else
159 Irp->IoStatus.Information = 0;
160
161 IoCompleteRequest(Irp, IO_NO_INCREMENT);
162
163 return(Status);
164 }
165
166 /* EOF */