source: trunk/src/kernel32/registry.cpp@ 3678

Last change on this file since 3678 was 3678, checked in by sandervl, 25 years ago

RegQueryValueW, OpenFile and LoadLibrary fixes

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