mirror of
https://github.com/T3nb3w/ComDotNetExploit
synced 2026-06-06 16:54:26 +00:00
24 lines
523 B
C++
24 lines
523 B
C++
// com_utils.h
|
|
#pragma once
|
|
#include <Windows.h>
|
|
#include <comdef.h>
|
|
#include <atlbase.h>
|
|
|
|
class COMAutoRelease {
|
|
public:
|
|
COMAutoRelease() { CoInitialize(nullptr); }
|
|
~COMAutoRelease() { CoUninitialize(); }
|
|
};
|
|
|
|
template<typename T>
|
|
class COMPtr {
|
|
CComPtr<T> ptr;
|
|
public:
|
|
COMPtr() = default;
|
|
COMPtr(const COMPtr&) = delete;
|
|
COMPtr& operator=(const COMPtr&) = delete;
|
|
|
|
T** operator&() { return &ptr; }
|
|
T* operator->() { return ptr; }
|
|
operator T* () { return ptr; }
|
|
}; |