Skip to content

Commit 9040017

Browse files
feat: is_valid in Pointer
1 parent 79f84d4 commit 9040017

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

include/blook/memo.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <type_traits>
1717
#include <vector>
1818

19-
2019
#include "process.h"
2120

2221
namespace blook {
@@ -46,6 +45,7 @@ class Pointer {
4645

4746
std::shared_ptr<Process> proc = nullptr;
4847
bool is_self() const;
48+
bool is_valid() const;
4949

5050
bool operator==(const Pointer &other) const = default;
5151

@@ -163,8 +163,8 @@ class Pointer {
163163
}
164164

165165
inline void write_bytearray(std::wstring_view data) const {
166-
write_bytearray(std::span<const uint8_t>(
167-
(const uint8_t *)data.data(), data.size() * sizeof(wchar_t)));
166+
write_bytearray(std::span<const uint8_t>((const uint8_t *)data.data(),
167+
data.size() * sizeof(wchar_t)));
168168
}
169169

170170
void write_pointer(Pointer ptr) const;
@@ -283,8 +283,6 @@ struct ScopedSetMemoryRWX {
283283
Process::MemoryProtection old_protect;
284284

285285
ScopedSetMemoryRWX(Pointer ptr, size_t size);
286-
ScopedSetMemoryRWX(void *ptr, size_t size)
287-
: ScopedSetMemoryRWX(Pointer(ptr), size) {}
288286
ScopedSetMemoryRWX(const ScopedSetMemoryRWX &) = delete;
289287
ScopedSetMemoryRWX &operator=(const ScopedSetMemoryRWX &) = delete;
290288
ScopedSetMemoryRWX(const MemoryRange &r);

0 commit comments

Comments
 (0)