Mercurial > hg
changeset 35549:94a127152e25
win32: allocate buffer of maximum length for GetVolumeInformation()
It's documented that "the maximum buffer size is MAX_PATH+1", which is
slightly larger than 256.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364993(v=vs.85).aspx
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 02 Jan 2018 12:02:25 +0900 |
parents | b14c8bcfbad9 |
children | ed30934165c9 |
files | mercurial/win32.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/win32.py Sun Oct 22 22:49:11 2017 +0900 +++ b/mercurial/win32.py Tue Jan 02 12:02:25 2018 +0900 @@ -8,6 +8,7 @@ from __future__ import absolute_import import ctypes +import ctypes.wintypes as wintypes import errno import msvcrt import os @@ -33,6 +34,7 @@ _HANDLE = ctypes.c_void_p _HWND = _HANDLE _PCCERT_CONTEXT = ctypes.c_void_p +_MAX_PATH = wintypes.MAX_PATH _INVALID_HANDLE_VALUE = _HANDLE(-1).value @@ -460,7 +462,7 @@ _DRIVE_RAMDISK): return None - size = 256 + size = _MAX_PATH + 1 name = ctypes.create_string_buffer(size) if not _kernel32.GetVolumeInformationA(volume, None, 0, None, None, None,