- Implement devices status page
authorDmitry Chapyshev <dmitry@reactos.org>
Thu, 8 Jan 2009 14:24:45 +0000 (14:24 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Thu, 8 Jan 2009 14:24:45 +0000 (14:24 +0000)
- More partly implementation

svn path=/trunk/; revision=38644

24 files changed:
reactos/dll/cpl/hdwwiz/hdwwiz.c
reactos/dll/cpl/hdwwiz/hdwwiz.h
reactos/dll/cpl/hdwwiz/hdwwiz.rbuild
reactos/dll/cpl/hdwwiz/lang/bg-BG.rc
reactos/dll/cpl/hdwwiz/lang/cs-CZ.rc
reactos/dll/cpl/hdwwiz/lang/de-DE.rc
reactos/dll/cpl/hdwwiz/lang/el-GR.rc
reactos/dll/cpl/hdwwiz/lang/en-US.rc
reactos/dll/cpl/hdwwiz/lang/es-ES.rc
reactos/dll/cpl/hdwwiz/lang/fr-FR.rc
reactos/dll/cpl/hdwwiz/lang/hu-HU.rc
reactos/dll/cpl/hdwwiz/lang/id-ID.rc
reactos/dll/cpl/hdwwiz/lang/it-IT.rc
reactos/dll/cpl/hdwwiz/lang/ja-JP.rc
reactos/dll/cpl/hdwwiz/lang/nl-NL.rc
reactos/dll/cpl/hdwwiz/lang/no-NO.rc
reactos/dll/cpl/hdwwiz/lang/pl-PL.rc
reactos/dll/cpl/hdwwiz/lang/pt-BR.rc
reactos/dll/cpl/hdwwiz/lang/ru-RU.rc
reactos/dll/cpl/hdwwiz/lang/sk-SK.rc
reactos/dll/cpl/hdwwiz/lang/th-TH.rc
reactos/dll/cpl/hdwwiz/lang/uk-UA.rc
reactos/dll/cpl/hdwwiz/lang/zh-CN.rc
reactos/dll/cpl/hdwwiz/resource.h

index 1784758..2fb325b 100644 (file)
@@ -32,6 +32,8 @@
 HINSTANCE hApplet = NULL;
 HFONT hTitleFont;
 SP_CLASSIMAGELIST_DATA ImageListData;
+PWSTR pDeviceStatusText;
+HANDLE hProcessHeap;
 
 typedef BOOL (WINAPI *PINSTALL_NEW_DEVICE)(HWND, LPGUID, PDWORD);
 
@@ -74,6 +76,21 @@ StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
             SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
         }
         break;
+
+        case WM_NOTIFY:
+        {
+            LPNMHDR lpnm = (LPNMHDR)lParam;
+
+            switch (lpnm->code)
+            {
+                case PSN_SETACTIVE:
+                {
+                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
+                }
+                break;
+            }
+        }
+        break;
     }
 
     return FALSE;
@@ -82,6 +99,30 @@ StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 static INT_PTR CALLBACK
 SearchPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+        {
+            /* TODO: PnP devices search */
+        }
+        break;
+
+        case WM_NOTIFY:
+        {
+            LPNMHDR lpnm = (LPNMHDR)lParam;
+
+            switch (lpnm->code)
+            {
+                case PSN_SETACTIVE:
+                {
+                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
+                }
+                break;
+            }
+        }
+        break;
+    }
+
     return FALSE;
 }
 
@@ -239,8 +280,10 @@ InitProbeListPage(HWND hwndDlg)
 {
     LV_COLUMN Column;
     LV_ITEM Item;
-    WCHAR szBuffer[MAX_STR_SIZE], szGuid[MAX_STR_SIZE], szTrimGuid[MAX_STR_SIZE];
+    WCHAR szBuffer[MAX_STR_SIZE], szGuid[MAX_STR_SIZE],
+          szTrimGuid[MAX_STR_SIZE], szStatusText[MAX_STR_SIZE];
     HWND hList = GetDlgItem(hwndDlg, IDC_PROBELIST);
+    PWSTR pstrStatusText;
     HDEVINFO hDevInfo;
     SP_DEVINFO_DATA DevInfoData;
     ULONG ulStatus, ulProblemNumber;
@@ -325,9 +368,19 @@ InitProbeListPage(HWND hwndDlg)
                                   &ClassGuid,
                                   &Item.iImage);
 
+        DeviceProblemTextW(NULL,
+                           DevInfoData.DevInst,
+                           ulProblemNumber,
+                           szStatusText,
+                           sizeof(szStatusText) / sizeof(WCHAR));
+
+        pstrStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, sizeof(szStatusText));
+        lstrcpy(pstrStatusText, szStatusText);
+
         /* Set device name */
-        Item.pszText = (LPTSTR) szBuffer;
+        Item.pszText = (LPWSTR) szBuffer;
         Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
+        Item.lParam = (LPARAM) pstrStatusText;
         Item.iItem = (INT) ListView_GetItemCount(hList);
         (VOID) ListView_InsertItem(hList, &Item);
 
@@ -341,10 +394,13 @@ InitProbeListPage(HWND hwndDlg)
 static INT_PTR CALLBACK
 ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    INT Index;
+
     switch (uMsg)
     {
         case WM_INITDIALOG:
         {
+            pDeviceStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, MAX_STR_SIZE);
             InitProbeListPage(hwndDlg);
         }
         break;
@@ -367,9 +423,102 @@ ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
                 }
                 break;
 
+                case NM_CLICK:
+                {
+                    Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
+                    if (Index != -1)
+                    {
+                        PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
+                    }
+                }
+                break;
+
                 case PSN_WIZNEXT:
                 {
-                    SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_FINISHPAGE);
+                    Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
+                    if (Index != -1)
+                    {
+                        if (Index == 0)
+                        {
+                            SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTWAYPAGE);
+                        }
+                        else
+                        {
+                            LVITEM Item;
+                            PWSTR pts;
+
+                            ZeroMemory(&Item, sizeof(LV_ITEM));
+                            Item.mask = LVIF_PARAM;
+                            Item.iItem = Index;
+                            (VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
+                            pts = (PWSTR) Item.lParam;
+                            wcscpy(pDeviceStatusText, pts);
+
+                            SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_HWSTATUSPAGE);
+                        }
+                    }
+                    return TRUE;
+                }
+            }
+        }
+        break;
+
+        case WM_DESTROY:
+        {
+            INT Index;
+            LVITEM Item;
+
+            for (Index = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_PROBELIST)); --Index > 0;)
+            {
+                ZeroMemory(&Item, sizeof(LV_ITEM));
+                Item.mask = LVIF_PARAM;
+                Item.iItem = Index;
+                (VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
+                HeapFree(hProcessHeap, 0, (LPVOID) Item.lParam);
+            }
+            HeapFree(hProcessHeap, 0, (LPVOID) pDeviceStatusText);
+        }
+        break;
+    }
+
+    return FALSE;
+}
+
+static INT_PTR CALLBACK
+SelectWayPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    return FALSE;
+}
+
+static INT_PTR CALLBACK
+DevStatusPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+        {
+            /* Set title font */
+            SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
+            /* Set status text */
+            SetWindowText(GetDlgItem(hwndDlg, IDC_HWSTATUSEDIT), pDeviceStatusText);
+        }
+        break;
+
+        case WM_NOTIFY:
+        {
+            LPNMHDR lpnm = (LPNMHDR)lParam;
+
+            switch (lpnm->code)
+            {
+                case PSN_SETACTIVE:
+                {
+                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH | PSWIZB_BACK);
+                }
+                break;
+
+                case PSN_WIZBACK:
+                {
+                    SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROBELISTPAGE);
                     return TRUE;
                 }
             }
@@ -383,7 +532,7 @@ ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 static VOID
 HardwareWizardInit(HWND hwnd)
 {
-    HPROPSHEETPAGE ahpsp[6];
+    HPROPSHEETPAGE ahpsp[8];
     PROPSHEETPAGE psp = {0};
     PROPSHEETHEADER psh;
     UINT nPages = 0;
@@ -430,6 +579,26 @@ HardwareWizardInit(HWND hwnd)
     psp.pszTemplate = MAKEINTRESOURCE(IDD_PROBELISTPAGE);
     ahpsp[nPages++] = CreatePropertySheetPage(&psp);
 
+    /* Create select search way page */
+    psp.dwSize = sizeof(PROPSHEETPAGE);
+    psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
+    psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SELECTWAYTITLE);
+    psp.pszHeaderSubTitle = NULL;
+    psp.hInstance = hApplet;
+    psp.lParam = 0;
+    psp.pfnDlgProc = SelectWayPageDlgProc;
+    psp.pszTemplate = MAKEINTRESOURCE(IDD_SELECTWAYPAGE);
+    ahpsp[nPages++] = CreatePropertySheetPage(&psp);
+
+    /* Create device status page */
+    psp.dwSize = sizeof(PROPSHEETPAGE);
+    psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
+    psp.hInstance = hApplet;
+    psp.lParam = 0;
+    psp.pfnDlgProc = DevStatusPageDlgProc;
+    psp.pszTemplate = MAKEINTRESOURCE(IDD_HWSTATUSPAGE);
+    ahpsp[nPages++] = CreatePropertySheetPage(&psp);
+
     /* Create finish page */
     psp.dwSize = sizeof(PROPSHEETPAGE);
     psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
@@ -527,6 +696,7 @@ DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
     {
         case DLL_PROCESS_ATTACH:
             hApplet = hinstDLL;
+            hProcessHeap = GetProcessHeap();
             DisableThreadLibraryCalls(hinstDLL);
             break;
     }
index 8cde570..b480ad1 100644 (file)
@@ -5,14 +5,17 @@
 #include <commctrl.h>
 #include <setupapi.h>
 #include <cfgmgr32.h>
+#include <reactos/dll/devmgr/devmgr.h>
 #include <cpl.h>
 #include <tchar.h>
+#include <stdlib.h>
 #include <stdio.h>
+#include <malloc.h>
 
 #define NDEBUG
 #include <debug.h>
 
-#define MAX_STR_SIZE 256
+#define MAX_STR_SIZE 255
 
 extern HINSTANCE hApplet;
 
index dc0d759..f7fdfc6 100644 (file)
@@ -10,6 +10,8 @@
        <library>rpcrt4</library>
        <library>user32</library>
        <library>gdi32</library>
+       <library>devmgr</library>
+       <library>ntdll</library>
        <file>hdwwiz.c</file>
        <file>hdwwiz.rc</file>
 </module>
index 52024db..5d90b2c 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index c865ff4..7fae665 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index f529500..4f6ab9c 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index ad24182..041f080 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 90e486e..d332cc6 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 36ea538..950aa60 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 769a39c..fa37437 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 5a670b8..b316027 100644 (file)
@@ -143,4 +143,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 61980e5..66ddb07 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index a086894..b7e5985 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 743a4c0..b939109 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index c11f8ec..214bc7d 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 10759a4..09c034e 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index f95e5c3..31ec0bb 100644 (file)
@@ -147,4 +147,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index f0c9b24..7015e45 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 8d54c09..a1e4838 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Ïîäêëþ÷åíî ëè  óñòðîéñòâî?"
        IDS_PROBELISTTITLE "Íà ýòîì êîìïüþòåðå óæå óñòàíîâëåíî ñëåäóþùåå îáîðóäîâàíèå"
        IDS_ADDNEWDEVICE "Äîáàâëåíèå íîâîãî óñòðîéñòâà"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index aa622c7..b7796d2 100644 (file)
@@ -146,4 +146,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 40cae51..df44207 100644 (file)
@@ -142,4 +142,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 60b0f47..0a03e60 100644 (file)
@@ -150,4 +150,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index 316c7f5..afdf83d 100644 (file)
@@ -148,4 +148,5 @@ BEGIN
        IDS_ISCONNECTED "Is the hardware connected?"
        IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
        IDS_ADDNEWDEVICE "Add a new hardware device"
+       IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
 END
index dc0ae77..9401571 100644 (file)
@@ -16,6 +16,7 @@
 #define IDS_PROBELISTTITLE        1005
 #define IDS_SEARCHTEXT            1020
 #define IDS_SEARCHTITLE           1025
+#define IDS_SELECTWAYTITLE        1027
 #define IDS_ADDNEWDEVICE          1081
 #define IDS_ISCONNECTED           1113