-
Notifications
You must be signed in to change notification settings - Fork 369
Description
Proposal: Add 'Id' property to Windows.System.User
Summary
Windows.System.User.GetFromId() creates a User object from a SID (as string) but there's no way to go the other way. Add a User.Id property to return the user SID as a string, complementing User.GetFromId()
Rationale
Windows.System.User has a function to go from a SID to a User object but not the reverse, making it a one way ticket and greatly limited its utility to the few Windows APIs accepting a Windows.System.User object. This gap creates an unnecessarily painful and segregated developer experience, directly contrary to Reunion's goals.
Many Windows APIs take a user SID as a string or PSID, but if you've got a Windows.System.User there's no way to make use of those APIs.
Having a way to get a SID from a User object is also useful for logging as you can't record a User object.
Scope
Capability | Priority |
---|---|
Provide API to convert Windows.System.User to a SID string | Must |
Provide API to convert Windows.System.User to a PSID | Should |
Important Notes
Proposed APIs:
STDAPI Windows_System_User_To_Sid(Windows::System::IUser* user, PSID* userSid);
STDAPI Windows_System_User_To_SidString(Windows::System::IUser* user, PWSTR* userSid);
namespace Microsoft.System
{
runtimeclass User
{
User(Windows.System.User user)
String Id { get; };
Windows.System.User User { get; };
}
}
Flat-C APIs get the User's SID as a string and a PSID (the common currency in C++ Win32 land, required by many APIs).
A WinRT API can only expose SID as a string as there's no notion of PSID today in Windows' WinRT API surface. Reunion can add more functionality in the future if/when desired.