[ROSTESTS] fix x64 build and fix/disable warnings

This commit is contained in:
Timo Kreuzer 2019-05-30 17:12:28 +02:00
parent 6a67450893
commit 42d2d5ec9c
56 changed files with 229 additions and 171 deletions

View file

@ -30,7 +30,7 @@ TestGetComputerNameEx(
return;
}
trace("[%d] Reference is %ls\n", NameType, Reference);
ReferenceLen = wcslen(Reference);
ReferenceLen = lstrlenW(Reference);
ok(ReferenceLen < RTL_NUMBER_OF(Reference),
"[%d] Unexpected ReferenceLen %lu\n", NameType, ReferenceLen);
if (NameType != ComputerNameDnsDomain && NameType != ComputerNamePhysicalDnsDomain)
@ -278,7 +278,7 @@ WriteRegistryValue(PCHAR ValueName, PCHAR Value)
0,
REG_SZ,
(LPBYTE)Value,
strlen(Value) + 1);
lstrlenA(Value) + 1);
/* Close the key */
RegCloseKey(ParametersKey);

View file

@ -54,7 +54,13 @@ static LONG WINAPI ExceptionFilterSSESupport(LPEXCEPTION_POINTERS exp)
ok((ctx->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL, "Context does not contain control register.\n");
#ifdef _M_IX86
ctx->Eip += 3;
#elif defined(_M_AMD64)
ctx->Rip += 3;
#else
#error Architecture not handled
#endif
return EXCEPTION_CONTINUE_EXECUTION;
}
@ -65,12 +71,17 @@ static LONG WINAPI ExceptionFilterSSEException(LPEXCEPTION_POINTERS exp)
{
PEXCEPTION_RECORD rec = exp->ExceptionRecord;
PCONTEXT ctx = exp->ContextRecord;
#ifdef _M_AMD64
ULONG ExpectedExceptionCode = STATUS_FLOAT_DIVIDE_BY_ZERO;
#else
ULONG ExpectedExceptionCode = STATUS_FLOAT_MULTIPLE_TRAPS;
#endif
trace("Exception raised while dividing by 0.\n");
ok(rec->ExceptionCode == STATUS_FLOAT_MULTIPLE_TRAPS, "Exception code is 0x%08x.\n", (unsigned int)rec->ExceptionCode);
ok(rec->ExceptionCode == ExpectedExceptionCode, "Exception code is 0x%08x.\n", (unsigned int)rec->ExceptionCode);
if(rec->ExceptionCode != STATUS_FLOAT_MULTIPLE_TRAPS)
if(rec->ExceptionCode != ExpectedExceptionCode)
{
trace("Unexpected exception code, terminating!\n");
return EXCEPTION_EXECUTE_HANDLER;
@ -80,7 +91,13 @@ static LONG WINAPI ExceptionFilterSSEException(LPEXCEPTION_POINTERS exp)
ExceptionCaught = TRUE;
#ifdef _M_IX86
ctx->Eip += 3;
#elif defined(_M_AMD64)
ctx->Rip += 3;
#else
#error Architecture not handled
#endif
return EXCEPTION_CONTINUE_EXECUTION;
}
@ -96,11 +113,19 @@ VOID TestSSEExceptions(VOID)
p = SetUnhandledExceptionFilter(ExceptionFilterSSESupport);
ok(p == NULL, "Previous filter should be NULL\n");
#ifdef _MSC_VER
#if defined(_M_AMD64)
{
__m128 xmm = { { 0 } };
xmm = _mm_xor_ps(xmm, xmm);
if (!ExceptionCaught) supportsSSE = TRUE;
}
#else
__asm
{
xorps xmm0, xmm0
mov supportsSSE, 0x1
}
#endif
#else
__asm__(
"xorps %%xmm0, %%xmm0\n"
@ -124,6 +149,14 @@ VOID TestSSEExceptions(VOID)
/* We can't use _mm_div_ps, as it masks the exception before performing anything*/
#if defined(_MSC_VER)
#if defined(_M_AMD64)
{
__m128 xmm1 = { { 1., 1. } }, xmm2 = { { 0 } };
/* Wait, aren't exceptions masked? Yes, but actually no. */
xmm1 = _mm_div_ps(xmm1, xmm2);
if (!ExceptionCaught) supportsSSE = TRUE;
}
#else
__asm
{
xorps xmm0, xmm0
@ -140,6 +173,7 @@ VOID TestSSEExceptions(VOID)
/* Clean up */
add esp, 16
}
#endif
#else
__asm__ (
"xorps %%xmm0, %%xmm0\n"

View file

@ -468,7 +468,7 @@ test_Functions()
test_EnumBuffer(Entries[i].Signature, NULL, sizeof(Buffer), NULL, NULL,
Entries[i].ErrInsuff, Entries[i].ErrSuccess);
// Test with wrong buffer
test_EnumBuffer(Entries[i].Signature, (PVOID *)0xbeeffeed, sizeof(Buffer), NULL, NULL,
test_EnumBuffer(Entries[i].Signature, (PVOID *)(LONG_PTR)0xbeeffeed, sizeof(Buffer), NULL, NULL,
Entries[i].ErrInsuff, Entries[i].ErrSuccess);
// Test with correct buffer
test_EnumBuffer(Entries[i].Signature, &Buffer, sizeof(Buffer), &TableCount[i], &FirstTableID[i],
@ -482,7 +482,7 @@ test_Functions()
test_GetBuffer(Entries[i].Signature, 0xbeeffeed, NULL, sizeof(Buffer),
TRUE, Entries[i].ErrInsuff, Entries[i].ErrSuccess);
// Test with fake ID and wrong buffer
test_GetBuffer(Entries[i].Signature, 0xbeeffeed, (PVOID *)0xbeeffeed, sizeof(Buffer),
test_GetBuffer(Entries[i].Signature, 0xbeeffeed, (PVOID *)(LONG_PTR)0xbeeffeed, sizeof(Buffer),
TRUE, Entries[i].ErrInsuff, Entries[i].ErrSuccess);
// Test with fake ID and correct buffer
test_GetBuffer(Entries[i].Signature, 0xbeeffeed, &Buffer, sizeof(Buffer),
@ -502,7 +502,7 @@ test_Functions()
test_GetBuffer(Entries[i].Signature, FirstTableID[i], NULL, sizeof(Buffer),
FALSE, Entries[i].ErrInsuff, Entries[i].ErrSuccess);
// Test with correct ID and wrong buffer
test_GetBuffer(Entries[i].Signature, FirstTableID[i], (PVOID *)0xbeeffeed, sizeof(Buffer),
test_GetBuffer(Entries[i].Signature, FirstTableID[i], (PVOID *)(LONG_PTR)0xbeeffeed, sizeof(Buffer),
FALSE, Entries[i].ErrInsuff, Entries[i].ErrSuccess);
// Test with correct ID and correct buffer
test_GetBuffer(Entries[i].Signature, FirstTableID[i], &Buffer, sizeof(Buffer),

View file

@ -19,8 +19,8 @@ Utf8Convert_(
_In_ PCSTR File,
_In_ INT Line)
{
size_t WideLen;
size_t Utf8Len;
int WideLen;
int Utf8Len;
char Buffer[32];
int Ret;
ULONG i;
@ -28,8 +28,8 @@ Utf8Convert_(
PCSTR ExpectedUtf8;
ExpectedUtf8 = ntv6(1) ? ExpectedUtf8_Vista : ExpectedUtf8_2003;
WideLen = wcslen(WideString);
Utf8Len = strlen(ExpectedUtf8);
WideLen = lstrlenW(WideString);
Utf8Len = lstrlenA(ExpectedUtf8);
/* Get length only */
Ret = WideCharToMultiByte(CP_UTF8, 0, WideString, WideLen, NULL, 0, NULL, NULL);

View file

@ -20,5 +20,5 @@ START_TEST(lstrcpynW)
ok(!lstrcmpW(buffer, L"Copy this"), "Copy went wrong.\n");
/* Test some invalid buffer */
ok(lstrcpynW((LPWSTR)0xbaadf00d, L"Copy this string", 256) == NULL, "lstrncpyW should have returned NULL.\n");
ok(lstrcpynW((LPWSTR)(LONG_PTR)0xbaadf00d, L"Copy this string", 256) == NULL, "lstrncpyW should have returned NULL.\n");
}

View file

@ -47,7 +47,7 @@ RemoveVectoredExceptionHandler(pVEH);
* Use Vectored Exception Handling to monitor for first-chance exceptions.
*/
pVEH = AddVectoredExceptionHandler(1, VEHandler_2);
ok(lstrlenA( (LPSTR)0xbaadf00d) == 0, "lstrlenA should have returned 0.\n");
ok(lstrlenW((LPWSTR)0xbaadf00d) == 0, "lstrlenW should have returned 0.\n");
ok(lstrlenA( (LPSTR)(LONG_PTR)0xbaadf00d) == 0, "lstrlenA should have returned 0.\n");
ok(lstrlenW((LPWSTR)(LONG_PTR)0xbaadf00d) == 0, "lstrlenW should have returned 0.\n");
RemoveVectoredExceptionHandler(pVEH);
}