diff --git a/include/WinStd/COM.h b/include/WinStd/COM.h index 271248b1..4995e1b7 100644 --- a/include/WinStd/COM.h +++ b/include/WinStd/COM.h @@ -81,7 +81,7 @@ namespace winstd template class com_obj : public dplhandle { - WINSTD_DPLHANDLE_IMPL(com_obj, NULL) + WINSTD_DPLHANDLE_IMPL(com_obj, T*, NULL) public: /// @@ -196,7 +196,7 @@ namespace winstd /// class bstr : public dplhandle { - WINSTD_DPLHANDLE_IMPL(bstr, NULL) + WINSTD_DPLHANDLE_IMPL(bstr, BSTR, NULL) public: /// @@ -1041,7 +1041,7 @@ namespace winstd /// class safearray : public dplhandle { - WINSTD_DPLHANDLE_IMPL(safearray, NULL) + WINSTD_DPLHANDLE_IMPL(safearray, SAFEARRAY*, NULL) public: /// diff --git a/include/WinStd/Common.h b/include/WinStd/Common.h index 14d5437d..a647687b 100644 --- a/include/WinStd/Common.h +++ b/include/WinStd/Common.h @@ -161,27 +161,27 @@ private: \ /// /// Implements default constructors and operators to prevent their auto-generation by compiler. /// -#define WINSTD_HANDLE_IMPL(C, INVAL) \ +#define WINSTD_HANDLE_IMPL(C, T, INVAL) \ public: \ - C ( ) noexcept { } \ - C (_In_opt_ handle_type h) noexcept : handle( h ) { } \ - C (_Inout_ C &&h) noexcept : handle(std::move(h)) { } \ - C& operator=(_In_opt_ handle_type h) noexcept { handle::operator=( h ); return *this; } \ - C& operator=(_Inout_ C &&h) noexcept { handle::operator=(std::move(h)); return *this; } \ + C ( ) noexcept {} \ + C (_In_opt_ T h) noexcept : handle( h ) {} \ + C (_Inout_ C &&h) noexcept : handle(std::move(h)) {} \ + C& operator=(_In_opt_ T h) noexcept { handle::operator=( h ); return *this; } \ + C& operator=(_Inout_ C &&h) noexcept { handle::operator=(std::move(h)); return *this; } \ WINSTD_NONCOPYABLE(C) /// /// Implements default constructors and operators to prevent their auto-generation by compiler. /// -#define WINSTD_DPLHANDLE_IMPL(C, INVAL) \ +#define WINSTD_DPLHANDLE_IMPL(C, T, INVAL) \ public: \ - C ( ) noexcept { } \ - C (_In_opt_ handle_type h) noexcept : dplhandle( h ) { } \ - C (_In_ const C &h) noexcept : dplhandle(duplicate_internal(h.m_h)) { } \ - C (_Inout_ C &&h) noexcept : dplhandle(std::move (h )) { } \ - C& operator=(_In_opt_ handle_type h) noexcept { dplhandle::operator=( h ); return *this; } \ - C& operator=(_In_ const C &h) noexcept { dplhandle::operator=( h ); return *this; } \ - C& operator=(_Inout_ C &&h) noexcept { dplhandle::operator=(std::move(h)); return *this; } \ + C ( ) noexcept {} \ + C (_In_opt_ T h) noexcept : dplhandle( h ) {} \ + C (_In_ const C &h) noexcept : dplhandle(duplicate_internal(h.m_h)) {} \ + C (_Inout_ C &&h) noexcept : dplhandle(std::move (h )) {} \ + C& operator=(_In_opt_ T h) noexcept { dplhandle::operator=( h ); return *this; } \ + C& operator=(_In_ const C &h) noexcept { dplhandle::operator=( h ); return *this; } \ + C& operator=(_Inout_ C &&h) noexcept { dplhandle::operator=(std::move(h)); return *this; } \ private: /// @} @@ -1951,7 +1951,7 @@ namespace winstd /// /// Deallocate object at _Ptr sanitizing its content first /// - void deallocate(_In_ pointer _Ptr, _In_ size_type _Count) + void deallocate(_In_ _Ty* const _Ptr, _In_ const std::size_t _Count) { // Sanitize then free. SecureZeroMemory(_Ptr, sizeof(_Ty) * _Count); diff --git a/include/WinStd/Crypt.h b/include/WinStd/Crypt.h index effaa9bb..e8710f73 100644 --- a/include/WinStd/Crypt.h +++ b/include/WinStd/Crypt.h @@ -259,7 +259,7 @@ namespace winstd /// class cert_context : public dplhandle { - WINSTD_DPLHANDLE_IMPL(cert_context, NULL) + WINSTD_DPLHANDLE_IMPL(cert_context, PCCERT_CONTEXT, NULL) public: /// @@ -392,7 +392,7 @@ namespace winstd /// class cert_chain_context : public dplhandle { - WINSTD_DPLHANDLE_IMPL(cert_chain_context, NULL) + WINSTD_DPLHANDLE_IMPL(cert_chain_context, PCCERT_CHAIN_CONTEXT, NULL) public: /// @@ -441,7 +441,7 @@ namespace winstd /// class cert_store : public handle { - WINSTD_HANDLE_IMPL(cert_store, NULL) + WINSTD_HANDLE_IMPL(cert_store, HCERTSTORE, NULL) public: /// @@ -474,7 +474,7 @@ namespace winstd /// class crypt_prov : public handle { - WINSTD_HANDLE_IMPL(crypt_prov, NULL) + WINSTD_HANDLE_IMPL(crypt_prov, HCRYPTPROV, NULL) public: /// @@ -507,7 +507,7 @@ namespace winstd /// class crypt_hash : public dplhandle { - WINSTD_DPLHANDLE_IMPL(crypt_hash, NULL) + WINSTD_DPLHANDLE_IMPL(crypt_hash, HCRYPTHASH, NULL) public: /// @@ -560,7 +560,7 @@ namespace winstd /// class crypt_key : public dplhandle { - WINSTD_DPLHANDLE_IMPL(crypt_key, NULL) + WINSTD_DPLHANDLE_IMPL(crypt_key, HCRYPTKEY, NULL) public: /// diff --git a/include/WinStd/EAP.h b/include/WinStd/EAP.h index 9067349b..837ce0b0 100644 --- a/include/WinStd/EAP.h +++ b/include/WinStd/EAP.h @@ -405,7 +405,7 @@ namespace winstd /// class eap_packet : public dplhandle { - WINSTD_DPLHANDLE_IMPL(eap_packet, NULL) + WINSTD_DPLHANDLE_IMPL(eap_packet, EapPacket*, NULL) public: /// diff --git a/include/WinStd/ETW.h b/include/WinStd/ETW.h index 743d6819..1b43c242 100644 --- a/include/WinStd/ETW.h +++ b/include/WinStd/ETW.h @@ -490,7 +490,7 @@ namespace winstd /// class event_provider : public handle { - WINSTD_HANDLE_IMPL(event_provider, NULL) + WINSTD_HANDLE_IMPL(event_provider, REGHANDLE, NULL) public: /// @@ -904,7 +904,7 @@ namespace winstd /// class event_trace : public handle { - WINSTD_HANDLE_IMPL(event_trace, INVALID_PROCESSTRACE_HANDLE) + WINSTD_HANDLE_IMPL(event_trace, TRACEHANDLE, INVALID_PROCESSTRACE_HANDLE) public: /// diff --git a/include/WinStd/GDI.h b/include/WinStd/GDI.h index 9bf3bd4e..e59f88cd 100644 --- a/include/WinStd/GDI.h +++ b/include/WinStd/GDI.h @@ -20,7 +20,7 @@ namespace winstd template class gdi_handle : public handle { - WINSTD_HANDLE_IMPL(gdi_handle, NULL) + WINSTD_HANDLE_IMPL(gdi_handle, T, NULL) public: /// @@ -51,7 +51,7 @@ namespace winstd /// class icon : public handle { - WINSTD_HANDLE_IMPL(icon, NULL) + WINSTD_HANDLE_IMPL(icon, HICON, NULL) public: /// @@ -82,7 +82,7 @@ namespace winstd /// class dc : public handle { - WINSTD_HANDLE_IMPL(dc, NULL) + WINSTD_HANDLE_IMPL(dc, HDC, NULL) public: /// diff --git a/include/WinStd/SetupAPI.h b/include/WinStd/SetupAPI.h index 6d470182..f02a25a9 100644 --- a/include/WinStd/SetupAPI.h +++ b/include/WinStd/SetupAPI.h @@ -24,7 +24,7 @@ namespace winstd /// class setup_device_info_list : public handle { - WINSTD_HANDLE_IMPL(setup_device_info_list, INVALID_HANDLE_VALUE) + WINSTD_HANDLE_IMPL(setup_device_info_list, HDEVINFO, INVALID_HANDLE_VALUE) public: /// diff --git a/include/WinStd/WLAN.h b/include/WinStd/WLAN.h index 10a5fac0..8132a209 100644 --- a/include/WinStd/WLAN.h +++ b/include/WinStd/WLAN.h @@ -131,7 +131,7 @@ namespace winstd /// class wlan_handle : public handle { - WINSTD_HANDLE_IMPL(wlan_handle, NULL) + WINSTD_HANDLE_IMPL(wlan_handle, HANDLE, NULL) public: /// diff --git a/include/WinStd/Win.h b/include/WinStd/Win.h index a106c17d..34d6a26b 100644 --- a/include/WinStd/Win.h +++ b/include/WinStd/Win.h @@ -1030,7 +1030,7 @@ namespace winstd template class win_handle : public handle { - WINSTD_HANDLE_IMPL(win_handle, INVALID) + WINSTD_HANDLE_IMPL(win_handle, HANDLE, INVALID) public: /// @@ -1063,7 +1063,7 @@ namespace winstd /// class library : public handle { - WINSTD_HANDLE_IMPL(library, NULL) + WINSTD_HANDLE_IMPL(library, HMODULE, NULL) public: /// @@ -1249,7 +1249,7 @@ namespace winstd /// class find_file : public handle { - WINSTD_HANDLE_IMPL(find_file, INVALID_HANDLE_VALUE) + WINSTD_HANDLE_IMPL(find_file, HANDLE, INVALID_HANDLE_VALUE) public: /// @@ -1282,7 +1282,7 @@ namespace winstd /// class heap : public handle { - WINSTD_HANDLE_IMPL(heap, NULL) + WINSTD_HANDLE_IMPL(heap, HANDLE, NULL) public: /// @@ -1809,7 +1809,7 @@ namespace winstd /// class reg_key : public handle { - WINSTD_HANDLE_IMPL(reg_key, NULL) + WINSTD_HANDLE_IMPL(reg_key, HKEY, NULL) public: /// @@ -1891,7 +1891,7 @@ namespace winstd /// class security_id : public handle { - WINSTD_HANDLE_IMPL(security_id, NULL) + WINSTD_HANDLE_IMPL(security_id, PSID, NULL) public: /// @@ -1962,7 +1962,7 @@ namespace winstd /// class event_log : public handle { - WINSTD_HANDLE_IMPL(event_log, NULL) + WINSTD_HANDLE_IMPL(event_log, HANDLE, NULL) public: /// @@ -1993,7 +1993,7 @@ namespace winstd /// class sc_handle : public handle { - WINSTD_HANDLE_IMPL(sc_handle, NULL) + WINSTD_HANDLE_IMPL(sc_handle, SC_HANDLE, NULL) public: /// diff --git a/include/WinStd/WinHTTP.h b/include/WinStd/WinHTTP.h index 8dfa4e12..714e2965 100644 --- a/include/WinStd/WinHTTP.h +++ b/include/WinStd/WinHTTP.h @@ -23,7 +23,7 @@ namespace winstd /// class http : public handle { - WINSTD_HANDLE_IMPL(http, NULL) + WINSTD_HANDLE_IMPL(http, HINTERNET, NULL) public: /// diff --git a/include/WinStd/WinSock2.h b/include/WinStd/WinSock2.h index bc7a34ea..b8039b87 100644 --- a/include/WinStd/WinSock2.h +++ b/include/WinStd/WinSock2.h @@ -107,7 +107,7 @@ namespace winstd /// class addrinfo : public handle { - WINSTD_HANDLE_IMPL(addrinfo, NULL) + WINSTD_HANDLE_IMPL(addrinfo, PADDRINFOA, NULL) public: /// @@ -140,7 +140,7 @@ namespace winstd /// class waddrinfo : public handle { - WINSTD_HANDLE_IMPL(waddrinfo, NULL) + WINSTD_HANDLE_IMPL(waddrinfo, PADDRINFOW, NULL) public: ///