source: trunk/include/helpers/prfh.h@ 195

Last change on this file since 195 was 157, checked in by umoeller, 23 years ago

Misc fixes.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 10.3 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 ERROR_PRF_LAST (ERROR_PRF_FIRST + 11)
68
69 /* ******************************************************************
70 *
71 * Strings
72 *
73 ********************************************************************/
74
75 // DECLARE_PRFH_STRING is a handy macro which saves us from
76 // keeping two string lists in both the .h and the .c file.
77 // If this include file is included from the .c file, the
78 // string is defined as a global variable. Otherwise
79 // it is only declared as "extern" so other files can
80 // see it.
81
82 #ifdef INCLUDE_PRFH_PRIVATE
83 #define DECLARE_PRFH_STRING(str, def) const char *str = def
84 #else
85 #define DECLARE_PRFH_STRING(str, def) extern const char *str;
86 #endif
87
88 /*
89 * OS2.INI applications
90 *
91 */
92
93 // NLS settings section
94 DECLARE_PRFH_STRING(PMINIAPP_NATIONAL, "PM_National");
95
96 // system font settings section
97 DECLARE_PRFH_STRING(PMINIAPP_SYSTEMFONTS, "PM_SystemFonts");
98 DECLARE_PRFH_STRING(PMINIKEY_DEFAULTFONT, "DefaultFont");
99 DECLARE_PRFH_STRING(PMINIKEY_ICONTEXTFONT, "IconText");
100 DECLARE_PRFH_STRING(PMINIKEY_MENUSFONT, "Menus");
101
102 // installed fonts secsion
103 DECLARE_PRFH_STRING(PMINIAPP_FONTS, "PM_Fonts");
104
105 // general WPS settings
106 DECLARE_PRFH_STRING(WPINIAPP_WORKPLACE, "PM_Workplace");
107 DECLARE_PRFH_STRING(WPINIKEY_MENUBAR, "FolderMenuBar");
108
109 DECLARE_PRFH_STRING(WPINIKEY_SHORTMENUS, "FolderMenus");
110 // V0.9.19 (2002-04-17) [umoeller]
111
112 // abstract objects per folder handle
113 DECLARE_PRFH_STRING(WPINIAPP_FDRCONTENT, "PM_Abstract:FldrContent");
114 // all defined abstract objects on the system
115 DECLARE_PRFH_STRING(WPINIAPP_OBJECTS, "PM_Abstract:Objects");
116 // their icons, if set individually
117 DECLARE_PRFH_STRING(WPINIAPP_ICONS, "PM_Abstract:Icons");
118
119 // object ID's (<WP_DESKTOP> etc.)
120 DECLARE_PRFH_STRING(WPINIAPP_LOCATION, "PM_Workplace:Location");
121
122 // folder positions
123 DECLARE_PRFH_STRING(WPINIAPP_FOLDERPOS, "PM_Workplace:FolderPos");
124
125 // palette positions
126 DECLARE_PRFH_STRING(WPINIAPP_PALETTEPOS, "PM_Workplace:PalettePos");
127 // ???
128 DECLARE_PRFH_STRING(WPINIAPP_STATUSPOS, "PM_Workplace:StatusPos");
129 // startup folders
130 DECLARE_PRFH_STRING(WPINIAPP_STARTUP, "PM_Workplace:Startup");
131 // all the defined templates on the system
132 DECLARE_PRFH_STRING(WPINIAPP_TEMPLATES, "PM_Workplace:Templates");
133
134 // all work area folders
135 DECLARE_PRFH_STRING(WPINIAPP_WORKAREARUNNING, "FolderWorkareaRunningObjects");
136 // spooler windows ?!?
137 DECLARE_PRFH_STRING(WPINIAPP_JOBCNRPOS, "PM_PrintObject:JobCnrPos");
138
139 // associations by type ("Plain Text")
140 DECLARE_PRFH_STRING(WPINIAPP_ASSOCTYPE, "PMWP_ASSOC_TYPE");
141 // associations by filter ("*.txt")
142 DECLARE_PRFH_STRING(WPINIAPP_ASSOCFILTER, "PMWP_ASSOC_FILTER");
143 // checksums ?!?
144 DECLARE_PRFH_STRING(WPINIAPP_ASSOC_CHECKSUM, "PMWP_ASSOC_CHECKSUM");
145
146 /*
147 * OS2SYS.INI applications
148 *
149 */
150
151 DECLARE_PRFH_STRING(WPINIAPP_ACTIVEHANDLES, "PM_Workplace:ActiveHandles");
152 DECLARE_PRFH_STRING(WPINIAPP_HANDLES, "PM_Workplace:Handles");
153 DECLARE_PRFH_STRING(WPINIAPP_HANDLESAPP, "HandlesAppName");
154
155 /*
156 * some default WPS INI keys:
157 *
158 */
159
160 DECLARE_PRFH_STRING(WPOBJID_DESKTOP, "<WP_DESKTOP>");
161
162 DECLARE_PRFH_STRING(WPOBJID_KEYB, "<WP_KEYB>");
163 DECLARE_PRFH_STRING(WPOBJID_MOUSE, "<WP_MOUSE>");
164 DECLARE_PRFH_STRING(WPOBJID_CNTRY, "<WP_CNTRY>");
165 DECLARE_PRFH_STRING(WPOBJID_SOUND, "<WP_SOUND>");
166 DECLARE_PRFH_STRING(WPOBJID_SYSTEM, "<WP_SYSTEM>"); // V0.9.9
167 DECLARE_PRFH_STRING(WPOBJID_POWER, "<WP_POWER>");
168 DECLARE_PRFH_STRING(WPOBJID_WINCFG, "<WP_WINCFG>");
169
170 DECLARE_PRFH_STRING(WPOBJID_HIRESCLRPAL, "<WP_HIRESCLRPAL>");
171 DECLARE_PRFH_STRING(WPOBJID_LORESCLRPAL, "<WP_LORESCLRPAL>");
172 DECLARE_PRFH_STRING(WPOBJID_FNTPAL, "<WP_FNTPAL>");
173 DECLARE_PRFH_STRING(WPOBJID_SCHPAL96, "<WP_SCHPAL96>");
174
175 DECLARE_PRFH_STRING(WPOBJID_LAUNCHPAD, "<WP_LAUNCHPAD>");
176 DECLARE_PRFH_STRING(WPOBJID_WARPCENTER, "<WP_WARPCENTER>");
177
178 DECLARE_PRFH_STRING(WPOBJID_SPOOL, "<WP_SPOOL>");
179 DECLARE_PRFH_STRING(WPOBJID_VIEWER, "<WP_VIEWER>");
180 DECLARE_PRFH_STRING(WPOBJID_SHRED, "<WP_SHRED>");
181 DECLARE_PRFH_STRING(WPOBJID_CLOCK, "<WP_CLOCK>");
182
183 DECLARE_PRFH_STRING(WPOBJID_START, "<WP_START>");
184 DECLARE_PRFH_STRING(WPOBJID_TEMPS, "<WP_TEMPS>");
185 DECLARE_PRFH_STRING(WPOBJID_DRIVES, "<WP_DRIVES>");
186
187 /* ******************************************************************
188 *
189 * Functions
190 *
191 ********************************************************************/
192
193 APIRET prfhQueryKeysForApp(HINI hIni,
194 const char *pcszApp,
195 PSZ *ppszKeys);
196
197 #ifdef __DEBUG_MALLOC_ENABLED__ // setup.h, helpers\memdebug.c
198 PSZ prfhQueryProfileDataDebug(HINI hIni,
199 const char *pcszApp,
200 const char *pcszKey,
201 PULONG pcbBuf,
202 const char *file,
203 unsigned long line,
204 const char *function);
205 #define prfhQueryProfileData(a, b, c, d) prfhQueryProfileDataDebug((a), (b), (c), (d), __FILE__, __LINE__, __FUNCTION__)
206 #else
207 PSZ prfhQueryProfileData(HINI hIni,
208 const char *pcszApp,
209 const char *pcszKey,
210 PULONG pcbBuf);
211 #endif
212
213 CHAR prfhQueryProfileChar(HINI hini,
214 const char *pcszApp,
215 const char *pcszKey,
216 CHAR cDefault);
217
218 LONG prfhQueryColor(const char *pcszKeyName, const char *pcszDefault);
219
220 APIRET prfhCopyKey(HINI hiniSource,
221 const char *pcszSourceApp,
222 const char *pcszKey,
223 HINI hiniTarget,
224 const char *pcszTargetApp);
225
226 APIRET prfhCopyApp(HINI hiniSource,
227 const char *pcszSourceApp,
228 HINI hiniTarget,
229 const char *pcszTargetApp,
230 PSZ pszErrorKey);
231
232 ULONG prfhRenameKey(HINI hini,
233 const char *pcszOldApp,
234 const char *pcszOldKey,
235 const char *pcszNewApp,
236 const char *pcszNewKey);
237
238 APIRET prfhSetUserProfile(HAB hab,
239 const char *pcszUserProfile);
240
241 ULONG prfhINIError(ULONG ulOptions,
242 FILE* fLog,
243 PFNWP fncbError,
244 PSZ pszErrorString);
245
246 ULONG prfhINIError2(ULONG ulOptions,
247 const char *pcszINI,
248 FILE* fLog,
249 PFNWP fncbError,
250 PSZ pszErrorString);
251
252 BOOL prfhCopyProfile(HAB hab,
253 FILE* fLog,
254 HINI hOld,
255 PSZ pszOld,
256 PSZ pszNew,
257 PFNWP fncbUpdate,
258 HWND hwnd, ULONG msg, ULONG ulCount, ULONG ulMax,
259 PFNWP fncbError);
260
261 APIRET prfhSaveINIs(HAB hab,
262 FILE* fLog,
263 PFNWP fncbUpdate,
264 HWND hwnd, ULONG msg,
265 PFNWP fncbError);
266
267#endif
268
269#if __cplusplus
270}
271#endif
272
Note: See TracBrowser for help on using the repository browser.