# Include "stdafx. h"
# Include <stdio. h>
# Include <windows. h>
# Include <time. h>
# Include <iostream>
# Include <string>
# Include <wininet. h>
# Include <sys \ stat. h>
# Include <cstring>
# Define MAXBLOCKSIZE 1024
Using namespace std;
# Pragma comment (lib, "wininet. lib ")
# Pragma comment (lib, "Version. lib ")
Enum NetVersion {
V_1_0 = 0X1,
V_2_0_SP1 = 0X2,
V_2_0 = 0X4,
V_3_0 = 0X8,
V_3_0_SP1 = 0X10,
V_4_0 = 0x20,
V_5_0 = 0x40
};
Char GetSystemDisk (){
Char str [255];
GetSystemDirectory (_ T (str), 255 );
Return str [0];
}
String ReadRegisteTable (const char * root, LPCTSTR path, LPCTSTR key)
{
HKEY hAppKey;
LPCTSTR WINDS_SERVICE_REGISTRY_KEY = path;
LPCTSTR DATA_FILE_SUB_KEY = key;
Char szDataFile [80];
If (string (root) = string ("HKEY_LOCAL_MACHINE "))
{
Long r = RegOpenKeyEx (
HKEY_LOCAL_MACHINE,
WINDS_SERVICE_REGISTRY_KEY,
0,
KEY_READ,
& HAppKey );
If (ERROR_SUCCESS = r)
{
ULONG cbSize = MAX_PATH * sizeof (TCHAR );
DWORD dwFlag = RegQueryValueEx (
HAppKey,
DATA_FILE_SUB_KEY,
NULL,
NULL,
(LPBYTE) szDataFile, & cbSize );
RegCloseKey (hAppKey );
If (ERROR_SUCCESS = dwFlag)
{
String strDate = szDataFile; // MessageBox (strDate );
Return strDate;
}
Return "";
}
}
If (string (root) = string ("HKEY_CURRENT_USER "))
{
If (ERROR_SUCCESS = RegOpenKeyEx (
HKEY_CURRENT_USER,
WINDS_SERVICE_REGISTRY_KEY,
0,
KEY_READ,
& HAppKey ))
{
ULONG cbSize = MAX_PATH * sizeof (TCHAR );
DWORD dwFlag = RegQueryValueEx (
HAppKey,
DATA_FILE_SUB_KEY,
NULL,
NULL,
(LPBYTE) szDataFile, & cbSize );
RegCloseKey (hAppKey );
If (ERROR_SUCCESS = dwFlag)
{
String strDate = szDataFile; // MessageBox (strDate );
Return strDate;
}
Return "";
}
}
Return "";
}
Void GetIEVersion (){
Char * path = ("SOFTWARE \ Microsoft \ Internet Explorer \\");
String data = ReadRegisteTable ("HKEY_LOCAL_MACHINE", path, "Version ");
Cout <"IE version:" <data <endl;
}
Int GetNetAllVersions (){
HKEY hKey;
LPCTSTR path_V_1_0 = TEXT ("SOFTWARE \ Microsoft \. NETFramework \ v1.0 ");
LPCTSTR path_V_2_0_SP1 = TEXT ("SOFTWARE \ Microsoft \. NETFramework \ v2.0 SP1 ");
LPCTSTR path_V_2_0 = TEXT ("SOFTWARE \ Microsoft \. NETFramework \ v2.0.50727 ");
LPCTSTR path_V_3_0 = TEXT ("SOFTWARE \ Microsoft \. NETFramework \ v3.0 ");
LPCTSTR path_V_3_0_SP1 = TEXT ("SOFTWARE \ Microsoft \. NETFramework \ v3.0 SP1 ");
LPCTSTR path_V_4_0 = TEXT ("SOFTWARE \ Microsoft \. NETFramework \ v4.0.30319 ");
LONG rpath_V_1_0 = RegOpenKeyEx (HKEY_LOCAL_MACHINE, path_V_1_0, 0, KEY_READ, & hKey );
: RegCloseKey (hKey );
LONG rpath_V_2_0_SP1 = RegOpenKeyEx (HKEY_LOCAL_MACHINE, path_V_2_0_SP1, 0, KEY_READ, & hKey );
: RegCloseKey (hKey );
LONG rpath_V_2_0 = RegOpenKeyEx (HKEY_LOCAL_MACHINE, path_V_2_0, 0, KEY_READ, & hKey );
: RegCloseKey (hKey );
LONG rpath_V_3_0 = RegOpenKeyEx (HKEY_LOCAL_MACHINE, path_V_3_0, 0, KEY_READ, & hKey );
: RegCloseKey (hKey );
LONG rpath_V_3_0_SP1 = RegOpenKeyEx (HKEY_LOCAL_MACHINE, path_V_3_0_SP1, 0, KEY_READ, & hKey );
: RegCloseKey (hKey );
LONG rpath_V_4_0 = RegOpenKeyEx (HKEY_LOCAL_MACHINE, path_V_4_0, 0, KEY_READ, & hKey );
: RegCloseKey (hKey );
Int result = 0;
If (rpath_V_1_0 = ERROR_SUCCESS ){
Result = result | NetVersion: V_1_0;
Cout <"the system has installed. NET: V_1_0" <endl;
}
If (rpath_V_2_0_SP1 = ERROR_SUCCESS ){
Result = result | NetVersion: V_2_0_SP1;
Cout <". NET: V_2_0_SP1" <endl;
}
If (rpath_V_2_0 = ERROR_SUCCESS ){
Result = result | NetVersion: V_2_0;
Cout <". NET: V_2_0" <endl;
}
If (rpath_V_3_0 = ERROR_SUCCESS ){
Result = result | NetVersion: V_3_0;
Cout <". NET: V_3_0" <endl;
}
If (rpath_V_3_0_SP1 = ERROR_SUCCESS ){
Result = result | NetVersion: V_3_0_SP1;
Cout <". NET: V_3_0_SP1" <endl;
}
If (rpath_V_4_0 = ERROR_SUCCESS ){
Result = result | NetVersion: V_4_0;
Cout <". NET: V_4_0" <endl;
}
Return result;
}
Int main (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
Int nFunsterStil)
{
GetIEVersion ();
GetNetAllVersions ();
Char p = GetSystemDisk ();
Cout <"System Disk:" <p <endl;
Char;
Cin>;
Return 1;
}