Commit 3714a398 authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

Correct cases where arguments of ok() calls depend on the order in

which they are evaluated.
parent feef8957
......@@ -222,13 +222,15 @@ static void test_allocateLuid(void)
ok(ret,
"AllocateLocallyUniqueId failed: %ld\n", GetLastError());
ok(pAllocateLocallyUniqueId(&luid2),
ret = pAllocateLocallyUniqueId(&luid2);
ok( ret,
"AllocateLocallyUniqueId failed: %ld\n", GetLastError());
ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0,
"AllocateLocallyUniqueId returned a well-known LUID\n");
ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart,
"AllocateLocallyUniqueId returned non-unique LUIDs\n");
ok(!pAllocateLocallyUniqueId(NULL) && GetLastError() == ERROR_NOACCESS,
ret = pAllocateLocallyUniqueId(NULL);
ok( !ret && GetLastError() == ERROR_NOACCESS,
"AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n",
GetLastError());
}
......@@ -253,8 +255,8 @@ static void test_lookupPrivilegeName(void)
/* check with a short buffer */
cchName = 0;
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
ok(!pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName) &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER,
ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName);
ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n",
GetLastError());
ok(cchName == strlen("SeCreateTokenPrivilege") + 1,
......@@ -273,21 +275,22 @@ static void test_lookupPrivilegeName(void)
{
luid.LowPart = i;
cchName = sizeof(buf);
ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName),
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
ok( ret,
"LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError());
}
/* check a bogus LUID */
luid.LowPart = 0xdeadbeef;
cchName = sizeof(buf);
ok(!pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) &&
GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
GetLastError());
/* check on a bogus system */
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
cchName = sizeof(buf);
ok(!pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName) &&
GetLastError() == RPC_S_SERVER_UNAVAILABLE,
ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName);
ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
"LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
GetLastError());
}
......@@ -344,22 +347,23 @@ static void test_lookupPrivilegeValue(void)
return;
/* check a bogus system name */
ok(!pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid)
&& GetLastError() == RPC_S_SERVER_UNAVAILABLE,
ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid);
ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
"LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
GetLastError());
/* check a NULL string */
ok(!pLookupPrivilegeValueA(NULL, 0, &luid) &&
GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
ret = pLookupPrivilegeValueA(NULL, 0, &luid);
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
GetLastError());
/* check a bogus privilege name */
ok(!pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid) &&
GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid);
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
GetLastError());
/* check case insensitive */
ok(pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid),
ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid);
ok( ret,
"LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n",
GetLastError());
for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++)
......
......@@ -45,6 +45,7 @@ static void test_solidbrush()
HBRUSH stockBrush;
LOGBRUSH br;
size_t i;
INT ret;
for(i=0; i<sizeof(stock)/sizeof(stock[0]); i++) {
solidBrush = CreateSolidBrush(stock[i].color);
......@@ -56,13 +57,15 @@ static void test_solidbrush()
else
stockBrush = NULL;
memset(&br, sizeof(br), 0);
ok(GetObject(solidBrush, sizeof(br), &br)!=0, "GetObject on solid %s brush failed, error=%ld\n", stock[i].name, GetLastError());
ret = GetObject(solidBrush, sizeof(br), &br);
ok( ret !=0, "GetObject on solid %s brush failed, error=%ld\n", stock[i].name, GetLastError());
ok(br.lbStyle==BS_SOLID, "%s brush has wrong style, got %d expected %d\n", stock[i].name, br.lbStyle, BS_SOLID);
ok(br.lbColor==stock[i].color, "%s brush has wrong color, got 0x%08lx expected 0x%08lx\n", stock[i].name, br.lbColor, stock[i].color);
if(stockBrush) {
/* Sanity check, make sure the colors being compared do in fact have a stock brush */
ok(GetObject(stockBrush, sizeof(br), &br)!=0, "GetObject on stock %s brush failed, error=%ld\n", stock[i].name, GetLastError());
ret = GetObject(stockBrush, sizeof(br), &br);
ok( ret !=0, "GetObject on stock %s brush failed, error=%ld\n", stock[i].name, GetLastError());
ok(br.lbColor==stock[i].color, "stock %s brush unexpected color, got 0x%08lx expected 0x%08lx\n", stock[i].name, br.lbColor, stock[i].color);
}
......
......@@ -211,6 +211,7 @@ static void test_gdi_objects(void)
HDC hdc = GetDC(NULL);
HPEN hp;
int i;
BOOL ret;
/* SelectObject() with a NULL DC returns 0 and sets ERROR_INVALID_HANDLE.
* Note: Under XP at least invalid ptrs can also be passed, not just NULL;
......@@ -244,9 +245,10 @@ static void test_gdi_objects(void)
hp, GetLastError());
/* DeleteObject does not SetLastError() on a null object */
ok(!DeleteObject(NULL) && !GetLastError(),
ret = DeleteObject(NULL);
ok( !ret && !GetLastError(),
"DeleteObject(NULL obj), expected 0, NO_ERROR, got %d, 0x%08lx\n",
DeleteObject(NULL), GetLastError());
ret, GetLastError());
/* GetObject does not SetLastError() on a null object */
SetLastError(0);
......
......@@ -38,6 +38,7 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
const INT *dx;
INT *orig_dx = (INT *)param;
LOGFONTA device_lf;
INT ret;
trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n",
hdc, emr->iType, emr->nSize, (void *)param);
......@@ -55,8 +56,8 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
const EMREXTTEXTOUTA *emr_ExtTextOutA = (const EMREXTTEXTOUTA *)emr;
dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx);
ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf),
"GetObjectA error %ld\n", GetLastError());
ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError());
/* compare up to lfOutPrecision, other values are not interesting,
* and in fact sometimes arbitrary adapted by Win9x.
......@@ -79,8 +80,8 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
const EMREXTTEXTOUTW *emr_ExtTextOutW = (const EMREXTTEXTOUTW *)emr;
dx = (const INT *)((const char *)emr + emr_ExtTextOutW->emrtext.offDx);
ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf),
"GetObjectA error %ld\n", GetLastError());
ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError());
/* compare up to lfOutPrecision, other values are not interesting,
* and in fact sometimes arbitrary adapted by Win9x.
......@@ -114,6 +115,7 @@ static void test_ExtTextOut(void)
static const char text[] = "Simple text to test ExtTextOut on metafiles";
INT i, len, dx[256];
static const RECT rc = { 0, 0, 100, 100 };
BOOL ret;
assert(sizeof(dx)/sizeof(dx[0]) >= lstrlenA(text));
......@@ -145,8 +147,8 @@ static void test_ExtTextOut(void)
len = lstrlenA(text);
for (i = 0; i < len; i++)
{
ok(GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]),
"GetCharWidthA error %ld\n", GetLastError());
ret = GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]);
ok( ret, "GetCharWidthA error %ld\n", GetLastError());
}
hFont = SelectObject(hdcDisplay, hFont);
......@@ -161,33 +163,37 @@ static void test_ExtTextOut(void)
hFont = SelectObject(hdcMetafile, hFont);
/* 1. pass NULL lpDx */
ok(ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL),
"ExtTextOutA error %ld\n", GetLastError());
ret = ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL);
ok( ret, "ExtTextOutA error %ld\n", GetLastError());
/* 2. pass custom lpDx */
ok(ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx),
"ExtTextOutA error %ld\n", GetLastError());
ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx);
ok( ret, "ExtTextOutA error %ld\n", GetLastError());
hFont = SelectObject(hdcMetafile, hFont);
ok(DeleteObject(hFont), "DeleteObject error %ld\n", GetLastError());
ret = DeleteObject(hFont);
ok( ret, "DeleteObject error %ld\n", GetLastError());
hMetafile = CloseEnhMetaFile(hdcMetafile);
ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
ok(!GetObjectType(hdcMetafile), "CloseEnhMetaFile has to destroy metafile hdc\n");
ok(PlayEnhMetaFile(hdcDisplay, hMetafile, &rc), "PlayEnhMetaFile error %ld\n", GetLastError());
ret = PlayEnhMetaFile(hdcDisplay, hMetafile, &rc);
ok( ret, "PlayEnhMetaFile error %ld\n", GetLastError());
ok(EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc),
"EnumEnhMetaFile error %ld\n", GetLastError());
ret = EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc);
ok( ret, "EnumEnhMetaFile error %ld\n", GetLastError());
ok(emr_processed, "EnumEnhMetaFile couldn't find EMR_EXTTEXTOUTA or EMR_EXTTEXTOUTW record\n");
ok(!EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, NULL),
"A valid hdc has to require a valid rc\n");
ok(DeleteEnhMetaFile(hMetafile), "DeleteEnhMetaFile error %ld\n", GetLastError());
ok(ReleaseDC(hwnd, hdcDisplay), "ReleaseDC error %ld\n", GetLastError());
ret = DeleteEnhMetaFile(hMetafile);
ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
ret = ReleaseDC(hwnd, hdcDisplay);
ok( ret, "ReleaseDC error %ld\n", GetLastError());
}
/* Win-format metafile (mfdrv) tests */
......@@ -317,6 +323,7 @@ static void test_mf_Blank(void)
HDC hdcMetafile;
HMETAFILE hMetafile;
INT caps;
BOOL ret;
hdcMetafile = CreateMetaFileA(NULL);
ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
......@@ -335,7 +342,8 @@ static void test_mf_Blank(void)
"mf_blank") != 0)
dump_mf_bits (hMetafile, "mf_Blank");
ok(DeleteMetaFile(hMetafile), "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
ret = DeleteMetaFile(hMetafile);
ok( ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
}
/* Simple APIs from mfdrv/graphics.c
......@@ -346,14 +354,18 @@ static void test_mf_Graphics()
HDC hdcMetafile;
HMETAFILE hMetafile;
POINT oldpoint;
BOOL ret;
hdcMetafile = CreateMetaFileA(NULL);
ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
trace("hdcMetafile %p\n", hdcMetafile);
ok(MoveToEx(hdcMetafile, 1, 1, NULL), "MoveToEx error %ld.\n", GetLastError());
ok(LineTo(hdcMetafile, 2, 2), "LineTo error %ld.\n", GetLastError());
ok(MoveToEx(hdcMetafile, 1, 1, &oldpoint), "MoveToEx error %ld.\n", GetLastError());
ret = MoveToEx(hdcMetafile, 1, 1, NULL);
ok( ret, "MoveToEx error %ld.\n", GetLastError());
ret = LineTo(hdcMetafile, 2, 2);
ok( ret, "LineTo error %ld.\n", GetLastError());
ret = MoveToEx(hdcMetafile, 1, 1, &oldpoint);
ok( ret, "MoveToEx error %ld.\n", GetLastError());
/* oldpoint gets garbage under Win XP, so the following test would
* work under Wine but fails under Windows:
......@@ -363,7 +375,8 @@ static void test_mf_Graphics()
* oldpoint.x, oldpoint.y);
*/
ok(Ellipse(hdcMetafile, 0, 0, 2, 2), "Ellipse error %ld.\n", GetLastError());
ret = Ellipse(hdcMetafile, 0, 0, 2, 2);
ok( ret, "Ellipse error %ld.\n", GetLastError());
hMetafile = CloseMetaFile(hdcMetafile);
ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
......@@ -373,7 +386,8 @@ static void test_mf_Graphics()
"mf_Graphics") != 0)
dump_mf_bits (hMetafile, "mf_Graphics");
ok(DeleteMetaFile(hMetafile), "DeleteMetaFile(%p) error %ld\n",
ret = DeleteMetaFile(hMetafile);
ok( ret, "DeleteMetaFile(%p) error %ld\n",
hMetafile, GetLastError());
}
......@@ -383,6 +397,7 @@ static void test_mf_PatternBrush(void)
HMETAFILE hMetafile;
LOGBRUSH *orig_lb;
HBRUSH hBrush;
BOOL ret;
orig_lb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGBRUSH));
......@@ -409,9 +424,12 @@ static void test_mf_PatternBrush(void)
"mf_Pattern_Brush") != 0)
dump_mf_bits (hMetafile, "mf_Pattern_Brush");
ok(DeleteMetaFile(hMetafile), "DeleteMetaFile error %ld\n", GetLastError());
ok(DeleteObject(hBrush), "DeleteObject(HBRUSH) error %ld\n", GetLastError());
ok(DeleteObject((HBITMAP *)orig_lb->lbHatch), "DeleteObject(HBITMAP) error %ld\n",
ret = DeleteMetaFile(hMetafile);
ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
ret = DeleteObject(hBrush);
ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
ret = DeleteObject((HBITMAP *)orig_lb->lbHatch);
ok( ret, "DeleteObject(HBITMAP) error %ld\n",
GetLastError());
HeapFree (GetProcessHeap(), 0, orig_lb);
}
......
......@@ -44,7 +44,8 @@ static DWORD CALLBACK NotificationThread(LPVOID arg)
ret = FindNextChangeNotification(change);
}
ok(FindCloseChangeNotification(change), "FindCloseChangeNotification error: %ld\n",
ret = FindCloseChangeNotification(change);
ok( ret, "FindCloseChangeNotification error: %ld\n",
GetLastError());
ExitThread((DWORD)ret);
......@@ -123,7 +124,8 @@ static void test_FindFirstChangeNotification(void)
file = CreateFileA(filename1, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError());
ret = CloseHandle(file);
ok( ret, "CloseHandle error: %ld\n", GetLastError());
/* Try to register notification for a file. win98 and win2k behave differently here */
change = FindFirstChangeNotificationA(filename1, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
......@@ -189,7 +191,8 @@ static void test_FindFirstChangeNotification(void)
file = CreateFileA(filename2, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError());
ret = CloseHandle(file);
ok( ret, "CloseHandle error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
attributes = GetFileAttributesA(filename2);
......@@ -209,7 +212,8 @@ static void test_FindFirstChangeNotification(void)
ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ret = WriteFile(file, buffer, sizeof(buffer), &count, NULL);
ok(ret && count == sizeof(buffer), "WriteFile error: %ld\n", GetLastError());
ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError());
ret = CloseHandle(file);
ok( ret, "CloseHandle error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Change file size by truncating a file */
......@@ -219,7 +223,8 @@ static void test_FindFirstChangeNotification(void)
ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ret = WriteFile(file, buffer, sizeof(buffer) / 2, &count, NULL);
ok(ret && count == sizeof(buffer) / 2, "WriteFileA error: %ld\n", GetLastError());
ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError());
ret = CloseHandle(file);
ok( ret, "CloseHandle error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* clean up */
......
......@@ -202,6 +202,7 @@ static void doChild(const char* file, const char* option)
char bufA[MAX_PATH];
WCHAR bufW[MAX_PATH];
HANDLE hFile = CreateFileA(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
BOOL ret;
if (hFile == INVALID_HANDLE_VALUE) return;
......@@ -329,11 +330,14 @@ static void doChild(const char* file, const char* option)
/* now that we have written all relevant information, let's change it */
ok(SetConsoleCP(1252), "Setting CP\n");
ok(SetConsoleOutputCP(1252), "Setting SB CP\n");
ok(SetConsoleMode(hConIn, modeIn ^ 1), "Setting mode (%ld)\n", GetLastError());
ok(SetConsoleMode(hConOut, modeOut ^ 1), "Setting mode (%ld)\n", GetLastError());
ret = SetConsoleMode(hConIn, modeIn ^ 1);
ok( ret, "Setting mode (%ld)\n", GetLastError());
ret = SetConsoleMode(hConOut, modeOut ^ 1);
ok( ret, "Setting mode (%ld)\n", GetLastError());
sbi.dwCursorPosition.X ^= 1;
sbi.dwCursorPosition.Y ^= 1;
ok(SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition), "Setting cursor position (%ld)\n", GetLastError());
ret = SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition);
ok( ret, "Setting cursor position (%ld)\n", GetLastError());
}
if (option && strcmp(option, "stdhandle") == 0)
{
......
......@@ -438,14 +438,14 @@ VOID test_thread_priority(void)
if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
ok(rc!=0,"error=%ld\n",GetLastError());
ok(pSetThreadPriorityBoost(curthread,1)!=0,
"error=%ld\n",GetLastError());
rc = pSetThreadPriorityBoost(curthread,1);
ok( rc != 0, "error=%ld\n",GetLastError());
rc=pGetThreadPriorityBoost(curthread,&disabled);
ok(rc!=0 && disabled==1,
"rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled);
ok(pSetThreadPriorityBoost(curthread,0)!=0,
"error=%ld\n",GetLastError());
rc = pSetThreadPriorityBoost(curthread,0);
ok( rc != 0, "error=%ld\n",GetLastError());
rc=pGetThreadPriorityBoost(curthread,&disabled);
ok(rc!=0 && disabled==0,
"rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled);
......
......@@ -189,10 +189,12 @@ void test_FileTimeToSystemTime()
FILETIME ft;
SYSTEMTIME st;
ULONGLONG time = (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
BOOL ret;
ft.dwHighDateTime = 0;
ft.dwLowDateTime = 0;
ok(FileTimeToSystemTime(&ft, &st),
ret = FileTimeToSystemTime(&ft, &st);
ok( ret,
"FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError());
ok(((st.wYear == 1601) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 0) &&
......@@ -201,7 +203,8 @@ void test_FileTimeToSystemTime()
ft.dwHighDateTime = (UINT)(time >> 32);
ft.dwLowDateTime = (UINT)time;
ok(FileTimeToSystemTime(&ft, &st),
ret = FileTimeToSystemTime(&ft, &st);
ok( ret,
"FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError());
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
......@@ -222,10 +225,13 @@ void test_FileTimeToLocalFileTime()
( res == TIME_ZONE_ID_STANDARD ? tzinfo.StandardBias :
( res == TIME_ZONE_ID_DAYLIGHT ? tzinfo.DaylightBias : 0 ))) *
SECSPERMIN *TICKSPERSEC;
BOOL ret;
ok( res != TIME_ZONE_ID_INVALID , "GetTimeZoneInformation failed\n");
ft.dwHighDateTime = (UINT)(time >> 32);
ft.dwLowDateTime = (UINT)time;
ok(FileTimeToLocalFileTime(&ft, &lft) !=0 ,
ret = FileTimeToLocalFileTime(&ft, &lft);
ok( ret,
"FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError());
FileTimeToSystemTime(&lft, &st);
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
......@@ -238,7 +244,8 @@ void test_FileTimeToLocalFileTime()
ok(SetEnvironmentVariableA("TZ","GMT") != 0,
"SetEnvironmentVariableA failed\n");
ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
ok(FileTimeToLocalFileTime(&ft, &lft) !=0 ,
ret = FileTimeToLocalFileTime(&ft, &lft);
ok( ret,
"FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError());
FileTimeToSystemTime(&lft, &st);
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
......
......@@ -140,12 +140,13 @@ static void test_lzread(void)
DWORD ret;
int cfile;
OFSTRUCT test;
BOOL retok;
/* Create the compressed file. */
file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
ok(file != INVALID_HANDLE_VALUE, "Could not create test file\n");
ok2(WriteFile(file, compressed_file, compressed_file_size, &ret, 0),
"WriteFile: error %ld\n", GetLastError());
retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0);
ok2( retok, "WriteFile: error %ld\n", GetLastError());
ok(ret == compressed_file_size, "Wrote wrong number of bytes with WriteFile?\n");
CloseHandle(file);
......@@ -177,13 +178,14 @@ static void test_lzcopy(void)
DWORD ret;
int source, dest;
OFSTRUCT stest, dtest;
BOOL retok;
/* Create the compressed file. */
file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
ok2(file != INVALID_HANDLE_VALUE,
"CreateFile: error %ld\n", GetLastError());
ok2(WriteFile(file, compressed_file, compressed_file_size, &ret, 0),
"WriteFile error %ld\n", GetLastError());
retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0);
ok2( retok, "WriteFile error %ld\n", GetLastError());
ok(ret == compressed_file_size, "Wrote wrong number of bytes\n");
CloseHandle(file);
......@@ -203,8 +205,8 @@ static void test_lzcopy(void)
ok2(file != INVALID_HANDLE_VALUE,
"CreateFile: error %ld\n", GetLastError());
ok2(ReadFile(file, buf, uncompressed_data_size*2, &ret, 0) &&
ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError());
retok = ReadFile(file, buf, uncompressed_data_size*2, &ret, 0);
ok2( retok && ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError());
/* Compare what we read with what we think we should read. */
ok(!memcmp(buf, uncompressed_data, uncompressed_data_size),
"buffer contents mismatch\n");
......
......@@ -630,6 +630,7 @@ static void test_OpenColorProfileA()
{
PROFILE profile;
HPROFILE handle;
BOOL ret;
profile.dwType = PROFILE_FILENAME;
profile.pProfileData = NULL;
......@@ -670,7 +671,8 @@ static void test_OpenColorProfileA()
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
ok( CloseColorProfile( handle ), "CloseColorProfile() failed (%ld)\n", GetLastError() );
ret = CloseColorProfile( handle );
ok( ret, "CloseColorProfile() failed (%ld)\n", GetLastError() );
}
}
......@@ -678,6 +680,7 @@ static void test_OpenColorProfileW()
{
PROFILE profile;
HPROFILE handle;
BOOL ret;
profile.dwType = PROFILE_FILENAME;
profile.pProfileData = NULL;
......@@ -718,7 +721,8 @@ static void test_OpenColorProfileW()
handle = OpenColorProfileW( &profile, PROFILE_READ, 0, OPEN_EXISTING );
ok( handle != NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
ok( CloseColorProfile( handle ), "CloseColorProfile() failed (%ld)\n", GetLastError() );
ret = CloseColorProfile( handle );
ok( ret, "CloseColorProfile() failed (%ld)\n", GetLastError() );
}
}
......
......@@ -187,10 +187,12 @@ static void test_file_write_read( void )
static const char mytext[]= "This is test_file_write_read\nsecond line\n";
static const char dostext[]= "This is test_file_write_read\r\nsecond line\r\n";
char btext[LLEN];
int ret;
tempf=_tempnam(".","wne");
ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
_S_IREAD | _S_IWRITE)) != -1,
tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
_S_IREAD | _S_IWRITE);
ok( tempfd != -1,
"Can't open '%s': %d\n", tempf, errno); /* open in TEXT mode */
ok(_write(tempfd,mytext,strlen(mytext)) == lstrlenA(mytext),
"_write _O_TEXT bad return value\n");
......@@ -208,10 +210,12 @@ static void test_file_write_read( void )
ok( memcmp(mytext,btext,strlen(mytext)) == 0,
"problems with _O_TEXT _write / _read\n");
_close(tempfd);
ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
ret = unlink(tempf);
ok( ret !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
tempf=_tempnam(".","wne");
ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0)) != -1,
tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0);
ok( tempfd != -1,
"Can't open '%s': %d\n", tempf, errno); /* open in BINARY mode */
ok(_write(tempfd,dostext,strlen(dostext)) == lstrlenA(dostext),
"_write _O_BINARY bad return value\n");
......@@ -230,17 +234,21 @@ static void test_file_write_read( void )
"problems with _O_BINARY _write / _O_TEXT _read\n");
_close(tempfd);
ok(_chmod (tempf, _S_IREAD | _S_IWRITE) == 0,
ret =_chmod (tempf, _S_IREAD | _S_IWRITE);
ok( ret == 0,
"Can't chmod '%s' to read-write: %d\n", tempf, errno);
ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
ret = unlink(tempf);
ok( ret !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
}
static void test_file_inherit_child(const char* fd_s)
{
int fd = atoi(fd_s);
char buffer[32];
int ret;
ok(write(fd, "Success", 8) == 8, "Couldn't write in child process on %d (%s)\n", fd, strerror(errno));
ret =write(fd, "Success", 8);
ok( ret == 8, "Couldn't write in child process on %d (%s)\n", fd, strerror(errno));
lseek(fd, 0, SEEK_SET);
ok(read(fd, buffer, sizeof (buffer)) == 8, "Couldn't read back the data\n");
ok(memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n");
......@@ -249,8 +257,10 @@ static void test_file_inherit_child(const char* fd_s)
static void test_file_inherit_child_no(const char* fd_s)
{
int fd = atoi(fd_s);
int ret;
ok(write(fd, "Success", 8) == -1 && errno == EBADF,
ret = write(fd, "Success", 8);
ok( ret == -1 && errno == EBADF,
"Wrong write result in child process on %d (%s)\n", fd, strerror(errno));
}
......
......@@ -821,6 +821,7 @@ static void testNonExistentPath(void)
STARTUPINFOA startup;
PROCESS_INFORMATION info;
HRESULT hr;
BOOL ret;
wnsprintfA(buffer, sizeof(buffer), "%s tests/shellpath.c 1",
selfname);
......@@ -856,8 +857,8 @@ static void testNonExistentPath(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0,
"child process termination\n");
ok(RemoveDirectoryA(modifiedPath),
"RemoveDirectoryA failed: %ld\n", GetLastError());
ret = RemoveDirectoryA(modifiedPath);
ok( ret, "RemoveDirectoryA failed: %ld\n", GetLastError());
}
}
else if (winetest_interactive)
......
......@@ -205,12 +205,13 @@ static void test_alloc_shared()
HANDLE hmem;
int val;
int* p;
BOOL ret;
procid=GetCurrentProcessId();
hmem=pSHAllocShared(NULL,10,procid);
ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %ld\n", GetLastError());
ok(pSHFreeShared(hmem, procid),
"SHFreeShared failed: %ld\n", GetLastError());
ret = pSHFreeShared(hmem, procid);
ok( ret, "SHFreeShared failed: %ld\n", GetLastError());
val=0x12345678;
hmem=pSHAllocShared(&val,4,procid);
......@@ -220,10 +221,11 @@ static void test_alloc_shared()
ok(p!=NULL,"SHLockShared failed: %ld\n", GetLastError());
if (p!=NULL)
ok(*p==val,"Wrong value in shared memory: %d instead of %d\n",*p,val);
ok(pSHUnlockShared(p),"SHUnlockShared failed: %ld\n", GetLastError());
ret = pSHUnlockShared(p);
ok( ret, "SHUnlockShared failed: %ld\n", GetLastError());
ok(pSHFreeShared(hmem, procid),
"SHFreeShared failed: %ld\n", GetLastError());
ret = pSHFreeShared(hmem, procid);
ok( ret, "SHFreeShared failed: %ld\n", GetLastError());
}
START_TEST(ordinal)
......
......@@ -37,6 +37,7 @@ static BOOL is_win9x = FALSE;
static void test_ClipboardOwner(void)
{
HWND hWnd1, hWnd2;
BOOL ret;
SetLastError(0xdeadbeef);
ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef,
......@@ -59,7 +60,8 @@ static void test_ClipboardOwner(void)
ok(OpenClipboard(0), "OpenClipboard failed\n");
ok(!GetClipboardOwner(), "clipboard should still be not owned\n");
ok(!OpenClipboard(hWnd1), "OpenClipboard should fail since clipboard already opened\n");
ok(CloseClipboard(), "CloseClipboard error %ld\n", GetLastError());
ret = CloseClipboard();
ok( ret, "CloseClipboard error %ld\n", GetLastError());
ok(OpenClipboard(hWnd1), "OpenClipboard failed\n");
......@@ -69,18 +71,22 @@ static void test_ClipboardOwner(void)
SetLastError(0xdeadbeef);
ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should still be not owned\n");
ok(EmptyClipboard(), "EmptyClipboard error %ld\n", GetLastError());
ret = EmptyClipboard();
ok( ret, "EmptyClipboard error %ld\n", GetLastError());
ok(GetClipboardOwner() == hWnd1, "clipboard should be owned by %p, not by %p\n", hWnd1, GetClipboardOwner());
SetLastError(0xdeadbeef);
ok(!OpenClipboard(hWnd2) && GetLastError() == 0xdeadbeef,
"OpenClipboard should fail without setting last error value\n");
ok(CloseClipboard(), "CloseClipboard error %ld\n", GetLastError());
ret = CloseClipboard();
ok( ret, "CloseClipboard error %ld\n", GetLastError());
ok(GetClipboardOwner() == hWnd1, "clipboard should still be owned\n");
ok(DestroyWindow(hWnd1), "DestroyWindow error %ld\n", GetLastError());
ok(DestroyWindow(hWnd2), "DestroyWindow error %ld\n", GetLastError());
ret = DestroyWindow(hWnd1);
ok( ret, "DestroyWindow error %ld\n", GetLastError());
ret = DestroyWindow(hWnd2);
ok( ret, "DestroyWindow error %ld\n", GetLastError());
SetLastError(0xdeadbeef);
ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should not be owned\n");
}
......@@ -91,6 +97,7 @@ static void test_RegisterClipboardFormatA(void)
UINT format_id, format_id2;
char buf[256];
int len;
BOOL ret;
format_id = RegisterClipboardFormatA("my_cool_clipboard_format");
ok(format_id > 0xc000 && format_id < 0xffff, "invalid clipboard format id %04x\n", format_id);
......@@ -149,7 +156,8 @@ todo_wine
}
#endif
ok(OpenClipboard(0), "OpenClipboard error %ld\n", GetLastError());
ret = OpenClipboard(0);
ok( ret, "OpenClipboard error %ld\n", GetLastError());
trace("# of formats available: %d\n", CountClipboardFormats());
......@@ -161,8 +169,10 @@ todo_wine
trace("%04x: %s\n", format_id, len ? buf : "");
}
ok(EmptyClipboard(), "EmptyClipboard error %ld\n", GetLastError());
ok(CloseClipboard(), "CloseClipboard error %ld\n", GetLastError());
ret = EmptyClipboard();
ok( ret, "EmptyClipboard error %ld\n", GetLastError());
ret =CloseClipboard();
ok( ret, "CloseClipboard error %ld\n", GetLastError());
if (CountClipboardFormats())
{
......
......@@ -2168,6 +2168,7 @@ static void test_hv_scroll_1(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
{
DWORD style, exstyle;
INT xmin, xmax;
BOOL ret;
exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
style = GetWindowLongA(hwnd, GWL_STYLE);
......@@ -2177,7 +2178,8 @@ static void test_hv_scroll_1(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
if (clear) ok(style & clear, "style %08lx should be set\n", clear);
if (set) ok(!(style & set), "style %08lx should not be set\n", set);
ok(SetScrollRange(hwnd, ctl, min, max, FALSE), "SetScrollRange(%d) error %ld\n", ctl, GetLastError());
ret = SetScrollRange(hwnd, ctl, min, max, FALSE);
ok( ret, "SetScrollRange(%d) error %ld\n", ctl, GetLastError());
if ((style & (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME)) || (exstyle & WS_EX_DLGMODALFRAME))
ok_sequence(WmSetScrollRangeHV_NC_Seq, "SetScrollRange(SB_HORZ/SB_VERT) NC", FALSE);
else
......@@ -2188,13 +2190,15 @@ static void test_hv_scroll_1(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
if (clear) ok(!(style & clear), "style %08lx should not be set\n", clear);
/* a subsequent call should do nothing */
ok(SetScrollRange(hwnd, ctl, min, max, FALSE), "SetScrollRange(%d) error %ld\n", ctl, GetLastError());
ret = SetScrollRange(hwnd, ctl, min, max, FALSE);
ok( ret, "SetScrollRange(%d) error %ld\n", ctl, GetLastError());
ok_sequence(WmEmptySeq, "SetScrollRange(SB_HORZ/SB_VERT)", FALSE);
xmin = 0xdeadbeef;
xmax = 0xdeadbeef;
trace("Ignore GetScrollRange error below if you are on Win9x\n");
ok(GetScrollRange(hwnd, ctl, &xmin, &xmax), "GetScrollRange(%d) error %ld\n", ctl, GetLastError());
ret = GetScrollRange(hwnd, ctl, &xmin, &xmax);
ok( ret, "GetScrollRange(%d) error %ld\n", ctl, GetLastError());
ok_sequence(WmEmptySeq, "GetScrollRange(SB_HORZ/SB_VERT)", FALSE);
ok(xmin == min, "unexpected min scroll value %d\n", xmin);
ok(xmax == max, "unexpected max scroll value %d\n", xmax);
......@@ -2204,6 +2208,7 @@ static void test_hv_scroll_2(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
{
DWORD style, exstyle;
SCROLLINFO si;
BOOL ret;
exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
style = GetWindowLongA(hwnd, GWL_STYLE);
......@@ -2244,7 +2249,8 @@ static void test_hv_scroll_2(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
si.fMask = SIF_RANGE;
si.nMin = 0xdeadbeef;
si.nMax = 0xdeadbeef;
ok(GetScrollInfo(hwnd, ctl, &si), "GetScrollInfo error %ld\n", GetLastError());
ret = GetScrollInfo(hwnd, ctl, &si);
ok( ret, "GetScrollInfo error %ld\n", GetLastError());
ok_sequence(WmEmptySeq, "GetScrollRange(SB_HORZ/SB_VERT)", FALSE);
ok(si.nMin == min, "unexpected min scroll value %d\n", si.nMin);
ok(si.nMax == max, "unexpected max scroll value %d\n", si.nMax);
......@@ -2255,23 +2261,27 @@ static void test_scroll_messages(HWND hwnd)
{
SCROLLINFO si;
INT min, max;
BOOL ret;
min = 0xdeadbeef;
max = 0xdeadbeef;
ok(GetScrollRange(hwnd, SB_CTL, &min, &max), "GetScrollRange error %ld\n", GetLastError());
ret = GetScrollRange(hwnd, SB_CTL, &min, &max);
ok( ret, "GetScrollRange error %ld\n", GetLastError());
if (sequence->message != WmGetScrollRangeSeq[0].message)
trace("GetScrollRange(SB_CTL) generated unknown message %04x\n", sequence->message);
/* values of min and max are undefined */
flush_sequence();
ok(SetScrollRange(hwnd, SB_CTL, 10, 150, FALSE), "SetScrollRange error %ld\n", GetLastError());
ret = SetScrollRange(hwnd, SB_CTL, 10, 150, FALSE);
ok( ret, "SetScrollRange error %ld\n", GetLastError());
if (sequence->message != WmSetScrollRangeSeq[0].message)
trace("SetScrollRange(SB_CTL) generated unknown message %04x\n", sequence->message);
flush_sequence();
min = 0xdeadbeef;
max = 0xdeadbeef;
ok(GetScrollRange(hwnd, SB_CTL, &min, &max), "GetScrollRange error %ld\n", GetLastError());
ret = GetScrollRange(hwnd, SB_CTL, &min, &max);
ok( ret, "GetScrollRange error %ld\n", GetLastError());
if (sequence->message != WmGetScrollRangeSeq[0].message)
trace("GetScrollRange(SB_CTL) generated unknown message %04x\n", sequence->message);
/* values of min and max are undefined */
......@@ -2303,7 +2313,8 @@ static void test_scroll_messages(HWND hwnd)
si.fMask = SIF_RANGE;
si.nMin = 0xdeadbeef;
si.nMax = 0xdeadbeef;
ok(GetScrollInfo(hwnd, SB_CTL, &si), "GetScrollInfo error %ld\n", GetLastError());
ret = GetScrollInfo(hwnd, SB_CTL, &si);
ok( ret, "GetScrollInfo error %ld\n", GetLastError());
if (sequence->message != WmGetScrollInfoSeq[0].message)
trace("GetScrollInfo(SB_CTL) generated unknown message %04x\n", sequence->message);
/* values of min and max are undefined */
......@@ -3366,6 +3377,7 @@ static void test_interthread_messages(void)
char buf[256];
int len, expected_len;
struct wnd_event wnd_event;
BOOL ret;
wnd_event.event = CreateEventW(NULL, 0, 0, NULL);
if (!wnd_event.event)
......@@ -3415,7 +3427,8 @@ static void test_interthread_messages(void)
ok(!len && GetLastError() == 0xdeadbeef,
"DispatchMessageA(WM_TIMER) failed on another thread window: ret %d, error %ld\n", len, GetLastError());
ok(PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0), "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
ok( ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
CloseHandle(hThread);
......@@ -3549,8 +3562,9 @@ static void test_accelerators(void)
HACCEL hAccel;
HWND hwnd = CreateWindowExA(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
assert(hwnd != 0);
BOOL ret;
assert(hwnd != 0);
SetFocus(hwnd);
ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus());
......@@ -3607,7 +3621,8 @@ static void test_accelerators(void)
pump_msg_loop(hwnd, hAccel);
ok_sequence(WmCtrlAltVkN, "Ctrl+Alt+VK_N press/release 1", FALSE);
ok(DestroyAcceleratorTable(hAccel), "DestroyAcceleratorTable error %ld\n", GetLastError());
ret = DestroyAcceleratorTable(hAccel);
ok( ret, "DestroyAcceleratorTable error %ld\n", GetLastError());
hAccel = LoadAccelerators(GetModuleHandleA(0), MAKEINTRESOURCE(2));
assert(hAccel != 0);
......@@ -3657,7 +3672,8 @@ static void test_accelerators(void)
pump_msg_loop(hwnd, hAccel);
ok_sequence(WmCtrlAltVkN, "Ctrl+Alt+VK_N press/release 2", FALSE);
ok(DestroyAcceleratorTable(hAccel), "DestroyAcceleratorTable error %ld\n", GetLastError());
ret = DestroyAcceleratorTable(hAccel);
ok( ret, "DestroyAcceleratorTable error %ld\n", GetLastError());
DestroyWindow(hwnd);
}
......
......@@ -38,6 +38,7 @@ static void test_DrawTextCalcRect(void)
"MM_HIENGLISH mode";
INT len;
RECT rect = { 0, 0, 100, 0 };
BOOL ret;
/* Initialization */
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
......@@ -65,9 +66,10 @@ static void test_DrawTextCalcRect(void)
GetLastError());
hOldFont = SelectObject(hdc, hFont);
ok(DrawTextA(hdc, text, len, &rect, DT_CALCRECT |
len = DrawTextA(hdc, text, len, &rect, DT_CALCRECT |
DT_EXTERNALLEADING | DT_WORDBREAK | DT_NOCLIP | DT_LEFT |
DT_NOPREFIX),"DrawTextA error %lu\n", GetLastError());
DT_NOPREFIX);
ok( len, "DrawTextA error %lu\n", GetLastError());
trace("MM_HIENGLISH rect.bottom %ld\n", rect.bottom);
todo_wine ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with "
......@@ -75,8 +77,8 @@ static void test_DrawTextCalcRect(void)
"(bot=%ld)\n", rect.bottom);
SelectObject(hdc, hOldFont);
ok(DeleteObject(hFont), "DeleteObject error %lu\n",
GetLastError());
ret = DeleteObject(hFont);
ok( ret, "DeleteObject error %lu\n", GetLastError());
/* DrawText in MM_TEXT with DT_CALCRECT */
......@@ -88,9 +90,10 @@ static void test_DrawTextCalcRect(void)
GetLastError());
hOldFont = SelectObject(hdc, hFont);
ok(DrawTextA(hdc, text, len, &rect, DT_CALCRECT |
len = DrawTextA(hdc, text, len, &rect, DT_CALCRECT |
DT_EXTERNALLEADING | DT_WORDBREAK | DT_NOCLIP | DT_LEFT |
DT_NOPREFIX),"DrawTextA error %lu\n", GetLastError());
DT_NOPREFIX);
ok( len, "DrawTextA error %lu\n", GetLastError());
trace("MM_TEXT rect.bottom %ld\n", rect.bottom);
ok(rect.bottom > 0, "In MM_TEXT, DrawText with DT_CALCRECT "
......@@ -98,14 +101,14 @@ static void test_DrawTextCalcRect(void)
rect.bottom);
SelectObject(hdc, hOldFont);
ok(DeleteObject(hFont), "DeleteObject error %lu\n",
GetLastError());
ret = DeleteObject(hFont);
ok( ret, "DeleteObject error %lu\n", GetLastError());
/* Clean up */
ok(ReleaseDC(hwnd, hdc), "ReleaseDC error %lu\n",
GetLastError());
ok(DestroyWindow(hwnd), "DestroyWindow error %lu\n",
GetLastError());
ret = ReleaseDC(hwnd, hdc);
ok( ret, "ReleaseDC error %lu\n", GetLastError());
ret = DestroyWindow(hwnd);
ok( ret, "DestroyWindow error %lu\n", GetLastError());
}
START_TEST(text)
......
......@@ -1672,6 +1672,7 @@ static void test_SetMenu(HWND parent)
HWND child;
HMENU hMenu, ret;
BOOL is_win9x = GetWindowLongW(parent, GWL_WNDPROC) == 0;
BOOL retok;
hMenu = CreateMenu();
assert(hMenu);
......@@ -1681,7 +1682,8 @@ static void test_SetMenu(HWND parent)
ret = GetMenu(parent);
ok(ret == hMenu, "unexpected menu id %p\n", ret);
/* test whether we can destroy a menu assigned to a window */
ok(DestroyMenu(hMenu), "DestroyMenu error %ld\n", GetLastError());
retok = DestroyMenu(hMenu);
ok( retok, "DestroyMenu error %ld\n", GetLastError());
ok(!IsMenu(hMenu), "menu handle should be not valid after DestroyMenu\n");
ret = GetMenu(parent);
/* This test fails on Win9x */
......@@ -2050,6 +2052,7 @@ static void test_capture_3(HWND hwnd1, HWND hwnd2)
static void test_keyboard_input(HWND hwnd)
{
MSG msg;
BOOL ret;
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
......@@ -2064,21 +2067,24 @@ static void test_keyboard_input(HWND hwnd)
PostMessageA(hwnd, WM_KEYDOWN, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus());
PostThreadMessageA(GetCurrentThreadId(), WM_KEYDOWN, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(!msg.hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus());
keybd_event(VK_SPACE, 0, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
SetFocus(0);
ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
......@@ -2088,21 +2094,24 @@ static void test_keyboard_input(HWND hwnd)
PostMessageA(hwnd, WM_KEYDOWN, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
PostThreadMessageA(GetCurrentThreadId(), WM_KEYDOWN, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(!msg.hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
keybd_event(VK_SPACE, 0, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == hwnd && msg.message == WM_SYSKEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
}
static void test_mouse_input(HWND hwnd)
......@@ -2112,6 +2121,7 @@ static void test_mouse_input(HWND hwnd)
int x, y;
HWND popup;
MSG msg;
BOOL ret;
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
......@@ -2150,7 +2160,8 @@ static void test_mouse_input(HWND hwnd)
/* FIXME: SetCursorPos in Wine generates additional WM_MOUSEMOVE message */
if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
mouse_event(MOUSEEVENTF_MOVE, -1, -1, 0, 0);
ShowWindow(popup, SW_HIDE);
......@@ -2160,7 +2171,8 @@ static void test_mouse_input(HWND hwnd)
mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
ShowWindow(hwnd, SW_HIDE);
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
DestroyWindow(popup);
}
......
......@@ -218,12 +218,13 @@ void InternetOpenUrlA_test(void)
char protocol[32], hostName[1024], userName[1024];
char password[1024], extra[1024], path[1024];
DWORD size, readbytes, totalbytes=0;
BOOL ret;
myhinternet = InternetOpen("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
ok((myhinternet != 0), "InternetOpen failed, error %lx\n",GetLastError());
size = 0x400;
ok (InternetCanonicalizeUrl(TEST_URL, buffer, &size,ICU_BROWSER_MODE),
"InternetCanonicalizeUrl failed, error %lx\n",GetLastError());
ret = InternetCanonicalizeUrl(TEST_URL, buffer, &size,ICU_BROWSER_MODE);
ok( ret, "InternetCanonicalizeUrl failed, error %lx\n",GetLastError());
urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
urlComponents.lpszScheme = protocol;
......@@ -238,15 +239,16 @@ void InternetOpenUrlA_test(void)
urlComponents.dwUrlPathLength = 2048;
urlComponents.lpszExtraInfo = extra;
urlComponents.dwExtraInfoLength = 1024;
ok((InternetCrackUrl(TEST_URL, 0,0,&urlComponents)),
"InternetCrackUrl failed, error %lx\n",GetLastError());
ret = InternetCrackUrl(TEST_URL, 0,0,&urlComponents);
ok( ret, "InternetCrackUrl failed, error %lx\n",GetLastError());
SetLastError(0);
myhttp = InternetOpenUrl(myhinternet, TEST_URL, 0, 0,
INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);
if (GetLastError() == 12007)
return; /* WinXP returns this when not connected to the net */
ok((myhttp != 0),"InternetOpenUrl failed, error %lx\n",GetLastError());
ok(InternetReadFile(myhttp, buffer,0x400,&readbytes), "InternetReadFile failed, error %lx\n",GetLastError());
ret = InternetReadFile(myhttp, buffer,0x400,&readbytes);
ok( ret, "InternetReadFile failed, error %lx\n",GetLastError());
totalbytes += readbytes;
while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
totalbytes += readbytes;
......@@ -258,6 +260,7 @@ void InternetCrackUrl_test(void)
URL_COMPONENTSA urlComponents;
char protocol[32], hostName[1024], userName[1024];
char password[1024], extra[1024], path[1024];
BOOL ret;
urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
urlComponents.lpszScheme = protocol;
......@@ -272,8 +275,8 @@ void InternetCrackUrl_test(void)
urlComponents.dwUrlPathLength = 2048;
urlComponents.lpszExtraInfo = extra;
urlComponents.dwExtraInfoLength = 1024;
ok((InternetCrackUrl(TEST_URL, 0,0,&urlComponents)),
"InternetCrackUrl failed, error %lx\n",GetLastError());
ret = InternetCrackUrl(TEST_URL, 0,0,&urlComponents);
ok( ret, "InternetCrackUrl failed, error %lx\n",GetLastError());
ok((strcmp(TEST_URL_PATH,path) == 0),"path cracked wrong\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment