2 * WineCfg configuration management
4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 /*****************************************************************************
32 WINECFG_DESC* allocConfig(void)
34 WINECFG_DESC* pWineCfg = malloc (sizeof (WINECFG_DESC));
36 if (!pWineCfg) goto fail;
37 ZeroMemory(pWineCfg, sizeof(*pWineCfg));
39 pWineCfg->pDlls = DPA_Create(100);
40 if (!pWineCfg->pDlls) goto fail;
41 pWineCfg->pApps = DPA_Create(100);
42 if (!pWineCfg->pApps) goto fail;
47 /* FIXME: do something nice */
48 printf("Out of memory");
53 /*****************************************************************************
55 int freeConfig (WINECFG_DESC* pCfg)
59 for (i = 0; i < pCfg->pDlls->nItemCount; i++)
60 free (DPA_GetPtr(pCfg->pDlls, i));
61 DPA_Destroy(pCfg->pDlls);
63 for (i = 0; i < pCfg->pApps->nItemCount; i++)
64 free (DPA_GetPtr(pCfg->pApps, i));
65 DPA_Destroy(pCfg->pApps);
72 /*****************************************************************************
74 * Description: Loads and populates a configuration structure
76 * Returns : 0 on success, -1 otherwise
78 * FIXME: We are supposed to load these values from the registry.
79 * This is not active yet, so just setup some (hopefully)
82 int loadConfig (WINECFG_DESC* pCfg)
84 const DLL_DESC *pDllDefaults;
87 * The default versions for all applications
89 strcpy(pCfg->szDOSVer, "6.22");
90 strcpy(pCfg->szWinVer, "win95");
91 strcpy(pCfg->szWinLook, "win95");
96 strcpy(pCfg->szWinDir, "c:\\Windows");
97 strcpy(pCfg->szWinSysDir, "c:\\Windows\\System");
98 strcpy(pCfg->szWinTmpDir, "c:\\Windows\\Temp");
99 strcpy(pCfg->szWinProfDir, "c:\\Windows\\Profiles\\Administrator");
100 strcpy(pCfg->szWinPath, "c:\\Windows;c:\\Windows\\System");
105 strcpy(pCfg->szGraphDriver, "x11drv");
108 * DLL defaults for all applications is built using
109 * the default DLL structure
111 for (pDllDefaults = getDLLDefaults (); *pDllDefaults->szName; pDllDefaults++)
113 DLL_DESC *pDll = malloc(sizeof(DLL_DESC));
114 memcpy (pDll, pDllDefaults, sizeof(DLL_DESC));
115 DPA_InsertPtr(pCfg->pDlls, INT_MAX, pDll);
119 * Application defaults on a per application
120 * level (if not set, this defaults to what
128 strcpy(pCfg->sX11Drv.szX11Display, ":0.0");
129 pCfg->sX11Drv.nSysColors = 100;
130 pCfg->sX11Drv.nPrivateMap = 0;
131 pCfg->sX11Drv.nPerfect = 0;
132 pCfg->sX11Drv.nDepth = 16;
133 pCfg->sX11Drv.nManaged = 1;
134 pCfg->sX11Drv.nDesktopSizeX = 640;
135 pCfg->sX11Drv.nDesktopSizeY = 480;
136 pCfg->sX11Drv.nDGA = 1;
137 pCfg->sX11Drv.nXShm = 1;
138 pCfg->sX11Drv.nXVidMode = 1;
139 pCfg->sX11Drv.nTakeFocus = 1;
140 pCfg->sX11Drv.nDXGrab = 0;
141 pCfg->sX11Drv.nDoubleBuffered = 0;
142 pCfg->sX11Drv.nTextCP = 0;
143 pCfg->sX11Drv.nXVideoPort = 43;
144 pCfg->sX11Drv.nSynchronous = 1;
150 /*****************************************************************************
152 * Description: Stores the configuration structure
154 * Returns : 0 on success, -1 otherwise
156 * FIXME: This is where we are to write the changes to the registry.
157 * This is not setup yet, so do nothing and say ok.
159 int saveConfig (const WINECFG_DESC* pCfg)