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

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

service apis bugfixed & added

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