Merge fixes to SheepShaver

This commit is contained in:
Andrew Tonner 2020-02-12 21:29:44 -08:00
parent 8b44b00da3
commit 831e7a2268
2 changed files with 18 additions and 5 deletions

View File

@ -20,7 +20,7 @@
#include "sysdeps.h"
#include "user_strings.h"
#include "util_windows.h"
// Platform-specific string definitions
user_string_def platform_strings[] = {
@ -86,7 +86,11 @@ static const char *get_volume_name(void)
HKEY hHelpKey;
DWORD key_type, cbData;
static char volume[256];
#ifdef _UNICODE
static char out_volume[256];
#endif
static TCHAR volume[256];
memset(volume, 0, sizeof(volume));
// Try Windows 2000 key first
@ -123,14 +127,19 @@ static const char *get_volume_name(void)
}
// Fix the error that some "tweak" apps do.
if (stricmp(volume, "%USERNAME% on %COMPUTER%") == 0)
volume[0] = '\0';
if (_tcsicmp(volume, TEXT("%USERNAME% on %COMPUTER%")) == 0)
volume[0] = TEXT('\0');
// No volume name found, default to "My Computer"
if (volume[0] == 0)
strcpy(volume, "My Computer");
_tcscpy(volume, TEXT("My Computer"));
#ifdef _UNICODE
strlcpy(out_volume, volume, 256);
return out_volume;
#else
return volume;
#endif
}

View File

@ -327,6 +327,10 @@ uint32 TimeToMacTime(time_t t)
// Convert to number of seconds elapsed since 1-Jan-1904
#ifdef WIN32
if (t == -1) {
// failsafe as this will segfault
return 0;
}
struct tm *local = localtime(&t);
#else
struct tm result;