acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_.h
1// get_mem_info2 from debug.h by camilo on 2022-11-07 01:53 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5#include "_c.h"
6
7
8#include "acme/operating_system/error_code.h"
9
10
11#include "acme/prototype/comparison/compare.h"
12
13
14#include "acme/prototype/time/_time.h"
15
16
17#include "acme/operating_system/time.h"
18
19
20#include "acme/operating_system/windows_common/last_error.h"
21
22
23#include "_string.h"
24
25
26//using dword_array_base = ::numeric_array_base < DWORD >;
27
28//using dword_array = ::array_particle < ::dword_array_base >;
29
30
31
32// #ifdef MEMDLEAK
33//
34//
35// //CLASS_DECL_ACME string get_mem_info_report1();
36// //CLASS_DECL_ACME::collection::count get_mem_info(::i32 ** ppiUse, const_char_pointer ** ppszFile, const_char_pointer ** pszCallStack, ::u32 ** ppuiLine, size_t ** ppsize);
37// #ifdef WINDOWS
38// CLASS_DECL_ACME::collection::count get_mem_info2(::i32 ** ppiUse, const_char_pointer ** ppszFile, DWORD64 ** ppuiStack[64], ::i64 ** ppiStack, ::i32 ** ppiLine, ::i64 ** ppiSize);
39// #endif
40//
41//
42// #endif
43
44
45namespace windows
46{
47
48 constexpr ::u32 wait_millis(const class time& time)
49 {
50
51 if (time.is_infinite())
52 {
53
54 return INFINITE;
55
56 }
57
58 auto i = time.integral_millisecond();
59
60 return i > 0xFFFFFFFEu ? 0xFFFFFFFEu : (DWORD) i;
61
62 }
63
64
65
66}
67
68//template < >
69//inline bool gt(DWORD dw, ::i32 i)
70//{
71// return i < 0 ? true : dw >((DWORD)i);
72//}
73
74//template < >
75//inline bool gt(count i,::u64 u)
76//{
77
78// return i < 0 ? false : ((::u64)i) > u;
79
80//}
81
82//#endif
83
84CLASS_DECL_ACME void TRACELASTERROR();
85
86
87#include "acme/operating_system/windows_common/last_error.h"
88#include "acme/operating_system/windows_common/last_error_exception.h"
89
90
91
92namespace windows
93{
94
95
96 CLASS_DECL_ACME::enum_status _last_error_status(::u32 uLastError);
97 inline ::e_status last_error_status(const last_error & lasterror) { return _last_error_status(lasterror.m_uLastError); }
98
99
100 CLASS_DECL_ACME::enum_status _failed_last_error_status(::u32 uLastError);
101 inline ::e_status failed_last_error_status(const last_error & lasterror) { return _failed_last_error_status(lasterror.m_uLastError); }
102
103
104 //CLASS_DECL_ACME::enum_status _hresult_status(HRESULT hresult);
105 //inline ::e_status hresult_status(HRESULT hresult) { return _hresult_status(hresult); }
106
107
108 CLASS_DECL_ACME void * get_library_symbol_address(const ::file::path & pathLibrary, const ::scoped_string & scopedstrSymbolName);
109
110
111 template < typename PFN >
113 {
114 public:
115
116
117 inline static PFN get_address(const ::scoped_string & scopedstrModule, const_char_pointer pszName)
118 {
119
120 return (PFN) get_library_symbol_address(scopedstrModule, pszName);
121
122 }
123
124
125 };
126
127
128 CLASS_DECL_ACME ::e_status wait_result_status(::i32 iResult, ::i32 nCount);
129
130 CLASS_DECL_ACME ::u32 _get_file_attributes(const ::file::path & path);
131
132 CLASS_DECL_ACME ::u32 get_file_attributes(const ::file::path & path);
133
134 CLASS_DECL_ACME ::i32_bool is_win32_accessible(::u32 uFileAttributes, const last_error & lasterror);
135
136 CLASS_DECL_ACME ::i32_bool is_win32_accessible(const ::file::path & path);
137
138 CLASS_DECL_ACME void set_file_attributes(const ::file::path & path, ::u32 uFileAttributes);
139
140
141 CLASS_DECL_ACME error_code last_error_error_code(const last_error & lasterror);
142
143
144 CLASS_DECL_ACME error_code last_error_error_code();
145
146
147 //CLASS_DECL_ACME void throw_last_error_exception(const ::last_error & lasterror);
148
149
150 //CLASS_DECL_ACME void throw_last_error_exception();
151
152
153} // namespace windows
154
155
156//
157//
158//
159//#ifdef WINDOWS
160//#define ARG_SEC_ATTRS_DEF , void * psaAttributes = nullptr
161//#define ARG_SEC_ATTRS , void * psaAttributes
162//#define PARAM_SEC_ATTRS (void *) psaAttributes
163//#define PASS_SEC_ATTRS psaAttributes
164//#define INSERT_PARAM_SEC_ATTRS(ATTRS) , ATTRS
165//#define ADD_PARAM_SEC_ATTRS , PARAM_SEC_ATTRS
166//#define ADD_PASS_SEC_ATTRS , PASS_SEC_ATTRS
167//#else
168//#define ARG_SEC_ATTRS_DEF
169//#define ARG_SEC_ATTRS
170//#define PARAM_SEC_ATTRS
171//#define INSERT_PARAM_SEC_ATTRS(ATTRS)
172//#define ADD_PARAM_SEC_ATTRS
173//#define ADD_PASS_SEC_ATTRS
174//#endif
175//
176//
177//
178
179
180
181#include "acme/operating_system/windows_common/handle.h"
182#include "acme/operating_system/windows_common/file.h"
183
184
185namespace windows
186{
187
188
189 [[ noreturn ]] CLASS_DECL_ACME void throw_last_error_exception(const ::scoped_string & scopedstrErrorMessage, const last_error & lasterror = {});
190 [[ noreturn ]] CLASS_DECL_ACME void throw_file_last_error_exception(const ::file::path & path, ::file::e_open eopen, const last_error & lasterror = {}, const ::scoped_string & scopedstrErrorMessage = nullptr);
191
192
193} // namespace windows
194
195
196
197
Definition error_code.h:22
Definition _.h:113
Definition last_error.h:10