Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capabillity to launch the right autorunsc depending on architecture #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions src/OrcCommand/Command/GetSamples/GetSamples_Run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,49 @@ HRESULT Main::LoadAutoRuns(TaskTracker& tk, LPCWSTR szTempDir)
auto command = std::make_shared<CommandExecute>(L"AutoRuns");

std::wstring strAutorunsRef;
hr = EmbeddedResource::ExtractValue(L"", L"AUTORUNS", strAutorunsRef);
if (FAILED(hr))
{
Log::Error("Could not find ressource reference to AutoRuns [{}]", SystemError(hr));

WORD wArch = 0;
if (FAILED(hr = SystemDetails::GetArchitecture(wArch)))
return hr;

switch (wArch)
{
case PROCESSOR_ARCHITECTURE_INTEL:
hr = EmbeddedResource::ExtractValue(L"", L"AUTORUNS", strAutorunsRef);
if (FAILED(hr))
{
Log::Error("Could not find ressource reference to AutoRuns [{}]", SystemError(hr));
return hr;
}
break;
case PROCESSOR_ARCHITECTURE_AMD64:
if (SystemDetails::IsWOW64())
{
hr = EmbeddedResource::ExtractValue(L"", L"AUTORUNS", strAutorunsRef);
if (FAILED(hr))
{
Log::Error("Could not find ressource reference to AutoRuns [{}]", SystemError(hr));
return hr;
}
}
else
{
hr = EmbeddedResource::ExtractValue(L"", L"AUTORUNS64", strAutorunsRef);
if (FAILED(hr))
{
Log::Info("Could not find ressource reference to AutoRuns x64 fallback to x86 [{}]", SystemError(hr));
}
hr = EmbeddedResource::ExtractValue(L"", L"AUTORUNS", strAutorunsRef);
if (FAILED(hr))
{
Log::Error("Could not find ressource reference to AutoRuns [{}]", SystemError(hr));
return hr;
}
}
break;
default:
Log::Error("Unsupported architecture: {}", wArch);
return hr;
}

std::wstring strAutorunsCmd;
Expand Down