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

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

added extra logging

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