From 3008e91efac446fc21d607485cb787c457401a8b Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 8 Oct 2018 20:48:52 +0000 Subject: Using EOL extension now, including a .hgeol file to make certain line ending specifications explicit Added missing test case for lua-winreg A number of warnings addressed Adding some helpers to deal with user privileges Some improvements regarding the inclusion of a basic set of Lua scripts in the resource section New version of setvcvars.cmd --- .hgeol | 46 +++ 3rdparty/VersionInfo.h | 306 ++++++++-------- 3rdparty/embedded-lua/globals.lua | 30 ++ 3rdparty/lua/src/buildvm.vs15.vcxproj | 106 ++++++ 3rdparty/lua/src/buildvm.vs8.vcproj | 177 ++++++++++ 3rdparty/lua/src/luajit2.vs15.vcxproj | 104 ++++++ 3rdparty/lua/src/luajit2.vs8.vcproj | 163 +++++++++ 3rdparty/lua/src/minilua.vs15.vcxproj | 147 ++++++++ 3rdparty/lua/src/minilua.vs8.vcproj | 260 ++++++++++++++ .../lua/src/modules/lua-winreg/src/lua_tstring.h | 6 +- 3rdparty/lua/src/modules/lua-winreg/src/luamacro.h | 6 +- 3rdparty/lua/src/modules/lua-winreg/src/luareg.h | 12 + 3rdparty/lua/src/modules/lua-winreg/src/winreg.c | 6 +- .../src/modules/lua-winreg/test/test_5_1_14.lua | 21 ++ 3rdparty/lua/src/modules/w32resembed.c | 118 ++++--- 3rdparty/lua/src/modules/winreg.c | 2 + 3rdparty/lua/src/modules/winreg.h | 5 +- 3rdparty/priv.c | 319 +++++++++++++++++ 3rdparty/priv.h | 70 ++++ common/setvcvars.cmd | 65 +++- premake4.lua | 18 +- sandbox/luaconf/hello.lua | 4 +- sandbox/luaconf/lua_conf.cpp | 23 +- sandbox/luaconf/lua_conf.lua | 60 +++- sandbox/luaconf/lua_conf.rc | 4 +- sandbox/luaconf/luaconf.vs15.vcxproj | 130 ++++++- sandbox/luaconf/luaconf.vs8.vcproj | 207 ++++++++++- windirstat.vs15.sln | 83 +---- windirstat.vs8.sln | 83 +---- windirstat/Controls/myimagelist.cpp | 4 +- windirstat/PageGeneral.cpp | 386 ++++++++++----------- windirstat/WDS_Lua_C.c | 49 +++ windirstat/WDS_Lua_C.h | 4 +- windirstat/getosplatformstring.cpp | 264 +++++++------- windirstat/mountpoints.cpp | 1 + windirstat/res/windirstat.manifest | 57 +-- windirstat/stdafx.cpp | 12 - windirstat/stdafx.h | 148 ++++---- windirstat/windirstat.cpp | 22 +- windirstat/windirstat.vs15.vcxproj | 16 +- windirstat/windirstat.vs8.vcproj | 20 +- 41 files changed, 2697 insertions(+), 867 deletions(-) create mode 100644 .hgeol create mode 100644 3rdparty/embedded-lua/globals.lua create mode 100644 3rdparty/lua/src/modules/lua-winreg/test/test_5_1_14.lua create mode 100644 3rdparty/priv.c create mode 100644 3rdparty/priv.h diff --git a/.hgeol b/.hgeol new file mode 100644 index 0000000..e6cfac1 --- /dev/null +++ b/.hgeol @@ -0,0 +1,46 @@ +[repository] +native = LF + +[patterns] +**.bmp = BIN +**.png = BIN +**.ico = BIN +**.exe = BIN +**.rtf = BIN +##### Our standard is to use Unix line endings (all modern text editors support it) +**.1 = LF +**.c = LF +**.cpp = LF +**.css = LF +**.dasc = LF +**.dep = LF +**.h = LF +**.hpp = LF +**.inc = LF +**.lua = LF +**.html = LF +**.pc = LF +**.py = LF +**.svg = LF +**.html.tmpl = LF +**.tt = LF +README.* = LF +##### Individual files +COPYRIGHT = LF +Makefile = LF +README = LF +.gitignore = LF +Makefile = LF +GNUmakefile = LF +lj.supp = LF +##### The few file types which _have_ to be CRLF +**.rc = CRLF +**.rc2 = CRLF +**.cmd = CRLF +**.bat = CRLF +**.vcxproj.filters = CRLF +**.vcxproj = CRLF +**.vcproj = CRLF +##### Third-party code which we don't touch, but which came as CRLF +3rdparty/lua/src/modules/lua-winreg/**.c = CRLF +3rdparty/lua/src/modules/lua-winreg/**.h = CRLF diff --git a/3rdparty/VersionInfo.h b/3rdparty/VersionInfo.h index 05ce4b0..c69a447 100644 --- a/3rdparty/VersionInfo.h +++ b/3rdparty/VersionInfo.h @@ -1,152 +1,156 @@ -/////////////////////////////////////////////////////////////////////////////// -/// -/// Little class which reads the version info from a loaded PE file. -/// -/// Licensed under the MIT license (see below). -/// -/////////////////////////////////////////////////////////////////////////////// -/// -/// Copyright (c) 2016, 2017 Oliver Schneider (assarbad.net) -/// -/// Permission is hereby granted, free of charge, to any person obtaining a -/// copy of this software and associated documentation files (the "Software"), -/// to deal in the Software without restriction, including without limitation -/// the rights to use, copy, modify, merge, publish, distribute, sublicense, -/// and/or sell copies of the Software, and to permit persons to whom the -/// Software is furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -/// DEALINGS IN THE SOFTWARE. -/// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __VERSIONINFO_H_VER__ -#define __VERSIONINFO_H_VER__ 2017091820 -#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) -#pragma once -#endif // Check for "#pragma once" support - -#include -#include -#pragma warning(disable:4995) -#include -#pragma warning(default:4995) -#pragma comment(lib, "delayimp") - -class CVersionInfo -{ - LPVOID m_lpVerInfo; - VS_FIXEDFILEINFO* m_pFixedFileInfo; - DWORD m_useTranslation; -public: - CVersionInfo(HINSTANCE hInstance) - : m_lpVerInfo(NULL) - , m_pFixedFileInfo(NULL) - , m_useTranslation(0) - { - HRSRC hVersionResource = ::FindResource(hInstance, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); - if (NULL != hVersionResource) - { - if (DWORD dwSize = ::SizeofResource(hInstance, hVersionResource)) - { - if (HGLOBAL hVersionResourceData = ::LoadResource(hInstance, hVersionResource)) - { - if (LPVOID pVerInfoRO = ::LockResource(hVersionResourceData)) - { - if (NULL != (m_lpVerInfo = ::LocalAlloc(LPTR, dwSize))) - { - ::CopyMemory(m_lpVerInfo, pVerInfoRO, dwSize); - UINT uLen; - if (::VerQueryValue(m_lpVerInfo, _T("\\"), (LPVOID*)&m_pFixedFileInfo, &uLen)) - { -#ifdef ATLTRACE2 - ATLTRACE2(_T("%u.%u\n"), HIWORD(m_pFixedFileInfo->dwFileVersionMS), LOWORD(m_pFixedFileInfo->dwFileVersionMS)); -#endif // ATLTRACE2 - DWORD* translations; - if (::VerQueryValue(m_lpVerInfo, _T("\\VarFileInfo\\Translation"), (LPVOID*)&translations, &uLen)) - { - size_t const numTranslations = uLen / sizeof(DWORD); -#ifdef ATLTRACE2 - ATLTRACE2(_T("Number of translations: %u\n"), (UINT)numTranslations); -#endif // ATLTRACE2 - for (size_t i = 0; i < numTranslations; i++) - { -#ifdef ATLTRACE2 - ATLTRACE2(_T("Translation %u: %08X\n"), (UINT)i, translations[i]); -#endif // ATLTRACE2 - switch (LOWORD(translations[i])) - { - case MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL): // fall through - case MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US): - if (1200 == HIWORD(translations[i])) // only Unicode entries - { - m_useTranslation = translations[i]; - return; - } - break; - } - } - } - } - else - { - m_pFixedFileInfo = NULL; - } - } - } - } - } - } - } - - virtual ~CVersionInfo() - { - ::LocalFree(m_lpVerInfo); - m_lpVerInfo = NULL; - } - - LPCTSTR operator[](LPCTSTR lpszKey) const - { - if (!m_lpVerInfo || !lpszKey) - { - return NULL; - } - size_t const addend = MAX_PATH; - if(_tcslen(lpszKey) >= addend) - { - return NULL; - } - TCHAR const fmtstr[] = _T("\\StringFileInfo\\%04X%04X\\%s"); - size_t const fmtbuflen = sizeof(fmtstr)/sizeof(fmtstr[0]) + addend; - TCHAR fullName[fmtbuflen] = {0}; - _stprintf_s(fullName, fmtbuflen, fmtstr, LOWORD(m_useTranslation), HIWORD(m_useTranslation), lpszKey); - fullName[fmtbuflen-1] = 0; - -#ifdef ATLTRACE2 - ATLTRACE2(_T("Full name: %s\n"), fullName); -#endif // ATLTRACE2 - UINT uLen = 0; - LPTSTR lpszBuf = NULL; - if (::VerQueryValue(m_lpVerInfo, fullName, (LPVOID*)&lpszBuf, &uLen)) - { -#ifdef ATLTRACE2 - ATLTRACE2(_T("Value: %s\n"), lpszBuf); -#endif // ATLTRACE2 - return lpszBuf; - } -#ifdef ATLTRACE2 - ATLTRACE2(_T("Value: NULL\n")); -#endif // ATLTRACE2 - return NULL; - } -}; - +/////////////////////////////////////////////////////////////////////////////// +/// +/// Little class which reads the version info from a loaded PE file. +/// +/// Licensed under the MIT license (see below). +/// +/////////////////////////////////////////////////////////////////////////////// +/// +/// Copyright (c) 2016, 2017 Oliver Schneider (assarbad.net) +/// +/// Permission is hereby granted, free of charge, to any person obtaining a +/// copy of this software and associated documentation files (the "Software"), +/// to deal in the Software without restriction, including without limitation +/// the rights to use, copy, modify, merge, publish, distribute, sublicense, +/// and/or sell copies of the Software, and to permit persons to whom the +/// Software is furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +/// DEALINGS IN THE SOFTWARE. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __VERSIONINFO_H_VER__ +#define __VERSIONINFO_H_VER__ 2018030119 +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) +#pragma once +#endif // Check for "#pragma once" support + +#include +#include +#pragma warning(disable:4995) +#if defined(DDKBUILD) +#include +#else +#include +#endif +#pragma warning(default:4995) +#pragma comment(lib, "delayimp") + +class CVersionInfo +{ + LPVOID m_lpVerInfo; + VS_FIXEDFILEINFO* m_pFixedFileInfo; + DWORD m_useTranslation; +public: + CVersionInfo(HINSTANCE hInstance) + : m_lpVerInfo(NULL) + , m_pFixedFileInfo(NULL) + , m_useTranslation(0) + { + HRSRC hVersionResource = ::FindResource(hInstance, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); + if (NULL != hVersionResource) + { + if (DWORD dwSize = ::SizeofResource(hInstance, hVersionResource)) + { + if (HGLOBAL hVersionResourceData = ::LoadResource(hInstance, hVersionResource)) + { + if (LPVOID pVerInfoRO = ::LockResource(hVersionResourceData)) + { + if (NULL != (m_lpVerInfo = ::LocalAlloc(LPTR, dwSize))) + { + ::CopyMemory(m_lpVerInfo, pVerInfoRO, dwSize); + UINT uLen; + if (::VerQueryValue(m_lpVerInfo, _T("\\"), (LPVOID*)&m_pFixedFileInfo, &uLen)) + { +#ifdef ATLTRACE2 + ATLTRACE2(_T("%u.%u\n"), HIWORD(m_pFixedFileInfo->dwFileVersionMS), LOWORD(m_pFixedFileInfo->dwFileVersionMS)); +#endif // ATLTRACE2 + DWORD* translations; + if (::VerQueryValue(m_lpVerInfo, _T("\\VarFileInfo\\Translation"), (LPVOID*)&translations, &uLen)) + { + size_t const numTranslations = uLen / sizeof(DWORD); +#ifdef ATLTRACE2 + ATLTRACE2(_T("Number of translations: %u\n"), (UINT)numTranslations); +#endif // ATLTRACE2 + for (size_t i = 0; i < numTranslations; i++) + { +#ifdef ATLTRACE2 + ATLTRACE2(_T("Translation %u: %08X\n"), (UINT)i, translations[i]); +#endif // ATLTRACE2 + switch (LOWORD(translations[i])) + { + case MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL): // fall through + case MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US): + if (1200 == HIWORD(translations[i])) // only Unicode entries + { + m_useTranslation = translations[i]; + return; + } + break; + } + } + } + } + else + { + m_pFixedFileInfo = NULL; + } + } + } + } + } + } + } + + virtual ~CVersionInfo() + { + ::LocalFree(m_lpVerInfo); + m_lpVerInfo = NULL; + } + + LPCTSTR operator[](LPCTSTR lpszKey) const + { + if (!m_lpVerInfo || !lpszKey) + { + return NULL; + } + size_t const addend = MAX_PATH; + if(_tcslen(lpszKey) >= addend) + { + return NULL; + } + TCHAR const fmtstr[] = _T("\\StringFileInfo\\%04X%04X\\%s"); + size_t const fmtbuflen = sizeof(fmtstr)/sizeof(fmtstr[0]) + addend; + TCHAR fullName[fmtbuflen] = {0}; + _stprintf_s(fullName, fmtbuflen, fmtstr, LOWORD(m_useTranslation), HIWORD(m_useTranslation), lpszKey); + fullName[fmtbuflen-1] = 0; + +#ifdef ATLTRACE2 + ATLTRACE2(_T("Full name: %s\n"), fullName); +#endif // ATLTRACE2 + UINT uLen = 0; + LPTSTR lpszBuf = NULL; + if (::VerQueryValue(m_lpVerInfo, fullName, (LPVOID*)&lpszBuf, &uLen)) + { +#ifdef ATLTRACE2 + ATLTRACE2(_T("Value: %s\n"), lpszBuf); +#endif // ATLTRACE2 + return lpszBuf; + } +#ifdef ATLTRACE2 + ATLTRACE2(_T("Value: NULL\n")); +#endif // ATLTRACE2 + return NULL; + } +}; + #endif // __VERSIONINFO_H_VER__ \ No newline at end of file diff --git a/3rdparty/embedded-lua/globals.lua b/3rdparty/embedded-lua/globals.lua new file mode 100644 index 0000000..ec8e367 --- /dev/null +++ b/3rdparty/embedded-lua/globals.lua @@ -0,0 +1,30 @@ +-- Portions Copyright (c) 2002-2009 Jason Perkins and the Premake project + +_G.iif = function(expr, trueval, falseval) + if (expr) then + return trueval + else + return falseval + end +end + +_G.printf = function(msg, ...) + _G.print(string.format(msg, unpack(arg))) +end + +_G.dbgprintf = function(msg, ...) + os.dbgprint(string.format(msg, unpack(arg))) +end + +-- An extension to type() to identify project object types by reading the +-- "__type" field from the metatable. +local builtin_type = _G.type +_G.type = function(t) + local mt = getmetatable(t) + if (mt) then + if (mt.__type) then + return mt.__type + end + end + return builtin_type(t) +end diff --git a/3rdparty/lua/src/buildvm.vs15.vcxproj b/3rdparty/lua/src/buildvm.vs15.vcxproj index 54a0dc3..d804f65 100644 --- a/3rdparty/lua/src/buildvm.vs15.vcxproj +++ b/3rdparty/lua/src/buildvm.vs15.vcxproj @@ -1,6 +1,14 @@  + + Debug + Win32 + + + Debug + x64 + Release Win32 @@ -16,6 +24,18 @@ Win32Proj + + Application + false + MultiByte + v141 + + + Application + false + MultiByte + v141 + Application false @@ -31,6 +51,12 @@ + + + + + + @@ -38,6 +64,22 @@ + + .\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + buildvm32 + .exe + false + false + + + .\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + buildvm64 + .exe + false + false + .\ ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ @@ -54,6 +96,70 @@ false false + + + Full + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + + + Console + false + true + true + $(OutDir)buildvm32.exe + $(IntDir);%(AdditionalLibraryDirectories) + mainCRTStartup + MachineX86 + + + if not exist "..\..\..\intermediate\vs2017_$(Platform)" md "..\..\..\intermediate\vs2017_$(Platform)" minilua ..\dynasm\dynasm.lua -LN -D WIN -D JIT -D FFI -o "..\..\..\intermediate\vs2017_$(Platform)\buildvm_arch.h" vm_x86.dasc + + + + + Full + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + + + Console + false + true + true + $(OutDir)buildvm64.exe + $(IntDir);%(AdditionalLibraryDirectories) + mainCRTStartup + MachineX64 + + + if not exist "..\..\..\intermediate\vs2017_$(Platform)" md "..\..\..\intermediate\vs2017_$(Platform)" minilua ..\dynasm\dynasm.lua -LN -D WIN -D JIT -D FFI -D P64 -o "..\..\..\intermediate\vs2017_$(Platform)\buildvm_arch.h" vm_x86.dasc + + Full diff --git a/3rdparty/lua/src/buildvm.vs8.vcproj b/3rdparty/lua/src/buildvm.vs8.vcproj index e75be7c..70be612 100644 --- a/3rdparty/lua/src/buildvm.vs8.vcproj +++ b/3rdparty/lua/src/buildvm.vs8.vcproj @@ -18,6 +18,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug + Win32 + + + Debug + x64 + Release Win32 @@ -16,6 +24,18 @@ Win32Proj + + StaticLibrary + false + MultiByte + v141 + + + StaticLibrary + false + MultiByte + v141 + StaticLibrary false @@ -31,6 +51,12 @@ + + + + + + @@ -38,6 +64,18 @@ + + ..\..\..\..\..\build\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + luajit2_$(Platform) + .lib + + + ..\..\..\..\..\build\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + luajit2_$(Platform) + .lib + ..\..\..\..\..\build\ ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ @@ -50,6 +88,72 @@ luajit2_$(Platform) .lib + + + Full + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + + + $(OutDir)luajit2_$(Platform).lib + /nodefaultlib "$(IntDir)\lj_vm32.obj" %(AdditionalOptions) + MachineX86 + + + Windows + false + true + true + + + if not exist "..\..\..\intermediate\vs2017_$(Platform)" md "..\..\..\intermediate\vs2017_$(Platform)" buildvm32 -m peobj -o "$(IntDir)\lj_vm32.obj" buildvm32 -m bcdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_bcdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm32 -m ffdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_ffdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm32 -m libdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_libdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm32 -m recdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_recdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm32 -m folddef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_folddef.h" lj_opt_fold.c + + + + + Full + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + $(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories) + + + $(OutDir)luajit2_$(Platform).lib + /nodefaultlib "$(IntDir)\lj_vm64.obj" %(AdditionalOptions) + MachineX64 + + + Windows + false + true + true + + + if not exist "..\..\..\intermediate\vs2017_$(Platform)" md "..\..\..\intermediate\vs2017_$(Platform)" buildvm64 -m peobj -o "$(IntDir)\lj_vm64.obj" buildvm64 -m bcdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_bcdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm64 -m ffdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_ffdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm64 -m libdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_libdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm64 -m recdef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_recdef.h" lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c buildvm64 -m folddef -o "..\..\..\intermediate\vs2017_$(Platform)\lj_folddef.h" lj_opt_fold.c + + Full diff --git a/3rdparty/lua/src/luajit2.vs8.vcproj b/3rdparty/lua/src/luajit2.vs8.vcproj index 3282bf0..232da95 100644 --- a/3rdparty/lua/src/luajit2.vs8.vcproj +++ b/3rdparty/lua/src/luajit2.vs8.vcproj @@ -18,6 +18,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug + Win32 + + + Debug + x64 + Release Win32 + + Release + x64 + {531911BC-0023-4EC6-A2CE-6C3F5C182647} @@ -12,19 +24,62 @@ Win32Proj + + Application + false + MultiByte + v141 + + + Application + false + MultiByte + v141 + Application false MultiByte v141 + + Application + false + MultiByte + v141 + + + + + + + + + + + + .\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + minilua + .exe + false + false + + + .\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + minilua + .exe + false + false + .\ ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ @@ -33,6 +88,70 @@ false false + + .\ + ..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + minilua + .exe + false + false + + + + Full + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + + Console + false + true + true + $(OutDir)minilua.exe + $(IntDir);%(AdditionalLibraryDirectories) + mainCRTStartup + MachineX86 + /release %(AdditionalOptions) + + + + + Full + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + + Console + false + true + true + $(OutDir)minilua.exe + $(IntDir);%(AdditionalLibraryDirectories) + mainCRTStartup + MachineX64 + /release %(AdditionalOptions) + + Full @@ -61,6 +180,34 @@ /release %(AdditionalOptions) + + + Full + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + false + true + MultiThreaded + true + + Level3 + + CompileAsC + + + NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + + Console + false + true + true + $(OutDir)minilua.exe + $(IntDir);%(AdditionalLibraryDirectories) + mainCRTStartup + MachineX64 + /release %(AdditionalOptions) + + diff --git a/3rdparty/lua/src/minilua.vs8.vcproj b/3rdparty/lua/src/minilua.vs8.vcproj index 42e9a2d..6b81b9f 100644 --- a/3rdparty/lua/src/minilua.vs8.vcproj +++ b/3rdparty/lua/src/minilua.vs8.vcproj @@ -11,10 +11,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h b/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h index 0f7be45..2b398ab 100644 --- a/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h +++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h @@ -47,10 +47,10 @@ const wchar_t *lua_optlwcs_from_char(lua_State *L, int narg, const wchar_t *def, #define lua_tolwstring lua_tolwcs_from_utf8 #define lua_towstring lua_towcs_from_utf8 -#define lua_pushlwstring lua_pushlutf8_from_wcs -#define lua_pushwstring lua_pushutf8_from_wcs +#define lua_pushlwstring lua_pushlutf8_from_wcs +#define lua_pushwstring lua_pushutf8_from_wcs #define lua_pushwchar lua_pushutf8_from_wchar -#define lua_addwchar lua_addutf8_from_wchar +#define lua_addwchar lua_addutf8_from_wchar #else /* all lua*wstring function will use char <--> wide convertion */ #define lua_checkwstring lua_checkwcs_from_char diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h b/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h index 18fd7dd..0a6ac13 100644 --- a/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h +++ b/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h @@ -18,12 +18,12 @@ # define lua_recycle(L) lua_gc(L,LUA_GCCOLLECT,0) #endif #ifndef lua_boxpointer -# define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u)) -#endif +# define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u)) +#endif #ifndef lua_unboxpointer # define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i))) #endif -/* convert a stack index to positive */ +/* convert a stack index to positive */ #define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1))) diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luareg.h b/3rdparty/lua/src/modules/lua-winreg/src/luareg.h index 26c5f05..0a46aa5 100644 --- a/3rdparty/lua/src/modules/lua-winreg/src/luareg.h +++ b/3rdparty/lua/src/modules/lua-winreg/src/luareg.h @@ -15,13 +15,19 @@ 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); +#ifndef LUA_REG_NO_HIVEOPS int reg_unloadkey(lua_State *L); +#endif // LUA_REG_NO_HIVEOPS int reg_handle(lua_State *L); int reg_detach(lua_State *L); int reg_getstrval(lua_State *L); @@ -41,13 +47,19 @@ 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/winreg.c b/3rdparty/lua/src/modules/lua-winreg/src/winreg.c index 87b518a..be50635 100644 --- a/3rdparty/lua/src/modules/lua-winreg/src/winreg.c +++ b/3rdparty/lua/src/modules/lua-winreg/src/winreg.c @@ -297,10 +297,10 @@ BOOL reg_aux_setvalue(lua_State *L, HKEY hKey, const TCHAR * pszVal, int type, i luaL_Buffer B; luaL_buffinit(L, &B); if(lua_istable(L, i)){ - int n; - int last = lua_objlen(L, i); + size_t n; + size_t last = lua_objlen(L, i); for (n = 1; n <= last; n++) { - lua_rawgeti(L, i, n); + lua_rawgeti(L, i, (int)n); luaL_addstring(&B, lua_checkstring(L, -1)); luaL_addchar(&B, 0); } diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_14.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_14.lua new file mode 100644 index 0000000..a5fb409 --- /dev/null +++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_14.lua @@ -0,0 +1,21 @@ +local winreg = require "winreg" + +local p = [[HKEY_LOCAL_MACHINE\SOFTWARE]] + +local key64 = assert(winreg.openkey(p, 'r64')) +local key32 = assert(winreg.openkey(p, 'r32')) + +function DumpKeys(hkey) + for name in hkey:enumvalue() do + result, type = hkey:getvalue(name) + print(name, result, type) + end +end + +print('X64:') +DumpKeys(key64) +print("---------------------------------") +print('X32:') +DumpKeys(key32) +print("---------------------------------") + diff --git a/3rdparty/lua/src/modules/w32resembed.c b/3rdparty/lua/src/modules/w32resembed.c index 783e2c4..a854717 100644 --- a/3rdparty/lua/src/modules/w32resembed.c +++ b/3rdparty/lua/src/modules/w32resembed.c @@ -16,11 +16,14 @@ #include #include "w32resembed.h" -static int luaC_registerPreloader_(lua_State* L, const int winresidx, LPCTSTR lpszName) +/* this function expects a name at the top of the stack and the winres table next */ +static int luaC_registerPreloader_(lua_State* L) { const int oldTop = lua_gettop(L); - UNREFERENCED_PARAMETER(winresidx); - // Expects the winres table at -1 + /* + [-2] winres + [-1] name:lower() + */ lua_getfield(L, LUA_GLOBALSINDEX, "package"); if(!lua_istable(L, -1)) { @@ -28,6 +31,11 @@ static int luaC_registerPreloader_(lua_State* L, const int winresidx, LPCTSTR lp lua_pushfstring(L, "Not a table at index %i. Expected '%s' table here.", -1, "package"); return FALSE; } + /* + [-3] winres + [-2] name:lower() + [-1] package + */ lua_getfield(L, -1, "preload"); if(!lua_istable(L, -1)) { @@ -35,19 +43,29 @@ static int luaC_registerPreloader_(lua_State* L, const int winresidx, LPCTSTR lp lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", -1, "package", "preload"); return FALSE; } - lua_pushtstring(L, lpszName); - lua_getfield(L, -4, W32RES_LOADER); // get registered C function + /* + [-4] winres + [-3] name:lower() + [-2] package + [-1] package.preload + */ + lua_pushvalue(L, -3); + lua_getfield(L, -5, W32RES_LOADER); // get registered C function if(!lua_isfunction(L, -1)) { lua_settop(L, oldTop); lua_pushfstring(L, "Not a C function when fetching field '%s.%s'.", W32RES_MODNAME, W32RES_LOADER); return 1; } - lua_rawset(L, -3); // package.preload[lpszName] = winres.c_loader - // We checked the parameters already - lua_pushtstring_lowercase(L, lpszName); // lpszName = string:lower(lpszName) - lua_getfield(L, -4, W32RES_LOADER); - lua_rawset(L, -3); // package.preload[lpszName] = winres.c_loader + /* + [-6] winres + [-5] name:lower() + [-4] package + [-3] package.preload [t] + [-2] name:lower() [k] + [-1] winres.c_loader [v] + */ + lua_rawset(L, -3); /* t[k] = v */ lua_settop(L, oldTop); return 0; } @@ -58,31 +76,45 @@ static BOOL CALLBACK enumLuaScriptsLanguageCallback(HANDLE hModule, LPCTSTR lpsz UNREFERENCED_PARAMETER(lpszName); if((0 == lstrcmp(RT_LUASCRIPT,lpszType)) && (LANG_NEUTRAL == PRIMARYLANGID(wIDLanguage))) { - const int winresidx = -1; - // Expecting the winres table at the top of the stack here + const int stktop = lua_gettop(L); + const int winresidx = -2; + LPCSTR lpszNameLower = NULL; + lua_pushtstring_lowercase(L, lpszName); /* name:lower() */ + lpszNameLower = lua_tostring(L, -1); + if (!lpszNameLower) + { + lua_pushstring(L, "Could not convert lowercase name to string."); + return FALSE; + } + /* Expecting the winres table at index winresidx here */ if(!lua_istable(L, winresidx)) { lua_pushfstring(L, "Not a table at index %i. Expected '%s' table here.", winresidx, W32RES_MODNAME); return FALSE; } - // Now register the preloader - if(luaC_registerPreloader_(L, winresidx, lpszName)) + /* Now register the preloader */ + if(luaC_registerPreloader_(L)) { - // we expect a string on the stack here ... don't do anything additional + /* we expect a string on the stack here ... don't do anything additional */ return FALSE; } - lua_getfield(L, -1, W32RES_SCRIPTS); + lua_getfield(L, winresidx, W32RES_SCRIPTS); if(!lua_istable(L, -1)) { - lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", winresidx, W32RES_MODNAME, W32RES_SCRIPTS); + lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", -1, W32RES_MODNAME, W32RES_SCRIPTS); return FALSE; } - // winres.scripts at top of stack - lua_pushtstring(L, lpszName); + lua_pushvalue(L, -2); lua_pushtstring(L, lpszType); - lua_rawset(L, -3); // winres.scripts[lpszName] = lpszType - // now pop one ... (winres.scripts) - lua_pop(L, 1); + /* + [-5] winres + [-4] name:lower() + [-3] winres.scripts [t] + [-2] name:lower() [k] + [-1] type [v] + */ + lua_rawset(L, -3); /* t[k] = v */ + lua_settop(L, stktop); } return TRUE; } @@ -91,10 +123,10 @@ static BOOL CALLBACK enumLuaScriptsNameCallback(HANDLE hModule, LPCTSTR lpszType { lua_State* L = (lua_State*)lParam; UNREFERENCED_PARAMETER(hModule); - // First string table entry that we encounter will be grabbed + /* First string table entry that we encounter will be grabbed */ if(0 == lstrcmp(RT_LUASCRIPT,lpszType)) { - // Now enumerate the languages of this entry ... + /* Now enumerate the languages of this entry ... */ EnumResourceLanguages((HMODULE)hModule, lpszType, lpszName, (ENUMRESLANGPROC)enumLuaScriptsLanguageCallback, (LONG_PTR)L); } return TRUE; @@ -140,14 +172,14 @@ static int luaC_winres_loader_(lua_State* L) LPCTSTR resName; LPCSTR chunkName; - // Expecting char string here (used as chunk name) + /* Expecting char string here (used as chunk name) */ chunkName = lua_checkstring(L, 1); - // Take a copy on the stack + /* Take a copy on the stack */ lua_pushstring(L, chunkName); - // Converts the copy to a wchar_t string + /* Converts the copy to a wchar_t string */ resName = lua_checktstring(L, 2); - // Get pointer to script contents and size of script from current module + /* Get pointer to script contents and size of script from current module */ if( !getResourcePointer(getMyModuleHandle(), resName, RT_LUASCRIPT, ((LPVOID*)&scriptBuf), &dwScriptLen) || !dwScriptLen @@ -157,21 +189,21 @@ static int luaC_winres_loader_(lua_State* L) return 0; } scriptLen = (size_t)dwScriptLen; - // Skip the UTF-8 BOM, if any + /* Skip the UTF-8 BOM, if any */ if((scriptLen > sizeof(utf8bom)) && 0 == memcmp(utf8bom, scriptBuf, sizeof(utf8bom))) { scriptBuf += sizeof(utf8bom); scriptLen -= sizeof(utf8bom); dwScriptLen -= sizeof(utf8bom); } - // Load the script into the Lua state + /* Load the script into the Lua state */ if(0 != (ret = luaL_loadbuffer(L, scriptBuf, scriptLen, chunkName))) { luaL_error(L, "Could not load Lua chunk from resource (%d): %s", ret, lua_tostring(L, -1)); return 0; } - // the loaded script is at the top of the stack - lua_remove(L, 2); // remove the chunk name now + /* the loaded script is at the top of the stack */ + lua_remove(L, 2); /* remove the chunk name now */ lua_pushtstring(L, resName); if(0 != (ret = lua_pcall(L, 1, LUA_MULTRET, 0))) { @@ -180,28 +212,32 @@ static int luaC_winres_loader_(lua_State* L) return ret; } +/* + this function leaves the winres table at the top of the stack + if it fails, it returns 1 and leaves an addition string value on the stack +*/ int w32res_enumerateEmbeddedLuaScripts(lua_State* L) { const luaL_Reg winres_funcs[] = { {W32RES_LOADER, luaC_winres_loader_}, - {NULL, NULL} + {NULL, NULL}, }; luaL_register(L, W32RES_MODNAME, winres_funcs); - // winres table at top of stack - // Name for the contained table + /* winres table at top of stack */ + /* Name for the contained table */ lua_pushstring(L, W32RES_SCRIPTS); - // winres.scripts (later) + /* winres.scripts (later) */ lua_newtable(L); - // Assign the table as winres.scripts + /* Assign the table as winres.scripts */ lua_rawset(L, -3); - // Enumerate the resource names of type RT_LUASCRIPT in the current module - // The callback functions add the names of resources to the table at the top of the stack + /* Enumerate the resource names of type RT_LUASCRIPT in the current module */ + /* The callback functions add the names of resources to the table at the top of the stack */ (void)EnumResourceNames(getMyModuleHandle(), RT_LUASCRIPT, (ENUMRESNAMEPROC)enumLuaScriptsNameCallback, (LONG_PTR)L); if(lua_isstring(L, -1)) { - // Leave error message at top of stack + /* Leave error message at top of stack */ return 1; } - // leave the winres table on the stack + /* leave the winres table on the stack */ return 0; } diff --git a/3rdparty/lua/src/modules/winreg.c b/3rdparty/lua/src/modules/winreg.c index 13ab0eb..93ac545 100644 --- a/3rdparty/lua/src/modules/winreg.c +++ b/3rdparty/lua/src/modules/winreg.c @@ -1,4 +1,6 @@ #define __LUA_WINREG_C__ +#define LUA_REG_DEFINE_EXTERNS +#include "lua-winreg/src/luareg.h" #include "winreg.h" #ifdef LUA_REG_NO_WINTRACE diff --git a/3rdparty/lua/src/modules/winreg.h b/3rdparty/lua/src/modules/winreg.h index c332f07..52fbedf 100644 --- a/3rdparty/lua/src/modules/winreg.h +++ b/3rdparty/lua/src/modules/winreg.h @@ -1,5 +1,5 @@ #ifndef __WINREG_H_VER__ -#define __WINREG_H_VER__ 2018040518 +#define __WINREG_H_VER__ 2018040520 #if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) #pragma once #endif // Check for "#pragma once" support @@ -15,8 +15,5 @@ extern "C" { #endif #define LUA_WINREGNAME "winreg" -#define LUA_REG_NO_WINTRACE -#define LUA_REG_NO_HIVEOPS -#define LUA_REG_NO_DLL #endif // __LWINREG_H_VER__ diff --git a/3rdparty/priv.c b/3rdparty/priv.c new file mode 100644 index 0000000..c47b9a9 --- /dev/null +++ b/3rdparty/priv.c @@ -0,0 +1,319 @@ +/////////////////////////////////////////////////////////////////////////////// +/// +/// Written by Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0 +/// +/// Purpose : Functions to deal with NT privileges. +/// +/////////////////////////////////////////////////////////////////////////////// +#include "priv.h" + +#pragma comment(lib, "advapi32.lib") + +// A struct that should fit all possible privileges ... twice over +typedef struct _ALL_TOKEN_PRIVILEGES +{ + DWORD PrivilegeCount; + LUID_AND_ATTRIBUTES Privileges[2*MaxTokenInfoClass + 1]; +} ALL_TOKEN_PRIVILEGES; + +HANDLE PrivGetProcessToken(DWORD dwAdditionalAccess) +{ + HANDLE hToken = NULL; + + if (!OpenProcessToken(GetCurrentProcess(), dwAdditionalAccess | TOKEN_QUERY, &hToken)) + { + return NULL; + } + return hToken; +} + +HANDLE PrivGetThreadToken(DWORD dwAdditionalAccess) +{ + HANDLE hToken = NULL; + + if (!OpenThreadToken(GetCurrentThread(), dwAdditionalAccess | TOKEN_QUERY, TRUE, &hToken)) + { + return NULL; + } + return hToken; +} + +BOOL PrivSetTokenPrivilege(HANDLE hToken, LPCTSTR lpszPrivilege, BOOL bEnablePrivilege) +{ + TOKEN_PRIVILEGES tp; + LUID luid; + + if (!LookupPrivilegeValue(NULL, lpszPrivilege, &luid)) + { + return FALSE; + } + + tp.PrivilegeCount = 1; + tp.Privileges[0].Luid = luid; + if (bEnablePrivilege) + { + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + } + else + { + tp.Privileges[0].Attributes = 0; + } + + if (!AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), (PTOKEN_PRIVILEGES)NULL, (PDWORD)NULL)) + { + return FALSE; + } + return TRUE; +} + +BOOL PrivSetContextPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege) +{ + HANDLE hToken = PrivGetThreadToken(TOKEN_ADJUST_PRIVILEGES); + + if (!hToken) + { + hToken = PrivGetProcessToken(TOKEN_ADJUST_PRIVILEGES); + if (!hToken) + { + return FALSE; + } + } + + if (!PrivSetTokenPrivilege(hToken, lpszPrivilege, bEnablePrivilege)) + { + (void)CloseHandle(hToken); + return FALSE; + } + + (void)CloseHandle(hToken); + return TRUE; +} + +BOOL PrivSetProcessPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege) +{ + HANDLE hToken = PrivGetProcessToken(TOKEN_ADJUST_PRIVILEGES); + + if (!hToken) + { + return FALSE; + } + + if (!PrivSetTokenPrivilege(hToken, lpszPrivilege, bEnablePrivilege)) + { + (void)CloseHandle(hToken); + return FALSE; + } + + (void)CloseHandle(hToken); + return TRUE; +} + +BOOL PrivSetThreadPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege) +{ + HANDLE hToken = PrivGetThreadToken(TOKEN_ADJUST_PRIVILEGES); + + if (!hToken) + { + return FALSE; + } + + if (!PrivSetTokenPrivilege(hToken, lpszPrivilege, bEnablePrivilege)) + { + (void)CloseHandle(hToken); + return FALSE; + } + + (void)CloseHandle(hToken); + return TRUE; +} + +BOOL PrivHasTokenPrivilege(HANDLE hToken, LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes) +{ + struct { + union + { + TOKEN_PRIVILEGES tp; + ALL_TOKEN_PRIVILEGES atp; +#pragma warning(suppress : 4201) + }; + } tp; + DWORD dwLength = 0; + + RtlZeroMemory(&tp, sizeof(tp)); + SetLastError(ERROR_INVALID_DATA); + + if (GetTokenInformation(hToken, TokenPrivileges, (LPVOID)&tp, sizeof(tp), &dwLength)) + { + DWORD i, dwPrivNameLength = MAX_PATH; + LPTSTR lpszPrivName = calloc(dwPrivNameLength, sizeof(TCHAR)); + + if (lpszPrivName) + { + for (i = 0; i < tp.atp.PrivilegeCount; i++) + { + dwLength = dwPrivNameLength; + if (!LookupPrivilegeName(NULL, &tp.atp.Privileges[i].Luid, lpszPrivName, &dwLength)) + { + if (dwLength > dwPrivNameLength) + { + free(lpszPrivName); + dwPrivNameLength = dwLength + 1; + lpszPrivName = calloc(dwPrivNameLength, sizeof(TCHAR)); + if (!lpszPrivName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + } + else + { + free(lpszPrivName); + // Last error should be set already + return FALSE; + } + } + dwLength = dwPrivNameLength; // no error, this value will have been changed by the previous call + if (!LookupPrivilegeName(NULL, &tp.atp.Privileges[i].Luid, lpszPrivName, &dwLength)) + { + free(lpszPrivName); + // Last error should be set already + return FALSE; + } + if (0 == _tcscmp(lpszPrivilege, lpszPrivName)) + { + free(lpszPrivName); + if (lpdwAttributes) + { + *lpdwAttributes = tp.atp.Privileges[i].Attributes; + } + SetLastError(ERROR_SUCCESS); + return TRUE; + } + } + free(lpszPrivName); + lpszPrivName = NULL; + SetLastError(ERROR_NO_MATCH); + return FALSE; + } + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + } + return FALSE; +} + +BOOL PrivHasContextTokenPrivilege(LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes) +{ + HANDLE hToken = PrivGetThreadToken(0); + + if (!hToken) + { + hToken = PrivGetProcessToken(0); + if (!hToken) + { + return FALSE; + } + } + + if (!PrivHasTokenPrivilege(hToken, lpszPrivilege, lpdwAttributes)) + { + DWORD dwError = GetLastError(); // save + (void)CloseHandle(hToken); + SetLastError(dwError); // restore + return FALSE; + } + + (void)CloseHandle(hToken); + return TRUE; +} + +BOOL PrivIsContextTokenPrivilegeEnabled(LPCTSTR lpszPrivilege) +{ + DWORD dwAttributes = 0; + if (PrivHasContextTokenPrivilege(lpszPrivilege, &dwAttributes)) + { + if (SE_PRIVILEGE_REMOVED & dwAttributes) + { + return FALSE; + } + if ((SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT) & dwAttributes) + { + return TRUE; + } + } + return FALSE; +} + +BOOL PrivHasProcessTokenPrivilege(LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes) +{ + HANDLE hToken = PrivGetProcessToken(0); + + if (!hToken) + { + return FALSE; + } + + if (!PrivHasTokenPrivilege(hToken, lpszPrivilege, lpdwAttributes)) + { + DWORD dwError = GetLastError(); // save + (void)CloseHandle(hToken); + SetLastError(dwError); // restore + return FALSE; + } + + (void)CloseHandle(hToken); + return TRUE; +} + +BOOL PrivIsProcessTokenPrivilegeEnabled(LPCTSTR lpszPrivilege) +{ + DWORD dwAttributes = 0; + if (PrivHasProcessTokenPrivilege(lpszPrivilege, &dwAttributes)) + { + if (SE_PRIVILEGE_REMOVED & dwAttributes) + { + return FALSE; + } + if ((SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT) & dwAttributes) + { + return TRUE; + } + } + return FALSE; +} + +BOOL PrivHasThreadTokenPrivilege(LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes) +{ + HANDLE hToken = PrivGetThreadToken(0); + + if (!hToken) + { + return FALSE; + } + + if (!PrivHasTokenPrivilege(hToken, lpszPrivilege, lpdwAttributes)) + { + DWORD dwError = GetLastError(); // save + (void)CloseHandle(hToken); + SetLastError(dwError); // restore + return FALSE; + } + + (void)CloseHandle(hToken); + return TRUE; +} + +BOOL PrivIsThreadTokenPrivilegeEnabled(LPCTSTR lpszPrivilege) +{ + DWORD dwAttributes = 0; + if (PrivHasThreadTokenPrivilege(lpszPrivilege, &dwAttributes)) + { + if (SE_PRIVILEGE_REMOVED & dwAttributes) + { + return FALSE; + } + if ((SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT) & dwAttributes) + { + return TRUE; + } + } + return FALSE; +} diff --git a/3rdparty/priv.h b/3rdparty/priv.h new file mode 100644 index 0000000..1b25830 --- /dev/null +++ b/3rdparty/priv.h @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////// +/// +/// Written by Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0 +/// +/// Purpose : Functions to deal with NT privileges. +/// +/////////////////////////////////////////////////////////////////////////////// +#ifndef __PRIV_H_VER__ +#define __PRIV_H_VER__ 2018070910 +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) +#pragma once +#endif /* Check for "#pragma once" support */ + +#include +#include +#include + +EXTERN_C HANDLE PrivGetProcessToken(DWORD dwAdditionalAccess); +EXTERN_C HANDLE PrivGetThreadToken(DWORD dwAdditionalAccess); +EXTERN_C BOOL PrivSetTokenPrivilege(HANDLE hToken, LPCTSTR lpszPrivilege, BOOL bEnablePrivilege); +EXTERN_C BOOL PrivSetContextPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege); +EXTERN_C BOOL PrivSetProcessPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege); +EXTERN_C BOOL PrivSetThreadPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege); +EXTERN_C BOOL PrivHasTokenPrivilege(HANDLE hToken, LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes); +EXTERN_C BOOL PrivHasContextTokenPrivilege(LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes); +EXTERN_C BOOL PrivHasProcessTokenPrivilege(LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes); +EXTERN_C BOOL PrivHasThreadTokenPrivilege(LPCTSTR lpszPrivilege, LPDWORD lpdwAttributes); +EXTERN_C BOOL PrivIsContextTokenPrivilegeEnabled(LPCTSTR lpszPrivilege); +EXTERN_C BOOL PrivIsProcessTokenPrivilegeEnabled(LPCTSTR lpszPrivilege); +EXTERN_C BOOL PrivIsThreadTokenPrivilegeEnabled(LPCTSTR lpszPrivilege); + +#ifdef __cplusplus +class CSnapEnableAssignedPrivilege +{ + BOOL m_bEnabled, m_bNoErrors; + LPTSTR m_lpszPrivilege; +public: + CSnapEnableAssignedPrivilege(LPCTSTR lpszPrivilege, BOOL bNoErrors = TRUE) + : m_bEnabled(FALSE) + , m_bNoErrors(bNoErrors) + , m_lpszPrivilege((lpszPrivilege) ? _tcsdup(lpszPrivilege) : NULL) + { + if (PrivHasContextTokenPrivilege(m_lpszPrivilege, NULL)) + { + m_bEnabled = PrivSetContextPrivilege(m_lpszPrivilege, TRUE); + if (!m_bEnabled) + { + if (!m_bNoErrors) + { + _ftprintf(stderr, _T("Could not enable %s\n"), lpszPrivilege); + } + } + } + } + + virtual ~CSnapEnableAssignedPrivilege() + { + if (m_bEnabled) + { + (void)PrivSetContextPrivilege(m_lpszPrivilege, FALSE); + } + free(m_lpszPrivilege); + } +private: + CSnapEnableAssignedPrivilege(CSnapEnableAssignedPrivilege&); + CSnapEnableAssignedPrivilege& operator=(CSnapEnableAssignedPrivilege&); +}; +#endif + +#endif /* __PRIV_H_VER__ */ diff --git a/common/setvcvars.cmd b/common/setvcvars.cmd index 67062b0..d487155 100644 --- a/common/setvcvars.cmd +++ b/common/setvcvars.cmd @@ -93,16 +93,43 @@ setlocal ENABLEEXTENSIONS & set VCVER=%~1 if defined VCVARS_PATH @( endlocal & goto :EOF ) :: Now let's distinguish the "nice" version numbers (2002, ... 2017) from the internal ones set VCVER=%VCVER:vs=% -set NICEVER=%VCVER% -set NUMVER=%VCVER:.0=% -echo %NUMVER% :: Not a "real" version number, but the marketing one (2002, ... 2017)? -if "%VCVER%" geq "%MIN_NICE%" call :NICE_%VCVER% > NUL 2>&1 +if %VCVER% GEQ %MIN_NICE% call :NICE_%VCVER% > NUL 2>&1 +set NUMVER=%VCVER:.0=% :: Figure out the set of supported toolsets set VCVERLBL=%VCVER:.=_% +call :PRETTY_%VCVERLBL% > NUL 2>&1 call :TSET_%VCVERLBL% > NUL 2>&1 +if not defined NICEVER @( echo ERROR: This script does not know the given version Visual C++ version&endlocal&set SETVCV_ERROR=1&goto :EOF ) :: Jump over those "subs" goto :NICE_SET +:PRETTY_15_0 + set NICEVER=2017 + goto :EOF +:PRETTY_14_0 + set NICEVER=2015 + goto :EOF +:PRETTY_12_0 + set NICEVER=2013 + goto :EOF +:PRETTY_11_0 + set NICEVER=2012 + goto :EOF +:PRETTY_10_0 + set NICEVER=2010 + goto :EOF +:PRETTY_9_0 + set NICEVER=2008 + goto :EOF +:PRETTY_8_0 + set NICEVER=2005 + goto :EOF +:PRETTY_7_1 + set NICEVER=2003 + goto :EOF +:PRETTY_7_0 + set NICEVER=2002 + goto :EOF :NICE_2017 set VCVER=15.0 set NEWVS=1 @@ -145,10 +172,10 @@ goto :NICE_SET set SUPPORTED_TSET=x86 ia64 amd64 x86_amd64 x86_ia64 goto :EOF :NICE_SET -echo Trying to locate Visual C++ %VCVER% ^(%VCTGT_TOOLSET%^) +echo Trying to locate Visual C++ %NICEVER% ^(= %VCVER%, %VCTGT_TOOLSET%^) :: Is it a version below 15? Then we use the old registry keys -if "%NUMVER%" lss "15" goto :OLDVS -echo Modern (^>=2017) Visual Studio +if %NUMVER% LSS 15 goto :OLDVS +:: echo Modern (^>=2017) Visual Studio :: This is where we intend to find the installation path in the registry set _VSINSTALLKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 if not defined _VCINSTALLDIR @( @@ -165,7 +192,7 @@ if not defined _VCINSTALLDIR @( ) goto :DETECTION_FINISHED :OLDVS -echo Old (^<2017) Visual Studio +:: echo Old (^<2017) Visual Studio :: The versions of Visual Studio prior to 2017 were all using this key set _VSINSTALLKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%VCVER%\Setup\VC if not defined _VCINSTALLDIR @( @@ -200,10 +227,10 @@ if not "%VCTGT_TOOLSET%" == "" @( if "%VCTGT_TOOLSET%" == "%%i" call :SetVar TEMP_SUPPORTED yes ) ) -if not "%TEMP_SUPPORTED%" == "yes" @( echo ERROR: Invalid toolset %TEMP_TOOLSET% for version %VCVER% of Visual C++&endlocal&set SETVCV_ERROR=1&goto :EOF ) +if not "%TEMP_SUPPORTED%" == "yes" @( echo ERROR: Invalid toolset %TEMP_TOOLSET% for version %VCVER% of Visual C++&endlocal&set SETVCV_ERROR=2&goto :EOF ) set VCTGT_TOOLSET=%TEMP_TOOLSET% :: Return, in case nothing was found -if not defined VCVARS_PATH @( endlocal&set SETVCV_ERROR=1&goto :EOF ) +if not defined VCVARS_PATH @( endlocal&set SETVCV_ERROR=3&goto :EOF ) :: Replace the . in the version by an underscore set VCVERLBL=%VCVER:.=_% :: Try to set a friendlier name for the Visual Studio version @@ -211,31 +238,31 @@ call :FRIENDLY_%VCVERLBL% > NUL 2>&1 :: Jump over those "subs" goto :FRIENDLY_SET :FRIENDLY_15_0 - set _VCVER=2017 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_14_0 - set _VCVER=2015 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_12_0 - set _VCVER=2013 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_11_0 - set _VCVER=2012 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_10_0 - set _VCVER=2010 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_9_0 - set _VCVER=2008 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_8_0 - set _VCVER=2005 ^[%TEMP_TOOLSET%^] + set _VCVER=%NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_7_1 - set _VCVER=.NET 2003 ^[%TEMP_TOOLSET%^] + set _VCVER=.NET %NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_7_0 - set _VCVER=.NET 2002 ^[%TEMP_TOOLSET%^] + set _VCVER=.NET %NICEVER% ^[%TEMP_TOOLSET%^] goto :EOF :FRIENDLY_SET if not defined _VCVER call :SetVar _VCVER "%VCVER%" diff --git a/premake4.lua b/premake4.lua index 92900d6..7e6dd53 100644 --- a/premake4.lua +++ b/premake4.lua @@ -191,7 +191,11 @@ do -- Override the project creation to suppress unnecessary configurations -- these get invoked by sln2005.generate per project ... -- ... they depend on the values in the sln.vstudio_configs table + --[[ local mprj = {[pfx.."wdsr%x*"] = {["Release|Win32"] = 0}, [pfx.."minilua"] = {["Release|Win32"] = 0}, [pfx.."buildvm"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}, [pfx.."luajit2"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}, [pfx.."lua"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}} + if _OPTIONS["dev"] then + mprj = {[pfx.."wdsr%x*"] = {["Release|Win32"] = 0},} + end local function prjgen_override_factory(orig_prjgen) return function(prj) local function prjmap() @@ -207,7 +211,7 @@ do local faked_cfgs = {} local prjmap = prjmap() for k,v in pairs(cfgs) do - if prjmap[v['name']] then + if prjmap[ v['name'] ] then faked_cfgs[#faked_cfgs+1] = v end end @@ -219,6 +223,9 @@ do return orig_prjgen(prj) end end + premake.vs2010_vcxproj = prjgen_override_factory(premake.vs2010_vcxproj) + premake.vstudio.vc200x.generate = prjgen_override_factory(premake.vstudio.vc200x.generate) + --]] -- Borrowed from setLocal() at https://stackoverflow.com/a/22752379 local function getLocal(stkidx, name) local index = 1 @@ -278,8 +285,6 @@ do orig_premake_vs2010_vcxproj(prj) _G._p = orig_p -- restore in any case end - premake.vs2010_vcxproj = prjgen_override_factory(premake.vs2010_vcxproj) - premake.vstudio.vc200x.generate = prjgen_override_factory(premake.vstudio.vc200x.generate) -- Allow us to set the project configuration to Release|Win32 for the resource DLL projects, -- no matter what the global solution project is. local orig_project_platforms_sln2prj_mapping = premake.vstudio.sln2005.project_platforms_sln2prj_mapping @@ -427,7 +432,7 @@ solution (iif(release, slnname, "windirstat")) buildoptions {"/Oi", "/Ot"} configuration {"vs*"} - defines {"WINVER=0x0501"} + defines {"WINVER=0x0501", "LUA_REG_NO_WINTRACE", "LUA_REG_NO_HIVEOPS", "LUA_REG_NO_DLL"} configuration {"vs2015 or vs2017"} defines {"_ALLOW_RTCc_IN_STL"} @@ -457,7 +462,7 @@ solution (iif(release, slnname, "windirstat")) resoptions {"/nologo", "/l409"} resincludedirs {".", "$(IntDir)"} linkoptions {"/pdbaltpath:%_PDB%"} - prebuildcommands{"copy \"$(ProjectDir)lua_conf.lua\" \"$(TargetDir)\\\""} + postbuildcommands{"xcopy /f /y \"$(ProjectDir)lua_conf.lua\" \"$(TargetDir)\""} files { @@ -491,6 +496,7 @@ solution (iif(release, slnname, "windirstat")) configuration {"Debug"} defines {"_DEBUG"} flags {"Symbols"} + linkoptions {"/nodefaultlib:libcmt",} configuration {"Release"} defines ("NDEBUG") @@ -499,7 +505,7 @@ solution (iif(release, slnname, "windirstat")) buildoptions {"/Oi", "/Ot"} configuration {"vs*"} - defines {"WINVER=0x0501"} + defines {"WINVER=0x0501", "LUA_REG_NO_WINTRACE", "LUA_REG_NO_HIVEOPS", "LUA_REG_NO_DLL"} end -- Add the resource DLL projects, if requested diff --git a/sandbox/luaconf/hello.lua b/sandbox/luaconf/hello.lua index 99bb1dc..fcf1408 100644 --- a/sandbox/luaconf/hello.lua +++ b/sandbox/luaconf/hello.lua @@ -1,6 +1,6 @@ -module(..., package.seeall) +module("hello", package.seeall) -- Declare the functions you want in your module function hello() -print "Hello world" + print "Hello world" end diff --git a/sandbox/luaconf/lua_conf.cpp b/sandbox/luaconf/lua_conf.cpp index 1a14edb..110919a 100644 --- a/sandbox/luaconf/lua_conf.cpp +++ b/sandbox/luaconf/lua_conf.cpp @@ -37,7 +37,6 @@ namespace fflush(stderr); } - static int report (lua_State *L, int status) { if (status && !lua_isnil(L, -1)) { @@ -77,16 +76,30 @@ namespace using namespace std; -int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) +int _tmain(int, TCHAR**) { lua_State* L = luaWDS_open(); if(L) { - //fprintf(stderr, "[STACK TOP] %i (line %i)\n", lua_gettop(L), __LINE__); - w32res_enumerateEmbeddedLuaScripts(L); - int ret = luaL_dofile(L, "lua_conf.lua"); + stackDump(L, "Before enumerating Lua resources"); + int ret = w32res_enumerateEmbeddedLuaScripts(L); if(ret) { + char const* lpszError = lua_tostring(L, -1); + fprintf(stderr, "Error occurred: %s\n", lpszError); + lua_pop(L, 1); /* pop error message from the stack */ + lua_close(L); + return EXIT_FAILURE; + } + lua_pop(L, 1); // pop the winres table from the stack + stackDump(L, "Before executing external Lua script (after enumerating Lua resources)"); + ret = luaL_dostring(L, "require \"globals\""); + ret = luaL_dostring(L, "require \"autoexec\""); + //lua_pop(L, 1); /* pop result from the stack */ + stackDump(L, "After executing external Lua script"); + if (ret) + { + fprintf(stderr, "Error occurred: %s\n", lua_tostring(L, -1)); lua_pop(L, 1); /* pop error message from the stack */ lua_close(L); return EXIT_FAILURE; diff --git a/sandbox/luaconf/lua_conf.lua b/sandbox/luaconf/lua_conf.lua index 648e1f4..6b26364 100644 --- a/sandbox/luaconf/lua_conf.lua +++ b/sandbox/luaconf/lua_conf.lua @@ -1,20 +1,61 @@ if os.isadmin() then - print "I'm admin" + print "I'm admin" else - print "I'm NOT admin" + print "I'm NOT admin" end if os.iswow64() then - print "I'm a WOW64 process" + print "I'm a WOW64 process" else - print "I'm NOT a WOW64 process" + print "I'm NOT a WOW64 process" end function dumptable(T,t) + local __genOrderedIndex = function( t ) + local orderedIndex = {} + for key in pairs(t) do + table.insert( orderedIndex, key ) + end + table.sort( orderedIndex ) + return orderedIndex + end + local orderedNext = function (t, state) + -- Equivalent of the next function, but returns the keys in the alphabetic + -- order. We use a temporary ordered key table that is stored in the + -- table being iterated. + local key = nil + --print("orderedNext: state = "..tostring(state) ) + if state == nil then + -- the first time, generate the index + t.__orderedIndex = __genOrderedIndex( t ) + key = t.__orderedIndex[1] + else + -- fetch the next value + for i = 1,table.getn(t.__orderedIndex) do + if t.__orderedIndex[i] == state then + key = t.__orderedIndex[i+1] + end + end + end + if key then + return key, t[key] + end + -- no more value to return, cleanup + t.__orderedIndex = nil + return + end + local orderedPairs = function(t) + -- Equivalent of the pairs() function on tables. Allows to iterate + -- in order + return orderedNext, t, nil + end print '--------------------------' print(T) print '--------------------------' - for k,v in pairs(t)do print(k,v) end + for k,v in orderedPairs(t) do + print(k,v) + end + print '==========================' end if winres then @@ -24,13 +65,18 @@ if winres then end end +--[[ for k,v in pairs(winres.scripts) do package.preload[k:lower()] = function(...) return winres.c_loader(k:upper()) end - package.preload[k:upper()] = package.preload[k:lower()] + --package.preload[k:upper()] = package.preload[k:lower()] end +--]] dumptable('package.preload', package.preload) dumptable('winreg', winreg) -require "helloworld" +hello = require "hello" dumptable('package.loaded', package.loaded) +dumptable('_G', _G) + +hello.hello() \ No newline at end of file diff --git a/sandbox/luaconf/lua_conf.rc b/sandbox/luaconf/lua_conf.rc index af9fbb1..76dd05c 100644 --- a/sandbox/luaconf/lua_conf.rc +++ b/sandbox/luaconf/lua_conf.rc @@ -57,7 +57,9 @@ END #include "modules/w32resembed.h" LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -helloworld LUA "../../sandbox/luaconf/hello.lua" +autoexec LUA "../../sandbox/luaconf/lua_conf.lua" +globals LUA "../../embedded-lua/globals.lua" +hello LUA "../../sandbox/luaconf/hello.lua" #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// diff --git a/sandbox/luaconf/luaconf.vs15.vcxproj b/sandbox/luaconf/luaconf.vs15.vcxproj index 0d7d22a..f1ec210 100644 --- a/sandbox/luaconf/luaconf.vs15.vcxproj +++ b/sandbox/luaconf/luaconf.vs15.vcxproj @@ -1,6 +1,14 @@  + + Debug + Win32 + + + Debug + x64 + Release Win32 @@ -16,6 +24,20 @@ Win32Proj + + Application + true + Unicode + v141 + Static + + + Application + true + Unicode + v141 + Static + Application false @@ -33,6 +55,12 @@ + + + + + + @@ -40,6 +68,20 @@ + + ..\..\build.vs2017\ + ..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + luaconf32D + .exe + false + + + ..\..\build.vs2017\ + ..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ + luaconf64D + .exe + false + ..\..\build.vs2017\ ..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\ @@ -54,12 +96,80 @@ .exe false + + + Disabled + ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;%(AdditionalIncludeDirectories) + _DEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) + false + EnableFastChecks + true + MultiThreadedDebug + true + + Level4 + false + true + ProgramDatabase + $(OutDir)luaconf32D.pdb + + + _DEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) + ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;..\..;$(IntDir);%(AdditionalIncludeDirectories) + + + Console + DebugFull + true + $(OutDir)luaconf32D.exe + $(IntDir);%(AdditionalLibraryDirectories) + MachineX86 + /pdbaltpath:%_PDB% /nodefaultlib:libcmt %(AdditionalOptions) + + + xcopy /f /y "$(ProjectDir)lua_conf.lua" "$(TargetDir)" + + + + + Disabled + ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;%(AdditionalIncludeDirectories) + _DEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) + false + EnableFastChecks + true + MultiThreadedDebug + true + + Level4 + false + true + ProgramDatabase + $(OutDir)luaconf64D.pdb + + + _DEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) + ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;..\..;$(IntDir);%(AdditionalIncludeDirectories) + + + Console + DebugFull + true + $(OutDir)luaconf64D.exe + $(IntDir);%(AdditionalLibraryDirectories) + MachineX64 + /pdbaltpath:%_PDB% /nodefaultlib:libcmt %(AdditionalOptions) + + + xcopy /f /y "$(ProjectDir)lua_conf.lua" "$(TargetDir)" + + /Oi /Ot %(AdditionalOptions) Full ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;%(AdditionalIncludeDirectories) - NDEBUG;WINVER=0x0501;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) false true MultiThreaded @@ -72,7 +182,7 @@ $(OutDir)luaconf32.pdb - NDEBUG;WINVER=0x0501;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;..\..;$(IntDir);%(AdditionalIncludeDirectories) @@ -86,16 +196,16 @@ MachineX86 /pdbaltpath:%_PDB% /release %(AdditionalOptions) - - copy "$(ProjectDir)lua_conf.lua" "$(TargetDir)\" - + + xcopy /f /y "$(ProjectDir)lua_conf.lua" "$(TargetDir)" + /Oi /Ot %(AdditionalOptions) Full ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;%(AdditionalIncludeDirectories) - NDEBUG;WINVER=0x0501;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) false true MultiThreaded @@ -108,7 +218,7 @@ $(OutDir)luaconf64.pdb - NDEBUG;WINVER=0x0501;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;%(PreprocessorDefinitions) ..\..\windirstat;..\..\common;..\..\3rdparty\lua\src;.;..\..;$(IntDir);%(AdditionalIncludeDirectories) @@ -122,9 +232,9 @@ MachineX64 /pdbaltpath:%_PDB% /release %(AdditionalOptions) - - copy "$(ProjectDir)lua_conf.lua" "$(TargetDir)\" - + + xcopy /f /y "$(ProjectDir)lua_conf.lua" "$(TargetDir)" + diff --git a/sandbox/luaconf/luaconf.vs8.vcproj b/sandbox/luaconf/luaconf.vs8.vcproj index 7786d7e..38cd27c 100644 --- a/sandbox/luaconf/luaconf.vs8.vcproj +++ b/sandbox/luaconf/luaconf.vs8.vcproj @@ -18,6 +18,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -240,6 +419,22 @@ + + + + + + diff --git a/windirstat.vs15.sln b/windirstat.vs15.sln index 2aa768e..ce51870 100644 --- a/windirstat.vs15.sln +++ b/windirstat.vs15.sln @@ -19,29 +19,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "windirstat", "windirstat\wi {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} = {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0407.German", "windirstat\res\0407.German\wdsr0407.German.vs15.vcxproj", "{C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0413.Dutch", "windirstat\res\0413.Dutch\wdsr0413.Dutch.vs15.vcxproj", "{70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040e.Hungarian", "windirstat\res\040e.Hungarian\wdsr040e.Hungarian.vs15.vcxproj", "{2A75AA20-BFFE-4D1C-8AEC-274823223919}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0416.Portuguese_Brazil", "windirstat\res\0416.Portuguese_Brazil\wdsr0416.Portuguese_Brazil.vs15.vcxproj", "{025A9D90-4C61-4D34-8BEC-8A1A044B80EB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0405.Czech", "windirstat\res\0405.Czech\wdsr0405.Czech.vs15.vcxproj", "{C3F39C58-7FC4-4243-82B2-A3572235AE02}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040a.Spanish", "windirstat\res\040a.Spanish\wdsr040a.Spanish.vs15.vcxproj", "{23B76347-204C-4DE6-A311-F562CEF5D89C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0419.Russian", "windirstat\res\0419.Russian\wdsr0419.Russian.vs15.vcxproj", "{7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0425.Estonian", "windirstat\res\0425.Estonian\wdsr0425.Estonian.vs15.vcxproj", "{2FADC62C-C670-4963-8B69-70ECA7987B93}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0415.Polish", "windirstat\res\0415.Polish\wdsr0415.Polish.vs15.vcxproj", "{70C09DAA-6F6D-4AAC-955F-ACD602A667CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040c.French", "windirstat\res\040c.French\wdsr040c.French.vs15.vcxproj", "{DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0410.Italian", "windirstat\res\0410.Italian\wdsr0410.Italian.vs15.vcxproj", "{FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040b.Finnish", "windirstat\res\040b.Finnish\wdsr040b.Finnish.vs15.vcxproj", "{C7A5D1EC-35D3-4754-A815-2C527CACD584}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luaconf", "sandbox\luaconf\luaconf.vs15.vcxproj", "{66A24518-ACE0-4C57-96B0-FF9F324E0985}" + ProjectSection(ProjectDependencies) = postProject + {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} = {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -83,54 +64,14 @@ Global {BD11B94C-6594-4477-9FDF-2E24447D1F14}.Release|Win32.Build.0 = Release|Win32 {BD11B94C-6594-4477-9FDF-2E24447D1F14}.Release|x64.ActiveCfg = Release|x64 {BD11B94C-6594-4477-9FDF-2E24447D1F14}.Release|x64.Build.0 = Release|x64 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Debug|Win32.ActiveCfg = Release|Win32 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Debug|x64.ActiveCfg = Release|Win32 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Release|Win32.ActiveCfg = Release|Win32 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Release|x64.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Debug|Win32.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Debug|x64.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Release|Win32.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Release|x64.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Debug|Win32.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Debug|x64.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Release|Win32.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Release|x64.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Debug|Win32.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Debug|x64.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Release|Win32.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Release|x64.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Debug|Win32.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Debug|x64.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Release|Win32.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Release|x64.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Debug|Win32.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Debug|x64.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Release|Win32.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Release|x64.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Debug|Win32.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Debug|x64.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Release|Win32.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Release|x64.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Debug|Win32.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Debug|x64.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Release|Win32.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Release|x64.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Debug|Win32.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Debug|x64.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Release|Win32.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Release|x64.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Debug|Win32.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Debug|x64.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Release|Win32.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Release|x64.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Debug|Win32.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Debug|x64.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Release|Win32.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Release|x64.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Debug|Win32.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Debug|x64.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Release|Win32.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Release|x64.ActiveCfg = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|Win32.ActiveCfg = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|Win32.Build.0 = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|x64.ActiveCfg = Release|x64 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|x64.Build.0 = Release|x64 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|Win32.ActiveCfg = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|Win32.Build.0 = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|x64.ActiveCfg = Release|x64 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/windirstat.vs8.sln b/windirstat.vs8.sln index e4c370b..779f776 100644 --- a/windirstat.vs8.sln +++ b/windirstat.vs8.sln @@ -19,29 +19,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "windirstat", "windirstat\wi {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} = {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0407.German", "windirstat\res\0407.German\wdsr0407.German.vs8.vcproj", "{C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0413.Dutch", "windirstat\res\0413.Dutch\wdsr0413.Dutch.vs8.vcproj", "{70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040e.Hungarian", "windirstat\res\040e.Hungarian\wdsr040e.Hungarian.vs8.vcproj", "{2A75AA20-BFFE-4D1C-8AEC-274823223919}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0416.Portuguese_Brazil", "windirstat\res\0416.Portuguese_Brazil\wdsr0416.Portuguese_Brazil.vs8.vcproj", "{025A9D90-4C61-4D34-8BEC-8A1A044B80EB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0405.Czech", "windirstat\res\0405.Czech\wdsr0405.Czech.vs8.vcproj", "{C3F39C58-7FC4-4243-82B2-A3572235AE02}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040a.Spanish", "windirstat\res\040a.Spanish\wdsr040a.Spanish.vs8.vcproj", "{23B76347-204C-4DE6-A311-F562CEF5D89C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0419.Russian", "windirstat\res\0419.Russian\wdsr0419.Russian.vs8.vcproj", "{7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0425.Estonian", "windirstat\res\0425.Estonian\wdsr0425.Estonian.vs8.vcproj", "{2FADC62C-C670-4963-8B69-70ECA7987B93}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0415.Polish", "windirstat\res\0415.Polish\wdsr0415.Polish.vs8.vcproj", "{70C09DAA-6F6D-4AAC-955F-ACD602A667CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040c.French", "windirstat\res\040c.French\wdsr040c.French.vs8.vcproj", "{DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr0410.Italian", "windirstat\res\0410.Italian\wdsr0410.Italian.vs8.vcproj", "{FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wdsr040b.Finnish", "windirstat\res\040b.Finnish\wdsr040b.Finnish.vs8.vcproj", "{C7A5D1EC-35D3-4754-A815-2C527CACD584}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luaconf", "sandbox\luaconf\luaconf.vs8.vcproj", "{66A24518-ACE0-4C57-96B0-FF9F324E0985}" + ProjectSection(ProjectDependencies) = postProject + {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} = {9F35C2BB-DF1E-400A-A829-AE34E1C91A70} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -83,54 +64,14 @@ Global {BD11B94C-6594-4477-9FDF-2E24447D1F14}.Release|Win32.Build.0 = Release|Win32 {BD11B94C-6594-4477-9FDF-2E24447D1F14}.Release|x64.ActiveCfg = Release|x64 {BD11B94C-6594-4477-9FDF-2E24447D1F14}.Release|x64.Build.0 = Release|x64 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Debug|Win32.ActiveCfg = Release|Win32 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Debug|x64.ActiveCfg = Release|Win32 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Release|Win32.ActiveCfg = Release|Win32 - {C8D9E4F9-7051-4B41-A5AB-F68F3FCE42E8}.Release|x64.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Debug|Win32.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Debug|x64.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Release|Win32.ActiveCfg = Release|Win32 - {70A55EB7-E109-41DE-81B4-0DF2B72DCDE9}.Release|x64.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Debug|Win32.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Debug|x64.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Release|Win32.ActiveCfg = Release|Win32 - {2A75AA20-BFFE-4D1C-8AEC-274823223919}.Release|x64.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Debug|Win32.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Debug|x64.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Release|Win32.ActiveCfg = Release|Win32 - {025A9D90-4C61-4D34-8BEC-8A1A044B80EB}.Release|x64.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Debug|Win32.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Debug|x64.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Release|Win32.ActiveCfg = Release|Win32 - {C3F39C58-7FC4-4243-82B2-A3572235AE02}.Release|x64.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Debug|Win32.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Debug|x64.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Release|Win32.ActiveCfg = Release|Win32 - {23B76347-204C-4DE6-A311-F562CEF5D89C}.Release|x64.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Debug|Win32.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Debug|x64.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Release|Win32.ActiveCfg = Release|Win32 - {7F06AAC4-9FBE-412F-B1D7-CB37AB8F311D}.Release|x64.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Debug|Win32.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Debug|x64.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Release|Win32.ActiveCfg = Release|Win32 - {2FADC62C-C670-4963-8B69-70ECA7987B93}.Release|x64.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Debug|Win32.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Debug|x64.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Release|Win32.ActiveCfg = Release|Win32 - {70C09DAA-6F6D-4AAC-955F-ACD602A667CE}.Release|x64.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Debug|Win32.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Debug|x64.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Release|Win32.ActiveCfg = Release|Win32 - {DA4DDD24-67BC-4A9D-87D3-18C73E5CAF31}.Release|x64.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Debug|Win32.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Debug|x64.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Release|Win32.ActiveCfg = Release|Win32 - {FD4194A7-EA1E-4466-A80B-AB4D8D17F33C}.Release|x64.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Debug|Win32.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Debug|x64.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Release|Win32.ActiveCfg = Release|Win32 - {C7A5D1EC-35D3-4754-A815-2C527CACD584}.Release|x64.ActiveCfg = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|Win32.ActiveCfg = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|Win32.Build.0 = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|x64.ActiveCfg = Release|x64 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Debug|x64.Build.0 = Release|x64 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|Win32.ActiveCfg = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|Win32.Build.0 = Release|Win32 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|x64.ActiveCfg = Release|x64 + {66A24518-ACE0-4C57-96B0-FF9F324E0985}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/windirstat/Controls/myimagelist.cpp b/windirstat/Controls/myimagelist.cpp index 38b2261..ffa71be 100644 --- a/windirstat/Controls/myimagelist.cpp +++ b/windirstat/Controls/myimagelist.cpp @@ -51,7 +51,7 @@ void CMyImageList::initialize() s.ReleaseBuffer(); VTRACE(_T("GetSystemDirectory() -> %s"), s.GetString()); - SHFILEINFO sfi; + SHFILEINFO sfi = {0}; HIMAGELIST hil = (HIMAGELIST)::SHGetFileInfo(s, 0, &sfi, sizeof(sfi), WDS_SHGFI_DEFAULTS); this->Attach(ImageList_Duplicate(hil)); @@ -110,7 +110,7 @@ int CMyImageList::cacheIcon(LPCTSTR path, UINT flags, CString *psTypeName) flags |= SHGFI_TYPENAME; } - SHFILEINFO sfi; + SHFILEINFO sfi = {0}; HIMAGELIST hil = (HIMAGELIST)::SHGetFileInfo(path, 0, &sfi, sizeof(sfi), flags); if(hil == NULL) { diff --git a/windirstat/PageGeneral.cpp b/windirstat/PageGeneral.cpp index 9819097..19adbd4 100644 --- a/windirstat/PageGeneral.cpp +++ b/windirstat/PageGeneral.cpp @@ -1,193 +1,193 @@ -// PageGeneral.cpp - Implementation of CPageGeneral -// -// WinDirStat - Directory Statistics -// Copyright (C) 2003-2005 Bernhard Seifert -// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "stdafx.h" -#include "windirstat.h" -#include "mainframe.h" // COptionsPropertySheet -#include "PageGeneral.h" -#include "options.h" -#include "globalhelpers.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -IMPLEMENT_DYNAMIC(CPageGeneral, CPropertyPage) - -CPageGeneral::CPageGeneral() - : CPropertyPage(CPageGeneral::IDD) -{ -} - -CPageGeneral::~CPageGeneral() -{ -} - -COptionsPropertySheet *CPageGeneral::GetSheet() -{ - COptionsPropertySheet *sheet = DYNAMIC_DOWNCAST(COptionsPropertySheet, GetParent()); - ASSERT(sheet != NULL); - return sheet; -} - -void CPageGeneral::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - DDX_Check(pDX, IDC_HUMANFORMAT, m_humanFormat); - DDX_Check(pDX, IDC_FOLLOWMOUNTPOINTS, m_followMountPoints); - DDX_Check(pDX, IDC_FOLLOWJUNCTIONS, m_followJunctionPoints); - DDX_Check(pDX, IDC_USEWDSLOCALE, m_useWdsLocale); - DDX_Control(pDX, IDC_COMBO, m_combo); - DDX_Control(pDX, IDC_FOLLOWMOUNTPOINTS, m_ctlFollowMountPoints); - DDX_Control(pDX, IDC_FOLLOWJUNCTIONS, m_ctlFollowJunctionPoints); - DDX_Check(pDX, IDC_SHOWGRID, m_listGrid); - DDX_Check(pDX, IDC_SHOWSTRIPES, m_listStripes); - DDX_Check(pDX, IDC_FULLROWSELECTION, m_listFullRowSelection); - DDX_Check(pDX, IDC_SKIPHIDDEN, m_skipHidden); -} - - -BEGIN_MESSAGE_MAP(CPageGeneral, CPropertyPage) - ON_BN_CLICKED(IDC_HUMANFORMAT, OnBnClickedHumanformat) - ON_BN_CLICKED(IDC_FOLLOWMOUNTPOINTS, OnBnClickedFollowmountpoints) - ON_BN_CLICKED(IDC_FOLLOWJUNCTIONS, OnBnClickedFollowjunctionpoints) - ON_BN_CLICKED(IDC_USEWDSLOCALE, OnBnClickedUseWdsLocale) - ON_CBN_SELENDOK(IDC_COMBO, OnCbnSelendokCombo) - ON_BN_CLICKED(IDC_SHOWGRID, OnBnClickedListGrid) - ON_BN_CLICKED(IDC_SHOWSTRIPES, OnBnClickedListStripes) - ON_BN_CLICKED(IDC_FULLROWSELECTION, OnBnClickedListFullRowSelection) - ON_BN_CLICKED(IDC_SKIPHIDDEN, OnBnClickedSkipHidden) -END_MESSAGE_MAP() - - -BOOL CPageGeneral::OnInitDialog() -{ - int i = 0; - CPropertyPage::OnInitDialog(); - - m_humanFormat = GetOptions()->IsHumanFormat(); - m_listGrid = GetOptions()->IsListGrid(); - m_listStripes = GetOptions()->IsListStripes(); - m_listFullRowSelection = GetOptions()->IsListFullRowSelection(); - - m_followMountPoints = GetOptions()->IsFollowMountPoints(); - m_followJunctionPoints = GetOptions()->IsFollowJunctionPoints(); - m_useWdsLocale = GetOptions()->IsUseWdsLocale(); - m_skipHidden = GetOptions()->IsSkipHidden(); - - m_followMountPoints = false; // Otherwise we would see pacman only. - m_ctlFollowMountPoints.ShowWindow(SW_HIDE); // Ignorance is bliss. - // The same for junction points - m_followJunctionPoints = false; // Otherwise we would see pacman only. - m_ctlFollowJunctionPoints.ShowWindow(SW_HIDE); // Ignorance is bliss. - - int k = m_combo.AddString(GetLocaleLanguage(GetWDSApp()->GetBuiltInLanguage())); - m_combo.SetItemData(k, GetWDSApp()->GetBuiltInLanguage()); - - CArray langid; - GetWDSApp()->GetAvailableResourceDllLangids(langid); - - for(i = 0; i < langid.GetSize(); i++) - { - k = m_combo.AddString(GetLocaleLanguage(langid[i])); - m_combo.SetItemData(k, langid[i]); - } - - m_originalLanguage = 0; - for(i = 0; i < m_combo.GetCount(); i++) - { - if(m_combo.GetItemData(i) == CLanguageOptions::GetLanguage()) - { - m_combo.SetCurSel(i); - m_originalLanguage = i; - break; - } - } - - UpdateData(false); - return TRUE; -} - -void CPageGeneral::OnOK() -{ - UpdateData(); - GetOptions()->SetHumanFormat(FALSE != m_humanFormat); - GetOptions()->SetFollowMountPoints(FALSE != m_followMountPoints); - GetOptions()->SetFollowJunctionPoints(FALSE != m_followJunctionPoints); - GetOptions()->SetUseWdsLocale(FALSE != m_useWdsLocale); - GetOptions()->SetListGrid(FALSE != m_listGrid); - GetOptions()->SetListStripes(FALSE != m_listStripes); - GetOptions()->SetListFullRowSelection(FALSE != m_listFullRowSelection); - GetOptions()->SetSkipHidden(FALSE != m_skipHidden); - - LANGID id = (LANGID)m_combo.GetItemData(m_combo.GetCurSel()); - CLanguageOptions::SetLanguage(id); - - CPropertyPage::OnOK(); -} - -void CPageGeneral::OnBnClickedHumanformat() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedFollowmountpoints() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedFollowjunctionpoints() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedUseWdsLocale() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedListGrid() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedListStripes() -{ - SetModified(); -} - -void CPageGeneral::OnBnClickedListFullRowSelection() -{ - SetModified(); -} - -void CPageGeneral::OnCbnSelendokCombo() -{ - int i = m_combo.GetCurSel(); - GetSheet()->SetLanguageChanged(i != m_originalLanguage); - SetModified(); -} - - -void CPageGeneral::OnBnClickedSkipHidden() -{ - SetModified(); -} +// PageGeneral.cpp - Implementation of CPageGeneral +// +// WinDirStat - Directory Statistics +// Copyright (C) 2003-2005 Bernhard Seifert +// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#include "stdafx.h" +#include "windirstat.h" +#include "mainframe.h" // COptionsPropertySheet +#include "PageGeneral.h" +#include "options.h" +#include "globalhelpers.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +IMPLEMENT_DYNAMIC(CPageGeneral, CPropertyPage) + +CPageGeneral::CPageGeneral() + : CPropertyPage(CPageGeneral::IDD) +{ +} + +CPageGeneral::~CPageGeneral() +{ +} + +COptionsPropertySheet *CPageGeneral::GetSheet() +{ + COptionsPropertySheet *sheet = DYNAMIC_DOWNCAST(COptionsPropertySheet, GetParent()); + ASSERT(sheet != NULL); + return sheet; +} + +void CPageGeneral::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + DDX_Check(pDX, IDC_HUMANFORMAT, m_humanFormat); + DDX_Check(pDX, IDC_FOLLOWMOUNTPOINTS, m_followMountPoints); + DDX_Check(pDX, IDC_FOLLOWJUNCTIONS, m_followJunctionPoints); + DDX_Check(pDX, IDC_USEWDSLOCALE, m_useWdsLocale); + DDX_Control(pDX, IDC_COMBO, m_combo); + DDX_Control(pDX, IDC_FOLLOWMOUNTPOINTS, m_ctlFollowMountPoints); + DDX_Control(pDX, IDC_FOLLOWJUNCTIONS, m_ctlFollowJunctionPoints); + DDX_Check(pDX, IDC_SHOWGRID, m_listGrid); + DDX_Check(pDX, IDC_SHOWSTRIPES, m_listStripes); + DDX_Check(pDX, IDC_FULLROWSELECTION, m_listFullRowSelection); + DDX_Check(pDX, IDC_SKIPHIDDEN, m_skipHidden); +} + + +BEGIN_MESSAGE_MAP(CPageGeneral, CPropertyPage) + ON_BN_CLICKED(IDC_HUMANFORMAT, OnBnClickedHumanformat) + ON_BN_CLICKED(IDC_FOLLOWMOUNTPOINTS, OnBnClickedFollowmountpoints) + ON_BN_CLICKED(IDC_FOLLOWJUNCTIONS, OnBnClickedFollowjunctionpoints) + ON_BN_CLICKED(IDC_USEWDSLOCALE, OnBnClickedUseWdsLocale) + ON_CBN_SELENDOK(IDC_COMBO, OnCbnSelendokCombo) + ON_BN_CLICKED(IDC_SHOWGRID, OnBnClickedListGrid) + ON_BN_CLICKED(IDC_SHOWSTRIPES, OnBnClickedListStripes) + ON_BN_CLICKED(IDC_FULLROWSELECTION, OnBnClickedListFullRowSelection) + ON_BN_CLICKED(IDC_SKIPHIDDEN, OnBnClickedSkipHidden) +END_MESSAGE_MAP() + + +BOOL CPageGeneral::OnInitDialog() +{ + int i = 0; + CPropertyPage::OnInitDialog(); + + m_humanFormat = GetOptions()->IsHumanFormat(); + m_listGrid = GetOptions()->IsListGrid(); + m_listStripes = GetOptions()->IsListStripes(); + m_listFullRowSelection = GetOptions()->IsListFullRowSelection(); + + m_followMountPoints = GetOptions()->IsFollowMountPoints(); + m_followJunctionPoints = GetOptions()->IsFollowJunctionPoints(); + m_useWdsLocale = GetOptions()->IsUseWdsLocale(); + m_skipHidden = GetOptions()->IsSkipHidden(); + + m_followMountPoints = false; // Otherwise we would see pacman only. + m_ctlFollowMountPoints.ShowWindow(SW_HIDE); // Ignorance is bliss. + // The same for junction points + m_followJunctionPoints = false; // Otherwise we would see pacman only. + m_ctlFollowJunctionPoints.ShowWindow(SW_HIDE); // Ignorance is bliss. + + int k = m_combo.AddString(GetLocaleLanguage(GetWDSApp()->GetBuiltInLanguage())); + m_combo.SetItemData(k, GetWDSApp()->GetBuiltInLanguage()); + + CArray langid; + GetWDSApp()->GetAvailableResourceDllLangids(langid); + + for(i = 0; i < langid.GetSize(); i++) + { + k = m_combo.AddString(GetLocaleLanguage(langid[i])); + m_combo.SetItemData(k, langid[i]); + } + + m_originalLanguage = 0; + for(i = 0; i < m_combo.GetCount(); i++) + { + if(m_combo.GetItemData(i) == CLanguageOptions::GetLanguage()) + { + m_combo.SetCurSel(i); + m_originalLanguage = i; + break; + } + } + + UpdateData(false); + return TRUE; +} + +void CPageGeneral::OnOK() +{ + UpdateData(); + GetOptions()->SetHumanFormat(FALSE != m_humanFormat); + GetOptions()->SetFollowMountPoints(FALSE != m_followMountPoints); + GetOptions()->SetFollowJunctionPoints(FALSE != m_followJunctionPoints); + GetOptions()->SetUseWdsLocale(FALSE != m_useWdsLocale); + GetOptions()->SetListGrid(FALSE != m_listGrid); + GetOptions()->SetListStripes(FALSE != m_listStripes); + GetOptions()->SetListFullRowSelection(FALSE != m_listFullRowSelection); + GetOptions()->SetSkipHidden(FALSE != m_skipHidden); + + LANGID id = (LANGID)m_combo.GetItemData(m_combo.GetCurSel()); + CLanguageOptions::SetLanguage(id); + + CPropertyPage::OnOK(); +} + +void CPageGeneral::OnBnClickedHumanformat() +{ + SetModified(); +} + +void CPageGeneral::OnBnClickedFollowmountpoints() +{ + SetModified(); +} + +void CPageGeneral::OnBnClickedFollowjunctionpoints() +{ + SetModified(); +} + +void CPageGeneral::OnBnClickedUseWdsLocale() +{ + SetModified(); +} + +void CPageGeneral::OnBnClickedListGrid() +{ + SetModified(); +} + +void CPageGeneral::OnBnClickedListStripes() +{ + SetModified(); +} + +void CPageGeneral::OnBnClickedListFullRowSelection() +{ + SetModified(); +} + +void CPageGeneral::OnCbnSelendokCombo() +{ + int i = m_combo.GetCurSel(); + GetSheet()->SetLanguageChanged(i != m_originalLanguage); + SetModified(); +} + + +void CPageGeneral::OnBnClickedSkipHidden() +{ + SetModified(); +} diff --git a/windirstat/WDS_Lua_C.c b/windirstat/WDS_Lua_C.c index 768a12c..4783149 100644 --- a/windirstat/WDS_Lua_C.c +++ b/windirstat/WDS_Lua_C.c @@ -14,6 +14,7 @@ #include "modules/wow64.c" #include "modules/dbgprint.c" #include "modules/w32resembed.c" +#include "../../priv.c" // Cheat a bit to redefine the list of "default" libraries ... #ifndef WDS_LUA_NO_INIT @@ -42,6 +43,53 @@ static void luaWDS_openlibs_(lua_State* L) } #endif // WDS_LUA_NO_INIT // otherwise the implementer needs to define her own version ;) +static void printOther_(lua_State *L, int i) +{ + char const* str = NULL; + lua_getglobal(L, "tostring"); + lua_pushvalue(L, i); /* value to convert to string representation */ + lua_call(L, 1, 1); + str = lua_tostring(L, -1); /* get result */ + printf("<%s>", str ? str : ""); + lua_pop(L, 1); /* pop result */ +} + +EXTERN_C void stackDump(lua_State *L, char* description) /* from the Programming Lua book */ +{ + int i; + int top = lua_gettop(L); + printf("[STACK:% 3i] ", lua_gettop(L)); + if (description) + { + printf("===== %s =====\n", description); + } + for (i = 1; i <= top; i++) + { + /* repeat for each level */ + int t = lua_type(L, i); + switch (t) { + + case LUA_TSTRING: /* strings */ + printf("\"%s\"", lua_tostring(L, i)); + break; + + case LUA_TBOOLEAN: /* booleans */ + printf(lua_toboolean(L, i) ? "true" : "false"); + break; + + case LUA_TNUMBER: /* numbers */ + printf("%g", lua_tonumber(L, i)); + break; + + default: /* other values */ + printOther_(L, i); + break; + } + printf(" "); /* put a separator */ + } + printf("\n"); /* end the listing */ +} + lua_State* luaWDS_open() { lua_State* L = lua_open(); @@ -52,6 +100,7 @@ lua_State* luaWDS_open() luaL_register(L, LUA_OSLIBNAME, wow64_funcs); luaL_register(L, LUA_OSLIBNAME, isadmin_funcs); luaL_register(L, LUA_OSLIBNAME, dbgprint_funcs); + lua_pop(L, 3); /* pop the "os" table three times, one for each luaL_register */ lua_gc(L, LUA_GCRESTART, 0); /* resume GC */ } return L; diff --git a/windirstat/WDS_Lua_C.h b/windirstat/WDS_Lua_C.h index 7908885..c5d18f1 100644 --- a/windirstat/WDS_Lua_C.h +++ b/windirstat/WDS_Lua_C.h @@ -1,5 +1,5 @@ #ifndef __WDS_LUA_C_H_VER__ -#define __WDS_LUA_C_H_VER__ 2012121805 +#define __WDS_LUA_C_H_VER__ 2018040522 #if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) #pragma once #endif // Check for "#pragma once" support @@ -37,4 +37,6 @@ extern "C" lua_call(L, 1, 1) #endif // lua_pushtstring_lowercase +EXTERN_C void stackDump(lua_State *L, char* description); + #endif // __WDS_LUA_C_H_VER__ diff --git a/windirstat/getosplatformstring.cpp b/windirstat/getosplatformstring.cpp index b77bf48..7e6f2ac 100644 --- a/windirstat/getosplatformstring.cpp +++ b/windirstat/getosplatformstring.cpp @@ -1,133 +1,133 @@ -// getosplatformstring.cpp - Implementation of GetOsPlatformString() -// -// WinDirStat - Directory Statistics -// Copyright (C) 2003-2005 Bernhard Seifert -// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "stdafx.h" -#include "windirstat.h" +// getosplatformstring.cpp - Implementation of GetOsPlatformString() +// +// WinDirStat - Directory Statistics +// Copyright (C) 2003-2005 Bernhard Seifert +// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#include "stdafx.h" +#include "windirstat.h" #include -#include "getosplatformstring.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -#ifndef _Return_type_success_ -# define _Return_type_success_(x) -#endif - -namespace { - typedef _Return_type_success_(return >= 0) LONG NTSTATUS; - /*lint -save -e624 */ // Don't complain about different typedefs. - typedef NTSTATUS *PNTSTATUS; - /*lint -restore */ // Resume checking for different typedefs. -} - -CString GetOsPlatformString() -{ - static NTSTATUS (WINAPI* RtlGetVersion)(LPOSVERSIONINFOEXW); - - if(!RtlGetVersion) - { - *(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "RtlGetVersion"); - ASSERT(RtlGetVersion != NULL); - if(!RtlGetVersion) - { - return LoadString(IDS__UNKNOWN_); - } - } - OSVERSIONINFOEXW osvi = { sizeof(OSVERSIONINFOEXW), 0, 0, 0, 0,{ 0 } }; - - CString ret; - - NTSTATUS ntStatus = RtlGetVersion(&osvi); - if(ntStatus < 0) - { - return LoadString(IDS__UNKNOWN_); // FIXME: include the status code - } - - LPCTSTR lpszMajorName = NULL; - - switch (osvi.dwPlatformId) - { - case VER_PLATFORM_WIN32_NT: - switch(osvi.dwMajorVersion) - { - case 5: - if(osvi.dwMinorVersion == 0) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("2000") : _T("2000 Server"); - else - if(osvi.dwMinorVersion == 1) - lpszMajorName = _T("XP"); - else - if(osvi.dwMinorVersion == 2) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("XP x64") : _T("Server 2003"); - break; - case 6: - if(osvi.dwMinorVersion == 0) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("Vista") : _T("Server 2008"); - else - if(osvi.dwMinorVersion == 1) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("7") : _T("Server 2008 R2"); - else - if(osvi.dwMinorVersion == 2) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("8") : _T("Server 2012"); - else - if(osvi.dwMinorVersion == 3) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("8.1") : _T("Server 2012 R2"); - break; - case 10: - if(osvi.dwMinorVersion == 0) - lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("10") : _T("Server 2016"); - break; - default: - break; - } - - if(!lpszMajorName) - { - if(osvi.wServicePackMajor) - ret.Format(_T("Windows %u.%u.%u, SP %u"), osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.wServicePackMajor); - else - ret.Format(_T("Windows %u.%u.%u"), osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber); - } - else - { - if(osvi.wServicePackMajor) - ret.Format(_T("Windows %s [%u.%u.%u], SP %u"), lpszMajorName, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.wServicePackMajor); - else - ret.Format(_T("Windows %s [%u.%u.%u]"), lpszMajorName, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber); - } - if(osvi.szCSDVersion[0]) - { - CString s; - s.Format(_T(" (%s)"), osvi.szCSDVersion); - ret += s; - } - break; - - default: - { - ret.Format(_T(""), osvi.dwPlatformId); - } - break; - } - - return ret; -} +#include "getosplatformstring.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +#ifndef _Return_type_success_ +# define _Return_type_success_(x) +#endif + +namespace { + typedef _Return_type_success_(return >= 0) LONG NTSTATUS; + /*lint -save -e624 */ // Don't complain about different typedefs. + typedef NTSTATUS *PNTSTATUS; + /*lint -restore */ // Resume checking for different typedefs. +} + +CString GetOsPlatformString() +{ + static NTSTATUS (WINAPI* RtlGetVersion)(LPOSVERSIONINFOEXW); + + if(!RtlGetVersion) + { + *(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "RtlGetVersion"); + ASSERT(RtlGetVersion != NULL); + if(!RtlGetVersion) + { + return LoadString(IDS__UNKNOWN_); + } + } + OSVERSIONINFOEXW osvi = { sizeof(OSVERSIONINFOEXW), 0, 0, 0, 0,{ 0 } }; + + CString ret; + + NTSTATUS ntStatus = RtlGetVersion(&osvi); + if(ntStatus < 0) + { + return LoadString(IDS__UNKNOWN_); // FIXME: include the status code + } + + LPCTSTR lpszMajorName = NULL; + + switch (osvi.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + switch(osvi.dwMajorVersion) + { + case 5: + if(osvi.dwMinorVersion == 0) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("2000") : _T("2000 Server"); + else + if(osvi.dwMinorVersion == 1) + lpszMajorName = _T("XP"); + else + if(osvi.dwMinorVersion == 2) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("XP x64") : _T("Server 2003"); + break; + case 6: + if(osvi.dwMinorVersion == 0) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("Vista") : _T("Server 2008"); + else + if(osvi.dwMinorVersion == 1) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("7") : _T("Server 2008 R2"); + else + if(osvi.dwMinorVersion == 2) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("8") : _T("Server 2012"); + else + if(osvi.dwMinorVersion == 3) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("8.1") : _T("Server 2012 R2"); + break; + case 10: + if(osvi.dwMinorVersion == 0) + lpszMajorName = (VER_NT_WORKSTATION == osvi.wProductType) ? _T("10") : _T("Server 2016"); + break; + default: + break; + } + + if(!lpszMajorName) + { + if(osvi.wServicePackMajor) + ret.Format(_T("Windows %u.%u.%u, SP %u"), osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.wServicePackMajor); + else + ret.Format(_T("Windows %u.%u.%u"), osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber); + } + else + { + if(osvi.wServicePackMajor) + ret.Format(_T("Windows %s [%u.%u.%u], SP %u"), lpszMajorName, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.wServicePackMajor); + else + ret.Format(_T("Windows %s [%u.%u.%u]"), lpszMajorName, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber); + } + if(osvi.szCSDVersion[0]) + { + CString s; + s.Format(_T(" (%s)"), osvi.szCSDVersion); + ret += s; + } + break; + + default: + { + ret.Format(_T(""), osvi.dwPlatformId); + } + break; + } + + return ret; +} diff --git a/windirstat/mountpoints.cpp b/windirstat/mountpoints.cpp index a3e3b3e..fcd0d05 100644 --- a/windirstat/mountpoints.cpp +++ b/windirstat/mountpoints.cpp @@ -68,6 +68,7 @@ void CReparsePoints::GetDriveVolumes() for(i = 0; i < wds::iNumDriveLetters; i++, mask <<= 1) { TCHAR volume[_MAX_PATH]; + volume[0] = 0; if((drives & mask) != 0) { diff --git a/windirstat/res/windirstat.manifest b/windirstat/res/windirstat.manifest index c1788d7..5ee9938 100644 --- a/windirstat/res/windirstat.manifest +++ b/windirstat/res/windirstat.manifest @@ -1,23 +1,36 @@  - - - - - - - - - - -WinDirStat - Windows Directory Statistics - - - - - - - - \ No newline at end of file + + + + + + + + + + + + WinDirStat - Windows Directory Statistics + + + + + + + + + > + + + + diff --git a/windirstat/stdafx.cpp b/windirstat/stdafx.cpp index d3bf4dd..3c5e83a 100644 --- a/windirstat/stdafx.cpp +++ b/windirstat/stdafx.cpp @@ -30,15 +30,3 @@ # pragma message (ANSISTRING(__FILE__) "(" ANSISTRING(__LINE__) ") : warning: You're building a feature-incomplete WinDirStat ('#define HAVE_WIN7_SDK' missing or 0). Refer to https://bitbucket.org/windirstat/windirstat/wiki/Building for details on how to build with this version of Visual Studio.") # endif // Visual C/C++ 2008 and below #endif // HAVE_WIN7_SDK - -#if defined(_UNICODE) || defined(UNICODE) -# if defined _M_IX86 -# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -# elif defined _M_IA64 -# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -# elif defined _M_X64 -# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -# else -# pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -# endif -#endif diff --git a/windirstat/stdafx.h b/windirstat/stdafx.h index b920edc..ff866ee 100644 --- a/windirstat/stdafx.h +++ b/windirstat/stdafx.h @@ -1,74 +1,74 @@ -// stdafx.h - include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently -// -// WinDirStat - Directory Statistics -// Copyright (C) 2003-2005 Bernhard Seifert -// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#ifndef __STDAFX_H_VER__ -#define __STDAFX_H_VER__ 2017112319 -#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) -#pragma once -#endif /* Check for "#pragma once" support */ - -#if (defined(HAVE_WIN7_SDK) && HAVE_WIN7_SDK) || (_MSC_VER >= 1600) -# define SUPPORT_W7_TASKBAR 1 -# define SUPPORT_ELEVATION 1 -#endif // HAVE_WIN7_SDK - -#ifndef _WIN32_WINNT -# ifdef WINVER -# define _WIN32_WINNT WINVER -# else -# define _WIN32_WINNT _WIN32_WINNT_WINXP -# define WINVER _WIN32_WINNT_WINXP -# endif // WINVER -#endif // !_WIN32_WINNT - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit - -// turns off MFC's hiding of some common and often safely ignored warning messages -#define _AFX_ALL_WARNINGS - -#include // MFC Core -#include // MFC Extensions - -#include // MFC IE 4 -#include // MFC Common Controls -#include // MFC Container classes -#include // MFC Multi-threading -#include // For CInternet* classes - -#include // _access() -#include // floor(), fmod(), sqrt() etc. -#include // DBL_MAX -#include // PROCESS_MEMORY_INFO - -#include // ComPtr<> - -#define RGB_GET_RVALUE(rgb) (rgb & 0xFF) -#define RGB_GET_GVALUE(rgb) ((rgb & 0xFF00) >> 8) -#define RGB_GET_BVALUE(rgb) ((rgb & 0xFF0000) >> 16) - -template int signum(T x) { return (x) < 0 ? -1 : (x) == 0 ? 0 : 1; } - -/// signum function for unsigned numbers. -template int usignum(T x, T y) { return (x) < (y) ? -1 : (x) == (y) ? 0 : 1; } - -#endif /* __STDAFX_H_VER__ */ +// stdafx.h - include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently +// +// WinDirStat - Directory Statistics +// Copyright (C) 2003-2005 Bernhard Seifert +// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef __STDAFX_H_VER__ +#define __STDAFX_H_VER__ 2017112319 +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP) +#pragma once +#endif /* Check for "#pragma once" support */ + +#if (defined(HAVE_WIN7_SDK) && HAVE_WIN7_SDK) || (_MSC_VER >= 1600) +# define SUPPORT_W7_TASKBAR 1 +# define SUPPORT_ELEVATION 1 +#endif // HAVE_WIN7_SDK + +#ifndef _WIN32_WINNT +# ifdef WINVER +# define _WIN32_WINNT WINVER +# else +# define _WIN32_WINNT _WIN32_WINNT_WINXP +# define WINVER _WIN32_WINNT_WINXP +# endif // WINVER +#endif // !_WIN32_WINNT + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC Core +#include // MFC Extensions + +#include // MFC IE 4 +#include // MFC Common Controls +#include // MFC Container classes +#include // MFC Multi-threading +#include // For CInternet* classes + +#include // _access() +#include // floor(), fmod(), sqrt() etc. +#include // DBL_MAX +#include // PROCESS_MEMORY_INFO + +#include // ComPtr<> + +#define RGB_GET_RVALUE(rgb) (rgb & 0xFF) +#define RGB_GET_GVALUE(rgb) ((rgb & 0xFF00) >> 8) +#define RGB_GET_BVALUE(rgb) ((rgb & 0xFF0000) >> 16) + +template int signum(T x) { return (x) < 0 ? -1 : (x) == 0 ? 0 : 1; } + +/// signum function for unsigned numbers. +template int usignum(T x, T y) { return (x) < (y) ? -1 : (x) == (y) ? 0 : 1; } + +#endif /* __STDAFX_H_VER__ */ diff --git a/windirstat/windirstat.cpp b/windirstat/windirstat.cpp index d481c06..fd325ff 100644 --- a/windirstat/windirstat.cpp +++ b/windirstat/windirstat.cpp @@ -546,7 +546,11 @@ BOOL CDirstatApp::InitInstance() //and if so, wait for it, so previous instance can store its config that we reload next ::WaitForSingleObject(m_ElevationEvent, 20 * 1000); ::CloseHandle(m_ElevationEvent); - m_ElevationEvent = 0; + m_ElevationEvent = NULL; + } + else + { + VTRACE(_T("OpenEvent failed with %d"), GetLastError()); } #endif // SUPPORT_ELEVATION @@ -677,8 +681,10 @@ void CDirstatApp::OnUpdateRunElevated(CCmdUI *pCmdUI) void CDirstatApp::OnRunElevated() { if (IsAdmin() || !IsUACEnabled()) + { return; - + } + CString sAppName = GetAppFileName(); SHELLEXECUTEINFO shellInfo; @@ -686,7 +692,7 @@ void CDirstatApp::OnRunElevated() shellInfo.cbSize = sizeof(shellInfo); shellInfo.fMask = SEE_MASK_DEFAULT; shellInfo.lpFile = sAppName; - shellInfo.lpVerb = _T("runas"); //DO NOT LOCALIZE + shellInfo.lpVerb = _T("runas"); //DO NOT LOCALIZE! shellInfo.nShow = SW_NORMAL; @@ -697,15 +703,15 @@ void CDirstatApp::OnRunElevated() m_ElevationEvent = ::CreateEvent(NULL, TRUE, FALSE, m_ElevationEventName); if (!m_ElevationEvent) { - VTRACE(_T("CreateEvent failed: %d"), GetLastError()); - m_ElevationEvent = 0; + VTRACE(_T("CreateEvent failed with %d"), GetLastError()); + m_ElevationEvent = NULL; return; } if (ERROR_ALREADY_EXISTS == ::GetLastError()) { VTRACE(_T("Event already exists")); ::CloseHandle(m_ElevationEvent); - m_ElevationEvent = 0; + m_ElevationEvent = NULL; return; } @@ -714,7 +720,7 @@ void CDirstatApp::OnRunElevated() VTRACE(_T("ShellExecuteEx failed to elevate %d"), GetLastError()); ::CloseHandle(m_ElevationEvent); - m_ElevationEvent = 0; + m_ElevationEvent = NULL; //TODO: Display message to user? } @@ -726,7 +732,7 @@ void CDirstatApp::OnRunElevated() ::SetEvent(m_ElevationEvent); //Tell other process that we finished saving data (it waits only 20s) ::CloseHandle(m_ElevationEvent); - m_ElevationEvent = 0; + m_ElevationEvent = NULL; } } #endif // SUPPORT_ELEVATION diff --git a/windirstat/windirstat.vs15.vcxproj b/windirstat/windirstat.vs15.vcxproj index 3bb0042..ef178cc 100644 --- a/windirstat/windirstat.vs15.vcxproj +++ b/windirstat/windirstat.vs15.vcxproj @@ -100,7 +100,7 @@ Disabled ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;%(AdditionalIncludeDirectories) - _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) true EnableFastChecks true @@ -114,7 +114,7 @@ $(OutDir)wds32D.pdb - _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;_ALLOW_RTCc_IN_STL;MODNAME=wds32D;%(PreprocessorDefinitions) + _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;MODNAME=wds32D;%(PreprocessorDefinitions) ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;..;$(IntDir);%(AdditionalIncludeDirectories) @@ -134,7 +134,7 @@ Disabled ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;%(AdditionalIncludeDirectories) - _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) true EnableFastChecks true @@ -148,7 +148,7 @@ $(OutDir)wds64D.pdb - _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;_ALLOW_RTCc_IN_STL;MODNAME=wds64D;%(PreprocessorDefinitions) + _DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;MODNAME=wds64D;%(PreprocessorDefinitions) ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;..;$(IntDir);%(AdditionalIncludeDirectories) @@ -169,7 +169,7 @@ /Oi /Ot %(AdditionalOptions) Full ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;%(AdditionalIncludeDirectories) - NDEBUG;WINVER=0x0501;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) false true MultiThreaded @@ -182,7 +182,7 @@ $(OutDir)wds32.pdb - NDEBUG;WINVER=0x0501;_ALLOW_RTCc_IN_STL;MODNAME=wds32;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;MODNAME=wds32;%(PreprocessorDefinitions) ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;..;$(IntDir);%(AdditionalIncludeDirectories) @@ -205,7 +205,7 @@ /Oi /Ot %(AdditionalOptions) Full ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;%(AdditionalIncludeDirectories) - NDEBUG;WINVER=0x0501;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) false true MultiThreaded @@ -218,7 +218,7 @@ $(OutDir)wds64.pdb - NDEBUG;WINVER=0x0501;_ALLOW_RTCc_IN_STL;MODNAME=wds64;%(PreprocessorDefinitions) + NDEBUG;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;_ALLOW_RTCc_IN_STL;MODNAME=wds64;%(PreprocessorDefinitions) ..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src;..;$(IntDir);%(AdditionalIncludeDirectories) diff --git a/windirstat/windirstat.vs8.vcproj b/windirstat/windirstat.vs8.vcproj index 56e6799..a5fc754 100644 --- a/windirstat/windirstat.vs8.vcproj +++ b/windirstat/windirstat.vs8.vcproj @@ -46,7 +46,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..;.;..\common;Controls;Dialogs;..\3rdparty\lua\src" - PreprocessorDefinitions="_DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;HAVE_WIN7_SDK=1" + PreprocessorDefinitions="_DEBUG;VTRACE_TO_CONSOLE=1;VTRACE_DETAIL=2;WINVER=0x0501;LUA_REG_NO_WINTRACE;LUA_REG_NO_HIVEOPS;LUA_REG_NO_DLL;HAVE_WIN7_SDK=1" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -65,7 +65,7 @@