2003-03-31 21:41:55 +02:00
|
|
|
/*
|
|
|
|
* WineCfg configuration management
|
|
|
|
*
|
|
|
|
* Copyright 2002 Jaco Greeff
|
|
|
|
* Copyright 2003 Dimitrie O. Paun
|
2004-09-28 05:16:43 +02:00
|
|
|
* Copyright 2004 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-03-31 21:41:55 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WINE_CFG_H
|
|
|
|
#define WINE_CFG_H
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winnls.h"
|
2008-05-19 05:50:19 +02:00
|
|
|
#include "commctrl.h"
|
2003-03-31 21:41:55 +02:00
|
|
|
|
2003-08-30 02:40:46 +02:00
|
|
|
#define IS_OPTION_TRUE(ch) \
|
|
|
|
((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
|
|
|
|
#define IS_OPTION_FALSE(ch) \
|
|
|
|
((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
|
|
|
|
|
2006-08-16 18:30:48 +02:00
|
|
|
extern WCHAR* current_app; /* NULL means editing global settings */
|
2003-09-08 20:58:07 +02:00
|
|
|
|
2005-06-13 20:49:23 +02:00
|
|
|
/* Use get_reg_key and set_reg_key to alter registry settings. The changes made through
|
|
|
|
set_reg_key won't be committed to the registry until process_all_settings is called,
|
|
|
|
however get_reg_key will still return accurate information.
|
2003-09-30 02:27:55 +02:00
|
|
|
|
2005-06-23 13:42:54 +02:00
|
|
|
The root HKEY has to be non-ambiguous. So only the registry roots (HKCU, HKLM, ...) or
|
|
|
|
the global config_key are allowed here.
|
|
|
|
|
2005-06-13 20:49:23 +02:00
|
|
|
You are expected to HeapFree the result of get_reg_key. The parameters to set_reg_key will
|
|
|
|
be copied, so free them too when necessary.
|
2004-09-28 05:55:16 +02:00
|
|
|
*/
|
2004-11-23 14:50:23 +01:00
|
|
|
|
2007-08-03 01:33:24 +02:00
|
|
|
void set_reg_keyW(HKEY root, const WCHAR *path, const WCHAR *name, const WCHAR *value);
|
|
|
|
void set_reg_key_dwordW(HKEY root, const WCHAR *path, const WCHAR *name, DWORD value);
|
|
|
|
WCHAR *get_reg_keyW(HKEY root, const WCHAR *path, const WCHAR *name, const WCHAR *def);
|
|
|
|
WCHAR **enumerate_valuesW(HKEY root, WCHAR *path);
|
|
|
|
|
2005-06-23 13:42:54 +02:00
|
|
|
void set_reg_key(HKEY root, const char *path, const char *name, const char *value);
|
2005-08-17 13:37:34 +02:00
|
|
|
void set_reg_key_dword(HKEY root, const char *path, const char *name, DWORD value);
|
2005-06-23 13:42:54 +02:00
|
|
|
char *get_reg_key(HKEY root, const char *path, const char *name, const char *def);
|
|
|
|
BOOL reg_key_exists(HKEY root, const char *path, const char *name);
|
2004-09-28 05:55:16 +02:00
|
|
|
void apply(void);
|
2005-06-23 13:42:54 +02:00
|
|
|
char **enumerate_values(HKEY root, char *path);
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2006-08-16 06:22:54 +02:00
|
|
|
/* Load a string from the resources. Allocated with HeapAlloc (GetProcessHeap()) */
|
|
|
|
WCHAR* load_string (UINT id);
|
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
/* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
|
2004-11-23 14:50:23 +01:00
|
|
|
the user is editing the global settings.
|
|
|
|
|
|
|
|
no explicit free is needed of the string returned by this function
|
2004-09-28 05:16:43 +02:00
|
|
|
*/
|
2008-04-25 14:36:25 +02:00
|
|
|
char *keypath(const char *section);
|
|
|
|
WCHAR *keypathW(const WCHAR *section);
|
2003-09-08 20:58:07 +02:00
|
|
|
|
2005-12-17 12:30:06 +01:00
|
|
|
int initialize(HINSTANCE hInstance);
|
2004-09-28 05:55:16 +02:00
|
|
|
extern HKEY config_key;
|
2003-03-31 21:41:55 +02:00
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
/* hack for the property sheet control */
|
2004-09-28 05:55:16 +02:00
|
|
|
void set_window_title(HWND dialog);
|
2003-08-30 02:49:00 +02:00
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
/* Window procedures */
|
2004-07-30 03:35:13 +02:00
|
|
|
INT_PTR CALLBACK GraphDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2003-08-30 02:49:00 +02:00
|
|
|
INT_PTR CALLBACK DriveDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
INT_PTR CALLBACK DriveEditDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2003-09-30 02:27:55 +02:00
|
|
|
INT_PTR CALLBACK AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2004-01-07 01:43:40 +01:00
|
|
|
INT_PTR CALLBACK LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2004-01-20 03:07:35 +01:00
|
|
|
INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2005-08-24 12:59:40 +02:00
|
|
|
INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2004-01-20 03:07:35 +01:00
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
/* Drive management */
|
2008-10-23 16:29:11 +02:00
|
|
|
BOOL load_drives(void);
|
2005-06-16 17:52:44 +02:00
|
|
|
int autodetect_drives(void);
|
2004-11-23 14:50:23 +01:00
|
|
|
|
|
|
|
struct drive
|
|
|
|
{
|
|
|
|
char letter;
|
|
|
|
char *unixpath;
|
2008-10-23 16:19:36 +02:00
|
|
|
char *device;
|
2008-10-17 14:11:56 +02:00
|
|
|
WCHAR *label;
|
2008-10-17 13:37:04 +02:00
|
|
|
DWORD serial;
|
2004-11-23 14:50:23 +01:00
|
|
|
DWORD type; /* one of the DRIVE_ constants from winbase.h */
|
|
|
|
|
|
|
|
BOOL in_use;
|
2008-10-23 12:15:43 +02:00
|
|
|
BOOL modified;
|
2004-11-23 14:50:23 +01:00
|
|
|
};
|
|
|
|
|
2006-06-10 04:33:42 +02:00
|
|
|
#define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A'))
|
2004-11-23 14:50:23 +01:00
|
|
|
|
|
|
|
long drive_available_mask(char letter);
|
2008-10-23 16:19:36 +02:00
|
|
|
BOOL add_drive(char letter, const char *targetpath, const char *device,
|
|
|
|
const WCHAR *label, DWORD serial, DWORD type);
|
2004-11-23 14:50:23 +01:00
|
|
|
void delete_drive(struct drive *pDrive);
|
2005-06-16 17:52:44 +02:00
|
|
|
void apply_drive_changes(void);
|
2008-01-03 14:29:24 +01:00
|
|
|
BOOL browse_for_unix_folder(HWND dialog, WCHAR *pszPath);
|
2004-11-23 14:50:23 +01:00
|
|
|
extern struct drive drives[26]; /* one for each drive letter */
|
|
|
|
|
|
|
|
BOOL gui_mode;
|
|
|
|
|
|
|
|
/* Some basic utilities to make win32 suck less */
|
2003-09-30 02:27:55 +02:00
|
|
|
#define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
|
|
|
|
#define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
|
2004-05-04 04:56:46 +02:00
|
|
|
void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
|
2003-09-30 02:27:55 +02:00
|
|
|
|
2004-09-28 05:16:43 +02:00
|
|
|
/* returns a string in the win32 heap */
|
2005-06-02 17:11:32 +02:00
|
|
|
static inline char *strdupA(const char *s)
|
2004-09-28 05:16:43 +02:00
|
|
|
{
|
2005-02-14 12:01:16 +01:00
|
|
|
char *r = HeapAlloc(GetProcessHeap(), 0, strlen(s)+1);
|
2004-09-28 05:16:43 +02:00
|
|
|
return strcpy(r, s);
|
|
|
|
}
|
|
|
|
|
2006-08-16 06:23:52 +02:00
|
|
|
static inline WCHAR *strdupW(const WCHAR *s)
|
|
|
|
{
|
|
|
|
WCHAR *r = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(s)+1)*sizeof(WCHAR));
|
|
|
|
return lstrcpyW(r, s);
|
|
|
|
}
|
|
|
|
|
2004-11-23 14:50:23 +01:00
|
|
|
static inline char *get_text(HWND dialog, WORD id)
|
2004-09-28 06:05:55 +02:00
|
|
|
{
|
|
|
|
HWND item = GetDlgItem(dialog, id);
|
|
|
|
int len = GetWindowTextLength(item) + 1;
|
2004-11-23 14:50:23 +01:00
|
|
|
char *result = len ? HeapAlloc(GetProcessHeap(), 0, len) : NULL;
|
|
|
|
if (!result || GetWindowText(item, result, len) == 0) return NULL;
|
2004-09-28 06:05:55 +02:00
|
|
|
return result;
|
|
|
|
}
|
2004-09-28 05:16:43 +02:00
|
|
|
|
2008-01-03 14:29:24 +01:00
|
|
|
static inline WCHAR *get_textW(HWND dialog, WORD id)
|
|
|
|
{
|
|
|
|
HWND item = GetDlgItem(dialog, id);
|
|
|
|
int len = GetWindowTextLengthW(item) + 1;
|
|
|
|
WCHAR *result = len ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL;
|
|
|
|
if (!result || GetWindowTextW(item, result, len) == 0) return NULL;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-06-02 17:11:32 +02:00
|
|
|
static inline void set_text(HWND dialog, WORD id, const char *text)
|
2004-11-23 14:50:23 +01:00
|
|
|
{
|
|
|
|
SetWindowText(GetDlgItem(dialog, id), text);
|
|
|
|
}
|
|
|
|
|
2008-01-03 14:29:24 +01:00
|
|
|
static inline void set_textW(HWND dialog, WORD id, const WCHAR *text)
|
|
|
|
{
|
|
|
|
SetWindowTextW(GetDlgItem(dialog, id), text);
|
|
|
|
}
|
|
|
|
|
2005-06-16 18:15:37 +02:00
|
|
|
#define WINE_KEY_ROOT "Software\\Wine"
|
2007-07-31 00:16:51 +02:00
|
|
|
#define MAXBUFLEN 256
|
2003-08-30 02:27:08 +02:00
|
|
|
|
2005-12-17 12:30:06 +01:00
|
|
|
extern HMENU hPopupMenus;
|
|
|
|
|
2003-03-31 21:41:55 +02:00
|
|
|
#endif
|