summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorshuax <[email protected]>2022-03-30 07:59:36 +0800
committershuax <[email protected]>2022-03-30 07:59:36 +0800
commit9a50e4308f3d969f6e54c74331dabc100bd8a900 (patch)
treed5c3ca1fef0c71019694c24872bbdb0364d8e344 /core/src
parent83bb549e7d7c73ce02d6b904452bbf6c8d7af377 (diff)
improve registry
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/winos/registry_query.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/xmake/winos/registry_query.c b/core/src/xmake/winos/registry_query.c
index efff036a0..7c9e87689 100644
--- a/core/src/xmake/winos/registry_query.c
+++ b/core/src/xmake/winos/registry_query.c
@@ -172,7 +172,8 @@ tb_int_t xm_winos_registry_query(lua_State* lua)
}
}
- if (tb_wtoa(valuename_w, value, valuesize + 1) == (tb_size_t)-1)
+ tb_size_t value_n = tb_wtoa(valuename_w, value, valuesize + 1);
+ if (value_n == (tb_size_t)-1)
{
lua_pushnil(lua);
lua_pushfstring(lua, "get registry value failed: %s\\%s;%s", rootkey, rootdir, valuename);
@@ -184,7 +185,7 @@ tb_int_t xm_winos_registry_query(lua_State* lua)
{
case REG_SZ:
case REG_EXPAND_SZ:
- lua_pushstring(lua, value);
+ lua_pushlstring(lua, value, value_n);
ok = tb_true;
break;
case REG_DWORD: