2 # Test script for the winetest program
9 ################################################################
10 # Declarations for functions we use in this script
12 wine
::declare
( "kernel32",
13 SetLastError
=> "void",
14 GetLastError
=> "int",
15 GlobalAddAtomA
=> "word",
16 GlobalGetAtomNameA
=> "int",
17 GetCurrentThread
=> "int",
18 GetExitCodeThread
=> "int",
19 GetModuleHandleA
=> "int",
20 GetProcAddress
=> "int",
24 ################################################################
25 # Test some simple function calls
27 # Test string arguments
28 $atom = GlobalAddAtomA
("foo");
29 assert
( $atom >= 0xc000 && $atom <= 0xffff );
30 assert
( !defined($wine::err
) );
32 # Test integer and string reference arguments
34 $ret = GlobalGetAtomNameA
( $atom, \
$buffer, length(buffer
) );
35 assert
( !defined($wine::err
) );
37 assert
( lc $buffer eq "foo\000xx" );
39 # Test integer reference
41 $ret = GetExitCodeThread
( GetCurrentThread
(), \
$code );
42 assert
( !defined($wine::err
) );
44 assert
( $code == 0x103 );
46 # Test string return value
47 $str = lstrcatA
( "foo\0foo", "bar" );
48 assert
( !defined($wine::err
) );
49 assert
( $str eq "foobar" );
51 ################################################################
52 # Test last error handling
55 $ret = GetLastError
();
56 assert
( $ret == 123 );
58 ################################################################
59 # Test various error cases
61 eval { SetLastError
(1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7); };
62 assert
( $@
=~ /Too many arguments at/ );
64 my $funcptr = GetProcAddress
( GetModuleHandleA
("kernel32"), "SetLastError" );
66 eval { wine
::call_wine_API
( $funcptr, 10, $wine::debug
, 0); };
67 assert
( $@
=~ /Bad return type 10 at/ );
69 eval { foobar
(1,2,3); };
70 assert
( $@
=~ /Function 'foobar' not declared at/ );