diff options
author | Oliver Schneider <oliver@assarbad.net> | 2018-10-08 23:48:52 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2018-10-08 23:48:52 +0300 |
commit | 3008e91efac446fc21d607485cb787c457401a8b (patch) | |
tree | 1bba3159c29b56fa63a1fe3e5d5720b9e4ddfab3 /3rdparty | |
parent | f045e0d70bc3c17933ce61302f3e0bfb30c2ec2f (diff) |
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
Diffstat (limited to '3rdparty')
-rw-r--r-- | 3rdparty/VersionInfo.h | 306 | ||||
-rw-r--r-- | 3rdparty/embedded-lua/globals.lua | 30 | ||||
-rw-r--r-- | 3rdparty/lua/src/buildvm.vs15.vcxproj | 106 | ||||
-rw-r--r-- | 3rdparty/lua/src/buildvm.vs8.vcproj | 177 | ||||
-rw-r--r-- | 3rdparty/lua/src/luajit2.vs15.vcxproj | 104 | ||||
-rw-r--r-- | 3rdparty/lua/src/luajit2.vs8.vcproj | 163 | ||||
-rw-r--r-- | 3rdparty/lua/src/minilua.vs15.vcxproj | 147 | ||||
-rw-r--r-- | 3rdparty/lua/src/minilua.vs8.vcproj | 260 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h | 6 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/lua-winreg/src/luamacro.h | 6 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/lua-winreg/src/luareg.h | 12 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/lua-winreg/src/winreg.c | 6 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/lua-winreg/test/test_5_1_14.lua | 21 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/w32resembed.c | 118 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/winreg.c | 2 | ||||
-rw-r--r-- | 3rdparty/lua/src/modules/winreg.h | 5 | ||||
-rw-r--r-- | 3rdparty/priv.c | 319 | ||||
-rw-r--r-- | 3rdparty/priv.h | 70 |
18 files changed, 1653 insertions, 205 deletions
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 <Windows.h>
-#include <tchar.h>
-#pragma warning(disable:4995)
-#include <cstdio>
-#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 <Windows.h> +#include <tchar.h> +#pragma warning(disable:4995) +#if defined(DDKBUILD) +#include <stdio.h> +#else +#include <cstdio> +#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 @@ <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@@ -16,6 +24,18 @@ <Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
@@ -31,6 +51,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -38,6 +64,22 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>.\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>buildvm32</TargetName>
+ <TargetExt>.exe</TargetExt>
+ <LinkIncremental>false</LinkIncremental>
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>.\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>buildvm64</TargetName>
+ <TargetExt>.exe</TargetExt>
+ <LinkIncremental>false</LinkIncremental>
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\</OutDir>
<IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
@@ -54,6 +96,70 @@ <LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <OutputFile>$(OutDir)buildvm32.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <PreBuildEvent>
+ <Command>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</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <OutputFile>$(OutDir)buildvm64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <PreBuildEvent>
+ <Command>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</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
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 @@ -19,6 +19,183 @@ </ToolFiles>
<Configurations>
<Configuration
+ Name="Debug|Win32"
+ OutputDirectory="."
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="if not exist "..\..\..\intermediate\vs2005_$(PlatformName)" md "..\..\..\intermediate\vs2005_$(PlatformName)"
minilua ..\dynasm\dynasm.lua -LN -D WIN -D JIT -D FFI -o "..\..\..\intermediate\vs2005_$(PlatformName)\buildvm_arch.h" vm_x86.dasc"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ ProgramDataBaseFileName="$(OutDir)\buildvm32.pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies=""
+ OutputFile="$(OutDir)\buildvm32.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(IntDir);$(IntDir)"
+ GenerateManifest="false"
+ GenerateDebugInformation="false"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="mainCRTStartup"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="."
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="if not exist "..\..\..\intermediate\vs2005_$(PlatformName)" md "..\..\..\intermediate\vs2005_$(PlatformName)"
minilua ..\dynasm\dynasm.lua -LN -D WIN -D JIT -D FFI -D P64 -o "..\..\..\intermediate\vs2005_$(PlatformName)\buildvm_arch.h" vm_x86.dasc"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ ProgramDataBaseFileName="$(OutDir)\buildvm64.pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies=""
+ OutputFile="$(OutDir)\buildvm64.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(IntDir);$(IntDir)"
+ GenerateManifest="false"
+ GenerateDebugInformation="false"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="mainCRTStartup"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
Name="Release|Win32"
OutputDirectory="."
IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
diff --git a/3rdparty/lua/src/luajit2.vs15.vcxproj b/3rdparty/lua/src/luajit2.vs15.vcxproj index addd9f5..311adbd 100644 --- a/3rdparty/lua/src/luajit2.vs15.vcxproj +++ b/3rdparty/lua/src/luajit2.vs15.vcxproj @@ -1,6 +1,14 @@ <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@@ -16,6 +24,18 @@ <Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
@@ -31,6 +51,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -38,6 +64,18 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>..\..\..\..\..\build\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>luajit2_$(Platform)</TargetName>
+ <TargetExt>.lib</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>..\..\..\..\..\build\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>luajit2_$(Platform)</TargetName>
+ <TargetExt>.lib</TargetExt>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\..\..\..\..\build\</OutDir>
<IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
@@ -50,6 +88,72 @@ <TargetName>luajit2_$(Platform)</TargetName>
<TargetExt>.lib</TargetExt>
</PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)luajit2_$(Platform).lib</OutputFile>
+ <AdditionalOptions>/nodefaultlib "$(IntDir)\lj_vm32.obj" %(AdditionalOptions)</AdditionalOptions>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ <PreBuildEvent>
+ <Command>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</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2017_$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)luajit2_$(Platform).lib</OutputFile>
+ <AdditionalOptions>/nodefaultlib "$(IntDir)\lj_vm64.obj" %(AdditionalOptions)</AdditionalOptions>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ <PreBuildEvent>
+ <Command>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</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
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 @@ -19,6 +19,169 @@ </ToolFiles>
<Configurations>
<Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build"
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="if not exist "..\..\..\intermediate\vs2005_$(PlatformName)" md "..\..\..\intermediate\vs2005_$(PlatformName)"
buildvm32 -m peobj -o "$(IntDir)\lj_vm32.obj"
buildvm32 -m bcdef -o "..\..\..\intermediate\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\lj_folddef.h" lj_opt_fold.c"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ ProgramDataBaseFileName="$(OutDir)\luajit2_$(PlatformName).pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies=""
+ OutputFile="$(OutDir)\luajit2_$(PlatformName).lib"
+ AdditionalLibraryDirectories="$(IntDir)"
+ AdditionalOptions="/MACHINE:X86 /nodefaultlib "$(IntDir)\lj_vm32.obj""
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="..\..\..\..\..\build"
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="if not exist "..\..\..\intermediate\vs2005_$(PlatformName)" md "..\..\..\intermediate\vs2005_$(PlatformName)"
buildvm64 -m peobj -o "$(IntDir)\lj_vm64.obj"
buildvm64 -m bcdef -o "..\..\..\intermediate\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\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\vs2005_$(PlatformName)\lj_folddef.h" lj_opt_fold.c"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ ProgramDataBaseFileName="$(OutDir)\luajit2_$(PlatformName).pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)..\dynasm;..\..\..\intermediate\vs2005_$(PlatformName)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies=""
+ OutputFile="$(OutDir)\luajit2_$(PlatformName).lib"
+ AdditionalLibraryDirectories="$(IntDir)"
+ AdditionalOptions="/MACHINE:X64 /nodefaultlib "$(IntDir)\lj_vm64.obj""
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
Name="Release|Win32"
OutputDirectory="..\..\..\..\..\build"
IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
diff --git a/3rdparty/lua/src/minilua.vs15.vcxproj b/3rdparty/lua/src/minilua.vs15.vcxproj index fd5f267..48344d6 100644 --- a/3rdparty/lua/src/minilua.vs15.vcxproj +++ b/3rdparty/lua/src/minilua.vs15.vcxproj @@ -1,10 +1,22 @@ <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{531911BC-0023-4EC6-A2CE-6C3F5C182647}</ProjectGuid>
@@ -12,19 +24,62 @@ <Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v141</PlatformToolset>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>.\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>minilua</TargetName>
+ <TargetExt>.exe</TargetExt>
+ <LinkIncremental>false</LinkIncremental>
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>.\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>minilua</TargetName>
+ <TargetExt>.exe</TargetExt>
+ <LinkIncremental>false</LinkIncremental>
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\</OutDir>
<IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
@@ -33,6 +88,70 @@ <LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>.\</OutDir>
+ <IntDir>..\..\..\intermediate\vs2017_$(Platform)_$(Configuration)\$(ProjectName)\</IntDir>
+ <TargetName>minilua</TargetName>
+ <TargetExt>.exe</TargetExt>
+ <LinkIncremental>false</LinkIncremental>
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <OutputFile>$(OutDir)minilua.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalOptions>/release %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <OutputFile>$(OutDir)minilua.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX64</TargetMachine>
+ <AdditionalOptions>/release %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
@@ -61,6 +180,34 @@ <AdditionalOptions>/release %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader></PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat></DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <OutputFile>$(OutDir)minilua.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX64</TargetMachine>
+ <AdditionalOptions>/release %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="host\minilua.c">
</ClCompile>
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,11 +11,185 @@ <Platform
Name="Win32"
/>
+ <Platform
+ Name="x64"
+ />
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
+ Name="Debug|Win32"
+ OutputDirectory="."
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ ProgramDataBaseFileName="$(OutDir)\minilua.pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/release"
+ OutputFile="$(OutDir)\minilua.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(IntDir);$(IntDir)"
+ GenerateManifest="false"
+ GenerateDebugInformation="false"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="mainCRTStartup"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="."
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ ProgramDataBaseFileName="$(OutDir)\minilua.pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/release"
+ OutputFile="$(OutDir)\minilua.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(IntDir);$(IntDir)"
+ GenerateManifest="false"
+ GenerateDebugInformation="false"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="mainCRTStartup"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
Name="Release|Win32"
OutputDirectory="."
IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
@@ -100,6 +274,92 @@ Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="."
+ IntermediateDirectory="..\..\..\intermediate\vs2005_$(PlatformName)_$(ConfigurationName)\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ ProgramDataBaseFileName="$(OutDir)\minilua.pdb"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/release"
+ OutputFile="$(OutDir)\minilua.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(IntDir);$(IntDir)"
+ GenerateManifest="false"
+ GenerateDebugInformation="false"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="mainCRTStartup"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
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 <lua.h> #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 <Windows.h> +#include <winnt.h> +#include <tchar.h> + +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__ */ |