-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathramdisk.h
More file actions
93 lines (77 loc) · 2.53 KB
/
ramdisk.h
File metadata and controls
93 lines (77 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef CRAMDISK_H
#define CRAMDISK_H
#include <QObject>
#include <QChar>
#include <QDebug>
#include <QProcess>
#include <windows.h>
#include <winioctl.h>
#include <shellapi.h>
#include <shlobj.h>
#include <dbt.h>
#include <stdio.h>
#include <stdlib.h>
// ImDisk includes
#include <ntumapi.h>
#include <imdisk.h>
#include <imdproxy.h>
enum
{
IMDISK_CLI_SUCCESS = 0,
IMDISK_CLI_ERROR_DEVICE_NOT_FOUND = 1,
IMDISK_CLI_ERROR_DEVICE_INACCESSIBLE = 2,
IMDISK_CLI_ERROR_CREATE_DEVICE = 3,
IMDISK_CLI_ERROR_DRIVER_NOT_INSTALLED = 4,
IMDISK_CLI_ERROR_DRIVER_WRONG_VERSION = 5,
IMDISK_CLI_ERROR_DRIVER_INACCESSIBLE = 6,
IMDISK_CLI_ERROR_SERVICE_INACCESSIBLE = 7,
IMDISK_CLI_ERROR_FORMAT = 8,
IMDISK_CLI_ERROR_BAD_MOUNT_POINT = 9,
IMDISK_CLI_ERROR_BAD_SYNTAX = 10,
IMDISK_CLI_ERROR_NOT_ENOUGH_MEMORY = 11,
IMDISK_CLI_ERROR_PARTITION_NOT_FOUND = 12,
IMDISK_CLI_ERROR_WRONG_SYNTAX = 13,
IMDISK_CLI_ERROR_FATAL = -1
};
#define DbgOemPrintF(x)
// Wrapper for ImDisk
class CRamDisk : public QObject
{
Q_OBJECT
protected:
explicit CRamDisk(QObject *parent = 0);
~CRamDisk();
public slots:
void unmount();
public:
void mount();
bool wasMounted();
static CRamDisk* getInstance();
static void destroyInstance();
void init();
private:
static const QString driveLetter;
static const quint64 driveSize;
static const QString driveFileSystem;
bool _wasMounted;
static CRamDisk *_instance;
// ============================================
// WinAPI, C-style code, (Hungarian Notation)
// ============================================
private:
DWORD _deviceNumber;
DISK_GEOMETRY _diskGeometry;
LARGE_INTEGER _imageOffset;
private:
INT ImDiskCliRemoveDevice(DWORD DeviceNumber, LPCWSTR MountPoint, BOOL ForceDismount, BOOL EmergencyRemove, BOOL RemoveSettings);
INT ImDiskCliCreateDevice(LPDWORD DeviceNumber, PDISK_GEOMETRY DiskGeometry, PLARGE_INTEGER ImageOffset,
DWORD Flags, LPCWSTR FileName, BOOL NativePath, LPWSTR MountPoint,
BOOL NumericPrint, LPWSTR FormatOptions, BOOL SaveSettings);
INT ImDiskCliFormatDisk(LPCWSTR DevicePath, WCHAR DriveLetter, LPCWSTR FormatOptions);
BOOL ImDiskOemPrintF(FILE *Stream, LPCSTR Message, ...);
VOID PrintLastError(LPCWSTR Prefix);
LPVOID ImDiskCliAssertNotNull(LPVOID Ptr);
BOOL ImDiskCliCheckDriverVersion(HANDLE Device);
BOOL ImDiskCliValidateDriveLetterTarget(LPCWSTR DriveLetter, LPCWSTR ValidTargetPath);
};
#endif // CRAMDISK_H