A program built with the mingw-w64 runtime imports fopen, fclose, fgets
and perror, and writes to the stream fopen returns with fprintf, fwrite
and fputs. The four did not resolve, and the output functions accepted
only stdout and stderr.
Adds the four services and file streams for the output functions. The
files are the ones on the in-memory C: drive behind CreateFileW, so a
file written through a C stream is the file ReadFile reads. Text mode,
the default, translates line ends as the fopen documentation describes.
Built on the standard streams from #400. Part of Gate A2.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
A program built with the mingw-w64 runtime prints through
__stdio_common_vfprintf on the stream __acrt_iob_func(1) returns, and
through fwrite, fputs, fflush and setvbuf. None resolved, and there was
nowhere for standard output to go that a host or a test could read.
Adds a formatting engine for the narrow printf family (d, i, u, o, x, X,
c, s, p and %% with their flags, width, precision and size prefixes), the
three standard streams, those six services, and capture of stdout and
stderr through ServicesState. Floating-point and wide conversions, a
locale, files and input are not modelled and stop the guest.
The engine is compared with the host C library's snprintf on 2,600
generated cases whose result ISO C defines.
Part of Gate A2.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
A program built with the mingw-w64 runtime gets argc, argv and envp for
main from __p___argc, __p___argv, __p__environ, _configure_narrow_argv
and _initialize_narrow_environment. None resolved, so the loader refused
the program before its entry point, and a host could not say what the
program's arguments are.
The five services are added to the typed registry, and
ServicesState::set_program_arguments lets a host supply argv. The
environment table is empty.
Part of Gate A2.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
A program built with the mingw-w64 runtime imports all three and does not
call them on a normal run. Without them the loader refused the program
before its entry point.
They are declared stub in the typed registry. A call stops the guest with
the runtime-limit fault and writes nothing, so a program that needs one
stops there and cannot run on with a made-up result.
Part of Gate A2.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
A program built with the mingw-w64 runtime imports _set_app_type,
_set_new_mode, _configthreadlocale, __setusermatherr,
_set_invalid_parameter_handler, __p__fmode, __p__commode, signal and
SetUnhandledExceptionFilter, and memcpy through
api-ms-win-crt-private-l1-1-0.dll. None resolved, so the loader refused
the program before its entry point.
Each service records what it is given and returns what its public
documentation says. Nothing acts on a recorded value yet, so all nine
are declared partial in the typed registry.
Part of Gate A2.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Parse import directories with one bounded parser shared by the static probe
and the binder, and resolve imports through one registry lookup. Refuse
conflicting registrations, keep ordinals apart from names, match API sets
exactly, and bind only when every import resolves.
Generate typed Win64 adapters, metadata and a coverage report from a
declarative service registry. Pass floating-point arguments and results in
XMM registers, and stop the guest if a service changes a nonvolatile
register. Make unimplemented generated wrappers fail explicitly.
Verify 20 services by calling them from translated guest code through bound
import slots, and the parser on damaged tables.
Refs #201, #270
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>