Support hardcoded environment variables

This commit is contained in:
momo5502
2024-10-23 18:41:29 +02:00
parent c992d17300
commit 1446d9193a
2 changed files with 11 additions and 0 deletions

View File

@@ -122,6 +122,13 @@ public:
return emulator_object<T>(*this->emu_, potential_start);
}
wchar_t* copy_string(const std::wstring_view str)
{
UNICODE_STRING uc_str{};
this->make_unicode_string(uc_str, str);
return uc_str.Buffer;
}
void make_unicode_string(UNICODE_STRING& result, const std::wstring_view str)
{
constexpr auto element_size = sizeof(str[0]);

View File

@@ -226,6 +226,10 @@ namespace
proc_params.StandardInput = STDIN_HANDLE.h;
proc_params.StandardError = proc_params.StandardOutput;
proc_params.Environment = allocator.copy_string(L"=::=::\\");
allocator.copy_string(L"EMULATOR=1");
allocator.copy_string(L"COMPUTERNAME=momo");
allocator.copy_string(L"");
std::wstring command_line = L"\"" + file.wstring() + L"\"";