sync with tizen_2.0
[platform/framework/native/appfw.git] / src / io / FIoRegistry.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FIoRegistry.cpp
20  * @brief       This is the implementation file for %Registry class.
21  */
22
23 #include <new>
24 #include <limits.h>
25 #include <unique_ptr.h>
26
27 #include <FBaseInteger.h>
28 #include <FBaseDouble.h>
29 #include <FBaseFloat.h>
30 #include <FBaseUuId.h>
31 #include <FBaseString.h>
32 #include <FBaseByteBuffer.h>
33 #include <FBaseUtilStringTokenizer.h>
34 #include <FBaseResult.h>
35 #include <FBaseSysLog.h>
36 #include <FIoRegistry.h>
37
38 #include <FBase_StringConverter.h>
39 #include <FApp_AppInfo.h>
40 #include "FIo_RegistryImpl.h"
41
42 using namespace std;
43 using namespace Tizen::Base;
44 using namespace Tizen::Base::Utility;
45 using namespace Tizen::Base::Collection;
46
47 namespace Tizen { namespace Io
48 {
49
50 Registry::Registry(void)
51         : __pRegistryImpl(null)
52 {
53 }
54
55 Registry::~Registry(void)
56 {
57         delete __pRegistryImpl;
58         __pRegistryImpl = null;
59 }
60
61 // This method will be removed in a future release.
62 result
63 Registry::Construct(const String& regPath, bool createIfNotExist)
64 {
65         SysAssertf(__pRegistryImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
66
67         long openMode = REG_OPEN_READ_WRITE;
68         if (createIfNotExist)
69         {
70                 openMode |= REG_OPEN_CREATE;
71         }
72
73         return Construct(regPath, openMode, null);
74 }
75
76 // This method will be removed in a future release.
77 result
78 Registry::Construct(const String& regPath, long openMode, long option)
79 {
80         SysAssertf(__pRegistryImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
81         SysTryReturnResult(NID_IO, regPath.GetLength() > 0 && regPath.GetLength() <= PATH_MAX, E_INVALID_ARG,
82                         "The length of the specified regPath is zero or exceeds system limitations.");
83
84         unique_ptr<_RegistryImpl> pRegistryImpl(new (std::nothrow) _RegistryImpl());
85         SysTryReturnResult(NID_IO, pRegistryImpl != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
86
87         result r = pRegistryImpl->Construct(regPath, openMode, null);
88         if (IsFailed(r))
89         {
90                 if (r == E_SYSTEM && Tizen::App::_AppInfo::IsOspCompat() == true)
91                 {
92                         r = E_IO;
93                 }
94                 SysPropagate(NID_IO, r);
95                 return r;
96         }
97         __pRegistryImpl = pRegistryImpl.release();
98
99         return E_SUCCESS;
100 }
101
102 result
103 Registry::Construct(const String& regPath, const char* pOpenMode)
104 {
105         SysAssertf(__pRegistryImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
106         SysTryReturnResult(NID_IO, regPath.GetLength() > 0 && regPath.GetLength() <= PATH_MAX, E_INVALID_ARG,
107                         "The length of the specified regPath is zero or exceeds system limitations.");
108
109         unique_ptr<_RegistryImpl> pRegistryImpl(new (std::nothrow) _RegistryImpl());
110         SysTryReturnResult(NID_IO, pRegistryImpl != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
111
112         result r = pRegistryImpl->Construct(regPath, pOpenMode, null);
113         SysTryReturn(NID_IO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
114
115         __pRegistryImpl = pRegistryImpl.release();
116
117         return E_SUCCESS;
118 }
119
120 result
121 Registry::Construct(const String& regPath, const char* pOpenMode, const ByteBuffer& key)
122 {
123         SysAssertf(__pRegistryImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
124         SysTryReturnResult(NID_IO, regPath.GetLength() > 0 && regPath.GetLength() <= PATH_MAX, E_INVALID_ARG,
125                         "The length of the specified regPath is zero or exceeds system limitations.");
126
127         unique_ptr<_RegistryImpl> pRegistryImpl(new (std::nothrow) _RegistryImpl());
128         SysTryReturnResult(NID_IO, pRegistryImpl != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
129
130         result r = pRegistryImpl->Construct(regPath, pOpenMode, &key);
131         SysTryReturn(NID_IO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
132
133         __pRegistryImpl = pRegistryImpl.release();
134
135         return E_SUCCESS;
136 }
137
138 result
139 Registry::Flush(void)
140 {
141         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
142         result r = E_SUCCESS;
143
144         r = __pRegistryImpl->Flush();
145         SysTryReturn(NID_IO, !IsFailed(r), r, r, "[%s] Flush failed.", GetErrorMessage(r));
146
147         return r;
148 }
149
150 result
151 Registry::AddSection(const String& sectionName)
152 {
153         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
154         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
155
156         return __pRegistryImpl->AddSection(sectionName);
157 }
158
159 result
160 Registry::RemoveSection(const String& sectionName)
161 {
162         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
163         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
164
165         return __pRegistryImpl->RemoveSection(sectionName);
166 }
167
168 IList*
169 Registry::GetAllSectionNamesN(void) const
170 {
171         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
172         result r = E_SUCCESS;
173         IList* pList = null;
174
175         r = __pRegistryImpl->GetSectionListN(&pList);
176         SysTryReturn(NID_IO, !IsFailed(r), null, r, "[%s] Propagating to caller...", GetErrorMessage(r));
177
178         SetLastResult(E_SUCCESS);
179         return pList;
180 }
181
182 IList*
183 Registry::GetAllEntryNamesN(const String& sectionName) const
184 {
185         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
186         return __pRegistryImpl->GetAllEntryNamesN(sectionName);
187 }
188
189 result
190 Registry::AddValue(const String& sectionName, const String& entryName, int value)
191 {
192         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
193         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
194         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
195
196         return __pRegistryImpl->AddValue(sectionName, entryName, Integer::ToString(value));
197 }
198
199 result
200 Registry::AddValue(const String& sectionName, const String& entryName, double value)
201 {
202         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
203         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
204         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
205
206         return __pRegistryImpl->AddValue(sectionName, entryName, Double::ToString(value));
207 }
208
209 result
210 Registry::AddValue(const String& sectionName, const String& entryName, float value)
211 {
212         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
213         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
214         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
215
216         return __pRegistryImpl->AddValue(sectionName, entryName, Float::ToString(value));
217 }
218
219 result
220 Registry::AddValue(const String& sectionName, const String& entryName, const String& value)
221 {
222         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
223         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
224         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
225
226         return __pRegistryImpl->AddValue(sectionName, entryName, value);
227 }
228
229 result
230 Registry::AddValue(const String& sectionName, const String& entryName, const UuId& value)
231 {
232         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
233         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
234         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
235
236         return __pRegistryImpl->AddValue(sectionName, entryName, value.ToString());
237 }
238
239 result
240 Registry::AddValue(const String& sectionName, const String& entryName, const ByteBuffer& value)
241 {
242         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
243         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
244         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
245
246         int size = value.GetLimit();
247         SysTryReturnResult(NID_IO, size > 0, E_INVALID_ARG, "invalid buffer length");
248
249         String strValEncoded;
250         String strVal;
251         result r = E_SUCCESS;
252         byte* pValue = const_cast< byte* >(value.GetPointer());
253         SysAssert(pValue);
254
255         for (int i = 0; i < size; i++)
256         {
257                 r = strValEncoded.Format(3, L"%02x", (static_cast< unsigned char* >(pValue)[i]));
258                 if (IsFailed(r))
259                 {
260                         SysLog(NID_IO, "[%s] Propagated.", GetErrorMessage(r));
261                         return r;
262                 }
263                 r = strVal.Append(strValEncoded);
264                 if (IsFailed(r))
265                 {
266                         SysLog(NID_IO, "[%s] Propagated.", GetErrorMessage(r));
267                         return r;
268                 }
269         }
270
271         return __pRegistryImpl->AddValue(sectionName, entryName, strVal);
272 }
273
274 result
275 Registry::GetValue(const String& sectionName, const String& entryName, int& retVal) const
276 {
277         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
278         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
279         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
280
281         result r = E_SUCCESS;
282         String valStr;
283
284         r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
285         if (!IsFailed(r))
286         {
287                 r = Integer::Parse(valStr, retVal);
288                 if (IsFailed(r))
289                 {
290                         r = E_PARSING_FAILED;
291                 }
292         }
293
294         return r;
295 }
296
297 result
298 Registry::GetValue(const String& sectionName, const String& entryName, double& retVal) const
299 {
300         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
301         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
302         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
303
304         result r = E_SUCCESS;
305         String valStr;
306
307         r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
308         if (!IsFailed(r))
309         {
310                 r = Double::Parse(valStr, retVal);
311                 if (IsFailed(r))
312                 {
313                         r = E_PARSING_FAILED;
314                 }
315         }
316
317         return r;
318 }
319
320 result
321 Registry::GetValue(const String& sectionName, const String& entryName, float& retVal) const
322 {
323         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
324         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
325         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
326
327         result r = E_SUCCESS;
328         String valStr;
329
330         r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
331         if (!IsFailed(r))
332         {
333                 r = Float::Parse(valStr, retVal);
334                 if (IsFailed(r))
335                 {
336                         r = E_PARSING_FAILED;
337                 }
338         }
339
340         return r;
341 }
342
343 result
344 Registry::GetValue(const String& sectionName, const String& entryName, String& retVal) const
345 {
346         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
347         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
348         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
349
350         return __pRegistryImpl->GetValue(sectionName, entryName, retVal);
351 }
352
353 result
354 Registry::GetValue(const String& sectionName, const String& entryName, UuId& retVal) const
355 {
356         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
357         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
358         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
359
360         result r = E_SUCCESS;
361         String valStr;
362
363         r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
364         if (!IsFailed(r))
365         {
366                 r = UuId::Parse(valStr, retVal);
367                 if (IsFailed(r))
368                 {
369                         r = E_PARSING_FAILED;
370                 }
371         }
372
373         return r;
374 }
375
376 result
377 Registry::GetValue(const String& sectionName, const String& entryName, ByteBuffer& retVal) const
378 {
379         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
380         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
381         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
382
383         int size = retVal.GetLimit();
384         SysTryReturnResult(NID_IO, size > 0, E_INVALID_ARG, "Invalid buffer length");
385
386         result r = E_SUCCESS;
387         String valStr;
388
389         r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
390         if (!IsFailed(r))
391         {
392                 int length = valStr.GetLength();
393                 int length2 = (size * 2);
394                 int parseSize = (length2 <= length) ? length2 : length;
395                 byte* pRetVal = const_cast< byte* >(retVal.GetPointer());
396                 SysAssert(pRetVal);
397                 for (int i = 0, j = 0; i < parseSize; i++)
398                 {
399                         unsigned long ul = 0;
400                         wchar_t ch = valStr[i];
401                         wchar_t tmp[3];
402
403                         if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'f') || (ch >= L'A' && ch <= L'F'))
404                         {
405                                 tmp[i % 2] = ch;
406                                 if (i % 2)
407                                 {
408                                         tmp[2] = L'\0';
409                                         ul = wcstoul(tmp, null, 16);
410                                         (static_cast< unsigned char* >(pRetVal))[j++] = static_cast< unsigned char >(ul);
411                                 }
412                         }
413                         else
414                         {
415                                 return E_PARSING_FAILED;
416                         }
417
418                 }
419
420                 parseSize = parseSize/2;
421                 SysAssertf(parseSize <= size, "The specified ByteBuffer is not enough to get the entry value from registry file.");
422                 if (parseSize < size)
423                 {
424                         // resize buffer limit
425                         r = retVal.SetLimit(parseSize);
426                         SysTryReturn(NID_IO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
427                 }
428         }
429         return r;
430 }
431
432 result
433 Registry::SetValue(const String& sectionName, const String& entryName, int newValue)
434 {
435         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
436         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
437         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
438
439         return __pRegistryImpl->SetValue(sectionName, entryName, Integer::ToString(newValue));
440 }
441
442 result
443 Registry::SetValue(const String& sectionName, const String& entryName, double newValue)
444 {
445         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
446         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
447         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
448
449         return __pRegistryImpl->SetValue(sectionName, entryName, Double::ToString(newValue));
450 }
451
452 result
453 Registry::SetValue(const String& sectionName, const String& entryName, float newValue)
454 {
455         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
456         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
457         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
458
459         return __pRegistryImpl->SetValue(sectionName, entryName, Float::ToString(newValue));
460 }
461
462 result
463 Registry::SetValue(const String& sectionName, const String& entryName, const String& newValue)
464 {
465         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
466         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName is empty");
467         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName is empty");
468         //SysTryReturnResult(NID_IO, newValue.GetLength() > 0, E_INVALID_ARG, "newValue is empty");
469
470         return __pRegistryImpl->SetValue(sectionName, entryName, newValue);
471 }
472
473 result
474 Registry::SetValue(const String& sectionName, const String& entryName, const UuId& newValue)
475 {
476         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
477         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
478         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
479
480         return __pRegistryImpl->SetValue(sectionName, entryName, newValue.ToString());
481 }
482
483 result
484 Registry::SetValue(const String& sectionName, const String& entryName, const ByteBuffer& newValue)
485 {
486         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
487         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
488         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
489
490         int size = newValue.GetLimit();
491         SysTryReturnResult(NID_IO, size > 0, E_INVALID_ARG, "invalid buffer length");
492
493         String strValEncoded;
494         String strVal;
495         result r = E_SUCCESS;
496         byte* pNewValue = const_cast< byte* >(newValue.GetPointer());
497         SysAssert(pNewValue);
498
499         for (int i = 0; i < size; i++)
500         {
501                 r = strValEncoded.Format(3, L"%02x", (static_cast< unsigned char* >(pNewValue)[i]));
502                 if (IsFailed(r))
503                 {
504                         SysLog(NID_IO, "[%s] Propagated.", GetErrorMessage(r));
505                         return r;
506                 }
507                 r = strVal.Append(strValEncoded);
508                 if (IsFailed(r))
509                 {
510                         SysLog(NID_IO, "[%s] Propagated.", GetErrorMessage(r));
511                         return r;
512                 }
513         }
514
515         return __pRegistryImpl->SetValue(sectionName, entryName, strVal);
516 }
517
518 result
519 Registry::RemoveValue(const String& sectionName, const String& entryName)
520 {
521         SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
522         SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
523         SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
524
525         return __pRegistryImpl->RemoveValue(sectionName, entryName);
526 }
527
528 result
529 Registry::Remove(const String& regPath)
530 {
531         SysTryReturnResult(NID_IO, regPath.GetLength() > 0 && regPath.GetLength() <= PATH_MAX, E_INVALID_ARG,
532                                          "regPath.GetLength <= 0 or long name was given.");
533
534         return _RegistryImpl::Remove(regPath);
535 }
536
537 result
538 Registry::ConvertToSecureRegistry(const String& plainRegPath, const String& secureRegPath, const ByteBuffer& key)
539 {
540         SysTryReturnResult(NID_IO, plainRegPath.GetLength() > 0 && plainRegPath.GetLength() <= PATH_MAX, E_INVALID_ARG,
541                                          "plainRegPath.GetLength <= 0 or long name was given.");
542         SysTryReturnResult(NID_IO, secureRegPath.GetLength() > 0 && secureRegPath.GetLength() <= PATH_MAX, E_INVALID_ARG,
543                                          "secureRegPath.GetLength <= 0 or long name was given.");
544         SysTryReturnResult(NID_IO, key.GetLimit() > 0, E_INVALID_ARG, "key.GetLimit <= 0.");
545
546         return _RegistryImpl::ConvertToSecureRegistry(plainRegPath, secureRegPath, &key);
547 }
548
549 }} // Tizen::Io
550