| 391 | } |
| 392 | |
| 393 | std::wstring HookProcessor::CopyWStringFromBuffer() { |
| 394 | // Allocate a buffer of wchar_t the length of the data in the |
| 395 | // shared memory buffer, plus one extra wide char, so that we |
| 396 | // can null terminate. |
| 397 | int local_buffer_size = GetDataBufferSize() + sizeof(wchar_t); |
| 398 | std::vector<wchar_t> local_buffer(local_buffer_size / sizeof(wchar_t)); |
| 399 | |
| 400 | // Copy the data from the shared memory buffer, and force |
| 401 | // a terminating null char into the local vector, then |
| 402 | // convert to wstring. |
| 403 | CopyDataFromBuffer(local_buffer_size, &local_buffer[0]); |
| 404 | local_buffer[local_buffer.size() - 1] = L'\0'; |
| 405 | std::wstring data = &local_buffer[0]; |
| 406 | return data; |
| 407 | } |
| 408 | |
| 409 | void HookProcessor::ClearBuffer() { |
| 410 | // Zero out the shared buffer |