source: trunk/src/kernel32/profile.cpp@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

File size: 24.7 KB
Line 
1/*
2 *
3 * Project Odin Software License can be found in LICENSE.TXT
4 *
5 */
6/*
7 * Win32 profile API functions
8 *
9 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
10 * Copyright 1998 Patrick Haller
11 *
12 */
13#include <os2win.h>
14#include <stdlib.h>
15#include <string.h>
16#include "unicode.h"
17
18//******************************************************************************
19//******************************************************************************
20UINT WIN32API GetPrivateProfileIntA(LPCSTR arg1, LPCSTR arg2, INT arg3, LPCSTR arg4)
21{
22 dprintf(("KERNEL32: OS2GetPrivateProfileIntA %s, %s, file %s\n", arg1, arg2, arg4));
23 return O32_GetPrivateProfileInt(arg1, arg2, arg3, arg4);
24}
25//******************************************************************************
26//******************************************************************************
27UINT WIN32API GetPrivateProfileIntW(LPCWSTR lpAppName, LPCWSTR lpKeyName,
28 INT nDefault, LPCWSTR lpFileName)
29{
30 char *asciiapp, *asciikey, *asciifile;
31 UINT rc;
32
33 dprintf(("KERNEL32: OS2GetPrivateProfileIntW\n"));
34 asciiapp = UnicodeToAsciiString((LPWSTR)lpAppName);
35 asciikey = UnicodeToAsciiString((LPWSTR)lpKeyName);
36 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
37 rc = O32_GetPrivateProfileInt(asciiapp, asciikey, nDefault, asciifile);
38 FreeAsciiString(asciifile);
39 FreeAsciiString(asciikey);
40 FreeAsciiString(asciiapp);
41 return(rc);
42}
43//******************************************************************************
44//******************************************************************************
45UINT WIN32API GetProfileIntA( LPCSTR arg1, LPCSTR arg2, INT arg3)
46{
47 UINT rc;
48
49 rc = O32_GetProfileInt(arg1, arg2, arg3);
50 dprintf(("KERNEL32: OS2GetProfileIntA %s %s returned %d\n", arg1, arg2, rc));
51 return(rc);
52}
53//******************************************************************************
54//******************************************************************************
55UINT WIN32API GetProfileIntW(LPCWSTR lpAppName, LPCWSTR lpKeyName, int nDefault)
56{
57 char *asciiapp, *asciikey;
58 UINT rc;
59
60 dprintf(("KERNEL32: OS2GetProfileIntW\n"));
61 asciiapp = UnicodeToAsciiString((LPWSTR)lpAppName);
62 asciikey = UnicodeToAsciiString((LPWSTR)lpKeyName);
63 rc = O32_GetProfileInt(asciiapp, asciikey, nDefault);
64 FreeAsciiString(asciikey);
65 FreeAsciiString(asciiapp);
66 return(rc);
67}
68//******************************************************************************
69//******************************************************************************
70INT WIN32API GetPrivateProfileStringA(LPCSTR arg1,
71 LPCSTR arg2,
72 LPCSTR arg3,
73 LPSTR arg4,
74 UINT arg5,
75 LPCSTR arg6)
76{
77 dprintf(("KERNEL32: GetPrivateProfileStringA(%s,%s,%s,%08xh,%u,%s)\n",
78 arg1,
79 arg2,
80 arg3,
81 arg4,
82 arg5,
83 arg6));
84
85 return O32_GetPrivateProfileString(arg1,
86 arg2,
87 arg3,
88 arg4,
89 arg5,
90 arg6);
91}
92//******************************************************************************
93//******************************************************************************
94INT WIN32API GetPrivateProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName,
95 LPCWSTR lpDefault, LPWSTR lpReturnedString,
96 UINT nSize, LPCWSTR lpFileName)
97{
98 char *asciiapp, *asciikey, *asciifile, *asciidefault;
99 char *asciistring = (char *)malloc(nSize+1);
100 UINT rc;
101
102 dprintf(("KERNEL32: OS2GetPrivateProfileStringW\n"));
103 asciiapp = UnicodeToAsciiString((LPWSTR)lpAppName);
104 asciikey = UnicodeToAsciiString((LPWSTR)lpKeyName);
105 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
106 asciidefault = UnicodeToAsciiString((LPWSTR)lpDefault);
107 rc = O32_GetPrivateProfileString(asciiapp, asciikey, asciidefault, asciistring,
108 nSize, asciifile);
109 if(rc) AsciiToUnicode(asciistring, lpReturnedString);
110 FreeAsciiString(asciidefault);
111 FreeAsciiString(asciifile);
112 FreeAsciiString(asciikey);
113 FreeAsciiString(asciiapp);
114 free(asciistring);
115 return(rc);
116}
117//******************************************************************************
118//******************************************************************************
119INT WIN32API GetProfileStringA( LPCSTR arg1, LPCSTR arg2, LPCSTR arg3, LPSTR arg4, UINT arg5)
120{
121 dprintf(("KERNEL32: GetProfileString %s\n", arg1));
122 return O32_GetProfileString(arg1, arg2, arg3, arg4, arg5);
123}
124//******************************************************************************
125//******************************************************************************
126INT WIN32API GetProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName,
127 LPCWSTR lpDefault, LPWSTR lpReturnedString,
128 UINT nSize)
129{
130 char *asciiapp, *asciikey, *asciifile, *asciidefault;
131 char *asciistring = (char *)malloc(nSize+1);
132 UINT rc;
133
134 dprintf(("KERNEL32: OS2GetProfileStringW\n"));
135 asciiapp = UnicodeToAsciiString((LPWSTR)lpAppName);
136 asciikey = UnicodeToAsciiString((LPWSTR)lpKeyName);
137 asciidefault = UnicodeToAsciiString((LPWSTR)lpDefault);
138 rc = O32_GetProfileString(asciiapp, asciikey, asciidefault, asciistring, nSize);
139 if(rc) AsciiToUnicode(asciistring, lpReturnedString);
140 FreeAsciiString(asciidefault);
141 FreeAsciiString(asciikey);
142 FreeAsciiString(asciiapp);
143 free(asciistring);
144 return(rc);
145}
146//******************************************************************************
147//******************************************************************************
148BOOL WIN32API WriteProfileStringA(LPCSTR arg1, LPCSTR arg2, LPCSTR arg3)
149{
150 dprintf(("KERNEL32: WriteProfileString %s key %s value %s\n", arg1, arg2, arg3));
151 return O32_WriteProfileString(arg1, arg2, arg3);
152}
153//******************************************************************************
154//******************************************************************************
155BOOL WIN32API WriteProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName,
156 LPCWSTR lpString)
157{
158 char *asciiapp, *asciikey, *asciistring;
159 UINT rc;
160
161 dprintf(("KERNEL32: OS2WriteProfileStringW\n"));
162 asciiapp = UnicodeToAsciiString((LPWSTR)lpAppName);
163 asciikey = UnicodeToAsciiString((LPWSTR)lpKeyName);
164 asciistring = UnicodeToAsciiString((LPWSTR)lpString);
165 rc = O32_WriteProfileString(asciiapp, asciikey, asciistring);
166 FreeAsciiString(asciistring);
167 FreeAsciiString(asciikey);
168 FreeAsciiString(asciiapp);
169 return(rc);
170}
171//******************************************************************************
172//******************************************************************************
173BOOL WIN32API WritePrivateProfileStringA( LPCSTR arg1, LPCSTR arg2, LPCSTR arg3, LPCSTR arg4)
174{
175 dprintf(("KERNEL32: WritePrivateProfileString\n"));
176 return O32_WritePrivateProfileString(arg1, arg2, arg3, arg4);
177}
178//******************************************************************************
179//******************************************************************************
180BOOL WIN32API WritePrivateProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName,
181 LPCWSTR lpString, LPCWSTR lpFileName)
182{
183 char *asciiapp, *asciikey, *asciifile, *asciistring;
184 UINT rc;
185
186 dprintf(("KERNEL32: OS2WritePrivateProfileStringW\n"));
187 asciiapp = UnicodeToAsciiString((LPWSTR)lpAppName);
188 asciikey = UnicodeToAsciiString((LPWSTR)lpKeyName);
189 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
190 asciistring = UnicodeToAsciiString((LPWSTR)lpString);
191 rc = O32_WritePrivateProfileString(asciiapp, asciikey, asciistring, asciifile);
192 FreeAsciiString(asciistring);
193 FreeAsciiString(asciifile);
194 FreeAsciiString(asciikey);
195 FreeAsciiString(asciiapp);
196 return(rc);
197}
198//******************************************************************************
199//******************************************************************************
200INT WIN32API GetProfileSectionA(LPCSTR lpszSection, LPSTR lpszReturnBuffer,
201 DWORD cchBuffer)
202{
203 dprintf(("KERNEL32: OS2GetProfileSectionA %s, not implemented\n", lpszSection));
204 return(0);
205}
206//******************************************************************************
207INT WIN32API GetProfileSectionW(LPCWSTR lpszSection,
208 LPWSTR lpszReturnBuffer,
209 DWORD cchBuffer)
210{
211 dprintf(("KERNEL32: OS2GetProfileSectionW %s, not implemented\n", lpszSection));
212 return(0);
213}
214
215INT WIN32API GetPrivateProfileSectionA(
216 LPCSTR lpszSection, /* address of section name */
217 LPSTR lpszReturnBuffer,/* address of return buffer */
218 DWORD cchBuffer, /* size of return buffer */
219 LPCSTR lpszFile) /* address of initialization filename */
220
221
222 /* The GetPrivateProfileSection function retrieves all of the keys
223 * and values for the specified section from the given initialization
224 * file. This function is provided for compatibility with 16-bit
225 * applications written for Windows. New applications should store
226 * initialization information in the registry.
227 */
228{
229 dprintf(("GetPrivateProfileSection(%s, %s, %d) - not implemented\n",
230 lpszFile, lpszSection, cchBuffer));
231 return FALSE; // return error
232}
233
234
235INT WIN32API GetPrivateProfileSectionW(
236 LPCWSTR lpszSection, /* address of section name */
237 LPWSTR lpszReturnBuffer,/* address of return buffer */
238 DWORD cchBuffer, /* size of return buffer */
239 LPCWSTR lpszFile) /* address of initialization filename */
240
241
242 /* The GetPrivateProfileSection function retrieves all of the keys
243 * and values for the specified section from the given initialization
244 * file. This function is provided for compatibility with 16-bit
245 * applications written for Windows. New applications should store
246 * initialization information in the registry.
247 */
248{
249 dprintf(("GetPrivateProfileSectionW(%s, %s, %d) - not implemented\n",
250 lpszFile, lpszSection, cchBuffer));
251 return FALSE; // return error
252}
253/*****************************************************************************
254 * Name : BOOL WriteProfileSectionA
255 * Purpose : The WriteProfileSection function replaces the contents of the
256 * specified section in the WIN.INI file with the specified keys and values.
257 * This function is provided for compatibility with 16-bit Windows
258 * applications. Win32-based applications should store initialization
259 * information in the registry.
260 * Parameters: LPCTSTR lpszSection address of string with section name
261 * LPCTSTR lpszKeysAndValues address of string with data
262 * Variables :
263 * Result : TRUE / FALSE
264 * Remark :
265 * Status : UNTESTED STUB
266 *
267 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
268 *****************************************************************************/
269
270BOOL WIN32API WriteProfileSectionA(LPCTSTR lpszSection,
271 LPCTSTR lpszKeysAndValues)
272{
273 dprintf(("KERNEL32: WriteProfileSectionA(%s,%s,%s) not implemented.\n",
274 lpszSection,
275 lpszKeysAndValues));
276
277 return (FALSE);
278}
279
280
281/*****************************************************************************
282 * Name : BOOL WriteProfileSectionW
283 * Purpose : The WriteProfileSection function replaces the contents of the
284 * specified section in the WIN.INI file with the specified keys and values.
285 * This function is provided for compatibility with 16-bit Windows
286 * applications. Win32-based applications should store initialization
287 * information in the registry.
288 * Parameters: LPCWSTR lpszSection address of string with section name
289 * LPCWSTR lpszKeysAndValues address of string with data
290 * Variables :
291 * Result : TRUE / FALSE
292 * Remark :
293 * Status : UNTESTED STUB
294 *
295 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
296 *****************************************************************************/
297
298BOOL WIN32API WriteProfileSectionW(LPCWSTR lpszSection,
299 LPCWSTR lpszKeysAndValues)
300{
301 dprintf(("KERNEL32: WriteProfileSectionW(%s,%s,%s) not implemented.\n",
302 lpszSection,
303 lpszKeysAndValues));
304
305 return (FALSE);
306}
307/*****************************************************************************
308 * Name : BOOL GetPrivateProfileStructA
309 * Purpose : The GetPrivateProfileStructA function retrieves the data associated
310 * with the specified key in the given section of an initialization
311 * file. As it retrieves the data, the function calculates a checksum
312 * and compares it with the checksum calculated by the WritePrivateProfileStruct
313 * function when the data was added to the file. This function is provided
314 * for compatibility with 16-bit Windows-based applications. Win32-based
315 * applications should store initialization information in the registry.
316 * Parameters: LPCTSTR lpszSection address of section name
317 * LPCTSTR lpszKey address of key name
318 * LPVOID lpStruct address of return buffer
319 * UINT uSizeStruct size of return buffer
320 * LPCTSTR szFile address of initialization filename
321 * Variables :
322 * Result : TRUE / FALSE
323 * Remark :
324 * Status : UNTESTED STUB
325 *
326 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
327 *****************************************************************************/
328
329BOOL WIN32API GetPrivateProfileStructA(LPCTSTR lpszSection,
330 LPCTSTR lpszKey,
331 LPVOID lpStruct,
332 UINT uSizeStruct,
333 LPCTSTR szFile)
334{
335 dprintf(("KERNEL32: GetPrivateProfileStructA(%s,%s,%08xh,%08xh,%s) not implemented.\n",
336 lpszSection,
337 lpszKey,
338 lpStruct,
339 uSizeStruct,
340 szFile));
341
342 return FALSE;
343}
344
345
346/*****************************************************************************
347 * Name : BOOL GetPrivateProfileStructW
348 * Purpose : The GetPrivateProfileStructW function retrieves the data associated
349 * with the specified key in the given section of an initialization
350 * file. As it retrieves the data, the function calculates a checksum
351 * and compares it with the checksum calculated by the WritePrivateProfileStruct
352 * function when the data was added to the file. This function is provided
353 * for compatibility with 16-bit Windows-based applications. Win32-based
354 * applications should store initialization information in the registry.
355 * Parameters: LPCWSTR lpszSection address of section name
356 * LPCWSTR lpszKey address of key name
357 * LPVOID lpStruct address of return buffer
358 * UINT uSizeStruct size of return buffer
359 * LPCWSTR szFile address of initialization filename
360 * Variables :
361 * Result : TRUE / FALSE
362 * Remark :
363 * Status : UNTESTED STUB
364 *
365 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
366 *****************************************************************************/
367
368BOOL WIN32API GetPrivateProfileStructW(LPCWSTR lpszSection,
369 LPCWSTR lpszKey,
370 LPVOID lpStruct,
371 UINT uSizeStruct,
372 LPCWSTR szFile)
373{
374 dprintf(("KERNEL32: GetPrivateProfileStructW(%s,%s,%08xh,%08xh,%s) not implemented.\n",
375 lpszSection,
376 lpszKey,
377 lpStruct,
378 uSizeStruct,
379 szFile));
380
381 return FALSE;
382}
383
384
385/*****************************************************************************
386 * Name : BOOL GetPrivateProfileSectionNamesA
387 * Purpose : The GetPrivateProfileSectionNames function retrieves the names
388 * of all sections in an initialization file. This function is
389 * provided for compatibility with 16-bit Windows-based applications.
390 * Win32-based applications should store initialization information
391 * in the registry.
392 * Parameters: LPTSTR lpszReturnBuffer address of return buffer
393 * DWORD nSize size of return buffer
394 * LPCTSTR lpFileName address of initialization filename
395 * Variables :
396 * Result : TRUE / FALSE
397 * Remark :
398 * Status : UNTESTED STUB
399 *
400 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
401 *****************************************************************************/
402
403DWORD WIN32API GetPrivateProfileSectionNamesA(LPTSTR lpszReturnBuffer,
404 DWORD nSize,
405 LPCTSTR lpFileName)
406{
407 dprintf(("KERNEL32: GetPrivateProfileSectionNamesA(%08xh,%08xh,%s) not implemented.\n",
408 lpszReturnBuffer,
409 nSize,
410 lpFileName));
411
412 return FALSE;
413}
414
415
416/*****************************************************************************
417 * Name : BOOL GetPrivateProfileSectionNamesW
418 * Purpose : The GetPrivateProfileSectionNames function retrieves the names
419 * of all sections in an initialization file. This function is
420 * provided for compatibility with 16-bit Windows-based applications.
421 * Win32-based applications should store initialization information
422 * in the registry.
423 * Parameters: LPWSTR lpszReturnBuffer address of return buffer
424 * DWORD nSize size of return buffer
425 * LPCTSTR lpFileName address of initialization filename
426 * Variables :
427 * Result : TRUE / FALSE
428 * Remark :
429 * Status : UNTESTED STUB
430 *
431 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
432 *****************************************************************************/
433
434DWORD WIN32API GetPrivateProfileSectionNamesW(LPWSTR lpszReturnBuffer,
435 DWORD nSize,
436 LPCWSTR lpFileName)
437{
438 dprintf(("KERNEL32: GetPrivateProfileSectionNamesW(%08xh,%08xh,%s) not implemented.\n",
439 lpszReturnBuffer,
440 nSize,
441 lpFileName));
442
443 return FALSE;
444}
445/*****************************************************************************
446 * Name : BOOL WritePrivateProfileSectionA
447 * Purpose : The WritePrivateProfileSection function replaces the keys and
448 * values under the specified section in an initialization file.
449 * This function is provided for compatibility with 16-bit
450 * Windows-based applications. Win32-based applications should
451 * store initialization information in the registry.
452 * Parameters: LPCTSTR lpszSection address of string with section name
453 * LPCTSTR lpszKeysAndValues address of string with data
454 * LPCTSTR lpszFile address of string with filename
455 * Variables :
456 * Result : TRUE / FALSE
457 * Remark :
458 * Status : UNTESTED STUB
459 *
460 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
461 *****************************************************************************/
462
463BOOL WIN32API WritePrivateProfileSectionA(LPCTSTR lpszSection,
464 LPCTSTR lpszKeysAndValues,
465 LPCTSTR lpszFile)
466{
467 dprintf(("KERNEL32: WritePrivateProfileSectionA(%s,%s,%s) not implemented.\n",
468 lpszSection,
469 lpszKeysAndValues,
470 lpszFile));
471
472 return (FALSE);
473}
474
475
476/*****************************************************************************
477 * Name : BOOL WritePrivateProfileSectionW
478 * Purpose : The WritePrivateProfileSection function replaces the keys and
479 * values under the specified section in an initialization file.
480 * This function is provided for compatibility with 16-bit
481 * Windows-based applications. Win32-based applications should
482 * store initialization information in the registry.
483 * Parameters: LPCWSTR lpszSection address of string with section name
484 * LPCWSTR lpszKeysAndValues address of string with data
485 * LPCWSTR lpszFile address of string with filename
486 * Variables :
487 * Result : TRUE / FALSE
488 * Remark :
489 * Status : UNTESTED STUB
490 *
491 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
492 *****************************************************************************/
493
494BOOL WIN32API WritePrivateProfileSectionW(LPCWSTR lpszSection,
495 LPCWSTR lpszKeysAndValues,
496 LPCWSTR lpszFile)
497{
498 dprintf(("KERNEL32: WritePrivateProfileSectionW(%s,%s,%s) not implemented.\n",
499 lpszSection,
500 lpszKeysAndValues,
501 lpszFile));
502
503 return (FALSE);
504}
505
506
507/*****************************************************************************
508 * Name : BOOL WritePrivateProfileStructA
509 * Purpose : The WritePrivateProfileStruct function copies data into the
510 * specified key in the given section of an initialization file.
511 * As it copies the data, the function calculates a checksum and
512 * appends it to the end of the data. The GetPrivateProfileStruct
513 * function uses the checksum to ensure the integrity of the data.
514 * This function is provided for compatibility with 16-bit
515 * Windows-based applications. Win32-based applications should store
516 * initialization information in the registry.
517 * Parameters: LPCTSTR lpszSection address of section name
518 * LPCTSTR lpszKey address of key name
519 * LPVOID lpvStruct address of buffer that contains data to add
520 * UINT uSizeStruct size, in bytes, of the buffer
521 * LPCTSTR lpszFile address of initialization filename
522 * Variables :
523 * Result : TRUE / FALSE
524 * Remark :
525 * Status : UNTESTED STUB
526 *
527 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
528 *****************************************************************************/
529
530BOOL WIN32API WritePrivateProfileStructA(LPCTSTR lpszSection,
531 LPCTSTR lpszKey,
532 LPVOID lpvStruct,
533 UINT uSizeStruct,
534 LPCTSTR lpszFile)
535{
536 dprintf(("KERNEL32: WritePrivateProfileStructA(%s,%s,%08xh,%u,%s) not implemented.\n",
537 lpszSection,
538 lpszKey,
539 lpvStruct,
540 uSizeStruct,
541 lpszFile));
542
543 return (FALSE);
544}
545
546
547/*****************************************************************************
548 * Name : BOOL WritePrivateProfileStructW
549 * Purpose : The WritePrivateProfileStruct function copies data into the
550 * specified key in the given section of an initialization file.
551 * As it copies the data, the function calculates a checksum and
552 * appends it to the end of the data. The GetPrivateProfileStruct
553 * function uses the checksum to ensure the integrity of the data.
554 * This function is provided for compatibility with 16-bit
555 * Windows-based applications. Win32-based applications should store
556 * initialization information in the registry.
557 * Parameters: LPCWSTR lpszSection address of section name
558 * LPCWSTR lpszKey address of key name
559 * LPVOID lpvStruct address of buffer that contains data to add
560 * UINT uSizeStruct size, in bytes, of the buffer
561 * LPCWSTR lpszFile address of initialization filename
562 * Variables :
563 * Result : TRUE / FALSE
564 * Remark :
565 * Status : UNTESTED STUB
566 *
567 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
568 *****************************************************************************/
569
570BOOL WIN32API WritePrivateProfileStructW(LPCWSTR lpszSection,
571 LPCWSTR lpszKey,
572 LPVOID lpvStruct,
573 UINT uSizeStruct,
574 LPCWSTR lpszFile)
575{
576 dprintf(("KERNEL32: WritePrivateProfileStructW(%s,%s,%08xh,%u,%s) not implemented.\n",
577 lpszSection,
578 lpszKey,
579 lpvStruct,
580 uSizeStruct,
581 lpszFile));
582
583 return (FALSE);
584}
Note: See TracBrowser for help on using the repository browser.