Re: Can we catch access violation exceptions in tests?

2007-05-07 Thread Marcus Meissner
On Mon, May 07, 2007 at 12:31:02PM +0200, Mikołaj Zalewski wrote:
>  I'm trying to write a tests for invalid cbSize in Shell_NotifyIcon. 
> The behaviour under Windows XP is to assume in such a case that the size 
> is NOTIFYICONDATA_V1_SIZE. AFAIK Shell_NotifyIcon doesn't provide a way 
> to read icon data to check that the data introduced after Win95 is not 
> modified. So I'm using VirtualAlloc+VirtualProtect to make 
> Shell_NotifyIcon fail if it tries to access this data.
>  I'd like to catch the exception to make a tests fail if something goes 
> wrong instead of crashing the testsuite. However __try doesn't work 
> under gcc and using wine/exception.h gives an unresolved symbol 
> '__wine_handle_exception'. Is it possible to catch exceptions in tests?

Of course.

Check dlls/ntdll/tests/exception.c::run_exception_test()

Ciao, Marcus




Re: Can we catch access violation exceptions in tests?

2007-05-07 Thread Damjan Jovanovic

On 5/7/07, Mikołaj Zalewski <[EMAIL PROTECTED]> wrote:

  I'm trying to write a tests for invalid cbSize in Shell_NotifyIcon.
The behaviour under Windows XP is to assume in such a case that the size
is NOTIFYICONDATA_V1_SIZE. AFAIK Shell_NotifyIcon doesn't provide a way
to read icon data to check that the data introduced after Win95 is not
modified. So I'm using VirtualAlloc+VirtualProtect to make
Shell_NotifyIcon fail if it tries to access this data.
  I'd like to catch the exception to make a tests fail if something goes
wrong instead of crashing the testsuite. However __try doesn't work
under gcc and using wine/exception.h gives an unresolved symbol
'__wine_handle_exception'. Is it possible to catch exceptions in tests?

Mikolaj Zalewski


#include "wine/exception.h"

__TRY
{
   /* code that can segfault */
}
__EXCEPT_PAGE_FAULT
{
   /* actions to take on segfault */
}
__ENDTRY

I'm not sure which library you have to link with.

Enjoy
Damjan



Can we catch access violation exceptions in tests?

2007-05-07 Thread Mikołaj Zalewski
 I'm trying to write a tests for invalid cbSize in Shell_NotifyIcon. 
The behaviour under Windows XP is to assume in such a case that the size 
is NOTIFYICONDATA_V1_SIZE. AFAIK Shell_NotifyIcon doesn't provide a way 
to read icon data to check that the data introduced after Win95 is not 
modified. So I'm using VirtualAlloc+VirtualProtect to make 
Shell_NotifyIcon fail if it tries to access this data.
 I'd like to catch the exception to make a tests fail if something goes 
wrong instead of crashing the testsuite. However __try doesn't work 
under gcc and using wine/exception.h gives an unresolved symbol 
'__wine_handle_exception'. Is it possible to catch exceptions in tests?


Mikolaj Zalewski