wined3d: Remove broken software shaders.
[wine] / programs / winecfg / winecfg.h
1 /*
2  * WineCfg configuration management
3  *
4  * Copyright 2002 Jaco Greeff
5  * Copyright 2003 Dimitrie O. Paun
6  * Copyright 2004 Mike Hearn
7  *
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.
12  *
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.
17  *
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
21  *
22  */
23
24 #ifndef WINE_CFG_H
25 #define WINE_CFG_H
26
27 #include <stdarg.h>
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33 #include "winnls.h"
34 #include "properties.h"
35
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')
40
41 extern WCHAR* current_app; /* NULL means editing global settings  */
42
43 /* Use get_reg_key and set_reg_key to alter registry settings. The changes made through
44    set_reg_key won't be committed to the registry until process_all_settings is called,
45    however get_reg_key will still return accurate information.
46
47    The root HKEY has to be non-ambiguous. So only the registry roots (HKCU, HKLM, ...) or
48    the global config_key are allowed here.
49    
50    You are expected to HeapFree the result of get_reg_key. The parameters to set_reg_key will
51    be copied, so free them too when necessary.
52  */
53
54 void set_reg_key(HKEY root, const char *path, const char *name, const char *value);
55 void set_reg_key_dword(HKEY root, const char *path, const char *name, DWORD value);
56 char *get_reg_key(HKEY root, const char *path, const char *name, const char *def);
57 BOOL reg_key_exists(HKEY root, const char *path, const char *name);
58 void apply(void);
59 char **enumerate_values(HKEY root, char *path);
60
61 /* Load a string from the resources. Allocated with HeapAlloc (GetProcessHeap()) */
62 WCHAR* load_string (UINT id);
63
64 /* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
65    the user is editing the global settings.
66  
67    no explicit free is needed of the string returned by this function
68  */
69 char *keypath(const char *section); 
70
71 int initialize(HINSTANCE hInstance);
72 extern HKEY config_key;
73
74 /* hack for the property sheet control  */
75 void set_window_title(HWND dialog);
76
77 /* Window procedures */
78 INT_PTR CALLBACK GraphDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
79 INT_PTR CALLBACK DriveDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
80 INT_PTR CALLBACK DriveEditDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
81 INT_PTR CALLBACK AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
82 INT_PTR CALLBACK LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
83 INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
84 INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
85
86 /* Drive management  */
87 void load_drives(void);
88 int autodetect_drives(void);
89
90 struct drive
91 {
92     char letter;
93     char *unixpath;
94     char *label;
95     char *serial;
96     DWORD type; /* one of the DRIVE_ constants from winbase.h  */
97
98     BOOL in_use;
99 };
100
101 #define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A'))
102
103 long drive_available_mask(char letter);
104 BOOL add_drive(const char letter, const char *targetpath, const char *label, const char *serial, unsigned int type);
105 void delete_drive(struct drive *pDrive);
106 void apply_drive_changes(void);
107 BOOL browse_for_unix_folder(HWND dialog, char *pszPath);
108 extern struct drive drives[26]; /* one for each drive letter */
109
110 BOOL gui_mode;
111
112 /* Some basic utilities to make win32 suck less */
113 #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
114 #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
115 void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
116
117 /* returns a string in the win32 heap  */
118 static inline char *strdupA(const char *s)
119 {
120     char *r = HeapAlloc(GetProcessHeap(), 0, strlen(s)+1);
121     return strcpy(r, s);
122 }
123
124 static inline WCHAR *strdupW(const WCHAR *s)
125 {
126     WCHAR *r = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(s)+1)*sizeof(WCHAR));
127     return lstrcpyW(r, s);
128 }
129
130 static inline char *get_text(HWND dialog, WORD id)
131 {
132     HWND item = GetDlgItem(dialog, id);
133     int len = GetWindowTextLength(item) + 1;
134     char *result = len ? HeapAlloc(GetProcessHeap(), 0, len) : NULL;
135     if (!result || GetWindowText(item, result, len) == 0) return NULL;
136     return result;
137 }
138
139 static inline void set_text(HWND dialog, WORD id, const char *text)
140 {
141     SetWindowText(GetDlgItem(dialog, id), text);
142 }
143
144 #define WINE_KEY_ROOT "Software\\Wine"
145
146 extern HMENU     hPopupMenus;
147
148 #endif