2003-09-30 02:27:55 +02:00
|
|
|
/*
|
2004-02-07 02:01:34 +01:00
|
|
|
* WineCfg app settings tabsheet
|
2003-09-30 02:27:55 +02:00
|
|
|
*
|
2004-02-07 02:01:34 +01:00
|
|
|
* Copyright 2004 Robert van Herk
|
2004-09-28 05:16:43 +02:00
|
|
|
* Copyright 2004 Chris Morgan
|
|
|
|
* Copyright 2004 Mike Hearn
|
2003-09-30 02:27:55 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-01-16 20:41:34 +01:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2004-02-07 02:01:34 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commdlg.h>
|
|
|
|
#include <wine/debug.h>
|
2003-09-30 02:27:55 +02:00
|
|
|
#include <stdio.h>
|
2004-09-28 05:16:43 +02:00
|
|
|
#include <assert.h>
|
2003-09-30 02:27:55 +02:00
|
|
|
#include "winecfg.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
|
|
|
|
|
2005-08-17 13:37:34 +02:00
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const char *szVersion;
|
|
|
|
const char *szDescription;
|
|
|
|
DWORD dwMajorVersion;
|
|
|
|
DWORD dwMinorVersion;
|
|
|
|
DWORD dwBuildNumber;
|
|
|
|
DWORD dwPlatformId;
|
|
|
|
const char *szCSDVersion;
|
|
|
|
WORD wServicePackMajor;
|
|
|
|
WORD wServicePackMinor;
|
|
|
|
const char *szProductType;
|
|
|
|
} win_versions[] =
|
|
|
|
{
|
|
|
|
{ "win2003", "Windows 2003", 5, 2, 0xECE, VER_PLATFORM_WIN32_NT, "Service Pack 1", 1, 0, "ServerNT"},
|
|
|
|
{ "winxp", "Windows XP", 5, 1, 0xA28, VER_PLATFORM_WIN32_NT, "Service Pack 2", 2, 0, "WinNT"},
|
|
|
|
{ "win2k", "Windows 2000", 5, 0, 0x893, VER_PLATFORM_WIN32_NT, "Service Pack 4", 4, 0, "WinNT"},
|
|
|
|
{ "winme", "Windows ME", 4, 90, 0xBB8, VER_PLATFORM_WIN32_WINDOWS, " ", 0, 0, ""},
|
|
|
|
{ "win98", "Windows 98", 4, 10, 0x8AE, VER_PLATFORM_WIN32_WINDOWS, " A ", 0, 0, ""},
|
|
|
|
{ "win95", "Windows 95", 4, 0, 0x3B6, VER_PLATFORM_WIN32_WINDOWS, "", 0, 0, ""},
|
|
|
|
{ "nt40", "Windows NT 4.0", 4, 0, 0x565, VER_PLATFORM_WIN32_NT, "Service Pack 6a", 6, 0, "WinNT"},
|
|
|
|
{ "nt351", "Windows NT 3.5", 3, 51, 0x421, VER_PLATFORM_WIN32_NT, "Service Pack 2", 0, 0, "WinNT"},
|
|
|
|
{ "win31", "Windows 3.1", 2, 10, 0, VER_PLATFORM_WIN32s, "Win32s 1.3", 0, 0, ""},
|
|
|
|
{ "win30", "Windows 3.0", 3, 0, 0, VER_PLATFORM_WIN32s, "Win32s 1.3", 0, 0, ""},
|
|
|
|
{ "win20", "Windows 2.0", 2, 0, 0, VER_PLATFORM_WIN32s, "Win32s 1.3", 0, 0, ""}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NB_VERSIONS (sizeof(win_versions)/sizeof(win_versions[0]))
|
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
static void update_comboboxes(HWND dialog)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2005-10-17 10:55:45 +02:00
|
|
|
int i;
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
char *winver;
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
/* retrieve the registry values */
|
|
|
|
winver = get_reg_key(config_key, keypath(""), "Version", "");
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
if (*winver == '\0')
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, winver);
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
if (current_app) /* no explicit setting */
|
|
|
|
{
|
|
|
|
WINE_TRACE("setting winver combobox to default\n");
|
|
|
|
SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, 0, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
winver = strdupA("win2k");
|
|
|
|
}
|
|
|
|
WINE_TRACE("winver is %s\n", winver);
|
|
|
|
|
|
|
|
/* normalize the version strings */
|
|
|
|
for (i = 0; i < NB_VERSIONS; i++)
|
|
|
|
{
|
|
|
|
if (!strcasecmp (win_versions[i].szVersion, winver))
|
|
|
|
{
|
|
|
|
SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL,
|
|
|
|
(WPARAM) i + (current_app?1:0), 0);
|
|
|
|
WINE_TRACE("match with %s\n", win_versions[i].szVersion);
|
|
|
|
break;
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2005-10-17 10:55:45 +02:00
|
|
|
}
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, winver);
|
2003-09-30 02:27:55 +02:00
|
|
|
}
|
|
|
|
|
2005-06-02 17:11:32 +02:00
|
|
|
static void
|
2004-09-28 05:16:43 +02:00
|
|
|
init_comboboxes (HWND dialog)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2005-10-17 10:55:45 +02:00
|
|
|
int i;
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
SendDlgItemMessage(dialog, IDC_WINVER, CB_RESETCONTENT, 0, 0);
|
2005-05-07 20:06:35 +02:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
/* add the default entries (automatic) which correspond to no setting */
|
|
|
|
if (current_app)
|
|
|
|
SendDlgItemMessage(dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM) "Use global settings");
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2005-08-17 13:37:34 +02:00
|
|
|
for (i = 0; i < NB_VERSIONS; i++)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
SendDlgItemMessage (dialog, IDC_WINVER, CB_ADDSTRING,
|
2005-08-17 13:37:34 +02:00
|
|
|
0, (LPARAM) win_versions[i].szDescription);
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2003-09-30 02:27:55 +02:00
|
|
|
}
|
|
|
|
|
2005-06-02 17:11:32 +02:00
|
|
|
static void add_listview_item(HWND listview, const char *text, void *association)
|
2004-09-28 05:16:43 +02:00
|
|
|
{
|
|
|
|
LVITEM item;
|
|
|
|
|
|
|
|
ZeroMemory(&item, sizeof(LVITEM));
|
|
|
|
|
|
|
|
item.mask = LVIF_TEXT | LVIF_PARAM;
|
2005-06-02 17:11:32 +02:00
|
|
|
item.pszText = (char*) text;
|
2004-09-28 05:16:43 +02:00
|
|
|
item.cchTextMax = strlen(text);
|
|
|
|
item.lParam = (LPARAM) association;
|
|
|
|
item.iItem = ListView_GetItemCount(listview);
|
|
|
|
|
2006-03-17 14:49:27 +01:00
|
|
|
SendMessage(listview, LVM_INSERTITEM, 0, (LPARAM) &item);
|
2004-09-28 05:16:43 +02:00
|
|
|
}
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2004-09-28 05:55:16 +02:00
|
|
|
/* Called when the application is initialized (cannot reinit!) */
|
2004-09-28 05:16:43 +02:00
|
|
|
static void init_appsheet(HWND dialog)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
HWND listview;
|
|
|
|
HKEY key;
|
2004-02-07 02:01:34 +01:00
|
|
|
int i;
|
|
|
|
DWORD size;
|
2004-09-28 05:16:43 +02:00
|
|
|
char appname[1024];
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
WINE_TRACE("()\n");
|
2004-09-28 05:55:16 +02:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
|
|
|
|
|
|
|
|
/* we use the lparam field of the item so we can alter the presentation later and not change code
|
|
|
|
* for instance, to use the tile view or to display the EXEs embedded 'display name' */
|
|
|
|
add_listview_item(listview, "Default Settings", NULL);
|
2004-09-28 05:55:16 +02:00
|
|
|
|
|
|
|
/* because this list is only populated once, it's safe to bypass the settings list here */
|
|
|
|
if (RegOpenKey(config_key, "AppDefaults", &key) == ERROR_SUCCESS)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
i = 0;
|
|
|
|
size = sizeof(appname);
|
2004-09-28 05:55:16 +02:00
|
|
|
while (RegEnumKeyEx(key, i, appname, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
2004-09-28 05:16:43 +02:00
|
|
|
{
|
2004-11-23 14:50:23 +01:00
|
|
|
add_listview_item(listview, appname, strdupA(appname));
|
2004-09-28 05:16:43 +02:00
|
|
|
|
|
|
|
i++;
|
|
|
|
size = sizeof(appname);
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
init_comboboxes(dialog);
|
|
|
|
|
|
|
|
/* Select the default settings listview item */
|
|
|
|
{
|
|
|
|
LVITEM item;
|
|
|
|
|
|
|
|
ZeroMemory(&item, sizeof(item));
|
|
|
|
|
|
|
|
item.mask = LVIF_STATE;
|
|
|
|
item.iItem = 0;
|
|
|
|
item.state = LVIS_SELECTED | LVIS_FOCUSED;
|
|
|
|
item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
|
|
|
|
|
2006-03-17 14:49:27 +01:00
|
|
|
SendMessage(listview, LVM_SETITEM, 0, (LPARAM) &item);
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
/* there has to be an easier way than this */
|
|
|
|
static int get_listview_selection(HWND listview)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
int count = ListView_GetItemCount(listview);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
if (ListView_GetItemState(listview, i, LVIS_SELECTED)) return i;
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2004-09-28 05:16:43 +02:00
|
|
|
|
|
|
|
return -1;
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
|
|
|
|
2004-09-28 05:55:16 +02:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
/* called when the user selects a different application */
|
|
|
|
static void on_selection_change(HWND dialog, HWND listview)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
LVITEM item;
|
2004-11-23 14:50:23 +01:00
|
|
|
char *oldapp = current_app;
|
2005-01-03 15:45:05 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
WINE_TRACE("()\n");
|
2005-01-03 15:45:05 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
item.iItem = get_listview_selection(listview);
|
|
|
|
item.mask = LVIF_PARAM;
|
2005-01-03 15:45:05 +01:00
|
|
|
|
|
|
|
WINE_TRACE("item.iItem=%d\n", item.iItem);
|
2004-09-28 05:16:43 +02:00
|
|
|
|
|
|
|
if (item.iItem == -1) return;
|
|
|
|
|
2006-03-17 14:49:27 +01:00
|
|
|
SendMessage(listview, LVM_GETITEM, 0, (LPARAM) &item);
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
current_app = (char *) item.lParam;
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
if (current_app)
|
2004-09-28 05:16:43 +02:00
|
|
|
{
|
2004-11-23 14:50:23 +01:00
|
|
|
WINE_TRACE("current_app is now %s\n", current_app);
|
2004-09-28 05:16:43 +02:00
|
|
|
enable(IDC_APP_REMOVEAPP);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-23 14:50:23 +01:00
|
|
|
WINE_TRACE("current_app=NULL, editing global settings\n");
|
2004-09-28 05:16:43 +02:00
|
|
|
/* focus will never be on the button in this callback so it's safe */
|
|
|
|
disable(IDC_APP_REMOVEAPP);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* reset the combo boxes if we changed from/to global/app-specific */
|
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
if ((oldapp && !current_app) || (!oldapp && current_app))
|
2004-09-28 05:16:43 +02:00
|
|
|
init_comboboxes(dialog);
|
|
|
|
|
|
|
|
update_comboboxes(dialog);
|
2004-09-28 05:55:16 +02:00
|
|
|
|
|
|
|
set_window_title(dialog);
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
|
|
|
|
2005-05-04 11:47:46 +02:00
|
|
|
static BOOL list_contains_file(HWND listview, char *filename)
|
|
|
|
{
|
|
|
|
LVFINDINFO find_info = { LVFI_STRING, filename, 0, {0, 0}, 0 };
|
|
|
|
int index;
|
|
|
|
|
|
|
|
index = ListView_FindItem(listview, -1, &find_info);
|
|
|
|
|
|
|
|
return (index != -1);
|
|
|
|
}
|
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
static void on_add_app_click(HWND dialog)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
char filetitle[MAX_PATH];
|
|
|
|
char file[MAX_PATH];
|
2004-02-07 02:01:34 +01:00
|
|
|
|
|
|
|
OPENFILENAME ofn = { sizeof(OPENFILENAME),
|
|
|
|
0, /*hInst*/0, "Wine Programs (*.exe,*.exe.so)\0*.exe;*.exe.so\0", NULL, 0, 0, NULL,
|
2004-09-28 05:16:43 +02:00
|
|
|
0, NULL, 0, "c:\\", "Select a Windows executable file",
|
|
|
|
OFN_SHOWHELP | OFN_HIDEREADONLY, 0, 0, NULL, 0, NULL };
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
ofn.lpstrFileTitle = filetitle;
|
2004-02-07 02:01:34 +01:00
|
|
|
ofn.lpstrFileTitle[0] = '\0';
|
2004-09-28 05:16:43 +02:00
|
|
|
ofn.nMaxFileTitle = sizeof(filetitle);
|
|
|
|
ofn.lpstrFile = file;
|
2004-02-07 02:01:34 +01:00
|
|
|
ofn.lpstrFile[0] = '\0';
|
2004-09-28 05:16:43 +02:00
|
|
|
ofn.nMaxFile = sizeof(file);
|
2004-02-07 02:01:34 +01:00
|
|
|
|
|
|
|
if (GetOpenFileName(&ofn))
|
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
|
|
|
|
int count = ListView_GetItemCount(listview);
|
2005-01-14 20:48:41 +01:00
|
|
|
char* new_app;
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2005-01-14 20:48:41 +01:00
|
|
|
new_app = strdupA(filetitle);
|
2005-05-04 11:47:46 +02:00
|
|
|
|
|
|
|
if (list_contains_file(listview, new_app))
|
|
|
|
return;
|
|
|
|
|
2005-01-14 20:48:41 +01:00
|
|
|
WINE_TRACE("adding %s\n", new_app);
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2005-01-14 20:48:41 +01:00
|
|
|
add_listview_item(listview, new_app, new_app);
|
2004-09-28 05:16:43 +02:00
|
|
|
|
|
|
|
ListView_SetItemState(listview, count, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
|
|
|
|
|
|
|
SetFocus(listview);
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2004-09-28 05:16:43 +02:00
|
|
|
else WINE_TRACE("user cancelled\n");
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
static void on_remove_app_click(HWND dialog)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
|
|
|
|
int selection = get_listview_selection(listview);
|
2004-09-28 05:55:16 +02:00
|
|
|
char *section = keypath(""); /* AppDefaults\\whatever.exe\\ */
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
WINE_TRACE("selection=%d, section=%s\n", selection, section);
|
|
|
|
|
|
|
|
assert( selection != 0 ); /* user cannot click this button when "default settings" is selected */
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
section[strlen(section)] = '\0'; /* remove last backslash */
|
2005-06-23 13:42:54 +02:00
|
|
|
set_reg_key(config_key, section, NULL, NULL); /* delete the section */
|
2006-03-17 14:49:27 +01:00
|
|
|
SendMessage(listview, LVM_DELETEITEM, selection, 0);
|
2005-01-03 15:45:05 +01:00
|
|
|
ListView_SetItemState(listview, selection - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
SetFocus(listview);
|
2005-01-03 15:45:05 +01:00
|
|
|
|
|
|
|
SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
static void on_winver_change(HWND dialog)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
int selection = SendDlgItemMessage(dialog, IDC_WINVER, CB_GETCURSEL, 0, 0);
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
if (!selection && current_app)
|
2004-02-07 02:01:34 +01:00
|
|
|
{
|
2005-10-17 10:55:45 +02:00
|
|
|
WINE_TRACE("default selected so removing current setting\n");
|
2005-06-23 13:42:54 +02:00
|
|
|
set_reg_key(config_key, keypath(""), "Version", NULL);
|
2004-09-28 05:16:43 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-17 10:55:45 +02:00
|
|
|
if (current_app) selection--;
|
|
|
|
WINE_TRACE("setting Version key to value '%s'\n", win_versions[selection].szVersion);
|
|
|
|
set_reg_key(config_key, keypath(""), "Version", win_versions[selection].szVersion);
|
2005-08-17 13:37:34 +02:00
|
|
|
}
|
|
|
|
/* global version only */
|
2005-10-17 10:55:45 +02:00
|
|
|
if (!current_app)
|
2005-08-17 13:37:34 +02:00
|
|
|
{
|
|
|
|
static const char szKey9x[] = "Software\\Microsoft\\Windows\\CurrentVersion";
|
|
|
|
static const char szKeyNT[] = "Software\\Microsoft\\Windows NT\\CurrentVersion";
|
|
|
|
static const char szKeyProdNT[] = "System\\CurrentControlSet\\Control\\ProductOptions";
|
|
|
|
static const char szKeyWindNT[] = "System\\CurrentControlSet\\Control\\Windows";
|
2005-10-28 11:38:11 +02:00
|
|
|
static const char szKeyEnvNT[] = "System\\CurrentControlSet\\Control\\Session Manager\\Environment";
|
2005-08-17 13:37:34 +02:00
|
|
|
char Buffer[40];
|
|
|
|
|
2005-10-17 10:55:45 +02:00
|
|
|
switch (win_versions[selection].dwPlatformId)
|
2005-08-17 13:37:34 +02:00
|
|
|
{
|
|
|
|
case VER_PLATFORM_WIN32_WINDOWS:
|
2005-10-17 10:55:45 +02:00
|
|
|
snprintf(Buffer, sizeof(Buffer), "%ld.%ld.%ld", win_versions[selection].dwMajorVersion,
|
|
|
|
win_versions[selection].dwMinorVersion, win_versions[selection].dwBuildNumber);
|
2005-08-17 13:37:34 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "VersionNumber", Buffer);
|
2005-10-17 10:55:45 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "SubVersionNumber", win_versions[selection].szCSDVersion);
|
2005-08-17 13:37:34 +02:00
|
|
|
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CSDVersion", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentVersion", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentBuildNumber", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, "ProductType", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyWindNT, "CSDVersion", NULL);
|
2005-10-28 11:38:11 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyEnvNT, "OS", NULL);
|
2005-08-17 13:37:34 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VER_PLATFORM_WIN32_NT:
|
2005-10-17 10:55:45 +02:00
|
|
|
snprintf(Buffer, sizeof(Buffer), "%ld.%ld", win_versions[selection].dwMajorVersion,
|
|
|
|
win_versions[selection].dwMinorVersion);
|
2005-08-17 13:37:34 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentVersion", Buffer);
|
2005-10-17 10:55:45 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CSDVersion", win_versions[selection].szCSDVersion);
|
|
|
|
snprintf(Buffer, sizeof(Buffer), "%ld", win_versions[selection].dwBuildNumber);
|
2005-08-17 13:37:34 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentBuildNumber", Buffer);
|
2005-10-17 10:55:45 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, "ProductType", win_versions[selection].szProductType);
|
2005-08-17 13:37:34 +02:00
|
|
|
set_reg_key_dword(HKEY_LOCAL_MACHINE, szKeyWindNT, "CSDVersion",
|
2005-10-17 10:55:45 +02:00
|
|
|
MAKEWORD( win_versions[selection].wServicePackMinor,
|
|
|
|
win_versions[selection].wServicePackMajor ));
|
2005-10-28 11:38:11 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyEnvNT, "OS", "Windows_NT");
|
2005-08-17 13:37:34 +02:00
|
|
|
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "VersionNumber", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "SubVersionNumber", NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VER_PLATFORM_WIN32s:
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CSDVersion", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentVersion", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentBuildNumber", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, "ProductType", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyWindNT, "CSDVersion", NULL);
|
2005-10-28 11:38:11 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKeyEnvNT, "OS", NULL);
|
2005-08-17 13:37:34 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "VersionNumber", NULL);
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "SubVersionNumber", NULL);
|
|
|
|
break;
|
|
|
|
}
|
2004-09-28 05:16:43 +02:00
|
|
|
}
|
2004-09-28 05:55:16 +02:00
|
|
|
|
|
|
|
/* enable the apply button */
|
|
|
|
SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-09-28 05:16:43 +02:00
|
|
|
}
|
2004-02-07 02:01:34 +01:00
|
|
|
|
2003-09-30 02:27:55 +02:00
|
|
|
INT_PTR CALLBACK
|
|
|
|
AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2004-02-07 02:01:34 +01:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
case WM_INITDIALOG:
|
2004-09-28 05:55:16 +02:00
|
|
|
init_appsheet(hDlg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_SHOWWINDOW:
|
|
|
|
set_window_title(hDlg);
|
|
|
|
break;
|
2004-09-28 05:16:43 +02:00
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
switch (((LPNMHDR)lParam)->code)
|
|
|
|
{
|
|
|
|
case LVN_ITEMCHANGED:
|
2004-09-28 05:55:16 +02:00
|
|
|
on_selection_change(hDlg, GetDlgItem(hDlg, IDC_APP_LISTVIEW));
|
|
|
|
break;
|
|
|
|
case PSN_APPLY:
|
|
|
|
apply();
|
2005-02-15 22:51:06 +01:00
|
|
|
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
2004-09-28 05:55:16 +02:00
|
|
|
break;
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2004-09-28 05:55:16 +02:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
2004-11-23 14:50:23 +01:00
|
|
|
switch(HIWORD(wParam))
|
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
case CBN_SELCHANGE:
|
2004-11-23 14:50:23 +01:00
|
|
|
switch(LOWORD(wParam))
|
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
case IDC_WINVER:
|
|
|
|
on_winver_change(hDlg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BN_CLICKED:
|
2004-11-23 14:50:23 +01:00
|
|
|
switch(LOWORD(wParam))
|
|
|
|
{
|
2004-09-28 05:16:43 +02:00
|
|
|
case IDC_APP_ADDAPP:
|
|
|
|
on_add_app_click(hDlg);
|
|
|
|
break;
|
|
|
|
case IDC_APP_REMOVEAPP:
|
|
|
|
on_remove_app_click(hDlg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-02-07 02:01:34 +01:00
|
|
|
}
|
2004-09-28 05:55:16 +02:00
|
|
|
|
2004-02-07 02:01:34 +01:00
|
|
|
break;
|
|
|
|
}
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2004-02-07 02:01:34 +01:00
|
|
|
return 0;
|
2003-09-30 02:27:55 +02:00
|
|
|
}
|