1*51134e9eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*51134e9eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*51134e9eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*51134e9eSAndrew Rist * distributed with this work for additional information 6*51134e9eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*51134e9eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*51134e9eSAndrew Rist * "License"); you may not use this file except in compliance 9*51134e9eSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*51134e9eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*51134e9eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*51134e9eSAndrew Rist * software distributed under the License is distributed on an 15*51134e9eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*51134e9eSAndrew Rist * KIND, either express or implied. See the License for the 17*51134e9eSAndrew Rist * specific language governing permissions and limitations 18*51134e9eSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*51134e9eSAndrew Rist *************************************************************/ 21*51134e9eSAndrew Rist 22*51134e9eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_registry.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <registry/registry.h> 28cdf0e10cSrcweir #include <registry/registry.hxx> 29cdf0e10cSrcweir #include <osl/process.h> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "keyimpl.hxx" 32cdf0e10cSrcweir #include "regimpl.hxx" 33cdf0e10cSrcweir #include "regkey.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir #if defined(WIN32) || defined(WNT) || defined(OS2) 36cdf0e10cSrcweir #include <io.h> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <string.h> 40cdf0e10cSrcweir #if defined(UNX) 41cdf0e10cSrcweir #include <stdlib.h> 42cdf0e10cSrcweir #include <unistd.h> 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir 45cdf0e10cSrcweir #if defined ( GCC ) && ( defined ( SCO ) ) 46cdf0e10cSrcweir ORealDynamicLoader* ODynamicLoader<Registry_Api>::m_pLoader = NULL; 47cdf0e10cSrcweir #endif 48cdf0e10cSrcweir 49cdf0e10cSrcweir extern "C" { 50cdf0e10cSrcweir 51cdf0e10cSrcweir //********************************************************************* 52cdf0e10cSrcweir // acquire 53cdf0e10cSrcweir // 54cdf0e10cSrcweir static void REGISTRY_CALLTYPE acquire(RegHandle hReg) 55cdf0e10cSrcweir { 56cdf0e10cSrcweir ORegistry* pReg = (ORegistry*) hReg; 57cdf0e10cSrcweir 58cdf0e10cSrcweir if (pReg != NULL) 59cdf0e10cSrcweir pReg->acquire(); 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir 63cdf0e10cSrcweir //********************************************************************* 64cdf0e10cSrcweir // release 65cdf0e10cSrcweir // 66cdf0e10cSrcweir static void REGISTRY_CALLTYPE release(RegHandle hReg) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir ORegistry* pReg = (ORegistry*) hReg; 69cdf0e10cSrcweir 70cdf0e10cSrcweir if (pReg) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir if (pReg->release() == 0) 73cdf0e10cSrcweir { 74cdf0e10cSrcweir delete pReg; 75cdf0e10cSrcweir hReg = NULL; 76cdf0e10cSrcweir } 77cdf0e10cSrcweir } 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir 81cdf0e10cSrcweir //********************************************************************* 82cdf0e10cSrcweir // getName 83cdf0e10cSrcweir // 84cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE getName(RegHandle hReg, rtl_uString** pName) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir ORegistry* pReg; 87cdf0e10cSrcweir 88cdf0e10cSrcweir if (hReg) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir pReg = (ORegistry*)hReg; 91cdf0e10cSrcweir if ( pReg->isOpen() ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir rtl_uString_assign(pName, pReg->getName().pData); 94cdf0e10cSrcweir return REG_NO_ERROR; 95cdf0e10cSrcweir } else 96cdf0e10cSrcweir { 97cdf0e10cSrcweir rtl_uString_new(pName); 98cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 99cdf0e10cSrcweir } 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir rtl_uString_new(pName); 103cdf0e10cSrcweir return REG_INVALID_REGISTRY; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir 107cdf0e10cSrcweir //********************************************************************* 108cdf0e10cSrcweir // isReadOnly 109cdf0e10cSrcweir // 110cdf0e10cSrcweir static sal_Bool REGISTRY_CALLTYPE isReadOnly(RegHandle hReg) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir if (hReg) 113cdf0e10cSrcweir return ((ORegistry*)hReg)->isReadOnly(); 114cdf0e10cSrcweir else 115cdf0e10cSrcweir return sal_False; 116cdf0e10cSrcweir } 117cdf0e10cSrcweir 118cdf0e10cSrcweir 119cdf0e10cSrcweir //********************************************************************* 120cdf0e10cSrcweir // createRegistry 121cdf0e10cSrcweir // 122cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE createRegistry(rtl_uString* registryName, 123cdf0e10cSrcweir RegHandle* phRegistry) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir RegError ret; 126cdf0e10cSrcweir 127cdf0e10cSrcweir ORegistry* pReg = new ORegistry(); 128cdf0e10cSrcweir if ((ret = pReg->initRegistry(registryName, REG_CREATE))) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir *phRegistry = NULL; 131cdf0e10cSrcweir return ret; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir *phRegistry = pReg; 135cdf0e10cSrcweir 136cdf0e10cSrcweir return REG_NO_ERROR; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //********************************************************************* 140cdf0e10cSrcweir // openRootKey 141cdf0e10cSrcweir // 142cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE openRootKey(RegHandle hReg, 143cdf0e10cSrcweir RegKeyHandle* phRootKey) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir ORegistry* pReg; 146cdf0e10cSrcweir 147cdf0e10cSrcweir if (hReg) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir pReg = (ORegistry*)hReg; 150cdf0e10cSrcweir if (!pReg->isOpen()) 151cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 152cdf0e10cSrcweir } else 153cdf0e10cSrcweir { 154cdf0e10cSrcweir phRootKey = NULL; 155cdf0e10cSrcweir return REG_INVALID_REGISTRY; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir 158cdf0e10cSrcweir *phRootKey = pReg->getRootKey(); 159cdf0e10cSrcweir 160cdf0e10cSrcweir return REG_NO_ERROR; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir 164cdf0e10cSrcweir //********************************************************************* 165cdf0e10cSrcweir // openRegistry 166cdf0e10cSrcweir // 167cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString* registryName, 168cdf0e10cSrcweir RegHandle* phRegistry, 169cdf0e10cSrcweir RegAccessMode accessMode) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir RegError _ret; 172cdf0e10cSrcweir 173cdf0e10cSrcweir ORegistry* pReg = new ORegistry(); 174cdf0e10cSrcweir if ((_ret = pReg->initRegistry(registryName, accessMode))) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir *phRegistry = NULL; 177cdf0e10cSrcweir delete pReg; 178cdf0e10cSrcweir return _ret; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir 182cdf0e10cSrcweir *phRegistry = pReg; 183cdf0e10cSrcweir 184cdf0e10cSrcweir return REG_NO_ERROR; 185cdf0e10cSrcweir } 186cdf0e10cSrcweir 187cdf0e10cSrcweir //********************************************************************* 188cdf0e10cSrcweir // closeRegistry 189cdf0e10cSrcweir // 190cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir ORegistry *pReg; 193cdf0e10cSrcweir 194cdf0e10cSrcweir if (hReg) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir pReg = (ORegistry*)hReg; 197cdf0e10cSrcweir if (!pReg->isOpen()) 198cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 199cdf0e10cSrcweir 200cdf0e10cSrcweir RegError ret = REG_NO_ERROR; 201cdf0e10cSrcweir if (pReg->release() == 0) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir delete(pReg); 204cdf0e10cSrcweir hReg = NULL; 205cdf0e10cSrcweir } 206cdf0e10cSrcweir else 207cdf0e10cSrcweir ret = pReg->closeRegistry(); 208cdf0e10cSrcweir 209cdf0e10cSrcweir return ret; 210cdf0e10cSrcweir } else 211cdf0e10cSrcweir { 212cdf0e10cSrcweir return REG_INVALID_REGISTRY; 213cdf0e10cSrcweir } 214cdf0e10cSrcweir } 215cdf0e10cSrcweir 216cdf0e10cSrcweir 217cdf0e10cSrcweir //********************************************************************* 218cdf0e10cSrcweir // destroyRegistry 219cdf0e10cSrcweir // 220cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg, 221cdf0e10cSrcweir rtl_uString* registryName) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir ORegistry *pReg; 224cdf0e10cSrcweir 225cdf0e10cSrcweir if (hReg) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir pReg = (ORegistry*)hReg; 228cdf0e10cSrcweir if (!pReg->isOpen()) 229cdf0e10cSrcweir return REG_INVALID_REGISTRY; 230cdf0e10cSrcweir 231cdf0e10cSrcweir RegError ret = pReg->destroyRegistry(registryName); 232cdf0e10cSrcweir if (!ret) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir if (!registryName->length) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir delete(pReg); 237cdf0e10cSrcweir hReg = NULL; 238cdf0e10cSrcweir } 239cdf0e10cSrcweir } 240cdf0e10cSrcweir return ret; 241cdf0e10cSrcweir } else 242cdf0e10cSrcweir { 243cdf0e10cSrcweir return REG_INVALID_REGISTRY; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir } 246cdf0e10cSrcweir 247cdf0e10cSrcweir 248cdf0e10cSrcweir //********************************************************************* 249cdf0e10cSrcweir // loadRegKey 250cdf0e10cSrcweir // 251cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE loadKey(RegHandle hReg, 252cdf0e10cSrcweir RegKeyHandle hKey, 253cdf0e10cSrcweir rtl_uString* keyName, 254cdf0e10cSrcweir rtl_uString* regFileName) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir 257cdf0e10cSrcweir ORegistry* pReg = static_cast< ORegistry* >(hReg); 258cdf0e10cSrcweir if (!pReg) 259cdf0e10cSrcweir return REG_INVALID_REGISTRY; 260cdf0e10cSrcweir 261cdf0e10cSrcweir if (!pReg->isOpen()) 262cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 263cdf0e10cSrcweir 264cdf0e10cSrcweir ORegKey* pKey = static_cast< ORegKey* >(hKey); 265cdf0e10cSrcweir if (!pKey) 266cdf0e10cSrcweir return REG_INVALID_KEY; 267cdf0e10cSrcweir 268cdf0e10cSrcweir if (pKey->getRegistry() != pReg) 269cdf0e10cSrcweir return REG_INVALID_KEY; 270cdf0e10cSrcweir if (pKey->isDeleted()) 271cdf0e10cSrcweir return REG_INVALID_KEY; 272cdf0e10cSrcweir if (pKey->isReadOnly()) 273cdf0e10cSrcweir return REG_REGISTRY_READONLY; 274cdf0e10cSrcweir 275cdf0e10cSrcweir 276cdf0e10cSrcweir ORegKey* pNewKey = 0; 277cdf0e10cSrcweir RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey); 278cdf0e10cSrcweir if (_ret == REG_NO_ERROR) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir pKey->releaseKey(pNewKey); 281cdf0e10cSrcweir pKey->deleteKey(keyName); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey); 285cdf0e10cSrcweir if (_ret != REG_NO_ERROR) 286cdf0e10cSrcweir return _ret; 287cdf0e10cSrcweir 288cdf0e10cSrcweir _ret = pReg->loadKey(pNewKey, regFileName); 289cdf0e10cSrcweir if (_ret != REG_NO_ERROR) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir pKey->releaseKey(pNewKey); 292cdf0e10cSrcweir pKey->deleteKey(keyName); 293cdf0e10cSrcweir return _ret; 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir return pKey->closeKey(pNewKey); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir //********************************************************************* 300cdf0e10cSrcweir // saveKey 301cdf0e10cSrcweir // 302cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE saveKey(RegHandle hReg, 303cdf0e10cSrcweir RegKeyHandle hKey, 304cdf0e10cSrcweir rtl_uString* keyName, 305cdf0e10cSrcweir rtl_uString* regFileName) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir 308cdf0e10cSrcweir ORegistry* pReg = static_cast< ORegistry* >(hReg); 309cdf0e10cSrcweir if (!pReg) 310cdf0e10cSrcweir return REG_INVALID_REGISTRY; 311cdf0e10cSrcweir 312cdf0e10cSrcweir if (!pReg->isOpen()) 313cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 314cdf0e10cSrcweir 315cdf0e10cSrcweir ORegKey* pKey = static_cast< ORegKey* >(hKey); 316cdf0e10cSrcweir if (!pKey) 317cdf0e10cSrcweir return REG_INVALID_KEY; 318cdf0e10cSrcweir 319cdf0e10cSrcweir if (pKey->getRegistry() != pReg) 320cdf0e10cSrcweir return REG_INVALID_KEY; 321cdf0e10cSrcweir if (pKey->isDeleted()) 322cdf0e10cSrcweir return REG_INVALID_KEY; 323cdf0e10cSrcweir 324cdf0e10cSrcweir ORegKey* pNewKey = 0; 325cdf0e10cSrcweir RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey); 326cdf0e10cSrcweir if (_ret != REG_NO_ERROR) 327cdf0e10cSrcweir return _ret; 328cdf0e10cSrcweir 329cdf0e10cSrcweir _ret = pReg->saveKey(pNewKey, regFileName); 330cdf0e10cSrcweir if (_ret != REG_NO_ERROR) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir (void) pKey->releaseKey(pNewKey); 333cdf0e10cSrcweir return _ret; 334cdf0e10cSrcweir } 335cdf0e10cSrcweir 336cdf0e10cSrcweir return pKey->releaseKey(pNewKey); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir //********************************************************************* 340cdf0e10cSrcweir // mergeKey 341cdf0e10cSrcweir // 342cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg, 343cdf0e10cSrcweir RegKeyHandle hKey, 344cdf0e10cSrcweir rtl_uString* keyName, 345cdf0e10cSrcweir rtl_uString* regFileName, 346cdf0e10cSrcweir sal_Bool bWarnings, 347cdf0e10cSrcweir sal_Bool bReport) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir ORegistry* pReg = static_cast< ORegistry* >(hReg); 350cdf0e10cSrcweir if (!pReg) 351cdf0e10cSrcweir return REG_INVALID_REGISTRY; 352cdf0e10cSrcweir if (!pReg->isOpen()) 353cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 354cdf0e10cSrcweir 355cdf0e10cSrcweir ORegKey* pKey = static_cast< ORegKey* >(hKey); 356cdf0e10cSrcweir if (!pKey) 357cdf0e10cSrcweir return REG_INVALID_KEY; 358cdf0e10cSrcweir if (pKey->getRegistry() != pReg) 359cdf0e10cSrcweir return REG_INVALID_KEY; 360cdf0e10cSrcweir if (pKey->isDeleted()) 361cdf0e10cSrcweir return REG_INVALID_KEY; 362cdf0e10cSrcweir if (pKey->isReadOnly()) 363cdf0e10cSrcweir return REG_REGISTRY_READONLY; 364cdf0e10cSrcweir 365cdf0e10cSrcweir if (keyName->length) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir ORegKey* pNewKey = 0; 368cdf0e10cSrcweir RegError _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey); 369cdf0e10cSrcweir if (_ret != REG_NO_ERROR) 370cdf0e10cSrcweir return _ret; 371cdf0e10cSrcweir 372cdf0e10cSrcweir _ret = pReg->loadKey(pNewKey, regFileName, bWarnings, bReport); 373cdf0e10cSrcweir if (_ret == REG_MERGE_ERROR || (_ret == REG_MERGE_CONFLICT && bWarnings)) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir if (pNewKey != pKey) 376cdf0e10cSrcweir (void) pKey->closeKey(pNewKey); 377cdf0e10cSrcweir else 378cdf0e10cSrcweir (void) pKey->releaseKey(pNewKey); 379cdf0e10cSrcweir return _ret; 380cdf0e10cSrcweir } 381cdf0e10cSrcweir 382cdf0e10cSrcweir return (pNewKey != pKey) ? pKey->closeKey(pNewKey) : pKey->releaseKey(pNewKey); 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir return pReg->loadKey(pKey, regFileName, bWarnings, bReport); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir //********************************************************************* 389cdf0e10cSrcweir // dumpRegistry 390cdf0e10cSrcweir // 391cdf0e10cSrcweir static RegError REGISTRY_CALLTYPE dumpRegistry(RegHandle hReg, 392cdf0e10cSrcweir RegKeyHandle hKey) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir ORegistry* pReg = static_cast< ORegistry* >(hReg); 395cdf0e10cSrcweir if (!pReg) 396cdf0e10cSrcweir return REG_INVALID_REGISTRY; 397cdf0e10cSrcweir if (!pReg->isOpen()) 398cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 399cdf0e10cSrcweir 400cdf0e10cSrcweir ORegKey* pKey = static_cast< ORegKey* >(hKey); 401cdf0e10cSrcweir if (!pKey) 402cdf0e10cSrcweir return REG_INVALID_KEY; 403cdf0e10cSrcweir if (pKey->getRegistry() != pReg) 404cdf0e10cSrcweir return REG_INVALID_KEY; 405cdf0e10cSrcweir if (pKey->isDeleted()) 406cdf0e10cSrcweir return REG_INVALID_KEY; 407cdf0e10cSrcweir 408cdf0e10cSrcweir return pReg->dumpRegistry(hKey); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir //********************************************************************* 412cdf0e10cSrcweir // initRegistry_Api 413cdf0e10cSrcweir // 414cdf0e10cSrcweir Registry_Api* REGISTRY_CALLTYPE initRegistry_Api(void) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir static Registry_Api aApi= {&acquire, 417cdf0e10cSrcweir &release, 418cdf0e10cSrcweir &isReadOnly, 419cdf0e10cSrcweir &openRootKey, 420cdf0e10cSrcweir &getName, 421cdf0e10cSrcweir &createRegistry, 422cdf0e10cSrcweir &openRegistry, 423cdf0e10cSrcweir &closeRegistry, 424cdf0e10cSrcweir &destroyRegistry, 425cdf0e10cSrcweir &loadKey, 426cdf0e10cSrcweir &saveKey, 427cdf0e10cSrcweir &mergeKey, 428cdf0e10cSrcweir &dumpRegistry, 429cdf0e10cSrcweir &acquireKey, 430cdf0e10cSrcweir &releaseKey, 431cdf0e10cSrcweir &isKeyReadOnly, 432cdf0e10cSrcweir &getKeyName, 433cdf0e10cSrcweir &createKey, 434cdf0e10cSrcweir &openKey, 435cdf0e10cSrcweir &openSubKeys, 436cdf0e10cSrcweir &closeSubKeys, 437cdf0e10cSrcweir &deleteKey, 438cdf0e10cSrcweir &closeKey, 439cdf0e10cSrcweir &setValue, 440cdf0e10cSrcweir &setLongListValue, 441cdf0e10cSrcweir &setStringListValue, 442cdf0e10cSrcweir &setUnicodeListValue, 443cdf0e10cSrcweir &getValueInfo, 444cdf0e10cSrcweir &getValue, 445cdf0e10cSrcweir &getLongListValue, 446cdf0e10cSrcweir &getStringListValue, 447cdf0e10cSrcweir &getUnicodeListValue, 448cdf0e10cSrcweir &freeValueList, 449cdf0e10cSrcweir &createLink, 450cdf0e10cSrcweir &deleteLink, 451cdf0e10cSrcweir &getKeyType, 452cdf0e10cSrcweir &getLinkTarget, 453cdf0e10cSrcweir &getResolvedKeyName, 454cdf0e10cSrcweir &getKeyNames, 455cdf0e10cSrcweir &freeKeyNames}; 456cdf0e10cSrcweir 457cdf0e10cSrcweir return (&aApi); 458cdf0e10cSrcweir } 459cdf0e10cSrcweir 460cdf0e10cSrcweir } 461cdf0e10cSrcweir 462cdf0e10cSrcweir //********************************************************************* 463cdf0e10cSrcweir // reg_loadRegKey 464cdf0e10cSrcweir // 465cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey, 466cdf0e10cSrcweir rtl_uString* keyName, 467cdf0e10cSrcweir rtl_uString* regFileName) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir ORegKey *pKey; 470cdf0e10cSrcweir 471cdf0e10cSrcweir if (hKey) 472cdf0e10cSrcweir pKey = (ORegKey*)hKey; 473cdf0e10cSrcweir else 474cdf0e10cSrcweir return REG_INVALID_KEY; 475cdf0e10cSrcweir 476cdf0e10cSrcweir return loadKey(pKey->getRegistry(), hKey, keyName, regFileName); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir //********************************************************************* 480cdf0e10cSrcweir // reg_saveKey 481cdf0e10cSrcweir // 482cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey, 483cdf0e10cSrcweir rtl_uString* keyName, 484cdf0e10cSrcweir rtl_uString* regFileName) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir ORegKey *pKey; 487cdf0e10cSrcweir 488cdf0e10cSrcweir if (hKey) 489cdf0e10cSrcweir pKey = (ORegKey*)hKey; 490cdf0e10cSrcweir else 491cdf0e10cSrcweir return REG_INVALID_KEY; 492cdf0e10cSrcweir 493cdf0e10cSrcweir return saveKey(pKey->getRegistry(), hKey, keyName, regFileName); 494cdf0e10cSrcweir } 495cdf0e10cSrcweir 496cdf0e10cSrcweir //********************************************************************* 497cdf0e10cSrcweir // reg_mergeKey 498cdf0e10cSrcweir // 499cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey, 500cdf0e10cSrcweir rtl_uString* keyName, 501cdf0e10cSrcweir rtl_uString* regFileName, 502cdf0e10cSrcweir sal_Bool bWarnings, 503cdf0e10cSrcweir sal_Bool bReport) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir ORegKey *pKey; 506cdf0e10cSrcweir 507cdf0e10cSrcweir if (hKey) 508cdf0e10cSrcweir pKey = (ORegKey*)hKey; 509cdf0e10cSrcweir else 510cdf0e10cSrcweir return REG_INVALID_KEY; 511cdf0e10cSrcweir 512cdf0e10cSrcweir return mergeKey(pKey->getRegistry(), hKey, keyName, regFileName, bWarnings, bReport); 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir //********************************************************************* 516cdf0e10cSrcweir // reg_createRegistry 517cdf0e10cSrcweir // 518cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName, 519cdf0e10cSrcweir RegHandle* phRegistry) 520cdf0e10cSrcweir { 521cdf0e10cSrcweir RegError ret; 522cdf0e10cSrcweir 523cdf0e10cSrcweir ORegistry* pReg = new ORegistry(); 524cdf0e10cSrcweir if ((ret = pReg->initRegistry(registryName, REG_CREATE))) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir *phRegistry = NULL; 527cdf0e10cSrcweir return ret; 528cdf0e10cSrcweir } 529cdf0e10cSrcweir 530cdf0e10cSrcweir *phRegistry = pReg; 531cdf0e10cSrcweir 532cdf0e10cSrcweir return REG_NO_ERROR; 533cdf0e10cSrcweir } 534cdf0e10cSrcweir 535cdf0e10cSrcweir //********************************************************************* 536cdf0e10cSrcweir // reg_openRootKey 537cdf0e10cSrcweir // 538cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry, 539cdf0e10cSrcweir RegKeyHandle* phRootKey) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir return openRootKey(hRegistry, phRootKey); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir 545cdf0e10cSrcweir //********************************************************************* 546cdf0e10cSrcweir // reg_getName 547cdf0e10cSrcweir // 548cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName) 549cdf0e10cSrcweir { 550cdf0e10cSrcweir return getName(hRegistry, pName); 551cdf0e10cSrcweir } 552cdf0e10cSrcweir 553cdf0e10cSrcweir 554cdf0e10cSrcweir //********************************************************************* 555cdf0e10cSrcweir // reg_isReadOnly 556cdf0e10cSrcweir // 557cdf0e10cSrcweir sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hRegistry) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir return isReadOnly(hRegistry); 560cdf0e10cSrcweir } 561cdf0e10cSrcweir 562cdf0e10cSrcweir 563cdf0e10cSrcweir //********************************************************************* 564cdf0e10cSrcweir // reg_openRegistry 565cdf0e10cSrcweir // 566cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName, 567cdf0e10cSrcweir RegHandle* phRegistry, 568cdf0e10cSrcweir RegAccessMode accessMode) 569cdf0e10cSrcweir { 570cdf0e10cSrcweir RegError _ret; 571cdf0e10cSrcweir 572cdf0e10cSrcweir ORegistry* pReg = new ORegistry(); 573cdf0e10cSrcweir if ((_ret = pReg->initRegistry(registryName, accessMode))) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir *phRegistry = NULL; 576cdf0e10cSrcweir return _ret; 577cdf0e10cSrcweir } 578cdf0e10cSrcweir 579cdf0e10cSrcweir *phRegistry = pReg; 580cdf0e10cSrcweir 581cdf0e10cSrcweir return REG_NO_ERROR; 582cdf0e10cSrcweir } 583cdf0e10cSrcweir 584cdf0e10cSrcweir //********************************************************************* 585cdf0e10cSrcweir // reg_closeRegistry 586cdf0e10cSrcweir // 587cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir ORegistry* pReg; 590cdf0e10cSrcweir 591cdf0e10cSrcweir if (hRegistry) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir pReg = (ORegistry*)hRegistry; 594cdf0e10cSrcweir delete(pReg); 595cdf0e10cSrcweir return REG_NO_ERROR; 596cdf0e10cSrcweir } else 597cdf0e10cSrcweir { 598cdf0e10cSrcweir return REG_REGISTRY_NOT_OPEN; 599cdf0e10cSrcweir } 600cdf0e10cSrcweir } 601cdf0e10cSrcweir 602cdf0e10cSrcweir 603cdf0e10cSrcweir //********************************************************************* 604cdf0e10cSrcweir // reg_destroyRegistry 605cdf0e10cSrcweir // 606cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_destroyRegistry(RegHandle hRegistry, 607cdf0e10cSrcweir rtl_uString* registryName) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir return destroyRegistry(hRegistry, registryName); 610cdf0e10cSrcweir } 611cdf0e10cSrcweir 612cdf0e10cSrcweir 613cdf0e10cSrcweir //********************************************************************* 614cdf0e10cSrcweir // reg_dumpRegistry 615cdf0e10cSrcweir // 616cdf0e10cSrcweir RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir ORegKey *pKey; 619cdf0e10cSrcweir 620cdf0e10cSrcweir if (hKey) 621cdf0e10cSrcweir pKey = (ORegKey*)hKey; 622cdf0e10cSrcweir else 623cdf0e10cSrcweir return REG_INVALID_KEY; 624cdf0e10cSrcweir 625cdf0e10cSrcweir return dumpRegistry(pKey->getRegistry(), hKey); 626cdf0e10cSrcweir } 627cdf0e10cSrcweir 628cdf0e10cSrcweir 629