| 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 Mller.
|
|---|
| 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
|
|---|
| 31 | extern "C" {
|
|---|
| 32 | #endif
|
|---|
| 33 |
|
|---|
| 34 | #ifndef PRFH_HEADER_INCLUDED
|
|---|
| 35 | #define PRFH_HEADER_INCLUDED
|
|---|
| 36 |
|
|---|
| 37 | /* ******************************************************************
|
|---|
| 38 | *
|
|---|
| 39 | * Errors
|
|---|
| 40 | *
|
|---|
| 41 | ********************************************************************/
|
|---|
| 42 |
|
|---|
| 43 | #define PRFERR_DATASIZE 10001 // couldn't query data size for key
|
|---|
| 44 | #define PRFERR_READ 10003 // couldn't read data from source (PrfQueryProfileData error)
|
|---|
| 45 | #define PRFERR_WRITE 10004 // couldn't write data to target (PrfWriteProfileData error)
|
|---|
| 46 | #define PRFERR_APPSLIST 10005 // couldn't query apps list
|
|---|
| 47 | #define PRFERR_KEYSLIST 10006 // couldn't query keys list
|
|---|
| 48 | #define PRFERR_ABORTED 10007 // aborted by user
|
|---|
| 49 | #define PRFERR_QUERY 10007 // PrfQueryProfile failed
|
|---|
| 50 | #define PRFERR_INVALID_FILE_NAME 10008 // profile names don't contain .INI
|
|---|
| 51 | #define PRFERR_INVALID_KEY 10009
|
|---|
| 52 | #define PRFERR_KEY_EXISTS 10010
|
|---|
| 53 |
|
|---|
| 54 | /* ******************************************************************
|
|---|
| 55 | *
|
|---|
| 56 | * Strings
|
|---|
| 57 | *
|
|---|
| 58 | ********************************************************************/
|
|---|
| 59 |
|
|---|
| 60 | // DECLARE_PRFH_STRING is a handy macro which saves us from
|
|---|
| 61 | // keeping two string lists in both the .h and the .c file.
|
|---|
| 62 | // If this include file is included from the .c file, the
|
|---|
| 63 | // string is defined as a global variable. Otherwise
|
|---|
| 64 | // it is only declared as "extern" so other files can
|
|---|
| 65 | // see it.
|
|---|
| 66 |
|
|---|
| 67 | #ifdef INCLUDE_PRFH_PRIVATE
|
|---|
| 68 | #define DECLARE_PRFH_STRING(str, def) const char *str = def
|
|---|
| 69 | #else
|
|---|
| 70 | #define DECLARE_PRFH_STRING(str, def) extern const char *str;
|
|---|
| 71 | #endif
|
|---|
| 72 |
|
|---|
| 73 | /*
|
|---|
| 74 | * OS2.INI applications
|
|---|
| 75 | *
|
|---|
| 76 | */
|
|---|
| 77 |
|
|---|
| 78 | // NLS settings section
|
|---|
| 79 | DECLARE_PRFH_STRING(PMINIAPP_NATIONAL, "PM_National");
|
|---|
| 80 |
|
|---|
| 81 | // system font settings section
|
|---|
| 82 | DECLARE_PRFH_STRING(PMINIAPP_SYSTEMFONTS, "PM_SystemFonts");
|
|---|
| 83 | DECLARE_PRFH_STRING(PMINIKEY_DEFAULTFONT, "DefaultFont");
|
|---|
| 84 | DECLARE_PRFH_STRING(PMINIKEY_ICONTEXTFONT, "IconText");
|
|---|
| 85 | DECLARE_PRFH_STRING(PMINIKEY_MENUSFONT, "Menus");
|
|---|
| 86 |
|
|---|
| 87 | // installed fonts secsion
|
|---|
| 88 | DECLARE_PRFH_STRING(PMINIAPP_FONTS, "PM_Fonts");
|
|---|
| 89 |
|
|---|
| 90 | // general WPS settings
|
|---|
| 91 | DECLARE_PRFH_STRING(WPINIAPP_WORKPLACE, "PM_Workplace");
|
|---|
| 92 | DECLARE_PRFH_STRING(WPINIKEY_MENUBAR, "FolderMenuBar");
|
|---|
| 93 |
|
|---|
| 94 | // abstract objects per folder handle
|
|---|
| 95 | DECLARE_PRFH_STRING(WPINIAPP_FDRCONTENT, "PM_Abstract:FldrContent");
|
|---|
| 96 | // all defined abstract objects on the system
|
|---|
| 97 | DECLARE_PRFH_STRING(WPINIAPP_OBJECTS, "PM_Abstract:Objects");
|
|---|
| 98 | // their icons, if set individually
|
|---|
| 99 | DECLARE_PRFH_STRING(WPINIAPP_ICONS, "PM_Abstract:Icons");
|
|---|
| 100 |
|
|---|
| 101 | // object ID's (<WP_DESKTOP> etc.)
|
|---|
| 102 | DECLARE_PRFH_STRING(WPINIAPP_LOCATION, "PM_Workplace:Location");
|
|---|
| 103 |
|
|---|
| 104 | // folder positions
|
|---|
| 105 | DECLARE_PRFH_STRING(WPINIAPP_FOLDERPOS, "PM_Workplace:FolderPos");
|
|---|
| 106 |
|
|---|
| 107 | // palette positions
|
|---|
| 108 | DECLARE_PRFH_STRING(WPINIAPP_PALETTEPOS, "PM_Workplace:PalettePos");
|
|---|
| 109 | // ???
|
|---|
| 110 | DECLARE_PRFH_STRING(WPINIAPP_STATUSPOS, "PM_Workplace:StatusPos");
|
|---|
| 111 | // startup folders
|
|---|
| 112 | DECLARE_PRFH_STRING(WPINIAPP_STARTUP, "PM_Workplace:Startup");
|
|---|
| 113 | // all the defined templates on the system
|
|---|
| 114 | DECLARE_PRFH_STRING(WPINIAPP_TEMPLATES, "PM_Workplace:Templates");
|
|---|
| 115 |
|
|---|
| 116 | // all work area folders
|
|---|
| 117 | DECLARE_PRFH_STRING(WPINIAPP_WORKAREARUNNING, "FolderWorkareaRunningObjects");
|
|---|
| 118 | // spooler windows ?!?
|
|---|
| 119 | DECLARE_PRFH_STRING(WPINIAPP_JOBCNRPOS, "PM_PrintObject:JobCnrPos");
|
|---|
| 120 |
|
|---|
| 121 | // associations by type ("Plain Text")
|
|---|
| 122 | DECLARE_PRFH_STRING(WPINIAPP_ASSOCTYPE, "PMWP_ASSOC_TYPE");
|
|---|
| 123 | // associations by filter ("*.txt")
|
|---|
| 124 | DECLARE_PRFH_STRING(WPINIAPP_ASSOCFILTER, "PMWP_ASSOC_FILTER");
|
|---|
| 125 | // checksums ?!?
|
|---|
| 126 | DECLARE_PRFH_STRING(WPINIAPP_ASSOC_CHECKSUM, "PMWP_ASSOC_CHECKSUM");
|
|---|
| 127 |
|
|---|
| 128 | /*
|
|---|
| 129 | * OS2SYS.INI applications
|
|---|
| 130 | *
|
|---|
| 131 | */
|
|---|
| 132 |
|
|---|
| 133 | DECLARE_PRFH_STRING(WPINIAPP_ACTIVEHANDLES, "PM_Workplace:ActiveHandles");
|
|---|
| 134 | DECLARE_PRFH_STRING(WPINIAPP_HANDLES, "PM_Workplace:Handles");
|
|---|
| 135 | DECLARE_PRFH_STRING(WPINIAPP_HANDLESAPP, "HandlesAppName");
|
|---|
| 136 |
|
|---|
| 137 | /*
|
|---|
| 138 | * some default WPS INI keys:
|
|---|
| 139 | *
|
|---|
| 140 | */
|
|---|
| 141 |
|
|---|
| 142 | DECLARE_PRFH_STRING(WPOBJID_DESKTOP, "<WP_DESKTOP>");
|
|---|
| 143 |
|
|---|
| 144 | DECLARE_PRFH_STRING(WPOBJID_KEYB, "<WP_KEYB>");
|
|---|
| 145 | DECLARE_PRFH_STRING(WPOBJID_MOUSE, "<WP_MOUSE>");
|
|---|
| 146 | DECLARE_PRFH_STRING(WPOBJID_CNTRY, "<WP_CNTRY>");
|
|---|
| 147 | DECLARE_PRFH_STRING(WPOBJID_SOUND, "<WP_SOUND>");
|
|---|
| 148 | DECLARE_PRFH_STRING(WPOBJID_SYSTEM, "<WP_SYSTEM>"); // V0.9.9
|
|---|
| 149 | DECLARE_PRFH_STRING(WPOBJID_POWER, "<WP_POWER>");
|
|---|
| 150 | DECLARE_PRFH_STRING(WPOBJID_WINCFG, "<WP_WINCFG>");
|
|---|
| 151 |
|
|---|
| 152 | DECLARE_PRFH_STRING(WPOBJID_HIRESCLRPAL, "<WP_HIRESCLRPAL>");
|
|---|
| 153 | DECLARE_PRFH_STRING(WPOBJID_LORESCLRPAL, "<WP_LORESCLRPAL>");
|
|---|
| 154 | DECLARE_PRFH_STRING(WPOBJID_FNTPAL, "<WP_FNTPAL>");
|
|---|
| 155 | DECLARE_PRFH_STRING(WPOBJID_SCHPAL96, "<WP_SCHPAL96>");
|
|---|
| 156 |
|
|---|
| 157 | DECLARE_PRFH_STRING(WPOBJID_LAUNCHPAD, "<WP_LAUNCHPAD>");
|
|---|
| 158 | DECLARE_PRFH_STRING(WPOBJID_WARPCENTER, "<WP_WARPCENTER>");
|
|---|
| 159 |
|
|---|
| 160 | DECLARE_PRFH_STRING(WPOBJID_SPOOL, "<WP_SPOOL>");
|
|---|
| 161 | DECLARE_PRFH_STRING(WPOBJID_VIEWER, "<WP_VIEWER>");
|
|---|
| 162 | DECLARE_PRFH_STRING(WPOBJID_SHRED, "<WP_SHRED>");
|
|---|
| 163 | DECLARE_PRFH_STRING(WPOBJID_CLOCK, "<WP_CLOCK>");
|
|---|
| 164 |
|
|---|
| 165 | DECLARE_PRFH_STRING(WPOBJID_START, "<WP_START>");
|
|---|
| 166 | DECLARE_PRFH_STRING(WPOBJID_TEMPS, "<WP_TEMPS>");
|
|---|
| 167 | DECLARE_PRFH_STRING(WPOBJID_DRIVES, "<WP_DRIVES>");
|
|---|
| 168 |
|
|---|
| 169 | /* ******************************************************************
|
|---|
| 170 | *
|
|---|
| 171 | * Functions
|
|---|
| 172 | *
|
|---|
| 173 | ********************************************************************/
|
|---|
| 174 |
|
|---|
| 175 | APIRET prfhQueryKeysForApp(HINI hIni,
|
|---|
| 176 | const char *pcszApp,
|
|---|
| 177 | PSZ *ppszKeys);
|
|---|
| 178 |
|
|---|
| 179 | #ifdef __DEBUG_MALLOC_ENABLED__ // setup.h, helpers\memdebug.c
|
|---|
| 180 | PSZ prfhQueryProfileDataDebug(HINI hIni,
|
|---|
| 181 | const char *pcszApp,
|
|---|
| 182 | const char *pcszKey,
|
|---|
| 183 | PULONG pcbBuf,
|
|---|
| 184 | const char *file,
|
|---|
| 185 | unsigned long line,
|
|---|
| 186 | const char *function);
|
|---|
| 187 | #define prfhQueryProfileData(a, b, c, d) prfhQueryProfileDataDebug((a), (b), (c), (d), __FILE__, __LINE__, __FUNCTION__)
|
|---|
| 188 | #else
|
|---|
| 189 | PSZ prfhQueryProfileData(HINI hIni,
|
|---|
| 190 | const char *pcszApp,
|
|---|
| 191 | const char *pcszKey,
|
|---|
| 192 | PULONG pcbBuf);
|
|---|
| 193 | #endif
|
|---|
| 194 |
|
|---|
| 195 | CHAR prfhQueryProfileChar(HINI hini,
|
|---|
| 196 | const char *pcszApp,
|
|---|
| 197 | const char *pcszKey,
|
|---|
| 198 | CHAR cDefault);
|
|---|
| 199 |
|
|---|
| 200 | LONG prfhQueryColor(const char *pcszKeyName, const char *pcszDefault);
|
|---|
| 201 |
|
|---|
| 202 | APIRET prfhCopyKey(HINI hiniSource,
|
|---|
| 203 | const char *pcszSourceApp,
|
|---|
| 204 | const char *pcszKey,
|
|---|
| 205 | HINI hiniTarget,
|
|---|
| 206 | const char *pcszTargetApp);
|
|---|
| 207 |
|
|---|
| 208 | APIRET prfhCopyApp(HINI hiniSource,
|
|---|
| 209 | const char *pcszSourceApp,
|
|---|
| 210 | HINI hiniTarget,
|
|---|
| 211 | const char *pcszTargetApp,
|
|---|
| 212 | PSZ pszErrorKey);
|
|---|
| 213 |
|
|---|
| 214 | ULONG prfhRenameKey(HINI hini,
|
|---|
| 215 | const char *pcszOldApp,
|
|---|
| 216 | const char *pcszOldKey,
|
|---|
| 217 | const char *pcszNewApp,
|
|---|
| 218 | const char *pcszNewKey);
|
|---|
| 219 |
|
|---|
| 220 | BOOL prfhSetUserProfile(HAB hab,
|
|---|
| 221 | const char *pcszUserProfile);
|
|---|
| 222 |
|
|---|
| 223 | ULONG prfhINIError(ULONG ulOptions,
|
|---|
| 224 | FILE* fLog,
|
|---|
| 225 | PFNWP fncbError,
|
|---|
| 226 | PSZ pszErrorString);
|
|---|
| 227 |
|
|---|
| 228 | ULONG prfhINIError2(ULONG ulOptions,
|
|---|
| 229 | const char *pcszINI,
|
|---|
| 230 | FILE* fLog,
|
|---|
| 231 | PFNWP fncbError,
|
|---|
| 232 | PSZ pszErrorString);
|
|---|
| 233 |
|
|---|
| 234 | BOOL prfhCopyProfile(HAB hab,
|
|---|
| 235 | FILE* fLog,
|
|---|
| 236 | HINI hOld,
|
|---|
| 237 | PSZ pszOld,
|
|---|
| 238 | PSZ pszNew,
|
|---|
| 239 | PFNWP fncbUpdate,
|
|---|
| 240 | HWND hwnd, ULONG msg, ULONG ulCount, ULONG ulMax,
|
|---|
| 241 | PFNWP fncbError);
|
|---|
| 242 |
|
|---|
| 243 | APIRET prfhSaveINIs(HAB hab,
|
|---|
| 244 | FILE* fLog,
|
|---|
| 245 | PFNWP fncbUpdate,
|
|---|
| 246 | HWND hwnd, ULONG msg,
|
|---|
| 247 | PFNWP fncbError);
|
|---|
| 248 |
|
|---|
| 249 | #endif
|
|---|
| 250 |
|
|---|
| 251 | #if __cplusplus
|
|---|
| 252 | }
|
|---|
| 253 | #endif
|
|---|
| 254 |
|
|---|