Changeset 4 for trunk/common_functions/ini_funcs.c
- Timestamp:
- Jul 13, 2017, 5:17:57 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/common_functions/ini_funcs.c
r2 r4 1 1 /* 2 * This file is (C) Chris Wohlgemuth 2001-200 42 * This file is (C) Chris Wohlgemuth 2001-2005 3 3 */ 4 5 4 #define INCL_WIN 6 5 7 6 #include <os2.h> 8 7 9 /* 10 hini may be NULL. Then the filename is used to open the ini file. 11 */ 12 /*!**************************************************/ 8 /*!**************************************************/ 9 /* */ 10 /* @@MODULE */ 11 /* */ 12 /* Profile functions */ 13 13 /* */ 14 14 /* @@DESC */ … … 31 31 /* */ 32 32 /*!!*************************************************/ 33 BOOL IniSaveWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd)33 BOOL PrfSaveWindowPos(HINI hini, char* iniFile, char* chrApp, char* chrKey, HWND hwnd) 34 34 { 35 35 BOOL bError=FALSE; … … 65 65 /*!**************************************************/ 66 66 /* */ 67 /* @@MODULE */ 68 /* */ 69 /* Profile functions */ 70 /* */ 67 71 /* @@DESC */ 68 72 /* */ … … 85 89 /* */ 86 90 /*!!*************************************************/ 87 BOOL IniRestoreWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd, ULONG fSize)91 BOOL PrfRestoreWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd, ULONG fSize) 88 92 { 89 93 HINI hiniPriv=hini; … … 115 119 } 116 120 117 118 121 /*!**************************************************/ 122 /* */ 123 /* @@MODULE */ 124 /* */ 125 /* Profile functions */ 126 /* */ 127 /* @@DESC */ 128 /* */ 129 /* Save a string in an INI file. */ 130 /* */ 131 /* . */ 132 /* */ 133 /* @@REMARKS */ 134 /* */ 135 /* If hini is NULL the given file name will be used */ 136 /* for opening the INI file. If hini is not NULL */ 137 /* the file name is ignored. */ 138 /* */ 139 /* @@RETURNS */ 140 /* */ 141 /* BOOL fSuccess */ 142 /* */ 143 /* TRUE: Function succeeded. */ 144 /* FALSE: Error occurred */ 145 /* */ 146 /*!!*************************************************/ 147 BOOL PrfWriteString(HINI hini, char * iniFile, char* chrApp, char *chrKey, char* chrString) 148 { 149 BOOL bError=FALSE; 150 HINI hiniPriv=hini; 151 152 if(!hini && !iniFile) 153 return FALSE; 154 155 do { 156 if(!hiniPriv) { 157 /* Open ini-file */ 158 if((hiniPriv=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),(unsigned char *)iniFile)) 159 ==NULLHANDLE) 160 break; 161 }/* end of if(!hiniPriv) */ 162 163 if(!PrfWriteProfileString(hiniPriv, chrApp, chrKey, chrString)) 164 bError=TRUE; 165 166 if(hiniPriv && !hini) 167 PrfCloseProfile(hiniPriv); 168 169 if(bError) 170 break; 171 return TRUE; 172 } while(TRUE); 173 return FALSE; 174 } 175 176 /*!**************************************************/ 177 /* */ 178 /* @@MODULE */ 179 /* */ 180 /* Profile functions */ 181 /* */ 182 /* @@DESC */ 183 /* */ 184 /* Get a string from an INI file. */ 185 /* */ 186 /* . */ 187 /* */ 188 /* @@REMARKS */ 189 /* */ 190 /* If hini is NULL the given file name will be used */ 191 /* for opening the INI file. If hini is not NULL */ 192 /* the file name is ignored. */ 193 /* */ 194 /* @@RETURNS */ 195 /* */ 196 /* ULONG ulLength */ 197 /* */ 198 /* TRUE: Function succeeded. */ 199 /* FALSE: Error occurred */ 200 /* */ 201 /*!!*************************************************/ 202 BOOL PrfQueryString(HINI hini, char * iniFile, char* chrApp, char *chrKey, char* chrDefault, char* chrBuffer, ULONG ulSize) 203 { 204 HINI hiniPriv=hini; 205 ULONG ulRC=0; 206 207 do{ 208 if(!hiniPriv) { 209 if((hiniPriv=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),(unsigned char *)iniFile)) 210 ==NULLHANDLE) 211 break; 212 }/* end of if(!hini) */ 213 214 ulRC=PrfQueryProfileString(hiniPriv, chrApp, chrKey, chrDefault, chrBuffer, ulSize); 215 216 if(hiniPriv && !hini) 217 PrfCloseProfile(hiniPriv); 218 219 break; 220 } while(TRUE); 221 return ulRC; 222 } 223 224
Note:
See TracChangeset
for help on using the changeset viewer.