api: only return top two version nibbles
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
dfd71bb954
commit
64f39cd95d
@ -1070,10 +1070,10 @@ VersionOfInf(_Out_ FILETIME *DriverDate, _Out_ DWORDLONG *DriverVersion)
|
|||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORDLONG
|
static DWORD
|
||||||
VersionOfFile(_In_z_ const WCHAR *Filename)
|
VersionOfFile(_In_z_ const WCHAR *Filename)
|
||||||
{
|
{
|
||||||
DWORDLONG Version = 0;
|
DWORD Version = 0;
|
||||||
DWORD Zero;
|
DWORD Zero;
|
||||||
DWORD Len = GetFileVersionInfoSizeW(Filename, &Zero);
|
DWORD Len = GetFileVersionInfoSizeW(Filename, &Zero);
|
||||||
if (!Len)
|
if (!Len)
|
||||||
@ -1096,7 +1096,7 @@ VersionOfFile(_In_z_ const WCHAR *Filename)
|
|||||||
LOG_LAST_ERROR(L"Failed to get version info root");
|
LOG_LAST_ERROR(L"Failed to get version info root");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
Version = (DWORDLONG)FixedInfo->dwFileVersionLS | ((DWORDLONG)FixedInfo->dwFileVersionMS << 32);
|
Version = FixedInfo->dwFileVersionMS;
|
||||||
out:
|
out:
|
||||||
HeapFree(ModuleHeap, 0, VersionInfo);
|
HeapFree(ModuleHeap, 0, VersionInfo);
|
||||||
return Version;
|
return Version;
|
||||||
@ -1125,10 +1125,10 @@ CreateTemporaryDirectory(_Out_cap_c_(MAX_PATH) WCHAR *RandomTempSubDirectory)
|
|||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORDLONG
|
DWORD
|
||||||
WintunGetVersion(void)
|
WintunGetVersion(void)
|
||||||
{
|
{
|
||||||
DWORDLONG Version = 0;
|
DWORD Version = 0;
|
||||||
PRTL_PROCESS_MODULES Modules;
|
PRTL_PROCESS_MODULES Modules;
|
||||||
ULONG BufferSize = 128 * 1024;
|
ULONG BufferSize = 128 * 1024;
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -190,7 +190,7 @@ typedef WINTUN_STATUS(
|
|||||||
*
|
*
|
||||||
* @return The version number on success, or 0 if failure or Wintun not loaded.
|
* @return The version number on success, or 0 if failure or Wintun not loaded.
|
||||||
*/
|
*/
|
||||||
typedef DWORDLONG(WINAPI *WINTUN_GET_VERSION_FUNC)(void);
|
typedef DWORD(WINAPI *WINTUN_GET_VERSION_FUNC)(void);
|
||||||
|
|
||||||
typedef enum _WINTUN_LOGGER_LEVEL
|
typedef enum _WINTUN_LOGGER_LEVEL
|
||||||
{
|
{
|
||||||
|
@ -314,11 +314,9 @@ main(void)
|
|||||||
goto cleanupQuit;
|
goto cleanupQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORDLONG Version = WintunGetVersion();
|
DWORD Version = WintunGetVersion();
|
||||||
Log(WINTUN_LOG_INFO,
|
Log(WINTUN_LOG_INFO,
|
||||||
L"Wintun v%d.%d.%d.%d loaded",
|
L"Wintun v%u.%u loaded",
|
||||||
(Version >> 48) & 0xff,
|
|
||||||
(Version >> 32) & 0xff,
|
|
||||||
(Version >> 16) & 0xff,
|
(Version >> 16) & 0xff,
|
||||||
(Version >> 0) & 0xff);
|
(Version >> 0) & 0xff);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user