Helper function to return the results of the GetVersionExW Windows API call.
    It is a ctypes Structure that contains Windows OS Version information.

    Returns:
        class: An instance of a class containing version info

def os_version_info_ex():
    '''
    Helper function to return the results of the GetVersionExW Windows API call.
    It is a ctypes Structure that contains Windows OS Version information.

    Returns:
        class: An instance of a class containing version info
    '''
    if not HAS_WIN32:
        return

    class OSVersionInfo(ctypes.Structure):
        _fields_ = (('dwOSVersionInfoSize', DWORD),
                    ('dwMajorVersion', DWORD),
                    ('dwMinorVersion', DWORD),
                    ('dwBuildNumber', DWORD),
                    ('dwPlatformId', DWORD),
                    ('szCSDVersion', WCHAR * 128))

        def __init__(self, *args, **kwds):
            super(OSVersionInfo, self).__init__(*args, **kwds)
            self.dwOSVersionInfoSize = ctypes.sizeof(self)
            kernel32.GetVersionExW(ctypes.byref(self))

    class OSVersionInfoEx(OSVersionInfo):
        _fields_ = (('wServicePackMajor', WORD),
                    ('wServicePackMinor', WORD),
                    ('wSuiteMask', WORD),
                    ('wProductType', BYTE),
                    ('wReserved', BYTE))

    return OSVersionInfoEx()