Show a couple of more error strings when failing to edit registry.

This commit is contained in:
Ludvig Strigeus 2018-09-08 23:31:50 +02:00
parent b0d322dfbd
commit f5072ac340

View file

@ -724,12 +724,17 @@ static void SetStartupFlags(int new_flags) {
if (len < 512) { if (len < 512) {
memcpy(buf + len + 1, L"\" --autostart", sizeof(wchar_t) * 14); memcpy(buf + len + 1, L"\" --autostart", sizeof(wchar_t) * 14);
result = RegSetValueExW(hkey, L"TunSafe", NULL, REG_SZ, (BYTE*)buf, (DWORD)(len + 15) * sizeof(wchar_t)); result = RegSetValueExW(hkey, L"TunSafe", NULL, REG_SZ, (BYTE*)buf, (DWORD)(len + 15) * sizeof(wchar_t));
} else {
RERROR("Unable to add to startup list, filename too long.");
} }
} else { } else {
RegDeleteValueW(hkey, L"TunSafe"); RegDeleteValueW(hkey, L"TunSafe");
} }
RegCloseKey(hkey); RegCloseKey(hkey);
} }
if (result != 0)
RERROR("Unable to modify startup list, error code = 0x%x", (int)result);
RegWriteInt(g_reg_key, "StartupFlags", new_flags); RegWriteInt(g_reg_key, "StartupFlags", new_flags);
bool was_started = g_backend && g_backend->is_started(); bool was_started = g_backend && g_backend->is_started();