Skip to content

Commit

Permalink
EfiDSEFix: print help text on invalid usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattiwatti committed May 31, 2023
1 parent fe90876 commit 2233c19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Application/EfiDSEFix/src/EfiDSEFix.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<ControlFlowGuard>false</ControlFlowGuard>
<AdditionalIncludeDirectories>$(SolutionDir)Include;$(SolutionDir)../MdePkg/Include;$(SolutionDir)../MdePkg/Include/X64;$(SolutionDir)../MdeModulePkg/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<IntrinsicFunctions>true</IntrinsicFunctions>
<BuildStlModules>false</BuildStlModules>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down Expand Up @@ -108,6 +109,7 @@
<ControlFlowGuard>false</ControlFlowGuard>
<AdditionalIncludeDirectories>$(SolutionDir)Include;$(SolutionDir)../MdePkg/Include;$(SolutionDir)../MdePkg/Include/X64;$(SolutionDir)../MdeModulePkg/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<IntrinsicFunctions>true</IntrinsicFunctions>
<BuildStlModules>false</BuildStlModules>
</ClCompile>
<Link>
<SubSystem>Native</SubSystem>
Expand Down
7 changes: 6 additions & 1 deletion Application/EfiDSEFix/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int wmain(int argc, wchar_t** argv)
const BOOLEAN Win8OrHigher = (RtlNtMajorVersion() >= 6 && RtlNtMinorVersion() >= 2) || RtlNtMajorVersion() > 6;
const ULONG EnabledCiOptionsValue = Win8OrHigher ? 0x6 : CODEINTEGRITY_OPTION_ENABLED;
const PCWCHAR CiOptionsName = Win8OrHigher ? L"g_CiOptions" : L"g_CiEnabled";
ULONG CiOptionsValue = 0;
ULONG CiOptionsValue;
BOOLEAN ReadOnly = FALSE;

if (wcsncmp(argv[1], L"-c", sizeof(L"-c") / sizeof(WCHAR) - 1) == 0 ||
Expand Down Expand Up @@ -82,6 +82,11 @@ int wmain(int argc, wchar_t** argv)
{
return DumpSystemInformation();
}
else
{
PrintUsage(argv[0]);
return STATUS_INVALID_PARAMETER;
}

// Trigger EFI driver exploit and write new value to g_CiOptions/g_CiEnabled
ULONG OldCiOptionsValue;
Expand Down

0 comments on commit 2233c19

Please sign in to comment.