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

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

RegQueryInfoKeyW fix

File size: 47.9 KB
Line 
1/* $Id: registry.cpp,v 1.7 1999-12-01 10:48:16 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 if(*arg3) {
735 astring = (char *)malloc(*arg3);
736 strcpy(astring, (char *)arg2);
737 AsciiToUnicode(astring, arg2);
738 free(astring);
739 }
740 else *arg2 = 0;
741 }
742 return(rc);
743}
744
745
746/*****************************************************************************
747 * Name :
748 * Purpose :
749 * Parameters:
750 * Variables :
751 * Result :
752 * Remark :
753 * Status : UNTESTED STUB
754 *
755 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
756 *****************************************************************************/
757
758ODINFUNCTION4(LONG,RegQueryValueA,HKEY, arg1,
759 LPCSTR,arg2,
760 LPSTR, arg3,
761 PLONG, arg4)
762{
763 dprintf(("ADVAPI32:Registry key=%s\n",
764 arg2));
765 return _O32_RegQueryValue(ConvertKey(arg1),
766 arg2,
767 arg3,
768 arg4);
769}
770
771
772/*****************************************************************************
773 * Name :
774 * Purpose :
775 * Parameters:
776 * Variables :
777 * Result :
778 * Remark :
779 * Status : UNTESTED STUB
780 *
781 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
782 *****************************************************************************/
783
784ODINFUNCTION4(LONG,RegQueryValueW,HKEY, hkey,
785 LPCWSTR,lpszSubKey,
786 LPWSTR, lpszValue,
787 PLONG, pcbValue)
788{
789 char *astring1 = UnicodeToAsciiString((LPWSTR)lpszSubKey);
790 char *astring2;
791 LONG rc;
792
793 rc = _O32_RegQueryValue(ConvertKey(hkey),
794 astring1,
795 (char *)lpszValue,
796 pcbValue);
797 if(rc == ERROR_SUCCESS)
798 {
799 astring2 = (char *)malloc(*pcbValue);
800 strcpy(astring2, (char *)lpszValue);
801 AsciiToUnicode(astring2, lpszValue);
802 free(astring2);
803 }
804 return(rc);
805}
806
807
808/*****************************************************************************
809 * Name :
810 * Purpose :
811 * Parameters:
812 * Variables :
813 * Result :
814 * Remark :
815 * Status : UNTESTED STUB
816 *
817 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
818 *****************************************************************************/
819
820ODINFUNCTION6(LONG,RegQueryValueExA,HKEY, arg1,
821 LPSTR, arg2,
822 LPDWORD,arg3,
823 LPDWORD,arg4,
824 LPBYTE, arg5,
825 LPDWORD,arg6)
826{
827 dprintf(("ADVAPI32:Registry key=%s\n",
828 arg2));
829 return _O32_RegQueryValueEx(ConvertKey(arg1),
830 arg2,
831 arg3,
832 arg4,
833 arg5,
834 arg6);
835}
836
837
838/*****************************************************************************
839 * Name :
840 * Purpose :
841 * Parameters:
842 * Variables :
843 * Result :
844 * Remark : TODO: DOESN'T WORK FOR STRING DATA!!
845 * Status : UNTESTED STUB
846 *
847 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
848 *****************************************************************************/
849
850ODINFUNCTION6(LONG,RegQueryValueExW,HKEY, arg1,
851 LPWSTR, arg2,
852 LPDWORD,arg3,
853 LPDWORD,arg4,
854 LPBYTE, arg5,
855 LPDWORD,arg6)
856{
857 char *astring = UnicodeToAsciiString(arg2);
858 LONG rc;
859
860 rc = _O32_RegQueryValueEx(ConvertKey(arg1),
861 astring,
862 arg3,
863 arg4,
864 arg5,
865 arg6);
866 FreeAsciiString(astring);
867 return(rc);
868}
869
870
871/*****************************************************************************
872 * Name :
873 * Purpose :
874 * Parameters:
875 * Variables :
876 * Result :
877 * Remark :
878 * Status : UNTESTED STUB
879 *
880 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
881 *****************************************************************************/
882
883ODINFUNCTION5(LONG,RegSetValueA,HKEY, hkey,
884 LPCSTR,lpSubKey,
885 DWORD, dwType,
886 LPCSTR,lpData,
887 DWORD, cbData)
888{
889 //SvL: 8-11-'97: Bugfix: crash in pmwinx if size == 0 and string is large
890 if(cbData == 0)
891 cbData = strlen(lpData);
892
893 return(_O32_RegSetValue(ConvertKey(hkey),
894 lpSubKey,
895 dwType,
896 lpData,
897 cbData));
898}
899
900
901/*****************************************************************************
902 * Name :
903 * Purpose :
904 * Parameters:
905 * Variables :
906 * Result :
907 * Remark :
908 * Status : UNTESTED STUB
909 *
910 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
911 *****************************************************************************/
912
913ODINFUNCTION5(LONG,RegSetValueW,HKEY, hkey,
914 LPCWSTR,lpSubKey,
915 DWORD, dwType,
916 LPCWSTR,lpData,
917 DWORD, cbData)
918{
919 char *astring1 = UnicodeToAsciiString((LPWSTR)lpSubKey);
920 char *astring2 = UnicodeToAsciiString((LPWSTR)lpData);
921 LONG rc;
922
923 //SvL: 8-11-'97: Bugfix: crash in pmwinx if size == 0 and string is large
924 if(cbData == 0)
925 cbData = strlen(astring2);
926
927 rc = _O32_RegSetValue(ConvertKey(hkey),
928 astring1,
929 dwType,
930 astring2,
931 cbData);
932
933 FreeAsciiString(astring1);
934 FreeAsciiString(astring2);
935 return(rc);
936}
937
938
939/*****************************************************************************
940 * Name :
941 * Purpose :
942 * Parameters:
943 * Variables :
944 * Result :
945 * Remark : TODO:Check for string length here too?
946 * Status : UNTESTED STUB
947 *
948 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
949 *****************************************************************************/
950
951ODINFUNCTION6(LONG,RegSetValueExA,HKEY, arg1,
952 LPSTR, arg2,
953 DWORD, arg3,
954 DWORD, arg4,
955 BYTE*, arg5,
956 DWORD, arg6)
957{
958 return _O32_RegSetValueEx(ConvertKey(arg1),
959 arg2,
960 arg3,
961 arg4,
962 arg5,
963 arg6);
964}
965
966
967/*****************************************************************************
968 * Name :
969 * Purpose :
970 * Parameters:
971 * Variables :
972 * Result :
973 * Remark : TODO:Check for string length here too?
974 * Status : UNTESTED STUB
975 *
976 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
977 *****************************************************************************/
978
979ODINFUNCTION6(LONG,RegSetValueExW,HKEY, arg1,
980 LPWSTR,arg2,
981 DWORD, arg3,
982 DWORD, arg4,
983 BYTE*, arg5,
984 DWORD, arg6)
985{
986 char *astring = UnicodeToAsciiString(arg2);
987 LONG rc;
988
989 dprintf(("ADVAPI32: RegSetValueExW(%08xh,%s,%08xh,%08xh,%08xh,%08xh)\n",
990 arg1,
991 astring,
992 arg3,
993 arg4,
994 arg5,
995 arg6));
996
997 rc = _O32_RegSetValueEx(ConvertKey(arg1),
998 astring,
999 arg3,
1000 arg4,
1001 arg5,
1002 arg6);
1003 FreeAsciiString(astring);
1004 return(rc);
1005}
1006
1007
1008/*****************************************************************************
1009 * Name :
1010 * Purpose :
1011 * Parameters:
1012 * Variables :
1013 * Result :
1014 * Remark :
1015 * Status : UNTESTED STUB
1016 *
1017 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1018 *****************************************************************************/
1019
1020ODINFUNCTION1(LONG,RegFlushKey,HKEY,hkey)
1021{
1022 dprintf(("ADVAPI32: RegFlushKey not implemented yet."));
1023
1024 return(ERROR_SUCCESS);
1025}
1026
1027
1028/*****************************************************************************
1029 * Name : RegConnectRegistryA
1030 * Purpose : The RegConnectRegistry function establishes a connection to a
1031 * predefined registry handle on another computer.
1032 * Parameters: LPTSTR lpszComputerName address of name of remote computer
1033 * HKEY hKey predefined registry handle
1034 * PHKEY phkResult address of buffer for remote registry handle
1035 * Variables :
1036 * Result :
1037 * Remark :
1038 * Status : UNTESTED STUB
1039 *
1040 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1041 *****************************************************************************/
1042
1043ODINFUNCTION3(LONG,RegConnectRegistryA,LPCSTR,lpszComputerName,
1044 HKEY, hKey,
1045 PHKEY, phkResult)
1046{
1047 char szLocalName[256];
1048 DWORD dwNameLength = sizeof(szLocalName)-2;
1049
1050 szLocalName[0] = '\\';
1051 szLocalName[1] = '\\';
1052 GetComputerNameA(szLocalName+2, &dwNameLength);
1053
1054 dprintf(("ADVAPI32: RegConnectRegistryA(%s,local %s) not implemented yet.\n",
1055 lpszComputerName,
1056 szLocalName));
1057
1058 /* local registry ? */
1059 if ( ( lpszComputerName == NULL) ||
1060 (strcmp(szLocalName, lpszComputerName) == 0 ) )
1061 {
1062 /* @@@PH experimental !!! */
1063 *phkResult = hKey;
1064
1065 return (NO_ERROR);
1066 }
1067
1068 return (ERROR_ACCESS_DENIED);
1069}
1070
1071
1072/*****************************************************************************
1073 * Name : RegConnectRegistryW
1074 * Purpose : The RegConnectRegistry function establishes a connection to a
1075 * predefined registry handle on another computer.
1076 * Parameters: LPWSTR lpszComputerName address of name of remote computer
1077 * HKEY hKey predefined registry handle
1078 * PHKEY phkResult address of buffer for remote registry handle
1079 * Variables :
1080 * Result :
1081 * Remark :
1082 * Status : UNTESTED STUB
1083 *
1084 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1085 *****************************************************************************/
1086
1087ODINFUNCTION3(LONG,RegConnectRegistryW,LPCWSTR,lpszComputerName,
1088 HKEY, hKey,
1089 PHKEY, phkResult)
1090{
1091 /* corresponding ascii string */
1092 LPSTR pszAscii;
1093 LONG rc; /* returncode from call to ascii version of this function */
1094
1095 dprintf(("ADVAPI32: RegConnectRegistryW not implemented yet."));
1096
1097 if (lpszComputerName != NULL)
1098 pszAscii = UnicodeToAsciiString((LPWSTR)lpszComputerName);
1099 else
1100 pszAscii = NULL;
1101
1102 rc = RegConnectRegistryA(pszAscii,
1103 hKey,
1104 phkResult);
1105
1106 if (pszAscii != NULL)
1107 FreeAsciiString(pszAscii);
1108
1109 return (rc); /* OK */
1110}
1111
1112
1113/*****************************************************************************
1114 * Name : RegGetKeySecurity
1115 * Purpose : The RegGetKeySecurity function retrieves a copy of the security
1116 * descriptor protecting the specified open registry key.
1117 * Parameters: HKEY hKey open handle of key to set
1118 * SECURITY_INFORMATION SecInf descriptor contents
1119 * PSECURITY_DESCRIPTOR pSecDesc address of descriptor for key
1120 * LPDWORD lpcbSecDesc address of size of buffer and descriptor
1121 * Variables :
1122 * Result :
1123 * Remark :
1124 * Status : UNTESTED STUB
1125 *
1126 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1127 *****************************************************************************/
1128
1129ODINFUNCTION4(LONG,RegGetKeySecurity,HKEY, hKey,
1130 SECURITY_INFORMATION, SecInf,
1131 PSECURITY_DESCRIPTOR, pSecDesc,
1132 LPDWORD, lpcbSecDesc)
1133{
1134 dprintf(("ADVAPI32: RegGetKeySecurity not implemented.\n"));
1135
1136 return (ERROR_ACCESS_DENIED); /* signal failure */
1137}
1138
1139
1140/*****************************************************************************
1141 * Name : RegLoadKeyA
1142 * Purpose : The RegLoadKey function creates a subkey under HKEY_USER or
1143 * HKEY_LOCAL_MACHINE and stores registration information from a
1144 * specified file into that subkey. This registration information
1145 * is in the form of a hive. A hive is a discrete body of keys,
1146 * subkeys, and values that is rooted at the top of the registry
1147 * hierarchy. A hive is backed by a single file and .LOG file.
1148 * Parameters: HKEY hKey handle of open key
1149 * LPCSTR lpszSubKey address of name of subkey
1150 * LPCSTR lpszFile address of filename for registry information
1151 * Variables :
1152 * Result :
1153 * Remark :
1154 * Status : UNTESTED STUB
1155 *
1156 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1157 *****************************************************************************/
1158
1159ODINFUNCTION3(LONG,RegLoadKeyA,HKEY, hKey,
1160 LPCSTR,lpszSubKey,
1161 LPCSTR,lpszFile)
1162{
1163 dprintf(("ADVAPI32: RegLoadKeyA not implemented.\n"));
1164
1165 return (ERROR_ACCESS_DENIED); /* signal failure */
1166}
1167
1168
1169/*****************************************************************************
1170 * Name : RegLoadKeyW
1171 * Purpose : The RegLoadKey function creates a subkey under HKEY_USER or
1172 * HKEY_LOCAL_MACHINE and stores registration information from a
1173 * specified file into that subkey. This registration information
1174 * is in the form of a hive. A hive is a discrete body of keys,
1175 * subkeys, and values that is rooted at the top of the registry
1176 * hierarchy. A hive is backed by a single file and .LOG file.
1177 * Parameters: HKEY hKey handle of open key
1178 * LPCWSTR lpszSubKey address of name of subkey
1179 * LPCWSTR lpszFile address of filename for registry information
1180 * Variables :
1181 * Result :
1182 * Remark :
1183 * Status : UNTESTED STUB
1184 *
1185 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1186 *****************************************************************************/
1187
1188ODINFUNCTION3(LONG,RegLoadKeyW,HKEY, hKey,
1189 LPCWSTR,lpszSubKey,
1190 LPCWSTR,lpszFile)
1191{
1192 dprintf(("ADVAPI32: RegLoadKeyW not implemented.\n"));
1193
1194 return (ERROR_ACCESS_DENIED); /* signal failure */
1195}
1196
1197
1198/*****************************************************************************
1199 * Name : RegQueryMultipleValuesA
1200 * Purpose : The RegQueryMultipleValues function retrieves the type and data
1201 * for a list of value names associated with an open registry key.
1202 * Parameters: HKEY hKey handle of key to query
1203 * PVALENT val_list address of array of value entry structures
1204 * DWORD num_vals size of array of value entry structures
1205 * LPTSTR lpValueBuf address of buffer for value information
1206 * LPDWORD ldwTotsize address of size of value buffer
1207 * Variables :
1208 * Result :
1209 * Remark :
1210 * Status : UNTESTED STUB
1211 *
1212 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1213 *****************************************************************************/
1214
1215ODINFUNCTION5(LONG,RegQueryMultipleValuesA,HKEY, hKey,
1216 PVALENTA,val_list,
1217 DWORD, num_vals,
1218 LPTSTR, lpValueBuf,
1219 LPDWORD, ldwTotsize)
1220{
1221 dprintf(("ADVAPI32: RegQueryMultipleValuesA not implemented.\n"));
1222
1223 return (ERROR_ACCESS_DENIED); /* signal failure */
1224}
1225
1226
1227/*****************************************************************************
1228 * Name : RegQueryMultipleValuesW
1229 * Purpose : The RegQueryMultipleValues function retrieves the type and data
1230 * for a list of value names associated with an open registry key.
1231 * Parameters: HKEY hKey handle of key to query
1232 * PVALENT val_list address of array of value entry structures
1233 * DWORD num_vals size of array of value entry structures
1234 * LPWSTR lpValueBuf address of buffer for value information
1235 * LPDWORD ldwTotsize address of size of value buffer
1236 * Variables :
1237 * Result :
1238 * Remark :
1239 * Status : UNTESTED STUB
1240 *
1241 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1242 *****************************************************************************/
1243
1244ODINFUNCTION5(LONG,RegQueryMultipleValuesW,HKEY, hKey,
1245 PVALENTW,val_list,
1246 DWORD, num_vals,
1247 LPWSTR, lpValueBuf,
1248 LPDWORD, ldwTotsize)
1249{
1250 dprintf(("ADVAPI32: RegQueryMultipleValuesW not implemented.\n"));
1251
1252 return (ERROR_ACCESS_DENIED); /* signal failure */
1253}
1254
1255
1256/*****************************************************************************
1257 * Name : RegRemapPreDefKey
1258 * Purpose :
1259 * Parameters:
1260 * Variables :
1261 * Result :
1262 * Remark :
1263 * Status : UNTESTED STUB
1264 *
1265 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1266 *****************************************************************************/
1267
1268#if 0
1269ODINFUNCTION1(LONG,RegRemapPreDefKey,HKEY,hKey)
1270{
1271 dprintf(("ADVAPI32: RegRemapPreDefKey not implemented.\n"));
1272
1273 return (ERROR_ACCESS_DENIED); /* signal failure */
1274}
1275#endif
1276
1277
1278/*****************************************************************************
1279 * Name : RegReplaceKeyA
1280 * Purpose : The RegReplaceKey function replaces the file backing a key and
1281 * all its subkeys with another file, so that when the system is
1282 * next started, the key and subkeys will have the values stored in the new file.
1283 * Parameters: HKEY hKey handle of open key
1284 * LPCSTR lpSubKey address of name of subkey
1285 * LPCSTR lpNewFile address of filename for file with new data
1286 * LPCSTR lpOldFile address of filename for backup file
1287 * Variables :
1288 * Result :
1289 * Remark :
1290 * Status : UNTESTED STUB
1291 *
1292 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1293 *****************************************************************************/
1294
1295ODINFUNCTION4(LONG,RegReplaceKeyA,HKEY, hKey,
1296 LPCSTR,lpSubKey,
1297 LPCSTR,lpNewFile,
1298 LPCSTR,lpOldFile)
1299{
1300 dprintf(("ADVAPI32: RegReplaceKeyA not implemented.\n"));
1301
1302 return (ERROR_ACCESS_DENIED); /* signal failure */
1303}
1304
1305
1306/*****************************************************************************
1307 * Name : RegReplaceKeyW
1308 * Purpose : The RegReplaceKey function replaces the file backing a key and
1309 * all its subkeys with another file, so that when the system is
1310 * next started, the key and subkeys will have the values stored in the new file.
1311 * Parameters: HKEY hKey handle of open key
1312 * LPCWSTR lpSubKey address of name of subkey
1313 * LPCWSTR lpNewFile address of filename for file with new data
1314 * LPCWSTR lpOldFile address of filename for backup file
1315 * Variables :
1316 * Result :
1317 * Remark :
1318 * Status : UNTESTED STUB
1319 *
1320 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1321 *****************************************************************************/
1322
1323ODINFUNCTION4(LONG,RegReplaceKeyW,HKEY, hKey,
1324 LPCWSTR,lpSubKey,
1325 LPCWSTR,lpNewFile,
1326 LPCWSTR,lpOldFile)
1327{
1328 dprintf(("ADVAPI32: RegReplaceKeyW not implemented.\n"));
1329
1330 return (ERROR_ACCESS_DENIED); /* signal failure */
1331}
1332
1333
1334/*****************************************************************************
1335 * Name : RegRestoreKeyA
1336 * Purpose : The RegRestoreKey function reads the registry information in a
1337 * specified file and copies it over the specified key. This
1338 * registry information may be in the form of a key and multiple
1339 * levels of subkeys.
1340 * Parameters: HKEY hKey handle of key where restore begins
1341 * LPCSTR lpszFile address of filename containing saved tree
1342 * DWORD fdw optional flags
1343 * Variables :
1344 * Result :
1345 * Remark :
1346 * Status : UNTESTED STUB
1347 *
1348 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1349 *****************************************************************************/
1350
1351ODINFUNCTION3(LONG,RegRestoreKeyA,HKEY, hKey,
1352 LPCSTR,lpszFile,
1353 DWORD, fdw)
1354{
1355 dprintf(("ADVAPI32: RegRestoreKeyA not implemented.\n"));
1356
1357 return (ERROR_ACCESS_DENIED); /* signal failure */
1358}
1359
1360
1361/*****************************************************************************
1362 * Name : RegRestoreKeyW
1363 * Purpose : The RegRestoreKey function reads the registry information in a
1364 * specified file and copies it over the specified key. This
1365 * registry information may be in the form of a key and multiple
1366 * levels of subkeys.
1367 * Parameters: HKEY hKey handle of key where restore begins
1368 * LPCWSTR lpszFile address of filename containing saved tree
1369 * DWORD fdw optional flags
1370 * Variables :
1371 * Result :
1372 * Remark :
1373 * Status : UNTESTED STUB
1374 *
1375 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1376 *****************************************************************************/
1377
1378ODINFUNCTION3(LONG,RegRestoreKeyW,HKEY, hKey,
1379 LPCWSTR, lpszFile,
1380 DWORD, fdw)
1381{
1382 dprintf(("ADVAPI32: RegRestoreKeyW not implemented.\n"));
1383
1384 return (ERROR_ACCESS_DENIED); /* signal failure */
1385}
1386
1387
1388/*****************************************************************************
1389 * Name : RegSaveKeyA
1390 * Purpose : The RegSaveKey function saves the specified key and all of its
1391 * subkeys and values to a new file.
1392 * Parameters: HKEY hKey handle of key where save begins
1393 * LPCSTR lpszFile address of filename to save to
1394 * LPSECURITY_ATTRIBUTES lpsa address of security structure
1395 * Variables :
1396 * Result :
1397 * Remark :
1398 * Status : UNTESTED STUB
1399 *
1400 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1401 *****************************************************************************/
1402
1403ODINFUNCTION3(LONG,RegSaveKeyA,HKEY, hKey,
1404 LPCSTR, lpszFile,
1405 LPSECURITY_ATTRIBUTES,lpsa)
1406{
1407 dprintf(("ADVAPI32: RegSaveKeyA not implemented.\n"));
1408
1409 return (ERROR_ACCESS_DENIED); /* signal failure */
1410}
1411
1412
1413/*****************************************************************************
1414 * Name : RegSaveKeyW
1415 * Purpose : The RegSaveKey function saves the specified key and all of its
1416 * subkeys and values to a new file.
1417 * Parameters: HKEY hKey handle of key where save begins
1418 * LPCWSTR lpszFile address of filename to save to
1419 * LPSECURITY_ATTRIBUTES lpsa address of security structure
1420 * Variables :
1421 * Result :
1422 * Remark :
1423 * Status : UNTESTED STUB
1424 *
1425 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1426 *****************************************************************************/
1427
1428ODINFUNCTION3(LONG,RegSaveKeyW,HKEY, hKey,
1429 LPCWSTR, lpszFile,
1430 LPSECURITY_ATTRIBUTES,lpsa)
1431{
1432 dprintf(("ADVAPI32: RegSaveKeyW not implemented.\n"));
1433
1434 return (ERROR_ACCESS_DENIED); /* signal failure */
1435}
1436
1437
1438/*****************************************************************************
1439 * Name : RegSetKeySecurity
1440 * Purpose : The RegSetKeySecurity function sets the security of an open registry key.
1441 * Parameters: HKEY hKey open handle of key to set
1442 * SECURITY_INFORMATION si descriptor contents
1443 * PSECURITY_DESCRIPTOR psd address of descriptor for key
1444 * Variables :
1445 * Result :
1446 * Remark :
1447 * Status : UNTESTED STUB
1448 *
1449 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1450 *****************************************************************************/
1451
1452ODINFUNCTION3(LONG,RegSetKeySecurity,HKEY, hKey,
1453 SECURITY_INFORMATION,si,
1454 PSECURITY_DESCRIPTOR,psd)
1455{
1456 dprintf(("ADVAPI32: RegSetKeySecurity not implemented.\n"));
1457
1458 return (ERROR_ACCESS_DENIED); /* signal failure */
1459}
1460
1461
1462/*****************************************************************************
1463 * Name : RegUnLoadKeyA
1464 * Purpose : The RegUnLoadKey function unloads the specified key and subkeys from the registry.
1465 * Parameters: HKEY hKey handle of open key
1466 * LPCSTR lpszSubKey address of name of subkey to unload
1467 * Variables :
1468 * Result :
1469 * Remark :
1470 * Status : UNTESTED STUB
1471 *
1472 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1473 *****************************************************************************/
1474
1475ODINFUNCTION2(LONG,RegUnLoadKeyA,HKEY, hKey,
1476 LPCSTR, lpszSubKey)
1477{
1478 dprintf(("ADVAPI32: RegUnLoadKeyA not implemented.\n"));
1479
1480 return (ERROR_ACCESS_DENIED); /* signal failure */
1481}
1482
1483
1484/*****************************************************************************
1485 * Name : RegUnLoadKeyW
1486 * Purpose : The RegUnLoadKey function unloads the specified key and subkeys from the registry.
1487 * Parameters: HKEY hKey handle of open key
1488 * LPCWSTR lpszSubKey address of name of subkey to unload
1489 * Variables :
1490 * Result :
1491 * Remark :
1492 * Status : UNTESTED STUB
1493 *
1494 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1495 *****************************************************************************/
1496
1497ODINFUNCTION2(LONG,RegUnLoadKeyW,HKEY, hKey,
1498 LPCWSTR, lpszSubKey)
1499{
1500 dprintf(("ADVAPI32: RegUnLoadKeyW not implemented.\n"));
1501
1502 return (ERROR_ACCESS_DENIED); /* signal failure */
1503}
1504
1505
1506/*****************************************************************************
1507 * Name : RegNotifyChangeKeyValue
1508 * Purpose :
1509 * Parameters: HKEY hKey handle of open key
1510 * LPCWSTR lpszSubKey address of name of subkey to unload
1511 * Variables :
1512 * Result :
1513 * Remark :
1514 * Status : UNTESTED STUB
1515 *
1516 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1517 *****************************************************************************/
1518
1519ODINFUNCTION5(LONG,RegNotifyChangeKeyValue,HKEY, hKey,
1520 BOOL, bWatchSubtree,
1521 DWORD, dwNotifyFilter,
1522 HANDLE,hEvent,
1523 BOOL, fAsynchronus)
1524{
1525 dprintf(("ADVAPI32: RegNotifyChangeKeyValue() not implemented.\n"));
1526
1527 return ERROR_ACCESS_DENIED;
1528}
1529
Note: See TracBrowser for help on using the repository browser.