Author: spetreolle Date: Wed Jul 7 20:05:47 2010 New Revision: 47964
URL: http://svn.reactos.org/svn/reactos?rev=47964&view=rev Log: [CRT] -Export memmove_s and memcpy_s -Implement rnd_s
Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.spec trunk/reactos/lib/sdk/crt/math/rand.c
Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/msvcrt.spe... ============================================================================== --- trunk/reactos/dll/win32/msvcrt/msvcrt.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt/msvcrt.spec [iso-8859-1] Wed Jul 7 20:05:47 2010 @@ -1266,9 +1266,9 @@ @ cdecl memchr(ptr long long) @ cdecl memcmp(ptr ptr long) @ cdecl memcpy(ptr ptr long) -# @ cdecl memcpy_s(ptr long ptr long) memmove_s +@ cdecl memcpy_s(ptr long ptr long) memmove_s @ cdecl memmove(ptr ptr long) -# @ cdecl memmove_s(ptr long ptr long) +@ cdecl memmove_s(ptr long ptr long) @ cdecl memset(ptr long long) @ cdecl mktime(ptr) @ cdecl modf(double ptr) @@ -1285,7 +1285,7 @@ # stub qsort_s @ cdecl raise(long) @ cdecl rand() -# @ cdecl rand_s(ptr) +@ cdecl rand_s(ptr) @ cdecl realloc(ptr long) @ cdecl remove(str) @ cdecl rename(str str) @@ -1405,3 +1405,6 @@ @ varargs wscanf(wstr) # @ varargs wscanf_s(wstr)
+# Functions not exported in native dll: +@ cdecl _get_invalid_parameter_handler() +@ cdecl _set_invalid_parameter_handler(ptr)
Modified: trunk/reactos/lib/sdk/crt/math/rand.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/rand.c?rev... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/rand.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/rand.c [iso-8859-1] Wed Jul 7 20:05:47 2010 @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include <precomp.h> -//#include <Ntsecapi.h> +#include <ntsecapi.h> #include <internal/tls.h>
/* @@ -31,12 +31,17 @@ */ int CDECL rand_s(unsigned int *pval) { -#if 0 - if (!pval || !RtlGenRandom(pval, sizeof(*pval))) + BOOLEAN (WINAPI *pSystemFunction036)(PVOID, ULONG); // RtlGenRandom + HINSTANCE hadvapi32 = LoadLibraryA("advapi32.dll"); + pSystemFunction036 = (void*)GetProcAddress(hadvapi32, "SystemFunction036"); +#if 1 + if (!pval || (pSystemFunction036 && !pSystemFunction036(pval, sizeof(*pval)))) { + _invalid_parameter(NULL,_CRT_WIDE("rand_s"),_CRT_WIDE(__FILE__),__LINE__, 0); *_errno() = EINVAL; return EINVAL; } #endif + if(hadvapi32) FreeLibrary(hadvapi32); return 0; }