merge the formfield patch from ooo-build
[ooovba.git] / registry / source / regkey.cxx
blob0898393305d2b7a38d82a6822039cde9f23e1387
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: regkey.cxx,v $
10 * $Revision: 1.7.8.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_registry.hxx"
34 #include "regkey.hxx"
35 #include <registry/registry.hxx>
36 #include <rtl/alloc.h>
37 #include "regimpl.hxx"
38 #include "keyimpl.hxx"
41 //*********************************************************************
42 // acquireKey
44 void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey)
46 ORegKey* pKey = (ORegKey*) hKey;
48 if (pKey != NULL)
49 pKey->acquire();
53 //*********************************************************************
54 // releaseKey
56 void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey)
58 ORegKey* pKey = (ORegKey*) hKey;
60 if (pKey)
62 if (pKey->release() == 0)
63 delete pKey;
68 //*********************************************************************
69 // isKeyReadOnly
71 sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey)
73 if (hKey)
75 return ((ORegKey*)hKey)->isReadOnly();
76 } else
78 return sal_False;
83 //*********************************************************************
84 // getKeyName
86 RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName)
88 if (hKey)
90 rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData );
91 return REG_NO_ERROR;
92 } else
94 rtl_uString_new(pKeyName);
95 return REG_INVALID_KEY;
100 //*********************************************************************
101 // createKey
103 RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey,
104 rtl_uString* keyName,
105 RegKeyHandle* phNewKey)
107 ORegKey* pKey;
109 if (hKey)
111 pKey = (ORegKey*)hKey;
113 if (pKey->isDeleted())
115 phNewKey = NULL;
116 return REG_INVALID_KEY;
118 } else
120 phNewKey = NULL;
121 return REG_INVALID_KEY;
124 if (pKey->isReadOnly())
125 return REG_REGISTRY_READONLY;
127 return pKey->createKey(keyName, phNewKey);
130 //*********************************************************************
131 // openKey
133 RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey,
134 rtl_uString* keyName,
135 RegKeyHandle* phOpenKey)
137 ORegKey* pKey;
139 if (hKey)
141 pKey = (ORegKey*)hKey;
143 if (pKey->isDeleted())
145 phOpenKey = NULL;
146 return REG_INVALID_KEY;
148 } else
150 phOpenKey = NULL;
151 return REG_INVALID_KEY;
154 return pKey->openKey(keyName, phOpenKey);
157 //*********************************************************************
158 // openSubKeys
160 RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey,
161 rtl_uString* keyName,
162 RegKeyHandle** pphSubKeys,
163 sal_uInt32* pnSubKeys)
165 ORegKey* pKey;
167 if (hKey)
169 pKey = (ORegKey*)hKey;
171 if (pKey->isDeleted())
173 *pphSubKeys = NULL;
174 *pnSubKeys = 0;
175 return REG_INVALID_KEY;
177 } else
179 *pphSubKeys = NULL;
180 *pnSubKeys = 0;
181 return REG_INVALID_KEY;
184 return pKey->openSubKeys(keyName, pphSubKeys, pnSubKeys);
187 //*********************************************************************
188 // closeSubKeys
190 RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys,
191 sal_uInt32 nSubKeys)
193 RegError _ret = REG_NO_ERROR;
195 if (phSubKeys != 0 && nSubKeys != 0)
197 ORegistry* pReg = NULL;
199 pReg = ((ORegKey*)phSubKeys[0])->getRegistry();
201 for (sal_uInt32 i=0; (i < nSubKeys) && (_ret == REG_NO_ERROR); i++)
203 _ret = pReg->closeKey(phSubKeys[i]);
206 rtl_freeMemory(phSubKeys);
208 else
209 _ret = REG_INVALID_KEY;
211 return _ret;
215 //*********************************************************************
216 // deleteKey
218 RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey,
219 rtl_uString* keyName)
221 ORegKey* pKey;
223 if (hKey)
225 pKey = (ORegKey*)hKey;
227 if (pKey->isDeleted())
228 return REG_INVALID_KEY;
229 } else
230 return REG_INVALID_KEY;
232 if (pKey->isReadOnly())
233 return REG_REGISTRY_READONLY;
235 return pKey->deleteKey(keyName);
238 //*********************************************************************
239 // closeKey
241 RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey)
243 ORegKey* pKey;
244 ORegistry* pReg;
246 if (hKey)
248 pKey = (ORegKey*)hKey;
250 pReg = pKey->getRegistry();
252 if (pReg->closeKey(hKey))
253 return REG_INVALID_KEY;
254 } else
255 return REG_INVALID_KEY;
257 return REG_NO_ERROR;
261 //*********************************************************************
262 // setValue
264 RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey,
265 rtl_uString* keyName,
266 RegValueType valueType,
267 RegValue pData,
268 sal_uInt32 valueSize)
270 ORegKey* pKey;
272 if (hKey)
274 pKey = (ORegKey*)hKey;
276 if (pKey->isDeleted())
277 return REG_INVALID_KEY;
278 } else
279 return REG_INVALID_KEY;
281 if (pKey->isReadOnly())
282 return REG_REGISTRY_READONLY;
284 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
285 if (keyName->length)
287 RegKeyHandle hSubKey;
288 ORegKey* pSubKey;
289 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
290 if (_ret1)
291 return _ret1;
293 pSubKey = (ORegKey*)hSubKey;
294 _ret1 = pSubKey->setValue(valueName, valueType, pData, valueSize);
295 if (_ret1)
297 RegError _ret2 = pKey->closeKey(hSubKey);
298 if (_ret2)
299 return _ret2;
300 else
301 return _ret1;
304 return pKey->closeKey(hSubKey);
307 return pKey->setValue(valueName, valueType, pData, valueSize);
310 //*********************************************************************
311 // setLongValueList
313 RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey,
314 rtl_uString* keyName,
315 sal_Int32* pValueList,
316 sal_uInt32 len)
318 ORegKey* pKey;
320 if (hKey)
322 pKey = (ORegKey*)hKey;
324 if (pKey->isDeleted())
325 return REG_INVALID_KEY;
326 } else
327 return REG_INVALID_KEY;
329 if (pKey->isReadOnly())
330 return REG_REGISTRY_READONLY;
332 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
333 if (keyName->length)
335 RegKeyHandle hSubKey;
336 ORegKey* pSubKey;
337 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
338 if (_ret1)
339 return _ret1;
341 pSubKey = (ORegKey*)hSubKey;
342 _ret1 = pSubKey->setLongListValue(valueName, pValueList, len);
343 if (_ret1)
345 RegError _ret2 = pKey->closeKey(hSubKey);
346 if (_ret2)
347 return _ret2;
348 else
349 return _ret1;
352 return pKey->closeKey(hSubKey);
355 return pKey->setLongListValue(valueName, pValueList, len);
358 //*********************************************************************
359 // setStringValueList
361 RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey,
362 rtl_uString* keyName,
363 sal_Char** pValueList,
364 sal_uInt32 len)
366 ORegKey* pKey;
368 if (hKey)
370 pKey = (ORegKey*)hKey;
372 if (pKey->isDeleted())
373 return REG_INVALID_KEY;
374 } else
375 return REG_INVALID_KEY;
377 if (pKey->isReadOnly())
378 return REG_REGISTRY_READONLY;
380 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
381 if (keyName->length)
383 RegKeyHandle hSubKey;
384 ORegKey* pSubKey;
385 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
386 if (_ret1)
387 return _ret1;
389 pSubKey = (ORegKey*)hSubKey;
390 _ret1 = pSubKey->setStringListValue(valueName, pValueList, len);
391 if (_ret1)
393 RegError _ret2 = pKey->closeKey(hSubKey);
394 if (_ret2)
395 return _ret2;
396 else
397 return _ret1;
400 return pKey->closeKey(hSubKey);
403 return pKey->setStringListValue(valueName, pValueList, len);
406 //*********************************************************************
407 // setUnicodeValueList
409 RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey,
410 rtl_uString* keyName,
411 sal_Unicode** pValueList,
412 sal_uInt32 len)
414 ORegKey* pKey;
416 if (hKey)
418 pKey = (ORegKey*)hKey;
420 if (pKey->isDeleted())
421 return REG_INVALID_KEY;
422 } else
423 return REG_INVALID_KEY;
425 if (pKey->isReadOnly())
426 return REG_REGISTRY_READONLY;
428 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
429 if (keyName->length)
431 RegKeyHandle hSubKey;
432 ORegKey* pSubKey;
433 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
434 if (_ret1)
435 return _ret1;
437 pSubKey = (ORegKey*)hSubKey;
438 _ret1 = pSubKey->setUnicodeListValue(valueName, pValueList, len);
439 if (_ret1)
441 RegError _ret2 = pKey->closeKey(hSubKey);
442 if (_ret2)
443 return _ret2;
444 else
445 return _ret1;
448 return pKey->closeKey(hSubKey);
451 return pKey->setUnicodeListValue(valueName, pValueList, len);
454 //*********************************************************************
455 // getValueInfo
457 RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey,
458 rtl_uString* keyName,
459 RegValueType* pValueType,
460 sal_uInt32* pValueSize)
462 ORegKey* pKey;
463 RegValueType valueType;
464 sal_uInt32 valueSize;
466 *pValueType = RG_VALUETYPE_NOT_DEFINED;
467 *pValueSize = 0;
469 if (hKey)
471 pKey = (ORegKey*)hKey;
473 if (pKey->isDeleted())
474 return REG_INVALID_KEY;
475 } else
476 return REG_INVALID_KEY;
478 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
479 if (keyName->length)
481 RegKeyHandle hSubKey;
482 ORegKey* pSubKey;
483 RegError _ret = pKey->openKey(keyName, &hSubKey);
484 if (_ret)
485 return _ret;
487 pSubKey = (ORegKey*)hSubKey;
488 if (pSubKey->getValueInfo(valueName, &valueType, &valueSize))
490 _ret = pKey->closeKey(hSubKey);
491 if (_ret)
492 return _ret;
493 else
494 return REG_INVALID_VALUE;
497 *pValueType = valueType;
498 *pValueSize = valueSize;
500 return pKey->closeKey(hSubKey);
504 if (pKey->getValueInfo(valueName, &valueType, &valueSize))
506 return REG_INVALID_VALUE;
509 *pValueType = valueType;
510 *pValueSize = valueSize;
512 return REG_NO_ERROR;
515 //*********************************************************************
516 // getValueInfo
518 RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey,
519 rtl_uString* keyName,
520 RegValue pValue)
522 ORegKey* pKey;
524 if (hKey)
526 pKey = (ORegKey*)hKey;
528 if (pKey->isDeleted())
530 pValue = NULL;
531 return REG_INVALID_KEY;
533 } else
535 pValue = NULL;
536 return REG_INVALID_KEY;
539 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
540 if (keyName->length)
542 RegKeyHandle hSubKey;
543 ORegKey* pSubKey;
544 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
545 if (_ret1)
547 pValue = NULL;
548 return _ret1;
551 pSubKey = (ORegKey*)hSubKey;
552 _ret1 = pSubKey->getValue(valueName, pValue);
553 if (_ret1)
555 RegError _ret2 = pKey->closeKey(hSubKey);
556 if (_ret2)
558 pValue = NULL;
559 return _ret2;
560 } else
562 pValue = NULL;
563 return _ret1;
567 return pKey->closeKey(hSubKey);
570 return pKey->getValue(valueName, pValue);
573 //*********************************************************************
574 // getLongValueList
576 RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey,
577 rtl_uString* keyName,
578 sal_Int32** pValueList,
579 sal_uInt32* pLen)
581 ORegKey* pKey;
583 if (hKey)
585 pKey = (ORegKey*)hKey;
587 if (pKey->isDeleted())
589 pValueList = NULL;
590 *pLen = 0;
591 return REG_INVALID_KEY;
593 } else
595 pValueList = NULL;
596 *pLen = 0;
597 return REG_INVALID_KEY;
600 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
601 if (keyName->length)
603 RegKeyHandle hSubKey;
604 ORegKey* pSubKey;
605 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
606 if (_ret1)
608 pValueList = NULL;
609 *pLen = 0;
610 return _ret1;
613 pSubKey = (ORegKey*)hSubKey;
615 _ret1 = pSubKey->getLongListValue(valueName, pValueList, pLen);
616 if (_ret1)
618 RegError _ret2 = pKey->closeKey(hSubKey);
619 if (_ret2)
621 pValueList = NULL;
622 *pLen = 0;
623 return _ret2;
624 } else
626 pValueList = NULL;
627 *pLen = 0;
628 return _ret1;
632 return pKey->closeKey(hSubKey);
635 return pKey->getLongListValue(valueName, pValueList, pLen);
638 //*********************************************************************
639 // getStringValueList
641 RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey,
642 rtl_uString* keyName,
643 sal_Char*** pValueList,
644 sal_uInt32* pLen)
646 ORegKey* pKey;
648 if (hKey)
650 pKey = (ORegKey*)hKey;
652 if (pKey->isDeleted())
654 pValueList = NULL;
655 *pLen = 0;
656 return REG_INVALID_KEY;
658 } else
660 pValueList = NULL;
661 *pLen = 0;
662 return REG_INVALID_KEY;
665 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
666 if (keyName->length)
668 RegKeyHandle hSubKey;
669 ORegKey* pSubKey;
670 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
671 if (_ret1)
673 pValueList = NULL;
674 *pLen = 0;
675 return _ret1;
678 pSubKey = (ORegKey*)hSubKey;
680 _ret1 = pSubKey->getStringListValue(valueName, pValueList, pLen);
681 if (_ret1)
683 RegError _ret2 = pKey->closeKey(hSubKey);
684 if (_ret2)
686 pValueList = NULL;
687 *pLen = 0;
688 return _ret2;
689 } else
691 pValueList = NULL;
692 *pLen = 0;
693 return _ret1;
697 return pKey->closeKey(hSubKey);
700 return pKey->getStringListValue(valueName, pValueList, pLen);
703 //*********************************************************************
704 // getUnicodeListValue
706 RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey,
707 rtl_uString* keyName,
708 sal_Unicode*** pValueList,
709 sal_uInt32* pLen)
711 ORegKey* pKey;
713 if (hKey)
715 pKey = (ORegKey*)hKey;
717 if (pKey->isDeleted())
719 pValueList = NULL;
720 *pLen = 0;
721 return REG_INVALID_KEY;
723 } else
725 pValueList = NULL;
726 *pLen = 0;
727 return REG_INVALID_KEY;
730 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
731 if (keyName->length)
733 RegKeyHandle hSubKey;
734 ORegKey* pSubKey;
735 RegError _ret1 = pKey->openKey(keyName, &hSubKey);
736 if (_ret1)
738 pValueList = NULL;
739 *pLen = 0;
740 return _ret1;
743 pSubKey = (ORegKey*)hSubKey;
745 _ret1 = pSubKey->getUnicodeListValue(valueName, pValueList, pLen);
746 if (_ret1)
748 RegError _ret2 = pKey->closeKey(hSubKey);
749 if (_ret2)
751 pValueList = NULL;
752 *pLen = 0;
753 return _ret2;
754 } else
756 pValueList = NULL;
757 *pLen = 0;
758 return _ret1;
762 return pKey->closeKey(hSubKey);
765 return pKey->getUnicodeListValue(valueName, pValueList, pLen);
768 //*********************************************************************
769 // freeValueList
771 RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
772 RegValue pValueList,
773 sal_uInt32 len)
775 switch (valueType)
777 case 5:
779 rtl_freeMemory(pValueList);
781 break;
782 case 6:
784 sal_Char** pVList = (sal_Char**)pValueList;
785 for (sal_uInt32 i=0; i < len; i++)
787 rtl_freeMemory(pVList[i]);
790 rtl_freeMemory(pVList);
792 break;
793 case 7:
795 sal_Unicode** pVList = (sal_Unicode**)pValueList;
796 for (sal_uInt32 i=0; i < len; i++)
798 rtl_freeMemory(pVList[i]);
801 rtl_freeMemory(pVList);
803 break;
804 default:
805 return REG_INVALID_VALUE;
808 pValueList = NULL;
809 return REG_NO_ERROR;
813 //*********************************************************************
814 // createLink
816 RegError REGISTRY_CALLTYPE createLink(RegKeyHandle, rtl_uString*, rtl_uString*)
818 return REG_INVALID_LINK; // links are no longer supported
821 //*********************************************************************
822 // deleteLink
824 RegError REGISTRY_CALLTYPE deleteLink(RegKeyHandle, rtl_uString*)
826 return REG_INVALID_LINK; // links are no longer supported
829 //*********************************************************************
830 // getKeyType
832 RegError REGISTRY_CALLTYPE getKeyType(RegKeyHandle hKey,
833 rtl_uString* keyName,
834 RegKeyType* pKeyType)
836 ORegKey* pKey;
838 if (hKey)
840 pKey = (ORegKey*)hKey;
842 if (pKey->isDeleted())
843 return REG_INVALID_KEY;
844 } else
845 return REG_INVALID_KEY;
847 return pKey->getKeyType(keyName, pKeyType);
850 //*********************************************************************
851 // getLinkTarget
853 RegError REGISTRY_CALLTYPE getLinkTarget(
854 RegKeyHandle, rtl_uString*, rtl_uString**)
856 return REG_INVALID_LINK; // links are no longer supported
859 //*********************************************************************
860 // getName
862 RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey,
863 rtl_uString* keyName,
864 sal_Bool,
865 rtl_uString** pResolvedName)
867 ORegKey *pKey;
868 RegError _ret = REG_NO_ERROR;
870 if (hKey)
872 pKey = (ORegKey*)hKey;
874 if (pKey->isDeleted())
875 return REG_INVALID_KEY;
876 } else
877 return REG_INVALID_KEY;
879 OUString resolvedName;
880 _ret = pKey->getResolvedKeyName(keyName, resolvedName);
881 if (!_ret)
882 rtl_uString_assign(pResolvedName, resolvedName.pData);
883 return _ret;
887 //*********************************************************************
888 // getKeyNames
890 RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey,
891 rtl_uString* keyName,
892 rtl_uString*** pSubKeyNames,
893 sal_uInt32* pnSubKeys)
895 ORegKey* pKey;
897 if (hKey)
899 pKey = (ORegKey*)hKey;
901 if (pKey->isDeleted())
902 return REG_INVALID_KEY;
903 } else
904 return REG_INVALID_KEY;
906 return pKey->getKeyNames(keyName, pSubKeyNames, pnSubKeys);
909 //*********************************************************************
910 // freeKeyNames
912 RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString** pKeyNames,
913 sal_uInt32 nKeys)
915 for (sal_uInt32 i=0; i < nKeys; i++)
917 rtl_uString_release(pKeyNames[i]);
920 rtl_freeMemory(pKeyNames);
922 return REG_NO_ERROR;
925 //*********************************************************************
926 // C API
929 //*********************************************************************
930 // reg_createKey
932 RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey,
933 rtl_uString* keyName,
934 RegKeyHandle* phNewKey)
936 if (!hKey)
937 return REG_INVALID_KEY;
939 return createKey(hKey, keyName, phNewKey);
942 //*********************************************************************
943 // reg_openKey
945 RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey,
946 rtl_uString* keyName,
947 RegKeyHandle* phOpenKey)
949 if (!hKey)
950 return REG_INVALID_KEY;
952 return openKey(hKey, keyName, phOpenKey);
955 //*********************************************************************
956 // reg_openSubKeys
958 RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey,
959 rtl_uString* keyName,
960 RegKeyHandle** pphSubKeys,
961 sal_uInt32* pnSubKeys)
963 if (!hKey)
964 return REG_INVALID_KEY;
966 return openSubKeys(hKey, keyName, pphSubKeys, pnSubKeys);
969 //*********************************************************************
970 // reg_closeSubKeys
972 RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* pphSubKeys,
973 sal_uInt32 nSubKeys)
975 if (!pphSubKeys)
976 return REG_INVALID_KEY;
978 return closeSubKeys(pphSubKeys, nSubKeys);
981 //*********************************************************************
982 // reg_deleteKey
984 RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey,
985 rtl_uString* keyName)
987 if (!hKey)
988 return REG_INVALID_KEY;
990 return deleteKey(hKey, keyName);
993 //*********************************************************************
994 // reg_closeKey
996 RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey)
998 if (!hKey)
999 return REG_INVALID_KEY;
1001 return closeKey(hKey);
1005 //*********************************************************************
1006 // reg_getKeyName
1008 RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName)
1010 if (hKey)
1012 rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData );
1013 return REG_NO_ERROR;
1014 } else
1016 rtl_uString_new( pKeyName );
1017 return REG_INVALID_KEY;
1021 //*********************************************************************
1022 // reg_setValue
1024 RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey,
1025 rtl_uString* keyName,
1026 RegValueType valueType,
1027 RegValue pData,
1028 sal_uInt32 valueSize)
1030 if (!hKey)
1031 return REG_INVALID_KEY;
1033 return setValue(hKey, keyName, valueType, pData, valueSize);
1036 //*********************************************************************
1037 // reg_setLongListValue
1039 RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey,
1040 rtl_uString* keyName,
1041 sal_Int32* pValueList,
1042 sal_uInt32 len)
1044 if (!hKey)
1045 return REG_INVALID_KEY;
1047 return setLongListValue(hKey, keyName, pValueList, len);
1050 //*********************************************************************
1051 // reg_setStringListValue
1053 RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey,
1054 rtl_uString* keyName,
1055 sal_Char** pValueList,
1056 sal_uInt32 len)
1058 if (!hKey)
1059 return REG_INVALID_KEY;
1061 return setStringListValue(hKey, keyName, pValueList, len);
1064 //*********************************************************************
1065 // reg_setUnicodeListValue
1067 RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey,
1068 rtl_uString* keyName,
1069 sal_Unicode** pValueList,
1070 sal_uInt32 len)
1072 if (!hKey)
1073 return REG_INVALID_KEY;
1075 return setUnicodeListValue(hKey, keyName, pValueList, len);
1078 //*********************************************************************
1079 // reg_getValueInfo
1081 RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey,
1082 rtl_uString* keyName,
1083 RegValueType* pValueType,
1084 sal_uInt32* pValueSize)
1086 if (!hKey)
1087 return REG_INVALID_KEY;
1089 return getValueInfo(hKey, keyName, pValueType, pValueSize);
1092 //*********************************************************************
1093 // reg_getValueInfo
1095 RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey,
1096 rtl_uString* keyName,
1097 RegValue pData)
1099 if (!hKey)
1100 return REG_INVALID_KEY;
1102 return getValue(hKey, keyName, pData);
1105 //*********************************************************************
1106 // reg_getLongListValue
1108 RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey,
1109 rtl_uString* keyName,
1110 sal_Int32** pValueList,
1111 sal_uInt32* pLen)
1113 if (!hKey)
1114 return REG_INVALID_KEY;
1116 return getLongListValue(hKey, keyName, pValueList, pLen);
1119 //*********************************************************************
1120 // reg_getStringListValue
1122 RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey,
1123 rtl_uString* keyName,
1124 sal_Char*** pValueList,
1125 sal_uInt32* pLen)
1127 if (!hKey)
1128 return REG_INVALID_KEY;
1130 return getStringListValue(hKey, keyName, pValueList, pLen);
1133 //*********************************************************************
1134 // reg_getUnicodeListValue
1136 RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey,
1137 rtl_uString* keyName,
1138 sal_Unicode*** pValueList,
1139 sal_uInt32* pLen)
1141 if (!hKey)
1142 return REG_INVALID_KEY;
1144 return getUnicodeListValue(hKey, keyName, pValueList, pLen);
1147 //*********************************************************************
1148 // reg_freeValueList
1150 RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType,
1151 RegValue pValueList,
1152 sal_uInt32 len)
1154 if (pValueList)
1155 return freeValueList(valueType, pValueList, len);
1156 else
1157 return REG_INVALID_VALUE;
1160 //*********************************************************************
1161 // reg_createLink
1163 RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey,
1164 rtl_uString* linkName,
1165 rtl_uString* linkTarget)
1167 if (!hKey)
1168 return REG_INVALID_KEY;
1170 return createLink(hKey, linkName, linkTarget);
1173 //*********************************************************************
1174 // reg_deleteLink
1176 RegError REGISTRY_CALLTYPE reg_deleteLink(RegKeyHandle hKey,
1177 rtl_uString* linkName)
1179 if (!hKey)
1180 return REG_INVALID_KEY;
1182 return deleteLink(hKey, linkName);
1185 //*********************************************************************
1186 // reg_getKeyType
1188 RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
1189 rtl_uString* keyName,
1190 RegKeyType* pKeyType)
1192 if (!hKey)
1193 return REG_INVALID_KEY;
1195 return getKeyType(hKey, keyName, pKeyType);
1198 //*********************************************************************
1199 // reg_getLinkTarget
1201 RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey,
1202 rtl_uString* linkName,
1203 rtl_uString** pLinkTarget)
1205 if (!hKey)
1206 return REG_INVALID_KEY;
1208 return getLinkTarget(hKey, linkName, pLinkTarget);
1212 //*********************************************************************
1213 // reg_getResolvedKeyName
1215 RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
1216 rtl_uString* keyName,
1217 sal_Bool firstLinkOnly,
1218 rtl_uString** pResolvedName)
1220 ORegKey *pKey;
1222 if (hKey)
1223 pKey = (ORegKey*)hKey;
1224 else
1225 return REG_INVALID_KEY;
1227 return getResolvedKeyName(hKey, keyName, firstLinkOnly, pResolvedName);