2 * Drive management UI code
4 * Copyright 2003 Mark Westcott
5 * Copyright 2004 Chris Morgan
6 * Copyright 2003-2004 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #define WIN32_LEAN_AND_MEAN
34 #include <wine/debug.h>
39 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
41 #define BOX_MODE_CD_ASSIGN 1
42 #define BOX_MODE_CD_AUTODETECT 2
43 #define BOX_MODE_NONE 3
44 #define BOX_MODE_NORMAL 4
46 static BOOL advanced
= FALSE
;
47 static BOOL updating_ui
= FALSE
;
48 static struct drive
* current_drive
;
50 static void get_etched_rect(HWND dialog
, RECT
*rect
);
51 static void update_controls(HWND dialog
);
53 /**** listview helper functions ****/
55 /* clears the item at index in the listview */
56 static void lv_clear_curr_select(HWND dialog
, int index
)
58 ListView_SetItemState(GetDlgItem(dialog
, IDC_LIST_DRIVES
), index
, 0, LVIS_SELECTED
);
61 /* selects the item at index in the listview */
62 static void lv_set_curr_select(HWND dialog
, int index
)
64 /* no more than one item can be selected in our listview */
65 lv_clear_curr_select(dialog
, -1);
66 ListView_SetItemState(GetDlgItem(dialog
, IDC_LIST_DRIVES
), index
, LVIS_SELECTED
, LVIS_SELECTED
);
69 /* returns the currently selected item in the listview */
70 static int lv_get_curr_select(HWND dialog
)
72 return SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_GETNEXTITEM
, -1, LVNI_SELECTED
);
75 /* sets the item in the listview at item->iIndex */
76 static void lv_set_item(HWND dialog
, LVITEM
*item
)
78 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_SETITEM
, 0, (LPARAM
) item
);
81 /* sets specified item's text */
82 static void lv_set_item_text(HWND dialog
, int item
, int subItem
, char *text
)
85 if (item
< 0 || subItem
< 0) return;
86 lvItem
.mask
= LVIF_TEXT
;
88 lvItem
.iSubItem
= subItem
;
89 lvItem
.pszText
= text
;
90 lvItem
.cchTextMax
= lstrlen(lvItem
.pszText
);
91 lv_set_item(dialog
, &lvItem
);
94 /* inserts an item into the listview */
95 static void lv_insert_item(HWND dialog
, LVITEM
*item
)
97 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_INSERTITEM
, 0, (LPARAM
) item
);
100 /* retrieve the item at index item->iIndex */
101 static void lv_get_item(HWND dialog
, LVITEM
*item
)
103 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_GETITEM
, 0, (LPARAM
) item
);
106 static void set_advanced(HWND dialog
)
115 LoadString(GetModuleHandle(NULL
), IDS_HIDE_ADVANCED
, text
, 256);
120 LoadString(GetModuleHandle(NULL
), IDS_SHOW_ADVANCED
, text
, 256);
123 ShowWindow(GetDlgItem(dialog
, IDC_RADIO_AUTODETECT
), state
);
124 ShowWindow(GetDlgItem(dialog
, IDC_RADIO_ASSIGN
), state
);
125 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_LABEL
), state
);
126 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_DEVICE
), state
);
127 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_LABEL
), state
);
128 ShowWindow(GetDlgItem(dialog
, IDC_BUTTON_BROWSE_DEVICE
), state
);
129 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_SERIAL
), state
);
130 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_SERIAL
), state
);
131 ShowWindow(GetDlgItem(dialog
, IDC_LABELSERIAL_STATIC
), state
);
132 ShowWindow(GetDlgItem(dialog
, IDC_COMBO_TYPE
), state
);
133 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_TYPE
), state
);
135 /* update the button text based on the state */
136 SetWindowText(GetDlgItem(dialog
, IDC_BUTTON_SHOW_HIDE_ADVANCED
), text
);
138 /* redraw for the etched line */
139 get_etched_rect(dialog
, &rect
);
140 InflateRect(&rect
, 5, 5);
141 InvalidateRect(dialog
, &rect
, TRUE
);
144 struct drive_typemap
{
149 static const struct drive_typemap type_pairs
[] = {
150 { DRIVE_UNKNOWN
, "Autodetect" },
151 { DRIVE_FIXED
, "Local hard disk" },
152 { DRIVE_REMOTE
, "Network share" },
153 { DRIVE_REMOVABLE
, "Floppy disk" },
154 { DRIVE_CDROM
, "CD-ROM" }
157 #define DRIVE_TYPE_DEFAULT 0
159 static void fill_drive_droplist(long mask
, char curletter
, HWND dialog
)
168 for (i
= 0, count
= 0, selection
= -1, next_letter
= -1; i
<= 'Z'-'A'; ++i
)
170 if (mask
& DRIVE_MASK_BIT('A' + i
))
175 index
= SendDlgItemMessage(dialog
, IDC_COMBO_LETTER
, CB_ADDSTRING
, 0, (LPARAM
) sName
);
177 if (toupper(curletter
) == 'A' + i
)
182 if (i
>= 2 && next_letter
== -1)
184 /* default drive is first one of C-Z */
194 selection
= next_letter
;
197 SendDlgItemMessage(dialog
, IDC_COMBO_LETTER
, CB_SETCURSEL
, selection
, 0);
201 static void enable_labelserial_box(HWND dialog
, int mode
)
203 WINE_TRACE("mode=%d\n", mode
);
207 case BOX_MODE_CD_ASSIGN
:
208 enable(IDC_RADIO_ASSIGN
);
209 disable(IDC_EDIT_DEVICE
);
210 disable(IDC_BUTTON_BROWSE_DEVICE
);
211 enable(IDC_EDIT_SERIAL
);
212 enable(IDC_EDIT_LABEL
);
213 enable(IDC_STATIC_SERIAL
);
214 enable(IDC_STATIC_LABEL
);
217 case BOX_MODE_CD_AUTODETECT
:
218 enable(IDC_RADIO_ASSIGN
);
219 enable(IDC_EDIT_DEVICE
);
220 enable(IDC_BUTTON_BROWSE_DEVICE
);
221 disable(IDC_EDIT_SERIAL
);
222 disable(IDC_EDIT_LABEL
);
223 disable(IDC_STATIC_SERIAL
);
224 disable(IDC_STATIC_LABEL
);
228 disable(IDC_RADIO_ASSIGN
);
229 disable(IDC_EDIT_DEVICE
);
230 disable(IDC_BUTTON_BROWSE_DEVICE
);
231 disable(IDC_EDIT_SERIAL
);
232 disable(IDC_EDIT_LABEL
);
233 disable(IDC_STATIC_SERIAL
);
234 disable(IDC_STATIC_LABEL
);
237 case BOX_MODE_NORMAL
:
238 enable(IDC_RADIO_ASSIGN
);
239 disable(IDC_EDIT_DEVICE
);
240 disable(IDC_BUTTON_BROWSE_DEVICE
);
241 enable(IDC_EDIT_SERIAL
);
242 enable(IDC_EDIT_LABEL
);
243 enable(IDC_STATIC_SERIAL
);
244 enable(IDC_STATIC_LABEL
);
249 static int fill_drives_list(HWND dialog
)
252 BOOL drivec_present
= FALSE
;
260 prevsel
= lv_get_curr_select(dialog
);
262 /* Clear the listbox */
263 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_DELETEALLITEMS
, 0, 0);
265 for(i
= 0; i
< 26; i
++)
270 /* skip over any unused drives */
271 if (!drives
[i
].in_use
)
274 if (drives
[i
].letter
== 'C')
275 drivec_present
= TRUE
;
281 memset(&item
, 0, sizeof(item
));
282 item
.mask
= LVIF_TEXT
| LVIF_PARAM
;
285 item
.pszText
= letter
;
286 item
.cchTextMax
= lstrlen(item
.pszText
);
287 item
.lParam
= (LPARAM
) &drives
[i
];
289 lv_insert_item(dialog
, &item
);
290 lv_set_item_text(dialog
, count
, 1, drives
[i
].unixpath
);
295 WINE_TRACE("loaded %d drives\n", count
);
297 /* show the warning if there is no Drive C */
299 ShowWindow(GetDlgItem(dialog
, IDS_DRIVE_NO_C
), SW_NORMAL
);
301 ShowWindow(GetDlgItem(dialog
, IDS_DRIVE_NO_C
), SW_HIDE
);
303 lv_set_curr_select(dialog
, prevsel
== -1 ? 0 : prevsel
);
309 static void on_options_click(HWND dialog
)
311 if (IsDlgButtonChecked(dialog
, IDC_SHOW_DOT_FILES
) == BST_CHECKED
)
312 set_reg_key(config_key
, "", "ShowDotFiles", "Y");
314 set_reg_key(config_key
, "", "ShowDotFiles", "N");
316 SendMessage(GetParent(dialog
), PSM_CHANGED
, 0, 0);
319 static void on_add_click(HWND dialog
)
321 /* we should allocate a drive letter automatically. We also need
322 some way to let the user choose the mapping point, for now we
323 will just force them to enter a path automatically, with / being
324 the default. In future we should be able to temporarily map /
325 then invoke the directory chooser dialog. */
327 char new = 'C'; /* we skip A and B, they are historically floppy drives */
328 long mask
= ~drive_available_mask(0); /* the mask is now which drives aren't available */
331 while (mask
& (1 << (new - 'A')))
336 MessageBox(dialog
, "You cannot add any more drives.\n\nEach drive must have a letter, from A to Z, so you cannot have more than 26", "", MB_OK
| MB_ICONEXCLAMATION
);
341 WINE_TRACE("allocating drive letter %c\n", new);
343 if (new == 'C') add_drive(new, "../drive_c", "System Drive", "", DRIVE_FIXED
);
344 else add_drive(new, "/", "", "", DRIVE_UNKNOWN
);
346 fill_drives_list(dialog
);
348 /* select the newly created drive */
349 mask
= ~drive_available_mask(0);
351 for (i
= 0; i
< 26; i
++)
353 if ('A' + i
== new) break;
354 if ((1 << i
) & mask
) c
++;
356 lv_set_curr_select(dialog
, c
);
358 SetFocus(GetDlgItem(dialog
, IDC_LIST_DRIVES
));
360 update_controls(dialog
);
363 static void on_remove_click(HWND dialog
)
369 itemIndex
= lv_get_curr_select(dialog
);
370 if (itemIndex
== -1) return; /* no selection */
372 memset(&item
, 0, sizeof(item
));
373 item
.mask
= LVIF_PARAM
;
374 item
.iItem
= itemIndex
;
377 lv_get_item(dialog
, &item
);
379 drive
= (struct drive
*) item
.lParam
;
381 WINE_ERR("unixpath: %s\n", drive
->unixpath
);
383 if (drive
->letter
== 'C')
385 DWORD result
= MessageBox(dialog
, "Are you sure you want to delete drive C?\n\nMost Windows applications expect drive C to exist, and will die messily if it doesn't. If you proceed remember to recreate it!", "", MB_YESNO
| MB_ICONEXCLAMATION
);
386 if (result
== IDNO
) return;
391 fill_drives_list(dialog
);
393 itemIndex
= itemIndex
- 1;
394 if (itemIndex
< 0) itemIndex
= 0;
395 lv_set_curr_select(dialog
, itemIndex
); /* previous item */
397 SetFocus(GetDlgItem(dialog
, IDC_LIST_DRIVES
));
399 update_controls(dialog
);
402 static void update_controls(HWND dialog
)
409 int i
, selection
= -1;
414 i
= lv_get_curr_select(dialog
);
417 /* no selection? let's select something for the user. this will re-enter */
418 lv_set_curr_select(dialog
, i
);
422 memset(&item
, 0, sizeof(item
));
423 item
.mask
= LVIF_PARAM
;
427 lv_get_item(dialog
, &item
);
428 current_drive
= (struct drive
*) item
.lParam
;
430 WINE_TRACE("Updating sheet for drive %c\n", current_drive
->letter
);
433 fill_drive_droplist(drive_available_mask(current_drive
->letter
), current_drive
->letter
, dialog
);
436 path
= current_drive
->unixpath
;
437 WINE_TRACE("set path control text to '%s'\n", path
);
438 set_text(dialog
, IDC_EDIT_PATH
, path
);
441 type
= current_drive
->type
;
442 SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_RESETCONTENT
, 0, 0);
444 for (i
= 0; i
< sizeof(type_pairs
) / sizeof(struct drive_typemap
); i
++)
446 SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_ADDSTRING
, 0, (LPARAM
) type_pairs
[i
].sDesc
);
448 if (type_pairs
[i
].sCode
== type
)
454 if (selection
== -1) selection
= DRIVE_TYPE_DEFAULT
;
455 SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_SETCURSEL
, selection
, 0);
457 /* removeable media properties */
458 label
= current_drive
->label
;
459 set_text(dialog
, IDC_EDIT_LABEL
, label
);
461 /* set serial edit text */
462 serial
= current_drive
->serial
;
463 set_text(dialog
, IDC_EDIT_SERIAL
, serial
);
465 /* TODO: get the device here to put into the edit box */
466 device
= "Not implemented yet";
467 set_text(dialog
, IDC_EDIT_DEVICE
, device
);
470 selection
= IDC_RADIO_ASSIGN
;
471 if ((type
== DRIVE_CDROM
) || (type
== DRIVE_REMOVABLE
))
475 selection
= IDC_RADIO_AUTODETECT
;
476 enable_labelserial_box(dialog
, BOX_MODE_CD_AUTODETECT
);
480 selection
= IDC_RADIO_ASSIGN
;
481 enable_labelserial_box(dialog
, BOX_MODE_CD_ASSIGN
);
486 enable_labelserial_box(dialog
, BOX_MODE_NORMAL
);
487 selection
= IDC_RADIO_ASSIGN
;
490 CheckRadioButton(dialog
, IDC_RADIO_AUTODETECT
, IDC_RADIO_ASSIGN
, selection
);
497 static void on_edit_changed(HWND dialog
, WORD id
)
499 if (updating_ui
) return;
501 WINE_TRACE("edit id %d changed\n", id
);
509 label
= get_text(dialog
, id
);
510 HeapFree(GetProcessHeap(), 0, current_drive
->label
);
511 current_drive
->label
= label
? label
: strdupA("");
513 WINE_TRACE("set label to %s\n", current_drive
->label
);
515 /* enable the apply button */
516 SendMessage(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
524 path
= get_text(dialog
, id
);
525 HeapFree(GetProcessHeap(), 0, current_drive
->unixpath
);
526 current_drive
->unixpath
= path
? path
: strdupA("drive_c");
528 WINE_TRACE("set path to %s\n", current_drive
->unixpath
);
530 lv_set_item_text(dialog
, lv_get_curr_select(dialog
), 1,
531 current_drive
->unixpath
);
533 /* enable the apply button */
534 SendMessage(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
538 case IDC_EDIT_SERIAL
:
542 serial
= get_text(dialog
, id
);
543 HeapFree(GetProcessHeap(), 0, current_drive
->serial
);
544 current_drive
->serial
= serial
? serial
: strdupA("");
546 WINE_TRACE("set serial to %s", current_drive
->serial
);
548 /* enable the apply button */
549 SendMessage(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
553 case IDC_EDIT_DEVICE
:
555 char *device
= get_text(dialog
, id
);
556 /* TODO: handle device if/when it makes sense to do so.... */
557 HeapFree(GetProcessHeap(), 0, device
);
563 static void get_etched_rect(HWND dialog
, RECT
*rect
)
565 GetClientRect(dialog
, rect
);
567 /* these dimensions from the labelserial static in En.rc */
574 /* this just draws a nice line to separate the advanced gui from the n00b gui :) */
575 static void paint(HWND dialog
)
579 BeginPaint(dialog
, &ps
);
585 get_etched_rect(dialog
, &rect
);
587 DrawEdge(ps
.hdc
, &rect
, EDGE_ETCHED
, BF_TOP
);
590 EndPaint(dialog
, &ps
);
593 static void browse_for_folder(HWND dialog
)
595 static WCHAR wszUnixRootDisplayName
[] =
596 { ':',':','{','C','C','7','0','2','E','B','2','-','7','D','C','5','-','1','1','D','9','-',
597 'C','6','8','7','-','0','0','0','4','2','3','8','A','0','1','C','D','}', 0 };
598 char pszChoosePath
[256];
609 IShellFolder
*pDesktop
;
610 LPITEMIDLIST pidlUnixRoot
, pidlSelectedPath
;
613 LoadString(GetModuleHandle(NULL
), IDS_CHOOSE_PATH
, pszChoosePath
, 256);
615 hr
= SHGetDesktopFolder(&pDesktop
);
616 if (!SUCCEEDED(hr
)) return;
618 hr
= IShellFolder_ParseDisplayName(pDesktop
, NULL
, NULL
, wszUnixRootDisplayName
, NULL
,
619 &pidlUnixRoot
, NULL
);
620 if (!SUCCEEDED(hr
)) {
621 IShellFolder_Release(pDesktop
);
625 bi
.pidlRoot
= pidlUnixRoot
;
626 pidlSelectedPath
= SHBrowseForFolderA(&bi
);
627 SHFree(pidlUnixRoot
);
629 if (pidlSelectedPath
) {
630 STRRET strSelectedPath
;
631 char *pszSelectedPath
;
634 hr
= IShellFolder_GetDisplayNameOf(pDesktop
, pidlSelectedPath
, SHGDN_FORPARSING
,
636 IShellFolder_Release(pDesktop
);
637 if (!SUCCEEDED(hr
)) {
638 SHFree(pidlSelectedPath
);
642 hr
= StrRetToStr(&strSelectedPath
, pidlSelectedPath
, &pszSelectedPath
);
643 SHFree(pidlSelectedPath
);
644 if (!SUCCEEDED(hr
)) return;
646 set_text(dialog
, IDC_EDIT_PATH
, pszSelectedPath
);
648 CoTaskMemFree(pszSelectedPath
);
652 static void init_listview_columns(HWND dialog
)
658 GetClientRect(GetDlgItem(dialog
, IDC_LIST_DRIVES
), &viewRect
);
659 width
= (viewRect
.right
- viewRect
.left
) / 6 - 5;
661 listColumn
.mask
= LVCF_TEXT
| LVCF_WIDTH
| LVCF_SUBITEM
;
662 listColumn
.pszText
= (char*) "Letter";
663 listColumn
.cchTextMax
= lstrlen(listColumn
.pszText
);
664 listColumn
.cx
= width
;
666 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_INSERTCOLUMN
, 0, (LPARAM
) &listColumn
);
668 listColumn
.cx
= viewRect
.right
- viewRect
.left
- width
;
669 listColumn
.pszText
= (char*) "Drive Mapping";
670 listColumn
.cchTextMax
= lstrlen(listColumn
.pszText
);
672 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_INSERTCOLUMN
, 1, (LPARAM
) &listColumn
);
675 static void load_drive_options(HWND dialog
)
677 if (!strcmp(get_reg_key(config_key
, "", "ShowDotFiles", "N"), "Y"))
678 CheckDlgButton(dialog
, IDC_SHOW_DOT_FILES
, BST_CHECKED
);
682 DriveDlgProc (HWND dialog
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
690 init_listview_columns(dialog
);
692 load_drive_options(dialog
);
694 if (!drives
[2].in_use
)
695 MessageBox(dialog
, "You don't have a drive C. This is not so great.\n\nRemember to click 'Add' in the Drives tab to create one!\n", "", MB_OK
| MB_ICONEXCLAMATION
);
697 fill_drives_list(dialog
);
698 update_controls(dialog
);
699 /* put in non-advanced mode by default */
700 set_advanced(dialog
);
704 set_window_title(dialog
);
712 switch (HIWORD(wParam
))
715 on_edit_changed(dialog
, LOWORD(wParam
));
719 switch (LOWORD(wParam
))
721 case IDC_SHOW_DOT_FILES
:
722 on_options_click(dialog
);
728 SendMessage(GetParent(dialog
), PSM_CHANGED
, 0, 0);
732 switch (LOWORD(wParam
))
735 if (HIWORD(wParam
) != BN_CLICKED
) break;
736 on_add_click(dialog
);
739 case IDC_BUTTON_REMOVE
:
740 if (HIWORD(wParam
) != BN_CLICKED
) break;
741 on_remove_click(dialog
);
744 case IDC_BUTTON_EDIT
:
745 if (HIWORD(wParam
) != BN_CLICKED
) break;
746 item
= SendMessage(GetDlgItem(dialog
, IDC_LIST_DRIVES
), LB_GETCURSEL
, 0, 0);
747 drive
= (struct drive
*) SendMessage(GetDlgItem(dialog
, IDC_LIST_DRIVES
), LB_GETITEMDATA
, item
, 0);
748 /*DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DRIVE_EDIT), NULL, (DLGPROC) DriveEditDlgProc, (LPARAM) drive); */
751 case IDC_BUTTON_AUTODETECT
:
753 fill_drives_list(dialog
);
754 SendMessage(GetParent(dialog
), PSM_CHANGED
, 0, 0);
757 case IDC_BUTTON_SHOW_HIDE_ADVANCED
:
758 advanced
= !advanced
;
759 set_advanced(dialog
);
762 case IDC_BUTTON_BROWSE_PATH
:
763 browse_for_folder(dialog
);
766 case IDC_RADIO_ASSIGN
:
770 str
= get_text(dialog
, IDC_EDIT_LABEL
);
771 HeapFree(GetProcessHeap(), 0, current_drive
->label
);
772 current_drive
->label
= str
? str
: strdupA("");
774 str
= get_text(dialog
, IDC_EDIT_SERIAL
);
775 HeapFree(GetProcessHeap(), 0, current_drive
->serial
);
776 current_drive
->serial
= str
? str
: strdupA("");
778 /* TODO: we don't have a device at this point */
780 enable_labelserial_box(dialog
, BOX_MODE_CD_ASSIGN
);
788 int mode
= BOX_MODE_NORMAL
;
791 if (HIWORD(wParam
) != CBN_SELCHANGE
) break;
793 selection
= SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_GETCURSEL
, 0, 0);
795 if (selection
>= 0 &&
796 (type_pairs
[selection
].sCode
== DRIVE_CDROM
||
797 type_pairs
[selection
].sCode
== DRIVE_REMOVABLE
))
799 if (IsDlgButtonChecked(dialog
, IDC_RADIO_AUTODETECT
))
800 mode
= BOX_MODE_CD_AUTODETECT
;
802 mode
= BOX_MODE_CD_ASSIGN
;
805 enable_labelserial_box(dialog
, mode
);
807 current_drive
->type
= type_pairs
[selection
].sCode
;
815 switch (((LPNMHDR
)lParam
)->code
)
818 WINE_TRACE("PSN_KILLACTIVE\n");
819 SetWindowLongPtr(dialog
, DWLP_MSGRESULT
, FALSE
);
822 apply_drive_changes();
823 SetWindowLongPtr(dialog
, DWLP_MSGRESULT
, PSNRET_NOERROR
);
827 case LVN_ITEMCHANGED
:
829 LPNMLISTVIEW lpnm
= (LPNMLISTVIEW
)lParam
;
830 if (!(lpnm
->uOldState
& LVIS_SELECTED
) &&
831 (lpnm
->uNewState
& LVIS_SELECTED
))
832 update_controls(dialog
);