param([Parameter(Mandatory)][string]$OutputDirectory) $ErrorActionPreference='Stop' $decoderOut=[IO.Path]::GetFullPath($(if([IO.Path]::IsPathRooted($OutputDirectory)){ $OutputDirectory }else{ Join-Path (Get-Location).ProviderPath $OutputDirectory })) New-Item -ItemType Directory -Force -Path $decoderOut | Out-Null $decoderSource=Join-Path $PSScriptRoot 'DecodeP1.cpp' $decoderSetup='call "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul' $decoderCommand=$decoderSetup+' && cl /nologo /EHsc /O2 /std:c++20 /DUNICODE /D_UNICODE "'+$decoderSource+'" /Fo"'+(Join-Path $decoderOut 'DecodeP1.obj')+'" /Fe"'+(Join-Path $decoderOut 'DecodeP1.exe')+'" /link tdh.lib advapi32.lib' cmd.exe /d /s /c $decoderCommand if($LASTEXITCODE) { throw 'Decoder compilation failed' }