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>
34 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
38 const WCHAR
*szVersion
;
39 const WCHAR
*szDescription
;
40 const WCHAR
*szCurrentVersion
;
45 const WCHAR
*szCSDVersion
;
46 WORD wServicePackMajor
;
47 WORD wServicePackMinor
;
48 const WCHAR
*szProductType
;
51 static const struct win_version win_versions
[] =
53 { L
"win11", L
"Windows 11", L
"6.3", 10, 0, 22000, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
54 { L
"win10", L
"Windows 10", L
"6.3", 10, 0, 18362, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
55 { L
"win81", L
"Windows 8.1", NULL
, 6, 3, 9600, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
56 { L
"win8", L
"Windows 8", NULL
, 6, 2, 9200, VER_PLATFORM_WIN32_NT
, L
"", 0, 0, L
"WinNT"},
57 { L
"win2008r2", L
"Windows 2008 R2", NULL
, 6, 1, 7601, VER_PLATFORM_WIN32_NT
, L
"Service Pack 1", 1, 0, L
"ServerNT"},
58 { L
"win7", L
"Windows 7", NULL
, 6, 1, 7601, VER_PLATFORM_WIN32_NT
, L
"Service Pack 1", 1, 0, L
"WinNT"},
59 { L
"win2008", L
"Windows 2008", NULL
, 6, 0, 6002, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"ServerNT"},
60 { L
"vista", L
"Windows Vista", NULL
, 6, 0, 6002, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"WinNT"},
61 { L
"win2003", L
"Windows 2003", NULL
, 5, 2, 3790, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"ServerNT"},
63 { L
"winxp64", L
"Windows XP", NULL
, 5, 2, 3790, VER_PLATFORM_WIN32_NT
, L
"Service Pack 2", 2, 0, L
"WinNT"},
65 { L
"winxp", L
"Windows XP", NULL
, 5, 1, 2600, VER_PLATFORM_WIN32_NT
, L
"Service Pack 3", 3, 0, L
"WinNT"},
66 { L
"win2k", L
"Windows 2000", NULL
, 5, 0, 2195, VER_PLATFORM_WIN32_NT
, L
"Service Pack 4", 4, 0, L
"WinNT"},
67 { L
"winme", L
"Windows ME", NULL
, 4, 90, 3000, VER_PLATFORM_WIN32_WINDOWS
, L
" ", 0, 0, L
""},
68 { L
"win98", L
"Windows 98", NULL
, 4, 10, 2222, VER_PLATFORM_WIN32_WINDOWS
, L
" A ", 0, 0, L
""},
69 { L
"win95", L
"Windows 95", NULL
, 4, 0, 950, VER_PLATFORM_WIN32_WINDOWS
, L
"", 0, 0, L
""},
70 { L
"nt40", L
"Windows NT 4.0", NULL
, 4, 0, 1381, VER_PLATFORM_WIN32_NT
, L
"Service Pack 6a", 6, 0, L
"WinNT"},
71 { L
"nt351", L
"Windows NT 3.51", NULL
, 3, 51, 1057, VER_PLATFORM_WIN32_NT
, L
"Service Pack 5", 5, 0, L
"WinNT"},
72 { L
"win31", L
"Windows 3.1", NULL
, 3, 10, 0, VER_PLATFORM_WIN32s
, L
"Win32s 1.3", 0, 0, L
""},
73 { L
"win30", L
"Windows 3.0", NULL
, 3, 0, 0, VER_PLATFORM_WIN32s
, L
"Win32s 1.3", 0, 0, L
""},
74 { L
"win20", L
"Windows 2.0", NULL
, 2, 0, 0, VER_PLATFORM_WIN32s
, L
"Win32s 1.3", 0, 0, L
""}
78 #define DEFAULT_WIN_VERSION L"win10"
80 static const WCHAR szKey9x
[] = L
"Software\\Microsoft\\Windows\\CurrentVersion";
81 static const WCHAR szKeyNT
[] = L
"Software\\Microsoft\\Windows NT\\CurrentVersion";
82 static const WCHAR szKeyProdNT
[] = L
"System\\CurrentControlSet\\Control\\ProductOptions";
84 static DWORD
get_reg_dword( HKEY root
, const WCHAR
*subkey
, const WCHAR
*value
)
87 DWORD ret
, len
= sizeof(ret
), type
;
89 if (RegOpenKeyExW( root
, subkey
, 0, KEY_QUERY_VALUE
, &hkey
)) return 0;
90 if (RegQueryValueExW( hkey
, value
, NULL
, &type
, (BYTE
*)&ret
, &len
) || type
!= REG_DWORD
) ret
= 0;
95 static int get_registry_version(void)
97 int i
, best
= -1, platform
, major
= 0, minor
= 0, build
= 0;
98 WCHAR
*p
, *ver
, *type
= NULL
;
100 if ((ver
= get_reg_key( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", NULL
)))
104 platform
= VER_PLATFORM_WIN32_NT
;
106 major
= get_reg_dword( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMajorVersionNumber" );
107 minor
= get_reg_dword( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMinorVersionNumber" );
109 build_str
= get_reg_key( HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", NULL
);
110 build
= wcstol(build_str
, NULL
, 10);
112 type
= get_reg_key( HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", NULL
);
114 else if ((ver
= get_reg_key( HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", NULL
)))
115 platform
= VER_PLATFORM_WIN32_WINDOWS
;
121 if ((p
= wcschr( ver
, '.' )))
123 WCHAR
*minor_str
= p
;
125 if ((p
= wcschr( minor_str
, '.' )))
127 WCHAR
*build_str
= p
;
129 build
= wcstol(build_str
, NULL
, 10);
131 minor
= wcstol(minor_str
, NULL
, 10);
133 major
= wcstol(ver
, NULL
, 10);
136 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
138 if (win_versions
[i
].dwPlatformId
!= platform
) continue;
139 if (win_versions
[i
].dwMajorVersion
!= major
) continue;
140 if (type
&& wcsicmp(win_versions
[i
].szProductType
, type
)) continue;
142 if ((win_versions
[i
].dwMinorVersion
== minor
) &&
143 (win_versions
[i
].dwBuildNumber
== build
))
149 static void update_comboboxes(HWND dialog
)
154 /* retrieve the registry values */
155 winver
= get_reg_key(config_key
, keypath(L
""), L
"Version", L
"");
156 ver
= get_registry_version();
158 if (!winver
|| !winver
[0])
162 if (current_app
) /* no explicit setting */
164 WINE_TRACE("setting winver combobox to default\n");
165 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_SETCURSEL
, 0, 0);
168 if (ver
!= -1) winver
= wcsdup(win_versions
[ver
].szVersion
);
169 else winver
= wcsdup(DEFAULT_WIN_VERSION
);
171 WINE_TRACE("winver is %s\n", debugstr_w(winver
));
173 /* normalize the version strings */
174 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
176 if (!wcsicmp(win_versions
[i
].szVersion
, winver
))
178 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_SETCURSEL
,
179 i
+ (current_app
?1:0), 0);
180 WINE_TRACE("match with %s\n", debugstr_w(win_versions
[i
].szVersion
));
189 init_comboboxes (HWND dialog
)
193 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_RESETCONTENT
, 0, 0);
195 /* add the default entries (automatic) which correspond to no setting */
199 LoadStringW(GetModuleHandleW(NULL
), IDS_USE_GLOBAL_SETTINGS
, str
, ARRAY_SIZE(str
));
200 SendDlgItemMessageW (dialog
, IDC_WINVER
, CB_ADDSTRING
, 0, (LPARAM
)str
);
203 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
205 SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_ADDSTRING
,
206 0, (LPARAM
) win_versions
[i
].szDescription
);
210 static void add_listview_item(HWND listview
, WCHAR
*text
, void *association
)
214 item
.mask
= LVIF_TEXT
| LVIF_PARAM
;
216 item
.cchTextMax
= lstrlenW(text
);
217 item
.lParam
= (LPARAM
) association
;
218 item
.iItem
= SendMessageW( listview
, LVM_GETITEMCOUNT
, 0, 0 );
221 SendMessageW(listview
, LVM_INSERTITEMW
, 0, (LPARAM
) &item
);
224 /* Called when the application is initialized (cannot reinit!) */
225 static void init_appsheet(HWND dialog
)
236 listview
= GetDlgItem(dialog
, IDC_APP_LISTVIEW
);
238 /* we use the lparam field of the item so we can alter the presentation later and not change code
239 * for instance, to use the tile view or to display the EXEs embedded 'display name' */
240 LoadStringW(GetModuleHandleW(NULL
), IDS_DEFAULT_SETTINGS
, appname
, ARRAY_SIZE(appname
));
241 add_listview_item(listview
, appname
, NULL
);
243 /* because this list is only populated once, it's safe to bypass the settings list here */
244 if (RegOpenKeyW(config_key
, L
"AppDefaults", &key
) == ERROR_SUCCESS
)
247 size
= ARRAY_SIZE(appname
);
248 while (RegEnumKeyExW (key
, i
, appname
, &size
, NULL
, NULL
, NULL
, NULL
) == ERROR_SUCCESS
)
250 add_listview_item(listview
, appname
, wcsdup(appname
));
253 size
= ARRAY_SIZE(appname
);
259 init_comboboxes(dialog
);
261 /* Select the default settings listview item */
264 item
.mask
= LVIF_STATE
;
265 item
.state
= LVIS_SELECTED
| LVIS_FOCUSED
;
266 item
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
268 SendMessageW(listview
, LVM_SETITEMW
, 0, (LPARAM
) &item
);
271 /* there has to be an easier way than this */
272 static int get_listview_selection(HWND listview
)
274 int count
= SendMessageW(listview
, LVM_GETITEMCOUNT
, 0, 0);
277 for (i
= 0; i
< count
; i
++)
279 if (SendMessageW( listview
, LVM_GETITEMSTATE
, i
, LVIS_SELECTED
)) return i
;
286 /* called when the user selects a different application */
287 static void on_selection_change(HWND dialog
, HWND listview
)
290 WCHAR
* oldapp
= current_app
;
294 item
.iItem
= get_listview_selection(listview
);
296 item
.mask
= LVIF_PARAM
;
298 WINE_TRACE("item.iItem=%d\n", item
.iItem
);
300 if (item
.iItem
== -1) return;
302 SendMessageW(listview
, LVM_GETITEMW
, 0, (LPARAM
) &item
);
304 current_app
= (WCHAR
*) item
.lParam
;
308 WINE_TRACE("current_app is now %s\n", wine_dbgstr_w (current_app
));
309 enable(IDC_APP_REMOVEAPP
);
313 WINE_TRACE("current_app=NULL, editing global settings\n");
314 /* focus will never be on the button in this callback so it's safe */
315 disable(IDC_APP_REMOVEAPP
);
318 /* reset the combo boxes if we changed from/to global/app-specific */
320 if ((oldapp
&& !current_app
) || (!oldapp
&& current_app
))
321 init_comboboxes(dialog
);
323 update_comboboxes(dialog
);
325 set_window_title(dialog
);
328 static BOOL
list_contains_file(HWND listview
, WCHAR
*filename
)
330 LVFINDINFOW find_info
= { LVFI_STRING
, filename
, 0, {0, 0}, 0 };
333 index
= ListView_FindItemW(listview
, -1, &find_info
);
335 return (index
!= -1);
338 static void on_add_app_click(HWND dialog
)
340 WCHAR filetitle
[MAX_PATH
];
341 WCHAR file
[MAX_PATH
];
342 WCHAR programsFilter
[100], filter
[MAX_PATH
];
343 WCHAR selectExecutableStr
[100];
345 OPENFILENAMEW ofn
= { sizeof(OPENFILENAMEW
),
346 dialog
, /*hInst*/0, 0, NULL
, 0, 0, NULL
,
347 0, NULL
, 0, L
"C:\\", 0,
348 OFN_SHOWHELP
| OFN_HIDEREADONLY
| OFN_ENABLESIZING
,
349 0, 0, NULL
, 0, NULL
};
351 LoadStringW (GetModuleHandleW(NULL
), IDS_SELECT_EXECUTABLE
, selectExecutableStr
,
352 ARRAY_SIZE(selectExecutableStr
));
353 LoadStringW (GetModuleHandleW(NULL
), IDS_EXECUTABLE_FILTER
, programsFilter
,
354 ARRAY_SIZE(programsFilter
));
355 swprintf( filter
, MAX_PATH
, L
"%s%c*.exe;*.exe.so%c", programsFilter
, 0, 0 );
357 ofn
.lpstrTitle
= selectExecutableStr
;
358 ofn
.lpstrFilter
= filter
;
359 ofn
.lpstrFileTitle
= filetitle
;
360 ofn
.lpstrFileTitle
[0] = '\0';
361 ofn
.nMaxFileTitle
= ARRAY_SIZE(filetitle
);
362 ofn
.lpstrFile
= file
;
363 ofn
.lpstrFile
[0] = '\0';
364 ofn
.nMaxFile
= ARRAY_SIZE(file
);
366 if (GetOpenFileNameW (&ofn
))
368 HWND listview
= GetDlgItem(dialog
, IDC_APP_LISTVIEW
);
369 int count
= SendMessageW(listview
, LVM_GETITEMCOUNT
, 0, 0);
373 if (list_contains_file(listview
, filetitle
))
376 new_app
= wcsdup(filetitle
);
378 WINE_TRACE("adding %s\n", wine_dbgstr_w (new_app
));
380 add_listview_item(listview
, new_app
, new_app
);
382 item
.mask
= LVIF_STATE
;
383 item
.state
= LVIS_SELECTED
| LVIS_FOCUSED
;
384 item
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
385 SendMessageW(listview
, LVM_SETITEMSTATE
, count
, (LPARAM
)&item
);
389 else WINE_TRACE("user cancelled\n");
392 static void on_remove_app_click(HWND dialog
)
394 HWND listview
= GetDlgItem(dialog
, IDC_APP_LISTVIEW
);
395 int selection
= get_listview_selection(listview
);
398 item
.iItem
= selection
;
400 item
.mask
= LVIF_PARAM
;
402 WINE_TRACE("selection=%d\n", selection
);
404 assert( selection
!= 0 ); /* user cannot click this button when "default settings" is selected */
406 set_reg_key(config_key
, keypath(L
""), NULL
, NULL
); /* delete the section */
407 SendMessageW(listview
, LVM_GETITEMW
, 0, (LPARAM
) &item
);
408 free((void*)item
.lParam
);
409 SendMessageW(listview
, LVM_DELETEITEM
, selection
, 0);
410 item
.mask
= LVIF_STATE
;
411 item
.state
= LVIS_SELECTED
| LVIS_FOCUSED
;
412 item
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
413 SendMessageW(listview
, LVM_SETITEMSTATE
, 0, (LPARAM
)&item
);
416 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
419 static void set_winver(const struct win_version
*version
)
421 static const WCHAR szKeyWindNT
[] = L
"System\\CurrentControlSet\\Control\\Windows";
422 static const WCHAR szKeyEnvNT
[] = L
"System\\CurrentControlSet\\Control\\Session Manager\\Environment";
425 switch (version
->dwPlatformId
)
427 case VER_PLATFORM_WIN32_WINDOWS
:
428 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"%d.%d.%d", version
->dwMajorVersion
,
429 version
->dwMinorVersion
, version
->dwBuildNumber
);
430 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", buffer
);
431 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"SubVersionNumber", version
->szCSDVersion
);
432 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"Microsoft %s", version
->szDescription
);
433 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"ProductName", buffer
);
435 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CSDVersion", NULL
);
436 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", NULL
);
437 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMajorVersionNumber", NULL
);
438 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMinorVersionNumber", NULL
);
439 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuild", NULL
);
440 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", NULL
);
441 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"ProductName", NULL
);
442 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", NULL
);
443 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyWindNT
, L
"CSDVersion", NULL
);
444 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyEnvNT
, L
"OS", NULL
);
445 set_reg_key(config_key
, keypath(L
""), L
"Version", NULL
);
448 case VER_PLATFORM_WIN32_NT
:
449 if (version
->szCurrentVersion
)
450 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", version
->szCurrentVersion
);
453 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"%d.%d", version
->dwMajorVersion
, version
->dwMinorVersion
);
454 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", buffer
);
456 set_reg_key_dword(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMajorVersionNumber", version
->dwMajorVersion
);
457 set_reg_key_dword(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentMinorVersionNumber", version
->dwMinorVersion
);
458 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CSDVersion", version
->szCSDVersion
);
459 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"%d", version
->dwBuildNumber
);
460 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuild", buffer
);
461 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", buffer
);
462 swprintf(buffer
, ARRAY_SIZE(buffer
), L
"Microsoft %s", version
->szDescription
);
463 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"ProductName", buffer
);
464 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", version
->szProductType
);
465 set_reg_key_dword(HKEY_LOCAL_MACHINE
, szKeyWindNT
, L
"CSDVersion",
466 MAKEWORD( version
->wServicePackMinor
,
467 version
->wServicePackMajor
));
468 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyEnvNT
, L
"OS", L
"Windows_NT");
470 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", NULL
);
471 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"SubVersionNumber", NULL
);
472 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"ProductName", NULL
);
473 set_reg_key(config_key
, keypath(L
""), L
"Version", NULL
);
476 case VER_PLATFORM_WIN32s
:
477 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CSDVersion", NULL
);
478 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentVersion", NULL
);
479 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuild", NULL
);
480 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"CurrentBuildNumber", NULL
);
481 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyNT
, L
"ProductName", NULL
);
482 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyProdNT
, L
"ProductType", NULL
);
483 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyWindNT
, L
"CSDVersion", NULL
);
484 set_reg_key(HKEY_LOCAL_MACHINE
, szKeyEnvNT
, L
"OS", NULL
);
485 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"VersionNumber", NULL
);
486 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"SubVersionNumber", NULL
);
487 set_reg_key(HKEY_LOCAL_MACHINE
, szKey9x
, L
"ProductName", NULL
);
488 set_reg_key(config_key
, keypath(L
""), L
"Version", version
->szVersion
);
493 BOOL
set_winver_from_string(const WCHAR
*version
)
497 WINE_TRACE("desired winver: %s\n", debugstr_w(version
));
499 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
501 if (!wcsicmp(win_versions
[i
].szVersion
, version
))
503 WINE_TRACE("match with %s\n", debugstr_w(win_versions
[i
].szVersion
));
504 set_winver(&win_versions
[i
]);
513 void print_windows_versions(void)
517 for (i
= 0; i
< ARRAY_SIZE(win_versions
); i
++)
519 wprintf(L
" %10s %s\n", win_versions
[i
].szVersion
, win_versions
[i
].szDescription
);
523 void print_current_winver(void)
525 WCHAR
*winver
= get_reg_key(config_key
, keypath(L
""), L
"Version", L
"");
527 if (!winver
|| !winver
[0])
529 int ver
= get_registry_version();
530 wprintf(L
"%s\n", ver
== -1 ? DEFAULT_WIN_VERSION
: win_versions
[ver
].szVersion
);
533 wprintf(L
"%s\n", winver
);
538 static void on_winver_change(HWND dialog
)
540 int selection
= SendDlgItemMessageW(dialog
, IDC_WINVER
, CB_GETCURSEL
, 0, 0);
546 WINE_TRACE("default selected so removing current setting\n");
547 set_reg_key(config_key
, keypath(L
""), L
"Version", NULL
);
551 WINE_TRACE("setting Version key to value %s\n", debugstr_w(win_versions
[selection
-1].szVersion
));
552 set_reg_key(config_key
, keypath(L
""), L
"Version", win_versions
[selection
-1].szVersion
);
555 else /* global version only */
557 set_winver(&win_versions
[selection
]);
560 /* enable the apply button */
561 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
565 AppDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
574 set_window_title(hDlg
);
578 switch (((LPNMHDR
)lParam
)->code
)
580 case LVN_ITEMCHANGED
:
581 on_selection_change(hDlg
, GetDlgItem(hDlg
, IDC_APP_LISTVIEW
));
585 SetWindowLongPtrW(hDlg
, DWLP_MSGRESULT
, PSNRET_NOERROR
);
592 switch(HIWORD(wParam
))
595 switch(LOWORD(wParam
))
598 on_winver_change(hDlg
);
602 switch(LOWORD(wParam
))
605 on_add_app_click(hDlg
);
607 case IDC_APP_REMOVEAPP
:
608 on_remove_app_click(hDlg
);