Fix access violation when calling get_volumes

Change-Id: I4b4ae831a096af1c94ee713549407de940232201
Closes-Bug: #1785473
This commit is contained in:
Alessandro Pilotti 2018-08-05 15:33:53 +03:00
parent 0368124b54
commit 53a4ee450b

View File

@ -259,6 +259,17 @@ kernel32.GetVolumePathNamesForVolumeNameW.argtypes = [wintypes.LPCWSTR,
wintypes.DWORD)] wintypes.DWORD)]
kernel32.GetVolumePathNamesForVolumeNameW.restype = wintypes.BOOL kernel32.GetVolumePathNamesForVolumeNameW.restype = wintypes.BOOL
kernel32.FindFirstVolumeW.argtypes = [wintypes.LPWSTR, wintypes.DWORD]
kernel32.FindFirstVolumeW.restype = wintypes.HANDLE
kernel32.FindNextVolumeW.argtypes = [wintypes.HANDLE,
wintypes.LPWSTR,
wintypes.DWORD]
kernel32.FindNextVolumeW.restype = wintypes.BOOL
kernel32.FindVolumeClose.argtypes = [wintypes.HANDLE]
kernel32.FindVolumeClose.restype = wintypes.BOOL
iphlpapi.GetIpForwardTable.argtypes = [ iphlpapi.GetIpForwardTable.argtypes = [
ctypes.POINTER(Win32_MIB_IPFORWARDTABLE), ctypes.POINTER(Win32_MIB_IPFORWARDTABLE),
ctypes.POINTER(wintypes.ULONG), ctypes.POINTER(wintypes.ULONG),
@ -1365,7 +1376,6 @@ class WindowsUtils(base.BaseOSUtils):
if handle_volumes == self.INVALID_HANDLE_VALUE: if handle_volumes == self.INVALID_HANDLE_VALUE:
raise exception.WindowsCloudbaseInitException( raise exception.WindowsCloudbaseInitException(
"FindFirstVolumeW failed: %r") "FindFirstVolumeW failed: %r")
try: try:
while True: while True:
volumes.append(volume.value) volumes.append(volume.value)