Automatically generate the list of error names in make_requests.
This commit is contained in:
parent
68a4da07eb
commit
830d1edb9d
119
server/trace.c
119
server/trace.c
|
@ -3691,68 +3691,79 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||||
"set_mailslot_info",
|
"set_mailslot_info",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ### make_requests end ### */
|
|
||||||
/* Everything above this line is generated automatically by tools/make_requests */
|
|
||||||
|
|
||||||
static const char *get_status_name( unsigned int status )
|
|
||||||
{
|
|
||||||
#define NAME(status) { #status, STATUS_##status }
|
|
||||||
#define NAME_WIN32(error) { #error, 0xc0010000 | error }
|
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
} status_names[] =
|
} status_names[] =
|
||||||
{
|
{
|
||||||
NAME(ACCESS_DENIED),
|
{ "ACCESS_DENIED", STATUS_ACCESS_DENIED },
|
||||||
NAME(ACCESS_VIOLATION),
|
{ "ACCESS_VIOLATION", STATUS_ACCESS_VIOLATION },
|
||||||
NAME(ALIAS_EXISTS),
|
{ "ALIAS_EXISTS", STATUS_ALIAS_EXISTS },
|
||||||
NAME(BUFFER_OVERFLOW),
|
{ "BUFFER_OVERFLOW", STATUS_BUFFER_OVERFLOW },
|
||||||
NAME(CHILD_MUST_BE_VOLATILE),
|
{ "BUFFER_TOO_SMALL", STATUS_BUFFER_TOO_SMALL },
|
||||||
NAME(DIRECTORY_NOT_EMPTY),
|
{ "CHILD_MUST_BE_VOLATILE", STATUS_CHILD_MUST_BE_VOLATILE },
|
||||||
NAME(DISK_FULL),
|
{ "DEVICE_BUSY", STATUS_DEVICE_BUSY },
|
||||||
NAME(DLL_NOT_FOUND),
|
{ "DIRECTORY_NOT_EMPTY", STATUS_DIRECTORY_NOT_EMPTY },
|
||||||
NAME(FILE_IS_A_DIRECTORY),
|
{ "DISK_FULL", STATUS_DISK_FULL },
|
||||||
NAME(FILE_LOCK_CONFLICT),
|
{ "DLL_NOT_FOUND", STATUS_DLL_NOT_FOUND },
|
||||||
NAME(INVALID_FILE_FOR_SECTION),
|
{ "ERROR_CLASS_ALREADY_EXISTS", 0xc0010000 | ERROR_CLASS_ALREADY_EXISTS },
|
||||||
NAME(INVALID_HANDLE),
|
{ "ERROR_CLASS_DOES_NOT_EXIST", 0xc0010000 | ERROR_CLASS_DOES_NOT_EXIST },
|
||||||
NAME(INVALID_PARAMETER),
|
{ "ERROR_CLASS_HAS_WINDOWS", 0xc0010000 | ERROR_CLASS_HAS_WINDOWS },
|
||||||
NAME(KEY_DELETED),
|
{ "ERROR_CLIPBOARD_NOT_OPEN", 0xc0010000 | ERROR_CLIPBOARD_NOT_OPEN },
|
||||||
NAME(MEDIA_WRITE_PROTECTED),
|
{ "ERROR_INVALID_INDEX", 0xc0010000 | ERROR_INVALID_INDEX },
|
||||||
NAME(MUTANT_NOT_OWNED),
|
{ "ERROR_SEEK", 0xc0010000 | ERROR_SEEK },
|
||||||
NAME(NOT_A_DIRECTORY),
|
{ "FILE_INVALID", STATUS_FILE_INVALID },
|
||||||
NAME(NOT_IMPLEMENTED),
|
{ "FILE_IS_A_DIRECTORY", STATUS_FILE_IS_A_DIRECTORY },
|
||||||
NAME(NOT_REGISTRY_FILE),
|
{ "FILE_LOCK_CONFLICT", STATUS_FILE_LOCK_CONFLICT },
|
||||||
NAME(NO_DATA_DETECTED),
|
{ "HANDLE_NOT_CLOSABLE", STATUS_HANDLE_NOT_CLOSABLE },
|
||||||
NAME(NO_MEMORY),
|
{ "INVALID_CID", STATUS_INVALID_CID },
|
||||||
NAME(NO_MORE_ENTRIES),
|
{ "INVALID_FILE_FOR_SECTION", STATUS_INVALID_FILE_FOR_SECTION },
|
||||||
NAME(NO_MORE_FILES),
|
{ "INVALID_HANDLE", STATUS_INVALID_HANDLE },
|
||||||
NAME(NO_SUCH_FILE),
|
{ "INVALID_PARAMETER", STATUS_INVALID_PARAMETER },
|
||||||
NAME(OBJECT_NAME_COLLISION),
|
{ "IO_TIMEOUT", STATUS_IO_TIMEOUT },
|
||||||
NAME(OBJECT_NAME_INVALID),
|
{ "KEY_DELETED", STATUS_KEY_DELETED },
|
||||||
NAME(OBJECT_NAME_NOT_FOUND),
|
{ "MEDIA_WRITE_PROTECTED", STATUS_MEDIA_WRITE_PROTECTED },
|
||||||
NAME(OBJECT_PATH_INVALID),
|
{ "MUTANT_NOT_OWNED", STATUS_MUTANT_NOT_OWNED },
|
||||||
NAME(OBJECT_TYPE_MISMATCH),
|
{ "NOT_ALL_ASSIGNED", STATUS_NOT_ALL_ASSIGNED },
|
||||||
NAME(PENDING),
|
{ "NOT_A_DIRECTORY", STATUS_NOT_A_DIRECTORY },
|
||||||
NAME(PIPE_BUSY),
|
{ "NOT_IMPLEMENTED", STATUS_NOT_IMPLEMENTED },
|
||||||
NAME(PIPE_CONNECTED),
|
{ "NOT_REGISTRY_FILE", STATUS_NOT_REGISTRY_FILE },
|
||||||
NAME(PIPE_DISCONNECTED),
|
{ "NO_DATA_DETECTED", STATUS_NO_DATA_DETECTED },
|
||||||
NAME(PIPE_LISTENING),
|
{ "NO_IMPERSONATION_TOKEN", STATUS_NO_IMPERSONATION_TOKEN },
|
||||||
NAME(PIPE_NOT_AVAILABLE),
|
{ "NO_MEMORY", STATUS_NO_MEMORY },
|
||||||
NAME(SEMAPHORE_LIMIT_EXCEEDED),
|
{ "NO_MORE_ENTRIES", STATUS_NO_MORE_ENTRIES },
|
||||||
NAME(SHARING_VIOLATION),
|
{ "NO_MORE_FILES", STATUS_NO_MORE_FILES },
|
||||||
NAME(SUSPEND_COUNT_EXCEEDED),
|
{ "NO_SUCH_DEVICE", STATUS_NO_SUCH_DEVICE },
|
||||||
NAME(TIMEOUT),
|
{ "NO_SUCH_FILE", STATUS_NO_SUCH_FILE },
|
||||||
NAME(USER_APC),
|
{ "NO_TOKEN", STATUS_NO_TOKEN },
|
||||||
NAME(WAS_LOCKED),
|
{ "OBJECT_NAME_COLLISION", STATUS_OBJECT_NAME_COLLISION },
|
||||||
NAME_WIN32(ERROR_INVALID_INDEX),
|
{ "OBJECT_NAME_INVALID", STATUS_OBJECT_NAME_INVALID },
|
||||||
NAME_WIN32(ERROR_INVALID_THREAD_ID),
|
{ "OBJECT_NAME_NOT_FOUND", STATUS_OBJECT_NAME_NOT_FOUND },
|
||||||
NAME_WIN32(ERROR_NEGATIVE_SEEK),
|
{ "OBJECT_PATH_INVALID", STATUS_OBJECT_PATH_INVALID },
|
||||||
NAME_WIN32(ERROR_SEEK),
|
{ "OBJECT_TYPE_MISMATCH", STATUS_OBJECT_TYPE_MISMATCH },
|
||||||
{ NULL, 0 } /* terminator */
|
{ "PENDING", STATUS_PENDING },
|
||||||
|
{ "PIPE_BUSY", STATUS_PIPE_BUSY },
|
||||||
|
{ "PIPE_CONNECTED", STATUS_PIPE_CONNECTED },
|
||||||
|
{ "PIPE_DISCONNECTED", STATUS_PIPE_DISCONNECTED },
|
||||||
|
{ "PIPE_LISTENING", STATUS_PIPE_LISTENING },
|
||||||
|
{ "PIPE_NOT_AVAILABLE", STATUS_PIPE_NOT_AVAILABLE },
|
||||||
|
{ "PRIVILEGE_NOT_HELD", STATUS_PRIVILEGE_NOT_HELD },
|
||||||
|
{ "SECTION_TOO_BIG", STATUS_SECTION_TOO_BIG },
|
||||||
|
{ "SEMAPHORE_LIMIT_EXCEEDED", STATUS_SEMAPHORE_LIMIT_EXCEEDED },
|
||||||
|
{ "SHARING_VIOLATION", STATUS_SHARING_VIOLATION },
|
||||||
|
{ "SUSPEND_COUNT_EXCEEDED", STATUS_SUSPEND_COUNT_EXCEEDED },
|
||||||
|
{ "TIMEOUT", STATUS_TIMEOUT },
|
||||||
|
{ "UNSUCCESSFUL", STATUS_UNSUCCESSFUL },
|
||||||
|
{ "WAS_LOCKED", STATUS_WAS_LOCKED },
|
||||||
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
#undef NAME
|
|
||||||
|
|
||||||
|
/* ### make_requests end ### */
|
||||||
|
/* Everything above this line is generated automatically by tools/make_requests */
|
||||||
|
|
||||||
|
static const char *get_status_name( unsigned int status )
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
static char buffer[10];
|
static char buffer[10];
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,30 @@ sub GET_PROTOCOL_VERSION()
|
||||||
return $protocol;
|
return $protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Retrieve the list of status and errors used in the server
|
||||||
|
|
||||||
|
sub GET_ERROR_NAMES()
|
||||||
|
{
|
||||||
|
my %errors = ();
|
||||||
|
foreach my $f (glob "server/*.c")
|
||||||
|
{
|
||||||
|
open FILE, $f or die "Can't open $f";
|
||||||
|
while (<FILE>)
|
||||||
|
{
|
||||||
|
if (/set_error\s*\(\s*STATUS_(\w+)\s*\)/)
|
||||||
|
{
|
||||||
|
$errors{$1} = "STATUS_$1";
|
||||||
|
}
|
||||||
|
elsif (/set_win32_error\s*\(\s*(\w+)\s*\)/)
|
||||||
|
{
|
||||||
|
$errors{$1} = "0xc0010000 | $1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close FILE;
|
||||||
|
}
|
||||||
|
return %errors;
|
||||||
|
}
|
||||||
|
|
||||||
### Replace the contents of a file between ### make_requests ### marks
|
### Replace the contents of a file between ### make_requests ### marks
|
||||||
|
|
||||||
sub REPLACE_IN_FILE($@)
|
sub REPLACE_IN_FILE($@)
|
||||||
|
@ -252,6 +276,8 @@ sub REPLACE_IN_FILE($@)
|
||||||
# Get the server protocol version
|
# Get the server protocol version
|
||||||
my $protocol = GET_PROTOCOL_VERSION();
|
my $protocol = GET_PROTOCOL_VERSION();
|
||||||
|
|
||||||
|
my %errors = GET_ERROR_NAMES();
|
||||||
|
|
||||||
### Create server_protocol.h and print header
|
### Create server_protocol.h and print header
|
||||||
|
|
||||||
open SERVER_PROT, ">include/wine/server_protocol.h" or die "Cannot create include/wine/server_protocol.h";
|
open SERVER_PROT, ">include/wine/server_protocol.h" or die "Cannot create include/wine/server_protocol.h";
|
||||||
|
@ -309,6 +335,18 @@ foreach my $req (@requests)
|
||||||
{
|
{
|
||||||
push @trace_lines, " \"$req\",\n";
|
push @trace_lines, " \"$req\",\n";
|
||||||
}
|
}
|
||||||
|
push @trace_lines, "};\n\n";
|
||||||
|
|
||||||
|
push @trace_lines, "static const struct\n{\n";
|
||||||
|
push @trace_lines, " const char *name;\n";
|
||||||
|
push @trace_lines, " unsigned int value;\n";
|
||||||
|
push @trace_lines, "} status_names[] =\n{\n";
|
||||||
|
|
||||||
|
foreach my $err (sort keys %errors)
|
||||||
|
{
|
||||||
|
push @trace_lines, sprintf(" { %-30s %s },\n", "\"$err\",", $errors{$err});
|
||||||
|
}
|
||||||
|
push @trace_lines, " { NULL, 0 }\n";
|
||||||
push @trace_lines, "};\n";
|
push @trace_lines, "};\n";
|
||||||
|
|
||||||
REPLACE_IN_FILE( "server/trace.c", @trace_lines );
|
REPLACE_IN_FILE( "server/trace.c", @trace_lines );
|
||||||
|
|
Loading…
Reference in New Issue