Reactos
1//
2// stdlib.h
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// The C Standard Library <stdlib.h> header.
7//
8#pragma once
9#ifndef _INC_STDLIB // include guard for 3rd party interop
10#define _INC_STDLIB
11
12#include <corecrt.h>
13#include <corecrt_malloc.h>
14#include <corecrt_search.h>
15#include <corecrt_wstdlib.h>
16#include <limits.h>
17
18#pragma warning(push)
19#pragma warning(disable: _UCRT_DISABLED_WARNINGS)
20_UCRT_DISABLE_CLANG_WARNINGS
21
22_CRT_BEGIN_C_HEADER
23
24
25
26#ifndef _countof
27 #define _countof __crt_countof
28#endif
29
30
31
32// Minimum and maximum macros
33#define __max(a,b) (((a) > (b)) ? (a) : (b))
34#define __min(a,b) (((a) < (b)) ? (a) : (b))
35
36
37
38_ACRTIMP void __cdecl _swab(
39 _Inout_updates_(_SizeInBytes) _Post_readable_size_(_SizeInBytes) char* _Buf1,
40 _Inout_updates_(_SizeInBytes) _Post_readable_size_(_SizeInBytes) char* _Buf2,
41 _In_ int _SizeInBytes
42 );
43
44
45
46//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47//
48// Exit and Abort
49//
50//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51// Argument values for exit()
52#define EXIT_SUCCESS 0
53#define EXIT_FAILURE 1
54
55#if _CRT_FUNCTIONS_REQUIRED
56 _ACRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
57 _ACRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
58 _ACRTIMP __declspec(noreturn) void __cdecl _Exit(_In_ int _Code);
59 _ACRTIMP __declspec(noreturn) void __cdecl quick_exit(_In_ int _Code);
60 _ACRTIMP __declspec(noreturn) void __cdecl abort(void);
61#endif // _CRT_FUNCTIONS_REQUIRED
62
63// Argument values for _set_abort_behavior().
64#define _WRITE_ABORT_MSG 0x1 // debug only, has no effect in release
65#define _CALL_REPORTFAULT 0x2
66
67_ACRTIMP unsigned int __cdecl _set_abort_behavior(
68 _In_ unsigned int _Flags,
69 _In_ unsigned int _Mask
70 );
71
72
73
74#ifndef _CRT_ONEXIT_T_DEFINED
75 #define _CRT_ONEXIT_T_DEFINED
76
77 typedef int (__CRTDECL* _onexit_t)(void);
78 #ifdef _M_CEE
79 typedef int (__clrcall* _onexit_m_t)(void);
80 #endif
81#endif
82
83#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
84 // Non-ANSI name for compatibility
85 #define onexit_t _onexit_t
86#endif
87
88
89
90#ifdef _M_CEE
91 #pragma warning (push)
92 #pragma warning (disable: 4985) // Attributes not present on previous declaration
93
94 _Check_return_ int __clrcall _atexit_m_appdomain(_In_opt_ void (__clrcall* _Function)(void));
95
96 _onexit_m_t __clrcall _onexit_m_appdomain(_onexit_m_t _Function);
97
98 #ifdef _M_CEE_MIXED
99 #ifdef __cplusplus
100 [System::Security::SecurityCritical]
101 #endif
102 _Check_return_ int __clrcall _atexit_m(_In_opt_ void (__clrcall* _Function)(void));
103
104 _onexit_m_t __clrcall _onexit_m(_onexit_m_t _Function);
105 #else
106 #ifdef __cplusplus
107 [System::Security::SecurityCritical]
108 #endif
109 _Check_return_ inline int __clrcall _atexit_m(_In_opt_ void (__clrcall* _Function)(void))
110 {
111 return _atexit_m_appdomain(_Function);
112 }
113
114 inline _onexit_m_t __clrcall _onexit_m(_onexit_t _Function)
115 {
116 return _onexit_m_appdomain(_Function);
117 }
118 #endif
119 #pragma warning (pop)
120#endif
121
122
123
124#ifdef _M_CEE_PURE
125 // In pure mode, atexit is the same as atexit_m_appdomain
126 extern "C++"
127 {
128
129 #ifdef __cplusplus
130 [System::Security::SecurityCritical]
131 #endif
132 inline int __clrcall atexit(void (__clrcall* _Function)(void))
133 {
134 return _atexit_m_appdomain(_Function);
135 }
136
137 inline _onexit_t __clrcall _onexit(_onexit_t _Function)
138 {
139 return _onexit_m_appdomain(_Function);
140 }
141
142 } // extern "C++"
143#else
144 int __cdecl atexit(void (__cdecl*)(void));
145 _onexit_t __cdecl _onexit(_In_opt_ _onexit_t _Func);
146#endif
147
148int __cdecl at_quick_exit(void (__cdecl*)(void));
149
150
151
152//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
153//
154// Global State (errno, global handlers, etc.)
155//
156//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
157#ifndef _M_CEE_PURE
158 // a purecall handler procedure. Never returns normally
159 typedef void (__cdecl* _purecall_handler)(void);
160
161 // Invalid parameter handler function pointer type
162 typedef void (__cdecl* _invalid_parameter_handler)(
163 wchar_t const*,
164 wchar_t const*,
165 wchar_t const*,
166 unsigned int,
167 uintptr_t
168 );
169
170 // Establishes a purecall handler
171 _VCRTIMP _purecall_handler __cdecl _set_purecall_handler(
172 _In_opt_ _purecall_handler _Handler
173 );
174
175 _VCRTIMP _purecall_handler __cdecl _get_purecall_handler(void);
176
177 // Establishes an invalid parameter handler
178 _ACRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(
179 _In_opt_ _invalid_parameter_handler _Handler
180 );
181
182 _ACRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
183
184 _ACRTIMP _invalid_parameter_handler __cdecl _set_thread_local_invalid_parameter_handler(
185 _In_opt_ _invalid_parameter_handler _Handler
186 );
187
188 _ACRTIMP _invalid_parameter_handler __cdecl _get_thread_local_invalid_parameter_handler(void);
189#endif
190
191
192#if defined __cplusplus && defined _M_CEE_PURE
193extern "C++"
194{
195 typedef void (__clrcall* _purecall_handler)(void);
196 typedef _purecall_handler _purecall_handler_m;
197
198 _MRTIMP _purecall_handler __cdecl _set_purecall_handler(
199 _In_opt_ _purecall_handler _Handler
200 );
201} // extern "C++"
202#endif
203
204
205
206// Argument values for _set_error_mode().
207#define _OUT_TO_DEFAULT 0
208#define _OUT_TO_STDERR 1
209#define _OUT_TO_MSGBOX 2
210#define _REPORT_ERRMODE 3
211
212_Check_return_opt_ _ACRTIMP int __cdecl _set_error_mode(_In_ int _Mode);
213
214
215
216#if _CRT_FUNCTIONS_REQUIRED
217 _ACRTIMP int* __cdecl _errno(void);
218 #define errno (*_errno())
219
220 _ACRTIMP errno_t __cdecl _set_errno(_In_ int _Value);
221 _ACRTIMP errno_t __cdecl _get_errno(_Out_ int* _Value);
222
223 _ACRTIMP unsigned long* __cdecl __doserrno(void);
224 #define _doserrno (*__doserrno())
225
226 _ACRTIMP errno_t __cdecl _set_doserrno(_In_ unsigned long _Value);
227 _ACRTIMP errno_t __cdecl _get_doserrno(_Out_ unsigned long * _Value);
228
229 // This is non-const for backwards compatibility; do not modify it.
230 _ACRTIMP _CRT_INSECURE_DEPRECATE(strerror) char** __cdecl __sys_errlist(void);
231 #define _sys_errlist (__sys_errlist())
232
233 _ACRTIMP _CRT_INSECURE_DEPRECATE(strerror) int * __cdecl __sys_nerr(void);
234 #define _sys_nerr (*__sys_nerr())
235
236 _ACRTIMP void __cdecl perror(_In_opt_z_ char const* _ErrMsg);
237#endif // _CRT_FUNCTIONS_REQUIRED
238
239
240
241// These point to the executable module name.
242_CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr ) _ACRTIMP char** __cdecl __p__pgmptr (void);
243_CRT_INSECURE_DEPRECATE_GLOBALS(_get_wpgmptr) _ACRTIMP wchar_t** __cdecl __p__wpgmptr(void);
244_CRT_INSECURE_DEPRECATE_GLOBALS(_get_fmode ) _ACRTIMP int* __cdecl __p__fmode (void);
245
246#ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
247 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr ) extern char* _pgmptr;
248 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_wpgmptr) extern wchar_t* _wpgmptr;
249 #ifndef _CORECRT_BUILD
250 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_fmode ) extern int _fmode;
251 #endif
252#else
253 #define _pgmptr (*__p__pgmptr ())
254 #define _wpgmptr (*__p__wpgmptr())
255 #define _fmode (*__p__fmode ())
256#endif
257
258_Success_(return == 0)
259_ACRTIMP errno_t __cdecl _get_pgmptr (_Outptr_result_z_ char** _Value);
260
261_Success_(return == 0)
262_ACRTIMP errno_t __cdecl _get_wpgmptr(_Outptr_result_z_ wchar_t** _Value);
263
264_ACRTIMP errno_t __cdecl _set_fmode (_In_ int _Mode );
265
266_ACRTIMP errno_t __cdecl _get_fmode (_Out_ int* _PMode);
267
268
269
270//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
271//
272// Math
273//
274//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
275typedef struct _div_t
276{
277 int quot;
278 int rem;
279} div_t;
280
281typedef struct _ldiv_t
282{
283 long quot;
284 long rem;
285} ldiv_t;
286
287typedef struct _lldiv_t
288{
289 long long quot;
290 long long rem;
291} lldiv_t;
292
293_Check_return_ int __cdecl abs (_In_ int _Number);
294_Check_return_ long __cdecl labs (_In_ long _Number);
295_Check_return_ long long __cdecl llabs (_In_ long long _Number);
296_Check_return_ __int64 __cdecl _abs64(_In_ __int64 _Number);
297
298_Check_return_ unsigned short __cdecl _byteswap_ushort(_In_ unsigned short _Number);
299_Check_return_ unsigned long __cdecl _byteswap_ulong (_In_ unsigned long _Number);
300_Check_return_ unsigned __int64 __cdecl _byteswap_uint64(_In_ unsigned __int64 _Number);
301
302_Check_return_ _ACRTIMP div_t __cdecl div (_In_ int _Numerator, _In_ int _Denominator);
303_Check_return_ _ACRTIMP ldiv_t __cdecl ldiv (_In_ long _Numerator, _In_ long _Denominator);
304_Check_return_ _ACRTIMP lldiv_t __cdecl lldiv(_In_ long long _Numerator, _In_ long long _Denominator);
305
306// These functions have declspecs in their declarations in the Windows headers,
307// which cause PREfast to fire 6540.
308#pragma warning(push)
309#pragma warning(disable: 6540)
310
311unsigned int __cdecl _rotl(
312 _In_ unsigned int _Value,
313 _In_ int _Shift
314 );
315
316_Check_return_
317unsigned long __cdecl _lrotl(
318 _In_ unsigned long _Value,
319 _In_ int _Shift
320 );
321
322unsigned __int64 __cdecl _rotl64(
323 _In_ unsigned __int64 _Value,
324 _In_ int _Shift
325 );
326
327unsigned int __cdecl _rotr(
328 _In_ unsigned int _Value,
329 _In_ int _Shift
330 );
331
332_Check_return_
333unsigned long __cdecl _lrotr(
334 _In_ unsigned long _Value,
335 _In_ int _Shift
336 );
337
338unsigned __int64 __cdecl _rotr64(
339 _In_ unsigned __int64 _Value,
340 _In_ int _Shift
341 );
342
343#pragma warning(pop)
344
345
346
347// Maximum value that can be returned by the rand function:
348#define RAND_MAX 0x7fff
349
350_ACRTIMP void __cdecl srand(_In_ unsigned int _Seed);
351
352_Check_return_ _ACRTIMP int __cdecl rand(void);
353
354#if defined _CRT_RAND_S || defined _CRTBLD
355 _ACRTIMP errno_t __cdecl rand_s(_Out_ unsigned int* _RandomValue);
356#endif
357
358
359
360#ifdef __cplusplus
361extern "C++"
362{
363 inline long abs(long const _X) throw()
364 {
365 return labs(_X);
366 }
367
368 inline long long abs(long long const _X) throw()
369 {
370 return llabs(_X);
371 }
372
373 inline ldiv_t div(long const _A1, long const _A2) throw()
374 {
375 return ldiv(_A1, _A2);
376 }
377
378 inline lldiv_t div(long long const _A1, long long const _A2) throw()
379 {
380 return lldiv(_A1, _A2);
381 }
382}
383#endif // __cplusplus
384
385
386
387
388// Structs used to fool the compiler into not generating floating point
389// instructions when copying and pushing [long] double values
390#define _CRT_DOUBLE_DEC
391
392#ifndef _LDSUPPORT
393
394 #pragma pack(push, 4)
395 typedef struct
396 {
397 unsigned char ld[10];
398 } _LDOUBLE;
399 #pragma pack(pop)
400
401 #define _PTR_LD(x) ((unsigned char*)(&(x)->ld))
402
403#else // _LDSUPPORT
404
405 // push and pop long, which is #defined as __int64 by a spec2k test
406 #pragma push_macro("long")
407 #undef long
408 typedef long double _LDOUBLE;
409 #pragma pop_macro("long")
410
411 #define _PTR_LD(x) ((unsigned char *)(x))
412
413#endif // _LDSUPPORT
414
415typedef struct
416{
417 double x;
418} _CRT_DOUBLE;
419
420typedef struct
421{
422 float f;
423} _CRT_FLOAT;
424
425// push and pop long, which is #defined as __int64 by a spec2k test
426#pragma push_macro("long")
427#undef long
428
429typedef struct
430{
431 long double x;
432} _LONGDOUBLE;
433
434#pragma pop_macro("long")
435
436#pragma pack(push, 4)
437typedef struct
438{
439 unsigned char ld12[12];
440} _LDBL12;
441#pragma pack(pop)
442
443
444
445//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
446//
447// Narrow String to Number Conversions
448//
449//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
450_Check_return_ _ACRTIMP double __cdecl atof (_In_z_ char const* _String);
451_Check_return_ _CRT_JIT_INTRINSIC _ACRTIMP int __cdecl atoi (_In_z_ char const* _String);
452_Check_return_ _ACRTIMP long __cdecl atol (_In_z_ char const* _String);
453_Check_return_ _ACRTIMP long long __cdecl atoll (_In_z_ char const* _String);
454_Check_return_ _ACRTIMP __int64 __cdecl _atoi64(_In_z_ char const* _String);
455
456_Check_return_ _ACRTIMP double __cdecl _atof_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
457_Check_return_ _ACRTIMP int __cdecl _atoi_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
458_Check_return_ _ACRTIMP long __cdecl _atol_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
459_Check_return_ _ACRTIMP long long __cdecl _atoll_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
460_Check_return_ _ACRTIMP __int64 __cdecl _atoi64_l(_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
461
462_Check_return_ _ACRTIMP int __cdecl _atoflt (_Out_ _CRT_FLOAT* _Result, _In_z_ char const* _String);
463_Check_return_ _ACRTIMP int __cdecl _atodbl (_Out_ _CRT_DOUBLE* _Result, _In_z_ char* _String);
464_Check_return_ _ACRTIMP int __cdecl _atoldbl(_Out_ _LDOUBLE* _Result, _In_z_ char* _String);
465
466_Check_return_
467_ACRTIMP int __cdecl _atoflt_l(
468 _Out_ _CRT_FLOAT* _Result,
469 _In_z_ char const* _String,
470 _In_opt_ _locale_t _Locale
471 );
472
473_Check_return_
474_ACRTIMP int __cdecl _atodbl_l(
475 _Out_ _CRT_DOUBLE* _Result,
476 _In_z_ char* _String,
477 _In_opt_ _locale_t _Locale
478 );
479
480
481_Check_return_
482_ACRTIMP int __cdecl _atoldbl_l(
483 _Out_ _LDOUBLE* _Result,
484 _In_z_ char* _String,
485 _In_opt_ _locale_t _Locale
486 );
487
488_Check_return_
489_ACRTIMP float __cdecl strtof(
490 _In_z_ char const* _String,
491 _Out_opt_ _Deref_post_z_ char** _EndPtr
492 );
493
494_Check_return_
495_ACRTIMP float __cdecl _strtof_l(
496 _In_z_ char const* _String,
497 _Out_opt_ _Deref_post_z_ char** _EndPtr,
498 _In_opt_ _locale_t _Locale
499 );
500
501_Check_return_
502_ACRTIMP double __cdecl strtod(
503 _In_z_ char const* _String,
504 _Out_opt_ _Deref_post_z_ char** _EndPtr
505 );
506
507_Check_return_
508_ACRTIMP double __cdecl _strtod_l(
509 _In_z_ char const* _String,
510 _Out_opt_ _Deref_post_z_ char** _EndPtr,
511 _In_opt_ _locale_t _Locale
512 );
513
514_Check_return_
515_ACRTIMP long double __cdecl strtold(
516 _In_z_ char const* _String,
517 _Out_opt_ _Deref_post_z_ char** _EndPtr
518 );
519
520_Check_return_
521_ACRTIMP long double __cdecl _strtold_l(
522 _In_z_ char const* _String,
523 _Out_opt_ _Deref_post_z_ char** _EndPtr,
524 _In_opt_ _locale_t _Locale
525 );
526
527_Check_return_
528_ACRTIMP long __cdecl strtol(
529 _In_z_ char const* _String,
530 _Out_opt_ _Deref_post_z_ char** _EndPtr,
531 _In_ int _Radix
532 );
533
534_Check_return_
535_ACRTIMP long __cdecl _strtol_l(
536 _In_z_ char const* _String,
537 _Out_opt_ _Deref_post_z_ char** _EndPtr,
538 _In_ int _Radix,
539 _In_opt_ _locale_t _Locale
540 );
541
542_Check_return_
543_ACRTIMP long long __cdecl strtoll(
544 _In_z_ char const* _String,
545 _Out_opt_ _Deref_post_z_ char** _EndPtr,
546 _In_ int _Radix
547 );
548
549_Check_return_
550_ACRTIMP long long __cdecl _strtoll_l(
551 _In_z_ char const* _String,
552 _Out_opt_ _Deref_post_z_ char** _EndPtr,
553 _In_ int _Radix,
554 _In_opt_ _locale_t _Locale
555 );
556
557_Check_return_
558_ACRTIMP unsigned long __cdecl strtoul(
559 _In_z_ char const* _String,
560 _Out_opt_ _Deref_post_z_ char** _EndPtr,
561 _In_ int _Radix
562 );
563
564_Check_return_
565_ACRTIMP unsigned long __cdecl _strtoul_l(
566 _In_z_ char const* _String,
567 _Out_opt_ _Deref_post_z_ char** _EndPtr,
568 _In_ int _Radix,
569 _In_opt_ _locale_t _Locale
570 );
571
572_Check_return_
573_ACRTIMP unsigned long long __cdecl strtoull(
574 _In_z_ char const* _String,
575 _Out_opt_ _Deref_post_z_ char** _EndPtr,
576 _In_ int _Radix
577 );
578
579_Check_return_
580_ACRTIMP unsigned long long __cdecl _strtoull_l(
581 _In_z_ char const* _String,
582 _Out_opt_ _Deref_post_z_ char** _EndPtr,
583 _In_ int _Radix,
584 _In_opt_ _locale_t _Locale
585 );
586
587_Check_return_
588_ACRTIMP __int64 __cdecl _strtoi64(
589 _In_z_ char const* _String,
590 _Out_opt_ _Deref_post_z_ char** _EndPtr,
591 _In_ int _Radix
592 );
593
594_Check_return_
595_ACRTIMP __int64 __cdecl _strtoi64_l(
596 _In_z_ char const* _String,
597 _Out_opt_ _Deref_post_z_ char** _EndPtr,
598 _In_ int _Radix,
599 _In_opt_ _locale_t _Locale
600 );
601
602_Check_return_
603_ACRTIMP unsigned __int64 __cdecl _strtoui64(
604 _In_z_ char const* _String,
605 _Out_opt_ _Deref_post_z_ char** _EndPtr,
606 _In_ int _Radix
607 );
608
609_Check_return_
610_ACRTIMP unsigned __int64 __cdecl _strtoui64_l(
611 _In_z_ char const* _String,
612 _Out_opt_ _Deref_post_z_ char** _EndPtr,
613 _In_ int _Radix,
614 _In_opt_ _locale_t _Locale
615 );
616
617
618
619//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
620//
621// Number to Narrow String Conversions
622//
623//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
624_Success_(return == 0)
625_Check_return_opt_
626_ACRTIMP errno_t __cdecl _itoa_s(
627 _In_ int _Value,
628 _Out_writes_z_(_BufferCount) char* _Buffer,
629 _In_ size_t _BufferCount,
630 _In_ int _Radix
631 );
632
633__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
634 _Success_(return == 0)
635 errno_t, _itoa_s,
636 _In_ int, _Value,
637 char, _Buffer,
638 _In_ int, _Radix
639 )
640
641__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
642 char*, __RETURN_POLICY_DST, _ACRTIMP, _itoa,
643 _In_ int, _Value,
644 _Pre_notnull_ _Post_z_, char, _Buffer,
645 _In_ int, _Radix
646 )
647
648_Success_(return == 0)
649_Check_return_opt_
650_ACRTIMP errno_t __cdecl _ltoa_s(
651 _In_ long _Value,
652 _Out_writes_z_(_BufferCount) char* _Buffer,
653 _In_ size_t _BufferCount,
654 _In_ int _Radix
655 );
656
657__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
658 errno_t, _ltoa_s,
659 _In_ long, _Value,
660 char, _Buffer,
661 _In_ int, _Radix
662 )
663
664__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
665 char*, __RETURN_POLICY_DST, _ACRTIMP, _ltoa,
666 _In_ long, _Value,
667 _Pre_notnull_ _Post_z_, char, _Buffer,
668 _In_ int, _Radix
669 )
670
671_Success_(return == 0)
672_Check_return_opt_
673_ACRTIMP errno_t __cdecl _ultoa_s(
674 _In_ unsigned long _Value,
675 _Out_writes_z_(_BufferCount) char* _Buffer,
676 _In_ size_t _BufferCount,
677 _In_ int _Radix
678 );
679
680__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
681 errno_t, _ultoa_s,
682 _In_ unsigned long, _Value,
683 char, _Buffer,
684 _In_ int, _Radix
685 )
686
687__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
688 char*, __RETURN_POLICY_DST, _ACRTIMP, _ultoa,
689 _In_ unsigned long, _Value,
690 _Pre_notnull_ _Post_z_, char, _Buffer,
691 _In_ int, _Radix
692 )
693
694_Success_(return == 0)
695_Check_return_opt_
696_ACRTIMP errno_t __cdecl _i64toa_s(
697 _In_ __int64 _Value,
698 _Out_writes_z_(_BufferCount) char* _Buffer,
699 _In_ size_t _BufferCount,
700 _In_ int _Radix
701 );
702
703_Success_(return == 0)
704_CRT_INSECURE_DEPRECATE(_i64toa_s)
705_ACRTIMP char* __cdecl _i64toa(
706 _In_ __int64 _Value,
707 _Pre_notnull_ _Post_z_ char* _Buffer,
708 _In_ int _Radix
709 );
710
711_Success_(return == 0)
712_Check_return_opt_
713_ACRTIMP errno_t __cdecl _ui64toa_s(
714 _In_ unsigned __int64 _Value,
715 _Out_writes_z_(_BufferCount) char* _Buffer,
716 _In_ size_t _BufferCount,
717 _In_ int _Radix
718 );
719
720_CRT_INSECURE_DEPRECATE(_ui64toa_s)
721_ACRTIMP char* __cdecl _ui64toa(
722 _In_ unsigned __int64 _Value,
723 _Pre_notnull_ _Post_z_ char* _Buffer,
724 _In_ int _Radix
725 );
726
727
728
729// _CVTBUFSIZE is the maximum size for the per-thread conversion buffer. It
730// should be at least as long as the number of digits in the largest double
731// precision value (?.?e308 in IEEE arithmetic). We will use the same size
732// buffer as is used in the printf support routines.
733//
734// (This value actually allows 40 additional decimal places; even though there
735// are only 16 digits of accuracy in a double precision IEEE number, the user may
736// ask for more to effect zero padding.)
737#define _CVTBUFSIZE (309 + 40) // # of digits in max. dp value + slop
738
739_Success_(return == 0)
740_Check_return_wat_
741_ACRTIMP errno_t __cdecl _ecvt_s(
742 _Out_writes_z_(_BufferCount) char* _Buffer,
743 _In_ size_t _BufferCount,
744 _In_ double _Value,
745 _In_ int _DigitCount,
746 _Out_ int* _PtDec,
747 _Out_ int* _PtSign
748 );
749
750__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(
751 errno_t, _ecvt_s,
752 char, _Buffer,
753 _In_ double, _Value,
754 _In_ int, _DigitCount,
755 _Out_ int*, _PtDec,
756 _Out_ int*, _PtSign
757 )
758
759_Check_return_ _CRT_INSECURE_DEPRECATE(_ecvt_s)
760_ACRTIMP char* __cdecl _ecvt(
761 _In_ double _Value,
762 _In_ int _DigitCount,
763 _Out_ int* _PtDec,
764 _Out_ int* _PtSign
765 );
766
767_Success_(return == 0)
768_Check_return_wat_
769_ACRTIMP errno_t __cdecl _fcvt_s(
770 _Out_writes_z_(_BufferCount) char* _Buffer,
771 _In_ size_t _BufferCount,
772 _In_ double _Value,
773 _In_ int _FractionalDigitCount,
774 _Out_ int* _PtDec,
775 _Out_ int* _PtSign
776 );
777
778__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(
779 _Success_(return == 0)
780 errno_t, _fcvt_s,
781 char, _Buffer,
782 _In_ double, _Value,
783 _In_ int, _FractionalDigitCount,
784 _Out_ int*, _PtDec,
785 _Out_ int*, _PtSign
786 )
787
788_Success_(return == 0)
789_Check_return_ _CRT_INSECURE_DEPRECATE(_fcvt_s)
790_ACRTIMP char* __cdecl _fcvt(
791 _In_ double _Value,
792 _In_ int _FractionalDigitCount,
793 _Out_ int* _PtDec,
794 _Out_ int* _PtSign
795 );
796
797_Success_(return == 0)
798_ACRTIMP errno_t __cdecl _gcvt_s(
799 _Out_writes_z_(_BufferCount) char* _Buffer,
800 _In_ size_t _BufferCount,
801 _In_ double _Value,
802 _In_ int _DigitCount
803 );
804
805__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(
806 _Success_(return == 0)
807 errno_t, _gcvt_s,
808 char, _Buffer,
809 _In_ double, _Value,
810 _In_ int, _DigitCount
811 )
812
813_CRT_INSECURE_DEPRECATE(_gcvt_s)
814_ACRTIMP char* __cdecl _gcvt(
815 _In_ double _Value,
816 _In_ int _DigitCount,
817 _Pre_notnull_ _Post_z_ char* _Buffer
818 );
819
820
821
822//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
823//
824// Multibyte String Operations and Conversions
825//
826//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
827// Maximum number of bytes in multi-byte character in the current locale
828// (also defined in ctype.h).
829#ifndef MB_CUR_MAX
830 #if defined _CRT_DISABLE_PERFCRIT_LOCKS && !defined _DLL
831 #define MB_CUR_MAX __mb_cur_max
832 #else
833 #define MB_CUR_MAX ___mb_cur_max_func()
834 #endif
835
836 #ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
837 extern int __mb_cur_max;
838 #else
839 #define __mb_cur_max (___mb_cur_max_func())
840 #endif
841
842 _Post_satisfies_(return > 0 && return < MB_LEN_MAX)
843 _ACRTIMP int __cdecl ___mb_cur_max_func(void);
844
845 _Post_satisfies_(return > 0 && return < MB_LEN_MAX)
846 _ACRTIMP int __cdecl ___mb_cur_max_l_func(_locale_t _Locale);
847#endif
848
849
850
851_Check_return_
852_ACRTIMP int __cdecl mblen(
853 _In_reads_bytes_opt_(_MaxCount) _Pre_opt_z_ char const* _Ch,
854 _In_ size_t _MaxCount
855 );
856
857_Check_return_
858_ACRTIMP int __cdecl _mblen_l(
859 _In_reads_bytes_opt_(_MaxCount) _Pre_opt_z_ char const* _Ch,
860 _In_ size_t _MaxCount,
861 _In_opt_ _locale_t _Locale
862 );
863
864_Check_return_
865_Post_satisfies_(return <= _String_length_(_String))
866_ACRTIMP size_t __cdecl _mbstrlen(
867 _In_z_ char const* _String
868 );
869
870_Check_return_
871_Post_satisfies_(return <= _String_length_(_String) || return == (size_t)-1)
872_ACRTIMP size_t __cdecl _mbstrlen_l(
873 _In_z_ char const* _String,
874 _In_opt_ _locale_t _Locale
875 );
876
877_Check_return_
878_Post_satisfies_((return <= _String_length_(_String) && return <= _MaxCount) || return == (size_t)-1)
879_ACRTIMP size_t __cdecl _mbstrnlen(
880 _In_z_ char const* _String,
881 _In_ size_t _MaxCount
882 );
883
884_Post_satisfies_((return <= _String_length_(_String) && return <= _MaxCount) || return == (size_t)-1)
885_Check_return_
886_ACRTIMP size_t __cdecl _mbstrnlen_l(
887 _In_z_ char const* _String,
888 _In_ size_t _MaxCount,
889 _In_opt_ _locale_t _Locale
890 );
891
892_Success_(return != -1)
893_ACRTIMP int __cdecl mbtowc(
894 _Pre_notnull_ _Post_z_ wchar_t* _DstCh,
895 _In_reads_or_z_opt_(_SrcSizeInBytes) char const* _SrcCh,
896 _In_ size_t _SrcSizeInBytes
897 );
898
899_Success_(return != -1)
900_ACRTIMP int __cdecl _mbtowc_l(
901 _Pre_notnull_ _Post_z_ wchar_t* _DstCh,
902 _In_reads_or_z_opt_(_SrcSizeInBytes) char const* _SrcCh,
903 _In_ size_t _SrcSizeInBytes,
904 _In_opt_ _locale_t _Locale
905 );
906
907_Check_return_opt_
908_ACRTIMP errno_t __cdecl mbstowcs_s(
909 _Out_opt_ size_t* _PtNumOfCharConverted,
910 _Out_writes_to_opt_(_SizeInWords, *_PtNumOfCharConverted) wchar_t* _DstBuf,
911 _In_ size_t _SizeInWords,
912 _In_reads_or_z_(_MaxCount) char const* _SrcBuf,
913 _In_ size_t _MaxCount
914 );
915
916__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(
917 errno_t, mbstowcs_s,
918 _Out_opt_ size_t*, _PtNumOfCharConverted,
919 _Post_z_ wchar_t, _Dest,
920 _In_z_ char const*, _Source,
921 _In_ size_t, _MaxCount
922 )
923
924__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
925 _ACRTIMP, mbstowcs,
926 _Out_writes_opt_z_(_MaxCount), wchar_t, _Dest,
927 _In_z_ char const*, _Source,
928 _In_ size_t, _MaxCount
929 )
930
931_Check_return_opt_
932_ACRTIMP errno_t __cdecl _mbstowcs_s_l(
933 _Out_opt_ size_t* _PtNumOfCharConverted,
934 _Out_writes_to_opt_(_SizeInWords, *_PtNumOfCharConverted) wchar_t* _DstBuf,
935 _In_ size_t _SizeInWords,
936 _In_reads_or_z_(_MaxCount) char const* _SrcBuf,
937 _In_ size_t _MaxCount,
938 _In_opt_ _locale_t _Locale
939 );
940
941__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(
942 errno_t, _mbstowcs_s_l,
943 _Out_opt_ size_t*, _PtNumOfCharConverted,
944 _Post_z_ wchar_t, _Dest,
945 _In_z_ char const*, _Source,
946 _In_ size_t, _MaxCount,
947 _In_opt_ _locale_t, _Locale
948 )
949
950__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(
951 _ACRTIMP, _mbstowcs_l, _mbstowcs_s_l,
952 _Out_writes_opt_z_(_Size) wchar_t,
953 _Out_writes_z_(_MaxCount), wchar_t, _Dest,
954 _In_z_ char const*, _Source,
955 _In_ size_t, _MaxCount,
956 _In_opt_ _locale_t, _Locale
957 )
958
959
960
961
962_CRT_INSECURE_DEPRECATE(wctomb_s)
963_ACRTIMP int __cdecl wctomb(
964 _Out_writes_opt_z_(MB_LEN_MAX) char* _MbCh,
965 _In_ wchar_t _WCh
966 );
967
968_CRT_INSECURE_DEPRECATE(_wctomb_s_l)
969_ACRTIMP int __cdecl _wctomb_l(
970 _Pre_maybenull_ _Post_z_ char* _MbCh,
971 _In_ wchar_t _WCh,
972 _In_opt_ _locale_t _Locale
973 );
974
975#if __STDC_WANT_SECURE_LIB__
976
977 _Check_return_wat_
978 _ACRTIMP errno_t __cdecl wctomb_s(
979 _Out_opt_ int* _SizeConverted,
980 _Out_writes_bytes_to_opt_(_SizeInBytes, *_SizeConverted) char* _MbCh,
981 _In_ rsize_t _SizeInBytes,
982 _In_ wchar_t _WCh
983 );
984
985#endif // __STDC_WANT_SECURE_LIB__
986
987_Check_return_wat_
988_ACRTIMP errno_t __cdecl _wctomb_s_l(
989 _Out_opt_ int* _SizeConverted,
990 _Out_writes_opt_z_(_SizeInBytes) char* _MbCh,
991 _In_ size_t _SizeInBytes,
992 _In_ wchar_t _WCh,
993 _In_opt_ _locale_t _Locale);
994
995_Check_return_wat_
996_ACRTIMP errno_t __cdecl wcstombs_s(
997 _Out_opt_ size_t* _PtNumOfCharConverted,
998 _Out_writes_bytes_to_opt_(_DstSizeInBytes, *_PtNumOfCharConverted) char* _Dst,
999 _In_ size_t _DstSizeInBytes,
1000 _In_z_ wchar_t const* _Src,
1001 _In_ size_t _MaxCountInBytes
1002 );
1003
1004__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(
1005 errno_t, wcstombs_s,
1006 _Out_opt_ size_t*, _PtNumOfCharConverted,
1007 _Out_writes_bytes_opt_(_Size) char, _Dest,
1008 _In_z_ wchar_t const*, _Source,
1009 _In_ size_t, _MaxCount
1010 )
1011
1012__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
1013 _ACRTIMP, wcstombs,
1014 _Out_writes_opt_(_MaxCount), char, _Dest,
1015 _In_z_ wchar_t const*, _Source,
1016 _In_ size_t, _MaxCount
1017 )
1018
1019_Check_return_wat_
1020_ACRTIMP errno_t __cdecl _wcstombs_s_l(
1021 _Out_opt_ size_t* _PtNumOfCharConverted,
1022 _Out_writes_bytes_to_opt_(_DstSizeInBytes, *_PtNumOfCharConverted) char* _Dst,
1023 _In_ size_t _DstSizeInBytes,
1024 _In_z_ wchar_t const* _Src,
1025 _In_ size_t _MaxCountInBytes,
1026 _In_opt_ _locale_t _Locale
1027 );
1028
1029__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(
1030 errno_t, _wcstombs_s_l,
1031 _Out_opt_ size_t*, _PtNumOfCharConverted,
1032 _Out_writes_opt_(_Size) char, _Dest,
1033 _In_z_ wchar_t const*, _Source,
1034 _In_ size_t, _MaxCount,
1035 _In_opt_ _locale_t, _Locale
1036 )
1037
1038__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(
1039 _ACRTIMP, _wcstombs_l, _wcstombs_s_l,
1040 _Out_writes_opt_z_(_Size) char,
1041 _Out_writes_(_MaxCount), char, _Dest,
1042 _In_z_ wchar_t const*, _Source,
1043 _In_ size_t, _MaxCount,
1044 _In_opt_ _locale_t, _Locale
1045 )
1046
1047
1048
1049//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1050//
1051// Path Manipulation
1052//
1053//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1054// Sizes for buffers used by the _makepath() and _splitpath() functions.
1055// note that the sizes include space for 0-terminator
1056#define _MAX_PATH 260 // max. length of full pathname
1057#define _MAX_DRIVE 3 // max. length of drive component
1058#define _MAX_DIR 256 // max. length of path component
1059#define _MAX_FNAME 256 // max. length of file name component
1060#define _MAX_EXT 256 // max. length of extension component
1061
1062
1063#pragma push_macro("_fullpath")
1064#undef _fullpath
1065
1066_Success_(return != 0)
1067_Check_return_
1068_ACRTIMP _CRTALLOCATOR char* __cdecl _fullpath(
1069 _Out_writes_opt_z_(_BufferCount) char* _Buffer,
1070 _In_z_ char const* _Path,
1071 _In_ size_t _BufferCount
1072 );
1073
1074#pragma pop_macro("_fullpath")
1075
1076_Check_return_wat_
1077_ACRTIMP errno_t __cdecl _makepath_s(
1078 _Out_writes_z_(_BufferCount) char* _Buffer,
1079 _In_ size_t _BufferCount,
1080 _In_opt_z_ char const* _Drive,
1081 _In_opt_z_ char const* _Dir,
1082 _In_opt_z_ char const* _Filename,
1083 _In_opt_z_ char const* _Ext
1084 );
1085
1086__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(
1087 errno_t, _makepath_s,
1088 char, _Buffer,
1089 _In_opt_z_ char const*, _Drive,
1090 _In_opt_z_ char const*, _Dir,
1091 _In_opt_z_ char const*, _Filename,
1092 _In_opt_z_ char const*, _Ext
1093 )
1094
1095__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4(
1096 void, __RETURN_POLICY_VOID, _ACRTIMP, _makepath,
1097 _Pre_notnull_ _Post_z_, char, _Buffer,
1098 _In_opt_z_ char const*, _Drive,
1099 _In_opt_z_ char const*, _Dir,
1100 _In_opt_z_ char const*, _Filename,
1101 _In_opt_z_ char const*, _Ext
1102 )
1103
1104_CRT_INSECURE_DEPRECATE(_splitpath_s)
1105_ACRTIMP void __cdecl _splitpath(
1106 _In_z_ char const* _FullPath,
1107 _Pre_maybenull_ _Post_z_ char* _Drive,
1108 _Pre_maybenull_ _Post_z_ char* _Dir,
1109 _Pre_maybenull_ _Post_z_ char* _Filename,
1110 _Pre_maybenull_ _Post_z_ char* _Ext
1111 );
1112
1113_Check_return_wat_
1114_ACRTIMP errno_t __cdecl _splitpath_s(
1115 _In_z_ char const* _FullPath,
1116 _Out_writes_opt_z_(_DriveCount) char* _Drive,
1117 _In_ size_t _DriveCount,
1118 _Out_writes_opt_z_(_DirCount) char* _Dir,
1119 _In_ size_t _DirCount,
1120 _Out_writes_opt_z_(_FilenameCount) char* _Filename,
1121 _In_ size_t _FilenameCount,
1122 _Out_writes_opt_z_(_ExtCount) char* _Ext,
1123 _In_ size_t _ExtCount
1124 );
1125
1126__DEFINE_CPP_OVERLOAD_SECURE_FUNC_SPLITPATH(errno_t, _splitpath_s, char, _Dest)
1127
1128#if __STDC_WANT_SECURE_LIB__
1129
1130_Check_return_opt_
1131_Success_(return == 0)
1132_DCRTIMP errno_t __cdecl getenv_s(
1133 _Out_ size_t* _RequiredCount,
1134 _Out_writes_opt_z_(_BufferCount) char* _Buffer,
1135 _In_ rsize_t _BufferCount,
1136 _In_z_ char const* _VarName
1137 );
1138
1139#endif // __STDC_WANT_SECURE_LIB__
1140
1141
1142
1143
1144_ACRTIMP int* __cdecl __p___argc (void);
1145_ACRTIMP char*** __cdecl __p___argv (void);
1146_ACRTIMP wchar_t*** __cdecl __p___wargv(void);
1147
1148#ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
1149 extern int __argc;
1150 extern char** __argv;
1151 extern wchar_t** __wargv;
1152#else
1153 #define __argc (*__p___argc()) // Pointer to number of command line arguments
1154 #define __argv (*__p___argv()) // Pointer to table of narrow command line arguments
1155 #define __wargv (*__p___wargv()) // Pointer to table of wide command line arguments
1156#endif
1157
1158_DCRTIMP char*** __cdecl __p__environ (void);
1159_DCRTIMP wchar_t*** __cdecl __p__wenviron(void);
1160
1161#ifndef _CRT_BEST_PRACTICES_USAGE
1162 #define _CRT_V12_LEGACY_FUNCTIONALITY
1163#endif
1164
1165#ifndef _CRT_V12_LEGACY_FUNCTIONALITY
1166 // Deprecated symbol: Do not expose environment global pointers unless
1167 // legacy access is specifically requested
1168 #define _environ crt_usage_error__do_not_reference_global_pointer_directly__environ
1169 #define _wenviron crt_usage_error__do_not_reference_global_pointer_directly__wenviron
1170#else
1171 #define _environ (*__p__environ()) // Pointer to narrow environment table
1172 #define _wenviron (*__p__wenviron()) // Pointer to wide environment table
1173#endif
1174
1175
1176
1177// Sizes for buffers used by the getenv/putenv family of functions.
1178#define _MAX_ENV 32767
1179
1180
1181#if _CRT_FUNCTIONS_REQUIRED
1182
1183 _Check_return_ _CRT_INSECURE_DEPRECATE(_dupenv_s)
1184 _DCRTIMP char* __cdecl getenv(
1185 _In_z_ char const* _VarName
1186 );
1187
1188 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
1189 errno_t, getenv_s,
1190 _Out_ size_t*, _RequiredCount,
1191 char, _Buffer,
1192 _In_z_ char const*, _VarName
1193 )
1194
1195 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
1196 #pragma push_macro("_dupenv_s")
1197 #undef _dupenv_s
1198 #endif
1199
1200 _Check_return_opt_
1201 _DCRTIMP errno_t __cdecl _dupenv_s(
1202 _Outptr_result_buffer_maybenull_(*_BufferCount) _Outptr_result_maybenull_z_ char** _Buffer,
1203 _Out_opt_ size_t* _BufferCount,
1204 _In_z_ char const* _VarName
1205 );
1206
1207 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
1208 #pragma pop_macro("_dupenv_s")
1209 #endif
1210
1211 _DCRTIMP int __cdecl system(
1212 _In_opt_z_ char const* _Command
1213 );
1214
1215 // The functions below have declspecs in their declarations in the Windows
1216 // headers, causing PREfast to fire 6540 here
1217 #pragma warning(push)
1218 #pragma warning(disable: 6540)
1219
1220 _Check_return_
1221 _DCRTIMP int __cdecl _putenv(
1222 _In_z_ char const* _EnvString
1223 );
1224
1225 _Check_return_wat_
1226 _DCRTIMP errno_t __cdecl _putenv_s(
1227 _In_z_ char const* _Name,
1228 _In_z_ char const* _Value
1229 );
1230
1231 #pragma warning(pop)
1232
1233 _DCRTIMP errno_t __cdecl _searchenv_s(
1234 _In_z_ char const* _Filename,
1235 _In_z_ char const* _VarName,
1236 _Out_writes_z_(_BufferCount) char* _Buffer,
1237 _In_ size_t _BufferCount
1238 );
1239
1240 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_2_0(
1241 errno_t, _searchenv_s,
1242 _In_z_ char const*, _Filename,
1243 _In_z_ char const*, _VarName,
1244 char, _Buffer
1245 )
1246
1247 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0(
1248 void, __RETURN_POLICY_VOID, _DCRTIMP, _searchenv,
1249 _In_z_ char const*, _Filename,
1250 _In_z_ char const*, _VarName,
1251 _Pre_notnull_ _Post_z_, char, _Buffer
1252 )
1253
1254 // The Win32 API SetErrorMode, Beep and Sleep should be used instead.
1255 _CRT_OBSOLETE(SetErrorMode)
1256 _DCRTIMP void __cdecl _seterrormode(
1257 _In_ int _Mode
1258 );
1259
1260 _CRT_OBSOLETE(Beep)
1261 _DCRTIMP void __cdecl _beep(
1262 _In_ unsigned _Frequency,
1263 _In_ unsigned _Duration
1264 );
1265
1266 _CRT_OBSOLETE(Sleep)
1267 _DCRTIMP void __cdecl _sleep(
1268 _In_ unsigned long _Duration
1269 );
1270
1271#endif // _CRT_FUNCTIONS_REQUIRED
1272
1273
1274//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1275//
1276// Non-ANSI Names for Compatibility
1277//
1278//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1279#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
1280
1281 #ifndef __cplusplus
1282 #define max(a,b) (((a) > (b)) ? (a) : (b))
1283 #define min(a,b) (((a) < (b)) ? (a) : (b))
1284 #endif
1285
1286 #define sys_errlist _sys_errlist
1287 #define sys_nerr _sys_nerr
1288
1289 #pragma warning(push)
1290 #pragma warning(disable: 4141) // Using deprecated twice
1291
1292 _Check_return_ _CRT_NONSTDC_DEPRECATE(_ecvt) _CRT_INSECURE_DEPRECATE(_ecvt_s)
1293 _ACRTIMP char* __cdecl ecvt(
1294 _In_ double _Value,
1295 _In_ int _DigitCount,
1296 _Out_ int* _PtDec,
1297 _Out_ int* _PtSign
1298 );
1299
1300 _Check_return_ _CRT_NONSTDC_DEPRECATE(_fcvt) _CRT_INSECURE_DEPRECATE(_fcvt_s)
1301 _ACRTIMP char* __cdecl fcvt(
1302 _In_ double _Value,
1303 _In_ int _FractionalDigitCount,
1304 _Out_ int* _PtDec,
1305 _Out_ int* _PtSign
1306 );
1307
1308 _CRT_NONSTDC_DEPRECATE(_gcvt) _CRT_INSECURE_DEPRECATE(_fcvt_s)
1309 _ACRTIMP char* __cdecl gcvt(
1310 _In_ double _Value,
1311 _In_ int _DigitCount,
1312 _Pre_notnull_ _Post_z_ char* _DstBuf
1313 );
1314
1315 _CRT_NONSTDC_DEPRECATE(_itoa) _CRT_INSECURE_DEPRECATE(_itoa_s)
1316 _ACRTIMP char* __cdecl itoa(
1317 _In_ int _Value,
1318 _Pre_notnull_ _Post_z_ char* _Buffer,
1319 _In_ int _Radix
1320 );
1321
1322 _CRT_NONSTDC_DEPRECATE(_ltoa) _CRT_INSECURE_DEPRECATE(_ltoa_s)
1323 _ACRTIMP char* __cdecl ltoa(
1324 _In_ long _Value,
1325 _Pre_notnull_ _Post_z_ char* _Buffer,
1326 _In_ int _Radix
1327 );
1328
1329
1330 _CRT_NONSTDC_DEPRECATE(_swab)
1331 _ACRTIMP void __cdecl swab(
1332 _Inout_updates_z_(_SizeInBytes) char* _Buf1,
1333 _Inout_updates_z_(_SizeInBytes) char* _Buf2,
1334 _In_ int _SizeInBytes
1335 );
1336
1337 _CRT_NONSTDC_DEPRECATE(_ultoa) _CRT_INSECURE_DEPRECATE(_ultoa_s)
1338 _ACRTIMP char* __cdecl ultoa(
1339 _In_ unsigned long _Value,
1340 _Pre_notnull_ _Post_z_ char* _Buffer,
1341 _In_ int _Radix
1342 );
1343
1344 #define environ _environ
1345
1346 _Check_return_ _CRT_NONSTDC_DEPRECATE(_putenv)
1347 _DCRTIMP int __cdecl putenv(
1348 _In_z_ char const* _EnvString
1349 );
1350
1351 #pragma warning(pop)
1352
1353 onexit_t __cdecl onexit(_In_opt_ onexit_t _Func);
1354
1355#endif // _CRT_INTERNAL_NONSTDC_NAMES
1356
1357
1358
1359_CRT_END_C_HEADER
1360_UCRT_RESTORE_CLANG_WARNINGS
1361#pragma warning(pop) // _UCRT_DISABLED_WARNINGS
1362#endif // _INC_STDLIB