Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
m417z
kdlibcpp
Commits
5be28cda
Commit
5be28cda
authored
Feb 13, 2020
by
ussrhero
Browse files
added getVaState, getVaType
parent
e24cbc85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
kdlib/include/kdlib/dbgtypedef.h
kdlib/include/kdlib/dbgtypedef.h
+11
-1
kdlib/include/kdlib/memaccess.h
kdlib/include/kdlib/memaccess.h
+3
-0
kdlib/source/win/dbgmem.cpp
kdlib/source/win/dbgmem.cpp
+34
-0
No files found.
kdlib/include/kdlib/dbgtypedef.h
View file @
5be28cda
...
...
@@ -134,7 +134,6 @@ enum FileFlag {
};
enum
MemoryProtect
{
PageNoAccess
=
0x00000001
,
PageReadOnly
=
0x00000002
,
PageReadWrite
=
0x00000004
,
...
...
@@ -145,6 +144,17 @@ enum MemoryProtect {
PageExecuteWriteCopy
=
0x00000080
};
enum
MemoryState
{
MemCommit
=
0x1000
,
MemReserve
=
0x2000
,
MemFree
=
0x10000
};
enum
MemoryType
{
MemPrivate
=
0x20000
,
MemMapped
=
0x40000
,
MemImage
=
0x1000000
};
enum
ProcessExitReason
{
ProcessExit
,
...
...
kdlib/include/kdlib/memaccess.h
View file @
5be28cda
...
...
@@ -19,6 +19,9 @@ bool compareMemory( MEMOFFSET_64 addr1, MEMOFFSET_64 addr2, size_t length, bool
MEMOFFSET_64
searchMemory
(
MEMOFFSET_64
beginOffset
,
unsigned
long
length
,
const
std
::
vector
<
char
>&
pattern
);
MEMOFFSET_64
findMemoryRegion
(
MEMOFFSET_64
beginOffset
,
MEMOFFSET_64
&
regionOffset
,
unsigned
long
long
&
regionLength
);
kdlib
::
MemoryProtect
getVaProtect
(
kdlib
::
MEMOFFSET_64
offset
);
kdlib
::
MemoryState
getVaState
(
kdlib
::
MEMOFFSET_64
offset
);
kdlib
::
MemoryType
getVaType
(
kdlib
::
MEMOFFSET_64
offset
);
void
writeMemory
(
MEMOFFSET_64
offset
,
const
void
*
buffer
,
size_t
length
,
bool
phyAddr
=
false
,
unsigned
long
*
written
=
0
);
...
...
kdlib/source/win/dbgmem.cpp
View file @
5be28cda
...
...
@@ -336,5 +336,39 @@ kdlib::MemoryProtect getVaProtect( kdlib::MEMOFFSET_64 offset )
///////////////////////////////////////////////////////////////////////////////
kdlib
::
MemoryState
getVaState
(
kdlib
::
MEMOFFSET_64
offset
)
{
offset
=
addr64
(
offset
);
HRESULT
hres
;
MEMORY_BASIC_INFORMATION64
meminfo
=
{};
hres
=
g_dbgMgr
->
dataspace
->
QueryVirtual
(
offset
,
&
meminfo
);
if
(
FAILED
(
hres
))
throw
MemoryException
(
offset
);
return
static_cast
<
MemoryState
>
(
meminfo
.
State
);
}
///////////////////////////////////////////////////////////////////////////////
kdlib
::
MemoryType
getVaType
(
kdlib
::
MEMOFFSET_64
offset
)
{
offset
=
addr64
(
offset
);
HRESULT
hres
;
MEMORY_BASIC_INFORMATION64
meminfo
=
{};
hres
=
g_dbgMgr
->
dataspace
->
QueryVirtual
(
offset
,
&
meminfo
);
if
(
FAILED
(
hres
))
throw
MemoryException
(
offset
);
return
static_cast
<
MemoryType
>
(
meminfo
.
Type
);
}
///////////////////////////////////////////////////////////////////////////////
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment