#include <corecrt_internal_traits.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
template<typename Character > |
static Character *__cdecl | common_getenv_nolock (Character const *const name) throw () |
|
template<typename Character > |
static Character *__cdecl | common_getenv (Character const *const name) throw () |
|
char *__cdecl | getenv (char const *const name) |
|
wchar_t *__cdecl | _wgetenv (wchar_t const *const name) |
|
template<typename Character > |
| _Success_ (return==0) static errno_t __cdecl common_getenv_s_nolock(size_t *const required_count |
|
| _Out_writes_z_ (buffer_count) Character *const buffer |
|
size_t const Character const *const name | throw () |
|
errno_t __cdecl | getenv_s (size_t *const required_count, char *const buffer, size_t const buffer_count, char const *const name) |
|
errno_t __cdecl | _wgetenv_s (size_t *const required_count, wchar_t *const buffer, size_t const buffer_count, wchar_t const *const name) |
|
template<typename Character > |
static errno_t __cdecl | common_dupenv_s_nolock (_Outptr_result_buffer_maybenull_(*buffer_count) _Outptr_result_maybenull_z_ Character **const buffer_pointer, _Out_opt_ size_t *const buffer_count, Character const *const name, int const block_use, char const *const file_name, int const line_number) throw () |
|
template<typename Character > |
| _Success_ (return !=0) static errno_t __cdecl common_dupenv_s(_Outptr_result_buffer_maybenull_(*buffer_count) _Outptr_result_maybenull_z_ Character **const buffer_pointer |
|
errno_t __cdecl | _dupenv_s (char **const buffer_pointer, size_t *const buffer_count, char const *const name) |
|
errno_t __cdecl | _wdupenv_s (wchar_t **const buffer_pointer, size_t *const buffer_count, wchar_t const *const name) |
|
◆ _dupenv_s()
Definition at line 285 of file getenv.cpp.
290{
292}
size_t const buffer_count
◆ _Out_writes_z_()
◆ _Success_() [1/2]
_Success_ |
( |
return ! |
= 0 | ) |
const |
◆ _Success_() [2/2]
_Success_ |
( |
return |
= = 0 | ) |
const |
Definition at line 57 of file chdir.cpp.
59{
61
63
64 if (!traits::set_current_directory(
path))
65 {
67 return -1;
68 }
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 Character buffer_initial_storage[
MAX_PATH + 1];
88
89 errno_t const err = traits::get_current_directory(current_directory_buffer);
90
92
93 return -1;
94 }
95
96 return set_cwd_environment_variable(current_directory_buffer.data());
97}
void __cdecl __acrt_errno_map_os_error(unsigned long)
#define _VALIDATE_CLEAR_OSSERR_RETURN(expr, errorcode, retexpr)
DWORD WINAPI GetLastError(void)
◆ _wdupenv_s()
◆ _wgetenv()
Definition at line 89 of file getenv.cpp.
90{
92}
static Character *__cdecl common_getenv(Character const *const name)
◆ _wgetenv_s()
◆ common_dupenv_s_nolock()
Definition at line 207 of file getenv.cpp.
215{
216
220
222
224 *buffer_pointer = nullptr;
225
228
230
232 if (
value ==
nullptr)
233 return 0;
234
235 size_t const value_count = traits::tcslen(
value) + 1;
236
237 *buffer_pointer =
static_cast<Character*
>(
_calloc_dbg(
238 value_count,
239 sizeof(Character),
244
248
249 return 0;
250}
#define _calloc_dbg(c, s, t, f, l)
int const char const *const int const line_number
_Out_opt_ size_t *const Character const *const int const char const *const file_name
_Out_opt_ size_t *const Character const *const int const block_use
static Character *__cdecl common_getenv_nolock(Character const *const name)
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
#define _VALIDATE_RETURN_ERRCODE_NOEXC(expr, errorcode)
#define UNREFERENCED_PARAMETER(P)
◆ common_getenv()
Definition at line 61 of file getenv.cpp.
62{
64
67
69
72 {
74 }
76 {
78 }
80
82}
void __cdecl __acrt_unlock(_In_ __acrt_lock_id lock)
@ __acrt_environment_lock
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
__acrt_lock(__acrt_heap_lock)
Referenced by _wgetenv(), and getenv().
◆ common_getenv_nolock()
static Character *__cdecl common_getenv_nolock |
( |
Character const *const |
name | ) |
|
throw | ( | |
| ) | | |
|
static |
Definition at line 26 of file getenv.cpp.
27{
29
30 Character** const environment = traits::get_or_create_environment_nolock();
31 if (environment ==
nullptr ||
name ==
nullptr)
32 return nullptr;
33
34 size_t const name_length = traits::tcslen(
name);
35
37 {
38 if (traits::tcslen(*
current) <= name_length)
39 continue;
40
41 if (*(*
current + name_length) !=
'=')
42 continue;
43
44 if (traits::tcsnicoll(*
current,
name, name_length) != 0)
45 continue;
46
47
48
49
51
52 return *
current + name_length + 1;
53 }
54
55 return nullptr;
56}
struct task_struct * current
Referenced by common_dupenv_s_nolock(), common_getenv(), and throw().
◆ getenv()
◆ getenv_s()
◆ throw()
Definition at line 113 of file getenv.cpp.
114{
116
118 *required_count = 0;
119
123
126
129 return 0;
130
131 *required_count = traits::tcslen(
value) + 1;
133 return 0;
134
135
136
139
141 return 0;
142}
◆ block_use
◆ buffer_count
◆ file_name
◆ name