started implementing startup page
authorChristoph von Wittich <christoph_vw@reactos.org>
Thu, 10 Nov 2005 20:56:49 +0000 (20:56 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Thu, 10 Nov 2005 20:56:49 +0000 (20:56 +0000)
svn path=/trunk/; revision=19124

reactos/subsys/system/msconfig/De.rc
reactos/subsys/system/msconfig/En.rc
reactos/subsys/system/msconfig/msconfig.c
reactos/subsys/system/msconfig/msconfig.xml
reactos/subsys/system/msconfig/precomp.h
reactos/subsys/system/msconfig/resource.h
reactos/subsys/system/msconfig/srvpage.c
reactos/subsys/system/msconfig/startuppage.c [new file with mode: 0644]
reactos/subsys/system/msconfig/startuppage.h [new file with mode: 0644]

index e178b5c..836d034 100644 (file)
@@ -23,6 +23,13 @@ BEGIN
     PUSHBUTTON "&Ausführen", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
     PUSHBUTTON "&Ausführen", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
+IDD_STARTUP_PAGE DIALOG DISCARDABLE  0, 0, 362, 175
+STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
+FONT 8, "Tahoma"
+BEGIN
+    CONTROL "List3",IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
+END
+
 IDD_SERVICES_PAGE DIALOG DISCARDABLE  0, 0, 362, 175
 STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
 FONT 8, "Tahoma"
 IDD_SERVICES_PAGE DIALOG DISCARDABLE  0, 0, 362, 175
 STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
 FONT 8, "Tahoma"
@@ -68,4 +75,8 @@ BEGIN
     IDS_TOOLS_SYSDM_DESCR    "Zeigt Informationen über diesen Rechner an."
     IDS_TOOLS_SYSDM_CMD      "control"
     IDS_TOOLS_SYSDM_PARAM    "sysdm.cpl"
     IDS_TOOLS_SYSDM_DESCR    "Zeigt Informationen über diesen Rechner an."
     IDS_TOOLS_SYSDM_CMD      "control"
     IDS_TOOLS_SYSDM_PARAM    "sysdm.cpl"
+
+    IDS_STARTUP_COLUMN_ELEMENT "Element"
+    IDS_STARTUP_COLUMN_CMD     "Befehl"
+    IDS_STARTUP_COLUMN_PATH    "Pfad"
 END
 END
index 7a933b6..c4ee8b7 100644 (file)
@@ -14,6 +14,13 @@ BEGIN
     PUSHBUTTON "Apply", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
     PUSHBUTTON "Apply", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
+IDD_STARTUP_PAGE DIALOG DISCARDABLE  0, 0, 362, 175
+STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
+FONT 8, "Tahoma"
+BEGIN
+    CONTROL "List3",IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
+END
+
 IDD_TOOLS_PAGE DIALOG DISCARDABLE  0, 0, 362, 175
 STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
 FONT 8, "Tahoma"
 IDD_TOOLS_PAGE DIALOG DISCARDABLE  0, 0, 362, 175
 STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
 FONT 8, "Tahoma"
@@ -67,4 +74,8 @@ BEGIN
     IDS_TOOLS_SYSDM_DESCR    "Shows information about this computer."
     IDS_TOOLS_SYSDM_CMD      "control"
     IDS_TOOLS_SYSDM_PARAM    "sysdm.cpl"
     IDS_TOOLS_SYSDM_DESCR    "Shows information about this computer."
     IDS_TOOLS_SYSDM_CMD      "control"
     IDS_TOOLS_SYSDM_PARAM    "sysdm.cpl"
+
+    IDS_STARTUP_COLUMN_ELEMENT "Element"
+    IDS_STARTUP_COLUMN_CMD     "Command"
+    IDS_STARTUP_COLUMN_PATH    "Path"
 END
 END
index 571ba5b..2623d6f 100644 (file)
@@ -14,6 +14,7 @@ BOOL OnCreate(HWND hWnd)
        hTabWnd = GetDlgItem(hWnd, IDC_TAB);
     hToolsPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TOOLS_PAGE), hWnd, ToolsPageWndProc);
     hServicesPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SERVICES_PAGE), hWnd, ServicesPageWndProc);
        hTabWnd = GetDlgItem(hWnd, IDC_TAB);
     hToolsPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TOOLS_PAGE), hWnd, ToolsPageWndProc);
     hServicesPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SERVICES_PAGE), hWnd, ServicesPageWndProc);
+    hStartupPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_STARTUP_PAGE), hWnd, StartupPageWndProc);
 
        // Insert Tab Pages
        LoadString(hInst, IDS_TAB_GENERAL, szTemp, 256);
 
        // Insert Tab Pages
        LoadString(hInst, IDS_TAB_GENERAL, szTemp, 256);
@@ -53,32 +54,37 @@ BOOL OnCreate(HWND hWnd)
 void MsConfig_OnTabWndSelChange(void)
 {
     switch (TabCtrl_GetCurSel(hTabWnd)) {
 void MsConfig_OnTabWndSelChange(void)
 {
     switch (TabCtrl_GetCurSel(hTabWnd)) {
-    case 0:
+    case 0: //General
         ShowWindow(hToolsPage, SW_HIDE);
         ShowWindow(hToolsPage, SW_HIDE);
-               //ShowWindow(hFreeLdrPage, SW_SHOW);
+               ShowWindow(hStartupPage, SW_HIDE);
+               //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_HIDE);
         //BringWindowToTop(hFreeLdrPage);
                break;
                ShowWindow(hServicesPage, SW_HIDE);
         //BringWindowToTop(hFreeLdrPage);
                break;
-    case 1:
+    case 1: //Freeldr
         ShowWindow(hToolsPage, SW_HIDE);
         ShowWindow(hToolsPage, SW_HIDE);
+               ShowWindow(hStartupPage, SW_HIDE);
                //ShowWindow(hFreeLdrPage, SW_SHOW);
                ShowWindow(hServicesPage, SW_HIDE);
         //BringWindowToTop(hFreeLdrPage);
                break;
                //ShowWindow(hFreeLdrPage, SW_SHOW);
                ShowWindow(hServicesPage, SW_HIDE);
         //BringWindowToTop(hFreeLdrPage);
                break;
-    case 2:
+    case 2: //Services
         ShowWindow(hToolsPage, SW_HIDE);
         ShowWindow(hToolsPage, SW_HIDE);
+               ShowWindow(hStartupPage, SW_HIDE);
                //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_SHOW);
         //BringWindowToTop(hFreeLdrPage);
                break;
                //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_SHOW);
         //BringWindowToTop(hFreeLdrPage);
                break;
-    case 3:
+    case 3: //startup
         ShowWindow(hToolsPage, SW_HIDE);
         ShowWindow(hToolsPage, SW_HIDE);
+               ShowWindow(hStartupPage, SW_SHOW);
                //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_HIDE);
                //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_HIDE);
-        //BringWindowToTop(hFreeLdrPage);
+        BringWindowToTop(hStartupPage);
                break;
                break;
-       case 4:
+       case 4: //Tools
         ShowWindow(hToolsPage, SW_SHOW);
         ShowWindow(hToolsPage, SW_SHOW);
+               ShowWindow(hStartupPage, SW_HIDE);
                //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_HIDE);
         BringWindowToTop(hToolsPage);
                //ShowWindow(hFreeLdrPage, SW_HIDE);
                ShowWindow(hServicesPage, SW_HIDE);
         BringWindowToTop(hToolsPage);
@@ -125,6 +131,7 @@ MsConfigWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     case WM_DESTROY:
                DestroyWindow(hToolsPage);
                DestroyWindow(hServicesPage);
     case WM_DESTROY:
                DestroyWindow(hToolsPage);
                DestroyWindow(hServicesPage);
+               DestroyWindow(hStartupPage);
         return DefWindowProc(hDlg, message, wParam, lParam);
 
     }
         return DefWindowProc(hDlg, message, wParam, lParam);
 
     }
index c21e8f0..1f4ed5c 100644 (file)
@@ -12,6 +12,7 @@
        <library>shell32</library>
        <file>toolspage.c</file>
        <file>srvpage.c</file>
        <library>shell32</library>
        <file>toolspage.c</file>
        <file>srvpage.c</file>
+       <file>startuppage.c</file>
        <file>msconfig.c</file>
        <file>msconfig.rc</file>
 </module>
        <file>msconfig.c</file>
        <file>msconfig.rc</file>
 </module>
index cf1e6c9..a9d6454 100644 (file)
@@ -8,4 +8,9 @@
 #include "msconfig.h"
 #include "toolspage.h"
 #include "srvpage.h"
 #include "msconfig.h"
 #include "toolspage.h"
 #include "srvpage.h"
+#include "startuppage.h"
+
+#define MAX_KEY_LENGTH 255
+#define MAX_VALUE_NAME 16383
+
 
 
index 2e067a2..7f72530 100644 (file)
@@ -11,6 +11,7 @@
 #define IDC_BTN_RUN                     1005
 #define IDC_SERVICES_LIST               1006
 #define IDC_TOOLS_LIST                  1007
 #define IDC_BTN_RUN                     1005
 #define IDC_SERVICES_LIST               1006
 #define IDC_TOOLS_LIST                  1007
+#define IDC_STARTUP_LIST                1008
 
 #define IDS_TAB_TOOLS                   2001
 #define IDS_TAB_FREELDR                 2002
 
 #define IDS_TAB_TOOLS                   2001
 #define IDS_TAB_FREELDR                 2002
@@ -23,6 +24,9 @@
 #define IDS_SERVICES_COLUMN_SERVICE     2012
 #define IDS_SERVICES_COLUMN_VENDOR      2013
 #define IDS_SERVICES_COLUMN_STATUS      2014
 #define IDS_SERVICES_COLUMN_SERVICE     2012
 #define IDS_SERVICES_COLUMN_VENDOR      2013
 #define IDS_SERVICES_COLUMN_STATUS      2014
+#define IDS_STARTUP_COLUMN_ELEMENT     2015
+#define IDS_STARTUP_COLUMN_CMD         2016
+#define IDS_STARTUP_COLUMN_PATH        2017
 
 #define IDS_TOOLS_CMD_NAME              2100
 #define IDS_TOOLS_CMD_DESCR             2101
 
 #define IDS_TOOLS_CMD_NAME              2100
 #define IDS_TOOLS_CMD_DESCR             2101
index a37d2e0..e84016b 100644 (file)
@@ -14,7 +14,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     switch (message) {
     case WM_INITDIALOG:
 
     switch (message) {
     case WM_INITDIALOG:
 
-        hServicesListCtrl = GetDlgItem(hDlg, IDC_TOOLS_LIST);
+        hServicesListCtrl = GetDlgItem(hDlg, IDC_SERVICES_LIST);
         hServicesDialog = hDlg;
 
         dwStyle = SendMessage(hServicesListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
         hServicesDialog = hDlg;
 
         dwStyle = SendMessage(hServicesListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
@@ -41,7 +41,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         LoadString(hInst, IDS_SERVICES_COLUMN_STATUS, szTemp, 256);
         column.pszText = szTemp;
         column.cx = 70;
         LoadString(hInst, IDS_SERVICES_COLUMN_STATUS, szTemp, 256);
         column.pszText = szTemp;
         column.cx = 70;
-        ListView_InsertColumn(hServicesListCtrl, 1, &column);
+        ListView_InsertColumn(hServicesListCtrl, 2, &column);
 
                return TRUE;
        }
 
                return TRUE;
        }
diff --git a/reactos/subsys/system/msconfig/startuppage.c b/reactos/subsys/system/msconfig/startuppage.c
new file mode 100644 (file)
index 0000000..0de04f1
--- /dev/null
@@ -0,0 +1,112 @@
+#include <precomp.h>\r
+\r
+HWND hStartupPage;\r
+HWND hStartupListCtrl;\r
+HWND hStartupDialog;\r
+\r
+void GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName );\r
+\r
+INT_PTR CALLBACK\r
+StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
+{\r
+    LV_COLUMN   column;\r
+    TCHAR       szTemp[256];\r
+    DWORD dwStyle;\r
+\r
+    switch (message) {\r
+    case WM_INITDIALOG:\r
+\r
+        hStartupListCtrl = GetDlgItem(hDlg, IDC_STARTUP_LIST);\r
+        hStartupDialog = hDlg;\r
+\r
+        dwStyle = SendMessage(hStartupListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);\r
+        dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;\r
+        SendMessage(hStartupListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);\r
+\r
+        SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);\r
+\r
+        // Initialize the application page's controls\r
+        column.mask = LVCF_TEXT | LVCF_WIDTH;\r
+\r
+        LoadString(hInst, IDS_STARTUP_COLUMN_ELEMENT, szTemp, 256);\r
+        column.pszText = szTemp;\r
+        column.cx = 150;\r
+        ListView_InsertColumn(hStartupListCtrl, 0, &column);\r
+\r
+        column.mask = LVCF_TEXT | LVCF_WIDTH;\r
+        LoadString(hInst, IDS_STARTUP_COLUMN_CMD, szTemp, 256);\r
+        column.pszText = szTemp;\r
+        column.cx = 150;\r
+        ListView_InsertColumn(hStartupListCtrl, 1, &column);\r
+\r
+        column.mask = LVCF_TEXT | LVCF_WIDTH;\r
+        LoadString(hInst, IDS_STARTUP_COLUMN_PATH, szTemp, 256);\r
+        column.pszText = szTemp;\r
+        column.cx = 250;\r
+        ListView_InsertColumn(hStartupListCtrl, 2, &column);\r
+\r
+        GetAutostartEntriesFromRegistry(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));\r
+        GetAutostartEntriesFromRegistry(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));\r
+        //FIXME: What about HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit\r
+        //FIXME: Common Startup (startmenu)\r
+\r
+        return TRUE;\r
+    }\r
+\r
+    return 0;\r
+}\r
+\r
+void\r
+GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )\r
+{\r
+    HKEY hKey;\r
+    DWORD Index, dwValues, retVal, dwType;\r
+    DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME; \r
+    TCHAR Data[MAX_VALUE_NAME];\r
+    TCHAR lpValueName[MAX_KEY_LENGTH];\r
+    TCHAR Path[MAX_KEY_LENGTH + 5];\r
+    LV_ITEM item;\r
+\r
+    if (RegOpenKeyEx(hRootKey, KeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)\r
+    {\r
+        if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)\r
+        {\r
+            for (Index = 0, retVal = ERROR_SUCCESS; Index < dwValues; Index++) \r
+            {\r
+                dwValueLength = MAX_VALUE_NAME;\r
+                dwDataLength = MAX_VALUE_NAME;\r
+                retVal = RegEnumValue(hKey, Index, lpValueName, &dwValueLength, NULL, &dwType, (LPBYTE)Data, &dwDataLength);\r
+                if (retVal == ERROR_SUCCESS) \r
+                {\r
+                    memset(&item, 0, sizeof(LV_ITEM));\r
+                    item.mask = LVIF_TEXT;\r
+                    item.iImage = 0;\r
+                    item.pszText = lpValueName;\r
+                    item.iItem = ListView_GetItemCount(hStartupListCtrl);\r
+                    item.lParam = 0;\r
+                    ListView_InsertItem(hStartupListCtrl, &item);\r
+\r
+                    if (dwType == REG_SZ)\r
+                    {\r
+                        GetLongPathName(Data, Data, sizeof(Data));\r
+                        item.pszText = Data;\r
+                        item.iSubItem = 1;\r
+                        SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);\r
+                    }\r
+                    \r
+                    if (hRootKey == HKEY_LOCAL_MACHINE)\r
+                        _tcscpy(Path, _T("HKLM\\"));\r
+                    if (hRootKey == HKEY_CURRENT_USER)\r
+                        _tcscpy(Path, _T("HKCU\\"));\r
+\r
+                    _tcscat(Path, KeyName);\r
+                    item.pszText = Path;\r
+                    item.iSubItem = 2;\r
+                    SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);\r
+                }\r
+            }\r
+        }\r
+        RegCloseKey(hKey);\r
+    }\r
+\r
+}\r
diff --git a/reactos/subsys/system/msconfig/startuppage.h b/reactos/subsys/system/msconfig/startuppage.h
new file mode 100644 (file)
index 0000000..39aebaf
--- /dev/null
@@ -0,0 +1,4 @@
+extern HWND hStartupPage;\r
+extern HWND hStartupPageListCtrl;\r
+\r
+INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r