diff --git a/src/common/platform/process.hpp b/src/common/platform/process.hpp index e02d8f99..0fc6adbb 100644 --- a/src/common/platform/process.hpp +++ b/src/common/platform/process.hpp @@ -770,6 +770,12 @@ struct TOKEN_USER64 SID_AND_ATTRIBUTES64 User; }; +struct TOKEN_GROUPS64 +{ + ULONG GroupCount; + SID_AND_ATTRIBUTES64 Groups[1]; +}; + struct TOKEN_OWNER64 { EMULATOR_CAST(EmulatorTraits::PVOID, PSID) Owner; diff --git a/src/windows-emulator/syscalls/token.cpp b/src/windows-emulator/syscalls/token.cpp index 52857c72..7580f334 100644 --- a/src/windows-emulator/syscalls/token.cpp +++ b/src/windows-emulator/syscalls/token.cpp @@ -75,6 +75,26 @@ namespace syscalls return STATUS_SUCCESS; } + if (token_information_class == TokenGroups) + { + constexpr auto required_size = sizeof(TOKEN_GROUPS64) + sizeof(sid); + return_length.write(required_size); + + if (required_size > token_information_length) + { + return STATUS_BUFFER_TOO_SMALL; + } + + TOKEN_GROUPS64 groups{}; + groups.GroupCount = 1; + groups.Groups[0].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + groups.Groups[0].Sid = token_information + sizeof(TOKEN_GROUPS64); + + emulator_object{c.emu, token_information}.write(groups); + c.emu.write_memory(token_information + sizeof(TOKEN_GROUPS64), sid, sizeof(sid)); + return STATUS_SUCCESS; + } + if (token_information_class == TokenOwner) { constexpr auto required_size = sizeof(sid) + sizeof(TOKEN_OWNER64);