ResourceGuardWin32.hpp 598 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include "ResourceGuard.hpp"
  3. #if defined(_WINDOWS_)
  4. struct GenericHandleTraits {
  5. using HandleType = HANDLE;
  6. static inline const HandleType InvalidValue = NULL;
  7. static constexpr auto& Releasor = CloseHandle;
  8. };
  9. struct FileHandleTraits {
  10. using HandleType = HANDLE;
  11. static inline const HandleType InvalidValue = INVALID_HANDLE_VALUE;
  12. static constexpr auto& Releasor = CloseHandle;
  13. };
  14. struct MapViewTraits {
  15. using HandleType = PVOID;
  16. static inline const HandleType InvalidValue = NULL;
  17. static constexpr auto& Releasor = UnmapViewOfFile;
  18. };
  19. #endif