diff options
author | Simon Rozman <simon@rozman.si> | 2020-10-23 22:04:40 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-10-30 16:51:01 +0100 |
commit | 84c066fa798a4d669f9fa3145a29ed9d46db47d5 (patch) | |
tree | 51ddf7fae7fe213e1130daf7f0c306892792a8c7 /api/adapter.c | |
parent | api: connect rundll32 child with parent using stdout and stderr (diff) | |
download | wintun-84c066fa798a4d669f9fa3145a29ed9d46db47d5.tar.xz wintun-84c066fa798a4d669f9fa3145a29ed9d46db47d5.zip |
api: revise logging
RegistryQueryString() may produce one or more "File not found" errors
when called from RegistryQueryStringWait() - which is expected while
waiting. Those errors were annoying and awkward to read in the log.
Furthermore, should RegistryQueryString() fail, it already displays
detailed Windows error message and the parent's logging was simplified
to prevent repetitions in the log.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/adapter.c')
-rw-r--r-- | api/adapter.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/api/adapter.c b/api/adapter.c index d1e8786..878f6ba 100644 --- a/api/adapter.c +++ b/api/adapter.c @@ -391,10 +391,10 @@ GetNetCfgInstanceId(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData, _O if (Key == INVALID_HANDLE_VALUE) return LOG_LAST_ERROR(L"Opening device registry key failed"); WCHAR *ValueStr; - DWORD Result = RegistryQueryString(Key, L"NetCfgInstanceId", &ValueStr); + DWORD Result = RegistryQueryString(Key, L"NetCfgInstanceId", &ValueStr, TRUE); if (Result != ERROR_SUCCESS) { - LOG_ERROR(L"Failed to query NetCfgInstanceId value", Result); + LOG(WINTUN_LOG_ERR, L"Failed to query NetCfgInstanceId value"); goto cleanupKey; } if (FAILED(CLSIDFromString(ValueStr, CfgInstanceID))) @@ -532,10 +532,10 @@ CreateAdapterData( /* Read the NetCfgInstanceId value and convert to GUID. */ WCHAR *ValueStr; - Result = RegistryQueryString(Key, L"NetCfgInstanceId", &ValueStr); + Result = RegistryQueryString(Key, L"NetCfgInstanceId", &ValueStr, TRUE); if (Result != ERROR_SUCCESS) { - LOG_ERROR(L"Failed to query NetCfgInstanceId value", Result); + LOG(WINTUN_LOG_ERR, L"Failed to query NetCfgInstanceId value"); goto cleanupAdapter; } if (FAILED(CLSIDFromString(ValueStr, &(*Adapter)->CfgInstanceID))) @@ -928,10 +928,10 @@ GetTcpipInterfaceRegPath(_In_ const WINTUN_ADAPTER *Adapter, _Out_cap_c_(MAX_REG if (Result != ERROR_SUCCESS) return LOG_ERROR(L"Failed to open registry key", Result); WCHAR *Paths; - Result = RegistryQueryString(TcpipAdapterRegKey, L"IpConfig", &Paths); + Result = RegistryQueryString(TcpipAdapterRegKey, L"IpConfig", &Paths, TRUE); if (Result != ERROR_SUCCESS) { - LOG_ERROR(L"Failed to query IpConfig value", Result); + LOG(WINTUN_LOG_ERR, L"Failed to query IpConfig value"); goto cleanupTcpipAdapterRegKey; } if (!Paths[0]) |