Need to include config.h.
[wine/multimedia.git] / programs / winecfg / main.c
bloba1fa75c2f19e5d7bf7fbc6e4efc4b0020fe80e68
1 /*
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 #include "config.h"
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
29 #include <windows.h>
30 #include <commctrl.h>
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <wine/debug.h>
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif
38 #include "properties.h"
39 #include "resource.h"
40 #include "winecfg.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
44 void CALLBACK
45 PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
47 switch (uMsg)
50 * hWnd = NULL, lParam == dialog resource
52 case PSCB_PRECREATE:
53 break;
55 case PSCB_INITIALIZED:
56 break;
58 default:
59 break;
63 INT_PTR CALLBACK
64 AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
66 switch (uMsg) {
68 case WM_NOTIFY:
69 if (((LPNMHDR)lParam)->code != PSN_SETACTIVE) break;
70 /* otherwise fall through, we want to refresh the page as well */
71 case WM_INITDIALOG:
72 break;
74 case WM_COMMAND:
75 break;
77 default:
78 break;
81 return FALSE;
84 #define NUM_PROPERTY_PAGES 6
86 INT_PTR
87 doPropertySheet (HINSTANCE hInstance, HWND hOwner)
89 PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
90 PROPSHEETHEADER psh;
91 int pg = 0; /* start with page 0 */
94 * Fill out the (Applications) PROPSHEETPAGE data structure
95 * for the property sheet
97 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
98 psp[pg].dwFlags = PSP_USETITLE;
99 psp[pg].hInstance = hInstance;
100 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
101 psp[pg].u2.pszIcon = NULL;
102 psp[pg].pfnDlgProc = AppDlgProc;
103 psp[pg].pszTitle = "Applications";
104 psp[pg].lParam = 0;
105 pg++;
108 * Fill out the (Libraries) PROPSHEETPAGE data structure
109 * for the property sheet
111 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
112 psp[pg].dwFlags = PSP_USETITLE;
113 psp[pg].hInstance = hInstance;
114 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
115 psp[pg].u2.pszIcon = NULL;
116 psp[pg].pfnDlgProc = LibrariesDlgProc;
117 psp[pg].pszTitle = "Libraries";
118 psp[pg].lParam = 0;
119 pg++;
122 * Fill out the (X11Drv) PROPSHEETPAGE data structure
123 * for the property sheet
125 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
126 psp[pg].dwFlags = PSP_USETITLE;
127 psp[pg].hInstance = hInstance;
128 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_X11DRVCFG);
129 psp[pg].u2.pszIcon = NULL;
130 psp[pg].pfnDlgProc = X11DrvDlgProc;
131 psp[pg].pszTitle = "X11 Driver";
132 psp[pg].lParam = 0;
133 pg++;
135 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
136 psp[pg].dwFlags = PSP_USETITLE;
137 psp[pg].hInstance = hInstance;
138 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DRIVECFG);
139 psp[pg].u2.pszIcon = NULL;
140 psp[pg].pfnDlgProc = DriveDlgProc;
141 psp[pg].pszTitle = "Drives";
142 psp[pg].lParam = 0;
143 pg++;
145 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
146 psp[pg].dwFlags = PSP_USETITLE;
147 psp[pg].hInstance = hInstance;
148 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_AUDIOCFG);
149 psp[pg].u2.pszIcon = NULL;
150 psp[pg].pfnDlgProc = AudioDlgProc;
151 psp[pg].pszTitle = "Audio";
152 psp[pg].lParam = 0;
153 pg++;
156 * Fill out the (General) PROPSHEETPAGE data structure
157 * for the property sheet
159 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
160 psp[pg].dwFlags = PSP_USETITLE;
161 psp[pg].hInstance = hInstance;
162 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_ABOUTCFG);
163 psp[pg].u2.pszIcon = NULL;
164 psp[pg].pfnDlgProc = AboutDlgProc;
165 psp[pg].pszTitle = "About";
166 psp[pg].lParam = 0;
167 pg++;
170 * Fill out the PROPSHEETHEADER
172 psh.dwSize = sizeof (PROPSHEETHEADER);
173 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
174 psh.hwndParent = hOwner;
175 psh.hInstance = hInstance;
176 psh.u.pszIcon = NULL;
177 psh.pszCaption = "Wine Configuration";
178 psh.nPages = NUM_PROPERTY_PAGES;
179 psh.u3.ppsp = (LPCPROPSHEETPAGE) & psp;
180 psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetCallback;
181 psh.u2.nStartPage = 0;
184 * Display the modal property sheet
186 return PropertySheet (&psh);
190 /*****************************************************************************
191 * Name : WinMain
192 * Description: Main windows entry point
193 * Parameters : hInstance
194 * hPrev
195 * szCmdLine
196 * nShow
197 * Returns : Program exit code
199 int WINAPI
200 WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
203 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
204 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
205 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
207 if (initialize() != 0) {
208 WINE_ERR("initialization failed, aborting\n");
209 ExitProcess(1);
212 /* is the user running as root? */
213 if(getuid() == 0)
214 MessageBox(NULL, "It is not advisable to run wine as root. Doing so may compromise the security of your computer. Please run wine as a normal user.", "Warning", MB_OK);
217 * The next 3 lines should be all that is needed
218 * for the Wine Configuration property sheet
220 InitCommonControls ();
221 if (doPropertySheet (hInstance, NULL) > 0) {
222 WINE_TRACE("OK\n");
223 } else {
224 WINE_TRACE("Cancel\n");
227 ExitProcess (0);
229 return 0;