aboutsummaryrefslogtreecommitdiffstats
path: root/api/api.h
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-07-24 08:10:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-10-30 16:50:59 +0100
commit28c135b8e17385db724ea83a4341fa69178b15b2 (patch)
treecfc52172737135e8078b7d610be9e86c4774ca66 /api/api.h
parentapi: fix SPDRP_DEVICEDESC zero-termination (diff)
downloadwintun-28c135b8e17385db724ea83a4341fa69178b15b2.tar.xz
wintun-28c135b8e17385db724ea83a4341fa69178b15b2.zip
api: tighten maximum registry key path length
Maximum registry key path length is not 260 (MAX_PATH), but 255 (256 incl. zero terminator). Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/api.h')
-rw-r--r--api/api.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/api/api.h b/api/api.h
index 3998123..e409b8b 100644
--- a/api/api.h
+++ b/api/api.h
@@ -38,16 +38,20 @@ NciInit();
void
NciCleanup();
+#define MAX_REG_PATH \
+ 256 /* Maximum registry path length \
+ https://support.microsoft.com/en-us/help/256986/windows-registry-information-for-advanced-users */
+
WINTUN_STATUS
RegistryOpenKeyWait(
_In_ HKEY Key,
- _In_z_count_c_(MAX_PATH) const WCHAR *Path,
+ _In_z_count_c_(MAX_REG_PATH) const WCHAR *Path,
_In_ DWORD Access,
_In_ DWORD Timeout,
_Out_ HKEY *KeyOut);
WINTUN_STATUS
-RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_PATH) const WCHAR *Path, _In_ DWORD Timeout);
+RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_REG_PATH) const WCHAR *Path, _In_ DWORD Timeout);
WINTUN_STATUS
RegistryGetString(_Inout_ WCHAR **Buf, _In_ DWORD Len, _In_ DWORD ValueType);