diff options
author | Matthijs Lavrijsen <mattiwatti@gmail.com> | 2022-04-21 21:03:50 +0200 |
---|---|---|
committer | Matthijs Lavrijsen <mattiwatti@gmail.com> | 2022-04-21 21:03:50 +0200 |
commit | d128e2a30b0249e66845c8195d3ad69adc5e6379 (patch) | |
tree | b98c1cce2253905ea38016d849efa1097f173a64 | |
parent | 734be74c4d499fd74123b0db1228235639b64c41 (diff) |
EfiDSEFix: add /SUBSYSTEM:NATIVE project configuration
Closes #51
-rw-r--r-- | Application/EfiDSEFix/src/EfiDSEFix.h | 7 | ||||
-rw-r--r-- | Application/EfiDSEFix/src/EfiDSEFix.vcxproj | 51 | ||||
-rw-r--r-- | Application/EfiDSEFix/src/main.cpp | 2 |
3 files changed, 59 insertions, 1 deletions
diff --git a/Application/EfiDSEFix/src/EfiDSEFix.h b/Application/EfiDSEFix/src/EfiDSEFix.h index e7cb109..9b79489 100644 --- a/Application/EfiDSEFix/src/EfiDSEFix.h +++ b/Application/EfiDSEFix/src/EfiDSEFix.h @@ -140,7 +140,14 @@ Printf( va_list VaList; va_start(VaList, Format); ULONG N = _vsnwprintf(Buffer, sizeof(Buffer) / sizeof(WCHAR) - 1, Format, VaList); +#if defined(_NATIVE) + UNREFERENCED_PARAMETER(N); + UNICODE_STRING String; + RtlInitUnicodeString(&String, Buffer); + NtDisplayString(&String); +#else WriteConsoleW(NtCurrentPeb()->ProcessParameters->StandardOutput, Buffer, N, &N, NULL); +#endif va_end(VaList); } diff --git a/Application/EfiDSEFix/src/EfiDSEFix.vcxproj b/Application/EfiDSEFix/src/EfiDSEFix.vcxproj index 3461e7b..2400aa5 100644 --- a/Application/EfiDSEFix/src/EfiDSEFix.vcxproj +++ b/Application/EfiDSEFix/src/EfiDSEFix.vcxproj @@ -1,6 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Release (native subsystem)|x64"> + <Configuration>Release (native subsystem)</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|x64"> <Configuration>Release</Configuration> <Platform>x64</Platform> @@ -23,6 +27,14 @@ <PlatformToolset>v142</PlatformToolset> <SpectreMitigation>false</SpectreMitigation> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release (native subsystem)|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>false</SpectreMitigation> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -76,9 +88,48 @@ <SetChecksum>true</SetChecksum> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release (native subsystem)|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PreprocessorDefinitions>WINVER=0x0600;_WIN32_WINNT=0x0600;NTDDI_VERSION=0x06000200;WIN32;_WIN64;NDEBUG;_NATIVE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DiagnosticsFormat>Caret</DiagnosticsFormat> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <LanguageStandard>stdcpplatest</LanguageStandard> + <AdditionalOptions>/Gw /utf-8 %(AdditionalOptions)</AdditionalOptions> + <BufferSecurityCheck>false</BufferSecurityCheck> + <DisableSpecificWarnings>4201</DisableSpecificWarnings> + <ExceptionHandling>false</ExceptionHandling> + <OmitFramePointers>true</OmitFramePointers> + <ControlFlowGuard>false</ControlFlowGuard> + <AdditionalIncludeDirectories>$(SolutionDir)Include;$(SolutionDir)../MdePkg/Include;$(SolutionDir)../MdePkg/Include/X64;$(SolutionDir)../MdeModulePkg/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <IntrinsicFunctions>true</IntrinsicFunctions> + </ClCompile> + <Link> + <SubSystem>Native</SubSystem> + <GenerateDebugInformation>DebugFull</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <Version>6.0</Version> + <MinimumRequiredVersion>6.0</MinimumRequiredVersion> + <AdditionalLibraryDirectories>$(SolutionDir)Application\EfiDSEFix\lib\x64</AdditionalLibraryDirectories> + <EntryPointSymbol>NtProcessStartupW</EntryPointSymbol> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <AdditionalOptions>/NOVCFEATURE /NOCOFFGRPINFO /PDBALTPATH:%_PDB% %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>ntdllp.lib</AdditionalDependencies> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <GenerateMapFile>true</GenerateMapFile> + <SetChecksum>true</SetChecksum> + </Link> + </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="hde\hde64.c"> <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MinSpace</Optimization> + <Optimization Condition="'$(Configuration)|$(Platform)'=='Release (native subsystem)|x64'">MinSpace</Optimization> </ClCompile> <ClCompile Include="main.cpp" /> <ClCompile Include="EfiDSEFix.cpp" /> diff --git a/Application/EfiDSEFix/src/main.cpp b/Application/EfiDSEFix/src/main.cpp index 0575b0a..7112ded 100644 --- a/Application/EfiDSEFix/src/main.cpp +++ b/Application/EfiDSEFix/src/main.cpp @@ -242,6 +242,6 @@ NtProcessStartupW( &NumChars); // Call the main function and terminate with the exit status - const NTSTATUS Status = wmain(Argc, Argv); + const NTSTATUS Status = wmain(static_cast<int>(Argc), Argv); return NtTerminateProcess(NtCurrentProcess, Status); } |