diff --git a/tools/winapi/options.pm b/tools/winapi/options.pm index 277622bc524..ad2a7155388 100644 --- a/tools/winapi/options.pm +++ b/tools/winapi/options.pm @@ -296,7 +296,7 @@ sub options_set { if(/^default$/) { $$refvalue = $$option{default}; } elsif(/^all$/) { - if($name !~ /^help|debug|verbose|module$/) { + if($name !~ /^(?:help|debug|verbose|module)$/) { if(ref($$refvalue) ne "HASH") { $$refvalue = 1; } else { @@ -304,7 +304,7 @@ sub options_set { } } } elsif(/^none$/) { - if($name !~ /^help|debug|verbose|module$/) { + if($name !~ /^(?:help|debug|verbose|module)$/) { if(ref($$refvalue) ne "HASH") { $$refvalue = 0; } else { @@ -367,8 +367,6 @@ sub show_help { } } if($default == $current) { - $output->write("$description (default)\n"); - } else { $output->write("$description\n"); } } diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api index c21fc090554..4032b287c4c 100644 --- a/tools/winapi/win32.api +++ b/tools/winapi/win32.api @@ -159,6 +159,48 @@ void LPCWSTR LPWSTR +%%cabinet.dll + +%long + +BOOL +HFCI +HFDI +INT_PTR +TCOMP +USHORT +int + +%ptr + +PCCAB +PERF +PFDICABINETINFO +PFNALLOC +PFNCLOSE +PFNFCIALLOC +PFNFCICLOSE +PFNFCIDELETE +PFNFCIFILEPLACED +PFNFCIFREE +PFNFCIGETNEXTCABINET +PFNFCIGETOPENINFO +PFNFCIGETTEMPFILE +PFNFCIOPEN +PFNFCIREAD +PFNFCISEEK +PFNFCISTATUS +PFNFCIWRITE +PFNFDIDECRYPT +PFNFDINOTIFY +PFNFREE +PFNOPEN +PFNREAD +PFNSEEK +PFNWRITE +char * +void * + %%comcat.dll %long @@ -881,6 +923,7 @@ LPVOID LPVOID * LPWORD LPWSTR * +MEMMANINFO * NUMBERFMTA * NUMBERFMTW * OFSTRUCT * @@ -1270,6 +1313,7 @@ __non_rtti_object * _onexit_t _onexit_t ** _se_translator_function +_stati64 * bad_cast * bad_typeid * char * @@ -1459,6 +1503,7 @@ LPCVOID * LPDWORD LPDWORD * LPRTL_RWLOCK +LPTIME_ZONE_INFORMATION LPVOID LPVOID * LPWSTR * @@ -1504,6 +1549,7 @@ PVOID PVOID * RTL_CRITICAL_SECTION * STRING * +TIME_ZONE_INFORMATION * UINT * ULONG * ULONGLONG * @@ -2984,6 +3030,7 @@ INTERNET_STATUS_CALLBACK LPBYTE LPCSTR * LPCVOID +LPCWSTR * LPDWORD LPINTERNET_BUFFERSA LPINTERNET_BUFFERSW @@ -3194,6 +3241,8 @@ LPWSAOVERLAPPED LPWSAOVERLAPPED_COMPLETION_ROUTINE LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFOW +LPWSASERVICECLASSINFOA +LPWSASERVICECLASSINFOW WS_fd_set * char * int * diff --git a/tools/winapi/winapi.pm b/tools/winapi/winapi.pm index ab4b5cf1f1f..a95ee51a7ec 100644 --- a/tools/winapi/winapi.pm +++ b/tools/winapi/winapi.pm @@ -40,6 +40,10 @@ sub import { &Exporter::import(@_); $Exporter::ExportLevel--; + if (defined($modules) && defined($win16api) && defined($win32api)) { + return; + } + require modules; import modules qw($modules); @@ -286,6 +290,7 @@ sub parse_spec_file { if($flags =~ /(?:-register|-interrupt)/) { if($arguments) { $arguments .= " "; } $arguments .= "ptr"; + $calling_convention .= " -register"; } if($external_name ne "@") { diff --git a/tools/winapi/winapi_check_options.pm b/tools/winapi/winapi_check_options.pm index 03c060e01b2..fd85ef700a7 100644 --- a/tools/winapi/winapi_check_options.pm +++ b/tools/winapi/winapi_check_options.pm @@ -76,7 +76,7 @@ my %options_long = ( "calling-convention-win32" => { default => 1, parent => "calling-convention", description => "calling convention checking (Win32)" }, "misplaced" => { default => 1, parent => "local", description => "check for misplaced functions" }, "statements" => { default => 0, parent => "local", description => "check for statements inconsistances" }, - "cross-call" => { default => 0, parent => "statements", description => "check for cross calling functions" }, + "cross-call" => { default => 0, parent => ["statements", "win16", "win32"], description => "check for cross calling functions" }, "cross-call-win32-win16" => { default => 0, parent => "cross-call", description => "check for cross calls between win32 and win16" }, diff --git a/tools/winapi_check/modules.dat b/tools/winapi_check/modules.dat index 0994476a8b8..208f3a1ce20 100644 --- a/tools/winapi_check/modules.dat +++ b/tools/winapi_check/modules.dat @@ -16,6 +16,10 @@ dlls/avifil32 dlls/avifil32 +% dlls/cabinet/cabinet.spec + +dlls/cabinet + % dlls/comcat/comcat.spec dlls/comcat diff --git a/tools/winapi_check/modules.pm b/tools/winapi_check/modules.pm index 82ac2e42c0e..daa91ae3807 100644 --- a/tools/winapi_check/modules.pm +++ b/tools/winapi_check/modules.pm @@ -44,6 +44,10 @@ sub import { &Exporter::import(@_); $Exporter::ExportLevel--; + if (defined($modules)) { + return; + } + $modules = 'modules'->new; } diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check index af77595a07f..d31b581e444 100755 --- a/tools/winapi_check/winapi_check +++ b/tools/winapi_check/winapi_check @@ -61,10 +61,9 @@ use winapi_local; use winapi_global; use winapi_parser; -my %declared_functions; - my %include2info; -{ + +if ($options->global) { my @files = get_h_files("winelib"); my $progress_current = 0; @@ -152,6 +151,8 @@ if(1) { my $progress_current = 0; my $progress_max = scalar(@c_files); +my %declared_functions; + if($options->headers) { $progress_max += scalar(@h_files); @@ -340,14 +341,9 @@ foreach my $file (@c_files) { } } - foreach my $module ($function->modules) { - $module2functions{$module}{$internal_name} = $function; - - my @types = ($return_type); - - my $refargument_types = $function->argument_types; - if(defined($refargument_types)) { - push @types, @$refargument_types; + if ($options->global) { + foreach my $module ($function->modules) { + $module2functions{$module}{$internal_name} = $function; } } diff --git a/tools/winapi_check/winapi_local.pm b/tools/winapi_check/winapi_local.pm index 93c61135d21..898551f0fe9 100644 --- a/tools/winapi_check/winapi_local.pm +++ b/tools/winapi_check/winapi_local.pm @@ -150,6 +150,12 @@ sub _check_function { my $declared_calling_convention = $winapi->function_internal_calling_convention($internal_name); my @declared_argument_kinds = split(/\s+/, $winapi->function_internal_arguments($internal_name)); + my $declared_register = 0; + if ($declared_calling_convention =~ /^(\w+) -register$/) { + $declared_register = 1; + $declared_calling_convention = $1; + } + if($implemented_calling_convention ne $declared_calling_convention && $implemented_calling_convention ne "asm" && !($declared_calling_convention =~ /^pascal/ && $forbidden_return_type) && @@ -179,7 +185,7 @@ sub _check_function { } if($#argument_types != -1 && $argument_types[$#argument_types] eq "CONTEXT *" && - $internal_name !~ /^(Get|Set)ThreadContext$/) # FIXME: Kludge + $internal_name =~ /^(?:RtlRaiseException|RtlUnwind|NtRaiseException)$/) # FIXME: Kludge { $#argument_types--; } @@ -220,6 +226,10 @@ sub _check_function { } } @argument_types; + if ($declared_register && $argument_kinds[$#argument_kinds] ne "context86") { + $output->write("function declared as register, but CONTEXT86 * is not last argument\n"); + } + for my $n (0..$#argument_kinds) { if(!defined($argument_kinds[$n]) || !defined($declared_argument_kinds[$n])) { next; }