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