msvcrt: Implemented _wputenv_s.
This commit is contained in:
parent
af2bc15edd
commit
356b2d2bc0
|
@ -1035,7 +1035,7 @@
|
|||
@ cdecl _putch(long) msvcrt._putch
|
||||
@ stub _putch_nolock
|
||||
@ cdecl _putenv(str) msvcrt._putenv
|
||||
@ stub _putenv_s
|
||||
@ cdecl _putenv_s(str str) msvcrt._putenv_s
|
||||
@ cdecl _putw(long ptr) msvcrt._putw
|
||||
@ stub _putwch
|
||||
@ stub _putwch_nolock
|
||||
|
@ -1371,7 +1371,7 @@
|
|||
@ stub _wprintf_p_l
|
||||
@ stub _wprintf_s_l
|
||||
@ cdecl _wputenv(wstr) msvcrt._wputenv
|
||||
@ stub _wputenv_s
|
||||
@ cdecl _wputenv_s(wstr wstr) msvcrt._wputenv_s
|
||||
@ cdecl _wremove(wstr) msvcrt._wremove
|
||||
@ cdecl _wrename(wstr wstr) msvcrt._wrename
|
||||
@ cdecl _write(long ptr long) msvcrt._write
|
||||
|
|
|
@ -883,7 +883,7 @@
|
|||
@ cdecl _putch(long) msvcrt._putch
|
||||
@ stub _putch_nolock
|
||||
@ cdecl _putenv(str) msvcrt._putenv
|
||||
@ stub _putenv_s
|
||||
@ cdecl _putenv_s(str str) msvcrt._putenv_s
|
||||
@ cdecl _putw(long ptr) msvcrt._putw
|
||||
@ stub _putwch
|
||||
@ stub _putwch_nolock
|
||||
|
@ -1227,7 +1227,7 @@
|
|||
@ stub _wprintf_p_l
|
||||
@ stub _wprintf_s_l
|
||||
@ cdecl _wputenv(wstr) msvcrt._wputenv
|
||||
@ stub _wputenv_s
|
||||
@ cdecl _wputenv_s(wstr wstr) msvcrt._wputenv_s
|
||||
@ cdecl _wremove(wstr) msvcrt._wremove
|
||||
@ cdecl _wrename(wstr wstr) msvcrt._wrename
|
||||
@ cdecl _write(long ptr long) msvcrt._write
|
||||
|
|
|
@ -869,7 +869,7 @@
|
|||
@ cdecl _putch(long) msvcrt._putch
|
||||
@ stub _putch_nolock
|
||||
@ cdecl _putenv(str) msvcrt._putenv
|
||||
@ stub _putenv_s
|
||||
@ cdecl _putenv_s(str str) msvcrt._putenv_s
|
||||
@ cdecl _putw(long ptr) msvcrt._putw
|
||||
@ stub _putwch
|
||||
@ stub _putwch_nolock
|
||||
|
@ -1211,7 +1211,7 @@
|
|||
@ stub _wprintf_p_l
|
||||
@ stub _wprintf_s_l
|
||||
@ cdecl _wputenv(wstr) msvcrt._wputenv
|
||||
@ stub _wputenv_s
|
||||
@ cdecl _wputenv_s(wstr wstr) msvcrt._wputenv_s
|
||||
@ cdecl _wremove(wstr) msvcrt._wremove
|
||||
@ cdecl _wrename(wstr wstr) msvcrt._wrename
|
||||
@ cdecl _write(long ptr long) msvcrt._write
|
||||
|
|
|
@ -160,3 +160,55 @@ finish:
|
|||
HeapFree(GetProcessHeap(), 0, name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _putenv_s (MSVCRT.@)
|
||||
*/
|
||||
int CDECL _putenv_s(const char *name, const char *value)
|
||||
{
|
||||
int ret;
|
||||
|
||||
TRACE("%s %s\n", debugstr_a(name), debugstr_a(value));
|
||||
|
||||
if (!MSVCRT_CHECK_PMT(name != NULL) || !MSVCRT_CHECK_PMT(value != NULL))
|
||||
{
|
||||
*MSVCRT__errno() = MSVCRT_EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = SetEnvironmentVariableA(name, value[0] ? value : NULL) ? 0 : -1;
|
||||
|
||||
/* _putenv returns success on deletion of nonexistent variable, unlike [Rtl]SetEnvironmentVariable */
|
||||
if ((ret == -1) && (GetLastError() == ERROR_ENVVAR_NOT_FOUND)) ret = 0;
|
||||
|
||||
MSVCRT__environ = msvcrt_SnapshotOfEnvironmentA(MSVCRT__environ);
|
||||
MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(MSVCRT__wenviron);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _wputenv_s (MSVCRT.@)
|
||||
*/
|
||||
int CDECL _wputenv_s(const MSVCRT_wchar_t *name, const MSVCRT_wchar_t *value)
|
||||
{
|
||||
int ret;
|
||||
|
||||
TRACE("%s %s\n", debugstr_w(name), debugstr_w(value));
|
||||
|
||||
if (!MSVCRT_CHECK_PMT(name != NULL) || !MSVCRT_CHECK_PMT(value != NULL))
|
||||
{
|
||||
*MSVCRT__errno() = MSVCRT_EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = SetEnvironmentVariableW(name, value[0] ? value : NULL) ? 0 : -1;
|
||||
|
||||
/* _putenv returns success on deletion of nonexistent variable, unlike [Rtl]SetEnvironmentVariable */
|
||||
if ((ret == -1) && (GetLastError() == ERROR_ENVVAR_NOT_FOUND)) ret = 0;
|
||||
|
||||
MSVCRT__environ = msvcrt_SnapshotOfEnvironmentA(MSVCRT__environ);
|
||||
MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(MSVCRT__wenviron);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -817,7 +817,7 @@
|
|||
@ cdecl _purecall()
|
||||
@ cdecl _putch(long)
|
||||
@ cdecl _putenv(str)
|
||||
# stub _putenv_s
|
||||
@ cdecl _putenv_s(str str)
|
||||
@ cdecl _putw(long ptr) MSVCRT__putw
|
||||
# stub _putwch
|
||||
@ cdecl _putws(wstr)
|
||||
|
@ -1146,7 +1146,7 @@
|
|||
# stub _wprintf_p_l
|
||||
# stub _wprintf_s_l
|
||||
@ cdecl _wputenv(wstr)
|
||||
# stub _wputenv_s
|
||||
@ cdecl _wputenv_s(wstr wstr)
|
||||
@ cdecl _wremove(wstr)
|
||||
@ cdecl _wrename(wstr wstr)
|
||||
@ cdecl _write(long ptr long) MSVCRT__write
|
||||
|
|
Loading…
Reference in New Issue