Monitoring clipboard crashes win
Could you tell me why this script,
after running about 20 minutes, crashes Windows 98?
If it is running and I´m only browsing internet, it starts
crashing the systray, then, all windows starts getting slow
until there is nothig else working.
The script is attached but, if fails, is the same below:
OutFile "Monitorador.exe"
Name "Monitorador"
!include WinMessages.nsh
;LoadLanguageFile "D:\Roteiro\PORTUGUESEBR.NLF"
;Icon Monitorador.ico
SilentInstall Silent
Page Instfiles
Section
############# Allow only one installer instance
System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $R0
StrCmp $R0 0 DoRunInstall
Banner::show /NoUnload "O Monitorador já está aberto !" ;It´s already open !
Sleep 2000
Banner::Destroy
Abort
DoRunInstall:
System::Free $R0 ;Does it help? is not in the original nsi.
####################################### lower priority Baixar prioridade
System::Call "kernel32::GetCurrentProcess() i .s"
System::Call "kernel32::SetPriorityClass(i s, i 0x00000040)"
####################################### Indicar que está ligado para o Proxy do Papai (botão 23)
WriteIniStr "$exedir\n.ini" "Field 23" Flags Disabled ;report interface that Monitorador is running and disable buton
####################################### see what is there to not launch on start Vê o que está lá para não lançar de arranque.
Delete "$temp\mt.ini" ; clear previous use of Monitorador
WriteIniStr "$temp\mt.ini" 1 2 Ligado ;report interface that Monitorador is running
System::Call 'user32::OpenClipboard(i 0)'
System::Call 'user32::GetClipboardData(i 1) t .r0'
System::Call "user32::CloseClipboard()"
Pop $0
WriteIniStr "$temp\mt.ini" 1 1 $0 ;So, Monitorador doesn´t launch TrocarProxy.exe with what was in clipboard
####################################### start Looping
loop:
System::Free $R0 ;Does it help ? is not in the original nsi.
System::Free $0 ;Does it help ? is not in the original nsi.
ReadIniStr $2 "$temp\mt.ini" 1 2 ;See if the enterface wants to close Monitorador
StrCmp $2 desligar Fechar ;See if the enterface wants to close Monitorador
Sleep 2000
System::Call 'user32::OpenClipboard(i 0)'
System::Call 'user32::GetClipboardData(i 1) t .r0'
System::Call "user32::CloseClipboard()"
Pop $0
ReadIniStr $9 "$temp\mt.ini" 1 1 ;see if clipboard changed. If no, loop
StrCmp $0 $9 loop ; $9 is the original. see if clipboard changed. If no, loop
####################################### Agora, ver se o dado HTTP é válido:
StrCpy $1 $0 7
StrCmp $1 "http://" 0 naoehttp ;If valid, closes TrocarProxy and reopens it
fct::fct /WC '#32770' /WT "Proxy do Papai"
WriteIniStr "$temp\mt.ini" 1 1 $0 ; This data becomes original clipboard.
WriteINIStr "$exedir\n.ini" "Field 41" Text "Do Monitorador" ;The interface says that was opened by Monitorador
Exec "$exedir\TrocarProxy.exe"
GoTo loop
####################################### see if it is a valid PROXY, by my criteria
naoehttp:
StrCpy $1 $0 1 -6
StrCmp $1 ":" certo1
StrCpy $1 $0 1 -5
StrCmp $1 ":" certo1
StrCpy $1 $0 1 -4
StrCmp $1 ":" certo1
StrCpy $1 $0 1 -3
StrCmp $1 ":" certo1 loop
certo1:
StrCpy $1 $0 "" -2
intop $2 $1 / $1 ;see if is a number
StrCmp $2 1 0 loop ;is it a number.. ver se é número
StrCmp $1 80 certo ;- allowed doors (dezena e unidade.)
StrCmp $1 28 certo ;- allowed doors (Centena em diante é irrelevante)
StrCmp $1 08 certo ;- allowed doors
StrCmp $1 50 certo ;- allowed doors
StrCmp $1 24 certo ;- allowed doors
StrCmp $1 88 certo ;- allowed doors
StrCmp $1 27 certo ;- allowed doors
GoTo loop
####################################### Yes, is a valid number. So...
certo: ;Right
####################################### O proxy do Papai Já está aberto? ;ClearErrors;Rename "$exedir\TrocarProxy.exe" "$exedir\TrocarProxy.exe" ;IfErrors 0 SemRever;ReadIniStr $2 "$temp\mt.ini" 1 2;StrCmp $2 desligar Fechar
fct::fct /WC '#32770' /WT "Proxy do Papai" ;Closes Proxy do Papai
########## Change the proxy Mudar o proxy
WriteRegDWORD HKU ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyEnable" 1
WriteRegDWORD HKLM "Config\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings" "ProxyEnable" 1
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyEnable" 1
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyServer" "$0"
WriteRegStr HKU ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyServer" "$0"
########## Adequate interface and launch TrocarProxy.exe Mudar config da interface para ligar configurado
WriteIniStr "$exedir\n.ini" "Field 10" "State" 0
WriteINIStr "$exedir\n.ini" "Field 11" "Flags" "Notify|DISABLED"
WriteINIStr "$exedir\n.ini" "Field 2" "Flags" ""
WriteINIStr "$exedir\n.ini" "Field 3" "Flags" "Notify"
WriteINIStr "$exedir\n.ini" "Field 41" Text "Do Monitorador"
WriteIniStr "$temp\mt.ini" 1 1 $0 ; becomes clipboard original.
Exec "$exedir\TrocarProxy.exe"
GoTo loop
Fechar:
Delete "$temp\mt.ini" ;clean last use of Monitorador
WriteIniStr "$exedir\n.ini" "Field 23" Flags Notify ;Buton of interface is enabled again
sectionend
autoclosewindow true