source: trunk/src/kernel32/registry.cpp@ 3313

Last change on this file since 3313 was 2984, checked in by sandervl, 25 years ago

moved registry apis into kernel32 + cleanup

File size: 48.1 KB
Line 
1/* $Id: registry.cpp,v 1.1 2000-03-03 11:15:59 sandervl Exp $ */
2
3/*
4 * Win32 registry API functions for OS/2
5 *
6 * 1998/06/12
7 *
8 * Copyright 1998 Sander van Leeuwen
9 * Copyright 1998 Patrick Haller
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14
15
16/*****************************************************************************
17 * Includes *
18 *****************************************************************************/
19
20#include <odin.h>
21#include <odinwrap.h>
22#include <os2sel.h>
23
24#include <os2win.h>
25#include <stdlib.h>
26#include <stdarg.h>
27#include <string.h>
28#include <odinwrap.h>
29#include <misc.h>
30#include "unicode.h"
31#include <winreg.h>
32
33
34ODINDEBUGCHANNEL(ADVAPI32-REGISTRY)
35
36
37/*****************************************************************************
38 * Defines *
39 *****************************************************************************/
40
41 /* this define enables certain less important debug messages */
42//#define DEBUG_LOCAL 1
43
44
45/*****************************************************************************
46 * Name : Convert Key
47 * Purpose : convert key handle values between win32 and os/2
48 * Parameters: HKEY winkey - the win32 key handle value
49 * Variables :
50 * Result : the os/2 warp registry key handle value
51 * Remark :
52 * Status : UNTESTED STUB
53 *
54 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
55 *****************************************************************************/
56
57static HKEY ConvertKey(HKEY winkey)
58{
59 switch((int)winkey)
60 {
61 case HKEY_CLASSES_ROOT: return HKEY_CLASSES_ROOT_O32;
62 case HKEY_CURRENT_USER: return HKEY_CURRENT_USER_O32;
63 case HKEY_LOCAL_MACHINE: return HKEY_LOCAL_MACHINE_O32;
64 case HKEY_USERS: return HKEY_USERS_O32;
65 }
66 return(winkey);
67}
68
69
70/*****************************************************************************
71 * Name :
72 * Purpose :
73 * Parameters:
74 * Variables :
75 * Result :
76 * Remark :
77 * Status : CORRECTED UNTESTED
78 *
79 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
80 *****************************************************************************/
81
82ODINFUNCTION1(LONG,RegCloseKey,HKEY,hKey)
83{
84 return _O32_RegCloseKey(ConvertKey(hKey));
85}
86
87
88/*****************************************************************************
89 * Name :
90 * Purpose :
91 * Parameters:
92 * Variables :
93 * Result :
94 * Remark :
95 * Status : CORRECTED UNTESTED
96 *
97 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
98 *****************************************************************************/
99
100ODINFUNCTION3(LONG,RegCreateKeyA,HKEY, hKey,
101 LPCSTR,lpszSubKey,
102 PHKEY, phkResult)
103{
104 dprintf(("RegCreateKeyA %x %s", hKey, lpszSubKey));
105 return _O32_RegCreateKey(ConvertKey(hKey),
106 lpszSubKey,
107 phkResult);
108}
109
110
111/*****************************************************************************
112 * Name :
113 * Purpose :
114 * Parameters:
115 * Variables :
116 * Result :
117 * Remark :
118 * Status : CORRECTED UNTESTED
119 *
120 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
121 *****************************************************************************/
122
123ODINFUNCTION3(LONG,RegCreateKeyW,HKEY, hKey,
124 LPCWSTR,lpszSubKey,
125 PHKEY, phkResult)
126{
127 char *astring = UnicodeToAsciiString((LPWSTR)lpszSubKey);
128 LONG rc;
129
130 dprintf(("RegCreateKeyW %x %s", hKey, astring));
131 rc = _O32_RegCreateKey(ConvertKey(hKey),
132 astring,
133 phkResult);
134
135 FreeAsciiString(astring);
136 return(rc);
137}
138
139
140/*****************************************************************************
141 * Name :
142 * Purpose :
143 * Parameters:
144 * Variables :
145 * Result :
146 * Remark :
147 * Status : CORRECTED UNTESTED
148 *
149 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
150 *****************************************************************************/
151
152ODINFUNCTION9(LONG,RegCreateKeyExA,HKEY, hKey,
153 LPCSTR, lpszSubKey,
154 DWORD, dwReserved,
155 LPSTR, lpszClass,
156 DWORD, fdwOptions,
157 REGSAM, samDesired,
158 LPSECURITY_ATTRIBUTES,lpSecurityAttributes,
159 PHKEY, phkResult,
160 LPDWORD, lpdwDisposition)
161{
162 dprintf(("RegCreateKeyExA %x %s", hKey, lpszSubKey));
163
164 return _O32_RegCreateKeyEx(ConvertKey(hKey),
165 lpszSubKey,
166 dwReserved,
167 lpszClass,
168 fdwOptions,
169 samDesired, // | KEY_READ
170 lpSecurityAttributes,
171 phkResult,
172 lpdwDisposition);
173}
174
175
176/*****************************************************************************
177 * Name :
178 * Purpose :
179 * Parameters:
180 * Variables :
181 * Result :
182 * Remark :
183 * Status : CORRECTED UNTESTED
184 *
185 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
186 *****************************************************************************/
187
188ODINFUNCTION9(LONG,RegCreateKeyExW,HKEY, hKey,
189 LPCWSTR, lpszSubKey,
190 DWORD, dwReserved,
191 LPWSTR, lpszClass,
192 DWORD, fdwOptions,
193 REGSAM, samDesired,
194 LPSECURITY_ATTRIBUTES,lpSecurityAttributes,
195 PHKEY, phkResult,
196 LPDWORD, lpdwDisposition)
197{
198 char *astring1 = UnicodeToAsciiString((LPWSTR)lpszSubKey);
199 char *astring2 = UnicodeToAsciiString(lpszClass);
200 LONG rc;
201
202 dprintf(("RegCreateKeyExW %x %s", hKey, astring1));
203
204 rc = _O32_RegCreateKeyEx(ConvertKey(hKey),
205 astring1,
206 dwReserved,
207 astring2,
208 fdwOptions,
209 samDesired, // | KEY_READ
210 lpSecurityAttributes,
211 phkResult,
212 lpdwDisposition);
213
214 FreeAsciiString(astring1);
215 FreeAsciiString(astring2);
216 return(rc);
217}
218
219
220/*****************************************************************************
221 * Name :
222 * Purpose :
223 * Parameters:
224 * Variables :
225 * Result :
226 * Remark :
227 * Status : CORRECTED UNTESTED
228 *
229 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
230 *****************************************************************************/
231
232ODINFUNCTION2(LONG,RegDeleteKeyW,HKEY, hKey,
233 LPWSTR,lpszSubKey)
234{
235 char *astring = UnicodeToAsciiString(lpszSubKey);
236 LONG rc;
237
238 dprintf(("RegDeleteKeyW %s", astring));
239 rc = _O32_RegDeleteKey(ConvertKey(hKey),
240 astring);
241 FreeAsciiString(astring);
242 return(rc);
243}
244
245
246/*****************************************************************************
247 * Name :
248 * Purpose :
249 * Parameters:
250 * Variables :
251 * Result :
252 * Remark :
253 * Status : CORRECTED UNTESTED
254 *
255 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
256 *****************************************************************************/
257
258ODINFUNCTION2(LONG,RegDeleteKeyA,HKEY, hKey,
259 LPCSTR,lpszSubKey)
260{
261 dprintf(("RegDeleteKeyW %s", lpszSubKey));
262 return _O32_RegDeleteKey(ConvertKey(hKey),
263 lpszSubKey);
264}
265
266
267/*****************************************************************************
268 * Name :
269 * Purpose :
270 * Parameters:
271 * Variables :
272 * Result :
273 * Remark :
274 * Status : CORRECTED UNTESTED
275 *
276 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
277 *****************************************************************************/
278
279ODINFUNCTION2(LONG,RegDeleteValueA,HKEY, hKey,
280 LPSTR,lpszValue)
281{
282 return _O32_RegDeleteValue(ConvertKey(hKey),
283 lpszValue);
284}
285
286
287/*****************************************************************************
288 * Name :
289 * Purpose :
290 * Parameters:
291 * Variables :
292 * Result :
293 * Remark :
294 * Status : CORRECTED UNTESTED
295 *
296 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
297 *****************************************************************************/
298
299ODINFUNCTION2(LONG,RegDeleteValueW,HKEY, hKey,
300 LPWSTR,lpszValue)
301{
302 char *astring = UnicodeToAsciiString(lpszValue);
303 LONG rc;
304
305 rc = _O32_RegDeleteValue(ConvertKey(hKey),
306 astring);
307 FreeAsciiString(astring);
308 return(rc);
309}
310
311
312/*****************************************************************************
313 * Name :
314 * Purpose :
315 * Parameters:
316 * Variables :
317 * Result :
318 * Remark :
319 * Status : UNTESTED STUB
320 *
321 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
322 *****************************************************************************/
323
324ODINFUNCTION4(LONG,RegEnumKeyA,HKEY, hKey,
325 DWORD,iSubKey,
326 LPSTR,lpszName,
327 DWORD,cchName)
328{
329 return _O32_RegEnumKey(ConvertKey(hKey),
330 iSubKey,
331 lpszName,
332 cchName);
333}
334
335
336/*****************************************************************************
337 * Name :
338 * Purpose :
339 * Parameters:
340 * Variables :
341 * Result :
342 * Remark :
343 * Status : UNTESTED STUB
344 *
345 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
346 *****************************************************************************/
347
348ODINFUNCTION4(LONG,RegEnumKeyW,HKEY, hKey,
349 DWORD, iSubKey,
350 LPWSTR,lpszName,
351 DWORD, cchName)
352{
353 char *astring;
354 LONG rc;
355
356 rc = _O32_RegEnumKey(ConvertKey(hKey),
357 iSubKey,
358 (char *)lpszName,
359 cchName);
360 if(rc == ERROR_SUCCESS)
361 {
362 astring = (char *)malloc(cchName);
363 strcpy(astring, (char *)lpszName);
364 AsciiToUnicode(astring, lpszName);
365 free(astring);
366 }
367 return(rc);
368}
369
370
371/*****************************************************************************
372 * Name :
373 * Purpose :
374 * Parameters:
375 * Variables :
376 * Result :
377 * Remark :
378 * Status : UNTESTED STUB
379 *
380 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
381 *****************************************************************************/
382
383ODINFUNCTION8(LONG,RegEnumKeyExA,HKEY, arg1,
384 DWORD, arg2,
385 LPSTR, arg3,
386 LPDWORD, arg4,
387 LPDWORD, arg5,
388 LPSTR, arg6,
389 LPDWORD, arg7,
390 LPFILETIME,arg8)
391{
392 return _O32_RegEnumKeyEx(ConvertKey(arg1),
393 arg2,
394 arg3,
395 arg4,
396 arg5,
397 arg6,
398 arg7,
399 arg8);
400}
401
402
403/*****************************************************************************
404 * Name :
405 * Purpose :
406 * Parameters:
407 * Variables :
408 * Result :
409 * Remark :
410 * Status : UNTESTED STUB
411 *
412 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
413 *****************************************************************************/
414
415ODINFUNCTION8(LONG,RegEnumKeyExW,HKEY, arg1,
416 DWORD, arg2,
417 LPWSTR, arg3,
418 LPDWORD, arg4,
419 LPDWORD, arg5,
420 LPWSTR, arg6,
421 LPDWORD, arg7,
422 LPFILETIME,arg8)
423{
424 char *astring;
425 LONG rc;
426
427 rc = _O32_RegEnumKeyEx(ConvertKey(arg1),
428 arg2,
429 (char *)arg3,
430 arg4,
431 arg5,
432 (char *)arg6,
433 arg7,
434 arg8);
435 if(rc == ERROR_SUCCESS)
436 {
437 astring = (char *)malloc(max(*arg4, *arg7)); //class & keyname
438 strcpy(astring, (char *)arg3);
439 AsciiToUnicode(astring, arg3);
440 if(arg6 != NULL)
441 {
442 strcpy(astring, (char *)arg6);
443 AsciiToUnicode(astring, arg6);
444 }
445 free(astring);
446 }
447 return(rc);
448}
449
450
451/*****************************************************************************
452 * Name :
453 * Purpose :
454 * Parameters:
455 * Variables :
456 * Result :
457 * Remark :
458 * Status : UNTESTED STUB
459 *
460 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
461 *****************************************************************************/
462
463ODINFUNCTION8(LONG,RegEnumValueA,HKEY, arg1,
464 DWORD, arg2,
465 LPSTR, arg3,
466 LPDWORD,arg4,
467 LPDWORD,arg5,
468 LPDWORD,arg6,
469 LPBYTE, arg7,
470 LPDWORD,arg8)
471{
472 return _O32_RegEnumValue(ConvertKey(arg1),
473 arg2,
474 arg3,
475 arg4,
476 arg5,
477 arg6,
478 arg7,
479 arg8);
480}
481
482
483/*****************************************************************************
484 * Name :
485 * Purpose :
486 * Parameters:
487 * Variables :
488 * Result :
489 * Remark :
490 * Status : UNTESTED STUB
491 *
492 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
493 *****************************************************************************/
494
495ODINFUNCTION8(LONG,RegEnumValueW,HKEY, arg1,
496 DWORD, arg2,
497 LPWSTR, arg3,
498 LPDWORD,arg4,
499 LPDWORD,arg5,
500 LPDWORD,arg6,
501 LPBYTE, arg7,
502 LPDWORD,arg8)
503{
504 char *astring;
505 LONG rc;
506
507 rc = _O32_RegEnumValue(ConvertKey(arg1),
508 arg2,
509 (char *)arg3,
510 arg4,
511 arg5,
512 arg6,
513 arg7,
514 arg8);
515 if(rc == ERROR_SUCCESS)
516 {
517 astring = (char *)malloc(*arg4);
518 strcpy(astring, (char *)arg3);
519 AsciiToUnicode(astring, arg3);
520 free(astring);
521 }
522 return(rc);
523}
524
525
526/*****************************************************************************
527 * Name :
528 * Purpose :
529 * Parameters:
530 * Variables :
531 * Result :
532 * Remark :
533 * Status : UNTESTED STUB
534 *
535 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
536 *****************************************************************************/
537
538ODINFUNCTION3(LONG,RegOpenKeyA,HKEY, arg1,
539 LPCSTR,arg2,
540 PHKEY, arg3)
541{
542 LONG rc;
543
544 dprintf(("RegOpenKey %s", arg2));
545
546 rc = _O32_RegOpenKey(ConvertKey(arg1),
547 arg2,
548 arg3);
549 if(rc)
550 *arg3 = 0;
551
552 return(rc);
553}
554
555
556/*****************************************************************************
557 * Name :
558 * Purpose :
559 * Parameters:
560 * Variables :
561 * Result :
562 * Remark :
563 * Status : UNTESTED STUB
564 *
565 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
566 *****************************************************************************/
567
568ODINFUNCTION3(LONG,RegOpenKeyW,HKEY, arg1,
569 LPCWSTR,arg2,
570 PHKEY, arg3)
571{
572 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
573 LONG rc;
574
575 rc = _O32_RegOpenKey(ConvertKey(arg1),
576 astring,
577 arg3);
578 if(rc)
579 *arg3 = 0;
580
581 FreeAsciiString(astring);
582 return(rc);
583}
584
585
586/*****************************************************************************
587 * Name :
588 * Purpose :
589 * Parameters:
590 * Variables :
591 * Result :
592 * Remark :
593 * Status : UNTESTED STUB
594 *
595 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
596 *****************************************************************************/
597
598ODINFUNCTION5(LONG,RegOpenKeyExA,HKEY, arg1,
599 LPCSTR,arg2,
600 DWORD, arg3,
601 REGSAM,arg4,
602 PHKEY, arg5)
603{
604 LONG rc;
605
606 dprintf(("RegOpenKeyEx %s", arg2));
607 rc = _O32_RegOpenKeyEx(ConvertKey(arg1),
608 arg2,
609 arg3,
610 arg4,
611 arg5);
612
613 //SvL: This fixes crashes in pmwinx.dll. (if an app doesn't check the
614 // return value and uses the whatever *arg5 contains)
615 if(rc)
616 *arg5 = 0;
617
618 return(rc);
619}
620
621
622/*****************************************************************************
623 * Name :
624 * Purpose :
625 * Parameters:
626 * Variables :
627 * Result :
628 * Remark :
629 * Status : UNTESTED STUB
630 *
631 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
632 *****************************************************************************/
633
634ODINFUNCTION5(LONG,RegOpenKeyExW,HKEY, arg1,
635 LPCWSTR,arg2,
636 DWORD, arg3,
637 REGSAM, arg4,
638 PHKEY, arg5)
639{
640 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
641 LONG rc;
642
643 rc = _O32_RegOpenKeyEx(ConvertKey(arg1),
644 astring,
645 arg3,
646 arg4,
647 arg5);
648 //SvL: This fixes crashes in pmwinx.dll. (if an app doesn't check the
649 // return value and uses the whatever *arg5 contains)
650 if(rc)
651 *arg5 = 0;
652
653 FreeAsciiString(astring);
654 return(rc);
655}
656
657
658/*****************************************************************************
659 * Name :
660 * Purpose :
661 * Parameters:
662 * Variables :
663 * Result :
664 * Remark :
665 * Status : UNTESTED STUB
666 *
667 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
668 *****************************************************************************/
669
670ODINFUNCTION12(LONG,RegQueryInfoKeyA,HKEY, arg1,
671 LPSTR, arg2,
672 LPDWORD, arg3,
673 LPDWORD, arg4,
674 LPDWORD, arg5,
675 LPDWORD, arg6,
676 LPDWORD, arg7,
677 LPDWORD, arg8,
678 LPDWORD, arg9,
679 LPDWORD, arg10,
680 LPDWORD, arg11,
681 LPFILETIME, arg12)
682{
683 return _O32_RegQueryInfoKey(ConvertKey(arg1),
684 arg2,
685 arg3,
686 arg4,
687 arg5,
688 arg6,
689 arg7,
690 arg8,
691 arg9,
692 arg10,
693 arg11,
694 arg12);
695}
696
697
698/*****************************************************************************
699 * Name :
700 * Purpose :
701 * Parameters:
702 * Variables :
703 * Result :
704 * Remark :
705 * Status : UNTESTED STUB
706 *
707 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
708 *****************************************************************************/
709
710ODINFUNCTION12(LONG,RegQueryInfoKeyW,HKEY, arg1,
711 LPWSTR, arg2,
712 LPDWORD, arg3,
713 LPDWORD, arg4,
714 LPDWORD, arg5,
715 LPDWORD, arg6,
716 LPDWORD, arg7,
717 LPDWORD, arg8,
718 LPDWORD, arg9,
719 LPDWORD, arg10,
720 LPDWORD, arg11,
721 LPFILETIME, arg12)
722{
723 char *astring;
724 LONG rc;
725
726 rc = _O32_RegQueryInfoKey(ConvertKey(arg1),
727 (char *)arg2,
728 arg3,
729 arg4,
730 arg5,
731 arg6,
732 arg7,
733 arg8,
734 arg9,
735 arg10,
736 arg11,
737 arg12);
738 if(rc == ERROR_SUCCESS)
739 {
740 if(*arg3) {
741 astring = (char *)malloc(*arg3);
742 strcpy(astring, (char *)arg2);
743 AsciiToUnicode(astring, arg2);
744 free(astring);
745 }
746 else *arg2 = 0;
747 }
748 return(rc);
749}
750
751
752/*****************************************************************************
753 * Name :
754 * Purpose :
755 * Parameters:
756 * Variables :
757 * Result :
758 * Remark :
759 * Status : UNTESTED STUB
760 *
761 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
762 *****************************************************************************/
763
764ODINFUNCTION4(LONG,RegQueryValueA,HKEY, arg1,
765 LPCSTR,arg2,
766 LPSTR, arg3,
767 PLONG, arg4)
768{
769 dprintf(("ADVAPI32:Registry key=%s\n",
770 arg2));
771 return _O32_RegQueryValue(ConvertKey(arg1),
772 arg2,
773 arg3,
774 arg4);
775}
776
777
778/*****************************************************************************
779 * Name :
780 * Purpose :
781 * Parameters:
782 * Variables :
783 * Result :
784 * Remark :
785 * Status : UNTESTED STUB
786 *
787 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
788 *****************************************************************************/
789
790ODINFUNCTION4(LONG,RegQueryValueW,HKEY, hkey,
791 LPCWSTR,lpszSubKey,
792 LPWSTR, lpszValue,
793 PLONG, pcbValue)
794{
795 char *astring1 = UnicodeToAsciiString((LPWSTR)lpszSubKey);
796 char *astring2;
797 LONG rc;
798
799 rc = _O32_RegQueryValue(ConvertKey(hkey),
800 astring1,
801 (char *)lpszValue,
802 pcbValue);
803 if(rc == ERROR_SUCCESS)
804 {
805 astring2 = (char *)malloc(*pcbValue);
806 strcpy(astring2, (char *)lpszValue);
807 AsciiToUnicode(astring2, lpszValue);
808 free(astring2);
809 }
810 return(rc);
811}
812
813
814/*****************************************************************************
815 * Name :
816 * Purpose :
817 * Parameters:
818 * Variables :
819 * Result :
820 * Remark :
821 * Status : UNTESTED STUB
822 *
823 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
824 *****************************************************************************/
825
826ODINFUNCTION6(LONG,RegQueryValueExA,HKEY, arg1,
827 LPSTR, arg2,
828 LPDWORD,arg3,
829 LPDWORD,arg4,
830 LPBYTE, arg5,
831 LPDWORD,arg6)
832{
833 dprintf(("ADVAPI32:Registry key=%s\n",
834 arg2));
835 return _O32_RegQueryValueEx(ConvertKey(arg1),
836 arg2,
837 arg3,
838 arg4,
839 arg5,
840 arg6);
841}
842
843
844/*****************************************************************************
845 * Name :
846 * Purpose :
847 * Parameters:
848 * Variables :
849 * Result :
850 * Remark : TODO: DOESN'T WORK FOR STRING DATA!!
851 * Status : UNTESTED STUB
852 *
853 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
854 *****************************************************************************/
855
856ODINFUNCTION6(LONG,RegQueryValueExW,HKEY, arg1,
857 LPWSTR, arg2,
858 LPDWORD,arg3,
859 LPDWORD,arg4,
860 LPBYTE, arg5,
861 LPDWORD,arg6)
862{
863 char *astring = UnicodeToAsciiString(arg2);
864 LONG rc;
865
866 rc = _O32_RegQueryValueEx(ConvertKey(arg1),
867 astring,
868 arg3,
869 arg4,
870 arg5,
871 arg6);
872 FreeAsciiString(astring);
873 return(rc);
874}
875
876
877/*****************************************************************************
878 * Name :
879 * Purpose :
880 * Parameters:
881 * Variables :
882 * Result :
883 * Remark :
884 * Status : UNTESTED STUB
885 *
886 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
887 *****************************************************************************/
888
889ODINFUNCTION5(LONG,RegSetValueA,HKEY, hkey,
890 LPCSTR,lpSubKey,
891 DWORD, dwType,
892 LPCSTR,lpData,
893 DWORD, cbData)
894{
895 //SvL: 8-11-'97: Bugfix: crash in pmwinx if size == 0 and string is large
896 if(cbData == 0)
897 cbData = strlen(lpData);
898
899 return(_O32_RegSetValue(ConvertKey(hkey),
900 lpSubKey,
901 dwType,
902 lpData,
903 cbData));
904}
905
906
907/*****************************************************************************
908 * Name :
909 * Purpose :
910 * Parameters:
911 * Variables :
912 * Result :
913 * Remark :
914 * Status : UNTESTED STUB
915 *
916 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
917 *****************************************************************************/
918
919ODINFUNCTION5(LONG,RegSetValueW,HKEY, hkey,
920 LPCWSTR,lpSubKey,
921 DWORD, dwType,
922 LPCWSTR,lpData,
923 DWORD, cbData)
924{
925 char *astring1 = UnicodeToAsciiString((LPWSTR)lpSubKey);
926 char *astring2 = UnicodeToAsciiString((LPWSTR)lpData);
927 LONG rc;
928
929 //SvL: 8-11-'97: Bugfix: crash in pmwinx if size == 0 and string is large
930 if(cbData == 0)
931 cbData = strlen(astring2);
932
933 rc = _O32_RegSetValue(ConvertKey(hkey),
934 astring1,
935 dwType,
936 astring2,
937 cbData);
938
939 FreeAsciiString(astring1);
940 FreeAsciiString(astring2);
941 return(rc);
942}
943
944
945/*****************************************************************************
946 * Name :
947 * Purpose :
948 * Parameters:
949 * Variables :
950 * Result :
951 * Remark : TODO:Check for string length here too?
952 * Status : UNTESTED STUB
953 *
954 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
955 *****************************************************************************/
956
957ODINFUNCTION6(LONG,RegSetValueExA,HKEY, arg1,
958 LPSTR, arg2,
959 DWORD, arg3,
960 DWORD, arg4,
961 BYTE*, arg5,
962 DWORD, arg6)
963{
964 return _O32_RegSetValueEx(ConvertKey(arg1),
965 arg2,
966 arg3,
967 arg4,
968 arg5,
969 arg6);
970}
971
972
973/*****************************************************************************
974 * Name :
975 * Purpose :
976 * Parameters:
977 * Variables :
978 * Result :
979 * Remark : TODO:Check for string length here too?
980 * Status : UNTESTED STUB
981 *
982 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
983 *****************************************************************************/
984
985ODINFUNCTION6(LONG,RegSetValueExW,HKEY, arg1,
986 LPWSTR,arg2,
987 DWORD, arg3,
988 DWORD, arg4,
989 BYTE*, arg5,
990 DWORD, arg6)
991{
992 char *astring = UnicodeToAsciiString(arg2);
993 LONG rc;
994
995 dprintf(("ADVAPI32: RegSetValueExW(%08xh,%s,%08xh,%08xh,%08xh,%08xh)\n",
996 arg1,
997 astring,
998 arg3,
999 arg4,
1000 arg5,
1001 arg6));
1002
1003 rc = _O32_RegSetValueEx(ConvertKey(arg1),
1004 astring,
1005 arg3,
1006 arg4,
1007 arg5,
1008 arg6);
1009 FreeAsciiString(astring);
1010 return(rc);
1011}
1012
1013
1014/*****************************************************************************
1015 * Name :
1016 * Purpose :
1017 * Parameters:
1018 * Variables :
1019 * Result :
1020 * Remark :
1021 * Status : UNTESTED STUB
1022 *
1023 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1024 *****************************************************************************/
1025
1026ODINFUNCTION1(LONG,RegFlushKey,HKEY,hkey)
1027{
1028 dprintf(("ADVAPI32: RegFlushKey not implemented yet."));
1029
1030 return(ERROR_SUCCESS);
1031}
1032
1033
1034/*****************************************************************************
1035 * Name : RegConnectRegistryA
1036 * Purpose : The RegConnectRegistry function establishes a connection to a
1037 * predefined registry handle on another computer.
1038 * Parameters: LPTSTR lpszComputerName address of name of remote computer
1039 * HKEY hKey predefined registry handle
1040 * PHKEY phkResult address of buffer for remote registry handle
1041 * Variables :
1042 * Result :
1043 * Remark :
1044 * Status : UNTESTED STUB
1045 *
1046 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1047 *****************************************************************************/
1048
1049ODINFUNCTION3(LONG,RegConnectRegistryA,LPCSTR,lpszComputerName,
1050 HKEY, hKey,
1051 PHKEY, phkResult)
1052{
1053 char szLocalName[256];
1054 DWORD dwNameLength = sizeof(szLocalName)-2;
1055
1056 szLocalName[0] = '\\';
1057 szLocalName[1] = '\\';
1058 GetComputerNameA(szLocalName+2, &dwNameLength);
1059
1060 dprintf(("ADVAPI32: RegConnectRegistryA(%s,local %s) not implemented yet.\n",
1061 lpszComputerName,
1062 szLocalName));
1063
1064 /* local registry ? */
1065 if ( ( lpszComputerName == NULL) ||
1066 (strcmp(szLocalName, lpszComputerName) == 0 ) )
1067 {
1068 /* @@@PH experimental !!! */
1069 *phkResult = hKey;
1070
1071 return (NO_ERROR);
1072 }
1073
1074 return (ERROR_ACCESS_DENIED);
1075}
1076
1077
1078/*****************************************************************************
1079 * Name : RegConnectRegistryW
1080 * Purpose : The RegConnectRegistry function establishes a connection to a
1081 * predefined registry handle on another computer.
1082 * Parameters: LPWSTR lpszComputerName address of name of remote computer
1083 * HKEY hKey predefined registry handle
1084 * PHKEY phkResult address of buffer for remote registry handle
1085 * Variables :
1086 * Result :
1087 * Remark :
1088 * Status : UNTESTED STUB
1089 *
1090 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1091 *****************************************************************************/
1092
1093ODINFUNCTION3(LONG,RegConnectRegistryW,LPCWSTR,lpszComputerName,
1094 HKEY, hKey,
1095 PHKEY, phkResult)
1096{
1097 /* corresponding ascii string */
1098 LPSTR pszAscii;
1099 LONG rc; /* returncode from call to ascii version of this function */
1100
1101 dprintf(("ADVAPI32: RegConnectRegistryW not implemented yet."));
1102
1103 if (lpszComputerName != NULL)
1104 pszAscii = UnicodeToAsciiString((LPWSTR)lpszComputerName);
1105 else
1106 pszAscii = NULL;
1107
1108 rc = RegConnectRegistryA(pszAscii,
1109 hKey,
1110 phkResult);
1111
1112 if (pszAscii != NULL)
1113 FreeAsciiString(pszAscii);
1114
1115 return (rc); /* OK */
1116}
1117
1118
1119/*****************************************************************************
1120 * Name : RegGetKeySecurity
1121 * Purpose : The RegGetKeySecurity function retrieves a copy of the security
1122 * descriptor protecting the specified open registry key.
1123 * Parameters: HKEY hKey open handle of key to set
1124 * SECURITY_INFORMATION SecInf descriptor contents
1125 * PSECURITY_DESCRIPTOR pSecDesc address of descriptor for key
1126 * LPDWORD lpcbSecDesc address of size of buffer and descriptor
1127 * Variables :
1128 * Result :
1129 * Remark :
1130 * Status : UNTESTED STUB
1131 *
1132 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1133 *****************************************************************************/
1134
1135ODINFUNCTION4(LONG,RegGetKeySecurity,HKEY, hKey,
1136 SECURITY_INFORMATION, SecInf,
1137 PSECURITY_DESCRIPTOR, pSecDesc,
1138 LPDWORD, lpcbSecDesc)
1139{
1140 dprintf(("ADVAPI32: RegGetKeySecurity not implemented.\n"));
1141
1142 return (ERROR_ACCESS_DENIED); /* signal failure */
1143}
1144
1145
1146/*****************************************************************************
1147 * Name : RegLoadKeyA
1148 * Purpose : The RegLoadKey function creates a subkey under HKEY_USER or
1149 * HKEY_LOCAL_MACHINE and stores registration information from a
1150 * specified file into that subkey. This registration information
1151 * is in the form of a hive. A hive is a discrete body of keys,
1152 * subkeys, and values that is rooted at the top of the registry
1153 * hierarchy. A hive is backed by a single file and .LOG file.
1154 * Parameters: HKEY hKey handle of open key
1155 * LPCSTR lpszSubKey address of name of subkey
1156 * LPCSTR lpszFile address of filename for registry information
1157 * Variables :
1158 * Result :
1159 * Remark :
1160 * Status : UNTESTED STUB
1161 *
1162 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1163 *****************************************************************************/
1164
1165ODINFUNCTION3(LONG,RegLoadKeyA,HKEY, hKey,
1166 LPCSTR,lpszSubKey,
1167 LPCSTR,lpszFile)
1168{
1169 dprintf(("ADVAPI32: RegLoadKeyA not implemented.\n"));
1170
1171 return (ERROR_ACCESS_DENIED); /* signal failure */
1172}
1173
1174
1175/*****************************************************************************
1176 * Name : RegLoadKeyW
1177 * Purpose : The RegLoadKey function creates a subkey under HKEY_USER or
1178 * HKEY_LOCAL_MACHINE and stores registration information from a
1179 * specified file into that subkey. This registration information
1180 * is in the form of a hive. A hive is a discrete body of keys,
1181 * subkeys, and values that is rooted at the top of the registry
1182 * hierarchy. A hive is backed by a single file and .LOG file.
1183 * Parameters: HKEY hKey handle of open key
1184 * LPCWSTR lpszSubKey address of name of subkey
1185 * LPCWSTR lpszFile address of filename for registry information
1186 * Variables :
1187 * Result :
1188 * Remark :
1189 * Status : UNTESTED STUB
1190 *
1191 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1192 *****************************************************************************/
1193
1194ODINFUNCTION3(LONG,RegLoadKeyW,HKEY, hKey,
1195 LPCWSTR,lpszSubKey,
1196 LPCWSTR,lpszFile)
1197{
1198 dprintf(("ADVAPI32: RegLoadKeyW not implemented.\n"));
1199
1200 return (ERROR_ACCESS_DENIED); /* signal failure */
1201}
1202
1203
1204/*****************************************************************************
1205 * Name : RegQueryMultipleValuesA
1206 * Purpose : The RegQueryMultipleValues function retrieves the type and data
1207 * for a list of value names associated with an open registry key.
1208 * Parameters: HKEY hKey handle of key to query
1209 * PVALENT val_list address of array of value entry structures
1210 * DWORD num_vals size of array of value entry structures
1211 * LPTSTR lpValueBuf address of buffer for value information
1212 * LPDWORD ldwTotsize address of size of value buffer
1213 * Variables :
1214 * Result :
1215 * Remark :
1216 * Status : UNTESTED STUB
1217 *
1218 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1219 *****************************************************************************/
1220
1221ODINFUNCTION5(LONG,RegQueryMultipleValuesA,HKEY, hKey,
1222 PVALENTA,val_list,
1223 DWORD, num_vals,
1224 LPTSTR, lpValueBuf,
1225 LPDWORD, ldwTotsize)
1226{
1227 dprintf(("ADVAPI32: RegQueryMultipleValuesA not implemented.\n"));
1228
1229 return (ERROR_ACCESS_DENIED); /* signal failure */
1230}
1231
1232
1233/*****************************************************************************
1234 * Name : RegQueryMultipleValuesW
1235 * Purpose : The RegQueryMultipleValues function retrieves the type and data
1236 * for a list of value names associated with an open registry key.
1237 * Parameters: HKEY hKey handle of key to query
1238 * PVALENT val_list address of array of value entry structures
1239 * DWORD num_vals size of array of value entry structures
1240 * LPWSTR lpValueBuf address of buffer for value information
1241 * LPDWORD ldwTotsize address of size of value buffer
1242 * Variables :
1243 * Result :
1244 * Remark :
1245 * Status : UNTESTED STUB
1246 *
1247 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1248 *****************************************************************************/
1249
1250ODINFUNCTION5(LONG,RegQueryMultipleValuesW,HKEY, hKey,
1251 PVALENTW,val_list,
1252 DWORD, num_vals,
1253 LPWSTR, lpValueBuf,
1254 LPDWORD, ldwTotsize)
1255{
1256 dprintf(("ADVAPI32: RegQueryMultipleValuesW not implemented.\n"));
1257
1258 return (ERROR_ACCESS_DENIED); /* signal failure */
1259}
1260
1261
1262/*****************************************************************************
1263 * Name : RegRemapPreDefKey
1264 * Purpose :
1265 * Parameters:
1266 * Variables :
1267 * Result :
1268 * Remark :
1269 * Status : UNTESTED STUB
1270 *
1271 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1272 *****************************************************************************/
1273
1274#if 0
1275ODINFUNCTION1(LONG,RegRemapPreDefKey,HKEY,hKey)
1276{
1277 dprintf(("ADVAPI32: RegRemapPreDefKey not implemented.\n"));
1278
1279 return (ERROR_ACCESS_DENIED); /* signal failure */
1280}
1281#endif
1282
1283
1284/*****************************************************************************
1285 * Name : RegReplaceKeyA
1286 * Purpose : The RegReplaceKey function replaces the file backing a key and
1287 * all its subkeys with another file, so that when the system is
1288 * next started, the key and subkeys will have the values stored in the new file.
1289 * Parameters: HKEY hKey handle of open key
1290 * LPCSTR lpSubKey address of name of subkey
1291 * LPCSTR lpNewFile address of filename for file with new data
1292 * LPCSTR lpOldFile address of filename for backup file
1293 * Variables :
1294 * Result :
1295 * Remark :
1296 * Status : UNTESTED STUB
1297 *
1298 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1299 *****************************************************************************/
1300
1301ODINFUNCTION4(LONG,RegReplaceKeyA,HKEY, hKey,
1302 LPCSTR,lpSubKey,
1303 LPCSTR,lpNewFile,
1304 LPCSTR,lpOldFile)
1305{
1306 dprintf(("ADVAPI32: RegReplaceKeyA not implemented.\n"));
1307
1308 return (ERROR_ACCESS_DENIED); /* signal failure */
1309}
1310
1311
1312/*****************************************************************************
1313 * Name : RegReplaceKeyW
1314 * Purpose : The RegReplaceKey function replaces the file backing a key and
1315 * all its subkeys with another file, so that when the system is
1316 * next started, the key and subkeys will have the values stored in the new file.
1317 * Parameters: HKEY hKey handle of open key
1318 * LPCWSTR lpSubKey address of name of subkey
1319 * LPCWSTR lpNewFile address of filename for file with new data
1320 * LPCWSTR lpOldFile address of filename for backup file
1321 * Variables :
1322 * Result :
1323 * Remark :
1324 * Status : UNTESTED STUB
1325 *
1326 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1327 *****************************************************************************/
1328
1329ODINFUNCTION4(LONG,RegReplaceKeyW,HKEY, hKey,
1330 LPCWSTR,lpSubKey,
1331 LPCWSTR,lpNewFile,
1332 LPCWSTR,lpOldFile)
1333{
1334 dprintf(("ADVAPI32: RegReplaceKeyW not implemented.\n"));
1335
1336 return (ERROR_ACCESS_DENIED); /* signal failure */
1337}
1338
1339
1340/*****************************************************************************
1341 * Name : RegRestoreKeyA
1342 * Purpose : The RegRestoreKey function reads the registry information in a
1343 * specified file and copies it over the specified key. This
1344 * registry information may be in the form of a key and multiple
1345 * levels of subkeys.
1346 * Parameters: HKEY hKey handle of key where restore begins
1347 * LPCSTR lpszFile address of filename containing saved tree
1348 * DWORD fdw optional flags
1349 * Variables :
1350 * Result :
1351 * Remark :
1352 * Status : UNTESTED STUB
1353 *
1354 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1355 *****************************************************************************/
1356
1357ODINFUNCTION3(LONG,RegRestoreKeyA,HKEY, hKey,
1358 LPCSTR,lpszFile,
1359 DWORD, fdw)
1360{
1361 dprintf(("ADVAPI32: RegRestoreKeyA not implemented.\n"));
1362
1363 return (ERROR_ACCESS_DENIED); /* signal failure */
1364}
1365
1366
1367/*****************************************************************************
1368 * Name : RegRestoreKeyW
1369 * Purpose : The RegRestoreKey function reads the registry information in a
1370 * specified file and copies it over the specified key. This
1371 * registry information may be in the form of a key and multiple
1372 * levels of subkeys.
1373 * Parameters: HKEY hKey handle of key where restore begins
1374 * LPCWSTR lpszFile address of filename containing saved tree
1375 * DWORD fdw optional flags
1376 * Variables :
1377 * Result :
1378 * Remark :
1379 * Status : UNTESTED STUB
1380 *
1381 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1382 *****************************************************************************/
1383
1384ODINFUNCTION3(LONG,RegRestoreKeyW,HKEY, hKey,
1385 LPCWSTR, lpszFile,
1386 DWORD, fdw)
1387{
1388 dprintf(("ADVAPI32: RegRestoreKeyW not implemented.\n"));
1389
1390 return (ERROR_ACCESS_DENIED); /* signal failure */
1391}
1392
1393
1394/*****************************************************************************
1395 * Name : RegSaveKeyA
1396 * Purpose : The RegSaveKey function saves the specified key and all of its
1397 * subkeys and values to a new file.
1398 * Parameters: HKEY hKey handle of key where save begins
1399 * LPCSTR lpszFile address of filename to save to
1400 * LPSECURITY_ATTRIBUTES lpsa address of security structure
1401 * Variables :
1402 * Result :
1403 * Remark :
1404 * Status : UNTESTED STUB
1405 *
1406 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1407 *****************************************************************************/
1408
1409ODINFUNCTION3(LONG,RegSaveKeyA,HKEY, hKey,
1410 LPCSTR, lpszFile,
1411 LPSECURITY_ATTRIBUTES,lpsa)
1412{
1413 dprintf(("ADVAPI32: RegSaveKeyA not implemented.\n"));
1414
1415 return (ERROR_ACCESS_DENIED); /* signal failure */
1416}
1417
1418
1419/*****************************************************************************
1420 * Name : RegSaveKeyW
1421 * Purpose : The RegSaveKey function saves the specified key and all of its
1422 * subkeys and values to a new file.
1423 * Parameters: HKEY hKey handle of key where save begins
1424 * LPCWSTR lpszFile address of filename to save to
1425 * LPSECURITY_ATTRIBUTES lpsa address of security structure
1426 * Variables :
1427 * Result :
1428 * Remark :
1429 * Status : UNTESTED STUB
1430 *
1431 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1432 *****************************************************************************/
1433
1434ODINFUNCTION3(LONG,RegSaveKeyW,HKEY, hKey,
1435 LPCWSTR, lpszFile,
1436 LPSECURITY_ATTRIBUTES,lpsa)
1437{
1438 dprintf(("ADVAPI32: RegSaveKeyW not implemented.\n"));
1439
1440 return (ERROR_ACCESS_DENIED); /* signal failure */
1441}
1442
1443
1444/*****************************************************************************
1445 * Name : RegSetKeySecurity
1446 * Purpose : The RegSetKeySecurity function sets the security of an open registry key.
1447 * Parameters: HKEY hKey open handle of key to set
1448 * SECURITY_INFORMATION si descriptor contents
1449 * PSECURITY_DESCRIPTOR psd address of descriptor for key
1450 * Variables :
1451 * Result :
1452 * Remark :
1453 * Status : UNTESTED STUB
1454 *
1455 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1456 *****************************************************************************/
1457
1458ODINFUNCTION3(LONG,RegSetKeySecurity,HKEY, hKey,
1459 SECURITY_INFORMATION,si,
1460 PSECURITY_DESCRIPTOR,psd)
1461{
1462 dprintf(("ADVAPI32: RegSetKeySecurity not implemented.\n"));
1463
1464 return (ERROR_ACCESS_DENIED); /* signal failure */
1465}
1466
1467
1468/*****************************************************************************
1469 * Name : RegUnLoadKeyA
1470 * Purpose : The RegUnLoadKey function unloads the specified key and subkeys from the registry.
1471 * Parameters: HKEY hKey handle of open key
1472 * LPCSTR lpszSubKey address of name of subkey to unload
1473 * Variables :
1474 * Result :
1475 * Remark :
1476 * Status : UNTESTED STUB
1477 *
1478 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1479 *****************************************************************************/
1480
1481ODINFUNCTION2(LONG,RegUnLoadKeyA,HKEY, hKey,
1482 LPCSTR, lpszSubKey)
1483{
1484 dprintf(("ADVAPI32: RegUnLoadKeyA not implemented.\n"));
1485
1486 return (ERROR_ACCESS_DENIED); /* signal failure */
1487}
1488
1489
1490/*****************************************************************************
1491 * Name : RegUnLoadKeyW
1492 * Purpose : The RegUnLoadKey function unloads the specified key and subkeys from the registry.
1493 * Parameters: HKEY hKey handle of open key
1494 * LPCWSTR lpszSubKey address of name of subkey to unload
1495 * Variables :
1496 * Result :
1497 * Remark :
1498 * Status : UNTESTED STUB
1499 *
1500 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1501 *****************************************************************************/
1502
1503ODINFUNCTION2(LONG,RegUnLoadKeyW,HKEY, hKey,
1504 LPCWSTR, lpszSubKey)
1505{
1506 dprintf(("ADVAPI32: RegUnLoadKeyW not implemented.\n"));
1507
1508 return (ERROR_ACCESS_DENIED); /* signal failure */
1509}
1510
1511
1512/*****************************************************************************
1513 * Name : RegNotifyChangeKeyValue
1514 * Purpose :
1515 * Parameters: HKEY hKey handle of open key
1516 * LPCWSTR lpszSubKey address of name of subkey to unload
1517 * Variables :
1518 * Result :
1519 * Remark :
1520 * Status : UNTESTED STUB
1521 *
1522 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1523 *****************************************************************************/
1524
1525ODINFUNCTION5(LONG,RegNotifyChangeKeyValue,HKEY, hKey,
1526 BOOL, bWatchSubtree,
1527 DWORD, dwNotifyFilter,
1528 HANDLE,hEvent,
1529 BOOL, fAsynchronus)
1530{
1531 dprintf(("ADVAPI32: RegNotifyChangeKeyValue() not implemented.\n"));
1532
1533 return ERROR_ACCESS_DENIED;
1534}
1535
Note: See TracBrowser for help on using the repository browser.