Advertisement
Guest User

Untitled

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