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

Last change on this file since 8327 was 8327, checked in by sandervl, 23 years ago

PH: memory leak fixes; extra checks for NULL pointers; CreateProcess changes for debug option; GetModuleFileName doesn't count 0 terminator

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