Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Is it possible to determine (programmatically) if system was just powered up or rebooted

Reply
Thread Tools Display Modes

Is it possible to determine (programmatically) if system was just powered up or rebooted

 
 
Boris
Guest
Posts: n/a

 
      07-10-2010
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\Contro l\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?

Thanks,
Boris

 
Reply With Quote
 
 
 
 
Boris
Guest
Posts: n/a

 
      07-10-2010
The operating systems in question are: XP SP3 (or XP Embedded Standard),
Win7 (or Win 7 Embedded).

Thanks,
Boris

"Boris" <> wrote in message
news:4c38f6cf$0$22105$...
> 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\Contro l\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?
>
> Thanks,
> Boris


 
Reply With Quote
 
a
Guest
Posts: n/a

 
      07-11-2010
"Boris" <> wrote in message news:4c38f980$0$22093$...
> The operating systems in question are: XP SP3 (or XP Embedded Standard), Win7 (or Win 7 Embedded).
>
> Thanks,
> Boris
>
> "Boris" <> wrote in message news:4c38f6cf$0$22105$...
>> 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\Contro l\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?


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.


 
Reply With Quote
 
Boris
Guest
Posts: n/a

 
      07-13-2010


"a" <> wrote in message news:4c39fc6b$...
> "Boris" <> wrote in message
> news:4c38f980$0$22093$...
>> The operating systems in question are: XP SP3 (or XP Embedded Standard),
>> Win7 (or Win 7 Embedded).
>>
>> Thanks,
>> Boris
>>
>> "Boris" <> wrote in message
>> news:4c38f6cf$0$22105$...
>>> 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\Contro l\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?

>
> 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.

Boris

 
Reply With Quote
 
Simon Richter
Guest
Posts: n/a

 
      07-13-2010
Hi,

On 2010年07月13日 09:04, Boris wrote:

> 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.


Also consider that the BIOS considers pressing the reset button a cold boot.

Your best bet would be to look at the timestamps of the events
preceeding the reboot in the events log.

I also have the usual feeling of this being a minor part of a solution
to a larger problem, where it is not entirely clear that the solution
itself is sound (i.e. what are you trying to do, really?)

Simon

 
Reply With Quote
 
Bob Masta
Guest
Posts: n/a

 
      07-13-2010
On Sat, 10 Jul 2010 15:40:34 -0700, "Boris"
<> 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\Contr ol\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!
 
Reply With Quote
 
a
Guest
Posts: n/a

 
      07-13-2010
"Boris" <> 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.


 
Reply With Quote
 
Maxim S. Shatskih
Guest
Posts: n/a

 
      07-13-2010
> or even if there is still a memory test (other than sizing).

Yes, memory tests are still here.

--
Maxim S. Shatskih
Windows DDK MVP

http://www.storagecraft.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How much Memory can Vista 32 bit support? Jon Acord Windows Vista General Discussion 125 12-31-2009 03:24 PM
Change drive letter 4 a partition that Vista marks as system wrong Jonathan Livni Windows Vista Installation 11 01-04-2008 11:05 PM
Help! Access Denied Even To The System Owner... AAD213 Windows Vista Administration 16 12-03-2007 11:02 PM
NVIDIA GeForece 6800 and Vista w2m Windows Vista Hardware 19 06-11-2007 11:34 PM
Can I repair parental controls service? Paul Spoerry Windows Vista Installation 3 06-04-2007 12:25 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59