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

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

added extra logging

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