Mail Archives: djgpp/2011/12/03/19:45:18
"Georg" <dosusb AT googlemail DOT com> wrote in message
news:cc43d375-8e59-425d-a32e-b4ca200ae5cc AT 4g2000yqu DOT googlegroups DOT com...
>
> thank you for your message. I tried to follow your suggestion 2, but
> did not succeed. It seems to read the environment segment ok but does
> not read the right environment data. Can you spot what I am doing
> wrong? I am testing in a Windows XP DOS box.
>
Ok, I think I located the issue. First,
_go32_info_block.linear_address_of_original_psp is the same value as
returned by Int 21h, ah=51h and Int 21h, ah=62h. So, that is good.
However, the ENV seems to be available on the parent PSP. The PSP we're
looking at is not the parent. There seems to be a linked list of PSPs.
PSP+0x16 points to the parent of the current PSP. You need a loop to trace
back through multiple PSPs until the word at PSP+0x16 stops changing values.
It's possible this value gets set to zero on some DOS' according to RBIL ...
I didn't see that. What I saw is PSP+0x16 eventually points to itself.
Then, you'll have the parent PSP with a word at 0x2c that points to the
correct ENV. My loop that I added to your C was somewhat messed up, but
I'll attempt to clean it up and post it, if you want.
Rod Pemberton
- Raw text -