Commit 82ce2cc7 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

New winecfg skeleton app, based heavily on original work by Jaco

Greeff.
parent 8f4d437a
...@@ -1543,6 +1543,7 @@ programs/uninstaller/Makefile ...@@ -1543,6 +1543,7 @@ programs/uninstaller/Makefile
programs/view/Makefile programs/view/Makefile
programs/wcmd/Makefile programs/wcmd/Makefile
programs/wineboot/Makefile programs/wineboot/Makefile
programs/winecfg/Makefile
programs/wineconsole/Makefile programs/wineconsole/Makefile
programs/winedbg/Makefile programs/winedbg/Makefile
programs/winefile/Makefile programs/winefile/Makefile
......
...@@ -24,6 +24,7 @@ SUBDIRS = \ ...@@ -24,6 +24,7 @@ SUBDIRS = \
view \ view \
wcmd \ wcmd \
wineboot \ wineboot \
winecfg \
wineconsole \ wineconsole \
winedbg \ winedbg \
winefile \ winefile \
...@@ -48,6 +49,7 @@ INSTALLSUBDIRS = \ ...@@ -48,6 +49,7 @@ INSTALLSUBDIRS = \
uninstaller \ uninstaller \
wcmd \ wcmd \
wineboot \ wineboot \
winecfg \
wineconsole \ wineconsole \
winedbg \ winedbg \
winefile \ winefile \
...@@ -66,6 +68,7 @@ INSTALLPROGS = \ ...@@ -66,6 +68,7 @@ INSTALLPROGS = \
uninstaller \ uninstaller \
wcmd \ wcmd \
wineboot \ wineboot \
winecfg \
wineconsole \ wineconsole \
winedbg \ winedbg \
winefile \ winefile \
......
Makefile
winecfg.exe.dbg.c
winecfg.exe.spec.c
winecfg.res
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winecfg.exe
APPMODE = gui
IMPORTS = comctl32 user32
C_SRCS = \
main.c \
properties.c \
winecfg.c
RC_SRCS = winecfg.rc
@MAKE_PROG_RULES@
### Dependencies:
/*
* WineCfg main entry point
*
* Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun
*
* 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
*
*/
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <stdio.h>
#include "properties.h"
#include "resource.h"
#include "winecfg.h"
WINECFG_DESC sCfg;
void CALLBACK
PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
{
switch (uMsg)
{
/*
* hWnd = NULL, lParam == dialog resource
*/
case PSCB_PRECREATE:
break;
case PSCB_INITIALIZED:
break;
default:
break;
}
}
void
initGeneralDlg (HWND hDlg)
{
int i;
const VERSION_DESC *pVer = NULL;
if ((pVer = getWinVersions ()))
{
for (i = 0; *pVer->szVersion; i++, pVer++)
{
SendDlgItemMessage (hDlg, IDC_WINVER, CB_ADDSTRING,
0, (LPARAM) pVer->szDescription);
if (!strcmp (pVer->szVersion, sCfg.szWinVer))
SendDlgItemMessage (hDlg, IDC_WINVER, CB_SETCURSEL,
(WPARAM) i, 0);
}
}
if ((pVer = getDOSVersions ()))
{
for (i = 0; *pVer->szVersion; i++, pVer++)
{
SendDlgItemMessage (hDlg, IDC_DOSVER, CB_ADDSTRING,
0, (LPARAM) pVer->szDescription);
if (!strcmp (pVer->szVersion, sCfg.szDOSVer))
SendDlgItemMessage (hDlg, IDC_DOSVER, CB_SETCURSEL,
(WPARAM) i, 0);
}
}
if ((pVer = getWinelook ()))
{
for (i = 0; *pVer->szVersion; i++, pVer++)
{
SendDlgItemMessage (hDlg, IDC_WINELOOK, CB_ADDSTRING,
0, (LPARAM) pVer->szDescription);
if (!strcmp (pVer->szVersion, sCfg.szWinLook))
SendDlgItemMessage (hDlg, IDC_WINELOOK, CB_SETCURSEL,
(WPARAM) i, 0);
}
}
}
INT_PTR CALLBACK
GeneralDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
initGeneralDlg (hDlg);
break;
case WM_COMMAND:
break;
default:
break;
}
return FALSE;
}
INT_PTR CALLBACK
DllDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
break;
default:
break;
}
return FALSE;
}
INT_PTR CALLBACK
AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
break;
default:
break;
}
return FALSE;
}
void
initX11DrvDlg (HWND hDlg)
{
char szBuf[20];
sprintf (szBuf, "%d", sCfg.sX11Drv.nSysColors);
SendDlgItemMessage (hDlg, IDC_SYSCOLORS, WM_SETTEXT, 0, (LPARAM) szBuf);
sprintf (szBuf, "%d", sCfg.sX11Drv.nDesktopSizeX);
SendDlgItemMessage (hDlg, IDC_DESKTOP_WIDTH, WM_SETTEXT, 0,
(LPARAM) szBuf);
sprintf (szBuf, "%d", sCfg.sX11Drv.nDesktopSizeY);
SendDlgItemMessage (hDlg, IDC_DESKTOP_HEIGHT, WM_SETTEXT, 0,
(LPARAM) szBuf);
}
INT_PTR CALLBACK
X11DrvDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
initX11DrvDlg (hDlg);
break;
case WM_COMMAND:
break;
default:
break;
}
return FALSE;
}
#define NUM_PROPERTY_PAGES 4
INT_PTR
doPropertySheet (HINSTANCE hInstance, HWND hOwner)
{
PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
PROPSHEETHEADER psh;
/*
* Fill out the (General) PROPSHEETPAGE data structure
* for the property sheet
*/
psp[0].dwSize = sizeof (PROPSHEETPAGE);
psp[0].dwFlags = PSP_USETITLE;
psp[0].hInstance = hInstance;
psp[0].u.pszTemplate = MAKEINTRESOURCE (IDD_GENERALCFG);
psp[0].u2.pszIcon = NULL;
psp[0].pfnDlgProc = GeneralDlgProc;
psp[0].pszTitle = "General";
psp[0].lParam = 0;
/*
* Fill out the (Libraries) PROPSHEETPAGE data structure
* for the property sheet
*/
psp[1].dwSize = sizeof (PROPSHEETPAGE);
psp[1].dwFlags = PSP_USETITLE;
psp[1].hInstance = hInstance;
psp[1].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
psp[1].u2.pszIcon = NULL;
psp[1].pfnDlgProc = DllDlgProc;
psp[1].pszTitle = "Libraries";
psp[1].lParam = 0;
/*
* Fill out the (Applications) PROPSHEETPAGE data structure
* for the property sheet
*/
psp[2].dwSize = sizeof (PROPSHEETPAGE);
psp[2].dwFlags = PSP_USETITLE;
psp[2].hInstance = hInstance;
psp[2].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
psp[2].u2.pszIcon = NULL;
psp[2].pfnDlgProc = AppDlgProc;
psp[2].pszTitle = "Applications";
psp[2].lParam = 0;
/*
* Fill out the (X11Drv) PROPSHEETPAGE data structure
* for the property sheet
*/
psp[3].dwSize = sizeof (PROPSHEETPAGE);
psp[3].dwFlags = PSP_USETITLE;
psp[3].hInstance = hInstance;
psp[3].u.pszTemplate = MAKEINTRESOURCE (IDD_X11DRVCFG);
psp[3].u2.pszIcon = NULL;
psp[3].pfnDlgProc = X11DrvDlgProc;
psp[3].pszTitle = "X11 Driver";
psp[3].lParam = 0;
/*
* 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;
/*
* Display the modal property sheet
*/
return PropertySheet (&psh);
}
/*****************************************************************************
* Name : WinMain
* Description: Main windows entry point
* Paramaters : hInstance
* hPrev
* szCmdLine
* nShow
* Returns : Program exit code
*/
int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
{
/*
* Load the configuration from registry
*/
loadConfig (&sCfg);
/*
* The next 3 lines should be all that is needed
* for the Wine Configuration property sheet
*/
InitCommonControls ();
doPropertySheet (hInstance, NULL);
ExitProcess (0);
return 0;
}
/*
* WineCfg properties management
*
* Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun
*
* 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
*
*/
#include <windows.h>
#include "properties.h"
static VERSION_DESC sWinVersions[] = {
{"win20", "Windows 2.0"},
{"win30", "Windows 3.0"},
{"win31", "Windows 3.1"},
{"nt351", "Windows NT 3.5"},
{"nt40", "Windows NT 4.0"},
{"win95", "Windows 95"},
{"win98", "Windows 98"},
{"winme", "Windows ME"},
{"win2k", "Windows 2000"},
{"winxp", "Windows XP"},
{"", ""}
};
static VERSION_DESC sDOSVersions[] = {
{"6.22", "MS-DOS 6.22"},
{"", ""}
};
static VERSION_DESC sWineLook[] = {
{"win31", "Windows 3.1"},
{"win95", "Windows 95"},
{"win98", "Windows 98"},
{"", ""}
};
static VERSION_DESC sWineDrivers[] = {
{"x11drv", "X11 Interface"},
{"ttydrv", "TTY Interface"},
{"", ""}
};
static DLL_DESC sDLLType[] = {
{"oleaut32", DLL_BUILTIN},
{"ole32", DLL_BUILTIN},
{"commdlg", DLL_BUILTIN},
{"comdlg32", DLL_BUILTIN},
{"shell", DLL_BUILTIN},
{"shell32", DLL_BUILTIN},
{"shfolder", DLL_BUILTIN},
{"shlwapi", DLL_BUILTIN},
{"shdocvw", DLL_BUILTIN},
{"advapi32", DLL_BUILTIN},
{"msvcrt", DLL_NATIVE},
{"mciavi.drv", DLL_NATIVE},
{"mcianim.drv", DLL_NATIVE},
{"*", DLL_NATIVE},
{"", -1}
};
/*****************************************************************************
*/
const VERSION_DESC* getWinVersions(void)
{
return sWinVersions;
}
/*****************************************************************************
*/
const VERSION_DESC* getDOSVersions(void)
{
return sDOSVersions;
}
/*****************************************************************************
*/
const VERSION_DESC* getWinelook(void)
{
return sWineLook;
}
/*****************************************************************************
*/
const DLL_DESC* getDLLDefaults(void)
{
return sDLLType;
}
/*
* WineCfg configuration properties
*
* Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun
*
* 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
*
*/
#ifndef WINE_CFG_PROPERTIES_H
#define WINE_CFG_PROPERTIES_H
#include "commctrl.h"
#define MAX_NAME_LENGTH 64
#define MAX_VERSION_LENGTH 48
#define MAX_DESCRIPTION_LENGTH 128
typedef struct
{
char szVersion[MAX_VERSION_LENGTH];
char szDescription[MAX_DESCRIPTION_LENGTH];
} VERSION_DESC;
#define DLL_NATIVE 0x0000
#define DLL_BUILTIN 0x0001
typedef struct
{
char szName[MAX_NAME_LENGTH];
int nType;
} DLL_DESC;
typedef struct
{
char szName[MAX_NAME_LENGTH];
char szWinVer[MAX_VERSION_LENGTH];
char szDOSVer[MAX_VERSION_LENGTH];
HDPA DLLs;
} APP_DESC;
typedef struct
{
char szX11Display[MAX_NAME_LENGTH];
int nSysColors;
int nPrivateMap;
int nPerfect;
int nDepth;
int nManaged;
int nDesktopSizeX;
int nDesktopSizeY;
int nDGA;
int nXShm;
int nXVidMode;
int nTakeFocus;
int nDXGrab;
int nDoubleBuffered;
int nTextCP;
int nXVideoPort;
int nSynchronous;
} X11DRV_DESC;
const VERSION_DESC *getWinVersions(void);
const VERSION_DESC *getDOSVersions(void);
const VERSION_DESC *getWinelook(void);
const DLL_DESC *getDLLDefaults(void);
#endif
/*
* WineCfg resource definitions
*
* Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun
*
* 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
*
*/
#define IDC_STATIC -1
#define IDS_WINE_VERSION 1
#define IDS_TAB_GENERAL 2
#define IDS_TAB_DLLS 3
#define IDS_TAB_DRIVES 4
#define IDD_MAINDLG 101
#define IDB_WINE 104
#define IDD_GENERALCFG 107
#define IDD_APPCFG 108
#define IDD_X11DRVCFG 109
#define IDD_DLLCFG 110
#define IDC_TABABOUT 1001
#define IDC_APPLYBTN 1002
#define IDC_WINEVER 1011
#define IDC_WINVER 1012
#define IDC_WINELOOK 1013
#define IDC_DOSVER 1014
#define IDC_SYSCOLORS 1017
#define IDC_PRIVATEMAP 1018
#define IDC_PERFECTGRAPH 1019
#define IDC_LIST_APPS 1021
#define IDC_MANAGED 1022
#define IDC_DESKTOP_WIDTH 1023
#define IDC_DESKTOP_HEIGHT 1024
#define IDC_DESKTOP_SIZE 1025
#define IDC_DESKTOP_BY 1026
#define IDC_XDGA 1027
#define IDC_XSHM 1028
#define IDC_RAD_BUILTIN 1029
#define IDC_RAD_NATIVE 1030
#define IDC_LIST_DLLS 1031
/*
* WineCfg configuration management
*
* Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun
*
* 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
*
*/
#include <stdio.h>
#include <limits.h>
#include <windows.h>
#include "winecfg.h"
/*****************************************************************************
*/
WINECFG_DESC* allocConfig(void)
{
WINECFG_DESC* pWineCfg = malloc (sizeof (WINECFG_DESC));
if (!pWineCfg) goto fail;
ZeroMemory(pWineCfg, sizeof(*pWineCfg));
pWineCfg->pDlls = DPA_Create(100);
if (!pWineCfg->pDlls) goto fail;
pWineCfg->pApps = DPA_Create(100);
if (!pWineCfg->pApps) goto fail;
return pWineCfg;
fail:
/* FIXME: do something nice */
printf("Out of memory");
exit(1);
}
/*****************************************************************************
*/
int freeConfig (WINECFG_DESC* pCfg)
{
int i;
for (i = 0; i < pCfg->pDlls->nItemCount; i++)
free (DPA_GetPtr(pCfg->pDlls, i));
DPA_Destroy(pCfg->pDlls);
for (i = 0; i < pCfg->pApps->nItemCount; i++)
free (DPA_GetPtr(pCfg->pApps, i));
DPA_Destroy(pCfg->pApps);
free (pCfg);
return 0;
}
/*****************************************************************************
* Name : loadConfig
* Description: Loads and populates a configuration structure
* Parameters : pCfg
* Returns : 0 on success, -1 otherwise
*
* FIXME: We are supposed to load these values from the registry.
* This is not active yet, so just setup some (hopefully)
* sane defaults
*/
int loadConfig (WINECFG_DESC* pCfg)
{
const DLL_DESC *pDllDefaults;
/*
* The default versions for all applications
*/
strcpy(pCfg->szDOSVer, "6.22");
strcpy(pCfg->szWinVer, "win95");
strcpy(pCfg->szWinLook, "win95");
/*
* Default directories
*/
strcpy(pCfg->szWinDir, "c:\\Windows");
strcpy(pCfg->szWinSysDir, "c:\\Windows\\System");
strcpy(pCfg->szWinTmpDir, "c:\\Windows\\Temp");
strcpy(pCfg->szWinProfDir, "c:\\Windows\\Profiles\\Administrator");
strcpy(pCfg->szWinPath, "c:\\Windows;c:\\Windows\\System");
/*
* Graphics driver
*/
strcpy(pCfg->szGraphDriver, "x11drv");
/*
* DLL defaults for all applications is built using
* the default DLL structure
*/
for (pDllDefaults = getDLLDefaults (); *pDllDefaults->szName; pDllDefaults++)
{
DLL_DESC *pDll = malloc(sizeof(DLL_DESC));
memcpy (pDll, pDllDefaults, sizeof(DLL_DESC));
DPA_InsertPtr(pCfg->pDlls, INT_MAX, pDll);
}
/*
* Application defaults on a per application
* level (if not set, this defaults to what
* is already there)
*/
/* FIXME: TODO */
/*
* X11Drv defaults
*/
strcpy(pCfg->sX11Drv.szX11Display, ":0.0");
pCfg->sX11Drv.nSysColors = 100;
pCfg->sX11Drv.nPrivateMap = 0;
pCfg->sX11Drv.nPerfect = 0;
pCfg->sX11Drv.nDepth = 16;
pCfg->sX11Drv.nManaged = 1;
pCfg->sX11Drv.nDesktopSizeX = 640;
pCfg->sX11Drv.nDesktopSizeY = 480;
pCfg->sX11Drv.nDGA = 1;
pCfg->sX11Drv.nXShm = 1;
pCfg->sX11Drv.nXVidMode = 1;
pCfg->sX11Drv.nTakeFocus = 1;
pCfg->sX11Drv.nDXGrab = 0;
pCfg->sX11Drv.nDoubleBuffered = 0;
pCfg->sX11Drv.nTextCP = 0;
pCfg->sX11Drv.nXVideoPort = 43;
pCfg->sX11Drv.nSynchronous = 1;
return 0;
}
/*****************************************************************************
* Name: saveConfig
* Description: Stores the configuration structure
* Parameters : pCfg
* Returns : 0 on success, -1 otherwise
*
* FIXME: This is where we are to write the changes to the registry.
* This is not setup yet, so do nothing and say ok.
*/
int saveConfig (const WINECFG_DESC* pCfg)
{
return 0;
}
/*
* WineCfg configuration management
*
* Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun
*
* 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
*
*/
#ifndef WINE_CFG_H
#define WINE_CFG_H
#include "properties.h"
typedef struct structWineCfg
{
char szWinVer[MAX_VERSION_LENGTH];
char szWinLook[MAX_VERSION_LENGTH];
char szDOSVer[MAX_VERSION_LENGTH];
char szWinDir[MAX_PATH];
char szWinSysDir[MAX_PATH];
char szWinPath[MAX_PATH];
char szWinTmpDir[MAX_PATH];
char szWinProfDir[MAX_PATH];
char szGraphDriver[MAX_NAME_LENGTH];
HDPA pDlls;
HDPA pApps;
X11DRV_DESC sX11Drv;
} WINECFG_DESC;
WINECFG_DESC *allocConfig(void);
int freeConfig(WINECFG_DESC *pCfg);
int loadConfig(WINECFG_DESC *pCfg);
int saveConfig(const WINECFG_DESC *pCfg);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment