mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:33:01 +00:00
[MSCONFIG_NEW]: Activate OS-version-specific behaviour (ReactOS vs. Windows and pre-Vista vs. post-Vista).
svn path=/trunk/; revision=70728
This commit is contained in:
parent
c6443d2f80
commit
340d1b6e9f
5 changed files with 77 additions and 13 deletions
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
/* Defaults for ReactOS */
|
/* Defaults for ReactOS */
|
||||||
BOOL bIsWindows = FALSE;
|
BOOL bIsWindows = FALSE;
|
||||||
BOOL bIsOSVersionLessThanVista = TRUE;
|
BOOL bIsPreVistaOSVersion = TRUE;
|
||||||
|
|
||||||
/* Language-independent Vendor strings */
|
/* Language-independent Vendor strings */
|
||||||
const LPCWSTR IDS_REACTOS = L"ReactOS";
|
const LPCWSTR IDS_REACTOS = L"ReactOS";
|
||||||
|
@ -232,7 +232,7 @@ HWND CreatePropSheet(HINSTANCE hInstance, HWND hwndOwner, LPCTSTR lpszTitle)
|
||||||
psp[nPages].pfnDlgProc = GeneralPageWndProc;
|
psp[nPages].pfnDlgProc = GeneralPageWndProc;
|
||||||
++nPages;
|
++nPages;
|
||||||
|
|
||||||
// if (bIsOSVersionLessThanVista)
|
// if (bIsPreVistaOSVersion)
|
||||||
{
|
{
|
||||||
/* SYSTEM.INI page */
|
/* SYSTEM.INI page */
|
||||||
if (MyFileExists(lpszSystemIni, NULL))
|
if (MyFileExists(lpszSystemIni, NULL))
|
||||||
|
@ -267,7 +267,7 @@ HWND CreatePropSheet(HINSTANCE hInstance, HWND hwndOwner, LPCTSTR lpszTitle)
|
||||||
|
|
||||||
/* FreeLdr page */
|
/* FreeLdr page */
|
||||||
// TODO: Program the interface for Vista: "light" BCD editor...
|
// TODO: Program the interface for Vista: "light" BCD editor...
|
||||||
if (!bIsWindows || (bIsWindows && bIsOSVersionLessThanVista))
|
if (!bIsWindows || (bIsWindows && bIsPreVistaOSVersion))
|
||||||
{
|
{
|
||||||
LPCWSTR lpszLoaderIniFile = NULL;
|
LPCWSTR lpszLoaderIniFile = NULL;
|
||||||
DWORD dwTabNameId = 0;
|
DWORD dwTabNameId = 0;
|
||||||
|
@ -346,12 +346,12 @@ BOOL Initialize(HINSTANCE hInstance)
|
||||||
INITCOMMONCONTROLSEX InitControls;
|
INITCOMMONCONTROLSEX InitControls;
|
||||||
|
|
||||||
/* Initialize our global version flags */
|
/* Initialize our global version flags */
|
||||||
bIsWindows = TRUE; /* IsWindowsOS(); */ // TODO: Commented for testing purposes...
|
bIsWindows = IsWindowsOS();
|
||||||
bIsOSVersionLessThanVista = TRUE; /* IsOSVersionLessThanVista(); */ // TODO: Commented for testing purposes...
|
bIsPreVistaOSVersion = IsPreVistaOSVersion();
|
||||||
|
|
||||||
/* Initialize global strings */
|
/* Initialize global strings */
|
||||||
szAppName = LoadResourceString(hInstance, IDS_MSCONFIG);
|
szAppName = LoadResourceString(hInstance, IDS_MSCONFIG);
|
||||||
if (!bIsOSVersionLessThanVista)
|
if (!bIsPreVistaOSVersion)
|
||||||
lpszVistaAppName = LoadResourceString(hInstance, IDS_MSCONFIG_2);
|
lpszVistaAppName = LoadResourceString(hInstance, IDS_MSCONFIG_2);
|
||||||
|
|
||||||
/* We use a semaphore in order to have a single-instance application */
|
/* We use a semaphore in order to have a single-instance application */
|
||||||
|
@ -367,7 +367,7 @@ BOOL Initialize(HINSTANCE hInstance)
|
||||||
*/
|
*/
|
||||||
if ( (hSingleWnd && IsWindow(hSingleWnd)) ||
|
if ( (hSingleWnd && IsWindow(hSingleWnd)) ||
|
||||||
( (hSingleWnd = FindWindowW(L"#32770", szAppName)) != NULL ) ||
|
( (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. */
|
/* Found it. Show the window. */
|
||||||
ShowWindow(hSingleWnd, SW_SHOWNORMAL);
|
ShowWindow(hSingleWnd, SW_SHOWNORMAL);
|
||||||
|
@ -377,7 +377,7 @@ BOOL Initialize(HINSTANCE hInstance)
|
||||||
/* Quit this instance of MSConfig */
|
/* Quit this instance of MSConfig */
|
||||||
Success = FALSE;
|
Success = FALSE;
|
||||||
}
|
}
|
||||||
if (!bIsOSVersionLessThanVista) MemFree(lpszVistaAppName);
|
if (!bIsPreVistaOSVersion) MemFree(lpszVistaAppName);
|
||||||
|
|
||||||
/* Quit now if we failed */
|
/* Quit now if we failed */
|
||||||
if (!Success)
|
if (!Success)
|
||||||
|
|
|
@ -5,7 +5,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern BOOL bIsWindows;
|
extern BOOL bIsWindows;
|
||||||
extern BOOL bIsOSVersionLessThanVista;
|
extern BOOL bIsPreVistaOSVersion;
|
||||||
|
|
||||||
extern const LPCWSTR IDS_REACTOS;
|
extern const LPCWSTR IDS_REACTOS;
|
||||||
extern const LPCWSTR IDS_MICROSOFT;
|
extern const LPCWSTR IDS_MICROSOFT;
|
||||||
|
|
|
@ -287,7 +287,7 @@ static void AddService(SC_HANDLE hSCManager, LPENUM_SERVICE_STATUS_PROCESS Servi
|
||||||
|
|
||||||
bAddServiceToList = params.bIsPresent;
|
bAddServiceToList = params.bIsPresent;
|
||||||
|
|
||||||
if (bIsWindows && bIsOSVersionLessThanVista && !bAddServiceToList)
|
if (bIsWindows && bIsPreVistaOSVersion && !bAddServiceToList)
|
||||||
{
|
{
|
||||||
QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] = {};
|
QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] = {};
|
||||||
ValuesQueryTable[0].QueryRoutine = GetRegistryValuedDisabledServicesQueryRoutine;
|
ValuesQueryTable[0].QueryRoutine = GetRegistryValuedDisabledServicesQueryRoutine;
|
||||||
|
@ -935,7 +935,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
KeysQueryTable[0].EntryContext = ¶ms;
|
KeysQueryTable[0].EntryContext = ¶ms;
|
||||||
RegQueryRegistryKeys(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", KeysQueryTable, (PVOID)svcName);
|
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] = {};
|
QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] = {};
|
||||||
ValuesQueryTable[0].QueryRoutine = GetRegistryValuedDisabledServicesQueryRoutine;
|
ValuesQueryTable[0].QueryRoutine = GetRegistryValuedDisabledServicesQueryRoutine;
|
||||||
|
@ -959,7 +959,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
//
|
//
|
||||||
// Delete also the valued-entry of the service.
|
// Delete also the valued-entry of the service.
|
||||||
//
|
//
|
||||||
if (bIsWindows && bIsOSVersionLessThanVista)
|
if (bIsWindows && bIsPreVistaOSVersion)
|
||||||
{
|
{
|
||||||
HKEY hSubKey = NULL;
|
HKEY hSubKey = NULL;
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", 0, KEY_SET_VALUE /*KEY_READ*/, &hSubKey) == ERROR_SUCCESS)
|
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 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
//
|
//
|
||||||
// Save also a valued-entry for the service.
|
// 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);
|
RegSetDWORDValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", svcName, TRUE, lpServiceConfig->dwStartType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,6 +221,67 @@ VOID ClipOrCenterWindowToMonitor(HWND hWnd, UINT flags)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
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
|
LPWSTR
|
||||||
GetExecutableVendor(IN LPCWSTR lpszFilename)
|
GetExecutableVendor(IN LPCWSTR lpszFilename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,9 @@ VOID ClipOrCenterWindowToMonitor(HWND hWnd, UINT flags);
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
BOOL IsWindowsOS(VOID);
|
||||||
|
BOOL IsPreVistaOSVersion(VOID);
|
||||||
|
|
||||||
LPWSTR
|
LPWSTR
|
||||||
GetExecutableVendor(IN LPCWSTR lpszFilename);
|
GetExecutableVendor(IN LPCWSTR lpszFilename);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue