WinStd
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
WinTrust.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
12
13#pragma once
14
15#include "Common.h"
16#include <WinTrust.h>
17
18namespace winstd
19{
22
27 {
30
31 public:
35 wintrust(_In_opt_ HWND hwnd, _In_ const GUID &action, _Inout_ WINTRUST_DATA &wtd) :
36 m_hwnd(hwnd),
37 m_action(action),
38 m_wtd(wtd)
39 {
40 const LONG lResult = WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
41 if (lResult != ERROR_SUCCESS)
42 throw win_runtime_error(lResult, "WinVerifyTrust failed.");
43 }
44
48 virtual ~wintrust()
49 {
50 m_wtd.dwStateAction = WTD_STATEACTION_CLOSE;
51 WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
52 }
53
54 protected:
56 HWND m_hwnd;
57 GUID m_action;
58 WINTRUST_DATA &m_wtd;
60 };
61
63}
General API.
Integrates WinStd classes with Microsoft WinTrust API.
Windows runtime error.
Definition: Common.h:1056
WinTrust engine wrapper class.
Definition: WinTrust.h:27
wintrust(HWND hwnd, const GUID &action, WINTRUST_DATA &wtd)
Initializes a new class instance.
Definition: WinTrust.h:35
virtual ~wintrust()
Destroys the WinTrust context.
Definition: WinTrust.h:48
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:82