[pywin32-checkins] pywin32/win32/src win32apimodule.cpp,1.51,1.52
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2006-01-10 05:35:55
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26242 Modified Files: win32apimodule.cpp Log Message: GetVersionEx takes an optional param - if 1, we return a longer tuple representing the OSVERSIONINFOEX structure. Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** win32apimodule.cpp 2 Dec 2005 07:51:47 -0000 1.51 --- win32apimodule.cpp 10 Jan 2006 05:35:47 -0000 1.52 *************** *** 2006,2026 **** } ! // @pymethod (int,int,int,int,string)|win32api|GetVersionEx|Returns the current version of Windows, and information about the environment. static PyObject * PyGetVersionEx(PyObject * self, PyObject * args) { ! if (!PyArg_ParseTuple(args, ":GetVersionEx")) return NULL; ! OSVERSIONINFO ver; ! ver.dwOSVersionInfoSize = sizeof(ver); ! if (!::GetVersionEx(&ver)) ! return ReturnAPIError("GetVersionEx"); ! return Py_BuildValue("iiiis", ! // @rdesc The return value is a tuple with the following information.<nl> ! ver.dwMajorVersion, // @tupleitem 0|int|majorVersion|Identifies the major version number of the operating system.<nl> ! ver.dwMinorVersion, // @tupleitem 1|int|minorVersion|Identifies the minor version number of the operating system.<nl> ! ver.dwBuildNumber, // @tupleitem 2|int|buildNumber|Identifies the build number of the operating system in the low-order word. (The high-order word contains the major and minor version numbers.)<nl> ! ver.dwPlatformId, // @tupleitem 3|int|platformId|Identifies the platform supported by the operating system. May be one of VER_PLATFORM_WIN32s, VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT<nl> ! ver.szCSDVersion); // @tupleitem 4|string|version|Contains arbitrary additional information about the operating system. } --- 2006,2050 ---- } ! // @pymethod tuple|win32api|GetVersionEx|Returns the current version of Windows, and information about the environment. static PyObject * PyGetVersionEx(PyObject * self, PyObject * args) { ! // @pyparm int|format|0|The format of the version info to return. ! // May be 0 (for OSVERSIONINFO) or 1 (for OSVERSIONINFOEX) ! int format = 0; ! if (!PyArg_ParseTuple(args, "|i:GetVersionEx", &format)) return NULL; ! if (format == 0) { ! OSVERSIONINFO ver; ! ver.dwOSVersionInfoSize = sizeof(ver); ! if (!::GetVersionEx(&ver)) ! return ReturnAPIError("GetVersionEx"); ! return Py_BuildValue("iiiis", ! // @rdesc The return value is a tuple with the following information.<nl> ! ver.dwMajorVersion, // @tupleitem 0|int|majorVersion|Identifies the major version number of the operating system.<nl> ! ver.dwMinorVersion, // @tupleitem 1|int|minorVersion|Identifies the minor version number of the operating system.<nl> ! ver.dwBuildNumber, // @tupleitem 2|int|buildNumber|Identifies the build number of the operating system in the low-order word. (The high-order word contains the major and minor version numbers.)<nl> ! ver.dwPlatformId, // @tupleitem 3|int|platformId|Identifies the platform supported by the operating system. May be one of VER_PLATFORM_WIN32s, VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT<nl> ! ver.szCSDVersion); // @tupleitem 4|string|version|Contains arbitrary additional information about the operating system. ! } else if (format == 1) { ! OSVERSIONINFOEX ver; ! ver.dwOSVersionInfoSize = sizeof(ver); ! if (!::GetVersionEx((LPOSVERSIONINFO)&ver)) ! return ReturnAPIError("GetVersionEx"); ! return Py_BuildValue("iiiisiiiii", ! // @rdesc or if the format param is 1, the return value is a tuple with:<nl> ! ver.dwMajorVersion, // @tupleitem 0|int|majorVersion|Identifies the major version number of the operating system.<nl> ! ver.dwMinorVersion, // @tupleitem 1|int|minorVersion|Identifies the minor version number of the operating system.<nl> ! ver.dwBuildNumber, // @tupleitem 2|int|buildNumber|Identifies the build number of the operating system in the low-order word. (The high-order word contains the major and minor version numbers.)<nl> ! ver.dwPlatformId, // @tupleitem 3|int|platformId|Identifies the platform supported by the operating system. May be one of VER_PLATFORM_WIN32s, VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT<nl> ! ver.szCSDVersion, // @tupleitem 4|string|version|Contains arbitrary additional information about the operating system. ! ver.wServicePackMajor, // @tupleitem 5|int|wServicePackMajor|Major version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the major version number is 3. If no Service Pack has been installed, the value is zero. ! ver.wServicePackMinor, // @tupleitem 6|int|wServicePackMinor|Minor version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the minor version number is 0. ! ver.wSuiteMask, // @tupleitem 7|int|wSuiteMask|Bit flags that identify the product suites available on the system. This member can be a combination of the VER_SUITE_* values. ! ver.wProductType, // @tupleitem 8|int|wProductType|Additional information about the system. This member can be one of the VER_NT_* values. ! ver.wReserved); // @tupleitem 9|int|wReserved| ! ! } ! return PyErr_Format(PyExc_ValueError, "format must be 0 or 1 (got %d)", format); } |