- API files update
- Minor bug fixes.
- Added new option --cross-call-unicode-ascii for checking illegal
Unicode to ASCII calls.
diff --git a/tools/winapi_check/win32/shell32.api b/tools/winapi_check/win32/shell32.api
index 92dba72..3c7143e 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 @@
HMENU
HICON
HINSTANCE
+HIMAGELIST
HKEY
-HMODULE
HRESULT
HWND
INT
LONG
-LPARAM
LRESULT
UINT
ULONG
@@ -25,6 +23,7 @@
WORD
WPARAM
+
%long # --forbidden
int
@@ -36,7 +35,7 @@
DWORD *
HICON *
HIMAGELIST *
-IDropTarget *
+HWND *
IShellFolder **
IStream *
IUnknown *
@@ -45,8 +44,14 @@
LPCITEMIDLIST
LPCITEMIDLIST *
LPCNOTIFYREGISTER
+LPCRECT
+LPCSHELLFOLDERVIEWINFO
LPCVOID
+LPCVOID *
+LPDATAOBJECT
LPDRAWITEMSTRUCT
+LPDROPSOURCE
+LPDROPTARGET
LPDWORD
LPFNCREATEINSTANCE
LPFNFMCALLBACK
@@ -56,12 +61,13 @@
LPMALLOC *
LPMEASUREITEMSTRUCT
LPNOTIFYREGISTER
+LPPOINT
LPSECURITY_ATTRIBUTES
LPSHELLEXECUTEINFOA
LPSHELLEXECUTEINFOW
LPSHELLFLAGSTATE
LPSHELLFOLDER
-LPSHELLVIEWDATA
+LPSHELLVIEW *
LPSHFILEOPSTRUCTA
LPSHFILEOPSTRUCTW
LPSTRRET
@@ -73,6 +79,7 @@
LPWORD
LPWSTR *
PAPPBARDATA
+PLONG
PNOTIFYICONDATAA
PNOTIFYICONDATAW
POINT *
diff --git a/tools/winapi_check/win32/shlwapi.api b/tools/winapi_check/win32/shlwapi.api
index 76290c4..7d43fc9 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 @@
%void
VOID
+void
%wstr
diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check
index 6fd4b3a..5a37036 100755
--- a/tools/winapi_check/winapi_check
+++ b/tools/winapi_check/winapi_check
@@ -54,14 +54,18 @@
$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] [<files>]\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 @@
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 1c7bf6c..fc1fabb 100644
--- a/tools/winapi_check/winapi_local.pm
+++ b/tools/winapi_check/winapi_local.pm
@@ -185,18 +185,31 @@
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 abdac38..a66713f 100644
--- a/tools/winapi_check/winapi_options.pm
+++ b/tools/winapi_check/winapi_options.pm
@@ -61,6 +61,12 @@
"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 @@
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 @@
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 @@
$name = $1;
$prefix = "no";
if(defined($value)) {
- print STDERR "<internal>: 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 @@
$$module = { active => 1, filter => 1, hash => \%names };
}
elsif(/^-(.*)$/) {
- print STDERR "<internal>: unknown option: $&\n";
- print STDERR "<internal>: usage: winapi-check [--help] [<files>]\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 @@
@$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 0c0864f..cfe246d 100644
--- a/tools/winapi_check/winapi_parser.pm
+++ b/tools/winapi_check/winapi_parser.pm
@@ -221,7 +221,7 @@
#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";