Exetools  

Go Back   Exetools > General > Source Code

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-07-2024, 18:05
atom0s's Avatar
atom0s atom0s is offline
Family
 
Join Date: Jan 2015
Location: 127.0.0.1
Posts: 431
Rept. Given: 26
Rept. Rcvd 130 Times in 67 Posts
Thanks Given: 54
Thanks Rcvd at 837 Times in 306 Posts
atom0s Reputation: 100-199 atom0s Reputation: 100-199
You can also do something similar to this by using the built-in 'std::shared_ptr' type. It allows for initialization with a custom deleter function. With that, you can pass a type cleanup call for types that have one. (You can also just define your own callback to cleanup custom/more unique types as needed.)

For example, using a 'HANDLE' type, which is cleaned up using 'CloseHandle':

PHP Code:
const std::shared_ptr<voidhandle(::OpenProcess(PROCESS_VM_READFALSEpid), ::CloseHandle); 
Usage is then similar to your setup by just using 'handle.get()' to obtain the actual handle.
__________________
Personal Projects Site: https://atom0s.com

Last edited by atom0s; 06-08-2024 at 04:49. Reason: Forum breaks C++ code using the normal code tags; changed to php tags instead.
Reply With Quote
The Following 3 Users Say Thank You to atom0s For This Useful Post:
MarcElBichon (06-07-2024), SofTw0rm (06-11-2024), tonyweb (06-08-2024)
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource Manager (.NET) v2 CodeCracker Community Tools 2 11-23-2025 22:25


All times are GMT +8. The time now is 11:51.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )