mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
kernel32/tests: Remove win9x hacks.
This commit is contained in:
parent
907f94e144
commit
187f50aad3
@ -111,16 +111,6 @@ static void test_null_source(void)
|
||||
len, GLE);
|
||||
}
|
||||
|
||||
/* lstrcmpW is not supported on Win9x! */
|
||||
static int mylstrcmpW(const WCHAR* str1, const WCHAR* str2)
|
||||
{
|
||||
while (*str1 && *str1==*str2) {
|
||||
str1++;
|
||||
str2++;
|
||||
}
|
||||
return *str1-*str2;
|
||||
}
|
||||
|
||||
static void test_negative_source_length(void)
|
||||
{
|
||||
int len;
|
||||
@ -139,7 +129,7 @@ static void test_negative_source_length(void)
|
||||
SetLastError( 0xdeadbeef );
|
||||
memset(bufW,'x',sizeof(bufW));
|
||||
len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10);
|
||||
ok(len == 7 && !mylstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef,
|
||||
ok(len == 7 && !lstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef,
|
||||
"MultiByteToWideChar(-2002): len=%d error=%u\n", len, GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
|
@ -63,11 +63,6 @@ static void test_GetDriveTypeW(void)
|
||||
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
|
||||
{
|
||||
type = GetDriveTypeW(drive);
|
||||
if (type == DRIVE_UNKNOWN && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
win_skip("GetDriveTypeW is not available on Win9x\n");
|
||||
return;
|
||||
}
|
||||
ok(type > DRIVE_UNKNOWN && type <= DRIVE_RAMDISK,
|
||||
"not a valid drive %c: type %u\n", drive[0], type);
|
||||
|
||||
|
@ -476,9 +476,7 @@ static void test_message_from_string(void)
|
||||
memcpy(out, init_buf, sizeof(init_buf));
|
||||
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "", 0,
|
||||
0, out, sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)) ||
|
||||
broken(!strcmp("", out)), /* Win9x */
|
||||
"Expected the buffer to be untouched\n");
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)), "Expected the buffer to be untouched\n");
|
||||
ok(r==0, "succeeded: r=%d\n", r);
|
||||
ok(GetLastError()==0xdeadbeef,
|
||||
"last error %u\n", GetLastError());
|
||||
@ -510,29 +508,17 @@ static void test_message_from_string(void)
|
||||
memcpy(out, init_buf, sizeof(init_buf));
|
||||
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "%1", 0,
|
||||
0, out, sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)) ||
|
||||
broken(!strcmp("%1", out)), /* Win9x */
|
||||
"Expected the buffer to be untouched\n");
|
||||
ok(r==0 ||
|
||||
broken(r==2), /* Win9x */
|
||||
"succeeded: r=%d\n", r);
|
||||
ok(GetLastError()==ERROR_INVALID_PARAMETER ||
|
||||
broken(GetLastError()==0xdeadbeef), /* Win9x */
|
||||
"last error %u\n", GetLastError());
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)), "Expected the buffer to be untouched\n");
|
||||
ok(r==0, "succeeded: r=%d\n", r);
|
||||
ok(GetLastError()==ERROR_INVALID_PARAMETER, "last error %u\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
memcpy(out, init_buf, sizeof(init_buf));
|
||||
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, "%1", 0,
|
||||
0, out, sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)) ||
|
||||
broken(!strcmp("%1", out)), /* Win9x */
|
||||
"Expected the buffer to be untouched\n");
|
||||
ok(r==0 ||
|
||||
broken(r==2), /* Win9x */
|
||||
"succeeded: r=%d\n", r);
|
||||
ok(GetLastError()==ERROR_INVALID_PARAMETER ||
|
||||
broken(GetLastError()==0xdeadbeef), /* Win9x */
|
||||
"last error %u\n", GetLastError());
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)), "Expected the buffer to be untouched\n");
|
||||
ok(r==0, "succeeded: r=%d\n", r);
|
||||
ok(GetLastError()==ERROR_INVALID_PARAMETER, "last error %u\n", GetLastError());
|
||||
|
||||
/* using the format feature */
|
||||
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0,
|
||||
@ -766,12 +752,8 @@ static void test_message_from_string(void)
|
||||
/* line feed */
|
||||
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0,
|
||||
0, out, sizeof(out)/sizeof(CHAR));
|
||||
ok(!strcmp("hi ", out) ||
|
||||
broken(!strcmp("hi\r\n", out)), /* Win9x */
|
||||
"failed out=[%s]\n",out);
|
||||
ok(r==3 ||
|
||||
broken(r==4), /* Win9x */
|
||||
"failed: r=%d\n",r);
|
||||
ok(!strcmp("hi ", out), "failed out=[%s]\n",out);
|
||||
ok(r==3, "failed: r=%d\n",r);
|
||||
|
||||
/* carriage return line feed */
|
||||
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0,
|
||||
@ -821,9 +803,7 @@ static void test_message_ignore_inserts(void)
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "%0test", 0, 0, out,
|
||||
sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(ret == 0, "Expected FormatMessageA to return 0, got %d\n", ret);
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)) ||
|
||||
broken(!strcmp("", out)), /* Win9x */
|
||||
"Expected the output buffer to be untouched\n");
|
||||
ok(!memcmp(out, init_buf, sizeof(init_buf)), "Expected the output buffer to be untouched\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected GetLastError() to return 0xdeadbeef, got %u\n", GetLastError());
|
||||
|
||||
/* Insert sequences are ignored. */
|
||||
@ -835,12 +815,8 @@ static void test_message_ignore_inserts(void)
|
||||
/* Only the "%n", "%r", and "%t" escape sequences are processed. */
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "%%% %.%!", 0, 0, out,
|
||||
sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(ret == 8 ||
|
||||
broken(ret == 7) /* Win9x */,
|
||||
"Expected FormatMessageA to return 8, got %d\n", ret);
|
||||
ok(!strcmp("%%% %.%!", out) ||
|
||||
broken(!strcmp("%%% %.!", out)) /* Win9x */,
|
||||
"Expected output string \"%%%%%% %%.%%!\", got %s\n", out);
|
||||
ok(ret == 8, "Expected FormatMessageA to return 8, got %d\n", ret);
|
||||
ok(!strcmp("%%% %.%!", out), "Expected output string \"%%%%%% %%.%%!\", got %s\n", out);
|
||||
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "%n%r%t", 0, 0, out,
|
||||
sizeof(out)/sizeof(CHAR), NULL);
|
||||
@ -872,12 +848,8 @@ static void test_message_ignore_inserts(void)
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0, 0, out,
|
||||
sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(!strcmp("hi ", out) ||
|
||||
broken(!strcmp("hi\r\n", out)), /* Win9x */
|
||||
"Expected output string \"hi \", got %s\n", out);
|
||||
ok(ret == 3 ||
|
||||
broken(ret == 4), /* Win9x */
|
||||
"Expected FormatMessageA to return 3, got %d\n", ret);
|
||||
ok(!strcmp("hi ", out), "Expected output string \"hi \", got %s\n", out);
|
||||
ok(ret == 3, "Expected FormatMessageA to return 3, got %d\n", ret);
|
||||
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0, 0, out,
|
||||
@ -1105,17 +1077,13 @@ static void test_message_null_buffer(void)
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, 0, 0, NULL, 0, NULL);
|
||||
error = GetLastError();
|
||||
ok(!ret, "FormatMessageA returned %u\n", ret);
|
||||
ok(error == ERROR_INSUFFICIENT_BUFFER ||
|
||||
error == ERROR_INVALID_PARAMETER, /* win9x */
|
||||
"last error %u\n", error);
|
||||
ok(error == ERROR_INSUFFICIENT_BUFFER, "last error %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, 0, 0, NULL, 1, NULL);
|
||||
error = GetLastError();
|
||||
ok(!ret, "FormatMessageA returned %u\n", ret);
|
||||
ok(error == ERROR_INSUFFICIENT_BUFFER ||
|
||||
error == ERROR_INVALID_PARAMETER, /* win9x */
|
||||
"last error %u\n", error);
|
||||
ok(error == ERROR_INSUFFICIENT_BUFFER, "last error %u\n", error);
|
||||
|
||||
if (0) /* crashes on Windows */
|
||||
{
|
||||
@ -1127,25 +1095,19 @@ static void test_message_null_buffer(void)
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, 0, 0, NULL, 0, NULL);
|
||||
error = GetLastError();
|
||||
ok(!ret, "FormatMessageA returned %u\n", ret);
|
||||
ok(error == ERROR_NOT_ENOUGH_MEMORY ||
|
||||
error == ERROR_INVALID_PARAMETER, /* win9x */
|
||||
"last error %u\n", error);
|
||||
ok(error == ERROR_NOT_ENOUGH_MEMORY, "last error %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, 0, 0, NULL, 1, NULL);
|
||||
error = GetLastError();
|
||||
ok(!ret, "FormatMessageA returned %u\n", ret);
|
||||
ok(error == ERROR_NOT_ENOUGH_MEMORY ||
|
||||
error == ERROR_INVALID_PARAMETER, /* win9x */
|
||||
"last error %u\n", error);
|
||||
ok(error == ERROR_NOT_ENOUGH_MEMORY, "last error %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, 0, 0, NULL, 256, NULL);
|
||||
error = GetLastError();
|
||||
ok(!ret, "FormatMessageA returned %u\n", ret);
|
||||
ok(error == ERROR_NOT_ENOUGH_MEMORY ||
|
||||
error == ERROR_INVALID_PARAMETER, /* win9x */
|
||||
"last error %u\n", error);
|
||||
ok(error == ERROR_NOT_ENOUGH_MEMORY, "last error %u\n", error);
|
||||
}
|
||||
|
||||
static void test_message_null_buffer_wide(void)
|
||||
@ -1391,16 +1353,12 @@ static void test_message_from_hmodule(void)
|
||||
/* Test a message string with an insertion without passing any variadic arguments. */
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 193 /* ERROR_BAD_EXE_FORMAT */,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(ret == 0 ||
|
||||
broken(ret != 0), /* Win9x */
|
||||
"FormatMessageA returned non-zero\n");
|
||||
ok(ret == 0, "FormatMessageA returned non-zero\n");
|
||||
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE |
|
||||
FORMAT_MESSAGE_ARGUMENT_ARRAY, h, 193 /* ERROR_BAD_EXE_FORMAT */,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL);
|
||||
ok(ret == 0 ||
|
||||
broken(ret != 0), /* Win9x */
|
||||
"FormatMessageA returned non-zero\n");
|
||||
ok(ret == 0, "FormatMessageA returned non-zero\n");
|
||||
|
||||
/*Test nonexistent messageID with varying language ID's Note: FormatMessageW behaves the same*/
|
||||
SetLastError(0xdeadbeef);
|
||||
@ -1469,9 +1427,7 @@ static void test_message_invalid_flags(void)
|
||||
ptr = (char *)0xdeadbeef;
|
||||
ret = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER, "test", 0, 0, (char *)&ptr, 0, NULL);
|
||||
ok(ret == 0, "Expected FormatMessageA to return 0, got %u\n", ret);
|
||||
ok(ptr == NULL ||
|
||||
broken(ptr == (char *)0xdeadbeef), /* Win9x */
|
||||
"Expected output pointer to be initialized to NULL, got %p\n", ptr);
|
||||
ok(ptr == NULL, "Expected output pointer to be initialized to NULL, got %p\n", ptr);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
|
||||
GetLastError());
|
||||
|
@ -482,13 +482,6 @@ static void test_Loader(void)
|
||||
BOOL error_match;
|
||||
int error_index;
|
||||
|
||||
if (GetLastError() == ERROR_GEN_FAILURE) /* Win9x, broken behaviour */
|
||||
{
|
||||
trace("skipping the loader test on Win9x\n");
|
||||
DeleteFile(dll_name);
|
||||
return;
|
||||
}
|
||||
|
||||
error_match = FALSE;
|
||||
for (error_index = 0;
|
||||
! error_match && error_index < sizeof(td[i].errors) / sizeof(DWORD);
|
||||
|
@ -55,13 +55,8 @@ static int mailslot_test(void)
|
||||
|
||||
/* open a mailslot with a null name */
|
||||
hSlot = CreateMailslot( NULL, 0, 0, NULL );
|
||||
ok( hSlot == INVALID_HANDLE_VALUE || broken(hSlot != INVALID_HANDLE_VALUE), /* win9x */
|
||||
"Created mailslot with invalid name\n");
|
||||
if (hSlot == INVALID_HANDLE_VALUE)
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||
"error should be ERROR_PATH_NOT_FOUND\n");
|
||||
else /* succeeds on win9x */
|
||||
CloseHandle( hSlot );
|
||||
ok( hSlot == INVALID_HANDLE_VALUE, "Created mailslot with invalid name\n");
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND, "error should be ERROR_PATH_NOT_FOUND\n");
|
||||
|
||||
/* valid open, but with wacky parameters ... then check them */
|
||||
hSlot = CreateMailslot( szmspath, -1, -1, NULL );
|
||||
@ -85,7 +80,7 @@ static int mailslot_test(void)
|
||||
count = 0;
|
||||
memset(buffer, 0, sizeof buffer);
|
||||
ret = ReadFile( hSlot, buffer, sizeof buffer, &count, NULL);
|
||||
ok( !ret || broken(ret), /* win9x */ "slot read\n");
|
||||
ok( !ret, "slot read\n");
|
||||
if (!ret) ok( GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError() );
|
||||
else ok( count == 0, "wrong count %u\n", count );
|
||||
ok( !WriteFile( hSlot, buffer, sizeof buffer, &count, NULL),
|
||||
@ -102,8 +97,6 @@ static int mailslot_test(void)
|
||||
/* now open the client with the correct sharing mode */
|
||||
hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
|
||||
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hWriter == INVALID_HANDLE_VALUE) /* win9x doesn't like GENERIC_READ */
|
||||
hWriter = CreateFile(szmspath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
ok( hWriter != INVALID_HANDLE_VALUE, "existing mailslot err %u\n", GetLastError());
|
||||
|
||||
/*
|
||||
@ -111,7 +104,7 @@ static int mailslot_test(void)
|
||||
* whether we can read or write the mailslot
|
||||
*/
|
||||
ret = ReadFile( hSlot, buffer, sizeof buffer/2, &count, NULL);
|
||||
ok( !ret || broken(ret), /* win9x */ "slot read\n");
|
||||
ok( !ret, "slot read\n");
|
||||
if (!ret) ok( GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError() );
|
||||
else ok( count == 0, "wrong count %u\n", count );
|
||||
ok( !WriteFile( hSlot, buffer, sizeof buffer/2, &count, NULL),
|
||||
@ -143,7 +136,7 @@ static int mailslot_test(void)
|
||||
|
||||
/* but not again */
|
||||
ret = ReadFile( hSlot, buffer, sizeof buffer, &count, NULL);
|
||||
ok( !ret || broken(ret), /* win9x */ "slot read\n");
|
||||
ok( !ret, "slot read\n");
|
||||
if (!ret) ok( GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError() );
|
||||
else ok( count == 0, "wrong count %u\n", count );
|
||||
|
||||
@ -205,7 +198,7 @@ static int mailslot_test(void)
|
||||
|
||||
/* check there's still no data */
|
||||
ret = ReadFile( hSlot, buffer, sizeof buffer, &count, NULL);
|
||||
ok( !ret || broken(ret), /* win9x */ "slot read\n");
|
||||
ok( !ret, "slot read\n");
|
||||
if (!ret) ok( GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError() );
|
||||
else ok( count == 0, "wrong count %u\n", count );
|
||||
|
||||
@ -242,8 +235,7 @@ static int mailslot_test(void)
|
||||
"getmailslotinfo failed\n");
|
||||
ok( dwNext == 1, "dwNext incorrect\n");
|
||||
todo_wine
|
||||
ok( dwMsgCount == 3 || broken(dwMsgCount == 2), /* win9x */
|
||||
"dwMsgCount incorrect %u\n", dwMsgCount);
|
||||
ok( dwMsgCount == 3, "dwMsgCount incorrect %u\n", dwMsgCount);
|
||||
|
||||
buffer[0]=buffer[1]=0;
|
||||
|
||||
@ -262,8 +254,7 @@ static int mailslot_test(void)
|
||||
"getmailslotinfo failed\n");
|
||||
ok( dwNext == 2, "dwNext incorrect\n");
|
||||
todo_wine {
|
||||
ok( dwMsgCount == 2 || broken(dwMsgCount == 1), /* win9x */
|
||||
"dwMsgCount incorrect %u\n", dwMsgCount);
|
||||
ok( dwMsgCount == 2, "dwMsgCount incorrect %u\n", dwMsgCount);
|
||||
}
|
||||
|
||||
/* read the second message */
|
||||
@ -276,10 +267,9 @@ static int mailslot_test(void)
|
||||
dwNext = dwMsgCount = 0;
|
||||
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
|
||||
"getmailslotinfo failed\n");
|
||||
ok( dwNext == 0 || broken(dwNext == ~0u), /* win9x */ "dwNext incorrect %u\n", dwNext);
|
||||
ok( dwNext == 0, "dwNext incorrect %u\n", dwNext);
|
||||
todo_wine {
|
||||
ok( dwMsgCount == 1 || broken(dwMsgCount == 0), /* win9x */
|
||||
"dwMsgCount incorrect %u\n", dwMsgCount);
|
||||
ok( dwMsgCount == 1, "dwMsgCount incorrect %u\n", dwMsgCount);
|
||||
}
|
||||
|
||||
/* read the 3rd (zero length) message */
|
||||
@ -301,7 +291,7 @@ static int mailslot_test(void)
|
||||
|
||||
/* check that reads fail */
|
||||
ret = ReadFile( hSlot, buffer, sizeof buffer, &count, NULL);
|
||||
ok( !ret || broken(ret), /* win9x */ "3rd slot read succeeded\n");
|
||||
ok( !ret, "3rd slot read succeeded\n");
|
||||
if (!ret) ok( GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError() );
|
||||
else ok( count == 0, "wrong count %u\n", count );
|
||||
|
||||
@ -317,8 +307,7 @@ static int mailslot_test(void)
|
||||
memset(buffer, 0, sizeof buffer);
|
||||
dwTimeout = GetTickCount();
|
||||
ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "slot read\n");
|
||||
ok( GetLastError() == ERROR_SEM_TIMEOUT || broken(GetLastError() == ERROR_ACCESS_DENIED), /* win9x */
|
||||
"wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError() );
|
||||
dwTimeout = GetTickCount() - dwTimeout;
|
||||
ok( dwTimeout >= 990, "timeout too short %u\n", dwTimeout );
|
||||
ok( CloseHandle( hSlot ), "closing the mailslot\n");
|
||||
|
Loading…
Reference in New Issue
Block a user