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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
37 #define IS_OPTION_TRUE(ch) \
38 ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
39 #define IS_OPTION_FALSE(ch) \
40 ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
42 extern WCHAR
* current_app
; /* NULL means editing global settings */
44 /* Use get_reg_key and set_reg_key to alter registry settings. The changes made through
45 set_reg_key won't be committed to the registry until process_all_settings is called,
46 however get_reg_key will still return accurate information.
48 The root HKEY has to be non-ambiguous. So only the registry roots (HKCU, HKLM, ...) or
49 the global config_key are allowed here.
51 You are expected to free the result of get_reg_key. The parameters to set_reg_key will
52 be copied, so free them too when necessary.
55 void set_reg_key(HKEY root
, const WCHAR
*path
, const WCHAR
*name
, const WCHAR
*value
);
56 void set_reg_key_dword(HKEY root
, const WCHAR
*path
, const WCHAR
*name
, DWORD value
);
57 WCHAR
*get_reg_key(HKEY root
, const WCHAR
*path
, const WCHAR
*name
, const WCHAR
*def
)
58 __WINE_DEALLOC(free
) __WINE_MALLOC
;
60 BOOL
reg_key_exists(HKEY root
, const WCHAR
*path
, const WCHAR
*name
);
62 WCHAR
**enumerate_values(HKEY root
, const WCHAR
*path
) __WINE_DEALLOC(free
) __WINE_MALLOC
;
64 /* Load a string from the resources. Allocated with malloc */
65 WCHAR
* load_string(UINT id
) __WINE_DEALLOC(free
) __WINE_MALLOC
;
67 /* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
68 the user is editing the global settings.
70 no explicit free is needed of the string returned by this function
72 WCHAR
*keypath(const WCHAR
*section
);
74 BOOL
initialize(HINSTANCE hInstance
);
75 extern HKEY config_key
;
77 /* hack for the property sheet control */
78 void set_window_title(HWND dialog
);
80 /* Window procedures */
81 INT_PTR CALLBACK
GraphDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
82 INT_PTR CALLBACK
DriveDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
83 INT_PTR CALLBACK
DriveEditDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
84 INT_PTR CALLBACK
AppDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
85 INT_PTR CALLBACK
LibrariesDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
86 INT_PTR CALLBACK
AudioDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
87 INT_PTR CALLBACK
ThemeDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
88 INT_PTR CALLBACK
AboutDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
90 /* Windows version management */
91 BOOL
set_winver_from_string(const WCHAR
*version
);
92 void print_current_winver(void);
93 void print_windows_versions(void);
95 /* Drive management */
96 BOOL
load_drives(void);
105 DWORD type
; /* one of the DRIVE_ constants from winbase.h */
111 #define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A'))
113 ULONG
drive_available_mask(char letter
);
114 BOOL
add_drive(char letter
, const char *targetpath
, const char *device
,
115 const WCHAR
*label
, DWORD serial
, DWORD type
);
116 void delete_drive(struct drive
*pDrive
);
117 void apply_drive_changes(void);
118 void query_shell_folder( const WCHAR
*path
, char *dest
, unsigned int len
);
119 void set_shell_folder( const WCHAR
*path
, const char *dest
);
120 BOOL
browse_for_unix_folder(HWND dialog
, WCHAR
*pszPath
);
121 extern struct drive drives
[26]; /* one for each drive letter */
123 /* Some basic utilities to make win32 suck less */
124 #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
125 #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
126 void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
128 /* create a unicode string from a string in Unix locale */
129 static inline WCHAR
*strdupU2W(const char *unix_str
)
134 lenW
= MultiByteToWideChar(CP_UNIXCP
, 0, unix_str
, -1, NULL
, 0);
135 unicode_str
= malloc(lenW
* sizeof(WCHAR
));
137 MultiByteToWideChar(CP_UNIXCP
, 0, unix_str
, -1, unicode_str
, lenW
);
141 static inline WCHAR
*get_text(HWND dialog
, WORD id
)
143 HWND item
= GetDlgItem(dialog
, id
);
144 int len
= GetWindowTextLengthW(item
) + 1;
145 WCHAR
*result
= len
? malloc(len
* sizeof(WCHAR
)) : NULL
;
146 if (!result
) return NULL
;
147 if(GetWindowTextW(item
, result
, len
) == 0) {
154 static inline void set_text(HWND dialog
, WORD id
, const char *text
)
156 SetWindowTextA(GetDlgItem(dialog
, id
), text
);
159 static inline void set_textW(HWND dialog
, WORD id
, const WCHAR
*text
)
161 SetWindowTextW(GetDlgItem(dialog
, id
), text
);
164 #define WINE_KEY_ROOT L"Software\\Wine"
165 #define MAXBUFLEN 256
167 extern HMENU hPopupMenus
;