mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
msvcrt: Implemented _(w)dupenv_s.
This commit is contained in:
parent
356b2d2bc0
commit
fc186c3bda
@ -581,7 +581,7 @@
|
||||
@ extern _dstbias msvcrt._dstbias
|
||||
@ cdecl _dup(long) msvcrt._dup
|
||||
@ cdecl _dup2(long long) msvcrt._dup2
|
||||
@ stub _dupenv_s
|
||||
@ cdecl _dupenv_s(ptr ptr str) msvcrt._dupenv_s
|
||||
@ cdecl _ecvt(double long ptr ptr) msvcrt._ecvt
|
||||
@ stub _ecvt_s
|
||||
@ cdecl _encoded_null() msvcr90._encoded_null
|
||||
@ -1327,7 +1327,7 @@
|
||||
@ stub _wctomb_l
|
||||
@ stub _wctomb_s_l
|
||||
@ stub _wctype
|
||||
@ stub _wdupenv_s
|
||||
@ cdecl _wdupenv_s(ptr ptr wstr) msvcrt._wdupenv_s
|
||||
@ extern _wenviron msvcrt._wenviron
|
||||
@ varargs _wexecl(wstr wstr) msvcrt._wexecl
|
||||
@ varargs _wexecle(wstr wstr) msvcrt._wexecle
|
||||
|
@ -421,7 +421,7 @@
|
||||
@ extern _dstbias msvcrt._dstbias
|
||||
@ cdecl _dup(long) msvcrt._dup
|
||||
@ cdecl _dup2(long long) msvcrt._dup2
|
||||
@ stub _dupenv_s
|
||||
@ cdecl _dupenv_s(ptr ptr str) msvcrt._dupenv_s
|
||||
@ cdecl _ecvt(double long ptr ptr) msvcrt._ecvt
|
||||
@ stub _ecvt_s
|
||||
@ cdecl _encode_pointer(ptr) msvcr90._encode_pointer
|
||||
@ -1180,7 +1180,7 @@
|
||||
@ stub _wctomb_l
|
||||
@ stub _wctomb_s_l
|
||||
@ stub _wctype
|
||||
@ stub _wdupenv_s
|
||||
@ cdecl _wdupenv_s(ptr ptr wstr) msvcrt._wdupenv_s
|
||||
@ extern _wenviron msvcrt._wenviron
|
||||
@ varargs _wexecl(wstr wstr) msvcrt._wexecl
|
||||
@ varargs _wexecle(wstr wstr) msvcrt._wexecle
|
||||
|
@ -413,7 +413,7 @@
|
||||
@ extern _dstbias msvcrt._dstbias
|
||||
@ cdecl _dup(long) msvcrt._dup
|
||||
@ cdecl _dup2(long long) msvcrt._dup2
|
||||
@ stub _dupenv_s
|
||||
@ cdecl _dupenv_s(ptr ptr str) msvcrt._dupenv_s
|
||||
@ cdecl _ecvt(double long ptr ptr) msvcrt._ecvt
|
||||
@ stub _ecvt_s
|
||||
@ cdecl _encode_pointer(ptr) MSVCR90_encode_pointer
|
||||
@ -1167,7 +1167,7 @@
|
||||
@ stub _wctomb_l
|
||||
@ stub _wctomb_s_l
|
||||
@ stub _wctype
|
||||
@ stub _wdupenv_s
|
||||
@ cdecl _wdupenv_s(ptr ptr wstr) msvcrt._wdupenv_s
|
||||
@ extern _wenviron msvcrt._wenviron
|
||||
@ varargs _wexecl(wstr wstr) msvcrt._wexecl
|
||||
@ varargs _wexecle(wstr wstr) msvcrt._wexecle
|
||||
|
@ -212,3 +212,52 @@ int CDECL _wputenv_s(const MSVCRT_wchar_t *name, const MSVCRT_wchar_t *value)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* _dupenv_s (MSVCRT.@)
|
||||
*/
|
||||
int _dupenv_s(char **buffer, MSVCRT_size_t *numberOfElements, const char *varname)
|
||||
{
|
||||
char* e;
|
||||
MSVCRT_size_t sz;
|
||||
|
||||
if (!MSVCRT_CHECK_PMT(buffer != NULL) || !MSVCRT_CHECK_PMT(varname) ||
|
||||
!(e = MSVCRT_getenv(varname)))
|
||||
{
|
||||
return *MSVCRT__errno() = MSVCRT_EINVAL;
|
||||
}
|
||||
sz = strlen(e) + 1;
|
||||
if (!(*buffer = MSVCRT_malloc(sz)))
|
||||
{
|
||||
if (numberOfElements) *numberOfElements = 0;
|
||||
return *MSVCRT__errno() = MSVCRT_ENOMEM;
|
||||
}
|
||||
strcpy(*buffer, e);
|
||||
if (numberOfElements) *numberOfElements = sz;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* _wdupenv_s (MSVCRT.@)
|
||||
*/
|
||||
int _wdupenv_s(MSVCRT_wchar_t **buffer, MSVCRT_size_t *numberOfElements,
|
||||
const MSVCRT_wchar_t *varname)
|
||||
{
|
||||
MSVCRT_wchar_t* e;
|
||||
MSVCRT_size_t sz;
|
||||
|
||||
if (!MSVCRT_CHECK_PMT(buffer != NULL) || !MSVCRT_CHECK_PMT(varname) ||
|
||||
!(e = _wgetenv(varname)))
|
||||
{
|
||||
return *MSVCRT__errno() = MSVCRT_EINVAL;
|
||||
}
|
||||
sz = strlenW(e) + 1;
|
||||
if (!(*buffer = MSVCRT_malloc(sz * sizeof(MSVCRT_wchar_t))))
|
||||
{
|
||||
if (numberOfElements) *numberOfElements = 0;
|
||||
return *MSVCRT__errno() = MSVCRT_ENOMEM;
|
||||
}
|
||||
strcpyW(*buffer, e);
|
||||
if (numberOfElements) *numberOfElements = sz;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1480,3 +1480,5 @@
|
||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||
@ cdecl ___mb_cur_max_l_func(ptr)
|
||||
@ cdecl _set_purecall_handler(ptr)
|
||||
@ cdecl _dupenv_s(ptr ptr str)
|
||||
@ cdecl _wdupenv_s(ptr ptr str)
|
||||
|
Loading…
Reference in New Issue
Block a user