samedi 15 octobre 2022

WIL Wrappers for Private Namespaces and Boundary Descriptors

I am currently reading "Windows 10 System Programming" by Pavel Yosifovich. Since The WIL Library doesn't have a boundary descriptor and private namespace wrapper, he creates it:

namespace wil {
    static void close_private_ns(HANDLE h) {
        ::ClosePrivateNamespace(h, 0);
    };

    using unique_private_ns = unique_any_handle_null_only<decltype(&close_private_ns), close_private_ns>;

    using unique_bound_desc = unique_any_handle_null_only<decltype(&::DeleteBoundaryDescriptor), ::DeleteBoundaryDescriptor>;
}

What is the meaning of the last two lines?

I tried reading about "using", "decltype" and templates but I couldn't understand it in this context.

The full program can be found in: https://github.com/zodiacon/Win10SysProgBookSamples/tree/master/Chapter02/PrivateSharing2

Aucun commentaire:

Enregistrer un commentaire