view include/animone/util/win32.h @ 24:f1b9adaa41b3

dep/animone: a11y/win32: fix missing ComInterface definition
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 23:21:19 -0400
parents 1cfa7d57c022
children 60ded877339b
line wrap: on
line source

#ifndef ANIMONE_ANIMONE_UTIL_WIN32_H_
#define ANIMONE_ANIMONE_UTIL_WIN32_H_

#include <windef.h>
#include <subauth.h>
#include <handleapi.h>

#include <memory>
#include <string>

namespace animone::internal::win32 {

struct HandleDeconstructor {
	using pointer = HANDLE;
	void operator()(pointer t) const { ::CloseHandle(t); };
};

using Handle = std::unique_ptr<HANDLE, HandleDeconstructor>;

/* ----------------------------------------------- */

std::string ToUtf8String(const std::wstring& string);
std::string ToUtf8String(const UNICODE_STRING& string);
std::wstring ToWstring(const std::string& string);

/* XXX can this stuff be moved to fd/win32.cc? */
bool IsSystemDirectory(const std::string& path);
bool IsSystemDirectory(std::wstring path);

} // namespace animone::internal::win32

#endif // ANIMONE_ANIMONE_UTIL_WIN32_H_