[ros-diffs] [gedmurphy] 44487: [SYSDM] - Add a setting to the system control panel applet which allows users to force reactos to report as a workstation. - This is a usermode change only, it will not alter the kernel nor anything calling kernel apis (e.g. RtlGetVersion) - This change should allow applications which don't allow installation on non-workstation version to install. See issue #5003 for more details.

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Wed Dec 9 17:34:05 CET 2009


Author: gedmurphy
Date: Wed Dec  9 17:34:05 2009
New Revision: 44487

URL: http://svn.reactos.org/svn/reactos?rev=44487&view=rev
Log:
[SYSDM]
- Add a setting to the system control panel applet which allows users to force reactos to report as a workstation.
- This is a usermode change only, it will not alter the kernel nor anything calling kernel apis (e.g. RtlGetVersion)
- This change should allow applications which don't allow installation on non-workstation version to install.
See issue #5003 for more details.

Modified:
    trunk/reactos/dll/cpl/sysdm/advanced.c
    trunk/reactos/dll/cpl/sysdm/lang/en-US.rc
    trunk/reactos/dll/cpl/sysdm/resource.h

Modified: trunk/reactos/dll/cpl/sysdm/advanced.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/advanced.c?rev=44487&r1=44486&r2=44487&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/advanced.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/sysdm/advanced.c [iso-8859-1] Wed Dec  9 17:34:05 2009
@@ -4,13 +4,111 @@
  * FILE:        dll/cpl/sysdm/advanced.c
  * PURPOSE:     Memory, start-up and profiles settings
  * COPYRIGHT:   Copyright Thomas Weidenmueller <w3seek at reactos.org>
-                Copyright 2006 Ged Murphy <gedmurphy at gmail.com>
+                Copyright 2006 - 2009 Ged Murphy <gedmurphy at reactos.org>
  *
  */
 
 #include "precomp.h"
 
 static TCHAR BugLink[] = _T("http://www.reactos.org/bugzilla");
+static TCHAR ReportAsWorkstationKey[] = _T("SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version");
+
+
+static VOID
+OnOK(HWND hwndDlg)
+{
+    HKEY hKey;
+    DWORD ReportAsWorkstation;
+
+    ReportAsWorkstation = (SendDlgItemMessageW(hwndDlg,
+                                               IDC_REPORTASWORKSTATION,
+                                               BM_GETCHECK,
+                                               0,
+                                               0) == BST_CHECKED);
+
+    if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
+                       ReportAsWorkstationKey,
+                       0,
+                       NULL,
+                       0,
+                       KEY_WRITE,
+                       NULL,
+                       &hKey,
+                       NULL) == ERROR_SUCCESS)
+    {
+        RegSetValueEx(hKey,
+                      _T("ReportAsWorkstation"),
+                      0,
+                      REG_DWORD,
+                      (LPBYTE)&ReportAsWorkstation,
+                      sizeof(DWORD));
+    }
+}
+
+static VOID
+OnInitSysSettingsDialog(HWND hwndDlg)
+{
+    HKEY hKey;
+    DWORD dwVal;
+    DWORD dwType = REG_DWORD;
+    DWORD cbData = sizeof(DWORD);
+
+    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                     ReportAsWorkstationKey,
+                     0,
+                     KEY_READ,
+                     &hKey) == ERROR_SUCCESS)
+    {
+        if (RegQueryValueEx(hKey,
+                            _T("ReportAsWorkstation"),
+                            0,
+                            &dwType,
+                            (LPBYTE)&dwVal,
+                            &cbData) == ERROR_SUCCESS)
+        {
+            if (dwVal == TRUE)
+            {
+                // set the check box
+                SendDlgItemMessageW(hwndDlg,
+                                    IDC_REPORTASWORKSTATION,
+                                    BM_SETCHECK,
+                                    BST_CHECKED,
+                                    0);
+            }
+        }
+    }
+
+
+}
+
+INT_PTR CALLBACK
+SysSettingsDlgProc(HWND hwndDlg,
+                   UINT uMsg,
+                   WPARAM wParam,
+                   LPARAM lParam)
+{
+    UNREFERENCED_PARAMETER(lParam);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            OnInitSysSettingsDialog(hwndDlg);
+            break;
+
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                case IDOK:
+                    OnOK(hwndDlg);
+                    EndDialog(hwndDlg, 0);
+                    return TRUE;
+            }
+            break;
+    }
+
+    return FALSE;
+}
+
 
 /* Property page dialog callback */
 INT_PTR CALLBACK
@@ -51,6 +149,13 @@
                               (DLGPROC)StartRecDlgProc);
                     break;
 
+                case IDC_SYSSETTINGS:
+                    DialogBox(hApplet,
+                              MAKEINTRESOURCE(IDD_SYSSETTINGS),
+                              hwndDlg,
+                              (DLGPROC)SysSettingsDlgProc);
+                    break;
+
                 case IDC_ENVVAR:
                     DialogBox(hApplet,
                               MAKEINTRESOURCE(IDD_ENVIRONMENT_VARIABLES),

Modified: trunk/reactos/dll/cpl/sysdm/lang/en-US.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/lang/en-US.rc?rev=44487&r1=44486&r2=44487&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/sysdm/lang/en-US.rc [iso-8859-1] Wed Dec  9 17:34:05 2009
@@ -62,8 +62,20 @@
     LTEXT       "Startup and recovery options tell your computer how to start and what to do if an error causes your computer to stop.", IDC_STATIC, 16, 144, 228, 19
     PUSHBUTTON  "Settings", IDC_STAREC, 194, 162, 50, 15
 
-    PUSHBUTTON  "Environment Variables", IDC_ENVVAR, 84, 192, 80, 15
+    PUSHBUTTON  "System Settings", IDC_SYSSETTINGS, 2, 192, 80, 15
+    PUSHBUTTON  "Environment Variables", IDC_ENVVAR, 85, 192, 80, 15
     PUSHBUTTON  "Error Reporting", IDC_ERRORREPORT, 170, 192, 80, 15
+END
+
+IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
+CAPTION "System Settings"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Version Info",IDC_STATIC,6,3,210,53
+    CONTROL         "Report as Workstation",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,37,88,10
+    LTEXT           "ReactOS is built as a server OS and reports as such. Check this box to change this for applications only.",IDC_STATIC,15,15,183,21
+    PUSHBUTTON      "OK",IDOK,166,63,50,14
 END
 
 

Modified: trunk/reactos/dll/cpl/sysdm/resource.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/resource.h?rev=44487&r1=44486&r2=44487&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/sysdm/resource.h [iso-8859-1] Wed Dec  9 17:34:05 2009
@@ -56,12 +56,16 @@
 
 /* propsheet - advanced */
 #define IDD_PROPPAGEADVANCED            400
-#define IDC_ENVVAR                      401
-#define IDC_STAREC                      402
-#define IDC_PERFOR                      403
-#define IDC_USERPROFILE                 404
-#define IDC_ERRORREPORT                 405
+#define IDC_SYSSETTINGS                 401
+#define IDC_ENVVAR                      402
+#define IDC_STAREC                      403
+#define IDC_PERFOR                      404
+#define IDC_USERPROFILE                 405
+#define IDC_ERRORREPORT                 406
 
+/* system settings */
+#define IDD_SYSSETTINGS                 800
+#define IDC_REPORTASWORKSTATION         801
 
 /* user profiles */
 #define IDD_USERPROFILE                 500




More information about the Ros-diffs mailing list