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

Last change on this file since 4 was 4, checked in by ktk, 26 years ago

Import

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