libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
WindowsFunctionCall.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
19#include <introvirt/core/fwd.hh>
22
23#include <functional>
24#include <memory>
25
26namespace introvirt {
27namespace windows {
28
30
32 public:
34 void return_address(const guest_ptr<void>& value) override;
35
36 bool is_return_event(Event& event) const override;
37 void handle_return(Event& event) override;
38 bool returned() const override;
39
45 bool x64() const;
46
48
49 protected:
50 uint64_t raw_return_value() const;
51 void raw_return_value(uint64_t value);
52
53 uint64_t get_argument(unsigned int index) const;
54 void set_argument(unsigned int index, uint64_t value);
55
56 guest_ptr<void> get_address_argument(unsigned int index) const;
57 void set_address_argument(unsigned int index, const guest_ptr<void>& address);
58
60 const Vcpu& vcpu() const;
61
62 WindowsFunctionCall(Event& event, unsigned int argument_count,
64
65 private:
66 uint64_t _get_argument_cdecl(unsigned int index) const;
67 void _set_argument_cdecl(unsigned int index, uint64_t value);
68
69 uint64_t _get_argument_fastcall(unsigned int index) const;
70 void _set_argument_fastcall(unsigned int index, uint64_t value);
71
72 uint64_t _get_argument_x64(unsigned int index) const;
73 void _set_argument_x64(unsigned int index, uint64_t value);
74
75 WindowsEvent* event_;
77
78 std::function<uint64_t(unsigned int)> get_argument_;
79 std::function<void(unsigned int, uint64_t)> set_argument_;
80
81 const uint64_t tid_;
82 uint64_t return_rsp_;
83
84 bool returned_ = false;
85 uint64_t raw_return_value_ = -1;
86
87 bool x64_;
88};
89
90} // namespace windows
91} // namespace introvirt
Interface class for hypervisor events.
Definition Event.hh:43
Base class for function calls.
Definition FunctionCall.hh:33
A class representing a single virtual processor.
Definition Vcpu.hh:33
Definition guest_ptr.hh:88
Definition WindowsEvent.hh:26
Definition WindowsFunctionCall.hh:31
void set_argument(unsigned int index, uint64_t value)
guest_ptr< void > return_address() const override
Get the return address for this function call.
void return_address(const guest_ptr< void > &value) override
Set the return address for this function call.
bool is_return_event(Event &event) const override
Check if the given event is a return event for this function call.
WindowsFunctionCall(Event &event, unsigned int argument_count, WindowsCallType type=WindowsCallType::AUTO)
uint64_t get_argument(unsigned int index) const
void set_address_argument(unsigned int index, const guest_ptr< void > &address)
bool x64() const
Check if the call is from x64 mode.hh>
bool returned() const override
Check if the call has returned.
guest_ptr< void > get_address_argument(unsigned int index) const
void handle_return(Event &event) override
Handle the return event.
Type-safe guest virtual address pointer and guest_ptr template.
WindowsCallType
Definition WindowsFunctionCall.hh:29
Core IntroVirt classes.
Definition Cr0.hh:20