From 5dadbf3289100b5a16f92eb64c501b113e7f39e1 Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Sat, 29 Apr 2000 14:24:11 +0000 Subject: [PATCH] - API files update - Minor bug fixes. - Added new option --cross-call-unicode-ascii for checking illegal Unicode to ASCII calls. --- tools/winapi_check/win32/shell32.api | 17 ++++++++---- tools/winapi_check/win32/shlwapi.api | 2 +- tools/winapi_check/winapi_check | 17 ++++++------ tools/winapi_check/winapi_local.pm | 35 ++++++++++++++++-------- tools/winapi_check/winapi_options.pm | 41 +++++++++++++++++++++------- tools/winapi_check/winapi_parser.pm | 2 +- 6 files changed, 78 insertions(+), 36 deletions(-) diff --git a/tools/winapi_check/win32/shell32.api b/tools/winapi_check/win32/shell32.api index 92dba72bda4..3c7143e6e9a 100644 --- a/tools/winapi_check/win32/shell32.api +++ b/tools/winapi_check/win32/shell32.api @@ -1,7 +1,6 @@ %long BOOL -BYTE COLORREF DWORD HANDLE @@ -11,13 +10,12 @@ HGLOBAL HMENU HICON HINSTANCE +HIMAGELIST HKEY -HMODULE HRESULT HWND INT LONG -LPARAM LRESULT UINT ULONG @@ -25,6 +23,7 @@ WCHAR WORD WPARAM + %long # --forbidden int @@ -36,7 +35,7 @@ DLLVERSIONINFO * DWORD * HICON * HIMAGELIST * -IDropTarget * +HWND * IShellFolder ** IStream * IUnknown * @@ -45,8 +44,14 @@ LPBYTE LPCITEMIDLIST LPCITEMIDLIST * LPCNOTIFYREGISTER +LPCRECT +LPCSHELLFOLDERVIEWINFO LPCVOID +LPCVOID * +LPDATAOBJECT LPDRAWITEMSTRUCT +LPDROPSOURCE +LPDROPTARGET LPDWORD LPFNCREATEINSTANCE LPFNFMCALLBACK @@ -56,12 +61,13 @@ LPITEMIDLIST * LPMALLOC * LPMEASUREITEMSTRUCT LPNOTIFYREGISTER +LPPOINT LPSECURITY_ATTRIBUTES LPSHELLEXECUTEINFOA LPSHELLEXECUTEINFOW LPSHELLFLAGSTATE LPSHELLFOLDER -LPSHELLVIEWDATA +LPSHELLVIEW * LPSHFILEOPSTRUCTA LPSHFILEOPSTRUCTW LPSTRRET @@ -73,6 +79,7 @@ LPVOID * LPWORD LPWSTR * PAPPBARDATA +PLONG PNOTIFYICONDATAA PNOTIFYICONDATAW POINT * diff --git a/tools/winapi_check/win32/shlwapi.api b/tools/winapi_check/win32/shlwapi.api index 76290c4e7b9..7d43fc9637e 100644 --- a/tools/winapi_check/win32/shlwapi.api +++ b/tools/winapi_check/win32/shlwapi.api @@ -1,7 +1,6 @@ %long BOOL -BYTE DWORD INT LONG @@ -31,6 +30,7 @@ LPSTR %void VOID +void %wstr diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check index 6fd4b3a400f..5a37036141f 100755 --- a/tools/winapi_check/winapi_check +++ b/tools/winapi_check/winapi_check @@ -54,14 +54,18 @@ if(length($wine_dir) != 1) { $current_dir =~ s/\/.$//; } -my $options = winapi_options->new(\@ARGV, $wine_dir); -if($options->help) { +my $output = 'output'->new; + +my $options = winapi_options->new($output, \@ARGV, $wine_dir); +if(!defined($options)) { + $output->write("usage: winapi_check [--help] []\n"); + + exit 1; +} elsif($options->help) { $options->show_help; exit; } -my $output = 'output'->new; - my $modules = 'modules'->new($options, $output, $wine_dir, $current_dir, "$winapi_check_dir/modules.dat"); my $win16api = 'winapi'->new($options, $output, "win16", "$winapi_check_dir/win16"); @@ -514,10 +518,7 @@ foreach my $file ($options->c_files) { if($nativeapi->is_conditional_header($header)) { if(!$preprocessor->is_def($macro)) { if($macro =~ /^HAVE_X11/) { - if(!$preprocessor->is_undef("X_DISPLAY_MISSING")) { - $output->write("$file: #$directive $argument: is a conditional include, " . - "but is not protected\n"); - } + # Do nothing X Windows is handled differently } elsif($macro =~ /^HAVE_(.*?)_H$/) { if($header ne "alloca.h" && !$preprocessor->is_def("STATFS_DEFINED_BY_$1")) { $output->write("$file: #$directive $argument: is a conditional include, " . diff --git a/tools/winapi_check/winapi_local.pm b/tools/winapi_check/winapi_local.pm index 1c7bf6cea8a..fc1fabb9478 100644 --- a/tools/winapi_check/winapi_local.pm +++ b/tools/winapi_check/winapi_local.pm @@ -185,18 +185,31 @@ sub check_file { my @called_names = $$functions{$name}->called_function_names; my @called_by_names = $$functions{$name}->called_by_function_names; my $module = $$functions{$name}->module; - my $module16 = $$functions{$name}->module16; - my $module32 = $$functions{$name}->module32; - if($#called_names >= 0 && (defined($module16) || defined($module32)) ) { - for my $called_name (@called_names) { - my $called_module16 = $$functions{$called_name}->module16; - my $called_module32 = $$functions{$called_name}->module32; - if(defined($module32) && - defined($called_module16) && !defined($called_module32) && - $name ne $called_name) - { - $output->write("$file: $module: $name: illegal call to $called_name (Win16)\n"); + if($options->cross_call_win32_win16) { + my $module16 = $$functions{$name}->module16; + my $module32 = $$functions{$name}->module32; + + if($#called_names >= 0 && (defined($module16) || defined($module32)) ) { + for my $called_name (@called_names) { + my $called_module16 = $$functions{$called_name}->module16; + my $called_module32 = $$functions{$called_name}->module32; + if(defined($module32) && + defined($called_module16) && !defined($called_module32) && + $name ne $called_name) + { + $output->write("$file: $module: $name: illegal call to $called_name (Win32 -> Win16)\n"); + } + } + } + } + + if($options->cross_call_unicode_ascii) { + if($name =~ /W$/) { + for my $called_name (@called_names) { + if($called_name =~ /A$/) { + $output->write("$file: $module: $name: illegal call to $called_name (Unicode -> ASCII)\n"); + } } } } diff --git a/tools/winapi_check/winapi_options.pm b/tools/winapi_check/winapi_options.pm index abdac383835..a66713f3f9d 100644 --- a/tools/winapi_check/winapi_options.pm +++ b/tools/winapi_check/winapi_options.pm @@ -61,6 +61,12 @@ my %options = ( "calling-convention" => { default => 0, parent => "local", description => "calling convention checking" }, "misplaced" => { default => 1, parent => "local", description => "check for misplaced functions" }, "cross-call" => { default => 0, parent => "local", description => "check for cross calling functions" }, + "cross-call-win32-win16" => { + default => 0, parent => "cross-call", description => "check for cross calls between win32 and win16" + }, + "cross-call-unicode-ascii" => { + default => 0, parent => "cross-call", description => "check for cross calls between Unicode and ASCII" + }, "documentation" => { default => 1, parent => "local", description => "check for documentation inconsistances\n" }, "documentation-width" => { default => 0, parent => "documentation", description => "check for documentation width inconsistances\n" }, @@ -85,8 +91,10 @@ sub new { my $self = {}; bless ($self, $class); + my $output = \${$self->{OUTPUT}}; + + $$output = shift; my $refarguments = shift; - my @ARGV = @$refarguments; my $wine_dir = shift; $self->options_set("default"); @@ -96,7 +104,13 @@ sub new { my $module = \${$self->{MODULE}}; my $global = \${$self->{GLOBAL}}; - while(defined($_ = shift @ARGV)) { + if($wine_dir eq ".") { + $$global = 1; + } else { + $$global = 0; + } + + while(defined($_ = shift @$refarguments)) { if(/^--(all|none)$/) { $self->options_set("$1"); next; @@ -121,8 +135,9 @@ sub new { $name = $1; $prefix = "no"; if(defined($value)) { - print STDERR ": options with prefix 'no' can't take parameters\n"; - exit 1; + $$output->write("options with prefix 'no' can't take parameters\n"); + + return undef; } } @@ -174,10 +189,16 @@ sub new { $$module = { active => 1, filter => 1, hash => \%names }; } elsif(/^-(.*)$/) { - print STDERR ": unknown option: $&\n"; - print STDERR ": usage: winapi-check [--help] []\n"; - exit 1; + $$output->write("unknown option: $_\n"); + + return undef; } else { + if(!-e $_) { + $$output->write("$_: no such file or directory\n"); + + return undef; + } + push @$c_files, $_; } } @@ -194,10 +215,10 @@ sub new { @$c_files = sort(map { s/^.\/(.*)$/$1/; - if(!/spec\.c$/) { - $_; - } else { + if(/glue\.c|spec\.c$/) { (); + } else { + $_; } } split(/\n/, `find $c_paths -name \\*.c`)); diff --git a/tools/winapi_check/winapi_parser.pm b/tools/winapi_check/winapi_parser.pm index 0c0864faf41..cfe246d2b94 100644 --- a/tools/winapi_check/winapi_parser.pm +++ b/tools/winapi_check/winapi_parser.pm @@ -221,7 +221,7 @@ sub parse_c_file { #print " " . ($n + 1) . ": '$argument'\n"; $argument =~ s/^(IN OUT(?=\s)|IN(?=\s)|OUT(?=\s)|\s*)\s*//; $argument =~ s/^(const(?=\s)|CONST(?=\s)|\s*)\s*//; - if($argument =~ /^...$/) { + if($argument =~ /^\.\.\.$/) { $argument = "..."; } elsif($argument =~ /^((struct\s+|union\s+|enum\s+)?\w+)\s*((\*\s*?)*)\s*/) { $argument = "$1";