X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fsystem%2FFSys_SystemInfoImpl.cpp;h=8cc29b0b16f10454de321263aa86e67c7693b27a;hb=ceea15f5cc3b8211979e6bc18f11c2d188883d0e;hp=8b23f9d74a6c00dff2b2a3a4c8988fab873ef9ca;hpb=ce380ff0d6dfbf0b1420e0b045f6077f2e124573;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/src/system/FSys_SystemInfoImpl.cpp b/src/system/FSys_SystemInfoImpl.cpp index 8b23f9d..8cc29b0 100644 --- a/src/system/FSys_SystemInfoImpl.cpp +++ b/src/system/FSys_SystemInfoImpl.cpp @@ -1,5 +1,4 @@ // -// Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); @@ -20,26 +19,39 @@ * @brief This is the implementation file for _SystemInfoImpl class. */ #include +#include +#include +#include + +#include #include +#include +#include +#include #include +#include #include #include #include #include -#include + +#include "FSys_Types.h" +#include "FSys_SystemClient.h" +#include "FSys_CommunicationDispatcherClient.h" using namespace std; using namespace Tizen::Base; using namespace Tizen::Base::Collection; using namespace Tizen::Io; +using namespace Tizen::Base::Utility; namespace Tizen { namespace System { -static const wchar_t* _REGISTRY_PATH = L"/tmp/osp/system_info_cache.ini"; +static const wchar_t* _REGISTRY_PATH = L"/opt/usr/etc/system_info_cache.ini"; static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInformation"; //Bluetooth @@ -128,7 +140,6 @@ static const wchar_t* _NETWORK_TYPE = L"NetworkType"; static const wchar_t* _NETWORK_EMERGENCY = L"Emergency"; static const wchar_t* _NETWORK_NO_SERVICE = L"NoService"; - //WIFI static const wchar_t* _WIFI = L"http://tizen.org/feature/network.wifi"; static const wchar_t* _WIFI_SUPPORTED = L"WiFiSupported"; @@ -139,12 +150,29 @@ static const wchar_t* _WIFI_DIRECT_SUPPORTED = L"WiFiDirectSupported"; static const wchar_t* _PLATFORM_VERSION = L"http://tizen.org/feature/platform.version"; static const wchar_t* _PLATFORM_NATIVE_API_VERSION = L"http://tizen.org/feature/platform.native.api.version"; static const wchar_t* _PLATFORM_WEB_API_VERSION = L"http://tizen.org/feature/platform.web.api.version"; -static const wchar_t* _BUID_STRING = L"http://tizen.org/system/build.string"; +static const wchar_t* _BUILD_STRING = L"http://tizen.org/system/build.string"; static const wchar_t* _WAC_VERSION = L"WACVersion"; static const wchar_t* _SUPPORTED = L"Supported"; static const wchar_t* _UNSUPPORTED = L"Unsupported"; +static bool firstRequest = false; +static HashMap integerList(SingleObjectDeleter); +static HashMap boolList(SingleObjectDeleter); +static HashMap stringList(SingleObjectDeleter); + +void +PrepareCache(void) +{ + if(firstRequest == false) + { + integerList.Construct(); + boolList.Construct(); + stringList.Construct(); + firstRequest = true; + } +} + String _SystemInfoImpl::ConvertToTizen(const String& key) { @@ -160,7 +188,7 @@ _SystemInfoImpl::ConvertToTizen(const String& key) } else if(code == _KEYBOARD_TYPE) { - code == _INPUT_KEYBOARD_LAYOUT; + code = _INPUT_KEYBOARD_LAYOUT; } else if(code == _SCREEN_BITS_PER_PIXEL) { @@ -239,6 +267,21 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value) result r = E_OBJ_NOT_FOUND; String tizenKey = ConvertToTizen(key); + SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer()); + + if (firstRequest == false) + { + PrepareCache(); + } + + String* pValue = (String*)stringList.GetValue(tizenKey); + + if(pValue != null) + { + value = *pValue; + return E_SUCCESS; + } + if (key == _NETWORK_TYPE) //Compatibility { bool supported = false; @@ -337,7 +380,7 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value) value.Append(L"CDMA"); } - + r = E_SUCCESS; } else if (key == _OPENGL_ES_VERSION) { @@ -358,6 +401,7 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value) value.Append(L"2.0"); } + r = E_SUCCESS; } else if(key == _BLUETOOTH_SUPPORTED) { @@ -367,6 +411,7 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value) value = _SUPPORTED; else value = _UNSUPPORTED; + r = E_SUCCESS; } else if (key == _GPS_SUPPORTED) { @@ -376,6 +421,7 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value) value = _SUPPORTED; else value = _UNSUPPORTED; + r = E_SUCCESS; } else if (key == _WIFI_SUPPORTED) { @@ -385,32 +431,115 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value) value = _SUPPORTED; else value = _UNSUPPORTED; + r = E_SUCCESS; } else if (key == _WAC_VERSION) { value.Clear(); r = E_SUCCESS; } - else if (key == _PLATFORM_NATIVE_API_VERSION || key == _PLATFORM_WEB_API_VERSION || key == _PLATFORM_VERSION) + else if (key == _PLATFORM_NATIVE_API_VERSION || key == _PLATFORM_WEB_API_VERSION || key == _PLATFORM_VERSION || key == _BUILD_STRING) { r = E_OBJ_NOT_FOUND; } + else if (tizenKey == _DUID) + { + r = GetFromRegistry(tizenKey, value); + + if(r != E_SUCCESS || value == L"ERROR") + { + ArrayList requestMessage; + ArrayList responseMessage; + + _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance(); + + _IpcClient* pIpcClient = pCommunicationDispatcherClient->GetIpcClient(); + SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance."); + + requestMessage.Construct(); + responseMessage.Construct(); + + String serviceId(_SYSTEM_SERVICE_ID); + String commandId(L"osp.system.command.get.duid.internal"); + + requestMessage.Add(serviceId); + requestMessage.Add(commandId); + + unique_ptr pMsg(new (std::nothrow) IoService_Request(requestMessage, &responseMessage)); + SysTryReturnResult(NID_SYS, pMsg != null, E_OUT_OF_MEMORY, "It is failed to create Ipc message"); + + r = pIpcClient->SendRequest(pMsg.get()); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to send ipc message. [%s]", GetErrorMessage(r)); + + String* pResult = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA); + String* pDuid = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1); + + SysTryReturn(NID_SYS, pResult != null, r = E_SYSTEM, r, "It is failed to receive result on IPC response message."); + SysTryReturn(NID_SYS, pDuid != null, r = E_SYSTEM, r, "It is failed to receive IMEI value on IPC response message."); + + SysTryReturn(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, r = E_PRIVILEGE_DENIED, r, "It is failed to get privilege."); + SysTryReturn(NID_SYS, *pResult == _SYSTEM_RESULT_OK, r = E_SYSTEM, r, "It is failed to get DUID value."); + + value = *pDuid; + + responseMessage.RemoveAll(true); + } + } else { r = GetFromRegistry(tizenKey, value); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "It is failed to get the key[%ls]", tizenKey.GetPointer()); - r = E_SUCCESS; + + if(r != E_SUCCESS) + { + char* pStringValue = null; + String tKey; + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_OBJ_NOT_FOUND, "Required key should be longer than 0."); + + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + int ret = system_info_get_platform_string(systemKey.get(), &pStringValue); + if (ret != SYSTEM_INFO_ERROR_NONE) + { + ret = system_info_get_custom_string(systemKey.get(), &pStringValue); + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + } + r = StringUtil::Utf8ToString(pStringValue, value); + free(pStringValue); + r = E_SUCCESS; + } + } + if( r == E_SUCCESS) + { + stringList.Add(new String(tizenKey), new String(value)); } return r; } - result _SystemInfoImpl::GetSysInfo(const String& key, int& value) { result r = E_SUCCESS; String tizenKey = ConvertToTizen(key); + SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer()); + + if (firstRequest == false) + { + PrepareCache(); + } + + Integer* pValue = (Integer*)integerList.GetValue(tizenKey); + + if(pValue != null) + { + value = pValue->value; + return E_SUCCESS; + } + if (key == _CAMERA_COUNT) { bool supported = false; @@ -425,43 +554,117 @@ _SystemInfoImpl::GetSysInfo(const String& key, int& value) cameraCount++; value = cameraCount; - } + } else { r = GetFromRegistry(tizenKey, value); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "It is failed to get the key[%ls]", tizenKey.GetPointer()); + if(r != E_SUCCESS || tizenKey == _SCREEN_WIDTH || tizenKey == _SCREEN_HEIGHT || tizenKey == _SCREEN_DPI) + { + int ret = 0; + String tKey; + + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_OBJ_NOT_FOUND, "Required key should be longer than 0."); + + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + ret = system_info_get_platform_int(systemKey.get(), &value); + if (ret != SYSTEM_INFO_ERROR_NONE) + { + ret = system_info_get_custom_int(systemKey.get(), &value); + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, + "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + } + r = E_SUCCESS; + } } - + + if(r == E_SUCCESS) + { + integerList.Add(new String(tizenKey), new Integer(value)); + } + return r; } - result _SystemInfoImpl::GetSysInfo(const String& key, long long& value) { return E_OBJ_NOT_FOUND; } - result _SystemInfoImpl::GetSysInfo(const String& key, double& value) { return E_OBJ_NOT_FOUND; } - result _SystemInfoImpl::GetSysInfo(const String& key, bool& value) { result r = E_SUCCESS; String tizenKey = ConvertToTizen(key); + SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer()); + + if (firstRequest == false) + { + PrepareCache(); + } + + Boolean* pValue = (Boolean*)boolList.GetValue(tizenKey); + + if(pValue != null) + { + value = pValue->value; + return E_SUCCESS; + } + r = GetFromRegistry(tizenKey, value); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "It is failed to get the key[%ls]", tizenKey.GetPointer()); + if(r != E_SUCCESS) + { + String tKey; + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_OBJ_NOT_FOUND, "Required key should be longer than 0."); - return E_SUCCESS; -} + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + bool supported = false; + int ret = system_info_get_platform_bool(systemKey.get(), &supported); + if(ret != SYSTEM_INFO_ERROR_NONE) + { + ret = system_info_get_custom_bool(systemKey.get(), &supported); + if (ret != SYSTEM_INFO_ERROR_NONE) + { + String screenKey(L"http://tizen.org/feature/screen.size"); + String requiredKey; + tizenKey.SubString(0, screenKey.GetLength(), requiredKey); + + if(requiredKey == screenKey) + { + value = false; + } + } + } + + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + value = supported; + r = E_SUCCESS; + } + + if(r == E_SUCCESS) + { + boolList.Add(new String(tizenKey), new Boolean(value)); + } + return r; +} result _SystemInfoImpl::GetSysInfo(const String& key, UuId& value) @@ -469,10 +672,9 @@ _SystemInfoImpl::GetSysInfo(const String& key, UuId& value) return E_OBJ_NOT_FOUND; } - Collection::IList* _SystemInfoImpl::GetSysInfoValuesN(const String& key, SystemInfoValueType type) -{ +{ SetLastResult(E_OBJ_NOT_FOUND); return null; } @@ -484,7 +686,26 @@ _SystemInfoImpl::GetPlatformVersion(String& platformVersion) String tizenKey(_PLATFORM_VERSION); r = GetFromRegistry(tizenKey, platformVersion); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer()); + + if(r != E_SUCCESS) + { + char* pStringValue = null; + String tKey; + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0."); + + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + int ret = system_info_get_platform_string(systemKey.get(), &pStringValue); + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + + r = StringUtil::Utf8ToString(pStringValue, platformVersion); + free(pStringValue); + r = E_SUCCESS; + } return r; } @@ -492,10 +713,29 @@ result _SystemInfoImpl::GetBuildInfo(String& buildInfo) { result r = E_SUCCESS; - String tizenKey(_BUID_STRING); + String tizenKey(_BUILD_STRING); r = GetFromRegistry(tizenKey, buildInfo); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer()); + + if(r != E_SUCCESS) + { + char* pStringValue = null; + String tKey; + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0."); + + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + int ret = system_info_get_platform_string(systemKey.get(), &pStringValue); + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + + r = StringUtil::Utf8ToString(pStringValue, buildInfo); + free(pStringValue); + r = E_SUCCESS; + } return r; } @@ -506,7 +746,26 @@ _SystemInfoImpl::GetNativeApiVersion(String& nativeApiVersion) String tizenKey(_PLATFORM_NATIVE_API_VERSION); r = GetFromRegistry(tizenKey, nativeApiVersion); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer()); + + if(r != E_SUCCESS) + { + char* pStringValue = null; + String tKey; + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0."); + + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + int ret = system_info_get_platform_string(systemKey.get(), &pStringValue); + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + + r = StringUtil::Utf8ToString(pStringValue, nativeApiVersion); + free(pStringValue); + r = E_SUCCESS; + } return r; } @@ -517,7 +776,26 @@ _SystemInfoImpl::GetWebApiVersion(String& webApiVersion) String tizenKey(_PLATFORM_WEB_API_VERSION); r = GetFromRegistry(tizenKey, webApiVersion); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer()); + + if(r != E_SUCCESS) + { + char* pStringValue = null; + String tKey; + tizenKey.SubString(7, tKey); + SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0."); + + ClearLastResult(); + unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey)); + r = GetLastResult(); + SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r)); + + int ret = system_info_get_platform_string(systemKey.get(), &pStringValue); + SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer()); + + r = StringUtil::Utf8ToString(pStringValue, webApiVersion); + free(pStringValue); + r = E_SUCCESS; + } return r; } @@ -526,14 +804,41 @@ _SystemInfoImpl::GetImei(String& imei) { result r = E_SUCCESS; + int ret = 0; + TapiHandle* handle = null; + int time_count = 0; + int status = 0; + + handle = tel_init(null); + SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "It is failed to get handle of telephony."); + while(time_count < 30) //Wait 30 second. + { + ret = tel_check_modem_power_status(handle, &status); + SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status); + if(ret != TAPI_API_SUCCESS) + { + SysLogException(NID_SYS, E_SYSTEM, "It is failed to get Modem status."); + tel_deinit(handle); + return E_SYSTEM; + } + + if(status == 0) + { + break; + } + + usleep(1000000); + time_count++; + } + tel_deinit(handle); + ArrayList requestMessage; ArrayList responseMessage; - unique_ptr<_IpcClient> pIpcClient (new (std::nothrow) _IpcClient()); - SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance."); + _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance(); - r = pIpcClient->Construct(_COMMUNICATION_DISPATCHER_IPC_ID); - SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to create IpcClient. [%s]", GetErrorMessage(r)); + _IpcClient* pIpcClient = pCommunicationDispatcherClient->GetIpcClient(); + SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance."); requestMessage.Construct(); responseMessage.Construct(); @@ -550,16 +855,18 @@ _SystemInfoImpl::GetImei(String& imei) r = pIpcClient->SendRequest(pMsg.get()); SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to send ipc message. [%s]", GetErrorMessage(r)); - unique_ptr pResult((String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA)); - unique_ptr pImei((String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1)); + String* pResult = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA); + String* pImei = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1); - SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "It is failed to receive result on IPC response message."); - SysTryReturnResult(NID_SYS, pImei != null, E_SYSTEM, "It is failed to receive IMEI value on IPC response message."); + SysTryReturn(NID_SYS, pResult != null, r = E_SYSTEM, r, "It is failed to receive result on IPC response message."); + SysTryReturn(NID_SYS, pImei != null, r = E_SYSTEM, r, "It is failed to receive IMEI value on IPC response message."); - SysTryReturnResult(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, E_PRIVILEGE_DENIED, "It is failed to get privilege."); - SysTryReturnResult(NID_SYS, *pResult == _SYSTEM_RESULT_OK, E_SYSTEM, "It is failed to get IMEI value."); + SysTryReturn(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, r = E_PRIVILEGE_DENIED, r, "It is failed to get privilege."); + SysTryReturn(NID_SYS, *pResult == _SYSTEM_RESULT_OK, r = E_SYSTEM, r, "It is failed to get IMEI value."); imei = *pImei; + responseMessage.RemoveAll(true); + return r; } @@ -571,10 +878,10 @@ _SystemInfoImpl::GetFromRegistry(const String& key, String& value) String valStr; r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null); - SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " RegistryImpl construct It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " RegistryImpl construct is failed"); r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr); - SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue is failed, %ls", key.GetPointer()); if(valStr == L"true" || valStr == L"false") { @@ -594,14 +901,14 @@ _SystemInfoImpl::GetFromRegistry(const String& key, int& value) result r = E_SUCCESS; _RegistryImpl _reg; String valStr; + r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed"); r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue It is failed"); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed, %ls", key.GetPointer()); r = Integer::Parse(valStr, value); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, " Integer::Parse() It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, " Integer::Parse() is failed"); return E_SUCCESS; } @@ -611,12 +918,12 @@ _SystemInfoImpl::GetFromRegistry(const String& key, bool& value) result r = E_SUCCESS; _RegistryImpl _reg; String valStr; + r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed"); r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue It is failed"); - SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue It is failed"); + SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed, [%ls]", key.GetPointer()); if(valStr == L"true") { value = true; @@ -631,6 +938,7 @@ _SystemInfoImpl::GetFromRegistry(const String& key, bool& value) } return E_SUCCESS; } + _SystemInfoImpl* _SystemInfoImpl::GetInstance(SystemInfo& systeminfo) {