microsoft / microsoft/win32metadata

Ambiguous definition of TRUSTEE_W

Open
#2,074 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

Summary

TRUSTEE_W is defined in the following way in C++:

typedef struct _TRUSTEE_W {
  struct _TRUSTEE_W          *pMultipleTrustee;
  MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation;
  TRUSTEE_FORM               TrusteeForm;
  TRUSTEE_TYPE               TrusteeType;
  union {
    LPWSTR             ptstrName;
    SID                *pSid;
    OBJECTS_AND_SID    *pObjectsAndSid;
    OBJECTS_AND_NAME_W *pObjectsAndName;
  };
  LPWCH                      ptstrName;
} TRUSTEE_W, *PTRUSTEE_W, TRUSTEEW, *PTRUSTEEW;

However the Rust definition only lists the first variant from union:

pub struct TRUSTEE_W {
    pub pMultipleTrustee: *mut TRUSTEE_W,
    pub MultipleTrusteeOperation: MULTIPLE_TRUSTEE_OPERATION,
    pub TrusteeForm: TRUSTEE_FORM,
    pub TrusteeType: TRUSTEE_TYPE,
    pub ptstrName: windows_core::PWSTR,
}

I am not sure what the right solution to this, but I guess either having enum for union or c_void* because otherwise I am forced to wrap, i.e SID into PWSTR to be able to pass the compiler check.

Crate manifest

Crate code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the documented TRUSTEE_W layout with the generated Rust definition shown in the issue, focusing on the union and its supported variants. Determine the correct representation and validate that callers can pass SID and name values without casts; no repository file or test is named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.