2 * WineCfg app settings tabsheet
4 * Copyright 2004 Robert van Herk
5 * Copyright 2004 Chris Morgan
6 * Copyright 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define WIN32_LEAN_AND_MEAN
27 #include <wine/debug.h>
33 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
37 const WCHAR
*szVersion
;
38 const WCHAR
*szDescription
;
39 const WCHAR
*szCurrentVersion
;
44 const WCHAR
*szCSDVersion
;
45 WORD wServicePackMajor
;
46 WORD wServicePackMinor
;
47 const WCHAR
*szProductType
;
50 static const struct win_version win_versions
[] =
52 { L
"win11", L
"Windows 11", L
"6.3", 10, 0, 22000, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
53 { L
"win10", L
"Windows 10", L
"6.3", 10, 0, 19043, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
54 { L
"win81", L
"Windows 8.1", NULL
, 6, 3, 9600, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
55 { L
"win8", L
"Windows 8", NULL
, 6, 2, 9200, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
56 { L
"win2008r2", L
"Windows 2008 R2", NULL
, 6, 1, 7601, VER_PLATFORM_WIN32_NT
, L
"Service Pack 1", 1, 0, L
"ServerNT"},
57 { L
"win7", L
"Windows 7", NULL
, 6, 1, 7601, VER_PLATFORM_WIN32_NT
, L
"Service Pack 1", 1, 0, L
"WinNT"},
58 { L
"win2008", L
"Windows 2008", NULL
, 6, 0, 6002, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"ServerNT"},
59 { L
"vista", L
"Windows Vista", NULL
, 6, 0, 6002, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"WinNT"},
60 { L
"win2003", L
"Windows 2003", NULL
, 5, 2, 3790, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"ServerNT"},
61 { L
"winxp64", L
"Windows XP 64", NULL
, 5, 2, 3790, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"WinNT"},
62 { L
"winxp", L
"Windows XP", NULL
, 5, 1, 2600, VER_PLATFORM_WIN32_NT
, L
"Service Pack 3", 3, 0, L
"WinNT"},
63 { L
"win2k", L
"Windows 2000", NULL
, 5, 0, 2195, VER_PLATFORM_WIN32_NT
, L
"Service Pack 4", 4, 0, L
"WinNT"},
64 { L
"winme", L
"Windows ME", NULL
, 4, 90, 3000, VER_PLATFORM_WIN32_WINDOWS
, L
" ", 0, 0, L
""},
65 { L
"win98", L
"Windows 98", NULL
, 4, 10, 2222, VER_PLATFORM_WIN32_WINDOWS
, L
" A ", 0, 0, L
""},
66 { L
"win95", L
"Windows 95", NULL
, 4, 0, 950, VER_PLATFORM_WIN32_WINDOWS
, L
"", 0, 0, L
""},
67 { L
"nt40", L
"Windows NT 4.0", NULL
, 4, 0, 1381, VER_PLATFORM_WIN32_NT
, L
"Service Pack 6a", 6, 0, L
"WinNT"},
68 { L
"nt351", L
"Windows NT 3.51", NULL
, 3, 51, 1057, VER_PLATFORM_WIN32_NT
, L
"Service Pack 5", 5, 0, L
"WinNT"},
69 { L
"win31", L
"Windows 3.1", NULL
, 3, 10, 0, VER_PLATFORM_WIN32s
, L
"Win32s 1.3", 0, 0, L
""},
70 { L
"win30", L
"Windows 3.0", NULL
, 3, 0, 0, VER_PLATFORM_WIN32s
, L
"Win32s 1.3", 0, 0, L
""},
71 { L
"win20", L
"Windows 2.0", NULL
, 2, 0, 0, VER_PLATFORM_WIN32s
, L
"Win32s 1.3", 0, 0, L
""}
74 #define DEFAULT_WIN_VERSION L"win10"
76 static const WCHAR szKey9x
[] = L
"Software\\Microsoft\\Windows\\CurrentVersion";
77 static const WCHAR szKeyNT
[] = L
"Software\\Microsoft\\Windows NT\\CurrentVersion";
78 static const WCHAR szKeyProdNT
[] = L
"System\\CurrentControlSet\\Control\\ProductOptions";
80 static DWORD
get_reg_dword( HKEY root
, const WCHAR
*subkey
, const WCHAR
*value
)
83 DWORD ret
, len
= sizeof(ret
), type
;
85 if (RegOpenKeyExW( root
, subkey
, 0, KEY_QUERY_VALUE
, &hkey
)) return 0;
86 if (RegQueryValueExW( hkey
, value
, NULL
, &type
, (BYTE
*)&ret
, &len
) || type
!= REG_DWORD
) ret
= 0;
91 static int get_registry_version(void)
93 int i
, best
= -1, platform
, major
= 0, minor
= 0, build
= 0;
94 WCHAR
*p
, *ver
, *type
= NULL
;
96 if ((ver
= get_reg_key( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", NULL
)))
100 platform
= VER_PLATFORM_WIN32_NT
;
102 major
= get_reg_dword( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMajorVersionNumber" );
103 minor
= get_reg_dword( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMinorVersionNumber" );
105 build_str
= get_reg_key( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", NULL
);
106 build
= wcstol(build_str
, NULL
, 10);
108 type
= get_reg_key( HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", NULL
);
110 else if ((ver
= get_reg_key( HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", NULL
)))
111 platform
= VER_PLATFORM_WIN32_WINDOWS
;
117 if ((p
= wcschr( ver
, '.' )))
119 WCHAR
*minor_str
= p
;
121 if ((p
= wcschr( minor_str
, '.' )))
123 WCHAR
*build_str
= p
;
125 build
= wcstol(build_str
, NULL
, 10);
127 minor
= wcstol(minor_str
, NULL
, 10);
129 major
= wcstol(ver
, NULL
, 10);
132 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
134 if (win_versions
[i
].dwPlatformId
!= platform
) continue;
135 if (win_versions
[i
].dwMajorVersion
!= major
) continue;
136 if (type
&& wcsicmp(win_versions
[i
].szProductType
, type
)) continue;
138 if ((win_versions
[i
].dwMinorVersion
== minor
) &&
139 (win_versions
[i
].dwBuildNumber
== build
))
145 static void update_comboboxes(HWND dialog
)
150 /* retrieve the registry values */
151 winver
= get_reg_key(config_key
, keypath(L
""), L
"Version", L
"");
152 ver
= get_registry_version();
154 if (!winver
|| !winver
[0])
158 if (current_app
) /* no explicit setting */
160 WINE_TRACE("setting winver combobox to default\n");
161 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_SETCURSEL
, 0, 0);
164 if (ver
!= -1) winver
= wcsdup(win_versions
[ver
].szVersion
);
165 else winver
= wcsdup(DEFAULT_WIN_VERSION
);
167 WINE_TRACE("winver is %s\n", debugstr_w(winver
));
169 /* normalize the version strings */
170 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
172 if (!wcsicmp(win_versions
[i
].szVersion
, winver
))
174 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_SETCURSEL
,
175 i
+ (current_app
?1:0), 0);
176 WINE_TRACE("match with %s\n", debugstr_w(win_versions
[i
].szVersion
));
185 init_comboboxes (HWND dialog
)
189 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_RESETCONTENT
, 0, 0);
191 /* add the default entries (automatic) which correspond to no setting */
195 LoadStringW(GetModuleHandleW(NULL
), IDS_USE_GLOBAL_SETTINGS
, str
, ARRAY_SIZE(str
));
196 SendDlgItemMessageW (dialog
, IDC_WINVER
, CB_ADDSTRING
, 0, (LPARAM
)str
);
199 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
201 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_ADDSTRING
,
202 0, (LPARAM
) win_versions
[i
].szDescription
);
206 static void add_listview_item(HWND listview
, WCHAR
*text
, void *association
)
210 item
.mask
= LVIF_TEXT
| LVIF_PARAM
;
212 item
.cchTextMax
= lstrlenW(text
);
213 item
.lParam
= (LPARAM
) association
;
214 item
.iItem
= SendMessageW( listview
, LVM_GETITEMCOUNT
, 0, 0 );
217 SendMessageW(listview
, LVM_INSERTITEMW
, 0, (LPARAM
) &item
);
220 /* Called when the application is initialized (cannot reinit!) */
221 static void init_appsheet(HWND dialog
)
232 listview
= GetDlgItem(dialog
, IDC_APP_LISTVIEW
);
234 /* we use the lparam field of the item so we can alter the presentation later and not change code
235 * for instance, to use the tile view or to display the EXEs embedded 'display name' */
236 LoadStringW(GetModuleHandleW(NULL
), IDS_DEFAULT_SETTINGS
, appname
, ARRAY_SIZE(appname
));
237 add_listview_item(listview
, appname
, NULL
);
239 /* because this list is only populated once, it's safe to bypass the settings list here */
240 if (RegOpenKeyW(config_key
, L
"AppDefaults", &key
) == ERROR_SUCCESS
)
243 size
= ARRAY_SIZE(appname
);
244 while (RegEnumKeyExW (key
, i
, appname
, &size
, NULL
, NULL
, NULL
, NULL
) == ERROR_SUCCESS
)
246 add_listview_item(listview
, appname
, wcsdup(appname
));
249 size
= ARRAY_SIZE(appname
);
255 init_comboboxes(dialog
);
257 /* Select the default settings listview item */
260 item
.mask
= LVIF_STATE
;
261 item
.state
= LVIS_SELECTED
| LVIS_FOCUSED
;
262 item
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
264 SendMessageW(listview
, LVM_SETITEMW
, 0, (LPARAM
) &item
);
267 /* there has to be an easier way than this */
268 static int get_listview_selection(HWND listview
)
270 int count
= SendMessageW(listview
, LVM_GETITEMCOUNT
, 0, 0);
273 for (i
= 0; i
< count
; i
++)
275 if (SendMessageW( listview
, LVM_GETITEMSTATE
, i
, LVIS_SELECTED
)) return i
;
282 /* called when the user selects a different application */
283 static void on_selection_change(HWND dialog
, HWND listview
)
286 WCHAR
* oldapp
= current_app
;
290 item
.iItem
= get_listview_selection(listview
);
292 item
.mask
= LVIF_PARAM
;
294 WINE_TRACE("item.iItem=%d\n", item
.iItem
);
296 if (item
.iItem
== -1) return;
298 SendMessageW(listview
, LVM_GETITEMW
, 0, (LPARAM
) &item
);
300 current_app
= (WCHAR
*) item
.lParam
;
304 WINE_TRACE("current_app is now %s\n", wine_dbgstr_w (current_app
));
305 enable(IDC_APP_REMOVEAPP
);
309 WINE_TRACE("current_app=NULL, editing global settings\n");
310 /* focus will never be on the button in this callback so it's safe */
311 disable(IDC_APP_REMOVEAPP
);
314 /* reset the combo boxes if we changed from/to global/app-specific */
316 if ((oldapp
&& !current_app
) || (!oldapp
&& current_app
))
317 init_comboboxes(dialog
);
319 update_comboboxes(dialog
);
321 set_window_title(dialog
);
324 static BOOL
list_contains_file(HWND listview
, WCHAR
*filename
)
326 LVFINDINFOW find_info
= { LVFI_STRING
, filename
, 0, {0, 0}, 0 };
329 index
= ListView_FindItemW(listview
, -1, &find_info
);
331 return (index
!= -1);
334 static void on_add_app_click(HWND dialog
)
336 WCHAR filetitle
[MAX_PATH
];
337 WCHAR file
[MAX_PATH
];
338 WCHAR programsFilter
[100], filter
[MAX_PATH
];
339 WCHAR selectExecutableStr
[100];
341 OPENFILENAMEW ofn
= { sizeof(OPENFILENAMEW
),
342 dialog
, /*hInst*/0, 0, NULL
, 0, 0, NULL
,
343 0, NULL
, 0, L
"C:\\", 0,
344 OFN_SHOWHELP
| OFN_HIDEREADONLY
| OFN_ENABLESIZING
,
345 0, 0, NULL
, 0, NULL
};
347 LoadStringW (GetModuleHandleW(NULL
), IDS_SELECT_EXECUTABLE
, selectExecutableStr
,
348 ARRAY_SIZE(selectExecutableStr
));
349 LoadStringW (GetModuleHandleW(NULL
), IDS_EXECUTABLE_FILTER
, programsFilter
,
350 ARRAY_SIZE(programsFilter
));
351 swprintf( filter
, MAX_PATH
, L
"%s%c*.exe;*.exe.so%c", programsFilter
, 0, 0 );
353 ofn
.lpstrTitle
= selectExecutableStr
;
354 ofn
.lpstrFilter
= filter
;
355 ofn
.lpstrFileTitle
= filetitle
;
356 ofn
.lpstrFileTitle
[0] = '\0';
357 ofn
.nMaxFileTitle
= ARRAY_SIZE(filetitle
);
358 ofn
.lpstrFile
= file
;
359 ofn
.lpstrFile
[0] = '\0';
360 ofn
.nMaxFile
= ARRAY_SIZE(file
);
362 if (GetOpenFileNameW (&ofn
))
364 HWND listview
= GetDlgItem(dialog
, IDC_APP_LISTVIEW
);
365 int count
= SendMessageW(listview
, LVM_GETITEMCOUNT
, 0, 0);
369 if (list_contains_file(listview
, filetitle
))
372 new_app
= wcsdup(filetitle
);
374 WINE_TRACE("adding %s\n", wine_dbgstr_w (new_app
));
376 add_listview_item(listview
, new_app
, new_app
);
378 item
.mask
= LVIF_STATE
;
379 item
.state
= LVIS_SELECTED
| LVIS_FOCUSED
;
380 item
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
381 SendMessageW(listview
, LVM_SETITEMSTATE
, count
, (LPARAM
)&item
);
385 else WINE_TRACE("user cancelled\n");
388 static void on_remove_app_click(HWND dialog
)
390 HWND listview
= GetDlgItem(dialog
, IDC_APP_LISTVIEW
);
391 int selection
= get_listview_selection(listview
);
394 item
.iItem
= selection
;
396 item
.mask
= LVIF_PARAM
;
398 WINE_TRACE("selection=%d\n", selection
);
400 assert( selection
!= 0 ); /* user cannot click this button when "default settings" is selected */
402 set_reg_key(config_key
, keypath(L
""), NULL
, NULL
); /* delete the section */
403 SendMessageW(listview
, LVM_GETITEMW
, 0, (LPARAM
) &item
);
404 free((void*)item
.lParam
);
405 SendMessageW(listview
, LVM_DELETEITEM
, selection
, 0);
406 item
.mask
= LVIF_STATE
;
407 item
.state
= LVIS_SELECTED
| LVIS_FOCUSED
;
408 item
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
409 SendMessageW(listview
, LVM_SETITEMSTATE
, 0, (LPARAM
)&item
);
412 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
415 static void set_winver(const struct win_version
*version
)
417 static const WCHAR szKeyWindNT
[] = L
"System\\CurrentControlSet\\Control\\Windows";
418 static const WCHAR szKeyEnvNT
[] = L
"System\\CurrentControlSet\\Control\\Session Manager\\Environment";
421 switch (version
->dwPlatformId
)
423 case VER_PLATFORM_WIN32_WINDOWS
:
424 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"%d.%d.%d", version
->dwMajorVersion
,
425 version
->dwMinorVersion
, version
->dwBuildNumber
);
426 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", buffer
);
427 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"SubVersionNumber", version
->szCSDVersion
);
428 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"Microsoft %s", version
->szDescription
);
429 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"ProductName", buffer
);
431 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CSDVersion", NULL
);
432 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", NULL
);
433 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMajorVersionNumber", NULL
);
434 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMinorVersionNumber", NULL
);
435 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuild", NULL
);
436 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", NULL
);
437 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"ProductName", NULL
);
438 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", NULL
);
439 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyWindNT
, L
"CSDVersion", NULL
);
440 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyEnvNT
, L
"OS", NULL
);
441 set_reg_key(config_key
, keypath(L
""), L
"Version", NULL
);
444 case VER_PLATFORM_WIN32_NT
:
445 if (version
->szCurrentVersion
)
446 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", version
->szCurrentVersion
);
449 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"%d.%d", version
->dwMajorVersion
, version
->dwMinorVersion
);
450 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", buffer
);
452 set_reg_key_dword(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMajorVersionNumber", version
->dwMajorVersion
);
453 set_reg_key_dword(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMinorVersionNumber", version
->dwMinorVersion
);
454 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CSDVersion", version
->szCSDVersion
);
455 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"%d", version
->dwBuildNumber
);
456 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuild", buffer
);
457 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", buffer
);
458 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"Microsoft %s", version
->szDescription
);
459 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"ProductName", buffer
);
460 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", version
->szProductType
);
461 set_reg_key_dword(HKEY_LOCAL_MACHINE
, szKeyWindNT
, L
"CSDVersion",
462 MAKEWORD( version
->wServicePackMinor
,
463 version
->wServicePackMajor
));
464 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyEnvNT
, L
"OS", L
"Windows_NT");
466 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", NULL
);
467 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"SubVersionNumber", NULL
);
468 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"ProductName", NULL
);
469 set_reg_key(config_key
, keypath(L
""), L
"Version", NULL
);
472 case VER_PLATFORM_WIN32s
:
473 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CSDVersion", NULL
);
474 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", NULL
);
475 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuild", NULL
);
476 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", NULL
);
477 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"ProductName", NULL
);
478 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", NULL
);
479 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyWindNT
, L
"CSDVersion", NULL
);
480 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyEnvNT
, L
"OS", NULL
);
481 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", NULL
);
482 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"SubVersionNumber", NULL
);
483 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"ProductName", NULL
);
484 set_reg_key(config_key
, keypath(L
""), L
"Version", version
->szVersion
);
489 BOOL
set_winver_from_string(const WCHAR
*version
)
493 WINE_TRACE("desired winver: %s\n", debugstr_w(version
));
495 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
497 if (!wcsicmp(win_versions
[i
].szVersion
, version
))
499 WINE_TRACE("match with %s\n", debugstr_w(win_versions
[i
].szVersion
));
500 set_winver(&win_versions
[i
]);
509 void print_windows_versions(void)
513 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
515 MESSAGE(" %10ls %ls\n", win_versions
[i
].szVersion
, win_versions
[i
].szDescription
);
519 void print_current_winver(void)
521 WCHAR
*winver
= get_reg_key(config_key
, keypath(L
""), L
"Version", L
"");
523 if (!winver
|| !winver
[0])
525 int ver
= get_registry_version();
526 MESSAGE("%ls\n", ver
== -1 ? DEFAULT_WIN_VERSION
: win_versions
[ver
].szVersion
);
529 MESSAGE("%ls\n", winver
);
534 static void on_winver_change(HWND dialog
)
536 int selection
= SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_GETCURSEL
, 0, 0);
542 WINE_TRACE("default selected so removing current setting\n");
543 set_reg_key(config_key
, keypath(L
""), L
"Version", NULL
);
547 WINE_TRACE("setting Version key to value %s\n", debugstr_w(win_versions
[selection
-1].szVersion
));
548 set_reg_key(config_key
, keypath(L
""), L
"Version", win_versions
[selection
-1].szVersion
);
551 else /* global version only */
553 set_winver(&win_versions
[selection
]);
556 /* enable the apply button */
557 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
561 AppDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
570 set_window_title(hDlg
);
574 switch (((LPNMHDR
)lParam
)->code
)
576 case LVN_ITEMCHANGED
:
577 on_selection_change(hDlg
, GetDlgItem(hDlg
, IDC_APP_LISTVIEW
));
581 SetWindowLongPtrW(hDlg
, DWLP_MSGRESULT
, PSNRET_NOERROR
);
588 switch(HIWORD(wParam
))
591 switch(LOWORD(wParam
))
594 on_winver_change(hDlg
);
598 switch(LOWORD(wParam
))
601 on_add_app_click(hDlg
);
603 case IDC_APP_REMOVEAPP
:
604 on_remove_app_click(hDlg
);