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
33 #include "properties.h"
35 #define IS_OPTION_TRUE(ch) \
36 ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
37 #define IS_OPTION_FALSE(ch) \
38 ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
40 #define return_if_fail(try) \
42 WINE_ERR("check (" #try ") at %s:%d failed, returning\n", __FILE__, __LINE__ - 1); \
46 #define WRITEME(owner) MessageBox(owner, "Write me!", "", MB_OK | MB_ICONEXCLAMATION);
49 /* Transaction management */
50 enum transaction_action
{
59 enum transaction_action action
;
60 struct transaction
*next
, *prev
;
62 extern struct transaction
*tqhead
, *tqtail
;
64 extern int instantApply
; /* non-zero means apply all changes instantly */
66 #define EDITING_GLOBAL 0
68 extern int appSettings
; /* non-zero means we are editing appdefault settings */
70 /* returns a string of the form AppDefaults\\appname.exe\\section */
71 /* no explicit free is needed of the string returned by this function */
72 char *getSectionForApp(char *section
);
74 /* Commits a transaction to the registry */
75 void processTransaction(struct transaction
*trans
);
77 /* Processes every pending transaction in the queue, removing them as it works from head to tail */
78 void processTransQueue();
80 /* Adds a transaction to the head of the queue. If we're using instant apply, this calls processTransaction
81 * action can be either:
82 * ACTION_SET -> this transaction will change a registry key, newValue is the replacement value
83 * ACTION_REMOVE -> this transaction will remove a registry key. In this case, newValue is ignored.
85 void addTransaction(const char *section
, const char *key
, enum transaction_action action
, const char *newValue
);
87 /* frees the transaction structure, all fields, and removes it from the queue if in it */
88 void destroyTransaction(struct transaction
*trans
);
90 /* Initializes the transaction system */
92 extern HKEY configKey
;
94 int setConfigValue (const char *subkey
, const char *valueName
, const char *value
);
95 char *getConfigValue (const char *subkey
, const char *valueName
, const char *defaultResult
);
96 HRESULT
doesConfigValueExist (const char *subkey
, const char *valueName
);
97 HRESULT
removeConfigValue (const char *subkey
, const char *valueName
);
101 void initX11DrvDlg (HWND hDlg
);
102 void saveX11DrvDlgSettings (HWND hDlg
);
103 INT_PTR CALLBACK
X11DrvDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
105 /* Drive management */
106 void initDriveDlg (HWND hDlg
);
107 void saveDriveSettings (HWND hDlg
);
109 INT_PTR CALLBACK
DriveDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
110 INT_PTR CALLBACK
DriveEditDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
111 INT_PTR CALLBACK
AppDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
112 INT_PTR CALLBACK
LibrariesDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
114 /* some basic utilities to make win32 suck less */
115 char *getDialogItemText(HWND hDlg
, WORD controlID
);
116 #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
117 #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
120 #define WINE_KEY_ROOT "Software\\Wine\\Wine\\Config"