microsoft / microsoft/win32metadata

Missing Free implementation

Open
#2,059 5 comments 0 reactions 1 assignee View on GitHub

@mikebattista is already working on this.

Since Feb 12, 2025.

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

Description

### Summary

It seems that 0.59.0 removed the implementation of `windows_core::Free` trait on some types (eg. PSID)

```
PS C:\Users\xxxx\RustroverProjects\toto> cargo run
Compiling windows v0.59.0
Compiling toto v0.1.0 (C:\Users\xxxx\RustroverProjects\toto)
error[E0599]: no method named `free` found for struct `PSID` in the current scope
--> src\main.rs:14:9
|
14 | sid.free()
| ^^^^ method not found in `PSID`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `toto` (bin "toto") due to 1 previous error
```

### Crate manifest

```TOML
[package]
name = "toto"
version = "0.1.0"
edition = "2021"

[dependencies]
windows = { version = "0.59", features = [
"Win32_Security_Authorization"
] }
```

### Crate code

```Rust
use std::ptr::null_mut;
use windows::core::w;
use windows::Win32::Security::Authorization::ConvertStringSidToSidW;
use windows::Win32::Security::PSID;
use windows::core::Free;

fn main() {
let sid = PSID(null_mut());
let sid_string = w!("S-1-5-18");
unsafe {
ConvertStringSidToSidW(sid_string, &raw mut sid).unwrap();
};

sid.free()
}
```

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.