source: trunk/src/advapi32/registry.cpp@ 1296

Last change on this file since 1296 was 1296, checked in by phaller, 26 years ago

Fix: RegConnectRegistry slightly improved.

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