libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
FILE_OBJECT.hh
Go to the documentation of this file.
1/*
2 * Copyright 2021 Assured Information Security, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include "OBJECT.hh"
19
21
22#include <string>
23
24namespace introvirt {
25namespace windows {
26namespace nt {
27
29 public:
30 bool FO_FILE_OPEN() const;
31 bool FO_SYNCHRONOUS_IO() const;
32 bool FO_ALERTABLE_IO() const;
34 bool FO_WRITE_THROUGH() const;
35 bool FO_SEQUENTIAL_ONLY() const;
36 bool FO_CACHE_SUPPORTED() const;
37 bool FO_NAMED_PIPE() const;
38 bool FO_STREAM_FILE() const;
39 bool FO_MAILSLOT() const;
43 bool FO_FILE_MODIFIED() const;
45 bool FO_CLEANUP_COMPLETE() const;
46 bool FO_TEMPORARY_FILE() const;
47 bool FO_DELETE_ON_CLOSE() const;
49 bool FO_HANDLE_CREATED() const;
51 bool FO_RANDOM_ACCESS() const;
53 bool FO_VOLUME_OPEN() const;
54 bool FO_REMOTE_ORIGIN() const;
56 bool FO_SKIP_SET_EVENT() const;
57 bool FO_SKIP_SET_FAST_IO() const;
58 uint32_t value() const { return value_; }
59
60 FileObjectFlags(uint32_t value) : value_(value) {}
61
62 private:
63 const uint32_t value_;
64};
65
66class FILE_OBJECT : public OBJECT {
67 public:
68 virtual const DEVICE_OBJECT* DeviceObject() const = 0;
69 virtual std::string FileName() const = 0;
70
71 virtual bool DeletePending() const = 0;
72 virtual void DeletePending(bool value) = 0;
73
74 virtual FileObjectFlags Flags() const = 0;
75 virtual void Flags(FileObjectFlags flags) = 0;
76
77 virtual bool DeleteAccess() const = 0;
78 virtual void DeleteAccess(bool value) = 0;
79
80 virtual bool SharedDelete() const = 0;
81 virtual void SharedDelete(bool value) = 0;
82
86 virtual std::string drive_letter() const = 0;
87
91 virtual std::string full_path() const = 0;
92
93 static std::shared_ptr<FILE_OBJECT> make_shared(const NtKernel& kernel,
94 const guest_ptr<void>& ptr);
95
96 static std::shared_ptr<FILE_OBJECT> make_shared(const NtKernel& kernel,
97 std::unique_ptr<OBJECT_HEADER>&& object_header);
98
99 virtual ~FILE_OBJECT() = default;
100};
101
102} /* namespace nt */
103} /* namespace windows */
104} /* namespace introvirt */
Definition guest_ptr.hh:88
Class for the Windows NT DEVICE_OBJECT structure.
Definition DEVICE_OBJECT.hh:38
Definition FILE_OBJECT.hh:66
virtual bool DeletePending() const =0
virtual void DeleteAccess(bool value)=0
virtual const DEVICE_OBJECT * DeviceObject() const =0
virtual bool DeleteAccess() const =0
virtual FileObjectFlags Flags() const =0
virtual void SharedDelete(bool value)=0
virtual void Flags(FileObjectFlags flags)=0
virtual bool SharedDelete() const =0
virtual void DeletePending(bool value)=0
static std::shared_ptr< FILE_OBJECT > make_shared(const NtKernel &kernel, const guest_ptr< void > &ptr)
virtual std::string FileName() const =0
virtual std::string full_path() const =0
Get the full path, drive letter included.
virtual std::string drive_letter() const =0
Get the drive letter of the file object.
static std::shared_ptr< FILE_OBJECT > make_shared(const NtKernel &kernel, std::unique_ptr< OBJECT_HEADER > &&object_header)
Definition FILE_OBJECT.hh:28
uint32_t value() const
Definition FILE_OBJECT.hh:58
FileObjectFlags(uint32_t value)
Definition FILE_OBJECT.hh:60
Abstraction for the Windows NT kernel.
Definition NtKernel.hh:37
Base class for all kernel objects.
Definition OBJECT.hh:30
virtual guest_ptr< void > ptr() const =0
Core IntroVirt classes.
Definition Cr0.hh:20