Fix reg type & missing snprintf

This commit is contained in:
wutno 2018-06-11 13:47:47 -04:00 committed by GitHub
parent bc95707618
commit 1c7111c10d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1458,7 +1458,7 @@ void CxbxInitFilePaths()
{ {
LONG result = ERROR_SUCCESS; LONG result = ERROR_SUCCESS;
dwType = REG_DWORD; dwSize = sizeof(szAppData); dwType = REG_SZ; dwSize = sizeof(szAppData);
result = RegQueryValueEx(hKey, "DATALOC", NULL, &dwType, (PBYTE)&szAppData, &dwSize); result = RegQueryValueEx(hKey, "DATALOC", NULL, &dwType, (PBYTE)&szAppData, &dwSize);
if (result != ERROR_SUCCESS) { if (result != ERROR_SUCCESS) {
SHGetSpecialFolderPath(NULL, szAppData, CSIDL_APPDATA, TRUE); //Luke wants default to be %appdata% SHGetSpecialFolderPath(NULL, szAppData, CSIDL_APPDATA, TRUE); //Luke wants default to be %appdata%
@ -1466,6 +1466,8 @@ void CxbxInitFilePaths()
} }
snprintf(szFolder_CxbxReloadedData, MAX_PATH, "%s\\Cxbx-Reloaded", szAppData);
// Make sure our data folder exists : // Make sure our data folder exists :
int result = SHCreateDirectoryEx(nullptr, szFolder_CxbxReloadedData, nullptr); int result = SHCreateDirectoryEx(nullptr, szFolder_CxbxReloadedData, nullptr);
if ((result != ERROR_SUCCESS) && (result != ERROR_ALREADY_EXISTS)) { if ((result != ERROR_SUCCESS) && (result != ERROR_ALREADY_EXISTS)) {