mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 13:42:55 +00:00
Fix formatting
This commit is contained in:
parent
4ec4055e4b
commit
c58f6c9742
@ -49,13 +49,13 @@ namespace vmx
|
||||
if (mtrr_data[i].enabled != FALSE)
|
||||
{
|
||||
mtrr_data[i].physical_address_min = mtrr_base.page_frame_number *
|
||||
MTRR_PAGE_SIZE;
|
||||
MTRR_PAGE_SIZE;
|
||||
|
||||
unsigned long bit{};
|
||||
_BitScanForward64(&bit, mtrr_mask.page_frame_number * MTRR_PAGE_SIZE);
|
||||
mtrr_data[i].physical_address_max = mtrr_data[i].
|
||||
physical_address_min +
|
||||
(1ULL << bit) - 1;
|
||||
physical_address_min +
|
||||
(1ULL << bit) - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ namespace vmx
|
||||
this->epml4[0].write_access = 1;
|
||||
this->epml4[0].execute_access = 1;
|
||||
this->epml4[0].page_frame_number = memory::get_physical_address(&this->epdpt) /
|
||||
PAGE_SIZE;
|
||||
PAGE_SIZE;
|
||||
|
||||
// --------------------------
|
||||
|
||||
@ -232,7 +232,7 @@ namespace vmx
|
||||
{
|
||||
this->epde[i][j].page_frame_number = (i * 512) + j;
|
||||
this->epde[i][j].memory_type = mtrr_adjust_effective_memory_type(
|
||||
mtrr_data, this->epde[i][j].page_frame_number * 2_mb, MEMORY_TYPE_WRITE_BACK);
|
||||
mtrr_data, this->epde[i][j].page_frame_number * 2_mb, MEMORY_TYPE_WRITE_BACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -366,7 +366,7 @@ namespace vmx
|
||||
if (translation_hint)
|
||||
{
|
||||
physical_address = translation_hint->physical_base_address + ADDRMASK_EPT_PML1_OFFSET(
|
||||
reinterpret_cast<uint64_t>(destination));
|
||||
reinterpret_cast<uint64_t>(destination));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -50,6 +50,6 @@ namespace utils
|
||||
finally(F&& f) noexcept
|
||||
{
|
||||
return final_action<typename std::remove_cv<typename std::remove_reference<F>::type>::type>(
|
||||
std::forward<F>(f));
|
||||
std::forward<F>(f));
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,8 @@ namespace
|
||||
});
|
||||
|
||||
memcpy(buffer.get(), request.source_data, request.source_data_size);
|
||||
translation_hints = generate_translation_hints(request.process_id, request.target_address, request.source_data_size);
|
||||
translation_hints = generate_translation_hints(request.process_id, request.target_address,
|
||||
request.source_data_size);
|
||||
|
||||
if (!translation_hints)
|
||||
{
|
||||
@ -153,7 +154,7 @@ namespace
|
||||
}
|
||||
|
||||
_Function_class_(DRIVER_DISPATCH) NTSTATUS io_ctl_handler(
|
||||
PDEVICE_OBJECT /*device_object*/, const PIRP irp)
|
||||
PDEVICE_OBJECT /*device_object*/, const PIRP irp)
|
||||
{
|
||||
PAGED_CODE()
|
||||
|
||||
|
@ -13,9 +13,9 @@ _IRQL_requires_min_(PASSIVE_LEVEL)
|
||||
_IRQL_requires_same_
|
||||
VOID
|
||||
KeGenericCallDpc(
|
||||
_In_ PKDEFERRED_ROUTINE Routine,
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
_In_ PKDEFERRED_ROUTINE Routine,
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
@ -24,8 +24,8 @@ _IRQL_requires_(DISPATCH_LEVEL)
|
||||
_IRQL_requires_same_
|
||||
VOID
|
||||
KeSignalCallDpcDone(
|
||||
_In_ PVOID SystemArgument1
|
||||
);
|
||||
_In_ PVOID SystemArgument1
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
@ -34,8 +34,8 @@ _IRQL_requires_(DISPATCH_LEVEL)
|
||||
_IRQL_requires_same_
|
||||
LOGICAL
|
||||
KeSignalCallDpcSynchronize(
|
||||
_In_ PVOID SystemArgument2
|
||||
);
|
||||
_In_ PVOID SystemArgument2
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
@ -45,13 +45,13 @@ _IRQL_requires_max_(DISPATCH_LEVEL)
|
||||
NTKERNELAPI
|
||||
_When_(return != NULL, _Post_writable_byte_size_ (NumberOfBytes)) PVOID
|
||||
MmAllocateContiguousNodeMemory(
|
||||
_In_ SIZE_T NumberOfBytes,
|
||||
_In_ PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||
_In_ PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||
_In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple,
|
||||
_In_ ULONG Protect,
|
||||
_In_ NODE_REQUIREMENT PreferredNode
|
||||
);
|
||||
_In_ SIZE_T NumberOfBytes,
|
||||
_In_ PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||
_In_ PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||
_In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple,
|
||||
_In_ ULONG Protect,
|
||||
_In_ NODE_REQUIREMENT PreferredNode
|
||||
);
|
||||
#endif
|
||||
|
||||
// ----------------------------------------
|
||||
@ -60,8 +60,8 @@ NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
RtlCaptureContext(
|
||||
_Out_ PCONTEXT ContextRecord
|
||||
);
|
||||
_Out_ PCONTEXT ContextRecord
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
@ -79,34 +79,34 @@ typedef struct _KAPC_STATE
|
||||
NTKERNELAPI
|
||||
VOID
|
||||
KeStackAttachProcess(
|
||||
__inout PEPROCESS PROCESS,
|
||||
__out PRKAPC_STATE ApcState
|
||||
);
|
||||
__inout PEPROCESS PROCESS,
|
||||
__out PRKAPC_STATE ApcState
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
NTKERNELAPI
|
||||
VOID
|
||||
KeUnstackDetachProcess(
|
||||
__in PRKAPC_STATE ApcState
|
||||
);
|
||||
__in PRKAPC_STATE ApcState
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
NTKERNELAPI
|
||||
NTSTATUS
|
||||
PsLookupProcessByProcessId(
|
||||
IN HANDLE ProcessId,
|
||||
OUT PEPROCESS* Process
|
||||
);
|
||||
IN HANDLE ProcessId,
|
||||
OUT PEPROCESS* Process
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
NTKERNELAPI
|
||||
PVOID
|
||||
PsGetProcessSectionBaseAddress(
|
||||
__in PEPROCESS Process
|
||||
);
|
||||
__in PEPROCESS Process
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
@ -114,16 +114,16 @@ NTKERNELAPI
|
||||
PPEB
|
||||
NTAPI
|
||||
PsGetProcessPeb(
|
||||
IN PEPROCESS Process
|
||||
);
|
||||
IN PEPROCESS Process
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
NTKERNELAPI
|
||||
PCSTR
|
||||
PsGetProcessImageFileName(
|
||||
__in PEPROCESS Process
|
||||
);
|
||||
__in PEPROCESS Process
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
@ -131,18 +131,18 @@ __kernel_entry NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateFile(
|
||||
_Out_ PHANDLE FileHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_Out_ PIO_STATUS_BLOCK IoStatusBlock,
|
||||
_In_opt_ PLARGE_INTEGER AllocationSize,
|
||||
_In_ ULONG FileAttributes,
|
||||
_In_ ULONG ShareAccess,
|
||||
_In_ ULONG CreateDisposition,
|
||||
_In_ ULONG CreateOptions,
|
||||
_In_reads_bytes_opt_(EaLength) PVOID EaBuffer,
|
||||
_In_ ULONG EaLength
|
||||
);
|
||||
_Out_ PHANDLE FileHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_Out_ PIO_STATUS_BLOCK IoStatusBlock,
|
||||
_In_opt_ PLARGE_INTEGER AllocationSize,
|
||||
_In_ ULONG FileAttributes,
|
||||
_In_ ULONG ShareAccess,
|
||||
_In_ ULONG CreateDisposition,
|
||||
_In_ ULONG CreateOptions,
|
||||
_In_reads_bytes_opt_(EaLength) PVOID EaBuffer,
|
||||
_In_ ULONG EaLength
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace process
|
||||
this->own_ = obj.own_;
|
||||
this->handle_ = obj.handle_;
|
||||
|
||||
if(this->own_ && this->handle_)
|
||||
if (this->own_ && this->handle_)
|
||||
{
|
||||
ObReferenceObject(this->handle_);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ sleep_callback::sleep_callback(callback_function&& callback)
|
||||
PCALLBACK_OBJECT callback_object{};
|
||||
UNICODE_STRING callback_name = RTL_CONSTANT_STRING(L"\\Callback\\PowerState");
|
||||
OBJECT_ATTRIBUTES object_attributes = RTL_CONSTANT_OBJECT_ATTRIBUTES(
|
||||
&callback_name, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE);
|
||||
&callback_name, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE);
|
||||
|
||||
const auto _ = utils::finally([&callback_object]()
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace std
|
||||
// TEMPLATE FUNCTION forward
|
||||
template <class _Ty>
|
||||
constexpr _Ty&& forward(
|
||||
typename remove_reference<_Ty>::type& _Arg)
|
||||
typename remove_reference<_Ty>::type& _Arg)
|
||||
{
|
||||
// forward an lvalue as either an lvalue or an rvalue
|
||||
return (static_cast<_Ty&&>(_Arg));
|
||||
@ -46,7 +46,7 @@ namespace std
|
||||
|
||||
template <class _Ty>
|
||||
constexpr _Ty&& forward(
|
||||
typename remove_reference<_Ty>::type&& _Arg)
|
||||
typename remove_reference<_Ty>::type&& _Arg)
|
||||
{
|
||||
// forward an rvalue as an rvalue
|
||||
return (static_cast<_Ty&&>(_Arg));
|
||||
@ -134,12 +134,21 @@ namespace std
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
struct remove_extent { typedef T type; };
|
||||
template <class T>
|
||||
struct remove_extent
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_extent<T[]> { typedef T type; };
|
||||
template <class T>
|
||||
struct remove_extent<T[]>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct remove_extent<T[N]> { typedef T type; };
|
||||
template <class T, std::size_t N>
|
||||
struct remove_extent<T[N]>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ bool driver_device::send(const DWORD ioctl_code, const data& input, data& output
|
||||
static_cast<DWORD>(output.size()),
|
||||
&size_returned,
|
||||
nullptr
|
||||
) != FALSE;
|
||||
) != FALSE;
|
||||
|
||||
if (success && size_returned < output.size())
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ std::vector<uint8_t> load_resource(const int id)
|
||||
auto* const handle = LoadResource(nullptr, res);
|
||||
if (!handle) return {};
|
||||
|
||||
const auto* data_ptr =static_cast<uint8_t*>(LockResource(handle));
|
||||
const auto* data_ptr = static_cast<uint8_t*>(LockResource(handle));
|
||||
const auto data_size = SizeofResource(nullptr, res);
|
||||
|
||||
std::vector<uint8_t> data{};
|
||||
@ -78,7 +78,7 @@ void unsafe_main(const int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
const auto driver_file = extract_driver();
|
||||
|
||||
driver driver{ driver_file, "MomoLul"};
|
||||
driver driver{driver_file, "MomoLul"};
|
||||
const driver_device driver_device{R"(\\.\HelloDev)"};
|
||||
|
||||
std::string pid_str{};
|
||||
|
Loading…
x
Reference in New Issue
Block a user