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
41 #include <wine/debug.h>
43 #include "properties.h"
47 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
50 PropSheetCallback (HWND hWnd
, UINT uMsg
, LPARAM lParam
)
55 * hWnd = NULL, lParam == dialog resource
60 case PSCB_INITIALIZED
:
69 AboutDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
74 if (((LPNMHDR
)lParam
)->code
!= PSN_SETACTIVE
) break;
75 /* otherwise fall through, we want to refresh the page as well */
89 #define NUM_PROPERTY_PAGES 6
92 doPropertySheet (HINSTANCE hInstance
, HWND hOwner
)
94 PROPSHEETPAGE psp
[NUM_PROPERTY_PAGES
];
96 int pg
= 0; /* start with page 0 */
99 * Fill out the (Applications) PROPSHEETPAGE data structure
100 * for the property sheet
102 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGE
);
103 psp
[pg
].dwFlags
= PSP_USETITLE
;
104 psp
[pg
].hInstance
= hInstance
;
105 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCE (IDD_APPCFG
);
106 psp
[pg
].u2
.pszIcon
= NULL
;
107 psp
[pg
].pfnDlgProc
= AppDlgProc
;
108 psp
[pg
].pszTitle
= "Applications";
113 * Fill out the (Libraries) PROPSHEETPAGE data structure
114 * for the property sheet
116 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGE
);
117 psp
[pg
].dwFlags
= PSP_USETITLE
;
118 psp
[pg
].hInstance
= hInstance
;
119 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCE (IDD_DLLCFG
);
120 psp
[pg
].u2
.pszIcon
= NULL
;
121 psp
[pg
].pfnDlgProc
= LibrariesDlgProc
;
122 psp
[pg
].pszTitle
= "Libraries";
127 * Fill out the (X11Drv) PROPSHEETPAGE data structure
128 * for the property sheet
130 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGE
);
131 psp
[pg
].dwFlags
= PSP_USETITLE
;
132 psp
[pg
].hInstance
= hInstance
;
133 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCE (IDD_GRAPHCFG
);
134 psp
[pg
].u2
.pszIcon
= NULL
;
135 psp
[pg
].pfnDlgProc
= GraphDlgProc
;
136 psp
[pg
].pszTitle
= "Graphics";
140 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGE
);
141 psp
[pg
].dwFlags
= PSP_USETITLE
;
142 psp
[pg
].hInstance
= hInstance
;
143 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCE (IDD_DRIVECFG
);
144 psp
[pg
].u2
.pszIcon
= NULL
;
145 psp
[pg
].pfnDlgProc
= DriveDlgProc
;
146 psp
[pg
].pszTitle
= "Drives";
150 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGE
);
151 psp
[pg
].dwFlags
= PSP_USETITLE
;
152 psp
[pg
].hInstance
= hInstance
;
153 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCE (IDD_AUDIOCFG
);
154 psp
[pg
].u2
.pszIcon
= NULL
;
155 psp
[pg
].pfnDlgProc
= AudioDlgProc
;
156 psp
[pg
].pszTitle
= "Audio";
161 * Fill out the (General) PROPSHEETPAGE data structure
162 * for the property sheet
164 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGE
);
165 psp
[pg
].dwFlags
= PSP_USETITLE
;
166 psp
[pg
].hInstance
= hInstance
;
167 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCE (IDD_ABOUTCFG
);
168 psp
[pg
].u2
.pszIcon
= NULL
;
169 psp
[pg
].pfnDlgProc
= AboutDlgProc
;
170 psp
[pg
].pszTitle
= "About";
175 * Fill out the PROPSHEETHEADER
177 psh
.dwSize
= sizeof (PROPSHEETHEADER
);
178 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_USEICONID
| PSH_USECALLBACK
;
179 psh
.hwndParent
= hOwner
;
180 psh
.hInstance
= hInstance
;
181 psh
.u
.pszIcon
= NULL
;
182 psh
.pszCaption
= "Wine Configuration";
183 psh
.nPages
= NUM_PROPERTY_PAGES
;
184 psh
.u3
.ppsp
= (LPCPROPSHEETPAGE
) & psp
;
185 psh
.pfnCallback
= (PFNPROPSHEETCALLBACK
) PropSheetCallback
;
186 psh
.u2
.nStartPage
= 0;
189 * Display the modal property sheet
191 return PropertySheet (&psh
);
194 /******************************************************************************
195 * Name : ProcessCmdLine
196 * Description: Checks command line parameters for 'autodetect drives' option
197 * Parameters : lpCmdLine - the command line
198 * Returns : TRUE - if '/D' was found. Drive autodetection was carried out.
199 * FALSE - no '/D' option found in command line
200 * Notes : This is a very simple implementation, which only works
201 * correctly if the one and only cmd line option is '/D' or
202 * no option at all. Has to be reworked, if more options are to
206 ProcessCmdLine(LPSTR lpCmdLine
)
208 if ((lpCmdLine
[0] == '/' || lpCmdLine
[0] == '-') &&
209 (lpCmdLine
[1] == 'D' || lpCmdLine
[1] == 'd'))
212 if (autodetect_drives()) {
213 apply_drive_changes();
221 /*****************************************************************************
223 * Description: Main windows entry point
224 * Parameters : hInstance
228 * Returns : Program exit code
231 WinMain (HINSTANCE hInstance
, HINSTANCE hPrev
, LPSTR szCmdLine
, int nShow
)
233 if (ProcessCmdLine(szCmdLine
)) {
237 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
238 if (!getenv("WINECFG_NOWARN")) {
239 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
240 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
241 MessageBoxA(NULL
, "The winecfg tool is not yet complete, and does not actually alter your configuration\n\n"
242 "If you want to alter the way Wine works, look in the ~/.wine/config file for more information.",
243 "", MB_OK
| MB_ICONEXCLAMATION
);
246 if (initialize() != 0) {
247 WINE_ERR("initialization failed, aborting\n");
252 * The next 9 lines should be all that is needed
253 * for the Wine Configuration property sheet
255 InitCommonControls ();
256 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
257 if (doPropertySheet (hInstance
, NULL
) > 0) {
260 WINE_TRACE("Cancel\n");