implement SF 2505422
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt
index 39855c6..2fd7d80 100644
--- a/pyserial/CHANGES.txt
+++ b/pyserial/CHANGES.txt
@@ -320,3 +320,4 @@
 - [Bug 2469098] parity PARITY_MARK, PARITY_SPACE isn't supported on win32
 - [SF 2446218] outWaiting implemented
 - [Bug 2392892] scanwin32.py better exception handling
+- [Bug 2505422] scanwin32.py Vista 64bit compatibility
diff --git a/pyserial/examples/scanwin32.py b/pyserial/examples/scanwin32.py
index 43316ac..6d58d89 100644
--- a/pyserial/examples/scanwin32.py
+++ b/pyserial/examples/scanwin32.py
@@ -55,17 +55,22 @@
     ]
     def __str__(self):
         return "InterfaceClassGuid:%s Flags:%s" % (self.InterfaceClassGuid, self.Flags)
+
 PSP_DEVICE_INTERFACE_DATA = ctypes.POINTER(SP_DEVICE_INTERFACE_DATA)
 
 PSP_DEVICE_INTERFACE_DETAIL_DATA = ctypes.c_void_p
 
+class dummy(ctypes.Structure):
+    _fields_=[("d1",ctypes.DWORD), ("d2",ctypes.CHAR)]
+SIZEOF_SP_DEVICE_INTERFACE_DETAIL_DATA_A = ctypes.sizeof(dummy)
+
 SetupDiDestroyDeviceInfoList = ctypes.windll.setupapi.SetupDiDestroyDeviceInfoList
 SetupDiDestroyDeviceInfoList.argtypes = [HDEVINFO]
 SetupDiDestroyDeviceInfoList.restype = BOOL
 
 SetupDiGetClassDevs = ctypes.windll.setupapi.SetupDiGetClassDevsA
 SetupDiGetClassDevs.argtypes = [ctypes.POINTER(GUID), PCTSTR, HWND, DWORD]
-SetupDiGetClassDevs.restype = ValidHandle #HDEVINFO
+SetupDiGetClassDevs.restype = ValidHandle # HDEVINFO
 
 SetupDiEnumDeviceInterfaces = ctypes.windll.setupapi.SetupDiEnumDeviceInterfaces
 SetupDiEnumDeviceInterfaces.argtypes = [HDEVINFO, PSP_DEVINFO_DATA, ctypes.POINTER(GUID), DWORD, PSP_DEVICE_INTERFACE_DATA]
@@ -113,7 +118,7 @@
             if ctypes.GetLastError() != ERROR_NO_MORE_ITEMS:
                 raise ctypes.WinError()
             break
-        
+
         dwNeeded = DWORD()
         # get the size
         if not SetupDiGetDeviceInterfaceDetail(
@@ -134,7 +139,7 @@
             def __str__(self):
                 return "DevicePath:%s" % (self.DevicePath,)
         idd = SP_DEVICE_INTERFACE_DETAIL_DATA_A()
-        idd.cbSize = 5
+        idd.cbSize = SIZEOF_SP_DEVICE_INTERFACE_DETAIL_DATA_A
         devinfo = SP_DEVINFO_DATA()
         devinfo.cbSize = ctypes.sizeof(devinfo)
         if not SetupDiGetDeviceInterfaceDetail(
@@ -177,7 +182,7 @@
         except AttributeError,msg:
             port_name = "???"
         yield port_name, szFriendlyName.value, szHardwareID.value
-    
+
     SetupDiDestroyDeviceInfoList(g_hdi)