xref: /reactos/sdk/include/crt/sec_api/stdlib_s.h (revision 5100859e)
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the w64 mingw-runtime package.
4  * No warranty is given; refer to the file DISCLAIMER within this package.
5  */
6 #ifndef _INC_STDLIB_S
7 #define _INC_STDLIB_S
8 
9 #include <stdlib.h>
10 
11 #if defined(MINGW_HAS_SECURE_API)
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17   _Check_return_opt_
18   _CRTIMP
19   errno_t
20   __cdecl
21   _dupenv_s(
22     _Outptr_result_buffer_maybenull_(*_PBufferSizeInBytes) _Outptr_result_maybenull_z_ char **_PBuffer,
23     _Out_opt_ size_t *_PBufferSizeInBytes,
24     _In_z_ const char *_VarName);
25 
26   _Check_return_opt_
27   _CRTIMP
28   errno_t
29   __cdecl
30   _itoa_s(
31     _In_ int _Value,
32     _Out_writes_z_(_Size) char *_DstBuf,
33     _In_ size_t _Size,
34     _In_ int _Radix);
35 
36   _Check_return_opt_
37   _CRTIMP
38   errno_t
39   __cdecl
40   _i64toa_s(
41     _In_ __int64 _Val,
42     _Out_writes_z_(_Size) char *_DstBuf,
43     _In_ size_t _Size,
44     _In_ int _Radix);
45 
46   _Check_return_opt_
47   _CRTIMP
48   errno_t
49   __cdecl
50   _ui64toa_s(
51     _In_ unsigned __int64 _Val,
52     _Out_writes_z_(_Size) char *_DstBuf,
53     _In_ size_t _Size,
54     _In_ int _Radix);
55 
56   _Check_return_opt_
57   _CRTIMP
58   errno_t
59   __cdecl
60   _ltoa_s(
61     _In_ long _Val,
62     _Out_writes_z_(_Size) char *_DstBuf,
63     _In_ size_t _Size,
64     _In_ int _Radix);
65 
66   _Success_(return!=EINVAL)
67   _Check_return_opt_
68   _CRTIMP
69   errno_t
70   __cdecl
71   mbstowcs_s(
72     _Out_opt_ size_t *pcchConverted,
73     _Out_writes_to_opt_(sizeInWords, *pcchConverted) wchar_t *pwcstr,
74     _In_ size_t sizeInWords,
75     _In_reads_or_z_(count) const char *pmbstr,
76     _In_ size_t count);
77 
78   _Check_return_opt_
79   _CRTIMP
80   errno_t
81   __cdecl
82   _mbstowcs_s_l(
83     _Out_opt_ size_t *_PtNumOfCharConverted,
84     _Out_writes_to_opt_(_SizeInWords, *_PtNumOfCharConverted) wchar_t *_DstBuf,
85     _In_ size_t _SizeInWords,
86     _In_reads_or_z_(_MaxCount) const char *_SrcBuf,
87     _In_ size_t _MaxCount,
88     _In_opt_ _locale_t _Locale);
89 
90   _Check_return_opt_
91   _CRTIMP
92   errno_t
93   __cdecl
94   _ultoa_s(
95     _In_ unsigned long _Val,
96     _Out_writes_z_(_Size) char *_DstBuf,
97     _In_ size_t _Size,
98     _In_ int _Radix);
99 
100   _Check_return_wat_
101   _CRTIMP
102   errno_t
103   __cdecl
104   _wctomb_s_l(
105     _Out_opt_ int *_SizeConverted,
106     _Out_writes_opt_z_(_SizeInBytes) char *_MbCh,
107     _In_ size_t _SizeInBytes,
108     _In_ wchar_t _WCh,
109     _In_opt_ _locale_t _Locale);
110 
111   _Success_(return!=EINVAL)
112   _Check_return_wat_
113   _CRTIMP
114   errno_t
115   __cdecl
116   wcstombs_s(
117     _Out_opt_ size_t *pcchConverted,
118     _Out_writes_bytes_to_opt_(cjDstSize, *pcchConverted) char *pmbstrDst,
119     _In_ size_t cjDstSize,
120     _In_z_ const wchar_t *pwszSrc,
121     _In_ size_t cjMaxCount);
122 
123   _Check_return_wat_
124   _CRTIMP
125   errno_t
126   __cdecl
127   _wcstombs_s_l(
128     _Out_opt_ size_t *_PtNumOfCharConverted,
129     _Out_writes_bytes_to_opt_(_DstSizeInBytes, *_PtNumOfCharConverted) char *_Dst,
130     _In_ size_t _DstSizeInBytes,
131     _In_z_ const wchar_t *_Src,
132     _In_ size_t _MaxCountInBytes,
133     _In_opt_ _locale_t _Locale);
134 
135 #ifndef _WSTDLIB_S_DEFINED
136 #define _WSTDLIB_S_DEFINED
137 
138   _Check_return_wat_
139   _CRTIMP
140   errno_t
141   __cdecl
142   _itow_s(
143     _In_ int _Val,
144     _Out_writes_z_(_SizeInWords) wchar_t *_DstBuf,
145     _In_ size_t _SizeInWords,
146     _In_ int _Radix);
147 
148   _Check_return_wat_
149   _CRTIMP
150   errno_t
151   __cdecl
152   _ltow_s(
153     _In_ long _Val,
154     _Out_writes_z_(_SizeInWords) wchar_t *_DstBuf,
155     _In_ size_t _SizeInWords,
156     _In_ int _Radix);
157 
158   _Check_return_wat_
159   _CRTIMP
160   errno_t
161   __cdecl
162   _ultow_s(
163     _In_ unsigned long _Val,
164     _Out_writes_z_(_SizeInWords) wchar_t *_DstBuf,
165     _In_ size_t _SizeInWords,
166     _In_ int _Radix);
167 
168   _Check_return_wat_
169   _CRTIMP
170   errno_t
171   __cdecl
172   _wgetenv_s(
173     _Out_ size_t *_ReturnSize,
174     _Out_writes_opt_z_(_DstSizeInWords) wchar_t *_DstBuf,
175     _In_ size_t _DstSizeInWords,
176     _In_z_ const wchar_t *_VarName);
177 
178   _Check_return_wat_
179   _CRTIMP
180   errno_t
181   __cdecl
182   _wdupenv_s(
183     _Outptr_result_buffer_maybenull_(*_BufferSizeInWords) _Outptr_result_maybenull_z_ wchar_t **_Buffer,
184     _Out_opt_ size_t *_BufferSizeInWords,
185     _In_z_ const wchar_t *_VarName);
186 
187   _Check_return_wat_
188   _CRTIMP
189   errno_t
190   __cdecl
191   _i64tow_s(
192     _In_ __int64 _Val,
193     _Out_writes_z_(_SizeInWords) wchar_t *_DstBuf,
194     _In_ size_t _SizeInWords,
195     _In_ int _Radix);
196 
197   _Check_return_wat_
198   _CRTIMP
199   errno_t
200   __cdecl
201   _ui64tow_s(
202     _In_ unsigned __int64 _Val,
203     _Out_writes_z_(_SizeInWords) wchar_t *_DstBuf,
204     _In_ size_t _SizeInWords,
205     _In_ int _Radix);
206 
207 #endif /* _WSTDLIB_S_DEFINED */
208 
209 #ifndef _POSIX_
210 
211   _Check_return_wat_
212   _CRTIMP
213   errno_t
214   __cdecl
215   _ecvt_s(
216     _Out_writes_z_(_Size) char *_DstBuf,
217     _In_ size_t _Size,
218     _In_ double _Val,
219     _In_ int _NumOfDights,
220     _Out_ int *_PtDec,
221     _Out_ int *_PtSign);
222 
223   _Check_return_wat_
224   _CRTIMP
225   errno_t
226   __cdecl
227   _fcvt_s(
228     _Out_writes_z_(_Size) char *_DstBuf,
229     _In_ size_t _Size,
230     _In_ double _Val,
231     _In_ int _NumOfDec,
232     _Out_ int *_PtDec,
233     _Out_ int *_PtSign);
234 
235   _CRTIMP
236   errno_t
237   __cdecl
238   _gcvt_s(
239     _Out_writes_z_(_Size) char *_DstBuf,
240     _In_ size_t _Size,
241     _In_ double _Val,
242     _In_ int _NumOfDigits);
243 
244   _Check_return_wat_
245   _CRTIMP
246   errno_t
247   __cdecl
248   _makepath_s(
249     _Out_writes_z_(_Size) char *_PathResult,
250     _In_ size_t _Size,
251     _In_opt_z_ const char *_Drive,
252     _In_opt_z_ const char *_Dir,
253     _In_opt_z_ const char *_Filename,
254     _In_opt_z_ const char *_Ext);
255 
256   _Check_return_wat_
257   _CRTIMP
258   errno_t
259   __cdecl
260   _putenv_s(
261     _In_z_ const char *_Name,
262     _In_z_ const char *_Value);
263 
264   _CRTIMP
265   errno_t
266   __cdecl
267   _searchenv_s(
268     _In_z_ const char *_Filename,
269     _In_z_ const char *_EnvVar,
270     _Out_writes_z_(_SizeInBytes) char *_ResultPath,
271     _In_ size_t _SizeInBytes);
272 
273   _Check_return_wat_
274   _CRTIMP
275   errno_t
276   __cdecl
277   _splitpath_s(
278     _In_z_ const char *path,
279     _Out_writes_opt_z_(drive_size) char *drive,
280     _In_ size_t drive_size,
281     _Out_writes_opt_z_(dir_size) char *dir,
282     _In_ size_t dir_size,
283     _Out_writes_opt_z_(fname_size) char *fname,
284     _In_ size_t fname_size,
285     _Out_writes_opt_z_(ext_size) char *ext,
286     _In_ size_t ext_size);
287 
288 #ifndef _WSTDLIBP_S_DEFINED
289 #define _WSTDLIBP_S_DEFINED
290 
291   _Check_return_wat_
292   _CRTIMP
293   errno_t
294   __cdecl
295   _wmakepath_s(
296     _Out_writes_z_(_SizeInWords) wchar_t *_PathResult,
297     _In_ size_t _SizeInWords,
298     _In_opt_z_ const wchar_t *_Drive,
299     _In_opt_z_ const wchar_t *_Dir,
300     _In_opt_z_ const wchar_t *_Filename,
301     _In_opt_z_ const wchar_t *_Ext);
302 
303   _Check_return_wat_
304   _CRTIMP
305   errno_t
306   __cdecl
307   _wputenv_s(
308     _In_z_ const wchar_t *_Name,
309     _In_z_ const wchar_t *_Value);
310 
311   _CRTIMP
312   errno_t
313   __cdecl
314   _wsearchenv_s(
315     _In_z_ const wchar_t *_Filename,
316     _In_z_ const wchar_t *_EnvVar,
317     _Out_writes_z_(_SizeInWords) wchar_t *_ResultPath,
318     _In_ size_t _SizeInWords);
319 
320   _CRTIMP
321   errno_t
322   __cdecl
323   _wsplitpath_s(
324     _In_z_ const wchar_t *path,
325     _Out_writes_opt_z_(drive_size) wchar_t *drive,
326     _In_ size_t drive_size,
327     _Out_writes_opt_z_(dir_size) wchar_t *dir,
328     _In_ size_t dir_size,
329     _Out_writes_opt_z_(fname_size) wchar_t *fname,
330     _In_ size_t fname_size,
331     _Out_writes_opt_z_(ext_size) wchar_t *ext,
332     _In_ size_t ext_size);
333 
334 #endif /* _WSTDLIBP_S_DEFINED */
335 
336 #endif /* _POSIX_ */
337 
338 #ifdef __cplusplus
339 }
340 #endif
341 
342 #endif /* defined(MINGW_HAS_SECURE_API) */
343 
344 #endif /* _INC_STDLIB_S */
345