From b3da4abc5771a7542409412c41b3356255f248b2 Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Tue, 12 Nov 2002 01:05:17 +0000 Subject: [PATCH] Added tests for a few new DLLs. --- tools/winapi/c_parser.pm | 7 +- tools/winapi/c_type.pm | 19 ++- tools/winapi/tests.dat | 289 +++++++++++++++++++++++++++++++++++++++ tools/winapi/winapi_test | 11 +- 4 files changed, 312 insertions(+), 14 deletions(-) diff --git a/tools/winapi/c_parser.pm b/tools/winapi/c_parser.pm index 24c2aaee78d..4bc2939e1fe 100644 --- a/tools/winapi/c_parser.pm +++ b/tools/winapi/c_parser.pm @@ -2002,9 +2002,13 @@ sub parse_c_variable { $type = $self->_format_c_type("$sign$1$3"); $name = $2; + $finished = 1; + } elsif($self->_parse_c('DEFINE_GUID', \$_, \$line, \$column, \$match)) { # Windows specific + $type = $match; $finished = 1; } else { $self->_parse_c_warning($_, $line, $column, "variable", "'$_'"); + $finished = 1; } if($finished) { @@ -2012,9 +2016,6 @@ sub parse_c_variable { } elsif($self->_parse_c('SEQ_DEFINEBUF', \$_, \$line, \$column, \$match)) { # Linux specific $type = $match; $finished = 1; - } elsif($self->_parse_c('DEFINE_GUID', \$_, \$line, \$column, \$match)) { # Windows specific - $type = $match; - $finished = 1; } elsif($self->_parse_c('DEFINE_REGS_ENTRYPOINT_\w+|DPQ_DECL_\w+|HANDLER_DEF|IX86_ONLY', # Wine specific \$_, \$line, \$column, \$match)) { diff --git a/tools/winapi/c_type.pm b/tools/winapi/c_type.pm index ec789637e32..53885c8a3d6 100644 --- a/tools/winapi/c_type.pm +++ b/tools/winapi/c_type.pm @@ -256,7 +256,7 @@ sub _refresh { my $n = 0; foreach my $field ($self->fields) { my $type_name = $field->type_name; - my $size = &$$find_size($type_name); + my $type_size = &$$find_size($type_name); my $base_type_name = $type_name; if ($base_type_name =~ s/^(.*?)\s*(?:\[\s*(.*?)\s*\]|:(\d+))?$/$1/) { @@ -279,11 +279,11 @@ sub _refresh { $$kind = &$$find_kind($type_name) || ""; } - if (!defined($size)) { + if (!defined($type_size)) { $$align = undef; $$size = undef; return; - } elsif ($size >= 0) { + } elsif ($type_size >= 0) { if ($offset_bits) { $offset += $pack * int(($offset_bits + 8 * $pack - 1 ) / (8 * $pack)); $offset_bits = 0; @@ -292,16 +292,16 @@ sub _refresh { $$$field_aligns[$n] = $align; $$$field_base_sizes[$n] = $base_size; $$$field_offsets[$n] = $offset; - $$$field_sizes[$n] = $size; + $$$field_sizes[$n] = $type_size; - $offset += $size; + $offset += $type_size; } else { $$$field_aligns[$n] = $align; $$$field_base_sizes[$n] = $base_size; $$$field_offsets[$n] = $offset; - $$$field_sizes[$n] = $size; + $$$field_sizes[$n] = $type_size; - $offset_bits += -$size; + $offset_bits += -$type_size; } $n++; @@ -310,6 +310,11 @@ sub _refresh { $$align = $pack; $$align = $max_field_align if $max_field_align < $pack; + if ($offset_bits) { + $offset += $pack * int(($offset_bits + 8 * $pack - 1 ) / (8 * $pack)); + $offset_bits = 0; + } + $$size = $offset; if ($$kind =~ /^(?:struct|union)$/) { if ($$size % $$align != 0) { diff --git a/tools/winapi/tests.dat b/tools/winapi/tests.dat index 72379dfe5b6..f20fbc99947 100644 --- a/tools/winapi/tests.dat +++ b/tools/winapi/tests.dat @@ -849,6 +849,141 @@ __int32 !__int64 __int8 +%%%dlls/shell32/tests + +%%pack + +%description + +Unit tests for data structure packing + +%header + +basetsd.h +winnt.h +windef.h +wtypes.h +shellapi.h +shlobj.h + +%include + +stdarg.h +windef.h +wtypes.h +shellapi.h +shlobj.h + +%type + +APPBARDATA +BFFCALLBACK +BROWSEINFOA +BROWSEINFOW +CIDA +DRAGINFOA +DRAGINFOW +DROPFILES +FILEOP_FLAGS +IShellIcon +ITEMIDLIST +LPBROWSEINFOA +LPBROWSEINFOW +LPCITEMIDLIST +LPDRAGINFOA +LPDRAGINFOW +LPIDA +LPITEMIDLIST +LPSHDESCRIPTIONID +LPSHELLEXECUTEINFOA +LPSHELLEXECUTEINFOW +!LPSHELLFLAGSTATE +# LPSHELLVIEWDATA +LPSHFILEOPSTRUCTA +LPSHFILEOPSTRUCTW +LPSHITEMID +NOTIFYICONDATAA +NOTIFYICONDATAW +PAPPBARDATA +PBROWSEINFOA +PBROWSEINFOW +PNOTIFYICONDATAA +PNOTIFYICONDATAW +PRINTEROP_FLAGS +SHDESCRIPTIONID +SHELLEXECUTEINFOA +SHELLEXECUTEINFOW +!SHELLFLAGSTATE +# SHELLVIEWDATA +SHELLVIEWID +# SHELLVIEWPROC +SHFILEINFOA +SHFILEINFOW +SHFILEOPSTRUCTA +SHFILEOPSTRUCTW +SHITEMID + +%%%dlls/shlwapi/tests + +%%pack + +%description + +Unit tests for data structure packing + +%header + +basetsd.h +winnt.h +windef.h +wtypes.h +shlwapi.h + +%include + +windef.h +wtypes.h +shlwapi.h + +%type + +!ASSOCF +DLLGETVERSIONPROC +DLLVERSIONINFO +!DLLVERSIONINFO2 +HUSKEY +IQueryAssociations +PHUSKEY + +%%%dlls/urlmon/tests + +%%pack + +%description + +Unit tests for data structure packing + +%header + +basetsd.h +winnt.h +windef.h +urlmon.h + +%include + +windef.h +urlmon.h + +%type + +BINDINFO +IBindHost +IBindStatusCallback +IBinding +IWinInetHttpInfo +IWinInetInfo + %%%dlls/user/tests %%pack @@ -1115,3 +1250,157 @@ WNDCLASSEXW WNDCLASSW WNDENUMPROC WNDPROC + +%%%dlls/wininet/tests + +%%pack + +%description + +Unit tests for data structure packing + +%header + +basetsd.h +winnt.h +windef.h +winbase.h +wininet.h + +%include + +stdarg.h +windef.h +winbase.h +wininet.h + +%type + +!GOPHER_ABSTRACT_ATTRIBUTE_TYPEA +!GOPHER_ABSTRACT_ATTRIBUTE_TYPEW +GOPHER_ABSTRACT_ATTRIBUTE_TYPE +!GOPHER_ADMIN_ATTRIBUTE_TYPEA +!GOPHER_ADMIN_ATTRIBUTE_TYPEW +GOPHER_ADMIN_ATTRIBUTE_TYPE +!GOPHER_ASK_ATTRIBUTE_TYPEA +!GOPHER_ASK_ATTRIBUTE_TYPEW +GOPHER_ASK_ATTRIBUTE_TYPE +!GOPHER_ATTRIBUTE_ENUMERATORA +!GOPHER_ATTRIBUTE_ENUMERATORW +GOPHER_ATTRIBUTE_ENUMERATOR +!GOPHER_ATTRIBUTE_TYPEA +!GOPHER_ATTRIBUTE_TYPEW +GOPHER_ATTRIBUTE_TYPE +GOPHER_FIND_DATAA +GOPHER_FIND_DATAW +GOPHER_FIND_DATA +GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE +!GOPHER_LOCATION_ATTRIBUTE_TYPEA +!GOPHER_LOCATION_ATTRIBUTE_TYPEW +GOPHER_LOCATION_ATTRIBUTE_TYPE +GOPHER_MOD_DATE_ATTRIBUTE_TYPE +!GOPHER_ORGANIZATION_ATTRIBUTE_TYPEA +!GOPHER_ORGANIZATION_ATTRIBUTE_TYPEW +GOPHER_ORGANIZATION_ATTRIBUTE_TYPE +!GOPHER_PROVIDER_ATTRIBUTE_TYPEA +!GOPHER_PROVIDER_ATTRIBUTE_TYPEW +GOPHER_PROVIDER_ATTRIBUTE_TYPE +GOPHER_SCORE_ATTRIBUTE_TYPE +GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE +!GOPHER_SITE_ATTRIBUTE_TYPEA +!GOPHER_SITE_ATTRIBUTE_TYPEW +GOPHER_SITE_ATTRIBUTE_TYPE +GOPHER_TIMEZONE_ATTRIBUTE_TYPE +GOPHER_TTL_ATTRIBUTE_TYPE +!GOPHER_UNKNOWN_ATTRIBUTE_TYPEA +!GOPHER_UNKNOWN_ATTRIBUTE_TYPEW +GOPHER_UNKNOWN_ATTRIBUTE_TYPE +GOPHER_VERONICA_ATTRIBUTE_TYPE +!GOPHER_VERSION_ATTRIBUTE_TYPEA +!GOPHER_VERSION_ATTRIBUTE_TYPEW +GOPHER_VERSION_ATTRIBUTE_TYPE +!GOPHER_VIEW_ATTRIBUTE_TYPEA +!GOPHER_VIEW_ATTRIBUTE_TYPEW +GOPHER_VIEW_ATTRIBUTE_TYPE +!GROUPID +HINTERNET +HTTP_VERSION_INFO +INTERNET_ASYNC_RESULT +INTERNET_AUTH_NOTIFY_DATA +INTERNET_BUFFERSA +INTERNET_BUFFERSW +INTERNET_CACHE_ENTRY_INFOA +INTERNET_CACHE_ENTRY_INFOW +!INTERNET_CERTIFICATE_INFOA +!INTERNET_CERTIFICATE_INFOW +INTERNET_CERTIFICATE_INFO +INTERNET_CONNECTED_INFO +INTERNET_PORT +!INTERNET_PROXY_INFOA +!INTERNET_PROXY_INFOW +INTERNET_PROXY_INFO +INTERNET_STATUS_CALLBACK +INTERNET_VERSION_INFO +!LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEA +!LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEW +LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE +!LPGOPHER_ADMIN_ATTRIBUTE_TYPEA +!LPGOPHER_ADMIN_ATTRIBUTE_TYPEW +LPGOPHER_ADMIN_ATTRIBUTE_TYPE +!LPGOPHER_ASK_ATTRIBUTE_TYPEA +!LPGOPHER_ASK_ATTRIBUTE_TYPEW +LPGOPHER_ASK_ATTRIBUTE_TYPE +!LPGOPHER_ATTRIBUTE_TYPEA +!LPGOPHER_ATTRIBUTE_TYPEW +LPGOPHER_ATTRIBUTE_TYPE +LPGOPHER_FIND_DATAA +LPGOPHER_FIND_DATAW +LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE +!LPGOPHER_LOCATION_ATTRIBUTE_TYPEA +!LPGOPHER_LOCATION_ATTRIBUTE_TYPEW +LPGOPHER_LOCATION_ATTRIBUTE_TYPE +LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE +!LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEA +!LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEW +LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE +!LPGOPHER_PROVIDER_ATTRIBUTE_TYPEA +!LPGOPHER_PROVIDER_ATTRIBUTE_TYPEW +LPGOPHER_PROVIDER_ATTRIBUTE_TYPE +LPGOPHER_SCORE_ATTRIBUTE_TYPE +LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE +!LPGOPHER_SITE_ATTRIBUTE_TYPEA +!LPGOPHER_SITE_ATTRIBUTE_TYPEW +LPGOPHER_SITE_ATTRIBUTE_TYPE +LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE +LPGOPHER_TTL_ATTRIBUTE_TYPE +!LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEA +!LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEW +LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE +LPGOPHER_VERONICA_ATTRIBUTE_TYPE +!LPGOPHER_VERSION_ATTRIBUTE_TYPEA +!LPGOPHER_VERSION_ATTRIBUTE_TYPEW +LPGOPHER_VERSION_ATTRIBUTE_TYPE +!LPGOPHER_VIEW_ATTRIBUTE_TYPEA +!LPGOPHER_VIEW_ATTRIBUTE_TYPEW +LPGOPHER_VIEW_ATTRIBUTE_TYPE +LPHINTERNET +LPHTTP_VERSION_INFO +LPINTERNET_ASYNC_RESULT +LPINTERNET_BUFFERSA +LPINTERNET_BUFFERSW +LPINTERNET_CACHE_ENTRY_INFOA +LPINTERNET_CACHE_ENTRY_INFOW +!LPINTERNET_CERTIFICATE_INFOA +!LPINTERNET_CERTIFICATE_INFOW +LPINTERNET_CONNECTED_INFO +LPINTERNET_PORT +!LPINTERNET_PROXY_INFOA +!LPINTERNET_PROXY_INFOW +LPINTERNET_STATUS_CALLBACK +LPINTERNET_VERSION_INFO +LPURL_COMPONENTSA +LPURL_COMPONENTSW +PFN_AUTH_NOTIFY +PFN_DIAL_HANDLER +URL_COMPONENTSA +URL_COMPONENTSW diff --git a/tools/winapi/winapi_test b/tools/winapi/winapi_test index 9ed317c1734..6012ef9221d 100755 --- a/tools/winapi/winapi_test +++ b/tools/winapi/winapi_test @@ -157,6 +157,8 @@ my %defines = ( "LF_FACESIZE" => 32, "LF_FULLFACESIZE" => 64, "MAXIMUM_SUPPORTED_EXTENSION" => 512, + "MAX_GOPHER_DISPLAY_TEXT + 1" => 129, + "MAX_GOPHER_LOCATOR_LENGTH + 1" => 654, "MAX_PATH" => 260, "MAX_PROFILE_LEN" => 80, "OFS_MAXPATHNAME" => 128, @@ -233,7 +235,7 @@ sub _find_align_kind_size { $align = 4; $kind = "struct"; $size = 8; - } elsif (/^(?:LARGE_INTEGER|LONGLONG)$/) { + } elsif (/^(?:LARGE_INTEGER)$/) { $align = 4; $kind = "signed"; $size = 8; @@ -282,10 +284,10 @@ sub _find_align_kind_size { } elsif (defined($count)) { if ($count =~ /^\d+$/) { $size *= int($count); - } elsif (defined($count = $defines{$count})) { - $size *= int($count); + } elsif (defined(my $count2 = $defines{$count})) { + $size *= int($count2); } else { - $output->write("$type_name: can't parse type\n"); + $output->write("$type_name: can't parse type ('$_') ('$count')\n"); $size = undef; } } elsif (defined($bits)) { @@ -453,6 +455,7 @@ sub output_header { print OUT "\n"; print OUT "#define WINVER 0x0501\n"; + print OUT "#define _WIN32_IE 0x0501\n"; print OUT "#define _WIN32_WINNT 0x0501\n"; print OUT "\n"; print OUT "#define WINE_NOWINSOCK\n";