From: Bob Masta on
On Sat, 10 Jul 2010 15:40:34 -0700, "Boris"
<somewhere(a)nowhere.net> wrote:

>Hi,
>
>I'm thinking about writing custom Native EXE that will be executed early
>during Windows boot process. I'll put pathname of my Native EXE into
>BootExecute value in
>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager key. But
>I need to tell "cold" boot from "warm" boot: if hardware was powered on or
>just Windows restarted.
>Is there a way of doing this?

Maybe no longer relevant, but:

Back in the Good Old Days of DOS, the BIOS set the word at
0x0472 to 0x1234 after the initial power-up memory test. If
you did a warm boot via CTRL-ALT-DEL and the memory test
code found this word already set to 0x1234, it skipped the
memory test (which used to be rather lengthy on some of
those old machines). You could force a "cold boot" memory
test by setting this word to some other value.

I don't know if the BIOS still does anything with this word,
or even if there is still a memory test (other than sizing).
But it might be something to look into if nothing else
turns up.

Best regards,


Bob Masta

DAQARTA v5.10
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
Frequency Counter, FREE Signal Generator
Pitch Track, Pitch-to-MIDI
DaqMusic - FREE MUSIC, Forever!
(Some assembly required)
Science (and fun!) with your sound card!
From: a on
"Boris" <somewhere(a)nowhere.net> wrote

>> I was going to say just check the value of GetTickCount(), but that's no
>> good if the user has rebooted the PC. Maybe check that once, and store a
>> flag value somewhere (with the date) so that subsequent checks on the same
>> day know that the PC has already been previously started that day? That
>> should work fine.
>
> Thanks for the response - but I don't think so. GetTickCount() counter is reset to 0 each time OS boots - you cannot tell cold
> boot from warm boot that way. It's possible, some HAL lib functions can extract that info from system BIOS - but I couldn't find
> anything relevant.

Upon thinking about it more, I was close in my tip above anyway. All you need
to do is: when Windows boots, check if a file called "<date>" exists in your
app's folder. If not, then the app assumes it's the first boot of the day and
creates the file, so any subsequents reboots on the same day can be identified.

And if the file "<date>" does NOT exist when your app starts at bootup, then
your app knows it IS the first boot of the day, and creates the file to mark
the boot as "known". Your app then deletes any "<date>" files from the past,
to keep the PC clean.

This will work fine.


From: Maxim S. Shatskih on
> or even if there is still a memory test (other than sizing).

Yes, memory tests are still here.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com