Archive: Monitoring clipboard crashes win


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


small cleanup and some fixes.

plz test if it works.

compare it with your original script by using winmerge to see the differences.


Thank You.
I tested but the result is now different.
After 40 minutes, when I try to open the NisEdit,
appeared a Windows messagebox saying something
like this, in english: (my langID is Português, Brasil)
"There is not enough memory to run this app"

Then, I close all the apps but nothing else could be launched.
When try to restart computer Start>turn off>restart,
there was a Windows window that goes:
"DDE SERVER is not responding"
"End task - wait - cancel"
Then, full stop. Press restart. Comes scandisk on next boot.

What could it be?


Try removing parts of the script to see which exact part of it causes the problems. To make the problem appear faster, drop the Sleep command.


I might forgot how I did this long ago, but good idea is to copy clipboard data while data are locked (before CloseClipboard). Otherwise handle may be not valid.


I´ll start trying a simple loop with IntOp.
For now, : I reduced the Sleep from 2000 to 60
and after about 1 hour (three times, the same behavior)
Systray and quicklaunch stoped to launch apps. Systray
is the fist to stop. Then, quickLaunch, then "there is
not enough memory to run this app. Close some apps..."
Then, I quicly press ctrl alt del, closed Monitorador,
and everything became working.

I don´t know, but looks like it is somethig outside the
loop. At first, I was not using priority but it still
crashes.
I also know that nsis is an installer and I´m pushing.
Thank you for beeing so patient.

Remember I´m using Win98 and the only app beiond windws running is Kaspersky anti hacker and browsing internet.
Sometimes, office 2000, nisedit, compiling. No music, no games.


PLEASE, READ THIS. I think it's relevant.

Well, I have not good news.
In fact, a simple script that keeps running background,
after about one hour, starts to crash Win98.
Today, I was listening to a lot of music in Winamp,
when Winamp crashes again . Then, I remembered that
Winamp ALWAYS crashes (itself) after some time, and today,
it happened about two hours after started.
I also remembered that Winamp ALWAYS crashes after some time
since version 3 (I posted it in this forum a long time ago, when I was using a 586, 166MHz).

I'm not a developer and want only to help us.
For me, looks like there is something not right in the
structure of Winamp/Nsis.

Winamp v2.x and mediaPlayer (audio-video) don't show problems
Winamp also frequently stops for a long time or crashes itself when STARTS to read cda. So serious that I don't use Winamp for cda.
BTW, the only app that crashes W98 that I can remember is 1By1 ( a micro-player free), but can be in few minutes or many hours. No problems with other timers or shedulers.

After all these days, I noticed that the first problem that shows that Win will crash is when a file is not opened by its .exe in Explorer. Then, fastly close my nsis app and Win becomes normal. (my timer or my clipboard monitor).

Thank you for all.


I remember that there is an other app that crashes only
Win98 but never crashes XP.
Is the "WinBox" that I use to control the users of my server.


Sounds like your Windows 98 has a greedy firewall or some spyware. Try turning off Kaspersky and running some spyware clean-up.