Added version resource to dd and fs.
[reactos.git] / reactos / drivers / fs / np / create.c
1 /* $Id: create.c,v 1.2 1999/12/04 20:58:42 ea Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: services/fs/np/create.c
6 * PURPOSE: Named pipe filesystem
7 * PROGRAMMER: David Welch <welch@cwcom.net>
8 */
9
10 /* INCLUDES ******************************************************************/
11
12 #include <ddk/ntddk.h>
13
14 //#define NDEBUG
15 #include <internal/debug.h>
16
17 #include "npfs.h"
18
19 /* FUNCTIONS *****************************************************************/
20
21 NTSTATUS NpfsCreatePipe(PNPFS_DEVICE_EXTENSION DeviceExt,
22 PFILE_OBJECT FileObject)
23 {
24 PWSTR PipeName;
25 PNPFS_FSCONTEXT PipeDescr;
26 NTSTATUS Status;
27
28 PipeName = wcsrchr(FileObject->FileName.Buffer, L'\\');
29 if (PipeName == NULL)
30 {
31 PipeName = FileObject->FileName.Buffer;
32 }
33
34 PipeDescr = ExAllocatePool(NonPagedPool, sizeof(NPFS_FSCONTEXT));
35 if (PipeDescr == NULL)
36 {
37 return(STATUS_NO_MEMORY);
38 }
39
40 Status = NpfsCreateEntry(PipeName, PipeDescr);
41 if (!NT_SUCCESS(Status))
42 {
43 ExFreePool(PipeDescr);
44 return(Status);
45 }
46
47 FileObject->FsContext = PipeDescr;
48
49 return(Status);
50 }
51
52 NTSTATUS NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
53 {
54 PIO_STACK_LOCATION IoStack;
55 PFILE_OBJECT FileObject;
56 NTSTATUS Status;
57 PNPFS_DEVICE_EXTENSION DeviceExt;
58
59 DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
60 IoStack = IoGetCurrentIrpStackLocation(Irp);
61 FileObject = IoStack->FileObject;
62
63 Status = NpfsCreatePipe(DeviceExt, FileObject);
64
65 Irp->IoStatus.Status = Status;
66 Irp->IoStatus.Information = 0;
67
68 IoCompleteRequest(Irp, IO_NO_INCREMENT);
69
70 return(Status);
71 }
72
73
74 /* EOF */