xref: /reactos/sdk/include/reactos/drivers/ntddrdsk.h (revision bff53493)
1 /*
2  * PROJECT:         ReactOS Kernel
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            include/reactos/drivers/ntddrdsk.h
5  * PURPOSE:         Constants and types for accessing the RAM disk device
6  * PROGRAMMERS:     ReactOS Portable Systems Group
7  */
8 #ifndef _NTDDRDSK_H_
9 #define _NTDDRDSK_H_
10 
11 #if _MSC_VER > 1000
12 #pragma once
13 #endif
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 //
20 // This guid identifies a RAM disk volume (RamdiskBootDiskGuid)
21 // {D9B257FC-684E-4DCB-AB79-03CFA2F6B750}
22 //
23 DEFINE_GUID(RAMDISK_BOOTDISK_GUID, 0xD9B257FC, 0x684E, 0x4DCB, 0xAB, 0x79, 0x03, 0xCF, 0xA2, 0xF6, 0xB7, 0x50);
24 
25 //
26 // This guid identifies a RAM disk bus
27 // {9D6D66A6-0B0C-4563-9077-A0E9A7955AE4}
28 //
29 DEFINE_GUID(GUID_BUS_TYPE_RAMDISK, 0x9D6D66A6, 0x0B0C, 0x4563, 0x90, 0x77, 0xA0, 0xE9, 0xA7, 0x95, 0x5A, 0xE4);
30 
31 //
32 // Device Name - this string is the name of the device.  It is the name
33 // that should be passed to NtOpenFile when accessing the device.
34 //
35 // Note:  For devices that support multiple units, it should be suffixed
36 //        with the Ascii representation of the unit number.
37 //
38 #define DD_RAMDISK_DEVICE_NAME              "\\Device\\Ramdisk"
39 #define DD_RAMDISK_DEVICE_NAME_U           L"\\Device\\Ramdisk"
40 
41 //
42 // IoControlCode values for ramdisk devices.
43 //
44 #define IOCTL_RAMDISK_BASE                  FILE_DEVICE_VIRTUAL_DISK
45 #define FSCTL_CREATE_RAM_DISK               CTL_CODE(FILE_DEVICE_VIRTUAL_DISK, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
46 
47 //
48 // Disk Types
49 //
50 #define RAMDISK_REGISTRY_DISK               1 // Loaded from the registry
51 #define RAMDISK_MEMORY_MAPPED_DISK          2 // Loaded from a file and mapped in memory
52 #define RAMDISK_BOOT_DISK                   3 // Used as a boot device "ramdisk(0)"
53 #define RAMDISK_WIM_DISK                    4 // Used as an installation device
54 
55 //
56 // Options when creating a ramdisk
57 //
58 typedef struct _RAMDISK_CREATE_OPTIONS
59 {
60     ULONG Readonly:1;
61     ULONG Fixed:1;
62     ULONG NoDriveLetter:1;
63     ULONG NoDosDevice:1;
64     ULONG Hidden:1;
65     ULONG ExportAsCd:1;
66 } RAMDISK_CREATE_OPTIONS;
67 
68 //
69 // This structure is passed in for a FSCTL_CREATE_RAM_DISK call
70 //
71 typedef struct _RAMDISK_CREATE_INPUT
72 {
73     ULONG Version;
74     GUID DiskGuid;
75     ULONG DiskType;
76     RAMDISK_CREATE_OPTIONS Options;
77     LARGE_INTEGER DiskLength;
78     LONG DiskOffset;
79     union
80     {
81         struct
82         {
83             ULONG ViewCount;
84             SIZE_T ViewLength;
85             WCHAR FileName[ANYSIZE_ARRAY];
86         };
87         struct
88         {
89             ULONG_PTR BasePage;
90             WCHAR DriveLetter;
91         };
92         PVOID BaseAddress;
93     };
94 } RAMDISK_CREATE_INPUT, *PRAMDISK_CREATE_INPUT;
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif // _NTDDRDSK_H_
101