MCPcopy Create free account
hub / github.com/ajkhoury/ReClassEx / ReadMemoryStringA

Function ReadMemoryStringA

ReClass/stdafx.cpp:124–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124CStringA ReadMemoryStringA( ULONG_PTR address, SIZE_T max )
125{
126 SIZE_T bytesRead = 0;
127 auto buffer = std::make_unique<char[]>( max + 1 );
128
129 if (ReClassReadMemory( (PVOID)address, (LPVOID)buffer.get( ), max, &bytesRead ) != 0)
130 {
131 for (int i = 0; i < bytesRead; i++)
132 {
133 if (!(buffer[i] > 0x1F && buffer[i] < 0xFF && buffer[i] != 0x7F) && buffer[i] != '\0')
134 buffer[i] = '.';
135 }
136 buffer[bytesRead] = '\0';
137 return CStringA( buffer.get( ) );
138 }
139 else
140 {
141 #ifdef _DEBUG
142 PrintOut( _T( "[ReadMemoryString]: Failed to read memory, GetLastError() = %s" ), Utils::GetLastErrorString( ).GetString( ) );
143 #endif
144 return CStringA( "...." );
145 }
146}
147
148CStringW ReadMemoryStringW( ULONG_PTR address, SIZE_T max )
149{

Callers 1

DrawMethod · 0.85

Calls 2

ReClassReadMemoryFunction · 0.85
GetLastErrorStringFunction · 0.85

Tested by

no test coverage detected