Commit ed04d36b authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Add more tests for old style hooks and winevent hooks, make them pass

under Wine.
parent 6b16f29f
......@@ -124,6 +124,12 @@ static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid,
WCHAR module[MAX_PATH];
DWORD len;
if (!proc)
{
SetLastError( ERROR_INVALID_FILTER_PROC );
return 0;
}
if (tid) /* thread-local hook */
{
if (id == WH_JOURNALRECORD ||
......@@ -143,7 +149,7 @@ static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid,
if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0;
else if (!inst || !(len = GetModuleFileNameW( inst, module, MAX_PATH )) || len >= MAX_PATH)
{
SetLastError( ERROR_INVALID_PARAMETER );
SetLastError( ERROR_HOOK_NEEDS_HMOD );
return 0;
}
}
......
......@@ -320,7 +320,14 @@ DECL_HANDLER(remove_hook)
{
struct hook *hook;
if (req->handle) hook = get_user_object( req->handle, USER_HOOK );
if (req->handle)
{
if (!(hook = get_user_object( req->handle, USER_HOOK )))
{
set_win32_error( ERROR_INVALID_HOOK_HANDLE );
return;
}
}
else
{
if (!req->proc || req->id < WH_MINHOOK || req->id > WH_MAXHOOK)
......@@ -329,9 +336,12 @@ DECL_HANDLER(remove_hook)
return;
}
if (!(hook = find_hook( current, req->id - WH_MINHOOK, req->proc )))
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
}
if (hook) remove_hook( hook );
remove_hook( hook );
}
......
......@@ -3210,6 +3210,7 @@ static const char *get_status_name( unsigned int status )
NAME(TIMEOUT),
NAME(USER_APC),
NAME(WAS_LOCKED),
NAME_WIN32(ERROR_INVALID_HOOK_HANDLE),
NAME_WIN32(ERROR_INVALID_INDEX),
NAME_WIN32(ERROR_NEGATIVE_SEEK),
NAME_WIN32(ERROR_SEEK),
......
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