Author: hbelusca
Date: Sat Feb 13 13:11:39 2016
New Revision: 70728
URL:
http://svn.reactos.org/svn/reactos?rev=70728&view=rev
Log:
[MSCONFIG_NEW]: Activate OS-version-specific behaviour (ReactOS vs. Windows and pre-Vista
vs. post-Vista).
Modified:
trunk/reactos/base/applications/msconfig_new/msconfig.c
trunk/reactos/base/applications/msconfig_new/msconfig.h
trunk/reactos/base/applications/msconfig_new/srvpage.cpp
trunk/reactos/base/applications/msconfig_new/utils.c
trunk/reactos/base/applications/msconfig_new/utils.h
Modified: trunk/reactos/base/applications/msconfig_new/msconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/msconfig.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/msconfig.c [iso-8859-1] Sat Feb 13
13:11:39 2016
@@ -29,7 +29,7 @@
/* Defaults for ReactOS */
BOOL bIsWindows = FALSE;
-BOOL bIsOSVersionLessThanVista = TRUE;
+BOOL bIsPreVistaOSVersion = TRUE;
/* Language-independent Vendor strings */
const LPCWSTR IDS_REACTOS = L"ReactOS";
@@ -232,7 +232,7 @@
psp[nPages].pfnDlgProc = GeneralPageWndProc;
++nPages;
- // if (bIsOSVersionLessThanVista)
+ // if (bIsPreVistaOSVersion)
{
/* SYSTEM.INI page */
if (MyFileExists(lpszSystemIni, NULL))
@@ -267,7 +267,7 @@
/* FreeLdr page */
// TODO: Program the interface for Vista: "light" BCD editor...
- if (!bIsWindows || (bIsWindows && bIsOSVersionLessThanVista))
+ if (!bIsWindows || (bIsWindows && bIsPreVistaOSVersion))
{
LPCWSTR lpszLoaderIniFile = NULL;
DWORD dwTabNameId = 0;
@@ -346,12 +346,12 @@
INITCOMMONCONTROLSEX InitControls;
/* Initialize our global version flags */
- bIsWindows = TRUE; /* IsWindowsOS(); */ // TODO: Commented for testing purposes...
- bIsOSVersionLessThanVista = TRUE; /* IsOSVersionLessThanVista(); */ // TODO:
Commented for testing purposes...
+ bIsWindows = IsWindowsOS();
+ bIsPreVistaOSVersion = IsPreVistaOSVersion();
/* Initialize global strings */
szAppName = LoadResourceString(hInstance, IDS_MSCONFIG);
- if (!bIsOSVersionLessThanVista)
+ if (!bIsPreVistaOSVersion)
lpszVistaAppName = LoadResourceString(hInstance, IDS_MSCONFIG_2);
/* We use a semaphore in order to have a single-instance application */
@@ -367,7 +367,7 @@
*/
if ( (hSingleWnd && IsWindow(hSingleWnd)) ||
( (hSingleWnd = FindWindowW(L"#32770", szAppName)) != NULL ) ||
- (!bIsOSVersionLessThanVista ? ( (hSingleWnd =
FindWindowW(L"#32770", lpszVistaAppName)) != NULL ) : FALSE) )
+ (!bIsPreVistaOSVersion ? ( (hSingleWnd = FindWindowW(L"#32770",
lpszVistaAppName)) != NULL ) : FALSE) )
{
/* Found it. Show the window. */
ShowWindow(hSingleWnd, SW_SHOWNORMAL);
@@ -377,7 +377,7 @@
/* Quit this instance of MSConfig */
Success = FALSE;
}
- if (!bIsOSVersionLessThanVista) MemFree(lpszVistaAppName);
+ if (!bIsPreVistaOSVersion) MemFree(lpszVistaAppName);
/* Quit now if we failed */
if (!Success)
Modified: trunk/reactos/base/applications/msconfig_new/msconfig.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/msconfig.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/msconfig.h [iso-8859-1] Sat Feb 13
13:11:39 2016
@@ -5,7 +5,7 @@
#endif
extern BOOL bIsWindows;
-extern BOOL bIsOSVersionLessThanVista;
+extern BOOL bIsPreVistaOSVersion;
extern const LPCWSTR IDS_REACTOS;
extern const LPCWSTR IDS_MICROSOFT;
Modified: trunk/reactos/base/applications/msconfig_new/srvpage.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/srvpage.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/srvpage.cpp [iso-8859-1] Sat Feb 13
13:11:39 2016
@@ -287,7 +287,7 @@
bAddServiceToList = params.bIsPresent;
- if (bIsWindows && bIsOSVersionLessThanVista &&
!bAddServiceToList)
+ if (bIsWindows && bIsPreVistaOSVersion &&
!bAddServiceToList)
{
QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] = {};
ValuesQueryTable[0].QueryRoutine =
GetRegistryValuedDisabledServicesQueryRoutine;
@@ -935,7 +935,7 @@
KeysQueryTable[0].EntryContext = ¶ms;
RegQueryRegistryKeys(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", KeysQueryTable,
(PVOID)svcName);
- if (bIsWindows && bIsOSVersionLessThanVista
&& !params.bIsPresent)
+ if (bIsWindows && bIsPreVistaOSVersion
&& !params.bIsPresent)
{
QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] =
{};
ValuesQueryTable[0].QueryRoutine =
GetRegistryValuedDisabledServicesQueryRoutine;
@@ -959,7 +959,7 @@
//
// Delete also the valued-entry of the
service.
//
- if (bIsWindows &&
bIsOSVersionLessThanVista)
+ if (bIsWindows &&
bIsPreVistaOSVersion)
{
HKEY hSubKey = NULL;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", 0, KEY_SET_VALUE
/*KEY_READ*/, &hSubKey) == ERROR_SUCCESS)
@@ -1022,7 +1022,7 @@
//
// Save also a valued-entry for the service.
//
- if (bIsWindows && bIsOSVersionLessThanVista)
+ if (bIsWindows && bIsPreVistaOSVersion)
{
RegSetDWORDValue(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", svcName, TRUE,
lpServiceConfig->dwStartType);
}
Modified: trunk/reactos/base/applications/msconfig_new/utils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/utils.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/utils.c [iso-8859-1] Sat Feb 13 13:11:39
2016
@@ -221,6 +221,67 @@
////////////////////////////////////////////////////////////////////////////////
+BOOL IsWindowsOS(VOID)
+{
+ BOOL bIsWindowsOS = FALSE;
+
+ OSVERSIONINFOW osvi = {0};
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+
+ if (!GetVersionExW(&osvi))
+ return FALSE;
+
+ if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)
+ return FALSE;
+
+ /* ReactOS reports as Windows NT 5.2 */
+
+ if ( (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 2) ||
+ (osvi.dwMajorVersion > 5) )
+ {
+ HKEY hKey = NULL;
+
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
+ 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ LONG ret;
+ DWORD dwType = 0, dwBufSize = 0;
+
+ ret = RegQueryValueExW(hKey, L"ProductName", NULL, &dwType,
NULL, &dwBufSize);
+ if (ret == ERROR_SUCCESS && dwType == REG_SZ)
+ {
+ LPTSTR lpszProductName = (LPTSTR)MemAlloc(0, dwBufSize);
+ RegQueryValueExW(hKey, L"ProductName", NULL, &dwType,
(LPBYTE)lpszProductName, &dwBufSize);
+
+ bIsWindowsOS = (FindSubStrI(lpszProductName, _T("Windows")) !=
NULL);
+
+ MemFree(lpszProductName);
+ }
+
+ RegCloseKey(hKey);
+ }
+ }
+ else
+ {
+ bIsWindowsOS = TRUE;
+ }
+
+ return bIsWindowsOS;
+}
+
+BOOL IsPreVistaOSVersion(VOID)
+{
+ OSVERSIONINFOW osvi = {0};
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+
+ if (!GetVersionExW(&osvi))
+ return FALSE;
+
+ /* Vista+-class OSes are NT >= 6 */
+ return ( (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) ? (osvi.dwMajorVersion < 6)
: FALSE );
+}
+
LPWSTR
GetExecutableVendor(IN LPCWSTR lpszFilename)
{
Modified: trunk/reactos/base/applications/msconfig_new/utils.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/utils.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/utils.h [iso-8859-1] Sat Feb 13 13:11:39
2016
@@ -74,6 +74,9 @@
////////////////////////////////////////////////////////////////////////////////
+BOOL IsWindowsOS(VOID);
+BOOL IsPreVistaOSVersion(VOID);
+
LPWSTR
GetExecutableVendor(IN LPCWSTR lpszFilename);