libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
WStr.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 "Utf16String.hh"
19
21#include <introvirt/fwd.hh>
22
23#include <cstdint>
24#include <memory>
25
26namespace introvirt {
27namespace windows {
28
32class WStr : public Utf16String {
33
34 public:
38 uint16_t Length() const override;
39
43 uint16_t MaximumLength() const;
44
48 const uint8_t* Buffer() const override;
49
53 void set(const std::u16string& value) override;
54 using Utf16String::set;
55
60
69
78 WStr(const guest_ptr<void>& ptr, size_t buffer_size);
79
89 WStr(const guest_ptr<void>& ptr, size_t buffer_size, size_t len);
90
91 WStr(WStr&&) noexcept;
92 WStr& operator=(WStr&&) noexcept;
93 ~WStr() override;
94
95 private:
96 guest_ptr<char16_t[]> buf_;
97 size_t len_;
98};
99
100} /* namespace windows */
101} /* namespace introvirt */
Definition guest_ptr.hh:88
Base UTF-16 class.
Definition Utf16String.hh:34
void set(const std::string &value)
Sets the value of the string.
Basic raw UTF-16 string wrapper.
Definition WStr.hh:32
uint16_t MaximumLength() const
WStr(WStr &&) noexcept
const uint8_t * Buffer() const override
WStr(const guest_ptr< void > &ptr, size_t buffer_size)
Parse a UTF16LE string from guest memory.
WStr(const guest_ptr< void > &ptr)
Parse a UTF16LE string from guest memory.
guest_ptr< void > ptr() const
Get the address of the buffer in the guest.
WStr(const guest_ptr< void > &ptr, size_t buffer_size, size_t len)
Parse a UTF16LE string from guest memory.
uint16_t Length() const override
void set(const std::u16string &value) override
Update the buffer with a new value.
Type-safe guest virtual address pointer and guest_ptr template.
Core IntroVirt classes.
Definition Cr0.hh:20