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