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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define WIN32_LEAN_AND_MEAN
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
32 #include <wine/debug.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
:
51 /* Set the window icon */
52 SendMessageW( hWnd
, WM_SETICON
, ICON_BIG
,
53 (LPARAM
)LoadIconW( (HINSTANCE
)GetWindowLongPtrW(hWnd
, GWLP_HINSTANCE
),
54 MAKEINTRESOURCEW(IDI_WINECFG
) ));
63 #define NUM_PROPERTY_PAGES 7
66 doPropertySheet (HINSTANCE hInstance
, HWND hOwner
)
68 PROPSHEETPAGEW psp
[NUM_PROPERTY_PAGES
];
70 int pg
= 0; /* start with page 0 */
73 * Fill out the (Applications) PROPSHEETPAGE data structure
74 * for the property sheet
76 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
77 psp
[pg
].dwFlags
= PSP_USETITLE
;
78 psp
[pg
].hInstance
= hInstance
;
79 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_APPCFG
);
80 psp
[pg
].u2
.pszIcon
= NULL
;
81 psp
[pg
].pfnDlgProc
= AppDlgProc
;
82 psp
[pg
].pszTitle
= load_string (IDS_TAB_APPLICATIONS
);
87 * Fill out the (Libraries) PROPSHEETPAGE data structure
88 * for the property sheet
90 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
91 psp
[pg
].dwFlags
= PSP_USETITLE
;
92 psp
[pg
].hInstance
= hInstance
;
93 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_DLLCFG
);
94 psp
[pg
].u2
.pszIcon
= NULL
;
95 psp
[pg
].pfnDlgProc
= LibrariesDlgProc
;
96 psp
[pg
].pszTitle
= load_string (IDS_TAB_DLLS
);
101 * Fill out the (X11Drv) PROPSHEETPAGE data structure
102 * for the property sheet
104 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
105 psp
[pg
].dwFlags
= PSP_USETITLE
;
106 psp
[pg
].hInstance
= hInstance
;
107 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_GRAPHCFG
);
108 psp
[pg
].u2
.pszIcon
= NULL
;
109 psp
[pg
].pfnDlgProc
= GraphDlgProc
;
110 psp
[pg
].pszTitle
= load_string (IDS_TAB_GRAPHICS
);
114 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
115 psp
[pg
].dwFlags
= PSP_USETITLE
;
116 psp
[pg
].hInstance
= hInstance
;
117 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_DESKTOP_INTEGRATION
);
118 psp
[pg
].u2
.pszIcon
= NULL
;
119 psp
[pg
].pfnDlgProc
= ThemeDlgProc
;
120 psp
[pg
].pszTitle
= load_string (IDS_TAB_DESKTOP_INTEGRATION
);
124 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
125 psp
[pg
].dwFlags
= PSP_USETITLE
;
126 psp
[pg
].hInstance
= hInstance
;
127 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_DRIVECFG
);
128 psp
[pg
].u2
.pszIcon
= NULL
;
129 psp
[pg
].pfnDlgProc
= DriveDlgProc
;
130 psp
[pg
].pszTitle
= load_string (IDS_TAB_DRIVES
);
134 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
135 psp
[pg
].dwFlags
= PSP_USETITLE
;
136 psp
[pg
].hInstance
= hInstance
;
137 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_AUDIOCFG
);
138 psp
[pg
].u2
.pszIcon
= NULL
;
139 psp
[pg
].pfnDlgProc
= AudioDlgProc
;
140 psp
[pg
].pszTitle
= load_string (IDS_TAB_AUDIO
);
145 * Fill out the (General) PROPSHEETPAGE data structure
146 * for the property sheet
148 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
149 psp
[pg
].dwFlags
= PSP_USETITLE
;
150 psp
[pg
].hInstance
= hInstance
;
151 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_ABOUTCFG
);
152 psp
[pg
].u2
.pszIcon
= NULL
;
153 psp
[pg
].pfnDlgProc
= AboutDlgProc
;
154 psp
[pg
].pszTitle
= load_string (IDS_TAB_ABOUT
);
159 * Fill out the PROPSHEETHEADER
161 psh
.dwSize
= sizeof (PROPSHEETHEADERW
);
162 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_USEICONID
| PSH_USECALLBACK
;
163 psh
.hwndParent
= hOwner
;
164 psh
.hInstance
= hInstance
;
165 psh
.u
.pszIcon
= MAKEINTRESOURCEW (IDI_WINECFG
);
166 psh
.pszCaption
= load_string (IDS_WINECFG_TITLE
);
167 psh
.nPages
= NUM_PROPERTY_PAGES
;
169 psh
.pfnCallback
= PropSheetCallback
;
170 psh
.u2
.nStartPage
= 0;
173 * Display the modal property sheet
175 return PropertySheetW (&psh
);
178 /******************************************************************************
179 * Name : ProcessCmdLine
180 * Description: Checks command line parameters for 'autodetect drives' option
181 * Parameters : lpCmdLine - the command line
182 * Returns : TRUE - if '/D' was found. Drive autodetection was carried out.
183 * FALSE - no '/D' option found in command line
184 * Notes : This is a very simple implementation, which only works
185 * correctly if the one and only cmd line option is '/D' or
186 * no option at all. Has to be reworked, if more options are to
190 ProcessCmdLine(LPSTR lpCmdLine
)
192 if ((lpCmdLine
[0] == '/' || lpCmdLine
[0] == '-') &&
193 (lpCmdLine
[1] == 'D' || lpCmdLine
[1] == 'd'))
196 if (autodetect_drives()) {
197 apply_drive_changes();
205 /*****************************************************************************
207 * Description: Main windows entry point
208 * Parameters : hInstance
212 * Returns : Program exit code
215 WinMain (HINSTANCE hInstance
, HINSTANCE hPrev
, LPSTR szCmdLine
, int nShow
)
217 if (ProcessCmdLine(szCmdLine
)) {
221 if (initialize(hInstance
) != 0) {
222 WINE_ERR("initialization failed, aborting\n");
227 * The next 9 lines should be all that is needed
228 * for the Wine Configuration property sheet
230 InitCommonControls ();
231 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
232 if (doPropertySheet (hInstance
, NULL
) > 0) {
235 WINE_TRACE("Cancel\n");