WinStd
Windows Win32 API using Standard C++
Loading...
Searching...
No Matches
WinTrust.h
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
8
9#pragma once
10
11#include "Common.h"
12#include <WinTrust.h>
13
14namespace winstd
15{
18
23 {
26
27 public:
31 wintrust(_In_opt_ HWND hwnd, _In_ const GUID &action, _Inout_ WINTRUST_DATA &wtd) :
32 m_hwnd(hwnd),
33 m_action(action),
34 m_wtd(wtd)
35 {
36 const LONG lResult = WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
37 if (lResult != ERROR_SUCCESS)
38 throw win_runtime_error(lResult, "WinVerifyTrust failed");
39 }
40
44 virtual ~wintrust()
45 {
46 m_wtd.dwStateAction = WTD_STATEACTION_CLOSE;
47 WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
48 }
49
50 protected:
52 HWND m_hwnd;
53 GUID m_action;
54 WINTRUST_DATA &m_wtd;
56 };
57
59}
Windows runtime error.
Definition Common.h:1553
WinTrust engine wrapper class.
Definition WinTrust.h:23
wintrust(HWND hwnd, const GUID &action, WINTRUST_DATA &wtd)
Initializes a new class instance.
Definition WinTrust.h:31
virtual ~wintrust()
Destroys the WinTrust context.
Definition WinTrust.h:44
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75