2003-03-31 21:41:55 +02:00
|
|
|
/*
|
|
|
|
* WineCfg main entry point
|
|
|
|
*
|
|
|
|
* Copyright 2002 Jaco Greeff
|
|
|
|
* Copyright 2003 Dimitrie O. Paun
|
2003-08-30 02:40:46 +02:00
|
|
|
* Copyright 2003 Mike Hearn
|
2003-03-31 21:41:55 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-03-16 02:32:36 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2004-03-19 02:17:51 +01:00
|
|
|
#include <stdarg.h>
|
2004-03-15 21:10:14 +01:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
2003-03-31 21:41:55 +02:00
|
|
|
|
2004-03-19 02:17:51 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <winuser.h>
|
|
|
|
#include <commctrl.h>
|
2005-03-09 17:41:30 +01:00
|
|
|
#include <objbase.h>
|
2004-03-19 02:17:51 +01:00
|
|
|
#include <wine/debug.h>
|
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
#include "properties.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "winecfg.h"
|
|
|
|
|
2003-08-30 02:27:08 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
|
|
|
|
|
2005-06-02 17:11:32 +02:00
|
|
|
static void CALLBACK
|
2003-03-31 21:41:55 +02:00
|
|
|
PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* hWnd = NULL, lParam == dialog resource
|
|
|
|
*/
|
|
|
|
case PSCB_PRECREATE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSCB_INITIALIZED:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-02 17:11:32 +02:00
|
|
|
static INT_PTR CALLBACK
|
2004-02-07 02:01:34 +01:00
|
|
|
AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2003-03-31 21:41:55 +02:00
|
|
|
{
|
2003-08-30 02:27:08 +02:00
|
|
|
switch (uMsg) {
|
2003-10-22 05:02:26 +02:00
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
if (((LPNMHDR)lParam)->code != PSN_SETACTIVE) break;
|
|
|
|
/* otherwise fall through, we want to refresh the page as well */
|
2003-08-30 02:27:08 +02:00
|
|
|
case WM_INITDIALOG:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-01-20 03:07:35 +01:00
|
|
|
#define NUM_PROPERTY_PAGES 6
|
|
|
|
|
2005-06-02 17:11:32 +02:00
|
|
|
static INT_PTR
|
2003-03-31 21:41:55 +02:00
|
|
|
doPropertySheet (HINSTANCE hInstance, HWND hOwner)
|
|
|
|
{
|
|
|
|
PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
|
|
|
|
PROPSHEETHEADER psh;
|
2004-02-07 02:01:34 +01:00
|
|
|
int pg = 0; /* start with page 0 */
|
2003-03-31 21:41:55 +02:00
|
|
|
|
|
|
|
/*
|
2003-09-30 02:27:55 +02:00
|
|
|
* Fill out the (Applications) PROPSHEETPAGE data structure
|
2003-03-31 21:41:55 +02:00
|
|
|
* for the property sheet
|
|
|
|
*/
|
2004-02-07 02:01:34 +01:00
|
|
|
psp[pg].dwSize = sizeof (PROPSHEETPAGE);
|
|
|
|
psp[pg].dwFlags = PSP_USETITLE;
|
|
|
|
psp[pg].hInstance = hInstance;
|
|
|
|
psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
|
|
|
|
psp[pg].u2.pszIcon = NULL;
|
|
|
|
psp[pg].pfnDlgProc = AppDlgProc;
|
|
|
|
psp[pg].pszTitle = "Applications";
|
|
|
|
psp[pg].lParam = 0;
|
|
|
|
pg++;
|
2003-03-31 21:41:55 +02:00
|
|
|
|
|
|
|
/*
|
2003-09-30 02:27:55 +02:00
|
|
|
* Fill out the (Libraries) PROPSHEETPAGE data structure
|
2003-03-31 21:41:55 +02:00
|
|
|
* for the property sheet
|
|
|
|
*/
|
2004-02-07 02:01:34 +01:00
|
|
|
psp[pg].dwSize = sizeof (PROPSHEETPAGE);
|
|
|
|
psp[pg].dwFlags = PSP_USETITLE;
|
|
|
|
psp[pg].hInstance = hInstance;
|
|
|
|
psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
|
|
|
|
psp[pg].u2.pszIcon = NULL;
|
|
|
|
psp[pg].pfnDlgProc = LibrariesDlgProc;
|
|
|
|
psp[pg].pszTitle = "Libraries";
|
|
|
|
psp[pg].lParam = 0;
|
|
|
|
pg++;
|
2003-09-30 02:27:55 +02:00
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
/*
|
|
|
|
* Fill out the (X11Drv) PROPSHEETPAGE data structure
|
|
|
|
* for the property sheet
|
|
|
|
*/
|
2004-02-07 02:01:34 +01:00
|
|
|
psp[pg].dwSize = sizeof (PROPSHEETPAGE);
|
|
|
|
psp[pg].dwFlags = PSP_USETITLE;
|
|
|
|
psp[pg].hInstance = hInstance;
|
2004-07-30 03:35:13 +02:00
|
|
|
psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_GRAPHCFG);
|
2004-02-07 02:01:34 +01:00
|
|
|
psp[pg].u2.pszIcon = NULL;
|
2004-07-30 03:35:13 +02:00
|
|
|
psp[pg].pfnDlgProc = GraphDlgProc;
|
|
|
|
psp[pg].pszTitle = "Graphics";
|
2004-02-07 02:01:34 +01:00
|
|
|
psp[pg].lParam = 0;
|
|
|
|
pg++;
|
|
|
|
|
|
|
|
psp[pg].dwSize = sizeof (PROPSHEETPAGE);
|
|
|
|
psp[pg].dwFlags = PSP_USETITLE;
|
|
|
|
psp[pg].hInstance = hInstance;
|
|
|
|
psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DRIVECFG);
|
|
|
|
psp[pg].u2.pszIcon = NULL;
|
|
|
|
psp[pg].pfnDlgProc = DriveDlgProc;
|
|
|
|
psp[pg].pszTitle = "Drives";
|
|
|
|
psp[pg].lParam = 0;
|
|
|
|
pg++;
|
|
|
|
|
|
|
|
psp[pg].dwSize = sizeof (PROPSHEETPAGE);
|
|
|
|
psp[pg].dwFlags = PSP_USETITLE;
|
|
|
|
psp[pg].hInstance = hInstance;
|
|
|
|
psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_AUDIOCFG);
|
|
|
|
psp[pg].u2.pszIcon = NULL;
|
|
|
|
psp[pg].pfnDlgProc = AudioDlgProc;
|
|
|
|
psp[pg].pszTitle = "Audio";
|
|
|
|
psp[pg].lParam = 0;
|
|
|
|
pg++;
|
2003-03-31 21:41:55 +02:00
|
|
|
|
2004-02-07 02:01:34 +01:00
|
|
|
/*
|
|
|
|
* Fill out the (General) PROPSHEETPAGE data structure
|
|
|
|
* for the property sheet
|
|
|
|
*/
|
|
|
|
psp[pg].dwSize = sizeof (PROPSHEETPAGE);
|
|
|
|
psp[pg].dwFlags = PSP_USETITLE;
|
|
|
|
psp[pg].hInstance = hInstance;
|
|
|
|
psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_ABOUTCFG);
|
|
|
|
psp[pg].u2.pszIcon = NULL;
|
|
|
|
psp[pg].pfnDlgProc = AboutDlgProc;
|
|
|
|
psp[pg].pszTitle = "About";
|
|
|
|
psp[pg].lParam = 0;
|
|
|
|
pg++;
|
2004-01-20 03:07:35 +01:00
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
/*
|
|
|
|
* Fill out the PROPSHEETHEADER
|
|
|
|
*/
|
|
|
|
psh.dwSize = sizeof (PROPSHEETHEADER);
|
|
|
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
|
|
|
|
psh.hwndParent = hOwner;
|
|
|
|
psh.hInstance = hInstance;
|
|
|
|
psh.u.pszIcon = NULL;
|
|
|
|
psh.pszCaption = "Wine Configuration";
|
|
|
|
psh.nPages = NUM_PROPERTY_PAGES;
|
|
|
|
psh.u3.ppsp = (LPCPROPSHEETPAGE) & psp;
|
|
|
|
psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetCallback;
|
2003-09-30 02:27:55 +02:00
|
|
|
psh.u2.nStartPage = 0;
|
2003-03-31 21:41:55 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Display the modal property sheet
|
|
|
|
*/
|
|
|
|
return PropertySheet (&psh);
|
|
|
|
}
|
|
|
|
|
2005-02-14 22:03:52 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Name : ProcessCmdLine
|
|
|
|
* Description: Checks command line parameters for 'autodetect drives' option
|
|
|
|
* Parameters : lpCmdLine - the command line
|
|
|
|
* Returns : TRUE - if '/D' was found. Drive autodetection was carried out.
|
|
|
|
* FALSE - no '/D' option found in command line
|
|
|
|
* Notes : This is a very simple implementation, which only works
|
|
|
|
* correctly if the one and only cmd line option is '/D' or
|
|
|
|
* no option at all. Has to be reworked, if more options are to
|
|
|
|
* be supported.
|
|
|
|
*/
|
2005-06-02 17:11:32 +02:00
|
|
|
static BOOL
|
2005-02-14 22:03:52 +01:00
|
|
|
ProcessCmdLine(LPSTR lpCmdLine)
|
|
|
|
{
|
|
|
|
if ((lpCmdLine[0] == '/' || lpCmdLine[0] == '-') &&
|
|
|
|
(lpCmdLine[1] == 'D' || lpCmdLine[1] == 'd'))
|
|
|
|
{
|
|
|
|
gui_mode = FALSE;
|
|
|
|
if (autodetect_drives()) {
|
|
|
|
apply_drive_changes();
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-03-31 21:41:55 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Name : WinMain
|
|
|
|
* Description: Main windows entry point
|
2003-06-18 05:30:39 +02:00
|
|
|
* Parameters : hInstance
|
2003-03-31 21:41:55 +02:00
|
|
|
* hPrev
|
|
|
|
* szCmdLine
|
|
|
|
* nShow
|
|
|
|
* Returns : Program exit code
|
|
|
|
*/
|
|
|
|
int WINAPI
|
|
|
|
WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
|
|
|
|
{
|
2005-02-14 22:03:52 +01:00
|
|
|
if (ProcessCmdLine(szCmdLine)) {
|
|
|
|
return 0;
|
|
|
|
}
|
2003-03-31 21:41:55 +02:00
|
|
|
|
2003-09-08 20:58:07 +02:00
|
|
|
if (initialize() != 0) {
|
|
|
|
WINE_ERR("initialization failed, aborting\n");
|
|
|
|
ExitProcess(1);
|
|
|
|
}
|
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
/*
|
2005-03-09 17:41:30 +01:00
|
|
|
* The next 9 lines should be all that is needed
|
2003-03-31 21:41:55 +02:00
|
|
|
* for the Wine Configuration property sheet
|
|
|
|
*/
|
|
|
|
InitCommonControls ();
|
2005-03-09 17:41:30 +01:00
|
|
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
2003-08-30 02:40:46 +02:00
|
|
|
if (doPropertySheet (hInstance, NULL) > 0) {
|
2003-08-30 02:27:08 +02:00
|
|
|
WINE_TRACE("OK\n");
|
2003-09-30 02:27:55 +02:00
|
|
|
} else {
|
2003-08-30 02:27:08 +02:00
|
|
|
WINE_TRACE("Cancel\n");
|
2003-09-30 02:27:55 +02:00
|
|
|
}
|
2005-03-09 17:41:30 +01:00
|
|
|
CoUninitialize();
|
2003-03-31 21:41:55 +02:00
|
|
|
ExitProcess (0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|