api: log Windows error message too when creating folder or file fails

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2021-04-13 12:09:13 +02:00 committed by Jason A. Donenfeld
parent 3a8dbb6ae2
commit d35312d33f

View File

@ -1306,7 +1306,7 @@ static _Return_type_success_(return != FALSE) BOOL SelectDriver(
WCHAR RandomTempSubDirectory[MAX_PATH]; WCHAR RandomTempSubDirectory[MAX_PATH];
if (!CreateTemporaryDirectory(RandomTempSubDirectory)) if (!CreateTemporaryDirectory(RandomTempSubDirectory))
{ {
LastError = LOG(WINTUN_LOG_ERR, L"Failed to create temporary folder %s", RandomTempSubDirectory); LastError = LOG_LAST_ERROR(L"Failed to create temporary folder %s", RandomTempSubDirectory);
goto cleanupExistingAdapters; goto cleanupExistingAdapters;
} }
@ -1330,7 +1330,7 @@ static _Return_type_success_(return != FALSE) BOOL SelectDriver(
!ResourceCopyToFile(SysPath, UseWHQL ? L"wintun-whql.sys" : L"wintun.sys") || !ResourceCopyToFile(SysPath, UseWHQL ? L"wintun-whql.sys" : L"wintun.sys") ||
!ResourceCopyToFile(InfPath, UseWHQL ? L"wintun-whql.inf" : L"wintun.inf")) !ResourceCopyToFile(InfPath, UseWHQL ? L"wintun-whql.inf" : L"wintun.inf"))
{ {
LastError = LOG(WINTUN_LOG_ERR, L"Failed to extract driver"); LastError = LOG_LAST_ERROR(L"Failed to extract driver");
goto cleanupDelete; goto cleanupDelete;
} }
LOG(WINTUN_LOG_INFO, L"Installing driver"); LOG(WINTUN_LOG_INFO, L"Installing driver");