-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
OperationRemoveStreams.h
62 lines (48 loc) · 1.58 KB
/
OperationRemoveStreams.h
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
#pragma once
#include <regex>
#include "Operation.h"
class OperationRemoveStreams final : public Operation
{
private:
// statics used by command registration utility
static std::wstring GetCommand() { return L"RemoveStreams"; }
static std::wstring GetCommandByName() { return L"RemoveStreamsByName"; }
static ClassFactory<OperationRemoveStreams> RegisteredFactory;
static ClassFactory<OperationRemoveStreams> RegisteredFactoryByName;
// operation specific
std::wregex tRegex;
//
// Definitions below avoid need to install Windows Driver Development Kit
//
typedef struct _IO_STATUS_BLOCK {
union {
NTSTATUS Status;
PVOID Pointer;
};
ULONG_PTR Information;
} IO_STATUS_BLOCK, * PIO_STATUS_BLOCK;
typedef enum _FILE_INFORMATION_CLASS {
FileStreamInformation = 22
} FILE_INFORMATION_CLASS, * PFILE_INFORMATION_CLASS;
#pragma pack(push, 4)
typedef struct _FILE_STREAM_INFORMATION { // Information Class 22
ULONG NextEntryOffset;
ULONG StreamNameLength;
LARGE_INTEGER EndOfStream;
LARGE_INTEGER AllocationSize;
WCHAR StreamName[1];
} FILE_STREAM_INFORMATION, * PFILE_STREAM_INFORMATION;
#pragma pack(pop)
typedef NTSTATUS(NTAPI* NTQUERYINFORMATIONFILE)(
IN HANDLE FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass);
NTQUERYINFORMATIONFILE NtQueryInformationFile;
public:
// overrides
void ProcessObjectAction(ObjectEntry & tObjectEntry) override;
// constructors
OperationRemoveStreams(std::queue<std::wstring> & oArgList, const std::wstring & sCommand);
};