{"id":25838576,"url":"https://github.com/vsrs/windows_safe_handle","last_synced_at":"2026-06-10T11:31:34.153Z","repository":{"id":192024280,"uuid":"686229495","full_name":"vsrs/windows_safe_handle","owner":"vsrs","description":"Generate smart pointers for https://crates.io/crates/windows raw handles with ergonomic APIs.","archived":false,"fork":false,"pushed_at":"2024-07-17T18:44:36.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T07:56:24.927Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsrs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-02T05:18:27.000Z","updated_at":"2024-07-17T18:35:57.000Z","dependencies_parsed_at":"2023-09-02T05:49:20.299Z","dependency_job_id":"2db5f904-b03c-463f-a8a9-5746fe95fbb9","html_url":"https://github.com/vsrs/windows_safe_handle","commit_stats":null,"previous_names":["vsrs/windows_safe_handle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vsrs/windows_safe_handle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrs%2Fwindows_safe_handle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrs%2Fwindows_safe_handle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrs%2Fwindows_safe_handle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrs%2Fwindows_safe_handle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsrs","download_url":"https://codeload.github.com/vsrs/windows_safe_handle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsrs%2Fwindows_safe_handle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34151273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-01T03:51:52.982Z","updated_at":"2026-06-10T11:31:34.134Z","avatar_url":"https://github.com/vsrs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `windows_safe_handle`\n\nGenerate smart pointers for [windows](https://crates.io/crates/windows) raw handles with ergonomic APIs.\n\n## `safe_handle!`\n\nThis crate doesn't offer pre-defined smart pointers. Instead, it provides a single `safe_handle!` macro for generation:\n\n### Simple Smart Pointer, calling an unsafe Function on `Drop`\n\n```rust\nuse windows_safe_handle::safe_handle;\nuse windows::Win32::Foundation::{HANDLE, CloseHandle};\n\nsafe_handle!(pub Handle(HANDLE), CloseHandle);\n```\n\nIf you do not need to export the `Handle` type, simply omit the `pub` keyword.\n\n### Smart Pointer with additional `Drop` logic\n\nYou can use a closure-based syntax:\n\n```rust\nuse windows_safe_handle::safe_handle;\nuse windows::Win32::Foundation::{HANDLE, CloseHandle};\n\nsafe_handle!(pub Handle(HANDLE), |h| {\n    // Place your code here\n    unsafe { CloseHandle(h) }\n});\n```\n\nNote that in this case you have to explicitly use `unsafe` block.\n\n## Versions\n\n- `v0.1.*`: Compatible with `windows` `v0.48.0`.\n- `v0.2.*`: Compatible with `windows` `v0.58.0`.\n\n## Example\n\nRefer to [`tests/bcrypt_hash.rs`](https://github.com/vsrs/windows_safe_handle/blob/main/tests/bcrypt_hash.rs) to see how to safely wrap [Windows Cryptography Next Generation (CNG) APIs](https://learn.microsoft.com/en-us/windows/win32/seccng/cng-portal) for calculating MD5 hashes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsrs%2Fwindows_safe_handle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsrs%2Fwindows_safe_handle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsrs%2Fwindows_safe_handle/lists"}