HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
random
seed_win32_impl.hpp
1
// Copyright Take Vos 2022.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "
../win32_headers.hpp
"
8
9
#include "seed_intf.hpp"
10
#include "../utility/utility.hpp"
11
#include "../macros.hpp"
12
#include <format>
13
14
hi_export_module(hikogui.random.seed : impl);
15
16
hi_export
namespace
hi::inline
v1
{
17
18
inline
void
generate_seed
(
void
*ptr,
size_t
size)
19
{
20
auto
status = BCryptGenRandom(NULL,
static_cast<
PUCHAR
>
(ptr), narrow_cast<ULONG>(size), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
21
if
(not SUCCEEDED(status)) {
22
throw
os_error(std::format(
"BCryptGenRandom(): {}"
, get_last_error_message(status)));
23
}
24
}
25
26
}
win32_headers.hpp
Rules for working with win32 headers.
v1
DOXYGEN BUG.
Definition
algorithm_misc.hpp:20
v1::generate_seed
void generate_seed(void *ptr, size_t size)
Load a random seed.
Definition
seed_win32_impl.hpp:18
Generated on
for HikoGUI by
1.16.1