Commit 1136408f authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

- Removed the central configuration structure, all changes are

committed instantly now. - Updated the drive handling code so it loads direct from the registry. - Removed DRIVE_DESC, drives are keyed by drive letter now. - Documented drive_available_mask. - Simplified the code somewhat.
parent e0b5270b
......@@ -36,8 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
WINECFG_DESC config;
void CALLBACK
PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
{
......
......@@ -63,17 +63,6 @@ typedef struct
typedef struct
{
char szName[MAX_NAME_LENGTH];
char szPath[MAX_NAME_LENGTH];
char szType[MAX_NAME_LENGTH];
char szFS[MAX_NAME_LENGTH];
char szLabel[MAX_NAME_LENGTH];
char szDevice[MAX_NAME_LENGTH];
char szSerial[MAX_NAME_LENGTH];
} DRIVE_DESC;
typedef struct
{
char szX11Display[MAX_NAME_LENGTH];
int nSysColors;
int nPrivateMap;
......
......@@ -179,157 +179,6 @@ HRESULT removeConfigValue(char *subkey, char *valueName) {
}
/*****************************************************************************
* Name : loadConfig
* Description: Loads and populates a configuration structure
* Parameters : pCfg
* Returns : 0 on success, -1 otherwise
*
*/
int loadConfig (WINECFG_DESC* pCfg)
{
const DLL_DESC *pDllDefaults;
char buffer[MAX_PATH];
char subKeyName[51];
DWORD res, i, sizeOfSubKeyName = 50;
WINE_TRACE("\n");
return_if_fail( initialize() == 0 , 1 );
/* System Paths */
/* getConfigValue(configKey, "Wine", "Windows", pCfg->szWinDir, MAX_PATH, "c:\\Windows");
getConfigValue(configKey, "Wine", "System", pCfg->szWinSysDir, MAX_PATH, "c:\\Windows\\System");
getConfigValue(configKey, "Wine", "Temp", pCfg->szWinTmpDir, MAX_PATH, "c:\\Windows\\Temp");
getConfigValue(configKey, "Wine", "Profile", pCfg->szWinProfDir, MAX_PATH, "c:\\Windows\\Profiles\\Administrator");
getConfigValue(configKey, "Wine", "Path", pCfg->szWinPath, MAX_PATH, "c:\\Windows;c:\\Windows\\System");
*/
/* Graphics driver */
/* getConfigValue(configKey, "Wine", "GraphicsDriver", pCfg->szGraphDriver, MAX_NAME_LENGTH, "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);
}
*/
pCfg->sX11Drv.nTextCP = 0;
pCfg->sX11Drv.nXVideoPort = 43;
pCfg->sX11Drv.nDepth = 16;
pCfg->sX11Drv.nManaged = 1;
pCfg->sX11Drv.nDesktopSizeX = 640;
pCfg->sX11Drv.nDesktopSizeY = 480;
pCfg->sX11Drv.nDGA = 1;
pCfg->sX11Drv.nXVidMode = 1;
pCfg->sX11Drv.nTakeFocus = 1;
pCfg->sX11Drv.nDXGrab = 0;
pCfg->sX11Drv.nDoubleBuffered = 0;
pCfg->sX11Drv.nSynchronous = 1;
/*
* Drive mappings
*/
/* pCfg->pDrives = DPA_Create(26);
for (i = 0;
RegEnumKeyExA(configKey, i, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, NULL ) != ERROR_NO_MORE_ITEMS;
++i, sizeOfSubKeyName=50) {
HKEY hkDrive;
DWORD returnType;
char returnBuffer[MAX_NAME_LENGTH];
DWORD sizeOfReturnBuffer = sizeof(returnBuffer);
LONG r;
if (!strncmp("Drive ", subKeyName, 5)) {
DRIVE_DESC *pDrive = malloc(sizeof(DRIVE_DESC));
WINE_TRACE("Loading %s\n", subKeyName);
ZeroMemory(pDrive, sizeof(*pDrive));
sizeOfReturnBuffer = sizeof(returnBuffer);
if (RegOpenKeyExA (configKey, subKeyName, 0, KEY_READ, &hkDrive) != ERROR_SUCCESS) {
WINE_ERR("unable to open drive registry key");
RegCloseKey(configKey);
return 1;
}
strncpy(pDrive->szName, &subKeyName[strlen(subKeyName)-1],1);
if(pDrive->szName) {
pDrive->szName[0] = toupper(pDrive->szName[0]);
}
ZeroMemory(returnBuffer, sizeof(*returnBuffer));
sizeOfReturnBuffer = sizeof(returnBuffer);
r = RegQueryValueExA(hkDrive, "Label", NULL, &returnType, returnBuffer, &sizeOfReturnBuffer);
if (r == ERROR_SUCCESS) {
strncpy(pDrive->szLabel, returnBuffer, sizeOfReturnBuffer);
} else {
WINE_WARN("pDrive->szLabel not loaded: %ld\n", r);
}
ZeroMemory(returnBuffer, sizeof(*returnBuffer));
sizeOfReturnBuffer = sizeof(returnBuffer);
r = RegQueryValueExA(hkDrive, "Serial", NULL, &returnType, returnBuffer, &sizeOfReturnBuffer);
if (r == ERROR_SUCCESS) {
strncpy(pDrive->szSerial, returnBuffer, sizeOfReturnBuffer);
} else {
WINE_WARN("pDrive->szSerial not loaded: %ld\n", r);
}
ZeroMemory(returnBuffer, sizeof(*returnBuffer));
sizeOfReturnBuffer = sizeof(returnBuffer);
r = RegQueryValueExA(hkDrive, "Type", NULL, &returnType, returnBuffer, &sizeOfReturnBuffer);
if (r == ERROR_SUCCESS) {
strncpy(pDrive->szType, returnBuffer, sizeOfReturnBuffer);
} else {
WINE_WARN("pDrive->szType not loaded: %ld", r);
}
ZeroMemory(returnBuffer, sizeof(*returnBuffer));
sizeOfReturnBuffer = sizeof(returnBuffer);
if (RegQueryValueExA(hkDrive, "Path", NULL, &returnType, returnBuffer, &sizeOfReturnBuffer) == ERROR_SUCCESS) {
strncpy(pDrive->szPath, returnBuffer, sizeOfReturnBuffer);
} else {
WINE_WARN("pDrive->szPath not loaded: %ld\n", GetLastError());
}
ZeroMemory(returnBuffer, sizeof(*returnBuffer));
sizeOfReturnBuffer = sizeof(returnBuffer);
if (RegQueryValueExA(hkDrive, "FileSystem", NULL, &returnType, returnBuffer, &sizeOfReturnBuffer) == ERROR_SUCCESS) {
strncpy(pDrive->szFS, returnBuffer, sizeOfReturnBuffer);
} else {
WINE_WARN("pDrive->szFS not loaded: %ld\n", GetLastError());
}
ZeroMemory(returnBuffer, sizeof(*returnBuffer));
sizeOfReturnBuffer = sizeof(returnBuffer);
if (RegQueryValueExA(hkDrive, "Device", NULL, &returnType, returnBuffer, &sizeOfReturnBuffer) == ERROR_SUCCESS) {
strncpy(pDrive->szDevice, returnBuffer, sizeOfReturnBuffer);
} else {
WINE_WARN("pDrive->szDevice not found: %ld\n", GetLastError());
}
if (DPA_InsertPtr(pCfg->pDrives, pCfg->driveCount, pDrive) == -1)
WINE_ERR("Failed to insert pDrive into DPA\n");
else
pCfg->driveCount++;
}
}
WINE_TRACE("loaded %d drives\n", pCfg->driveCount);
*/
return 0;
}
/* ========================================================================= */
/* Transaction management code */
......
......@@ -79,48 +79,7 @@ void destroyTransaction(struct transaction *trans);
/* Initializes the transaction system */
int initialize(void);
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;
HDPA pDrives;
int driveCount;
X11DRV_DESC sX11Drv;
} WINECFG_DESC;
extern WINECFG_DESC config;
WINECFG_DESC *allocConfig(void);
int freeConfig(WINECFG_DESC *pCfg);
int loadConfig(WINECFG_DESC *pCfg);
int saveConfig(const WINECFG_DESC *pCfg);
extern HKEY configKey;
int setConfigValue (char *subkey, char *valueName, const char *value);
char *getConfigValue (char *subkey, char *valueName, char *defaultResult);
......
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