首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

怎么获得操作系统补丁版本详细信息

2012-02-19 
如何获得操作系统补丁版本详细信息? - C++ Builder / Windows SDK/APISDK是vc6的,OSVERSIONINFO结构无wPro

如何获得操作系统补丁版本详细信息? - C++ Builder / Windows SDK/API
SDK是vc6的,OSVERSIONINFO结构无wProductType

不装SDK,如何获得操作系统SP1,SP2,SP3?家庭版,专业版等信息?


[解决办法]
自己定义一个结构就行了,以下代码在VC6和C++Builder6中均编译通过,获取操作系统的详细信息.

C/C++ code
#include <tchar.h>#include <stdio.h>#include <windows.h>#include <shlwapi.h>#define BUFSIZE 256#define PRODUCT_ULTIMATE 0x00000001#define PRODUCT_HOME_BASIC 0x00000002#define PRODUCT_HOME_PREMIUM 0x00000003#define PRODUCT_ENTERPRISE 0x00000004#define PRODUCT_HOME_BASIC_N 0x00000005#define PRODUCT_BUSINESS 0x00000006#define PRODUCT_STANDARD_SERVER 0x00000007#define PRODUCT_DATACENTER_SERVER 0x00000008#define PRODUCT_SMALLBUSINESS_SERVER 0x00000009#define PRODUCT_ENTERPRISE_SERVER 0x0000000A#define PRODUCT_STARTER 0x0000000B#define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C#define PRODUCT_STANDARD_SERVER_CORE 0x0000000D#define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E#define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F#define PRODUCT_BUSINESS_N 0x00000010#define PRODUCT_WEB_SERVER 0x00000011#define PRODUCT_CLUSTER_SERVER 0x00000012#define PRODUCT_HOME_SERVER 0x00000013#define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014#define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019#define PRODUCT_HOME_PREMIUM_N 0x0000001A#define PRODUCT_ENTERPRISE_N 0x0000001B#define PRODUCT_ULTIMATE_N 0x0000001C#define PRODUCT_WEB_SERVER_CORE 0x0000001D#define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E#define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F#define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020#define PRODUCT_SMALLBUSINESS_SERVER_PRIME 0x00000021#define PRODUCT_HOME_PREMIUM_SERVER 0x00000022#define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023#define PRODUCT_STANDARD_SERVER_V 0x00000024#define PRODUCT_DATACENTER_SERVER_V 0x00000025#define PRODUCT_ENTERPRISE_SERVER_V 0x00000026#define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027#define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028#define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029#define PRODUCT_HYPERV 0x0000002A#define SM_TABLETPC 86#define SM_MEDIACENTER 87#define SM_STARTER 88#define SM_SERVERR2 89#define VER_SERVER_NT 0x80000000#define VER_WORKSTATION_NT 0x40000000#define VER_SUITE_SMALLBUSINESS 0x00000001#define VER_SUITE_ENTERPRISE 0x00000002#define VER_SUITE_BACKOFFICE 0x00000004#define VER_SUITE_COMMUNICATIONS 0x00000008#define VER_SUITE_TERMINAL 0x00000010#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020#define VER_SUITE_EMBEDDEDNT 0x00000040#define VER_SUITE_DATACENTER 0x00000080#define VER_SUITE_SINGLEUSERTS 0x00000100#define VER_SUITE_PERSONAL 0x00000200#define VER_SUITE_BLADE 0x00000400#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800#define VER_SUITE_SECURITY_APPLIANCE 0x00001000#define VER_SUITE_STORAGE_SERVER 0x00002000#define VER_SUITE_COMPUTE_SERVER 0x00004000#define VER_SUITE_WH_SERVER 0x00008000#define VER_NT_WORKSTATION              0x0000001#define VER_NT_DOMAIN_CONTROLLER        0x0000002#define VER_NT_SERVER                   0x0000003#define PROCESSOR_ARCHITECTURE_INTEL            0#define PROCESSOR_ARCHITECTURE_MIPS             1#define PROCESSOR_ARCHITECTURE_ALPHA            2#define PROCESSOR_ARCHITECTURE_PPC              3#define PROCESSOR_ARCHITECTURE_SHX              4#define PROCESSOR_ARCHITECTURE_ARM              5#define PROCESSOR_ARCHITECTURE_IA64             6#define PROCESSOR_ARCHITECTURE_ALPHA64          7#define PROCESSOR_ARCHITECTURE_MSIL             8#define PROCESSOR_ARCHITECTURE_AMD64            9#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64    10#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFFtypedef VOID (WINAPI *GETNATIVESYSTEMINFO)(LPSYSTEM_INFO);typedef BOOL (WINAPI *GETPRODUCTINFO)(DWORD , DWORD, DWORD, DWORD, PDWORD);typedef struct _OSVERSIONINFOEXA2 {    DWORD dwOSVersionInfoSize;    DWORD dwMajorVersion;    DWORD dwMinorVersion;    DWORD dwBuildNumber;    DWORD dwPlatformId;    CHAR   szCSDVersion[ 128 ];     // Maintenance string for PSS usage    WORD   wServicePackMajor;    WORD   wServicePackMinor;    WORD   wSuiteMask;    BYTE  wProductType;    BYTE  wReserved;} OSVERSIONINFOEXA2, *POSVERSIONINFOEXA2, *LPOSVERSIONINFOEXA2;typedef struct _OSVERSIONINFOEXW2 {    DWORD dwOSVersionInfoSize;    DWORD dwMajorVersion;    DWORD dwMinorVersion;    DWORD dwBuildNumber;    DWORD dwPlatformId;    WCHAR  szCSDVersion[ 128 ];     // Maintenance string for PSS usage    WORD   wServicePackMajor;    WORD   wServicePackMinor;    WORD   wSuiteMask;    BYTE  wProductType;    BYTE  wReserved;} OSVERSIONINFOEXW2, *POSVERSIONINFOEXW2, *LPOSVERSIONINFOEXW2, RTL_OSVERSIONINFOEXW2, *PRTL_OSVERSIONINFOEXW2;#ifdef UNICODEtypedef OSVERSIONINFOEXW2 OSVERSIONINFOEX2;typedef POSVERSIONINFOEXW2 POSVERSIONINFOEX2;typedef LPOSVERSIONINFOEXW2 LPOSVERSIONINFOEX2;#elsetypedef OSVERSIONINFOEXA2 OSVERSIONINFOEX2;typedef POSVERSIONINFOEXA2 POSVERSIONINFOEX2;typedef LPOSVERSIONINFOEXA2 LPOSVERSIONINFOEX2;#endif // UNICODE 

热点排行