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/resource.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 '')
-rw-r--r-- | api/resource.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/api/resource.c b/api/resource.c index 4c5be64..b59911e 100644 --- a/api/resource.c +++ b/api/resource.c @@ -21,17 +21,17 @@ ResourceGetAddress(_In_z_ const WCHAR *ResourceName, _Out_ const VOID **Address, { HRSRC FoundResource = FindResourceW(ResourceModule, ResourceName, RT_RCDATA); if (!FoundResource) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to find resource"); + return LOG_LAST_ERROR(L"Failed to find resource"); *Size = SizeofResource(ResourceModule, FoundResource); if (!*Size) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to size resource"); + return LOG_LAST_ERROR(L"Failed to size resource"); HGLOBAL LoadedResource = LoadResource(ResourceModule, FoundResource); if (!LoadedResource) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to load resource"); + return LOG_LAST_ERROR(L"Failed to load resource"); *Address = LockResource(LoadedResource); if (!*Address) { - WINTUN_LOGGER(WINTUN_LOG_ERR, L"Failed to lock resource"); + LOG(WINTUN_LOG_ERR, L"Failed to lock resource"); return ERROR_LOCK_FAILED; } return ERROR_SUCCESS; @@ -58,7 +58,7 @@ ResourceCopyToFile( DWORD SizeResource; DWORD Result = ResourceGetAddress(ResourceName, &LockedResource, &SizeResource); if (Result != ERROR_SUCCESS) - return WINTUN_LOGGER_ERROR("Failed to locate resource", Result); + return LOG_ERROR("Failed to locate resource", Result); HANDLE DestinationHandle = CreateFileW( DestinationPath, GENERIC_WRITE, @@ -68,13 +68,13 @@ ResourceCopyToFile( FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY, NULL); if (DestinationHandle == INVALID_HANDLE_VALUE) - return WINTUN_LOGGER_LAST_ERROR(L"Failed to create file"); + return LOG_LAST_ERROR(L"Failed to create file"); DWORD BytesWritten; if (!WriteFile(DestinationHandle, LockedResource, SizeResource, &BytesWritten, NULL)) - Result = WINTUN_LOGGER_LAST_ERROR(L"Failed to write file"); + Result = LOG_LAST_ERROR(L"Failed to write file"); if (BytesWritten != SizeResource) { - WINTUN_LOGGER(WINTUN_LOG_ERR, L"Incomplete write"); + LOG(WINTUN_LOG_ERR, L"Incomplete write"); Result = Result != ERROR_SUCCESS ? Result : ERROR_WRITE_FAULT; } CloseHandle(DestinationHandle); |