| 122 | } |
| 123 | |
| 124 | CStringA 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 | |
| 148 | CStringW ReadMemoryStringW( ULONG_PTR address, SIZE_T max ) |
| 149 | { |
no test coverage detected