2 * WineCfg configuration management
4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2004 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "properties.h"
36 #define IS_OPTION_TRUE(ch) \
37 ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
38 #define IS_OPTION_FALSE(ch) \
39 ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
41 extern char *current_app
; /* NULL means editing global settings */
43 /* Use get and set to alter registry settings. The changes made through set
44 won't be committed to the registry until process_all_settings is called,
45 however get will still return accurate information.
47 You are expected to release the result of get. The parameters to set will
48 be copied, so release them too when necessary.
51 void set(char *path
, char *name
, char *value
);
52 char *get(char *path
, char *name
, char *def
);
53 BOOL
exists(char *path
, char *name
);
55 char **enumerate_values(char *path
);
57 /* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
58 the user is editing the global settings.
60 no explicit free is needed of the string returned by this function
62 char *keypath(char *section
);
65 extern HKEY config_key
;
67 /* hack for the property sheet control */
68 void set_window_title(HWND dialog
);
70 /* Window procedures */
71 INT_PTR CALLBACK
GraphDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
72 INT_PTR CALLBACK
DriveDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
73 INT_PTR CALLBACK
DriveEditDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
74 INT_PTR CALLBACK
AppDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
75 INT_PTR CALLBACK
LibrariesDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
76 INT_PTR CALLBACK
AudioDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
78 /* Drive management */
80 int autodetect_drives();
88 DWORD type
; /* one of the DRIVE_ constants from winbase.h */
93 #define DRIVE_MASK_BIT(B) 1 << (toupper(B) - 'A')
95 long drive_available_mask(char letter
);
96 BOOL
add_drive(char letter
, char *targetpath
, char *label
, char *serial
, unsigned int type
);
97 void delete_drive(struct drive
*pDrive
);
98 void apply_drive_changes();
99 extern struct drive drives
[26]; /* one for each drive letter */
103 /* Some basic utilities to make win32 suck less */
104 #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
105 #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
106 void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
108 /* returns a string in the win32 heap */
109 static inline char *strdupA(char *s
)
111 char *r
= HeapAlloc(GetProcessHeap(), 0, strlen(s
)+1);
115 static inline char *get_text(HWND dialog
, WORD id
)
117 HWND item
= GetDlgItem(dialog
, id
);
118 int len
= GetWindowTextLength(item
) + 1;
119 char *result
= len
? HeapAlloc(GetProcessHeap(), 0, len
) : NULL
;
120 if (!result
|| GetWindowText(item
, result
, len
) == 0) return NULL
;
124 static inline void set_text(HWND dialog
, WORD id
, char *text
)
126 SetWindowText(GetDlgItem(dialog
, id
), text
);
129 #define WINE_KEY_ROOT "Software\\Wine\\Testing\\Config"