2 * WineCfg main entry point
4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2003 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 NONAMELESSUNION
25 #define NONAMELESSSTRUCT
31 #include <wine/debug.h>
33 #include "properties.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
40 PropSheetCallback (HWND hWnd
, UINT uMsg
, LPARAM lParam
)
45 * hWnd = NULL, lParam == dialog resource
50 case PSCB_INITIALIZED
:
59 initGeneralDlg (HWND hDlg
)
62 const VERSION_DESC
*pVer
= NULL
;
63 char *curWinVer
= getConfigValue("Version", "Windows", "win98");
64 char *curDOSVer
= getConfigValue("Version", "DOS", "6.22");
65 char *curWineLook
= getConfigValue("Tweak.Layout", "WineLook", "win95");
67 /* normalize the version strings */
68 if (!strcmp(curWinVer
, "win2000") || !strcmp(curWinVer
, "nt2k") || !strcmp(curWinVer
, "nt2000")) {
70 curWinVer
= strdup("win2k");
73 if (!strcmp(curWinVer
, "win2k3")) {
75 curWinVer
= strdup("win2003");
78 if ((pVer
= getWinVersions ()))
80 for (i
= 0; *pVer
->szVersion
; i
++, pVer
++)
82 SendDlgItemMessage (hDlg
, IDC_WINVER
, CB_ADDSTRING
,
83 0, (LPARAM
) pVer
->szDescription
);
84 if (!strcmp (pVer
->szVersion
, curWinVer
))
85 SendDlgItemMessage (hDlg
, IDC_WINVER
, CB_SETCURSEL
,
89 if ((pVer
= getDOSVersions ()))
91 for (i
= 0; *pVer
->szVersion
; i
++, pVer
++)
93 SendDlgItemMessage (hDlg
, IDC_DOSVER
, CB_ADDSTRING
,
94 0, (LPARAM
) pVer
->szDescription
);
95 if (!strcmp (pVer
->szVersion
, curDOSVer
))
96 SendDlgItemMessage (hDlg
, IDC_DOSVER
, CB_SETCURSEL
,
100 if ((pVer
= getWinelook ()))
102 for (i
= 0; *pVer
->szVersion
; i
++, pVer
++)
104 SendDlgItemMessage (hDlg
, IDC_WINELOOK
, CB_ADDSTRING
,
105 0, (LPARAM
) pVer
->szDescription
);
106 if (!strcmp (pVer
->szVersion
, curWineLook
))
107 SendDlgItemMessage (hDlg
, IDC_WINELOOK
, CB_SETCURSEL
,
118 GeneralDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
123 initGeneralDlg (hDlg
);
127 switch (LOWORD(wParam
)) {
128 case IDC_WINVER
: if (HIWORD(wParam
) == CBN_SELCHANGE
) {
129 /* user changed the wine version combobox */
130 int selection
= SendDlgItemMessage( hDlg
, IDC_WINVER
, CB_GETCURSEL
, 0, 0);
131 VERSION_DESC
*desc
= getWinVersions();
133 while (selection
> 0) {
136 addTransaction("Version", "Windows", ACTION_SET
, desc
->szVersion
);
151 DllDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
166 AppDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
179 #define NUM_PROPERTY_PAGES 5
181 doPropertySheet (HINSTANCE hInstance
, HWND hOwner
)
183 PROPSHEETPAGE psp
[NUM_PROPERTY_PAGES
];
187 * Fill out the (General) PROPSHEETPAGE data structure
188 * for the property sheet
190 psp
[0].dwSize
= sizeof (PROPSHEETPAGE
);
191 psp
[0].dwFlags
= PSP_USETITLE
;
192 psp
[0].hInstance
= hInstance
;
193 psp
[0].u
.pszTemplate
= MAKEINTRESOURCE (IDD_GENERALCFG
);
194 psp
[0].u2
.pszIcon
= NULL
;
195 psp
[0].pfnDlgProc
= GeneralDlgProc
;
196 psp
[0].pszTitle
= "General";
200 * Fill out the (Libraries) PROPSHEETPAGE data structure
201 * for the property sheet
203 psp
[1].dwSize
= sizeof (PROPSHEETPAGE
);
204 psp
[1].dwFlags
= PSP_USETITLE
;
205 psp
[1].hInstance
= hInstance
;
206 psp
[1].u
.pszTemplate
= MAKEINTRESOURCE (IDD_DLLCFG
);
207 psp
[1].u2
.pszIcon
= NULL
;
208 psp
[1].pfnDlgProc
= DllDlgProc
;
209 psp
[1].pszTitle
= "Libraries";
213 * Fill out the (Applications) PROPSHEETPAGE data structure
214 * for the property sheet
216 psp
[2].dwSize
= sizeof (PROPSHEETPAGE
);
217 psp
[2].dwFlags
= PSP_USETITLE
;
218 psp
[2].hInstance
= hInstance
;
219 psp
[2].u
.pszTemplate
= MAKEINTRESOURCE (IDD_APPCFG
);
220 psp
[2].u2
.pszIcon
= NULL
;
221 psp
[2].pfnDlgProc
= AppDlgProc
;
222 psp
[2].pszTitle
= "Applications";
226 * Fill out the (X11Drv) PROPSHEETPAGE data structure
227 * for the property sheet
229 psp
[3].dwSize
= sizeof (PROPSHEETPAGE
);
230 psp
[3].dwFlags
= PSP_USETITLE
;
231 psp
[3].hInstance
= hInstance
;
232 psp
[3].u
.pszTemplate
= MAKEINTRESOURCE (IDD_X11DRVCFG
);
233 psp
[3].u2
.pszIcon
= NULL
;
234 psp
[3].pfnDlgProc
= X11DrvDlgProc
;
235 psp
[3].pszTitle
= "X11 Driver";
238 psp
[4].dwSize
= sizeof (PROPSHEETPAGE
);
239 psp
[4].dwFlags
= PSP_USETITLE
;
240 psp
[4].hInstance
= hInstance
;
241 psp
[4].u
.pszTemplate
= MAKEINTRESOURCE (IDD_DRIVECFG
);
242 psp
[4].u2
.pszIcon
= NULL
;
243 psp
[4].pfnDlgProc
= DriveDlgProc
;
244 psp
[4].pszTitle
= "Drives";
248 * Fill out the PROPSHEETHEADER
250 psh
.dwSize
= sizeof (PROPSHEETHEADER
);
251 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_USEICONID
| PSH_USECALLBACK
;
252 psh
.hwndParent
= hOwner
;
253 psh
.hInstance
= hInstance
;
254 psh
.u
.pszIcon
= NULL
;
255 psh
.pszCaption
= "Wine Configuration";
256 psh
.nPages
= NUM_PROPERTY_PAGES
;
257 psh
.u3
.ppsp
= (LPCPROPSHEETPAGE
) & psp
;
258 psh
.pfnCallback
= (PFNPROPSHEETCALLBACK
) PropSheetCallback
;
261 * Display the modal property sheet
263 return PropertySheet (&psh
);
267 /*****************************************************************************
269 * Description: Main windows entry point
270 * Parameters : hInstance
274 * Returns : Program exit code
277 WinMain (HINSTANCE hInstance
, HINSTANCE hPrev
, LPSTR szCmdLine
, int nShow
)
280 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
281 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
282 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
284 if (initialize() != 0) {
285 WINE_ERR("initialization failed, aborting\n");
290 * The next 3 lines should be all that is needed
291 * for the Wine Configuration property sheet
293 InitCommonControls ();
294 if (doPropertySheet (hInstance
, NULL
) > 0) {
297 WINE_TRACE("Cancel\n");