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
33 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
40 #include <wine/debug.h>
42 #include "properties.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
49 PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
54 * hWnd = NULL, lParam == dialog resource
59 case PSCB_INITIALIZED:
68 AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
73 if (((LPNMHDR)lParam)->code != PSN_SETACTIVE) break;
74 /* otherwise fall through, we want to refresh the page as well */
88 #define NUM_PROPERTY_PAGES 6
91 doPropertySheet (HINSTANCE hInstance, HWND hOwner)
93 PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
95 int pg = 0; /* start with page 0 */
98 * Fill out the (Applications) PROPSHEETPAGE data structure
99 * for the property sheet
101 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
102 psp[pg].dwFlags = PSP_USETITLE;
103 psp[pg].hInstance = hInstance;
104 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
105 psp[pg].u2.pszIcon = NULL;
106 psp[pg].pfnDlgProc = AppDlgProc;
107 psp[pg].pszTitle = "Applications";
112 * Fill out the (Libraries) PROPSHEETPAGE data structure
113 * for the property sheet
115 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
116 psp[pg].dwFlags = PSP_USETITLE;
117 psp[pg].hInstance = hInstance;
118 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
119 psp[pg].u2.pszIcon = NULL;
120 psp[pg].pfnDlgProc = LibrariesDlgProc;
121 psp[pg].pszTitle = "Libraries";
126 * Fill out the (X11Drv) PROPSHEETPAGE data structure
127 * for the property sheet
129 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
130 psp[pg].dwFlags = PSP_USETITLE;
131 psp[pg].hInstance = hInstance;
132 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_GRAPHCFG);
133 psp[pg].u2.pszIcon = NULL;
134 psp[pg].pfnDlgProc = GraphDlgProc;
135 psp[pg].pszTitle = "Graphics";
139 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
140 psp[pg].dwFlags = PSP_USETITLE;
141 psp[pg].hInstance = hInstance;
142 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DRIVECFG);
143 psp[pg].u2.pszIcon = NULL;
144 psp[pg].pfnDlgProc = DriveDlgProc;
145 psp[pg].pszTitle = "Drives";
149 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
150 psp[pg].dwFlags = PSP_USETITLE;
151 psp[pg].hInstance = hInstance;
152 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_AUDIOCFG);
153 psp[pg].u2.pszIcon = NULL;
154 psp[pg].pfnDlgProc = AudioDlgProc;
155 psp[pg].pszTitle = "Audio";
160 * Fill out the (General) PROPSHEETPAGE data structure
161 * for the property sheet
163 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
164 psp[pg].dwFlags = PSP_USETITLE;
165 psp[pg].hInstance = hInstance;
166 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_ABOUTCFG);
167 psp[pg].u2.pszIcon = NULL;
168 psp[pg].pfnDlgProc = AboutDlgProc;
169 psp[pg].pszTitle = "About";
174 * Fill out the PROPSHEETHEADER
176 psh.dwSize = sizeof (PROPSHEETHEADER);
177 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
178 psh.hwndParent = hOwner;
179 psh.hInstance = hInstance;
180 psh.u.pszIcon = NULL;
181 psh.pszCaption = "Wine Configuration";
182 psh.nPages = NUM_PROPERTY_PAGES;
183 psh.u3.ppsp = (LPCPROPSHEETPAGE) & psp;
184 psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetCallback;
185 psh.u2.nStartPage = 0;
188 * Display the modal property sheet
190 return PropertySheet (&psh);
193 /******************************************************************************
194 * Name : ProcessCmdLine
195 * Description: Checks command line parameters for 'autodetect drives' option
196 * Parameters : lpCmdLine - the command line
197 * Returns : TRUE - if '/D' was found. Drive autodetection was carried out.
198 * FALSE - no '/D' option found in command line
199 * Notes : This is a very simple implementation, which only works
200 * correctly if the one and only cmd line option is '/D' or
201 * no option at all. Has to be reworked, if more options are to
205 ProcessCmdLine(LPSTR lpCmdLine)
207 if ((lpCmdLine[0] == '/' || lpCmdLine[0] == '-') &&
208 (lpCmdLine[1] == 'D' || lpCmdLine[1] == 'd'))
211 if (autodetect_drives()) {
212 apply_drive_changes();
220 /*****************************************************************************
222 * Description: Main windows entry point
223 * Parameters : hInstance
227 * Returns : Program exit code
230 WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
232 if (ProcessCmdLine(szCmdLine)) {
236 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
237 if (!getenv("WINECFG_NOWARN")) {
238 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
239 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
240 MessageBoxA(NULL, "The winecfg tool is not yet complete, and does not actually alter your configuration\n\n"
241 "If you want to alter the way Wine works, look in the ~/.wine/config file for more information.",
242 "", MB_OK | MB_ICONEXCLAMATION);
245 if (initialize() != 0) {
246 WINE_ERR("initialization failed, aborting\n");
251 * The next 3 lines should be all that is needed
252 * for the Wine Configuration property sheet
254 InitCommonControls ();
255 if (doPropertySheet (hInstance, NULL) > 0) {
258 WINE_TRACE("Cancel\n");