1. How can I restore a minimized console window in windows XP. I want to restore it from another process,
and it seems I cannot find a HWND for the console window.

2. I have a mysterious behaviour of a program using mixed 16/32 bit code segments. the following code crashes on pentium cpus, but works for P4:

this code when executed has a 16bit CS and a 32bit! SS, HiWord(ESP)=0 but HiWord(EBP) is NOT zero:

push bp
mov bp, sp
mov ax, 1
leave ;<- causes a stack fault on pentium cpus

I always thought the leave instruction on a 16-bit CS (without 66h prefix) should restore SP with BP only, leaving HiWord(ESP) unchanged, but this seems to be not the case. I havent found any descriptions of this bug(?) yet. Further information would be appreciated.

Posted on 2004-05-25 04:24:07 by japheth
For the second part: do you have the same OS for those two CPUs? If not, I suspect one on your Pentium runs strange version of DPMI. Or, that one does not handle DOS extender (as embedded in .exe) properly.
Posted on 2004-05-25 04:43:39 by Starless
For the first question, this routine:

2k+ only though, and only for the active process (ie, code injection time). Or you could use this workaround, which would also require code injection: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q124/1/03.asp&NoWebContent=1
Posted on 2004-05-25 10:18:16 by f0dder

its "almost" the same OS. But it doesnt matter, because I made a mistake and the versions of the 16-bit dlls differed. For the P4 I used an older version, where the generated code was a bit optimized:

mov ax, 1

When I use the newer version, I crashes on the P4 as well. So obviously the "leave" instruction always depends on the D bit of the SS descriptor, not the CS descriptor, which I wasnt aware of.

f0dder, thanks for the links. If it is really necessary to inject code for such "simple" jobs... :rolleyes:

Posted on 2004-05-25 11:05:30 by japheth