mazdakam
15th November 2007 06:30 UTC
How to close applicatiom, restart windows, run cmd and install dll
Hi at first i need to say that this is my first post and i am newbie in Nsis so i a not pro in it
i want to do these things but i dont know how:
1) before finish installation run cmd.exe and write sfc /purgecache in it (i don't want this optional)
2) after that i want to close cmd.exe and a dialog box that appear
3) restart the windows
i know there is http://nsis.sourceforge.net/ShutDown_plug-in
for this but i donlt kn ow how to use it
4) my another qustion is bout installing dll that windows protectet i know i can use
InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED
is it true this code install my dll after boot? and do nothing befor boot? i just wana sure about it
please answer for a dummy :p Thanks in advanced
kichik
15th November 2007 18:07 UTC
- Use ExecWait at the end of your last section.
- It'll close automatically. If not, you can use nsExec or ExecDos instead of ExecWait.
- Use the built-in Reboot command or use the MUI's finish page. The finish page will ask the user to reboot if the reboot flag is set. Use SetRebootFlag to set the reboot flag.
- You can't and shouldn't replace protected files.
mazdakam
15th November 2007 18:45 UTC
## Use ExecWait at the end of your last section.
# It'll close automatically. If not, you can use nsExec or ExecDos instead of ExecWait.
tha nks but i decide to write a bat file and execute it after a section
i think it is better
about problem number 3 thanks it worked for me :)
but about number 4 i want to delete default kbdfa.dll it is default Farsi (persian) keyboard and it is not standard so i wana replace it with standard kbdfa.dll
but it is windowse protected file
i try these step to do it:
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $R0
${registry::Write} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "SFCDisable" "1" "REG_DWORD" $R0
and then
run sfc /purgecache in cmd
and after that
!insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED kbdfa.dll $SYSDIR\kbdfa.dll $SYSDIR
i just wana know what will do this:
InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED
does this code replace kbdfa.dll after reboot or not and if NO what is tha action of this code?
kichik
15th November 2007 20:01 UTC
It'd replace it after reboot if it can't replace it immediately.
mazdakam
16th November 2007 06:43 UTC
thanks for answering...
i found that i need to restart windows 2 time
1) after run bat file (run sfc /purgecache in cmd)
2) after !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED kbdfa.dll $SYSDIR\kbdfa.dll $SYSDIR
is there anyway for this?
i mean
1)user execute inistaller then
2) inistaller say you need to reboot
3) user choose reboot
4) after reboot instalation continue its work and then say you need to reboot
5) user choose reboot
6) after reboot complete instalation
is it posible?
kichik
16th November 2007 09:05 UTC
I don't know. Installing over a protected file is not a standard action and it's not recommended. If you have some guide that shows how to do it without rebooting twice, I can help you implement the details.
mazdakam
16th November 2007 12:22 UTC
If you have some guide that shows how to do it without rebooting twice, I can help you implement the details.
no id don;t have any guide i just know i shuld do these steop
1) change SFCDisable value fro, 0 tp 1
2) go to start>run and type:sfc /purgecache
3) click cancel if windowse protection file dilog appear
4) click yes
5) restart windows
6) copy kbdfa.dll(this is my file) to system32\kbdfa.dll(original file)
7) click cancel if windowse protection file dilog appear
8) click yes
9) restart windows
that's it
but as you see it need reboot twice
kichik
16th November 2007 12:28 UTC
If you must reboot twice, you can put your installer in the RunOnce registry key before the first reboot. This way, the installer will start itself again and you can continue to step 6.
mazdakam
16th November 2007 12:51 UTC
my installer name is PSK.setup
do you mean this:?
Section -run PSK
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\RunOnce" "PSK" "$INSTDIR\PSK.exe"
SectionEnd
kichik
16th November 2007 13:25 UTC
Yes.
mazdakam
16th November 2007 14:51 UTC
no no :(
did not work for me
how it can call a PSK.exe when there is nothing there?