From db58ffd66b837aa184ee8d934811b78f9ff8040b Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Thu, 21 Jan 2016 13:24:38 +0000 Subject: IEView: external db_set function git-svn-id: http://svn.miranda-ng.org/main/trunk@16135 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/external_funcs.cpp | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'plugins/IEView/src/external_funcs.cpp') diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp index 445c2e5df1..3f38f4d3f1 100644 --- a/plugins/IEView/src/external_funcs.cpp +++ b/plugins/IEView/src/external_funcs.cpp @@ -42,6 +42,48 @@ namespace External return S_OK; } + HRESULT db_set(DISPPARAMS *pDispParams, VARIANT *pVarResult) + { + if (pDispParams->cArgs < 4 || pDispParams == nullptr) + return E_INVALIDARG; + + MCONTACT hContact = pDispParams->rgvarg[3].intVal; + BSTR szModule = pDispParams->rgvarg[2].bstrVal; + BSTR szSetting = pDispParams->rgvarg[1].bstrVal; + + DBVARIANT dbv = { 0 }; + + VARIANT& pVal = pDispParams->rgvarg[0]; + + switch (pVal.vt) + { + case VT_BSTR: + dbv.type = DBVT_WCHAR; + dbv.pwszVal = mir_wstrdup(pVal.bstrVal); + break; + case VT_INT: + case VT_I1: + case VT_I2: + case VT_I4: + case VT_I8: + dbv.type = DBVT_DWORD; + dbv.dVal = pVal.intVal; + break; + case VT_BOOL: + dbv.type = DBVT_BYTE; + dbv.bVal = pVal.boolVal; + } + + INT_PTR res = ::db_set(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv); + + if (pVarResult != nullptr) + { + pVarResult->vt = VT_INT_PTR; + pVarResult->ullVal = (ULONGLONG)res; + } + return S_OK; + } + HRESULT win32_ShellExecute(DISPPARAMS *pDispParams, VARIANT *pVarResult) { if (pDispParams->cArgs < 5 || pDispParams == nullptr) -- cgit v1.2.3