PSP manipulation from DPMI programs (Developers)
I see! I understood why you think that I should reimplement the Exec function.
Under Turbopascal the Exec copies the environment for child from _actual_ PSP/environment.
So in our case we do not have to change the Exec (int 21h/4b00h) implementation because it is enough to change PSP.
But it is not sure whether Freepascal also copies evironment from current PSP.
So you advice to write own Exec (int 21h/4b00h)
I looked to the FP/Exec sources and it is clear that it behaves differently.
It takes PSP/environment not from actual state but from time of the program start. So if I change the PSP/environment it will not have any influence to Freepascal's Exec. The FP/Exec creates the child's environemnt using the EnvStr(i:byte) function. So we have to look how the EnvStr works. The answer is that it extracts the environment variables from buffer ENVP.
The ENVP buffer is defined in the SYSTEM.PP:
envp:PPchar;public name 'operatingsystem_parameter_envp';
So we see that ENVP points to internal structure 'operatingsystem_parameter_envp'. I don't know when and when is this structire created (maybe even in the realmode before the protected mode is entered)
But the important thing is that the ENVP pointer can be redirected to own buffer.
If we do it we change the behaviour of the EnvStr function and also the Exec function.
---
DOS-u-akbar!
Complete thread:
- PSP manipulation from DPMI programs - Laaca, 16.02.2023, 00:02 (Developers)
- PSP manipulation from DPMI programs - Japheth, 16.02.2023, 05:25
- PSP manipulation from DPMI programs - tkchia, 16.02.2023, 11:18
- PSP manipulation from DPMI programs - Laaca, 16.02.2023, 19:46
- PSP manipulation from DPMI programs - tom, 16.02.2023, 20:16
- PSP manipulation from DPMI programs - Laaca, 16.02.2023, 20:48
- PSP manipulation from DPMI programs - tkchia, 16.02.2023, 21:23
- PSP manipulation from DPMI programs - tkchia, 16.02.2023, 21:28
- PSP manipulation from DPMI programs - tkchia, 16.02.2023, 21:35
- PSP manipulation from DPMI programs - Rugxulo, 17.02.2023, 08:35
- PSP manipulation from DPMI programs - tkchia, 17.02.2023, 11:21
- PSP manipulation from DPMI programs - marcov, 17.02.2023, 16:00
- PSP manipulation from DPMI programs - tkchia, 17.02.2023, 11:21
- PSP manipulation from DPMI programs - Laaca, 17.02.2023, 08:56
- PSP manipulation from DPMI programs - tkchia, 17.02.2023, 11:07
- PSP manipulation from DPMI programs - Laaca, 18.02.2023, 00:52
- PSP manipulation from DPMI programs - marcov, 17.02.2023, 16:02
- PSP manipulation from DPMI programs - tkchia, 17.02.2023, 11:07
- PSP manipulation from DPMI programs - Rugxulo, 17.02.2023, 08:35
- PSP manipulation from DPMI programs - tom, 16.02.2023, 20:16
- PSP manipulation from DPMI programs - Laaca, 16.02.2023, 19:46
- PSP manipulation from DPMI programs - tkchia, 16.02.2023, 11:26
- PSP manipulation from DPMI programs - tkchia, 16.02.2023, 17:14