]> mj.ucw.cz Git - pciutils.git/commit
libpci: win32-kldbg: Fix driver constructing path
authorPali Rohár <pali@kernel.org>
Thu, 17 Aug 2023 19:15:02 +0000 (21:15 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 29 Dec 2023 13:30:02 +0000 (14:30 +0100)
commit8c22b2c473815c6b19c4b6cfa32229e405b9c367
tree3329253769d733ddb9687d3bd12dc9453ee9d26c
parent6e50724345522dce3f74f076dc2a0662956ba933
libpci: win32-kldbg: Fix driver constructing path

Get*Directory() functions have strange API. When called with zero buffer
they return length of the required buffer for storing path including
nul-term in TCHAR units (which is 1 for ANSI builds and 2 for UNICODE
builds). When called with non-zero buffer which can store full path they
return length of the path without nul-term (again in TCHAR units).

GetWindowsDirectory() function returns HOME user folder if application is
running on the Terminal Server. So this function is not suitable.

Fix calculation of path buffer for UNICODE builds and instead of usage
GetWindowsDirectory() function with concatenating "\\system32" string, use
function GetSystemDirectory() which returns path directly to system32
folder and which works correctly also on Terminal Server (per KB281316).
lib/win32-kldbg.c