|
@@ -21,30 +21,27 @@ limitations under the License.
|
|
import os
|
|
import os
|
|
import sys
|
|
import sys
|
|
import platform
|
|
import platform
|
|
-import ctypes
|
|
|
|
-
|
|
|
|
-class _OSVERSIONINFOEXW(ctypes.Structure):
|
|
|
|
- _fields_ = [('dwOSVersionInfoSize', ctypes.c_ulong),
|
|
|
|
- ('dwMajorVersion', ctypes.c_ulong),
|
|
|
|
- ('dwMinorVersion', ctypes.c_ulong),
|
|
|
|
- ('dwBuildNumber', ctypes.c_ulong),
|
|
|
|
- ('dwPlatformId', ctypes.c_ulong),
|
|
|
|
- ('szCSDVersion', ctypes.c_wchar*128),
|
|
|
|
- ('wServicePackMajor', ctypes.c_ushort),
|
|
|
|
- ('wServicePackMinor', ctypes.c_ushort),
|
|
|
|
- ('wSuiteMask', ctypes.c_ushort),
|
|
|
|
- ('wProductType', ctypes.c_byte),
|
|
|
|
- ('wReserved', ctypes.c_byte)]
|
|
|
|
-
|
|
|
|
-VER_NT_WORKSTATION = 1
|
|
|
|
-VER_NT_DOMAIN_CONTROLLER = 2
|
|
|
|
-VER_NT_SERVER = 3
|
|
|
|
|
|
|
|
def _get_windows_version():
|
|
def _get_windows_version():
|
|
"""
|
|
"""
|
|
Get's the OS major and minor versions. Returns a tuple of
|
|
Get's the OS major and minor versions. Returns a tuple of
|
|
(OS_MAJOR, OS_MINOR).
|
|
(OS_MAJOR, OS_MINOR).
|
|
"""
|
|
"""
|
|
|
|
+ import ctypes
|
|
|
|
+
|
|
|
|
+ class _OSVERSIONINFOEXW(ctypes.Structure):
|
|
|
|
+ _fields_ = [('dwOSVersionInfoSize', ctypes.c_ulong),
|
|
|
|
+ ('dwMajorVersion', ctypes.c_ulong),
|
|
|
|
+ ('dwMinorVersion', ctypes.c_ulong),
|
|
|
|
+ ('dwBuildNumber', ctypes.c_ulong),
|
|
|
|
+ ('dwPlatformId', ctypes.c_ulong),
|
|
|
|
+ ('szCSDVersion', ctypes.c_wchar*128),
|
|
|
|
+ ('wServicePackMajor', ctypes.c_ushort),
|
|
|
|
+ ('wServicePackMinor', ctypes.c_ushort),
|
|
|
|
+ ('wSuiteMask', ctypes.c_ushort),
|
|
|
|
+ ('wProductType', ctypes.c_byte),
|
|
|
|
+ ('wReserved', ctypes.c_byte)]
|
|
|
|
+
|
|
os_version = _OSVERSIONINFOEXW()
|
|
os_version = _OSVERSIONINFOEXW()
|
|
os_version.dwOSVersionInfoSize = ctypes.sizeof(os_version)
|
|
os_version.dwOSVersionInfoSize = ctypes.sizeof(os_version)
|
|
retcode = ctypes.windll.Ntdll.RtlGetVersion(ctypes.byref(os_version))
|
|
retcode = ctypes.windll.Ntdll.RtlGetVersion(ctypes.byref(os_version))
|
|
@@ -68,6 +65,12 @@ REL_2008R2 = "win2008serverr2"
|
|
REL_2012 = "win2012server"
|
|
REL_2012 = "win2012server"
|
|
REL_2012R2 = "win2012serverr2"
|
|
REL_2012R2 = "win2012serverr2"
|
|
|
|
|
|
|
|
+# windows machine types
|
|
|
|
+VER_NT_WORKSTATION = 1
|
|
|
|
+VER_NT_DOMAIN_CONTROLLER = 2
|
|
|
|
+VER_NT_SERVER = 3
|
|
|
|
+
|
|
|
|
+
|
|
def os_distribution():
|
|
def os_distribution():
|
|
if platform.system() == SYSTEM_WINDOWS:
|
|
if platform.system() == SYSTEM_WINDOWS:
|
|
# windows distribution
|
|
# windows distribution
|