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

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

Implemented some service apis

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