add a check for SPDRP_CONFIGFLAGS which is not working yet Modified: trunk/reactos/lib/newdev/newdev.c _____
Modified: trunk/reactos/lib/newdev/newdev.c --- trunk/reactos/lib/newdev/newdev.c 2005-11-15 18:08:07 UTC (rev 19253) +++ trunk/reactos/lib/newdev/newdev.c 2005-11-15 18:56:23 UTC (rev 19254) @@ -5,6 +5,7 @@
* PURPOSE: New devices installation * * PROGRAMMERS: HervÚ Poussineau (hpoussin@reactos.org) +* PROGRAMMERS: Christoph von Wittich (Christoph@ActiveVB.de) */
//#define NDEBUG @@ -24,751 +25,752 @@ static HFONT CreateTitleFont(VOID) { - NONCLIENTMETRICS ncm; - LOGFONT LogFont; - HDC hdc; - INT FontSize; - HFONT hFont; + NONCLIENTMETRICS ncm; + LOGFONT LogFont; + HDC hdc; + INT FontSize; + HFONT hFont;
- ncm.cbSize = sizeof(NONCLIENTMETRICS); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + ncm.cbSize = sizeof(NONCLIENTMETRICS); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
- LogFont = ncm.lfMessageFont; - LogFont.lfWeight = FW_BOLD; - _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg")); + LogFont = ncm.lfMessageFont; + LogFont.lfWeight = FW_BOLD; + _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg"));
- hdc = GetDC(NULL); - FontSize = 12; - LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72; - hFont = CreateFontIndirect(&LogFont); - ReleaseDC(NULL, hdc); + hdc = GetDC(NULL); + FontSize = 12; + LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72; + hFont = CreateFontIndirect(&LogFont); + ReleaseDC(NULL, hdc);
- return hFont; + return hFont; }
static VOID CenterWindow(HWND hWnd) { - HWND hWndParent; - RECT rcParent; - RECT rcWindow; + HWND hWndParent; + RECT rcParent; + RECT rcWindow;
- hWndParent = GetParent(hWnd); - if (hWndParent == NULL) - hWndParent = GetDesktopWindow(); + hWndParent = GetParent(hWnd); + if (hWndParent == NULL) + hWndParent = GetDesktopWindow();
- GetWindowRect(hWndParent, &rcParent); - GetWindowRect(hWnd, &rcWindow); + GetWindowRect(hWndParent, &rcParent); + GetWindowRect(hWnd, &rcWindow);
- SetWindowPos(hWnd, - HWND_TOP, - ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2, - ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2, - 0, - 0, - SWP_NOSIZE); + SetWindowPos(hWnd, + HWND_TOP, + ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2, + ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2, + 0, + 0, + SWP_NOSIZE); }
static INT_PTR CALLBACK WelcomeDlgProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) {
- PDEVINSTDATA DevInstData; + PDEVINSTDATA DevInstData;
- /* Retrieve pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA); + /* Retrieve pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
- switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle;
- /* Get pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData); + /* Get pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData);
- hwndControl = GetParent(hwndDlg); + hwndControl = GetParent(hwndDlg);
- /* Center the wizard window */ - CenterWindow (hwndControl); + /* Center the wizard window */ + CenterWindow (hwndControl);
- /* Hide the system menu */ - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + /* Hide the system menu */ + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
- /* Set title font */ - SendDlgItemMessage(hwndDlg, - IDC_WELCOMETITLE, - WM_SETFONT, - (WPARAM)DevInstData->hTitleFont, - (LPARAM)TRUE); + /* Set title font */ + SendDlgItemMessage(hwndDlg, + IDC_WELCOMETITLE, + WM_SETFONT, + (WPARAM)DevInstData->hTitleFont, + (LPARAM)TRUE);
- SendDlgItemMessage(hwndDlg, - IDC_DEVICE, - WM_SETTEXT, - 0, - (LPARAM) DevInstData->buffer); + SendDlgItemMessage(hwndDlg, + IDC_DEVICE, + WM_SETTEXT, + 0, + (LPARAM) DevInstData->buffer);
- SendDlgItemMessage(hwndDlg, - IDC_RADIO_AUTO, - BM_SETCHECK, - (WPARAM) TRUE, - (LPARAM) 0); + SendDlgItemMessage(hwndDlg, + IDC_RADIO_AUTO, + BM_SETCHECK, + (WPARAM) TRUE, + (LPARAM) 0);
- } - break; + } + break;
- case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam;
- switch (lpnm->code) - { - case PSN_SETACTIVE: - /* Enable the Next button */ - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT); - break; + switch (lpnm->code) + { + case PSN_SETACTIVE: + /* Enable the Next button */ + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT); + break;
- case PSN_WIZNEXT: - /* Handle a Next button click, if necessary */ + case PSN_WIZNEXT: + /* Handle a Next button click, if necessary */
- if (SendDlgItemMessage(hwndDlg, IDC_RADIO_AUTO, BM_GETCHECK, (WPARAM) 0, (LPARAM) 0) == BST_CHECKED) - PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_SEARCHDRV); + if (SendDlgItemMessage(hwndDlg, IDC_RADIO_AUTO, BM_GETCHECK, (WPARAM) 0, (LPARAM) 0) == BST_CHECKED) + PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_SEARCHDRV);
- break; + break;
- default: - break; - } - } - break; + default: + break; + } + } + break;
- default: - break; - } + default: + break; + }
- return FALSE; + return FALSE; }
static INT_PTR CALLBACK CHSourceDlgProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) {
- PDEVINSTDATA DevInstData; + PDEVINSTDATA DevInstData;
- /* Retrieve pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA); + /* Retrieve pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
- switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle;
- /* Get pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData); + /* Get pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData);
- hwndControl = GetParent(hwndDlg); + hwndControl = GetParent(hwndDlg);
- /* Center the wizard window */ - CenterWindow (hwndControl); + /* Center the wizard window */ + CenterWindow (hwndControl);
- /* Hide the system menu */ - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + /* Hide the system menu */ + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
- SendDlgItemMessage(hwndDlg, - IDC_RADIO_SEARCHHERE, - BM_SETCHECK, - (WPARAM) TRUE, - (LPARAM) 0); + SendDlgItemMessage(hwndDlg, + IDC_RADIO_SEARCHHERE, + BM_SETCHECK, + (WPARAM) TRUE, + (LPARAM) 0);
- } - break; + } + break;
- case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam;
- switch (lpnm->code) - { - case PSN_SETACTIVE: - /* Enable the Next and Back buttons */ - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); - break; + switch (lpnm->code) + { + case PSN_SETACTIVE: + /* Enable the Next and Back buttons */ + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); + break;
- case PSN_WIZNEXT: - /* Handle a Next button click, if necessary */ - PropSheet_SetCurSel(GetParent(hwndDlg), 0, 4); - break; + case PSN_WIZNEXT: + /* Handle a Next button click, if necessary */ + PropSheet_SetCurSel(GetParent(hwndDlg), 0, 4); + break;
- default: - break; - } - } - break; + default: + break; + } + } + break;
- default: - break; - } + default: + break; + }
- return FALSE; + return FALSE; }
static INT_PTR CALLBACK SearchDrvDlgProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) {
- PDEVINSTDATA DevInstData; - DWORD dwThreadId; + PDEVINSTDATA DevInstData; + DWORD dwThreadId;
- /* Retrieve pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA); + /* Retrieve pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
- switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle;
- /* Get pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData); + /* Get pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData);
- DevInstData->hDialog = hwndDlg; - hwndControl = GetParent(hwndDlg); + DevInstData->hDialog = hwndDlg; + hwndControl = GetParent(hwndDlg);
- /* Center the wizard window */ - CenterWindow (hwndControl); + /* Center the wizard window */ + CenterWindow (hwndControl);
- SendDlgItemMessage(hwndDlg, - IDC_DEVICE, - WM_SETTEXT, - 0, - (LPARAM) DevInstData->buffer); + SendDlgItemMessage(hwndDlg, + IDC_DEVICE, + WM_SETTEXT, + 0, + (LPARAM) DevInstData->buffer);
- /* Hide the system menu */ - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - } - break; + /* Hide the system menu */ + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + } + break;
- case WM_SEARCH_FINISHED: - { - CloseHandle(hThread); - hThread = 0; - if (wParam == 0) - PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_NODRIVER); - else - PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_FINISHPAGE); - break; - } - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; + case WM_SEARCH_FINISHED: + { + CloseHandle(hThread); + hThread = 0; + if (wParam == 0) + PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_NODRIVER); + else + PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_FINISHPAGE); + break; + } + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam;
- switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), !PSWIZB_NEXT | !PSWIZB_BACK); - hThread = CreateThread( NULL, 0, FindDriverProc, DevInstData, 0, &dwThreadId); - break; + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), !PSWIZB_NEXT | !PSWIZB_BACK); + hThread = CreateThread( NULL, 0, FindDriverProc, DevInstData, 0, &dwThreadId); + break;
- case PSN_KILLACTIVE: - if (hThread != 0) - { - SetWindowLong ( hwndDlg, DWL_MSGRESULT, TRUE); - return TRUE; - } - break; - case PSN_WIZNEXT: - /* Handle a Next button click, if necessary */ - break; + case PSN_KILLACTIVE: + if (hThread != 0) + { + SetWindowLong ( hwndDlg, DWL_MSGRESULT, TRUE); + return TRUE; + } + break; + case PSN_WIZNEXT: + /* Handle a Next button click, if necessary */ + break;
- default: - break; - } - } - break; + default: + break; + } + } + break;
- default: - break; - } + default: + break; + }
- return FALSE; + return FALSE; }
static DWORD WINAPI FindDriverProc( - IN LPVOID lpParam) + IN LPVOID lpParam) { - TCHAR drive[] = {'?',':',0}; - size_t nType; - DWORD dwDrives; - PDEVINSTDATA DevInstData; - UINT i = 1; + TCHAR drive[] = {'?',':',0}; + size_t nType; + DWORD dwDrives; + PDEVINSTDATA DevInstData; + UINT i = 1;
- DevInstData = (PDEVINSTDATA)lpParam; + DevInstData = (PDEVINSTDATA)lpParam;
- dwDrives = GetLogicalDrives(); - for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++) - { - if (dwDrives & i) - { - nType = GetDriveType( drive ); - if ((nType == DRIVE_CDROM) || (nType == DRIVE_FIXED)) - { - /* search for inf file */ - if (SearchDriver ( DevInstData, drive )) - { - /* if we found a valid driver inf... */ - if (FindDriver ( DevInstData )) - { - InstallDriver ( DevInstData ); - PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 1, 0); - return 0; - } - } - } - } - i <<= 1; - } + dwDrives = GetLogicalDrives(); + for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++) + { + if (dwDrives & i) + { + nType = GetDriveType( drive ); + if ((nType == DRIVE_CDROM)) + //if ((nType == DRIVE_CDROM) || (nType == DRIVE_FIXED)) + { + /* search for inf file */ + if (SearchDriver ( DevInstData, drive )) + { + /* if we found a valid driver inf... */ + if (FindDriver ( DevInstData )) + { + InstallDriver ( DevInstData ); + PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 1, 0); + return 0; + } + } + } + } + i <<= 1; + }
- PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 0, 0); - return 0; + PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 0, 0); + return 0; }
static INT_PTR CALLBACK FinishDlgProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) {
- PDEVINSTDATA DevInstData; + PDEVINSTDATA DevInstData;
- /* Retrieve pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA); + /* Retrieve pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
- switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl;
- /* Get pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData); + /* Get pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData);
- hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); - ShowWindow (hwndControl, SW_HIDE); - EnableWindow (hwndControl, FALSE); + hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); + ShowWindow (hwndControl, SW_HIDE); + EnableWindow (hwndControl, FALSE);
- SendDlgItemMessage(hwndDlg, - IDC_DEVICE, - WM_SETTEXT, - 0, - (LPARAM) DevInstData->drvInfoData.Description); + SendDlgItemMessage(hwndDlg, + IDC_DEVICE, + WM_SETTEXT, + 0, + (LPARAM) DevInstData->drvInfoData.Description);
- /* Set title font */ - SendDlgItemMessage(hwndDlg, - IDC_FINISHTITLE, - WM_SETFONT, - (WPARAM)DevInstData->hTitleFont, - (LPARAM)TRUE); - } - break; + /* Set title font */ + SendDlgItemMessage(hwndDlg, + IDC_FINISHTITLE, + WM_SETFONT, + (WPARAM)DevInstData->hTitleFont, + (LPARAM)TRUE); + } + break;
- case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam;
- switch (lpnm->code) - { - case PSN_SETACTIVE: - /* Enable the correct buttons on for the active page */ - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH); - break; + switch (lpnm->code) + { + case PSN_SETACTIVE: + /* Enable the correct buttons on for the active page */ + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH); + break;
- case PSN_WIZBACK: - /* Handle a Back button click, if necessary */ - break; + case PSN_WIZBACK: + /* Handle a Back button click, if necessary */ + break;
- case PSN_WIZFINISH: - /* Handle a Finish button click, if necessary */ - break; + case PSN_WIZFINISH: + /* Handle a Finish button click, if necessary */ + break;
- default: - break; - } - } - break; + default: + break; + } + } + break;
- default: - break; - } + default: + break; + }
- return FALSE; + return FALSE; }
static INT_PTR CALLBACK InstFailDlgProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) {
- PDEVINSTDATA DevInstData; + PDEVINSTDATA DevInstData;
- /* Get pointer to the global setup data */ - DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA); + /* Get pointer to the global setup data */ + DevInstData = (PDEVINSTDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
- switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl;
- DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData); + DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)DevInstData);
- hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); - ShowWindow (hwndControl, SW_HIDE); - EnableWindow (hwndControl, FALSE); + hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); + ShowWindow (hwndControl, SW_HIDE); + EnableWindow (hwndControl, FALSE);
- /* Set title font */ - SendDlgItemMessage(hwndDlg, - IDC_FINISHTITLE, - WM_SETFONT, - (WPARAM)DevInstData->hTitleFont, - (LPARAM)TRUE); - } - break; + /* Set title font */ + SendDlgItemMessage(hwndDlg, + IDC_FINISHTITLE, + WM_SETFONT, + (WPARAM)DevInstData->hTitleFont, + (LPARAM)TRUE); + } + break;
- case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - DWORD config_flags; - BOOL ret; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + DWORD config_flags; + BOOL ret;
- switch (lpnm->code) - { - case PSN_SETACTIVE: - /* Enable the correct buttons on for the active page */ - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH); - break; + switch (lpnm->code) + { + case PSN_SETACTIVE: + /* Enable the correct buttons on for the active page */ + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH); + break;
- case PSN_WIZBACK: - PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_WELCOMEPAGE); - /* Handle a Back button click, if necessary */ - break; + case PSN_WIZBACK: + PropSheet_SetCurSel(GetParent(hwndDlg), 0, IDD_WELCOMEPAGE); + /* Handle a Back button click, if necessary */ + break;
- case PSN_WIZFINISH: - /* Handle a Finish button click, if necessary */ - if (SendDlgItemMessage(hwndDlg, IDC_DONOTSHOWDLG, BM_GETCHECK, (WPARAM) 0, (LPARAM) 0) == BST_CHECKED) - { + case PSN_WIZFINISH: + /* Handle a Finish button click, if necessary */ + if (SendDlgItemMessage(hwndDlg, IDC_DONOTSHOWDLG, BM_GETCHECK, (WPARAM) 0, (LPARAM) 0) == BST_CHECKED) + {
- if(SetupDiGetDeviceRegistryProperty(DevInstData->hDevInfo, - &DevInstData->devInfoData, - SPDRP_CONFIGFLAGS, - NULL, - (BYTE *)&config_flags, - sizeof(config_flags), - NULL)) - { - config_flags |= CONFIGFLAG_FAILEDINSTALL; - ret = SetupDiSetDeviceRegistryProperty( - DevInstData->hDevInfo, - &DevInstData->devInfoData, - SPDRP_CONFIGFLAGS, - NULL, 0 ); - } + if(SetupDiGetDeviceRegistryProperty(DevInstData->hDevInfo, + &DevInstData->devInfoData, + SPDRP_CONFIGFLAGS, + NULL, + (BYTE *)&config_flags, + sizeof(config_flags), + NULL)) + { + config_flags |= CONFIGFLAG_FAILEDINSTALL; + ret = SetupDiSetDeviceRegistryProperty( + DevInstData->hDevInfo, + &DevInstData->devInfoData, + SPDRP_CONFIGFLAGS, + NULL, 0 ); + }
- } - break; + } + break;
- default: - break; - } - } - break; + default: + break; + } + } + break;
- default: - break; - } + default: + break; + }
- return FALSE; + return FALSE; }
static BOOL FindDriver( - IN PDEVINSTDATA DevInstData) + IN PDEVINSTDATA DevInstData) {
- BOOL ret; + BOOL ret;
- ret = SetupDiBuildDriverInfoList(DevInstData->hDevInfo, &DevInstData->devInfoData, SPDIT_COMPATDRIVER); - if (!ret) - { - DPRINT("SetupDiBuildDriverInfoList() failed with error 0x%lx\n", GetLastError()); - return FALSE; - } + ret = SetupDiBuildDriverInfoList(DevInstData->hDevInfo, &DevInstData->devInfoData, SPDIT_COMPATDRIVER); + if (!ret) + { + DPRINT("SetupDiBuildDriverInfoList() failed with error 0x%lx\n", GetLastError()); + return FALSE; + }
- DevInstData->drvInfoData.cbSize = sizeof(SP_DRVINFO_DATA); - ret = SetupDiEnumDriverInfo( - DevInstData->hDevInfo, - &DevInstData->devInfoData, - SPDIT_COMPATDRIVER, - 0, - &DevInstData->drvInfoData); - if (!ret) - { - if (GetLastError() == ERROR_NO_MORE_ITEMS) - return FALSE; - DPRINT("SetupDiEnumDriverInfo() failed with error 0x%lx\n", GetLastError()); - return FALSE; - } - DPRINT("Installing driver %S: %S\n", DevInstData->drvInfoData.MfgName, DevInstData->drvInfoData.Description); + DevInstData->drvInfoData.cbSize = sizeof(SP_DRVINFO_DATA); + ret = SetupDiEnumDriverInfo( + DevInstData->hDevInfo, + &DevInstData->devInfoData, + SPDIT_COMPATDRIVER, + 0, + &DevInstData->drvInfoData); + if (!ret) + { + if (GetLastError() == ERROR_NO_MORE_ITEMS) + return FALSE; + DPRINT("SetupDiEnumDriverInfo() failed with error 0x%lx\n", GetLastError()); + return FALSE; + } + DPRINT("Installing driver %S: %S\n", DevInstData->drvInfoData.MfgName, DevInstData->drvInfoData.Description);
- return TRUE; + return TRUE; }
static BOOL IsDots(IN LPCTSTR str) { - if(_tcscmp(str, _T(".")) && _tcscmp(str, _T(".."))) return FALSE; - return TRUE; + if(_tcscmp(str, _T(".")) && _tcscmp(str, _T(".."))) return FALSE; + return TRUE; }
static LPTSTR GetFileExt(IN LPTSTR FileName) { - if (FileName == 0) - return _T(""); + if (FileName == 0) + return _T("");
- int i = _tcsclen(FileName); - while ((i >= 0) && (FileName[i] != _T('.'))) - i--; + int i = _tcsclen(FileName); + while ((i >= 0) && (FileName[i] != _T('.'))) + i--;
- FileName = _tcslwr(FileName); + FileName = _tcslwr(FileName);
- if (i >= 0) - return &FileName[i]; - else - return _T(""); + if (i >= 0) + return &FileName[i]; + else + return _T(""); }
static BOOL SearchDriver( - IN PDEVINSTDATA DevInstData, - IN LPCTSTR Path) + IN PDEVINSTDATA DevInstData, + IN LPCTSTR Path) { - WIN32_FIND_DATA wfd; - SP_DEVINSTALL_PARAMS DevInstallParams; - TCHAR DirPath[MAX_PATH]; - TCHAR FileName[MAX_PATH]; - TCHAR FullPath[MAX_PATH]; - TCHAR LastDirPath[MAX_PATH] = _T(""); - TCHAR PathWithPattern[MAX_PATH]; - BOOL ok = TRUE; - BOOL ret; - HANDLE hFindFile; + WIN32_FIND_DATA wfd; [truncated at 1000 lines; 675 more skipped]