Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Windows does not pass arguments to the entrypoint directly #25

Description

@TheNNX

In Win32 applications, the entrypoint present in PE headers and invoked on program start does not have any parameters. Functions like WinMain are not the real entrypoint of the program - instead, a function (usually provided by the compiler) like WinMainCRTStartup is used to get things like command line arguments, initialise the C/C++ runtime, and to call the "higher-level entrypoint".

Judging by function names, programs compiled for WinCE seem to have a CRT startup routines, but they expect the arguments from the operating system. Because no arguments are provided by the OS, the program, for example, has no access to the command line arguments.

Compare stack traces with debug symbols between a Win32 application, and a WinCE one:

Win32:
obraz
WinCE (not showing anything above that in that stacktrace, as it seems that at least for solitaire.exe, CRT startup function is the only entrypoint - the main program loop is there):
obraz

Using a dirty hack that violates many best practices to call the entrypoint from COREDLL!DllMain, implementing some functions, clicking through a few stub messages, and making some other minor tweaks, it is possible to run WinCE cmd.exe, albeit it doesn't really work that great.
obraz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions