Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mcb_walk.c: try querying UMB link state even if not on DOS 5+ #161

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

ecm-pushbx
Copy link
Contributor

@ecm-pushbx ecm-pushbx commented Feb 3, 2025

Current lMS-DOS still reports its version as v4.00 but does fully support a DOS-managed UMA. As of today lMS-DOS also supports the SHELLHIGH= directive. Like FreeDOS's this is implemented using the 21.4B80 extension. Although the internals differ, the outside observable behaviour is the DOS executable loader allocates both the environment and the process memory block into the UMA, if there are free UMBs. However, unlike LH the UMB link state is not enabled once the control flow is passed to the application. That means an environment block in a UMB isn't reachable when walking the MCBs without regard to proceeding past the first UMCB.

The MCB walker is used in FreeCOM's init to validate the environment block passed to it upon its startup. Reference:

/* Some elder DOSs may not pass an initializied environment segment */

If this check fails, then the shell will prompt for the position of its executable as follows. This patch makes the MCB walker enable the UMB link even if the reported DOS version is below 5, allowing it to find the environment block's UMCB and avoiding the prompt.

Failed to load the strings resource into memory, the location
pointed to in %COMSPEC% seems to be invalid. Please specify another
location of FreeCOM to try to load the strings from, e.g.:
C:\COMMAND.COM
or just hit enter to cancel to load the strings.

Current lMS-DOS still reports its version as v4.00 but does fully
support a DOS-managed UMA. As of today lMS-DOS also supports the
SHELLHIGH= directive. Like FreeDOS's this is implemented using
the 21.4B80 extension. Although the internals differ, the outside
observable behaviour is the DOS executable loader allocates both
the environment and the process memory block into the UMA, if
there are free UMBs. However, unlike LH the UMB link state is not
enabled once the control flow is passed to the application. That
means an environment block in a UMB isn't reachable when walking
the MCBs without regard to proceeding past the first UMCB.

The MCB walker is used in FreeCOM's init to validate the
environment block passed to it upon its startup. Reference:
https://github.com/FDOS/freecom/blob/cede733377c454cb93e9038d476582f0d1fcbf0a/shell/init.c#L238

If this check fails, then the shell will prompt for the position
of its executable as follows. This patch makes the MCB walker
enable the UMB link even if the reported DOS version is below 5,
allowing it to find the environment block's UMCB and avoiding
the prompt.

Failed to load the strings resource into memory, the location
pointed to in %COMSPEC% seems to be invalid. Please specify another
location of FreeCOM to try to load the strings from, e.g.:
C:\COMMAND.COM
or just hit enter to cancel to load the strings.
@ecm-pushbx
Copy link
Contributor Author

In this changeset lMS-DOS adds support for the FreeDOS extension of using the UMA if 21.4B80 is used: https://hg.pushbx.org/ecm/msdos4/rev/1a8906752b66

This is the changeset that adds SHELLHIGH= support: https://hg.pushbx.org/ecm/msdos4/rev/49f66d9e6f0f

@PerditionC PerditionC merged commit 74eddec into FDOS:master Feb 17, 2025
12 checks passed
@ecm-pushbx
Copy link
Contributor Author

Linked to this PR from SvarDOS/edrdos#55 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants