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-05 23:20:34 +0300
committerOliver Schneider <oliver@assarbad.net>2018-04-05 23:20:34 +0300
commitca2892052b5ad03e5745c5f62ef7eeb791ba52b8 (patch)
tree3fcb456be7cfada6ee1e9a3d00baa7dbb55d19c5
parentf57ac71db43c6218ee0e611751a3d345f02df902 (diff)
Improved logic in wow64.c
-rw-r--r--3rdparty/lua/src/modules/winreg.c4
-rw-r--r--3rdparty/lua/src/modules/wow64.c16
-rw-r--r--windirstat/WDS_Lua_C.c41
3 files changed, 32 insertions, 29 deletions
diff --git a/3rdparty/lua/src/modules/winreg.c b/3rdparty/lua/src/modules/winreg.c
index 8676ff9..13ab0eb 100644
--- a/3rdparty/lua/src/modules/winreg.c
+++ b/3rdparty/lua/src/modules/winreg.c
@@ -36,9 +36,7 @@
#include "lua-winreg/src/lua_int64.c"
#include "lua-winreg/src/lua_mtutil.c"
#include "lua-winreg/src/lua_tstring.c"
-#ifndef LUA_REG_NO_HIVEOPS
-# include "lua-winreg/src/win_privileges.c"
-#endif // LUA_REG_NO_HIVEOPS
+#include "lua-winreg/src/win_privileges.c"
#include "lua-winreg/src/win_registry.c"
#include "lua-winreg/src/win_trace.c"
#include "lua-winreg/src/winreg.c"
diff --git a/3rdparty/lua/src/modules/wow64.c b/3rdparty/lua/src/modules/wow64.c
index b490750..30c8ef5 100644
--- a/3rdparty/lua/src/modules/wow64.c
+++ b/3rdparty/lua/src/modules/wow64.c
@@ -22,13 +22,17 @@ static int luaC_iswow64_(lua_State* L)
{
typedef BOOL (WINAPI *TFNIsWow64Process) (HANDLE, PBOOL);
static int cachedResult = 0;
- TFNIsWow64Process pfnIsWow64Process = (TFNIsWow64Process)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "IsWow64Process");
- if(pfnIsWow64Process)
+ HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+ if(hKernel32)
{
- BOOL bIsWow64 = FALSE;
- // Ignore result, instead presume it's not WOW64
- (void)pfnIsWow64Process(GetCurrentProcess(), &bIsWow64);
- cachedResult = (bIsWow64) ? 1 : 0;
+ TFNIsWow64Process pfnIsWow64Process = (TFNIsWow64Process)GetProcAddress(hKernel32, "IsWow64Process");
+ if(pfnIsWow64Process)
+ {
+ BOOL bIsWow64 = FALSE;
+ // Ignore result, instead presume it's not WOW64
+ (void)pfnIsWow64Process(GetCurrentProcess(), &bIsWow64);
+ cachedResult = (bIsWow64) ? 1 : 0;
+ }
}
pcachedResult = &cachedResult;
}
diff --git a/windirstat/WDS_Lua_C.c b/windirstat/WDS_Lua_C.c
index 7d12dc7..768a12c 100644
--- a/windirstat/WDS_Lua_C.c
+++ b/windirstat/WDS_Lua_C.c
@@ -3,9 +3,9 @@
#include "WDS_Lua_C.h"
#ifdef _WIN64
-# pragma warning(push)
-# pragma warning(disable:4324)
-# pragma warning(disable:4334)
+#pragma warning(push)
+#pragma warning(disable : 4324)
+#pragma warning(disable : 4334)
#endif
// Modules/Packages, individual functions
@@ -18,22 +18,23 @@
// Cheat a bit to redefine the list of "default" libraries ...
#ifndef WDS_LUA_NO_INIT
static const luaL_Reg lualibs[] = {
- {"", luaopen_base},
- {LUA_LOADLIBNAME, luaopen_package},
- {LUA_TABLIBNAME, luaopen_table},
- {LUA_IOLIBNAME, luaopen_io},
- {LUA_OSLIBNAME, luaopen_os},
- {LUA_STRLIBNAME, luaopen_string},
- {LUA_MATHLIBNAME, luaopen_math},
- {LUA_DBLIBNAME, luaopen_debug},
- {LUA_WINREGNAME, luaopen_winreg},
- {NULL, NULL},
+ { "", luaopen_base },
+ { LUA_LOADLIBNAME, luaopen_package },
+ { LUA_TABLIBNAME, luaopen_table },
+ { LUA_IOLIBNAME, luaopen_io },
+ { LUA_OSLIBNAME, luaopen_os },
+ { LUA_STRLIBNAME, luaopen_string },
+ { LUA_MATHLIBNAME, luaopen_math },
+ { LUA_DBLIBNAME, luaopen_debug },
+ { LUA_WINREGNAME, luaopen_winreg },
+ { NULL, NULL },
};
-static void luaWDS_openlibs_(lua_State *L)
+static void luaWDS_openlibs_(lua_State* L)
{
- const luaL_Reg *lib = lualibs;
- for (; lib->func; lib++) {
+ const luaL_Reg* lib = lualibs;
+ for (; lib->func; lib++)
+ {
lua_pushcfunction(L, lib->func);
lua_pushstring(L, lib->name);
lua_call(L, 1, 0);
@@ -44,10 +45,10 @@ static void luaWDS_openlibs_(lua_State *L)
lua_State* luaWDS_open()
{
lua_State* L = lua_open();
- if(L)
+ if (L)
{
- lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
- luaWDS_openlibs_(L); /* open libraries */
+ lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
+ luaWDS_openlibs_(L); /* open libraries */
luaL_register(L, LUA_OSLIBNAME, wow64_funcs);
luaL_register(L, LUA_OSLIBNAME, isadmin_funcs);
luaL_register(L, LUA_OSLIBNAME, dbgprint_funcs);
@@ -57,5 +58,5 @@ lua_State* luaWDS_open()
}
#ifdef _WIN64
-# pragma warning(pop)
+#pragma warning(pop)
#endif