Old 19th July 2018, 13:09   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 258
check windows want restart or shutdown

how can check windows now want restart before installer closed by windows?
if windows restart and shutdown have flag?
i most save many values to registry before windows restart or shutdown...
Or moments before
Windows startup and shutdown
is Moments before windows restart or shutdown can recognize it?

before restart and shutdown:
witch process start OR witch process closed?
what changes are made to the registry?
which flag is changing and how it is accessed that flag?
r2du-soft is offline   Reply With Quote
Old 19th July 2018, 14:07   #2
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 181
Maybe you can find some useful information from my topic: http://forums.winamp.com/showthread.php?t=452693
TrifonovS is offline   Reply With Quote
Old 19th July 2018, 15:13   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 258
Quote:
Originally Posted by TrifonovS View Post
Maybe you can find some useful information from my topic: http://forums.winamp.com/showthread.php?t=452693
hi
thanks,i studied that topic
i try thats codes but i cant use thats in a loop and installer Automatically ends...
i most use that in loop to check windows want turned on of off or restart..
r2du-soft is offline   Reply With Quote
Old 19th July 2018, 19:27   #4
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 258
i found some examples:

SystemEvents.SessionEnding Event:
https://stackoverflow.com/questions/...down-or-logoff

SystemEvents.SessionEnding Event:
https://msdn.microsoft.com/en-us/lib...code-snippet-2

SystemEvents::SessionEnded Event:
https://msdn.microsoft.com/en-us/lib...sionended.aspx

also:
https://stackoverflow.com/questions/...a-winforms-app

also:
http://vbcity.com/forums/t/84431.aspx

But I do not know if this work is possible in nsis?!
r2du-soft is offline   Reply With Quote
Old Yesterday, 22:51   #5
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 258
Question

i found a way to save values in registry just before: Logoff,Restart,ShutDown and others...
Just before Logoff,Restart,ShutDown and others windows run LogonUI.exe process!

HTML Code:
!include x64.nsh
Var Process

Section Section
${IF} ${RunningX64}
	SetRegView 64
${ELSE}
	SetRegView 32
${EndIF}

	GetFunctionAddress $0 ShutDown_Checker
    ThreadTimer::Start 1 0 $0

SectionEnd

Function ShutDown_Checker
	Try:
	StrCpy $Process "LogonUI.exe"
	LockedList::FindProcess "$Process"
	Pop $R0
	;MessageBox MB_OK "$R0"
	${If} $R0 S!= ""
		WriteRegStr HKLM "SOFTWARE\1" "Windows Status" "Windows Now Want (Logoff,Restart,ShutDown)"
		ThreadTimer::Stop
		Quit
	${ELSE}
		Goto Try
	${EndIf}
FunctionEnd

but i have a problem!
if change:
HTML Code:
StrCpy $Process "LogonUI.exe"
To
HTML Code:
StrCpy $Process "notepad.exe"
after run installer,run the notepad.exe
installer write the value in registry but QUIT not work and installer not closed!
i think problem was from:
HTML Code:
ThreadTimer::Stop
Quit
I tried different ways but after saving value in the registry,installer not QUIT!!!

where is the problem from?
What is the problem solving method?
r2du-soft is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump