From 48721f541820718c8094a53204590bd809299358 Mon Sep 17 00:00:00 2001 From: Tau Date: Tue, 5 Nov 2019 20:44:00 -0500 Subject: [PATCH] platform/vfs.c: Abort if VFS is misconfigured --- platform/config.c | 4 ++-- platform/vfs.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/platform/config.c b/platform/config.c index 6c6e5d7..8b01d40 100644 --- a/platform/config.c +++ b/platform/config.c @@ -283,7 +283,7 @@ void vfs_config_load(struct vfs_config *cfg, const wchar_t *filename) GetPrivateProfileStringW( L"vfs", L"amfs", - L"E:\\", + L"", cfg->amfs, _countof(cfg->amfs), filename); @@ -291,7 +291,7 @@ void vfs_config_load(struct vfs_config *cfg, const wchar_t *filename) GetPrivateProfileStringW( L"vfs", L"appdata", - L"Y:\\", + L"", cfg->appdata, _countof(cfg->appdata), filename); diff --git a/platform/vfs.c b/platform/vfs.c index 59ee163..689cd44 100644 --- a/platform/vfs.c +++ b/platform/vfs.c @@ -53,6 +53,18 @@ HRESULT vfs_hook_init(const struct vfs_config *config) return S_FALSE; } + if (config->amfs[0] == L'\0') { + dprintf("Vfs: FATAL: AMFS path not specified in INI file\n"); + + return E_FAIL; + } + + if (config->appdata[0] == L'\0') { + dprintf("Vfs: FATAL: APPDATA path not specified in INI file\n"); + + return E_FAIL; + } + home_ok = GetEnvironmentVariableW( L"USERPROFILE", vfs_nthome_real,