summaryrefslogtreecommitdiff
path: root/plugins/MirLua
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-09-05 17:09:17 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-09-05 17:09:17 +0000
commitd90a7bfca694e956879221ba24f4b54cd35379f3 (patch)
treed0e9f5adfb2761832026d9eac6dbc9ecdb96abf8 /plugins/MirLua
parentc6ee1ad4bbfceb4afc0ba1d69489a652cbce3893 (diff)
MirLua: fix registry read & write
git-svn-id: http://svn.miranda-ng.org/main/trunk@15277 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua')
-rw-r--r--plugins/MirLua/src/m_windows.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/MirLua/src/m_windows.cpp b/plugins/MirLua/src/m_windows.cpp
index 9aee495b44..c42be30335 100644
--- a/plugins/MirLua/src/m_windows.cpp
+++ b/plugins/MirLua/src/m_windows.cpp
@@ -214,7 +214,7 @@ static int lua_GetRegValue(lua_State *L)
ptrT valueName(mir_utf8decodeT(luaL_checkstring(L, 3)));
HKEY hKey = 0;
- LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey);
+ LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_READ, &hKey);
if (res != ERROR_SUCCESS)
{
lua_pushvalue(L, 4);
@@ -248,7 +248,10 @@ static int lua_GetRegValue(lua_State *L)
case REG_SZ:
case REG_LINK:
case REG_EXPAND_SZ:
- lua_pushlstring(L, ptrA(Utf8EncodeT((TCHAR*)value)), length);
+ {
+ ptrA str(Utf8EncodeT((TCHAR*)value));
+ lua_pushlstring(L, str, mir_strlen(str));
+ }
break;
default:
@@ -302,7 +305,7 @@ static int lua_SetRegValue(lua_State *L)
case LUA_TSTRING:
type = REG_SZ;
- length = mir_strlen(lua_tostring(L, 4));
+ length = mir_strlen(lua_tostring(L, 4)) * sizeof(TCHAR);
value = (BYTE*)mir_utf8decodeT(lua_tostring(L, 4));
break;