|
@@ -337,21 +337,23 @@ do_get(const string &key, const string &name, int &data_type, string &data) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
string WindowsRegistry::
|
|
string WindowsRegistry::
|
|
|
format_message(int error_code) {
|
|
format_message(int error_code) {
|
|
|
- LPTSTR buffer;
|
|
|
|
|
|
|
+ PVOID buffer;
|
|
|
DWORD length =
|
|
DWORD length =
|
|
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
|
- NULL, error_code, 0, &buffer, 0, NULL);
|
|
|
|
|
|
|
+ NULL, error_code, 0, (LPTSTR)&buffer, 0, NULL);
|
|
|
if (length == 0) {
|
|
if (length == 0) {
|
|
|
return "Unknown error message";
|
|
return "Unknown error message";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const char *text = (const char *)buffer;
|
|
|
|
|
+
|
|
|
// Strip off \n's and \r's trailing the string.
|
|
// Strip off \n's and \r's trailing the string.
|
|
|
while (length > 0 &&
|
|
while (length > 0 &&
|
|
|
- (buffer[length - 1] == '\r' || buffer[length - 1] == '\n')) {
|
|
|
|
|
|
|
+ (text[length - 1] == '\r' || text[length - 1] == '\n')) {
|
|
|
length--;
|
|
length--;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- string result((const char *)buffer, length);
|
|
|
|
|
|
|
+ string result((const char *)text, length);
|
|
|
LocalFree(buffer);
|
|
LocalFree(buffer);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|