Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Release

RAII Smart Handle Wrappers for Windows Kernel Objects & Shared Memory [v2.4 Technical Discussion]

ptr_arithmetic
C++ Wizard
MEMBER
担当者: 162
参加日: May 2018
投稿: 73
ありがとう: 42
3 週間前 · Jul 29, 2026 8:13 PM
#1

Modern C++20 RAII handle management to eliminate handle leaks:

CPP
struct HandleDeleter { void operator()(HANDLE h) const { if (h && h != INVALID_HANDLE_VALUE) CloseHandle(h); } };
using UniqueHandle = std::unique_ptr<void, HandleDeleter>;

UniqueHandle hProcess(OpenProcess(PROCESS_ALL_ACCESS, FALSE, targetPid));
if (!hProcess) return false;
// Automatically calls CloseHandle when exiting scope!

Guarantees exception safety and zero dangling zombie process handles!

null_deref
Reverse Engineer
MEMBER
担当者: 79
参加日: Jan 2019
投稿: 42
ありがとう: 46
3 週間前 · Jul 30, 2026 3:47 AM
#2

RAII smart handles prevent resource leaks during early error return branches. Clean modern C++.

vtable_slayer
Senior Reverser
MEMBER
担当者: 215
参加日: Mar 2018
投稿: 86
ありがとう: 61
3 週間前 · Jul 30, 2026 10:07 AM
#3

Simple, elegant, and crash-proof.