source: branches/branch-1-0/include/helpers/prfh.h@ 231

Last change on this file since 231 was 229, checked in by umoeller, 23 years ago

Sources as of 1.0.0.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 10.7 KB
Line 
1
2/*
3 *@@sourcefile prfh.h:
4 * header file for prfh.c. See remarks there.
5 *
6 * This file is new with V0.82.
7 *
8 * Note: Version numbering in this file relates to XWorkplace version
9 * numbering.
10 *
11 *@@include #define INCL_WINWINDOWMGR
12 *@@include #define INCL_WINSHELLDATA
13 *@@include #include <os2.h>
14 *@@include #include <stdio.h>
15 *@@include #include "helpers\prfh.h"
16 */
17
18/* Copyright (C) 1997-2000 Ulrich M”ller.
19 * This file is part of the "XWorkplace helpers" source package.
20 * This is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published
22 * by the Free Software Foundation, in version 2 as it comes in the
23 * "COPYING" file of the XWorkplace main distribution.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 */
29
30#if __cplusplus
31extern "C" {
32#endif
33
34#ifndef PRFH_HEADER_INCLUDED
35 #define PRFH_HEADER_INCLUDED
36
37 /* ******************************************************************
38 *
39 * Errors
40 *
41 ********************************************************************/
42
43 #define ERROR_PRF_FIRST 42000
44
45 #define PRFERR_DATASIZE (ERROR_PRF_FIRST + 1)
46 // couldn't query data size for key
47 #define PRFERR_READ (ERROR_PRF_FIRST + 2)
48 // couldn't read data from source (PrfQueryProfileData error)
49 #define PRFERR_WRITE (ERROR_PRF_FIRST + 3)
50 // couldn't write data to target (PrfWriteProfileData error)
51 #define PRFERR_APPSLIST (ERROR_PRF_FIRST + 4)
52 // couldn't query apps list
53 #define PRFERR_KEYSLIST (ERROR_PRF_FIRST + 5)
54 // couldn't query keys list
55 #define PRFERR_ABORTED (ERROR_PRF_FIRST + 6)
56 // aborted by user
57 #define PRFERR_QUERY (ERROR_PRF_FIRST + 7)
58 // PrfQueryProfile failed
59 #define PRFERR_INVALID_FILE_NAME (ERROR_PRF_FIRST + 8)
60 // profile names don't contain .INI
61 #define PRFERR_INVALID_KEY (ERROR_PRF_FIRST + 9)
62 #define PRFERR_KEY_EXISTS (ERROR_PRF_FIRST + 10)
63
64 #define PRFERR_RESET (ERROR_PRF_FIRST + 11)
65 // PrfReset failed V0.9.19 (2002-04-02) [umoeller]
66
67 #define PRFERR_INVALID_APP_NAME (ERROR_PRF_FIRST + 12)
68 // V1.0.0 (2002-09-17) [umoeller]
69 #define PRFERR_INVALID_KEY_NAME (ERROR_PRF_FIRST + 13)
70 // V1.0.0 (2002-09-17) [umoeller]
71
72 #define ERROR_PRF_LAST (ERROR_PRF_FIRST + 13)
73
74 /* ******************************************************************
75 *
76 * Strings
77 *
78 ********************************************************************/
79
80 // DECLARE_PRFH_STRING is a handy macro which saves us from
81 // keeping two string lists in both the .h and the .c file.
82 // If this include file is included from the .c file, the
83 // string is defined as a global variable. Otherwise
84 // it is only declared as "extern" so other files can
85 // see it.
86
87 #ifdef INCLUDE_PRFH_PRIVATE
88 #define DECLARE_PRFH_STRING(str, def) const char *str = def
89 #else
90 #define DECLARE_PRFH_STRING(str, def) extern const char *str;
91 #endif
92
93 /*
94 * OS2.INI applications
95 *
96 */
97
98 // NLS settings section
99 DECLARE_PRFH_STRING(PMINIAPP_NATIONAL, "PM_National");
100
101 // system font settings section
102 DECLARE_PRFH_STRING(PMINIAPP_SYSTEMFONTS, "PM_SystemFonts");
103 DECLARE_PRFH_STRING(PMINIKEY_DEFAULTFONT, "DefaultFont");
104 DECLARE_PRFH_STRING(PMINIKEY_ICONTEXTFONT, "IconText");
105 DECLARE_PRFH_STRING(PMINIKEY_MENUSFONT, "Menus");
106
107 // installed fonts section
108 DECLARE_PRFH_STRING(PMINIAPP_FONTS, "PM_Fonts");
109
110 // general WPS settings
111 DECLARE_PRFH_STRING(WPINIAPP_WORKPLACE, "PM_Workplace");
112 DECLARE_PRFH_STRING(WPINIKEY_MENUBAR, "FolderMenuBar");
113
114 DECLARE_PRFH_STRING(WPINIKEY_SHORTMENUS, "FolderMenus");
115 // V0.9.19 (2002-04-17) [umoeller]
116
117 // class replacements list V1.0.0 (2002-08-26) [umoeller]
118 DECLARE_PRFH_STRING(WPINIAPP_REPLACEMENTS, "PM_Workplace:ReplaceList");
119
120 // abstract objects per folder handle
121 DECLARE_PRFH_STRING(WPINIAPP_FDRCONTENT, "PM_Abstract:FldrContent");
122 // all defined abstract objects on the system
123 DECLARE_PRFH_STRING(WPINIAPP_OBJECTS, "PM_Abstract:Objects");
124 // their icons, if set individually
125 DECLARE_PRFH_STRING(WPINIAPP_ICONS, "PM_Abstract:Icons");
126
127 // object ID's (<WP_DESKTOP> etc.)
128 DECLARE_PRFH_STRING(WPINIAPP_LOCATION, "PM_Workplace:Location");
129
130 // folder positions
131 DECLARE_PRFH_STRING(WPINIAPP_FOLDERPOS, "PM_Workplace:FolderPos");
132
133 // palette positions
134 DECLARE_PRFH_STRING(WPINIAPP_PALETTEPOS, "PM_Workplace:PalettePos");
135 // ???
136 DECLARE_PRFH_STRING(WPINIAPP_STATUSPOS, "PM_Workplace:StatusPos");
137 // startup folders
138 DECLARE_PRFH_STRING(WPINIAPP_STARTUP, "PM_Workplace:Startup");
139 // all the defined templates on the system
140 DECLARE_PRFH_STRING(WPINIAPP_TEMPLATES, "PM_Workplace:Templates");
141
142 // all work area folders
143 DECLARE_PRFH_STRING(WPINIAPP_WORKAREARUNNING, "FolderWorkareaRunningObjects");
144 // spooler windows ?!?
145 DECLARE_PRFH_STRING(WPINIAPP_JOBCNRPOS, "PM_PrintObject:JobCnrPos");
146
147 // associations by type ("Plain Text")
148 DECLARE_PRFH_STRING(WPINIAPP_ASSOCTYPE, "PMWP_ASSOC_TYPE");
149 // associations by filter ("*.txt")
150 DECLARE_PRFH_STRING(WPINIAPP_ASSOCFILTER, "PMWP_ASSOC_FILTER");
151 // checksums ?!?
152 DECLARE_PRFH_STRING(WPINIAPP_ASSOC_CHECKSUM, "PMWP_ASSOC_CHECKSUM");
153
154 /*
155 * OS2SYS.INI applications
156 *
157 */
158
159 DECLARE_PRFH_STRING(WPINIAPP_ACTIVEHANDLES, "PM_Workplace:ActiveHandles");
160 DECLARE_PRFH_STRING(WPINIAPP_HANDLES, "PM_Workplace:Handles");
161 DECLARE_PRFH_STRING(WPINIAPP_HANDLESAPP, "HandlesAppName");
162
163 /*
164 * some default WPS INI keys:
165 *
166 */
167
168 DECLARE_PRFH_STRING(WPOBJID_DESKTOP, "<WP_DESKTOP>");
169
170 DECLARE_PRFH_STRING(WPOBJID_KEYB, "<WP_KEYB>");
171 DECLARE_PRFH_STRING(WPOBJID_MOUSE, "<WP_MOUSE>");
172 DECLARE_PRFH_STRING(WPOBJID_CNTRY, "<WP_CNTRY>");
173 DECLARE_PRFH_STRING(WPOBJID_SOUND, "<WP_SOUND>");
174 DECLARE_PRFH_STRING(WPOBJID_SYSTEM, "<WP_SYSTEM>"); // V0.9.9
175 DECLARE_PRFH_STRING(WPOBJID_POWER, "<WP_POWER>");
176 DECLARE_PRFH_STRING(WPOBJID_WINCFG, "<WP_WINCFG>");
177
178 DECLARE_PRFH_STRING(WPOBJID_HIRESCLRPAL, "<WP_HIRESCLRPAL>");
179 DECLARE_PRFH_STRING(WPOBJID_LORESCLRPAL, "<WP_LORESCLRPAL>");
180 DECLARE_PRFH_STRING(WPOBJID_FNTPAL, "<WP_FNTPAL>");
181 DECLARE_PRFH_STRING(WPOBJID_SCHPAL96, "<WP_SCHPAL96>");
182
183 DECLARE_PRFH_STRING(WPOBJID_LAUNCHPAD, "<WP_LAUNCHPAD>");
184 DECLARE_PRFH_STRING(WPOBJID_WARPCENTER, "<WP_WARPCENTER>");
185
186 DECLARE_PRFH_STRING(WPOBJID_SPOOL, "<WP_SPOOL>");
187 DECLARE_PRFH_STRING(WPOBJID_VIEWER, "<WP_VIEWER>");
188 DECLARE_PRFH_STRING(WPOBJID_SHRED, "<WP_SHRED>");
189 DECLARE_PRFH_STRING(WPOBJID_CLOCK, "<WP_CLOCK>");
190
191 DECLARE_PRFH_STRING(WPOBJID_START, "<WP_START>");
192 DECLARE_PRFH_STRING(WPOBJID_TEMPS, "<WP_TEMPS>");
193 DECLARE_PRFH_STRING(WPOBJID_DRIVES, "<WP_DRIVES>");
194
195 /* ******************************************************************
196 *
197 * Functions
198 *
199 ********************************************************************/
200
201 APIRET prfhQueryKeysForApp(HINI hIni,
202 const char *pcszApp,
203 PSZ *ppszKeys);
204
205 #ifdef __DEBUG_MALLOC_ENABLED__ // setup.h, helpers\memdebug.c
206 PSZ prfhQueryProfileDataDebug(HINI hIni,
207 const char *pcszApp,
208 const char *pcszKey,
209 PULONG pcbBuf,
210 const char *file,
211 unsigned long line,
212 const char *function);
213 #define prfhQueryProfileData(a, b, c, d) prfhQueryProfileDataDebug((a), (b), (c), (d), __FILE__, __LINE__, __FUNCTION__)
214 #else
215 PSZ prfhQueryProfileData(HINI hIni,
216 const char *pcszApp,
217 const char *pcszKey,
218 PULONG pcbBuf);
219 #endif
220
221 CHAR prfhQueryProfileChar(HINI hini,
222 const char *pcszApp,
223 const char *pcszKey,
224 CHAR cDefault);
225
226 LONG prfhQueryColor(const char *pcszKeyName, const char *pcszDefault);
227
228 APIRET prfhCopyKey(HINI hiniSource,
229 const char *pcszSourceApp,
230 const char *pcszKey,
231 HINI hiniTarget,
232 const char *pcszTargetApp);
233
234 APIRET prfhCopyApp(HINI hiniSource,
235 const char *pcszSourceApp,
236 HINI hiniTarget,
237 const char *pcszTargetApp,
238 PSZ pszErrorKey);
239
240 ULONG prfhRenameKey(HINI hini,
241 const char *pcszOldApp,
242 const char *pcszOldKey,
243 const char *pcszNewApp,
244 const char *pcszNewKey);
245
246 APIRET prfhSetUserProfile(HAB hab,
247 const char *pcszUserProfile);
248
249 ULONG prfhINIError(ULONG ulOptions,
250 FILE* fLog,
251 PFNWP fncbError,
252 PSZ pszErrorString);
253
254 ULONG prfhINIError2(ULONG ulOptions,
255 const char *pcszINI,
256 FILE* fLog,
257 PFNWP fncbError,
258 PSZ pszErrorString);
259
260 BOOL prfhCopyProfile(HAB hab,
261 FILE* fLog,
262 HINI hOld,
263 PSZ pszOld,
264 PSZ pszNew,
265 PFNWP fncbUpdate,
266 HWND hwnd, ULONG msg, ULONG ulCount, ULONG ulMax,
267 PFNWP fncbError);
268
269 APIRET prfhSaveINIs(HAB hab,
270 FILE* fLog,
271 PFNWP fncbUpdate,
272 HWND hwnd, ULONG msg,
273 PFNWP fncbError);
274
275#endif
276
277#if __cplusplus
278}
279#endif
280
Note: See TracBrowser for help on using the repository browser.