VOGONS


Interesting VESA info from a user

Topic actions

First post, by vladr

User metadata
Rank Oldbie
Rank
Oldbie

From Simon Hradecky:

Hello, […]
Show full quote

Hello,

you may perhaps have heard of "Airline Simulator 2", which is a flight
simulator still based on DOS, using 800*600 resolution for display.

Ever since Windows XP was introduced, there was a problem however. Whenever
any VESA call was made to activate that graphics mode, the monitor went to
sleep, as the pixel rate could never be set and therefore the frequencies
for horizontal and vertical synchronisation went too low.

I have now identified the problem, which lies within vga.sys. Depending on
how vga.sys determines the graphics board capabilities (based on very
outdated chipset infos!) it either goes to a full vesa implementation and
provides full access to all I/O ports of the vga hardware. However, for
example with current Nvidia cards, vga.sys determines that this vga
hardware is just a minimally compatible hardware and traps I/O ports 3C2H,
3C4H and 3C5H, effectively disabling any reasonable work and especially
setting the pixel frequency - result see above.

With a kernel debugger I have now managed to verify this issue and manually
set the I/O Port information in the TSS, which makes AS2 work instantly.

Instead of doing another garbage on my own and implementing a driver, which
should manipulate the TSS's i/o emulation, would it be possible for you to
provide an update to VDMSound instantly - all what is needed: if VESA
support is enabled, your driver should - in ring 0 - find the vga.sys
driver, search for a data string in there that reads (all in hex):

c2 03 00 00 00 00 00 00 01 00 00 00 01 00 01 00
c4 03 00 00 00 00 00 00 02 00 00 00 01 00 01 00

There is no possibility to confuse that string of 32 bytes actually. Two
bytes need to be changed, so that the memory then reads:

c2 03 00 00 00 00 00 00 01 00 00 00 01 01 01 00
c4 03 00 00 00 00 00 00 02 00 00 00 01 01 01 00

This modification will prompt vga.sys to no longer trap the ports 3c2, 3c4
and 3c5, and hence the VESA BIOS will work properly. I suppose, that fix
will also solve a lot of related issues ...

With best regards
Simon Hradecky

Reply 1 of 40, by Snover

User metadata
Rank l33t++
Rank
l33t++

Well, well, well. Isn't That Interesting.
*goes and HEX edits his VGA.SYS*

Yes, it’s my fault.

Reply 2 of 40, by Schadenfreude

User metadata
Rank Member
Rank
Member

Amazing.

Let's get the ball rolling on this!!

(I still think this will not fix LFB support - but it should help NVIDIA and NOLFB combinations. 😀)

Comments people?

Reply 3 of 40, by MajorGrubert

User metadata
Rank Member
Rank
Member
Snover wrote:

Well, well, well. Isn't That Interesting.
*goes and HEX edits his VGA.SYS*

Well, well, Windows file protection jumps in and restores the original file. I guess we have to either disable WFP (not an easy task, afaik) or pack a patched vga.sys file in a way similar to a hotfix, so it will be accepted as an upgrade.

Plan B: look at the source code in VDMSound and patch vga.sys in memory. Quite a task, since it's been 5 years since I last wrote something to run on ring 0.

Regards,

Major Grubert

Athlon 64 3200+/Asus K8V-X/1GB DDR400/GeForce FX 5700/SB Live! 5.1

Reply 4 of 40, by Zorbid

User metadata
Rank Member
Rank
Member
MajorGrubert wrote:

I guess we have to either disable WFP (not an easy task, afaik)

Piece of cake 😀

Windows has a backup copy of it's crucial files. when you alter something in the windows/system32 folder, it's automatically replaced with the backup. Microsoft has been nice enough to let the backups as is in another folder, and these files are not protected by anything 😀. \WINDOWS\ServicePackFiles\i386 if you have the SP1 installed, and another folder (I don't remember which) if you haven't.

Search for VGA.sys in your windows subfolders. Rename all the vga.sys you find but the one in system32\drivers to let's say VGA.syso, you'll be able to patch the "good" VGA.sys.

Another option: you can edit the backup version, then modify the "protected" one, and let windows copy the patched file for you :p

Reply 5 of 40, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

So how much extra functionality (on a system with an nVidia card for example) would this hack give me?

The memory patching thing sounds like the best way to go, as it doesn't require modification of critical system files (as botched as they may be).

vlad: if you decide to implement a memory patcher, please please PLEASE consider keeping it separate from the full-screen (i.e. "basic VESA support") checkbox/option in LaunchPad/VDMsound! It is entirely possible that one would want to use one option without the other. Just putting in my two cents 😉

Reply 6 of 40, by Snover

User metadata
Rank l33t++
Rank
l33t++

I could've sworn that killing Windows file protection was as simple as editing a registry key...hmm...

Yes, it’s my fault.

Reply 7 of 40, by Nicht Sehr Gut

User metadata
Rank l33t
Rank
l33t

Originally posted by Zorbid \WINDOWS\ServicePackFiles\i386 if you have the SP1 installed, and another folder (I don't remember which) if you haven't.

That would be WINDOWS\system32\dllcache\vga.sys, at least for XP.

Reply 8 of 40, by Nicht Sehr Gut

User metadata
Rank l33t
Rank
l33t

I knew it wouldn't be this easy. DOS titles or any command prompt attempting to "full-screen" generates this error:

Reply 9 of 40, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Hmmm, Wonder what vid card this guy had.

Oh, I also wish I could do stuff like that.....I feel like Rip Van Winkle. The only diff is that I've been awake and I'm still falling behind. 🙁

How To Ask Questions The Smart Way
Make your games work offline

Reply 10 of 40, by Snover

User metadata
Rank l33t++
Rank
l33t++

Nicht.

W I N D O W S E X P E E .

Yes, it’s my fault.

Reply 11 of 40, by MajorGrubert

User metadata
Rank Member
Rank
Member
Snover wrote:

I could've sworn that killing Windows file protection was as simple as editing a registry key...hmm...

According to MS knowledge base article 222473 (http://support.microsoft.com/default.aspx?sci … kb;en-us;222473):

All registry settings for Windows File Protection/System File Checker are located in the following registry key: HKEY_LOCAL_MAC […]
Show full quote

All registry settings for Windows File Protection/System File Checker are located in the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

(...)

Registry Values
SFCDisable (REG_DWORD)
0 = enabled (default)
1 = disabled, prompt at boot to re-enable
2 = disabled at next boot only, no prompt to re-enable
4 = enabled, with popups disabled

NOTE: For options 1 and 2: Both of these options require a kernel debugger to be hooked up for those options to become useable. If a kernel debugger is not hooked up, Windows File Protection is not disabled.

So it's simple only if you have a debug build of the kernel.

Regards,

Major Grubert

Athlon 64 3200+/Asus K8V-X/1GB DDR400/GeForce FX 5700/SB Live! 5.1

Reply 12 of 40, by MajorGrubert

User metadata
Rank Member
Rank
Member
Nicht Sehr Gut wrote:

I knew it wouldn't be this easy. DOS titles or any command prompt attempting to "full-screen" generates this error:

I booted my Windows 98 copy and edited the copies of vga.sys from %systemroot%\system32\drivers and %systemroot%\system32\dllcache (the only ones I found in my Windows 2000 partition). Rebooted into Windows 2000 and got a beautiful BSOD: STOP 0xc000026c Unable to load device driver vga.sys.

Vga.sys has an .exe file header (with MZ and PE signatures), so I guess that patching the file would invalidate the checksum in the header. Does anyone knows how to fix this?

Regards,

Major Grubert

Athlon 64 3200+/Asus K8V-X/1GB DDR400/GeForce FX 5700/SB Live! 5.1

Reply 14 of 40, by MajorGrubert

User metadata
Rank Member
Rank
Member
DosFreak wrote:

Booting into another OS is unecessary...if your fast enough to copy the files around while in the OS. 😉

Yeah, but I need to reboot in order to load the modified vga.sys and it gives me the same blue screen upon reboot.

Did someone got this working on Windows 2000? Maybe I'm doing something really stupid 😕

Thanks,

Major Grubert

Athlon 64 3200+/Asus K8V-X/1GB DDR400/GeForce FX 5700/SB Live! 5.1

Reply 15 of 40, by Targaff

User metadata
Rank Member
Rank
Member
Snover wrote:

I could've sworn that killing Windows file protection was as simple as editing a registry key...hmm...

It was. Then they released the service packs and you found yourself having to hexedit the relevant files. VP.net has a summary of the relevant info here.

Reply 16 of 40, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Major Grubert, correct me if I'm wrong, but we are talking about VESA in Windows XP and hacking/editing the Windows XP vga.sys.
What makes you think the same applies to W2k?

Reply 17 of 40, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Well if he found the same byte string in his vga.sys, then I'll wager that it's (almost?) identical to the one in XP. I edited a copy of mine, but I'm waiting to hear reports of what I can hope to gain from it before I go kludging up my OS.

Reply 18 of 40, by MajorGrubert

User metadata
Rank Member
Rank
Member
Dominus wrote:

Major Grubert, correct me if I'm wrong, but we are talking about VESA in Windows XP and hacking/editing the Windows XP vga.sys.
What makes you think the same applies to W2k?

Since VESA support in Windows 2000 have mostly the same limitations as in Windows XP and the vga.sys driver is very similar, I decided to try the same patch on Windows 2000. By the way, the limits imposed to VESA modes by vga.sys under Windows 2000 are different from card to card, just as they are under Windows XP, but the causes are the same: vga.sys traps several I/O instructions issued by the BIOS and prevents some mode changes.

HunterZ wrote:

Well if he found the same byte string in his vga.sys, then I'll wager that it's (almost?) identical to the one in XP

That's correct, the same 32 byte sequence appears in the Windows 2000 version of vga.sys.

Regards,

Major Grubert

Athlon 64 3200+/Asus K8V-X/1GB DDR400/GeForce FX 5700/SB Live! 5.1

Reply 19 of 40, by Nicht Sehr Gut

User metadata
Rank l33t
Rank
l33t

Originally posted by DosFreak Oh, I also wish I could do stuff like that.....I feel like Rip Van Winkle.

?? You mean tracking down the tiny details, right. Don't tell me Mr.Network Admin isn't comfortable with a hex editor.

Originally posted by Snover Nicht.

W I N D O W S E X P E E .

*blink*
*blink*

Ok, I'm sure that makes sense to someone.

Originally posted by DosFreak Booting into another OS is unecessary...if your fast enough to copy the files around while in the OS.

True, I edited both of my VGA.SYS files while still in XP (kind of like swapping out wiper blades on my car while flying down the highway...but without all the wind).

The backup took fine, so did the active version. But two seconds after I saved the active SYS file, I received a prompt demanding my XP CD. I refused and it gave me dire warnings, but accepted my decision.

Put the original back after I realized it killed all full-screen modes.