diff options
author | Simon Rozman <simon@rozman.si> | 2020-10-14 13:04:29 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-10-30 16:51:00 +0100 |
commit | 78b7a01eb39bde51cc6b9515ebfe781f2657574c (patch) | |
tree | 90b4dc911033bb1c329968aa9617b298cefef531 /api/registry.c | |
parent | api: implement driver version extraction from .inf file (diff) | |
download | wintun-78b7a01eb39bde51cc6b9515ebfe781f2657574c.tar.xz wintun-78b7a01eb39bde51cc6b9515ebfe781f2657574c.zip |
api: simplify logger macros names
WINTUN_LOGGER_... => LOGGER_... => LOG_...
Those macros are internal, so they don/t need to start with WINTUN_...
Replacing the noun LOGGER_... with the verb LOG_... makes the code more
natural to read now.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/registry.c')
-rw-r--r-- | api/registry.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/api/registry.c b/api/registry.c index 57d948d..e591a46 100644 --- a/api/registry.c +++ b/api/registry.c @@ -15,13 +15,13 @@ OpenKeyWait(_In_ HKEY Key, _Inout_z_ WCHAR *Path, _In_ DWORD Access, _In_ ULONGL HANDLE Event = CreateEventW(NULL, FALSE, FALSE, NULL); if (!Event) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to create event"); + return LOG_LAST_ERROR(L"Failed to create event"); for (;;) { Result = RegNotifyChangeKeyValue(Key, FALSE, REG_NOTIFY_CHANGE_NAME, Event, TRUE); if (Result != ERROR_SUCCESS) { - WINTUN_LOGGER_ERROR(L"Failed to setup notification", Result); + LOG_ERROR(L"Failed to setup notification", Result); break; } @@ -40,7 +40,7 @@ OpenKeyWait(_In_ HKEY Key, _Inout_z_ WCHAR *Path, _In_ DWORD Access, _In_ ULONGL } if (Result != ERROR_FILE_NOT_FOUND && Result != ERROR_PATH_NOT_FOUND) { - WINTUN_LOGGER_ERROR(L"Failed to open", Result); + LOG_ERROR(L"Failed to open", Result); break; } @@ -49,7 +49,7 @@ OpenKeyWait(_In_ HKEY Key, _Inout_z_ WCHAR *Path, _In_ DWORD Access, _In_ ULONGL TimeLeft = 0; if (WaitForSingleObject(Event, (DWORD)TimeLeft) != WAIT_OBJECT_0) { - WINTUN_LOGGER(WINTUN_LOG_ERR, "Timeout waiting"); + LOG(WINTUN_LOG_ERR, "Timeout waiting"); break; } } @@ -145,7 +145,7 @@ RegistryGetString(_Inout_ WCHAR **Buf, _In_ DWORD Len, _In_ DWORD ValueType) DWORD Result = ExpandEnvironmentStringsW(*Buf, Expanded, Len); if (!Result) { - Result = WINTUN_LOGGER_LAST_ERROR(L"Failed to expand environment variables"); + Result = LOG_LAST_ERROR(L"Failed to expand environment variables"); HeapFree(Heap, 0, Expanded); return Result; } @@ -266,7 +266,7 @@ RegistryQuery( return ERROR_SUCCESS; HeapFree(Heap, 0, *Buf); if (Result != ERROR_MORE_DATA) - return WINTUN_LOGGER_ERROR(L"Querying value failed", Result); + return LOG_ERROR(L"Querying value failed", Result); } } @@ -302,7 +302,7 @@ RegistryQueryString(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _Out_ WCHAR **V HeapFree(GetProcessHeap(), 0, *Value); return Result; default: - WINTUN_LOGGER(WINTUN_LOG_ERR, L"Value is not a string"); + LOG(WINTUN_LOG_ERR, L"Value is not a string"); HeapFree(GetProcessHeap(), 0, *Value); return ERROR_INVALID_DATATYPE; } @@ -332,13 +332,13 @@ RegistryQueryStringWait(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _In_ DWORD ULONGLONG Deadline = GetTickCount64() + Timeout; HANDLE Event = CreateEventW(NULL, FALSE, FALSE, NULL); if (!Event) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to create event"); + return LOG_LAST_ERROR(L"Failed to create event"); for (;;) { Result = RegNotifyChangeKeyValue(Key, FALSE, REG_NOTIFY_CHANGE_LAST_SET, Event, TRUE); if (Result != ERROR_SUCCESS) { - WINTUN_LOGGER_ERROR(L"Failed to setup notification", Result); + LOG_ERROR(L"Failed to setup notification", Result); break; } Result = RegistryQueryString(Key, Name, Value); @@ -349,7 +349,7 @@ RegistryQueryStringWait(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _In_ DWORD TimeLeft = 0; if (WaitForSingleObject(Event, (DWORD)TimeLeft) != WAIT_OBJECT_0) { - WINTUN_LOGGER(WINTUN_LOG_ERR, "Timeout waiting"); + LOG(WINTUN_LOG_ERR, "Timeout waiting"); break; } } @@ -375,15 +375,15 @@ RegistryQueryDWORD(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _Out_ DWORD *Val DWORD ValueType, Size = sizeof(DWORD); DWORD Result = RegQueryValueExW(Key, Name, NULL, &ValueType, (BYTE *)Value, &Size); if (Result != ERROR_SUCCESS) - return WINTUN_LOGGER_ERROR(L"Querying failed", Result); + return LOG_ERROR(L"Querying failed", Result); if (ValueType != REG_DWORD) { - WINTUN_LOGGER(WINTUN_LOG_ERR, L"Value is not a DWORD"); + LOG(WINTUN_LOG_ERR, L"Value is not a DWORD"); return ERROR_INVALID_DATATYPE; } if (Size != sizeof(DWORD)) { - WINTUN_LOGGER(WINTUN_LOG_ERR, L"Value size is not 4 bytes"); + LOG(WINTUN_LOG_ERR, L"Value size is not 4 bytes"); return ERROR_INVALID_DATA; } return ERROR_SUCCESS; @@ -410,13 +410,13 @@ RegistryQueryDWORDWait(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _In_ DWORD T ULONGLONG Deadline = GetTickCount64() + Timeout; HANDLE Event = CreateEventW(NULL, FALSE, FALSE, NULL); if (!Event) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to create event"); + return LOG_LAST_ERROR(L"Failed to create event"); for (;;) { Result = RegNotifyChangeKeyValue(Key, FALSE, REG_NOTIFY_CHANGE_LAST_SET, Event, TRUE); if (Result != ERROR_SUCCESS) { - WINTUN_LOGGER_ERROR(L"Failed to setup notification", Result); + LOG_ERROR(L"Failed to setup notification", Result); break; } Result = RegistryQueryDWORD(Key, Name, Value); @@ -427,7 +427,7 @@ RegistryQueryDWORDWait(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _In_ DWORD T TimeLeft = 0; if (WaitForSingleObject(Event, (DWORD)TimeLeft) != WAIT_OBJECT_0) { - WINTUN_LOGGER(WINTUN_LOG_ERR, "Timeout waiting"); + LOG(WINTUN_LOG_ERR, "Timeout waiting"); break; } } |