Sign in to follow this  
Followers 0
ant2ne

Computer randomly shutsdown

11 posts in this topic

On a Windows 7 machine, when I run this code as a compiled program then the computer will randomly shutdown With an (Event ID 109 Kernel-Power) after 10 to 30 minutes. At the console a box pops up and says "The computer will shut down in less than a minute." This is not a crash. The computer knows it is going down. Warns the user and writes an event to the event log.

If I do not run this compiled code then the system stays up all day. If I start the program again, within a 10 to 30 minutes the computer will shut down.

On the XP machine there is no problem with shutting down.

My Code

;Opt("WinTitleMatchMode" ,2)
#include <Array.au3>
Opt("TrayIconHide", 1)
sleep(5000)
Global $_State
Global $_pos[2] =[0,0]
Global $_size[2] =[0,0]


While 1
$_pos[0] = 1
$_pos[1] = 1
$_size[0] = 1
$_size[1] = 1
$_State = WinGetState("[CLASS:IEFrame]","")
  if $_State = 0 Then
   _Open()
  else
   $_pos = WinGetPos("[CLASS:IEFrame]")
   $_size = WinGetClientSize("[CLASS:IEFrame]")
   if $_size[0]  < 1280 then _Resize()
   if $_size[1]  < 1024 then _Resize()
   ; msgbox(1,"pos",$_pos[0] & @CRLF & $_pos[1],5)
   if $_pos[0] <> 0 then  _Resize()
   if $_pos[1] <> 0 then  _Resize()
  EndIf
Sleep(5000)
Wend

Func _Open()
if FileExists("C:\Program Files (x86)\Internet Explorer\iexplore.exe") then
  $_IE = Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe")
Else
  $_IE = Run("C:\Program Files\Internet Explorer\iexplore.exe")
  Endif
Sleep(2000)
EndFunc

Func _Resize()
WinActivate("[CLASS:IEFrame]")
WinMove("[CLASS:IEFrame]", "", 0, 0, 1280, 1024)
EndFunc

This code functions exactly as it should, other than the unexplained shut down. As you can see there is nothing in my code to shut down the system. I don't see any run away loops or memory/cpu hogs. I can only figure that I've stumbled into a bug.

Event ID 109 Kernel Power

Log Name:     System
Source:     Microsoft-Windows-Kernel-Power
Date:         10/10/2009 12:10:00 PM
Event ID:     109
Task Category: (103)
Level:       Information
Keywords:     (4)
User:         N/A
Computer:     Fred
Description:
The kernel power manager has initiated a shutdown transition.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331C3B3A-2005-44C2-AC5E-77220C37D6B4}" />
    <EventID>109</EventID>
    <Version>0</Version>
    <Level>4</Level>
    <Task>103</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000004</Keywords>
    <TimeCreated SystemTime="2009-10-10T16:10:00.925187500Z" />
    <EventRecordID>5385</EventRecordID>
    <Correlation />
    <Execution ProcessID="428" ThreadID="432" />
    <Channel>System</Channel>
    <Computer>Fred</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="ShutdownActionType">6</Data>
    <Data Name="ShutdownEventCode">0</Data>
    <Data Name="ShutdownReason">0</Data>
  </EventData>
</Event>

Share this post


Link to post
Share on other sites



As you mention, there is nothing in your script calling a shutdown. Is this the only time you see a system shutdown, when you're running the script?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Just trying to understand your code here.

nevermind, I missed something

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

googled event 109:

http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/6cc741c1-f488-43ee-b762-bf5f8e814327

Please follow these steps:

  • Right-clickMy Computer, and then clickProperties.
  • ClickAdvanced system settings.
  • Click theAdvancedtab.
  • In theStartup and Recovery section, clickSettings.
  • Click to clear theAutomatically restart check box.
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

@jdelaney,

I have that box checked and have never had a problem.

@ant2ne - Any system log activity before the shutdown?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

googled event 109:

http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/6cc741c1-f488-43ee-b762-bf5f8e814327

Please follow these steps:

  • Right-clickMy Computer, and then clickProperties.
  • ClickAdvanced system settings.
  • Click theAdvancedtab.
  • In theStartup and Recovery section, clickSettings.
  • Click to clear theAutomatically restart check box.
This doesn't even apply to what the OP is talking about.

EDIT: To the OP, check for a virus, because there's nothing in your code that could do what you're saying.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Could also be hardware issues...how would stopping the auto crash reboot not be related?

Yes, it's not directly going to fix his problem, but it could be a temp fix untill the issue is figured out

edit: in a forum, I would like as many possibilities to try out as possible, and select the one that works out best for me

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Could also be hardware issues...how would stopping the auto crash reboot not be related?

It's not blue screening or rebooting because of a blue screen. It's giving him a shutdown message, informing him that the computer is going to shut down in x minutes. What you posted has nothing whatever to do with that issue

Yes, it's not directly going to fix his problem, but it could be a temp fix untill the issue is figured out

It's not even tangentally going to "fix" his problem nor is it a temporary fix to his problem because it's a fix for a problem he doesn't have.

edit: in a forum, I would like as many possibilities to try out as possible, and select the one that works out best for me

I agree with that, but I would also like the fixes suggested to apply to the problem at hand, not something that doesn't come close to what he said was happening.

I'm sorry if this comes off a bit harsh, but the suggestion didn't fit the symptoms, and your reply shows that you didn't read what he posted about what the problem he was having. Then you tried to defend your wrong information by trying to attack the messenger who told you that your information wasn't going to help with the problem listed.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

It's not blue screening or rebooting because of a blue screen. It's giving him a shutdown message, informing him that the computer is going to shut down in x minutes. What you posted has nothing whatever to do with that issue

It's not even tangentally going to "fix" his problem nor is it a temporary fix to his problem because it's a fix for a problem he doesn't have.

Removing the auto-reboot could also give him time to figure out what is causing the shutdown. Years ago I had a virus that would cause the auto reboot and it always happened so quickly that I didn't have time to search through processes or scan the pc to figure out what was causing it. Un-ticking the box so the pc wouldn't reboot gave me the time I needed to find and solve the issue.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

I'm not sure how having it not reboot on a blue screen would prevent a shutdown message from happening, or how it would stop the shutdown itself.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Lots of good replies thanks. I think we tracked the issue down to a bad driver. I don't know why this bad driver only caused an issue while running this script. And that made it look like it was an issue with this script. I executed the script on another Win7 machine with intel drivers (instead of the MS ones) and it didn't shut down the system.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0