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

Last change on this file since 156 was 153, checked in by umoeller, 23 years ago

Lots of changes from the last three weeks.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 10.2 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 // abstract objects per folder handle
110 DECLARE_PRFH_STRING(WPINIAPP_FDRCONTENT, "PM_Abstract:FldrContent");
111 // all defined abstract objects on the system
112 DECLARE_PRFH_STRING(WPINIAPP_OBJECTS, "PM_Abstract:Objects");
113 // their icons, if set individually
114 DECLARE_PRFH_STRING(WPINIAPP_ICONS, "PM_Abstract:Icons");
115
116 // object ID's (<WP_DESKTOP> etc.)
117 DECLARE_PRFH_STRING(WPINIAPP_LOCATION, "PM_Workplace:Location");
118
119 // folder positions
120 DECLARE_PRFH_STRING(WPINIAPP_FOLDERPOS, "PM_Workplace:FolderPos");
121
122 // palette positions
123 DECLARE_PRFH_STRING(WPINIAPP_PALETTEPOS, "PM_Workplace:PalettePos");
124 // ???
125 DECLARE_PRFH_STRING(WPINIAPP_STATUSPOS, "PM_Workplace:StatusPos");
126 // startup folders
127 DECLARE_PRFH_STRING(WPINIAPP_STARTUP, "PM_Workplace:Startup");
128 // all the defined templates on the system
129 DECLARE_PRFH_STRING(WPINIAPP_TEMPLATES, "PM_Workplace:Templates");
130
131 // all work area folders
132 DECLARE_PRFH_STRING(WPINIAPP_WORKAREARUNNING, "FolderWorkareaRunningObjects");
133 // spooler windows ?!?
134 DECLARE_PRFH_STRING(WPINIAPP_JOBCNRPOS, "PM_PrintObject:JobCnrPos");
135
136 // associations by type ("Plain Text")
137 DECLARE_PRFH_STRING(WPINIAPP_ASSOCTYPE, "PMWP_ASSOC_TYPE");
138 // associations by filter ("*.txt")
139 DECLARE_PRFH_STRING(WPINIAPP_ASSOCFILTER, "PMWP_ASSOC_FILTER");
140 // checksums ?!?
141 DECLARE_PRFH_STRING(WPINIAPP_ASSOC_CHECKSUM, "PMWP_ASSOC_CHECKSUM");
142
143 /*
144 * OS2SYS.INI applications
145 *
146 */
147
148 DECLARE_PRFH_STRING(WPINIAPP_ACTIVEHANDLES, "PM_Workplace:ActiveHandles");
149 DECLARE_PRFH_STRING(WPINIAPP_HANDLES, "PM_Workplace:Handles");
150 DECLARE_PRFH_STRING(WPINIAPP_HANDLESAPP, "HandlesAppName");
151
152 /*
153 * some default WPS INI keys:
154 *
155 */
156
157 DECLARE_PRFH_STRING(WPOBJID_DESKTOP, "<WP_DESKTOP>");
158
159 DECLARE_PRFH_STRING(WPOBJID_KEYB, "<WP_KEYB>");
160 DECLARE_PRFH_STRING(WPOBJID_MOUSE, "<WP_MOUSE>");
161 DECLARE_PRFH_STRING(WPOBJID_CNTRY, "<WP_CNTRY>");
162 DECLARE_PRFH_STRING(WPOBJID_SOUND, "<WP_SOUND>");
163 DECLARE_PRFH_STRING(WPOBJID_SYSTEM, "<WP_SYSTEM>"); // V0.9.9
164 DECLARE_PRFH_STRING(WPOBJID_POWER, "<WP_POWER>");
165 DECLARE_PRFH_STRING(WPOBJID_WINCFG, "<WP_WINCFG>");
166
167 DECLARE_PRFH_STRING(WPOBJID_HIRESCLRPAL, "<WP_HIRESCLRPAL>");
168 DECLARE_PRFH_STRING(WPOBJID_LORESCLRPAL, "<WP_LORESCLRPAL>");
169 DECLARE_PRFH_STRING(WPOBJID_FNTPAL, "<WP_FNTPAL>");
170 DECLARE_PRFH_STRING(WPOBJID_SCHPAL96, "<WP_SCHPAL96>");
171
172 DECLARE_PRFH_STRING(WPOBJID_LAUNCHPAD, "<WP_LAUNCHPAD>");
173 DECLARE_PRFH_STRING(WPOBJID_WARPCENTER, "<WP_WARPCENTER>");
174
175 DECLARE_PRFH_STRING(WPOBJID_SPOOL, "<WP_SPOOL>");
176 DECLARE_PRFH_STRING(WPOBJID_VIEWER, "<WP_VIEWER>");
177 DECLARE_PRFH_STRING(WPOBJID_SHRED, "<WP_SHRED>");
178 DECLARE_PRFH_STRING(WPOBJID_CLOCK, "<WP_CLOCK>");
179
180 DECLARE_PRFH_STRING(WPOBJID_START, "<WP_START>");
181 DECLARE_PRFH_STRING(WPOBJID_TEMPS, "<WP_TEMPS>");
182 DECLARE_PRFH_STRING(WPOBJID_DRIVES, "<WP_DRIVES>");
183
184 /* ******************************************************************
185 *
186 * Functions
187 *
188 ********************************************************************/
189
190 APIRET prfhQueryKeysForApp(HINI hIni,
191 const char *pcszApp,
192 PSZ *ppszKeys);
193
194 #ifdef __DEBUG_MALLOC_ENABLED__ // setup.h, helpers\memdebug.c
195 PSZ prfhQueryProfileDataDebug(HINI hIni,
196 const char *pcszApp,
197 const char *pcszKey,
198 PULONG pcbBuf,
199 const char *file,
200 unsigned long line,
201 const char *function);
202 #define prfhQueryProfileData(a, b, c, d) prfhQueryProfileDataDebug((a), (b), (c), (d), __FILE__, __LINE__, __FUNCTION__)
203 #else
204 PSZ prfhQueryProfileData(HINI hIni,
205 const char *pcszApp,
206 const char *pcszKey,
207 PULONG pcbBuf);
208 #endif
209
210 CHAR prfhQueryProfileChar(HINI hini,
211 const char *pcszApp,
212 const char *pcszKey,
213 CHAR cDefault);
214
215 LONG prfhQueryColor(const char *pcszKeyName, const char *pcszDefault);
216
217 APIRET prfhCopyKey(HINI hiniSource,
218 const char *pcszSourceApp,
219 const char *pcszKey,
220 HINI hiniTarget,
221 const char *pcszTargetApp);
222
223 APIRET prfhCopyApp(HINI hiniSource,
224 const char *pcszSourceApp,
225 HINI hiniTarget,
226 const char *pcszTargetApp,
227 PSZ pszErrorKey);
228
229 ULONG prfhRenameKey(HINI hini,
230 const char *pcszOldApp,
231 const char *pcszOldKey,
232 const char *pcszNewApp,
233 const char *pcszNewKey);
234
235 APIRET prfhSetUserProfile(HAB hab,
236 const char *pcszUserProfile);
237
238 ULONG prfhINIError(ULONG ulOptions,
239 FILE* fLog,
240 PFNWP fncbError,
241 PSZ pszErrorString);
242
243 ULONG prfhINIError2(ULONG ulOptions,
244 const char *pcszINI,
245 FILE* fLog,
246 PFNWP fncbError,
247 PSZ pszErrorString);
248
249 BOOL prfhCopyProfile(HAB hab,
250 FILE* fLog,
251 HINI hOld,
252 PSZ pszOld,
253 PSZ pszNew,
254 PFNWP fncbUpdate,
255 HWND hwnd, ULONG msg, ULONG ulCount, ULONG ulMax,
256 PFNWP fncbError);
257
258 APIRET prfhSaveINIs(HAB hab,
259 FILE* fLog,
260 PFNWP fncbUpdate,
261 HWND hwnd, ULONG msg,
262 PFNWP fncbError);
263
264#endif
265
266#if __cplusplus
267}
268#endif
269
Note: See TracBrowser for help on using the repository browser.