1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_registry.hxx" 30 31 #include "regkey.hxx" 32 33 #include <registry/registry.hxx> 34 #include <rtl/alloc.h> 35 #include "regimpl.hxx" 36 #include "keyimpl.hxx" 37 38 using rtl::OUString; 39 40 //********************************************************************* 41 // acquireKey 42 // 43 void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey) 44 { 45 ORegKey* pKey = static_cast< ORegKey* >(hKey); 46 if (pKey != 0) 47 { 48 ORegistry* pReg = pKey->getRegistry(); 49 (void) pReg->acquireKey(pKey); 50 } 51 } 52 53 54 //********************************************************************* 55 // releaseKey 56 // 57 void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey) 58 { 59 ORegKey* pKey = static_cast< ORegKey* >(hKey); 60 if (pKey != 0) 61 { 62 ORegistry* pReg = pKey->getRegistry(); 63 (void) pReg->releaseKey(pKey); 64 } 65 } 66 67 68 //********************************************************************* 69 // isKeyReadOnly 70 // 71 sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey) 72 { 73 ORegKey* pKey = static_cast< ORegKey* >(hKey); 74 return (pKey != 0) ? pKey->isReadOnly() : sal_False; 75 } 76 77 78 //********************************************************************* 79 // getKeyName 80 // 81 RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName) 82 { 83 ORegKey* pKey = static_cast< ORegKey* >(hKey); 84 if (pKey) 85 { 86 rtl_uString_assign( pKeyName, pKey->getName().pData ); 87 return REG_NO_ERROR; 88 } else 89 { 90 rtl_uString_new(pKeyName); 91 return REG_INVALID_KEY; 92 } 93 } 94 95 96 //********************************************************************* 97 // createKey 98 // 99 RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey, 100 rtl_uString* keyName, 101 RegKeyHandle* phNewKey) 102 { 103 *phNewKey = 0; 104 105 ORegKey* pKey = static_cast< ORegKey* >(hKey); 106 if (!pKey) 107 return REG_INVALID_KEY; 108 109 if (pKey->isDeleted()) 110 return REG_INVALID_KEY; 111 112 if (pKey->isReadOnly()) 113 return REG_REGISTRY_READONLY; 114 115 return pKey->createKey(keyName, phNewKey); 116 } 117 118 //********************************************************************* 119 // openKey 120 // 121 RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey, 122 rtl_uString* keyName, 123 RegKeyHandle* phOpenKey) 124 { 125 *phOpenKey = 0; 126 127 ORegKey* pKey = static_cast< ORegKey* >(hKey); 128 if (!pKey) 129 return REG_INVALID_KEY; 130 131 if (pKey->isDeleted()) 132 return REG_INVALID_KEY; 133 134 return pKey->openKey(keyName, phOpenKey); 135 } 136 137 //********************************************************************* 138 // openSubKeys 139 // 140 RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey, 141 rtl_uString* keyName, 142 RegKeyHandle** pphSubKeys, 143 sal_uInt32* pnSubKeys) 144 { 145 *pphSubKeys = NULL; 146 *pnSubKeys = 0; 147 148 ORegKey* pKey = static_cast< ORegKey* >(hKey); 149 if (!pKey) 150 return REG_INVALID_KEY; 151 152 if (pKey->isDeleted()) 153 return REG_INVALID_KEY; 154 155 return pKey->openSubKeys(keyName, pphSubKeys, pnSubKeys); 156 } 157 158 //********************************************************************* 159 // closeSubKeys 160 // 161 RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys, 162 sal_uInt32 nSubKeys) 163 { 164 if (phSubKeys == 0 || nSubKeys == 0) 165 return REG_INVALID_KEY; 166 167 ORegistry* pReg = ((ORegKey*)(phSubKeys[0]))->getRegistry(); 168 for (sal_uInt32 i = 0; i < nSubKeys; i++) 169 { 170 (void) pReg->closeKey(phSubKeys[i]); 171 } 172 rtl_freeMemory(phSubKeys); 173 174 return REG_NO_ERROR; 175 } 176 177 //********************************************************************* 178 // deleteKey 179 // 180 RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey, 181 rtl_uString* keyName) 182 { 183 ORegKey* pKey = static_cast< ORegKey* >(hKey); 184 if (!pKey) 185 return REG_INVALID_KEY; 186 187 if (pKey->isDeleted()) 188 return REG_INVALID_KEY; 189 190 if (pKey->isReadOnly()) 191 return REG_REGISTRY_READONLY; 192 193 return pKey->deleteKey(keyName); 194 } 195 196 //********************************************************************* 197 // closeKey 198 // 199 RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey) 200 { 201 ORegKey* pKey = static_cast< ORegKey* >(hKey); 202 if (!pKey) 203 return REG_INVALID_KEY; 204 205 return pKey->closeKey(hKey); 206 } 207 208 //********************************************************************* 209 // setValue 210 // 211 RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, 212 rtl_uString* keyName, 213 RegValueType valueType, 214 RegValue pData, 215 sal_uInt32 valueSize) 216 { 217 ORegKey* pKey = static_cast< ORegKey* >(hKey); 218 if (!pKey) 219 return REG_INVALID_KEY; 220 221 if (pKey->isDeleted()) 222 return REG_INVALID_KEY; 223 224 if (pKey->isReadOnly()) 225 return REG_REGISTRY_READONLY; 226 227 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 228 if (keyName->length) 229 { 230 ORegKey* pSubKey = 0; 231 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 232 if (_ret1 != REG_NO_ERROR) 233 return _ret1; 234 235 _ret1 = pSubKey->setValue(valueName, valueType, pData, valueSize); 236 if (_ret1 != REG_NO_ERROR) 237 { 238 RegError _ret2 = pKey->closeKey(pSubKey); 239 if (_ret2) 240 return _ret2; 241 else 242 return _ret1; 243 } 244 245 return pKey->closeKey(pSubKey); 246 } 247 248 return pKey->setValue(valueName, valueType, pData, valueSize); 249 } 250 251 //********************************************************************* 252 // setLongValueList 253 // 254 RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, 255 rtl_uString* keyName, 256 sal_Int32* pValueList, 257 sal_uInt32 len) 258 { 259 ORegKey* pKey = static_cast< ORegKey* >(hKey); 260 if (!pKey) 261 return REG_INVALID_KEY; 262 263 if (pKey->isDeleted()) 264 return REG_INVALID_KEY; 265 266 if (pKey->isReadOnly()) 267 return REG_REGISTRY_READONLY; 268 269 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 270 if (keyName->length) 271 { 272 ORegKey* pSubKey = 0; 273 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 274 if (_ret1 != REG_NO_ERROR) 275 return _ret1; 276 277 _ret1 = pSubKey->setLongListValue(valueName, pValueList, len); 278 if (_ret1 != REG_NO_ERROR) 279 { 280 RegError _ret2 = pKey->closeKey(pSubKey); 281 if (_ret2 != REG_NO_ERROR) 282 return _ret2; 283 else 284 return _ret1; 285 } 286 287 return pKey->closeKey(pSubKey); 288 } 289 290 return pKey->setLongListValue(valueName, pValueList, len); 291 } 292 293 //********************************************************************* 294 // setStringValueList 295 // 296 RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, 297 rtl_uString* keyName, 298 sal_Char** pValueList, 299 sal_uInt32 len) 300 { 301 ORegKey* pKey = static_cast< ORegKey* >(hKey); 302 if (!pKey) 303 return REG_INVALID_KEY; 304 305 if (pKey->isDeleted()) 306 return REG_INVALID_KEY; 307 308 if (pKey->isReadOnly()) 309 return REG_REGISTRY_READONLY; 310 311 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 312 if (keyName->length) 313 { 314 ORegKey* pSubKey = 0; 315 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 316 if (_ret1 != REG_NO_ERROR) 317 return _ret1; 318 319 _ret1 = pSubKey->setStringListValue(valueName, pValueList, len); 320 if (_ret1 != REG_NO_ERROR) 321 { 322 RegError _ret2 = pKey->closeKey(pSubKey); 323 if (_ret2 != REG_NO_ERROR) 324 return _ret2; 325 else 326 return _ret1; 327 } 328 329 return pKey->closeKey(pSubKey); 330 } 331 332 return pKey->setStringListValue(valueName, pValueList, len); 333 } 334 335 //********************************************************************* 336 // setUnicodeValueList 337 // 338 RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, 339 rtl_uString* keyName, 340 sal_Unicode** pValueList, 341 sal_uInt32 len) 342 { 343 ORegKey* pKey = static_cast< ORegKey* >(hKey); 344 if (!pKey) 345 return REG_INVALID_KEY; 346 347 if (pKey->isDeleted()) 348 return REG_INVALID_KEY; 349 350 if (pKey->isReadOnly()) 351 return REG_REGISTRY_READONLY; 352 353 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 354 if (keyName->length) 355 { 356 ORegKey* pSubKey = 0; 357 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 358 if (_ret1 != REG_NO_ERROR) 359 return _ret1; 360 361 _ret1 = pSubKey->setUnicodeListValue(valueName, pValueList, len); 362 if (_ret1 != REG_NO_ERROR) 363 { 364 RegError _ret2 = pKey->closeKey(pSubKey); 365 if (_ret2 != REG_NO_ERROR) 366 return _ret2; 367 else 368 return _ret1; 369 } 370 371 return pKey->closeKey(pSubKey); 372 } 373 374 return pKey->setUnicodeListValue(valueName, pValueList, len); 375 } 376 377 //********************************************************************* 378 // getValueInfo 379 // 380 RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, 381 rtl_uString* keyName, 382 RegValueType* pValueType, 383 sal_uInt32* pValueSize) 384 { 385 *pValueType = RG_VALUETYPE_NOT_DEFINED; 386 *pValueSize = 0; 387 388 ORegKey* pKey = static_cast< ORegKey* >(hKey); 389 if (!pKey) 390 return REG_INVALID_KEY; 391 392 if (pKey->isDeleted()) 393 return REG_INVALID_KEY; 394 395 RegValueType valueType; 396 sal_uInt32 valueSize; 397 398 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 399 if (keyName->length) 400 { 401 ORegKey* pSubKey = 0; 402 RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 403 if (_ret != REG_NO_ERROR) 404 return _ret; 405 406 if (pSubKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR) 407 { 408 (void) pKey->releaseKey(pSubKey); 409 return REG_INVALID_VALUE; 410 } 411 412 *pValueType = valueType; 413 *pValueSize = valueSize; 414 415 return pKey->releaseKey(pSubKey); 416 } 417 418 419 if (pKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR) 420 { 421 return REG_INVALID_VALUE; 422 } 423 424 *pValueType = valueType; 425 *pValueSize = valueSize; 426 427 return REG_NO_ERROR; 428 } 429 430 //********************************************************************* 431 // getValueInfo 432 // 433 RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey, 434 rtl_uString* keyName, 435 RegValue pValue) 436 { 437 ORegKey* pKey = static_cast< ORegKey* >(hKey); 438 if (!pKey) 439 return REG_INVALID_KEY; 440 441 if (pKey->isDeleted()) 442 return REG_INVALID_KEY; 443 444 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 445 if (keyName->length) 446 { 447 ORegKey* pSubKey = 0; 448 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 449 if (_ret1 != REG_NO_ERROR) 450 return _ret1; 451 452 _ret1 = pSubKey->getValue(valueName, pValue); 453 if (_ret1 != REG_NO_ERROR) 454 { 455 (void) pKey->releaseKey(pSubKey); 456 return _ret1; 457 } 458 459 return pKey->releaseKey(pSubKey); 460 } 461 462 return pKey->getValue(valueName, pValue); 463 } 464 465 //********************************************************************* 466 // getLongValueList 467 // 468 RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, 469 rtl_uString* keyName, 470 sal_Int32** pValueList, 471 sal_uInt32* pLen) 472 { 473 OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getLongListValue(): invalid parameter"); 474 *pValueList = 0, *pLen = 0; 475 476 ORegKey* pKey = static_cast< ORegKey* >(hKey); 477 if (!pKey) 478 return REG_INVALID_KEY; 479 480 if (pKey->isDeleted()) 481 return REG_INVALID_KEY; 482 483 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 484 if (keyName->length) 485 { 486 ORegKey* pSubKey = 0; 487 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 488 if (_ret1 != REG_NO_ERROR) 489 return _ret1; 490 491 _ret1 = pSubKey->getLongListValue(valueName, pValueList, pLen); 492 if (_ret1 != REG_NO_ERROR) 493 { 494 (void) pKey->releaseKey(pSubKey); 495 return _ret1; 496 } 497 498 return pKey->releaseKey(pSubKey); 499 } 500 501 return pKey->getLongListValue(valueName, pValueList, pLen); 502 } 503 504 //********************************************************************* 505 // getStringValueList 506 // 507 RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey, 508 rtl_uString* keyName, 509 sal_Char*** pValueList, 510 sal_uInt32* pLen) 511 { 512 OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getStringListValue(): invalid parameter"); 513 *pValueList = 0, *pLen = 0; 514 515 ORegKey* pKey = static_cast< ORegKey* >(hKey); 516 if (!pKey) 517 return REG_INVALID_KEY; 518 519 if (pKey->isDeleted()) 520 return REG_INVALID_KEY; 521 522 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 523 if (keyName->length) 524 { 525 ORegKey* pSubKey = 0; 526 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 527 if (_ret1 != REG_NO_ERROR) 528 return _ret1; 529 530 _ret1 = pSubKey->getStringListValue(valueName, pValueList, pLen); 531 if (_ret1 != REG_NO_ERROR) 532 { 533 (void) pKey->releaseKey(pSubKey); 534 return _ret1; 535 } 536 537 return pKey->releaseKey(pSubKey); 538 } 539 540 return pKey->getStringListValue(valueName, pValueList, pLen); 541 } 542 543 //********************************************************************* 544 // getUnicodeListValue 545 // 546 RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey, 547 rtl_uString* keyName, 548 sal_Unicode*** pValueList, 549 sal_uInt32* pLen) 550 { 551 OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getUnicodeListValue(): invalid parameter"); 552 *pValueList = 0, *pLen = 0; 553 554 ORegKey* pKey = static_cast< ORegKey* >(hKey); 555 if (!pKey) 556 return REG_INVALID_KEY; 557 558 if (pKey->isDeleted()) 559 return REG_INVALID_KEY; 560 561 OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); 562 if (keyName->length) 563 { 564 ORegKey* pSubKey = 0; 565 RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); 566 if (_ret1 != REG_NO_ERROR) 567 return _ret1; 568 569 _ret1 = pSubKey->getUnicodeListValue(valueName, pValueList, pLen); 570 if (_ret1 != REG_NO_ERROR) 571 { 572 (void) pKey->releaseKey(pSubKey); 573 return _ret1; 574 } 575 576 return pKey->releaseKey(pSubKey); 577 } 578 579 return pKey->getUnicodeListValue(valueName, pValueList, pLen); 580 } 581 582 //********************************************************************* 583 // freeValueList 584 // 585 RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType, 586 RegValue pValueList, 587 sal_uInt32 len) 588 { 589 switch (valueType) 590 { 591 case 5: 592 { 593 rtl_freeMemory(pValueList); 594 } 595 break; 596 case 6: 597 { 598 sal_Char** pVList = (sal_Char**)pValueList; 599 for (sal_uInt32 i=0; i < len; i++) 600 { 601 rtl_freeMemory(pVList[i]); 602 } 603 604 rtl_freeMemory(pVList); 605 } 606 break; 607 case 7: 608 { 609 sal_Unicode** pVList = (sal_Unicode**)pValueList; 610 for (sal_uInt32 i=0; i < len; i++) 611 { 612 rtl_freeMemory(pVList[i]); 613 } 614 615 rtl_freeMemory(pVList); 616 } 617 break; 618 default: 619 return REG_INVALID_VALUE; 620 } 621 622 pValueList = NULL; 623 return REG_NO_ERROR; 624 } 625 626 //********************************************************************* 627 // createLink 628 // 629 RegError REGISTRY_CALLTYPE createLink(RegKeyHandle, rtl_uString*, rtl_uString*) 630 { 631 return REG_INVALID_LINK; // links are no longer supported 632 } 633 634 //********************************************************************* 635 // deleteLink 636 // 637 RegError REGISTRY_CALLTYPE deleteLink(RegKeyHandle, rtl_uString*) 638 { 639 return REG_INVALID_LINK; // links are no longer supported 640 } 641 642 //********************************************************************* 643 // getKeyType 644 // 645 RegError REGISTRY_CALLTYPE getKeyType(RegKeyHandle hKey, 646 rtl_uString* keyName, 647 RegKeyType* pKeyType) 648 { 649 ORegKey* pKey = static_cast< ORegKey* >(hKey); 650 if (!pKey) 651 return REG_INVALID_KEY; 652 653 if (pKey->isDeleted()) 654 return REG_INVALID_KEY; 655 656 return pKey->getKeyType(keyName, pKeyType); 657 } 658 659 //********************************************************************* 660 // getLinkTarget 661 // 662 RegError REGISTRY_CALLTYPE getLinkTarget( 663 RegKeyHandle, rtl_uString*, rtl_uString**) 664 { 665 return REG_INVALID_LINK; // links are no longer supported 666 } 667 668 //********************************************************************* 669 // getName 670 // 671 RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey, 672 rtl_uString* keyName, 673 sal_Bool, 674 rtl_uString** pResolvedName) 675 { 676 ORegKey* pKey = static_cast< ORegKey* >(hKey); 677 if (!pKey) 678 return REG_INVALID_KEY; 679 680 if (pKey->isDeleted()) 681 return REG_INVALID_KEY; 682 683 OUString resolvedName; 684 RegError _ret = pKey->getResolvedKeyName(keyName, resolvedName); 685 if (_ret == REG_NO_ERROR) 686 rtl_uString_assign(pResolvedName, resolvedName.pData); 687 return _ret; 688 } 689 690 //********************************************************************* 691 // getKeyNames 692 // 693 RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey, 694 rtl_uString* keyName, 695 rtl_uString*** pSubKeyNames, 696 sal_uInt32* pnSubKeys) 697 { 698 ORegKey* pKey = static_cast< ORegKey* >(hKey); 699 if (!pKey) 700 return REG_INVALID_KEY; 701 702 if (pKey->isDeleted()) 703 return REG_INVALID_KEY; 704 705 return pKey->getKeyNames(keyName, pSubKeyNames, pnSubKeys); 706 } 707 708 //********************************************************************* 709 // freeKeyNames 710 // 711 RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString** pKeyNames, 712 sal_uInt32 nKeys) 713 { 714 for (sal_uInt32 i=0; i < nKeys; i++) 715 { 716 rtl_uString_release(pKeyNames[i]); 717 } 718 719 rtl_freeMemory(pKeyNames); 720 721 return REG_NO_ERROR; 722 } 723 724 //********************************************************************* 725 // C API 726 // 727 728 //********************************************************************* 729 // reg_createKey 730 // 731 RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey, 732 rtl_uString* keyName, 733 RegKeyHandle* phNewKey) 734 { 735 if (!hKey) 736 return REG_INVALID_KEY; 737 738 return createKey(hKey, keyName, phNewKey); 739 } 740 741 //********************************************************************* 742 // reg_openKey 743 // 744 RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey, 745 rtl_uString* keyName, 746 RegKeyHandle* phOpenKey) 747 { 748 if (!hKey) 749 return REG_INVALID_KEY; 750 751 return openKey(hKey, keyName, phOpenKey); 752 } 753 754 //********************************************************************* 755 // reg_openSubKeys 756 // 757 RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey, 758 rtl_uString* keyName, 759 RegKeyHandle** pphSubKeys, 760 sal_uInt32* pnSubKeys) 761 { 762 if (!hKey) 763 return REG_INVALID_KEY; 764 765 return openSubKeys(hKey, keyName, pphSubKeys, pnSubKeys); 766 } 767 768 //********************************************************************* 769 // reg_closeSubKeys 770 // 771 RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* pphSubKeys, 772 sal_uInt32 nSubKeys) 773 { 774 if (!pphSubKeys) 775 return REG_INVALID_KEY; 776 777 return closeSubKeys(pphSubKeys, nSubKeys); 778 } 779 780 //********************************************************************* 781 // reg_deleteKey 782 // 783 RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey, 784 rtl_uString* keyName) 785 { 786 if (!hKey) 787 return REG_INVALID_KEY; 788 789 return deleteKey(hKey, keyName); 790 } 791 792 //********************************************************************* 793 // reg_closeKey 794 // 795 RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey) 796 { 797 if (!hKey) 798 return REG_INVALID_KEY; 799 800 return closeKey(hKey); 801 } 802 803 804 //********************************************************************* 805 // reg_getKeyName 806 // 807 RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName) 808 { 809 if (hKey) 810 { 811 rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData ); 812 return REG_NO_ERROR; 813 } else 814 { 815 rtl_uString_new( pKeyName ); 816 return REG_INVALID_KEY; 817 } 818 } 819 820 //********************************************************************* 821 // reg_setValue 822 // 823 RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey, 824 rtl_uString* keyName, 825 RegValueType valueType, 826 RegValue pData, 827 sal_uInt32 valueSize) 828 { 829 if (!hKey) 830 return REG_INVALID_KEY; 831 832 return setValue(hKey, keyName, valueType, pData, valueSize); 833 } 834 835 //********************************************************************* 836 // reg_setLongListValue 837 // 838 RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey, 839 rtl_uString* keyName, 840 sal_Int32* pValueList, 841 sal_uInt32 len) 842 { 843 if (!hKey) 844 return REG_INVALID_KEY; 845 846 return setLongListValue(hKey, keyName, pValueList, len); 847 } 848 849 //********************************************************************* 850 // reg_setStringListValue 851 // 852 RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey, 853 rtl_uString* keyName, 854 sal_Char** pValueList, 855 sal_uInt32 len) 856 { 857 if (!hKey) 858 return REG_INVALID_KEY; 859 860 return setStringListValue(hKey, keyName, pValueList, len); 861 } 862 863 //********************************************************************* 864 // reg_setUnicodeListValue 865 // 866 RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey, 867 rtl_uString* keyName, 868 sal_Unicode** pValueList, 869 sal_uInt32 len) 870 { 871 if (!hKey) 872 return REG_INVALID_KEY; 873 874 return setUnicodeListValue(hKey, keyName, pValueList, len); 875 } 876 877 //********************************************************************* 878 // reg_getValueInfo 879 // 880 RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey, 881 rtl_uString* keyName, 882 RegValueType* pValueType, 883 sal_uInt32* pValueSize) 884 { 885 if (!hKey) 886 return REG_INVALID_KEY; 887 888 return getValueInfo(hKey, keyName, pValueType, pValueSize); 889 } 890 891 //********************************************************************* 892 // reg_getValueInfo 893 // 894 RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey, 895 rtl_uString* keyName, 896 RegValue pData) 897 { 898 if (!hKey) 899 return REG_INVALID_KEY; 900 901 return getValue(hKey, keyName, pData); 902 } 903 904 //********************************************************************* 905 // reg_getLongListValue 906 // 907 RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey, 908 rtl_uString* keyName, 909 sal_Int32** pValueList, 910 sal_uInt32* pLen) 911 { 912 if (!hKey) 913 return REG_INVALID_KEY; 914 915 return getLongListValue(hKey, keyName, pValueList, pLen); 916 } 917 918 //********************************************************************* 919 // reg_getStringListValue 920 // 921 RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey, 922 rtl_uString* keyName, 923 sal_Char*** pValueList, 924 sal_uInt32* pLen) 925 { 926 if (!hKey) 927 return REG_INVALID_KEY; 928 929 return getStringListValue(hKey, keyName, pValueList, pLen); 930 } 931 932 //********************************************************************* 933 // reg_getUnicodeListValue 934 // 935 RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey, 936 rtl_uString* keyName, 937 sal_Unicode*** pValueList, 938 sal_uInt32* pLen) 939 { 940 if (!hKey) 941 return REG_INVALID_KEY; 942 943 return getUnicodeListValue(hKey, keyName, pValueList, pLen); 944 } 945 946 //********************************************************************* 947 // reg_freeValueList 948 // 949 RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType, 950 RegValue pValueList, 951 sal_uInt32 len) 952 { 953 if (pValueList) 954 return freeValueList(valueType, pValueList, len); 955 else 956 return REG_INVALID_VALUE; 957 } 958 959 //********************************************************************* 960 // reg_createLink 961 // 962 RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey, 963 rtl_uString* linkName, 964 rtl_uString* linkTarget) 965 { 966 if (!hKey) 967 return REG_INVALID_KEY; 968 969 return createLink(hKey, linkName, linkTarget); 970 } 971 972 //********************************************************************* 973 // reg_deleteLink 974 // 975 RegError REGISTRY_CALLTYPE reg_deleteLink(RegKeyHandle hKey, 976 rtl_uString* linkName) 977 { 978 if (!hKey) 979 return REG_INVALID_KEY; 980 981 return deleteLink(hKey, linkName); 982 } 983 984 //********************************************************************* 985 // reg_getKeyType 986 // 987 RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey, 988 rtl_uString* keyName, 989 RegKeyType* pKeyType) 990 { 991 if (!hKey) 992 return REG_INVALID_KEY; 993 994 return getKeyType(hKey, keyName, pKeyType); 995 } 996 997 //********************************************************************* 998 // reg_getLinkTarget 999 // 1000 RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey, 1001 rtl_uString* linkName, 1002 rtl_uString** pLinkTarget) 1003 { 1004 if (!hKey) 1005 return REG_INVALID_KEY; 1006 1007 return getLinkTarget(hKey, linkName, pLinkTarget); 1008 } 1009 1010 //********************************************************************* 1011 // reg_getResolvedKeyName 1012 // 1013 RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey, 1014 rtl_uString* keyName, 1015 sal_Bool firstLinkOnly, 1016 rtl_uString** pResolvedName) 1017 { 1018 if (!hKey) 1019 return REG_INVALID_KEY; 1020 1021 return getResolvedKeyName(hKey, keyName, firstLinkOnly, pResolvedName); 1022 } 1023