Esempio n. 1
0
static void test_SystemFunction036(void)
{
    BOOL ret;
    int test;

    if (!pSystemFunction036)
    {
        win_skip("SystemFunction036 is not available\n");
        return;
    }

    ret = pSystemFunction036(NULL, 0);
    ok(ret == TRUE, "Expected SystemFunction036 to return TRUE, got %d\n", ret);

    /* Test crashes on Windows. */
    if (0)
    {
        SetLastError(0xdeadbeef);
        ret = pSystemFunction036(NULL, 5);
        trace("ret = %d, GetLastError() = %d\n", ret, GetLastError());
    }

    ret = pSystemFunction036(&test, 0);
    ok(ret == TRUE, "Expected SystemFunction036 to return TRUE, got %d\n", ret);

    ret = pSystemFunction036(&test, sizeof(int));
    ok(ret == TRUE, "Expected SystemFunction036 to return TRUE, got %d\n", ret);
}
Esempio n. 2
0
/*********************************************************************
 *              rand_s (MSVCRT.@)
 */
int CDECL rand_s(unsigned int *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;
}