HeapReAlloc doesn't allocate memory.
[wine.git] / programs / winecfg / winecfg.h
blobf1844e9a394fb3d516a7f05a5e78d5772e48a77c
1 /*
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
23 #ifndef WINE_CFG_H
24 #define WINE_CFG_H
26 #include <stdarg.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "winnls.h"
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) \
41 if (!(try)) { \
42 WINE_ERR("check (" #try ") at %s:%d failed, returning\n", __FILE__, __LINE__ - 1); \
43 return; \
46 #define WRITEME(owner) MessageBox(owner, "Write me!", "", MB_OK | MB_ICONEXCLAMATION);
49 /* Transaction management */
50 enum transaction_action {
51 ACTION_SET,
52 ACTION_REMOVE
55 struct transaction {
56 char *section;
57 char *key;
58 char *newValue;
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
67 #define EDITING_APP 1
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 */
91 int initialize(void);
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);
99 /* X11DRV */
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);
113 /* some basic utilities to make win32 suck less */
114 char *getDialogItemText(HWND hDlg, WORD controlID);
115 #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
116 #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
119 #define WINE_KEY_ROOT "Software\\Wine\\Wine\\Config"
121 #endif