Hi
There may be a very nice way of doing that, along the lines of a screensaver as you mentioned, or putting the monitor into a fake suspend state and disabling mouse/keyboard input except for your passphrase, but here's an idea maybe worth looking into. This code was for Win9x, I'm not sure if it would work on Win2K but you would need to program a driver to use the IN/OUT commands.
Once upon a time there was a protection which did something similar if it caught you tracing over it or something. I
believe it may have been DP-tEunlock or dp-borg2, maybe someone can confirm, but I remember seeing the effect. Anyway, someone had posted a similar type code snippet on the Win32asm forum and I was interested in what it was doing so I did a bit of digging. Here's my analysis of it, which may or may not be entirely accurate.
Original question:
==============================
I have this code which is supposed to disable screen, and it worx fine on my Win98:
mov dx, 03c4h
mov al, 01h
out dx, al
inc dx
in al, dx
or al, 20h
out dx, al
The problem is that I would like to turn it back on, but I don't know how?
Also, could someone pls explain what this code does exactly?
==============================
Possible explanation:
==============================
I did a little bit of searching and came up with this. Port 3C4h Index 1 is the VGA Sequencer Clocking Mode. If bit 5 is set this turns off the screen and gives all memory cycles to the CPU interface.
--------------------------------------------
3C4h is the VGA Sequencer Index Register (SEQX).
This register is loaded with a binary value that indexes the sequencer register for read/write data. This value is referred to as the "Index Number" of the SR register.
Bits 4-0 : SEQ ADDRESS - Sequencer Register Index
A binary value indexing the register where data is to be accessed.
Bits 7-5 : Reserved
Index 0: reset register
INDEX 1: CLOCKING MODE REGISTER
Index 2: map mask register
Index 3: character map select register
Index 4: memory mode register
---------------------------------------------
3C5h is the VGA Sequencer Data Register (SEQ_DATA).
This register is the data port for the sequencer register indexed by the
Sequencer Index register (3C4h).
Bits 7-0 : SEQ DATA - Sequencer Register Data
Data to the sequencer register indexed by the sequencer address index.
3C5h Index 1: CLOCKING MODE REGISTER
.......1 8/9 dot clocks (9 bits for mda-compatibility)
.....1.. 16/8 bits shift mode (see also 3cf.5)
....1... 40/80 column mode
...1.... 32/8 bits shift mode (see also 3cf.5)
..1..... DISABLE THE DISPLAY, to give the cpu more access to video memory
---------------------------------------------
So I roughly interpret the code as:
mov dx, 03c4h ; VGA Sequencer Index Register 3C4h (SEQX)
mov al, 01h ; Index 1 (clocking mode register)
out dx, al ; write index to 3C4h register
inc dx ; point to Data Register 3C5h (SEQ_DATA)
in al, dx ; read indexed Data Register into accumulator
or al, 20h ; set bit 5 (20h = 100000)
out dx, al ; output to Data Register
I would assume to reverse it you would just need to unset bit 5 again with xor 20h.
==============================
EOF
I'm not sure how you're thinking of adding a "random" onset of the screen blanking. Perhaps using an APC callback (slight random factor there since the OS decides when to call your APC), then a small random sleep/timer function within the callback itself before calling the screen blanking code. Couple of ideas anyway (to go along with Clandestiny's covert filter driver of course

)
Cheers,
Kayaker