Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

PSP manipulation from DPMI programs (Developers)

posted by Laaca Homepage, Czech republic, 17.02.2023, 08:56

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. :hungry:

---
DOS-u-akbar!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 246 users online (0 registered, 246 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum