Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2018-04-04 22:31:11 +0300
committerOliver Schneider <oliver@assarbad.net>2018-04-04 22:31:11 +0300
commit4d85f899cc1f5a346275cd1f3cf934239c33d414 (patch)
treec00b300284a62b98443cdfa0f96e0da2e9932de9
parent9382f770f8e3448707ef2ac819070415f327b40a (diff)
Updating lua-winreg module to 104aff465b80a879a9a44415baa34ce53bfa602a
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/README.md12
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/appveyor.yml36
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/lakeconfig.lua99
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/lakefile51
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-1.0.0-1.rockspec46
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-scm-0.rockspec47
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h15
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h2
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/luareg.h10
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h4
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/winreg.c58
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua16
12 files changed, 296 insertions, 100 deletions
diff --git a/3rdparty/lua/src/modules/lua-winreg/README.md b/3rdparty/lua/src/modules/lua-winreg/README.md
index e89641a..a21798d 100644
--- a/3rdparty/lua/src/modules/lua-winreg/README.md
+++ b/3rdparty/lua/src/modules/lua-winreg/README.md
@@ -1,5 +1,9 @@
#winreg
+[![Build status](https://ci.appveyor.com/api/projects/status/8xfyu8bow3n51jv2/branch/master?svg=true)](https://ci.appveyor.com/project/moteus/lua-winreg/branch/master)
+
+--------------------------------------------------------------------------------
+
##Jas Latrix
Copyright © 2005, 2006 Jas Latrix <jastejada at yahoo dot com>
@@ -10,7 +14,9 @@ All Rights Deserved. Use at your own risk!. Shake well before using.
#Introduction
-winreg is a Lua binary module to Access Microsoft(R) Windows(R) Registry. The registry is a system-defined database that applications and Microsoft(R) Windows(R) system components use to store and retrieve configuration data.
+winreg is a Lua binary module to Access Microsoft(R) Windows(R) Registry. The registry is a
+system-defined database that applications and Microsoft(R) Windows(R) system components use to
+store and retrieve configuration data.
Load the module via the require function (make sure Lua can find the module), for example:
```lua
@@ -21,8 +27,8 @@ hkey = winreg.openkey[[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVers
skey = hkey:openkey([[Explorer\Shell Folders]])
for name in skey:enumvalue() do
- print("\nname: " .. name
- .. "\npath: " .. skey:getvalue(name))
+ print("\nname: " .. name
+ .. "\npath: " .. skey:getvalue(name))
end
```
diff --git a/3rdparty/lua/src/modules/lua-winreg/appveyor.yml b/3rdparty/lua/src/modules/lua-winreg/appveyor.yml
new file mode 100644
index 0000000..8500078
--- /dev/null
+++ b/3rdparty/lua/src/modules/lua-winreg/appveyor.yml
@@ -0,0 +1,36 @@
+version: 0.1.0.{build}
+
+environment:
+ matrix:
+ - LUA: "lua 5.1"
+ - LUA: "lua 5.2"
+ - LUA: "lua 5.3"
+
+platform:
+ - x64
+ - x86
+ - mingw
+
+before_build:
+ - set PATH=C:\Python27\Scripts;%PATH%
+ - pip install hererocks
+ - if /I "%platform%"=="x86" set HR_TARGET=vs_32
+ - if /I "%platform%"=="x64" set HR_TARGET=vs_64
+ - if /I "%platform%"=="mingw" set HR_TARGET=mingw
+ - if /I "%platform%"=="mingw" set PATH=C:\MinGW\bin;%PATH%
+ - hererocks env --%LUA% --target %HR_TARGET% -rlatest
+ - call env\bin\activate
+
+build_script:
+ - luarocks make rockspecs\winreg-scm-0.rockspec
+
+test_script:
+ - cd test
+ - lua test_1.lua
+ - lua test_5_1_5.lua
+ - lua test_5_1_6.lua
+ - lua test_5_1_8.lua
+ - lua test_5_1_9.lua
+ - lua test_5_1_10.lua
+ - lua test_5_1_13.lua
+ - lua test_5_1_14.lua
diff --git a/3rdparty/lua/src/modules/lua-winreg/lakeconfig.lua b/3rdparty/lua/src/modules/lua-winreg/lakeconfig.lua
new file mode 100644
index 0000000..b4b102b
--- /dev/null
+++ b/3rdparty/lua/src/modules/lua-winreg/lakeconfig.lua
@@ -0,0 +1,99 @@
+J = J or path.join
+J = IF or choose
+
+function vc_version()
+ local VER = lake.compiler_version()
+ MSVC_VER = ({
+ [15] = '9';
+ [16] = '10';
+ })[VER.MAJOR] or ''
+ return MSVC_VER
+end
+
+function prequire(...)
+ local ok, mod = pcall(require, ...)
+ if ok then return mod end
+end
+
+function run_lua(file, cwd)
+ print()
+ print("run " .. file)
+ if not TESTING then
+ if cwd then lake.chdir(cwd) end
+ local status, code = utils.execute( LUA_RUNNER .. ' ' .. file )
+ if cwd then lake.chdir("<") end
+ print()
+ return status, code
+ end
+ return true, 0
+end
+
+function run_test(name, params)
+ local test_dir = TEST_DIR or J(ROOT, 'test')
+ local cmd = J(test_dir, name)
+ if params then cmd = cmd .. ' ' .. params end
+ local ok = run_lua(cmd, test_dir)
+ print("TEST " .. cmd .. (ok and ' - pass!' or ' - fail!'))
+end
+
+do -- spawn
+
+local function spawn_win(file, cwd)
+ local winapi = prequire "winapi"
+ if not winapi then
+ print(file, ' error: Test needs winapi!')
+ return false
+ end
+ print("spawn " .. file)
+ if not TESTING then
+ if cwd then lake.chdir(cwd) end
+ assert(winapi.shell_exec(nil, LUA_RUNNER, file, cwd))
+ if cwd then lake.chdir("<") end
+ print()
+ end
+ return true
+end
+
+local function spawn_nix(file, cwd)
+ print("spawn " .. file)
+ if not TESTING then
+ if cwd then lake.chdir(cwd) end
+ local status, code = utils.execute( LUA_RUNNER .. file .. ' &', true )
+ if cwd then lake.chdir("<") end
+ print()
+ return status, code
+ end
+ return true
+end
+
+spawn = WINDOWS and spawn_win or spawn_nix
+
+end
+
+function as_bool(v,d)
+ if v == nil then return not not d end
+ local n = tonumber(v)
+ if n == 0 then return false end
+ if n then return true end
+ return false
+end
+
+-----------------------
+-- needs --
+-----------------------
+
+lake.define_need('lua52', function()
+ return {
+ incdir = J(ENV.LUA_DIR_5_2, 'include');
+ libdir = J(ENV.LUA_DIR_5_2, 'lib');
+ libs = {'lua52'};
+ }
+end)
+
+lake.define_need('lua51', function()
+ return {
+ incdir = J(ENV.LUA_DIR, 'include');
+ libdir = J(ENV.LUA_DIR, 'lib');
+ libs = {'lua5.1'};
+ }
+end) \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/lakefile b/3rdparty/lua/src/modules/lua-winreg/lakefile
index 5a7b3cc..d3f2518 100644
--- a/3rdparty/lua/src/modules/lua-winreg/lakefile
+++ b/3rdparty/lua/src/modules/lua-winreg/lakefile
@@ -1,13 +1,23 @@
-if not WINDOWS then quit('This is only windwos module!') end
+if not WINDOWS then quit('This is only windows module!') end
+
+PROJECT = 'winreg'
if LUA_VER == '5.2' then
LUA_NEED = 'lua52'
LUA_DIR = ENV.LUA_DIR_5_2 or ENV.LUA_DIR
+ LUA_RUNNER = 'lua52'
else
- LUA_NEED = 'lua'
+ LUA_NEED = 'lua51'
LUA_DIR = ENV.LUA_DIR
+ LUA_RUNNER = 'lua'
end
+ROOT = ROOT or J(LUA_DIR, 'libs', PROJECT)
+LUADIR = LUADIR or J(ROOT, 'share')
+LIBDIR = LIBDIR or J(ROOT, 'share')
+DYNAMIC = as_bool(DYNAMIC, false)
+WINVER = IF(WINDOWS, WINVER or '501', '')
+
lake.define_need('unicode',function()return{
defines = {"UNICODE"; "_UNICODE"};
flags = "/UMBS /U_MBS";
@@ -33,45 +43,28 @@ winreg = c.shared{'winreg',
IF(DEBUG, {'-Z7' , '-Od', --[['-MLd']]}, {'-O2', --[['-ML']]}),
'-Os -DNDEBUG -s'
);
- libflags = IF(MSVC,IF(DEBUG, '-debug:full -debugtype:cv', '-DEBUG -OPT:REF -OPT:ICF'));
+ libflags = IF(MSVC and DEBUG, '-debug:full -debugtype:cv', '-DEBUG -OPT:REF -OPT:ICF');
needs = {LUA_NEED,IF(UNICODE, 'unicode')};
libs = {"advapi32", "kernel32", "user32"};
optimize = false;
+ dynamic = DYNAMIC;
}
target('build',{winreg})
install = target('install', {
- file.group{odir=J(INSTALL_DIR, 'test');
- src = J('test','*.*');recurse=true;
- };
- file.group{odir=J(INSTALL_DIR, 'doc');
- src = J('doc','*.*');recurse=true;
- };
- file.group{odir=J(INSTALL_DIR, 'examples');
- src = J('examples','*.*');recurse=true;
- };
- target(J(INSTALL_DIR, 'bin', winreg.name .. DLL_EXT), winreg, CP );
+ file.group{odir=J(ROOT, 'test'); src = J('test','*.*'); recurse=true };
+ file.group{odir=J(ROOT, 'doc'); src = J('doc','*.*'); recurse=true };
+ file.group{odir=J(ROOT, 'examples'); src = J('examples','*.*');recurse=true };
+ file.group{odir = LIBDIR; src = winreg};
})
target('test', install, function()
- if TESTING then
- lake.chdir('test')
- for file in path.mask('*.lua') do
- print("run " .. file)
- end
- lake.chdir('<')
- end
- if not TESTING then
- lake.chdir(J(INSTALL_DIR,'test'))
- for file in path.mask('*.lua') do
- print("run " .. file)
- if not utils.execute( LUA_EXE .. ' ' .. file ) then
- quit("FAIL!")
- end
- end
- lake.chdir('<')
+ lake.chdir('test')
+ for file in path.mask('*.lua') do
+ run_test(file)
end
+ lake.chdir('<')
end)
default('build')
diff --git a/3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-1.0.0-1.rockspec b/3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-1.0.0-1.rockspec
new file mode 100644
index 0000000..dd49ffc
--- /dev/null
+++ b/3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-1.0.0-1.rockspec
@@ -0,0 +1,46 @@
+package = "winreg"
+version = "1.0.0-1"
+source = {
+ url = "https://github.com/moteus/lua-winreg/archive/v1.0.0.zip",
+ dir = "lua-winreg-1.0.0",
+}
+
+description = {
+ summary = "Lua module to Access Microsoft(R) Windows(R) Registry",
+ homepage = "http://github.com/moteus/lua-winreg",
+ license = "MIT/X11",
+ detailed = [[
+ ]],
+}
+
+supported_platforms = {
+ "windows"
+}
+
+dependencies = {
+ "lua >= 5.1, < 5.4",
+}
+
+build = {
+ type = "builtin",
+
+ copy_directories = {'doc', 'examples', 'test'},
+
+ modules = {
+ winreg = {
+ sources = {
+ "src/l52util.c", "src/lua_int64.c", "src/lua_mtutil.c", "src/lua_tstring.c",
+ "src/luawin_dllerror.c", "src/win_privileges.c", "src/win_registry.c",
+ "src/win_trace.c", "src/winreg.c",
+ },
+ defines = {
+ "WIN32"; "_WIN32"; "_WINDOWS",
+ "WIN32_LEAN_AND_MEAN"; "WINDLL"; "USRDLL",
+ "NDEBUG", "_CRT_SECURE_NO_WARNINGS",
+ "CRTAPI1=_cdecl", "CRTAPI2=_cdecl",
+ "WINREG_EXPORTS", "WINREG_API=__declspec(dllexport)"
+ },
+ libraries = {"advapi32", "kernel32", "user32"},
+ }
+ }
+}
diff --git a/3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-scm-0.rockspec b/3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-scm-0.rockspec
new file mode 100644
index 0000000..42c56cf
--- /dev/null
+++ b/3rdparty/lua/src/modules/lua-winreg/rockspecs/winreg-scm-0.rockspec
@@ -0,0 +1,47 @@
+package = "winreg"
+version = "scm-0"
+source = {
+ url = "https://github.com/moteus/lua-winreg/archive/master.zip",
+ dir = "lua-winreg-master",
+}
+
+description = {
+ summary = "Lua module to Access Microsoft(R) Windows(R) Registry",
+ homepage = "http://github.com/moteus/lua-winreg",
+ license = "MIT/X11",
+ detailed = [[
+ ]],
+}
+
+supported_platforms = {
+ "windows"
+}
+
+dependencies = {
+ "lua >= 5.1, < 5.4",
+}
+
+build = {
+ type = "builtin",
+
+ copy_directories = {'doc', 'examples', 'test'},
+
+ modules = {
+ winreg = {
+ sources = {
+ "src/l52util.c", "src/lua_int64.c", "src/lua_mtutil.c", "src/lua_tstring.c",
+ "src/luawin_dllerror.c", "src/win_privileges.c", "src/win_registry.c",
+ "src/win_trace.c", "src/winreg.c",
+ },
+ defines = {
+ "WIN32"; "_WIN32"; "_WINDOWS",
+ "WIN32_LEAN_AND_MEAN"; "WINDLL"; "USRDLL",
+ "NDEBUG", "_CRT_SECURE_NO_WARNINGS",
+ "CRTAPI1=_cdecl", "CRTAPI2=_cdecl",
+ "WINREG_EXPORTS", "WINREG_API=__declspec(dllexport)"
+ },
+ libraries = {"advapi32", "kernel32", "user32"},
+ }
+ }
+}
+
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h b/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h
index 56a3396..0bf2ecb 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h
@@ -21,19 +21,10 @@ int atoINT64(const char* s, INT64 *pv);
#define CONST_9007199254740992 9007199254740992
#endif
-#ifdef _DEBUG
-#define lua_dllerrorX(L,code,expr,fname,lineno) lua_dllerror(L,code,expr,fname,lineno)
-#else
-#define lua_dllerrorX(L,code,expr,fname,lineno) lua_dllerror(L,code)
-#endif // _DEBUG
-
-#define lua_pushUINT64(L,n,expr,fname,lineno) \
+#define lua_pushUINT64(L,n) \
if( n > CONST_9007199254740992 ){ \
char buf[24]; \
- if(0 == _ui64toa_s(n, buf, _countof(buf) - 1, 10)) \
- lua_pushstring(L, buf); \
- else \
- lua_dllerrorX(L, ERROR_INVALID_DATA, expr, fname, lineno); \
+ lua_pushstring(L, _ui64toa(n, buf, 10)); \
}else{ \
lua_pushnumber(L, (lua_Number)(__int64)n); \
}
@@ -41,7 +32,7 @@ int atoINT64(const char* s, INT64 *pv);
#define lua_pushINT64(L,n) \
if(n > 9007199254740992 || n < -9007199254740992){ \
char buf[24]; \
- lua_pushstring(L, _i64toa_s(n, buf, 10)); \
+ lua_pushstring(L, _i64toa(n, buf, 10)); \
}else{ \
lua_pushnumber(L, (lua_Number)n); \
}
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h b/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h
index 97fae38..34e9717 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h
@@ -7,7 +7,7 @@ extern "C" {
#include <lualib.h>
#include <lauxlib.h>
-int lua_opentablemt(lua_State *L, const char * libname, const luaL_Reg * reg, int upval);
+int lua_opentablemt(lua_State *L, const char * libname, const luaL_Reg * reg);
void * lua_newuserdatamt(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg);
void * lua_newuserdatamtuv(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg, int upval);
#ifdef __cplusplus
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luareg.h b/3rdparty/lua/src/modules/lua-winreg/src/luareg.h
index d653f00..b1d49ab 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/luareg.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/luareg.h
@@ -15,15 +15,11 @@ int reg_enumvalue(lua_State *L);
int reg_flushkey(lua_State *L);
int reg_getinfo(lua_State *L);
int reg_getvalue(lua_State *L);
-#ifndef LUA_REG_NO_HIVEOPS
int reg_loadkey(lua_State *L);
-#endif // LUA_REG_NO_HIVEOPS
int reg_openkey(lua_State *L);
-#ifndef LUA_REG_NO_HIVEOPS
int reg_replacekey(lua_State *L);
int reg_restorekey(lua_State *L);
int reg_savekey(lua_State *L);
-#endif // LUA_REG_NO_HIVEOPS
int reg_setvalue(lua_State *L);
int reg_unloadkey(lua_State *L);
int reg_handle(lua_State *L);
@@ -45,19 +41,13 @@ luaL_Reg lreg_regobj[] = {
{"flushkey",reg_flushkey},
{"getinfo",reg_getinfo},
{"getvalue",reg_getvalue},
-#ifndef LUA_REG_NO_HIVEOPS
{"load",reg_loadkey},
-#endif // LUA_REG_NO_HIVEOPS
{"openkey",reg_openkey},
-#ifndef LUA_REG_NO_HIVEOPS
{"replace",reg_replacekey},
{"restore",reg_restorekey},
{"save",reg_savekey},
-#endif // LUA_REG_NO_HIVEOPS
{"setvalue",reg_setvalue},
-#ifndef LUA_REG_NO_HIVEOPS
{"unload",reg_unloadkey},
-#endif // LUA_REG_NO_HIVEOPS
{"handle",reg_handle},
{"detach",reg_detach},
{"getstrval",reg_getstrval},
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h b/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h
index c90972d..1d4757e 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h
@@ -51,9 +51,7 @@
// is between
#define AMID(c,x,y) (((x)<=(c))&&((c)<=(y)))
// avoid comp err
-#ifndef UNUSED
-# define UNUSED(x) (void)(x)
-#endif // UNUSED
+#define UNUSED(x) (void)(x)
// Ternary ops
#define IIF(b,t,f) ((b)?(t):(f))
// swap 2 numbers
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/winreg.c b/3rdparty/lua/src/modules/lua-winreg/src/winreg.c
index 4ea9795..a787b87 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/winreg.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/winreg.c
@@ -3,9 +3,7 @@
#endif
#include <assert.h>
-#ifndef lua_assert
-# define lua_assert assert
-#endif // lua_assert
+#define lua_assert assert
#include <lua.h>
#include <lualib.h>
@@ -40,19 +38,14 @@
#endif
-#ifdef LUA_REG_AS_DLL
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
UNUSED(hModule);
UNUSED(lpReserved);
UNUSED(ul_reason_for_call);
- return TRUE;
+ return TRUE;
}
-__declspec(dllexport)
-#else
-LUA_API
-#endif // LUA_REG_AS_DLL
-int luaopen_winreg(lua_State *L){
+__declspec(dllexport) int luaopen_winreg(lua_State *L){
luaL_register(L, "winreg", lreg_reglib);
return 1;
}
@@ -104,8 +97,20 @@ REGSAM reg_aux_getaccess(lua_State *L, int i){
case 'w': acc |= KEY_WRITE; break;
case 'r': acc |= KEY_READ ; break;
case 'a': acc |= KEY_ALL_ACCESS ; break;
- case 'X': acc |= KEY_WOW64_64KEY ; break;
- case 'x': acc |= KEY_WOW64_32KEY ; break;
+#ifdef KEY_WOW64_64KEY
+ case '6': if(*++psz == '4') {
+ // Access a 64-bit key from either a 32-bit or 64-bit application
+ acc |= KEY_WOW64_64KEY;
+ break;
+ }
+#endif
+#ifdef KEY_WOW64_32KEY
+ case '3': if(*++psz == '2') {
+ // Access a 64-bit key from either a 32-bit or 64-bit application
+ acc |= KEY_WOW64_32KEY;
+ break;
+ }
+#endif
default : lua_error_invalid_option(L, i);
}
}
@@ -146,7 +151,7 @@ HKEY reg_aux_strtohkey(lua_State *L, const char * psz){
WIN_TRACEA("DIGIT ROOTKEY %s", psz);
return (HKEY)(size_t)x;
}else{
- for(pph = ph; pph->name && _stricmp(psz, pph->name); pph++);
+ for(pph = ph; pph->name && stricmp(psz, pph->name); pph++);
if(!pph->data)luaL_error(L, "invalid prefix key '%s'", psz);
return (HKEY)pph->data;
}
@@ -194,7 +199,7 @@ int reglib_openkey(lua_State *L){//reglib.openkey
const TCHAR * pszMachine;
const char * pszRootKey;
// \\computer_name\hkxx
- while(szPath[0] && ISSLASH(szPath[0]) )szPath++;// skip the beginning slashes
+ while(szPath[0] && ISSLASH(szPath[0]) )szPath++;// skip the begining slashes
reg_aux_splitkey(L, szPath);
pszMachine = lua_totstring(L,-1);
pszRootKey = lua_tostring(L,-2);
@@ -289,7 +294,7 @@ BOOL reg_aux_setvalue(lua_State *L, HKEY hKey, const TCHAR * pszVal, int type, i
luaL_buffinit(L, &B);
if(lua_istable(L, i)){
int n;
- int last = (int)lua_objlen(L, i);
+ int last = lua_objlen(L, i);
for (n = 1; n <= last; n++) {
lua_rawgeti(L, i, n);
luaL_addstring(&B, lua_checkstring(L, -1));
@@ -337,10 +342,7 @@ void reg_aux_pusheregstrdata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwTy
}else{
n = (DWORD64)(*((PDWORD32)pdata));
}
- if(0 == _ui64toa_s(n, buf, _countof(buf) - 1, 10))
- lua_pushstring(L, buf);
- else
- LUA_CHECK_DLL_ERROR(L, ERROR_INVALID_DATA);
+ lua_pushstring(L, _ui64toa(n, buf, 10));
}
break; case REG_MULTI_SZ:
{
@@ -370,7 +372,7 @@ void reg_aux_pusheregluadata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwTy
case REG_DWORD: case REG_DWORD_BIG_ENDIAN:
lua_pushnumber(L, *((PDWORD32)pdata));
break; case REG_QWORD:
- lua_pushUINT64(L, *((PDWORD64)pdata), "reg_aux_pusheregluadata(REG_QWORD)", __FILE__, __LINE__);
+ lua_pushUINT64(L, *((PDWORD64)pdata));
break; case REG_MULTI_SZ:
{
int c = 1;
@@ -390,7 +392,7 @@ void reg_aux_pusheregluadata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwTy
}
typedef struct _REG_ENUM_TAG { // rc
HKEY hKey;
- DWORD dwIndex;
+ DWORD dwIndex;
PTSTR buffer;
DWORD bchlen;
} REG_ENUM_TAG;
@@ -459,13 +461,7 @@ int reg_createkey(lua_State *L){//regobj.createkey
}
//docok
int reg_deletekey(lua_State *L){//regobj.deletekey
- LONG ret;
- // the key name is optional
- if(reg_aux_gethkey(L,1) && lua_isnoneornil(L, 2))
- {
- lua_pushtstring(L, TEXT(""));
- }
- ret = win_reg_deltree(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
+ LONG ret = win_reg_deltree(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
LUA_CHECK_DLL_ERROR(L, ret);
LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
}
@@ -576,7 +572,6 @@ int reg_getvalue(lua_State *L){//regobj.getvalue
}
return 2;
}
-#ifndef LUA_REG_NO_HIVEOPS
//docok
int reg_loadkey(lua_State *L){//regobj.load
LONG ret;
@@ -585,14 +580,12 @@ int reg_loadkey(lua_State *L){//regobj.load
LUA_CHECK_DLL_ERROR(L, ret);
LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
}
-#endif // LUA_REG_NO_HIVEOPS
//docok
int reg_openkey(lua_State *L){//regobj.openkey
reg_aux_newkey(L, reg_aux_gethkey(L, 1),
lua_checktstring(L, 2), NULL, reg_aux_getaccess(L, 3), FALSE);
return 1;
}
-#ifndef LUA_REG_NO_HIVEOPS
//docok
int reg_replacekey(lua_State *L){//regobj.replace
LONG ret;
@@ -623,14 +616,12 @@ int reg_savekey(lua_State *L){//regobj.save
LUA_CHECK_DLL_ERROR(L, ret);
LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
}
-#endif // LUA_REG_NO_HIVEOPS
//docok
int reg_setvalue(lua_State *L){//regobj.setvalue
LUA_CHECK_RETURN_OBJECT(L,
reg_aux_setvalue(L, reg_aux_gethkey(L, 1), lua_opttstring(L, 2, NULL), reg_aux_getdatatype(L, 4), 3)
);
}
-#ifndef LUA_REG_NO_HIVEOPS
//docok
int reg_unloadkey(lua_State *L){//regobj.unload
LONG ret;
@@ -639,7 +630,6 @@ int reg_unloadkey(lua_State *L){//regobj.unload
LUA_CHECK_DLL_ERROR(L, ret);
LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
}
-#endif // LUA_REG_NO_HIVEOPS
int reg_handle(lua_State *L){//regobj.handle
HKEY hKey = reg_aux_gethkey(L, 1);
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua
index 74e9311..4c23888 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua
@@ -1,8 +1,8 @@
-local winreg = require"winreg"
--- Enumerate Application paths
-rkey = [[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths]]
-hkey = winreg.openkey(rkey)
-for k in hkey:enumkey() do
- print(k,(hkey:openkey(k):getvalue()))
- collectgarbage()
-end
+local winreg = require"winreg"
+-- Enumerate Application paths
+rkey = [[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths]]
+hkey = winreg.openkey(rkey, 'r')
+for k in hkey:enumkey() do
+ print(k,(hkey:openkey(k, 'r'):getvalue()))
+ collectgarbage()
+end