rdasheiff Posted April 25, 2005 Share Posted April 25, 2005 This code isn't working. If the file wmplayer.exe is corrupted, then FileGetVersion generates errorlevel 1 and the messagebox correctly prints out 'Windows Media Player - Trojan'. If the file wmplayer.exe is ok, no message. So far, so good. If the 2nd file shlwapi.dll is corrupted, the 2nd messagebox should print out 'Shell Light-weight Utility Library - Spyware' (whether wmplayer.exe generated errorlevel 0 or 1) but it doesn't print, even though I can confirm it's returning errorlevel 1 with my diagnostics - MsgBox(0,"ErrorLevel2",@error) If I Remark out all If and ElseIf and EndIf statements, all prints out. If I Remark out the 1st If, and replace ElseIf with If, it also works. And my Diagnostics of the extra MsgBox report correct errorlevels. Stumped! CODE -------------------------------------------------------------------------- $ver1 = FileGetVersion("c:\progra~1\window~1\wmplayer.exe") If @error = 1 Then $size1 = FileGetSize("c:\progra~1\window~1\wmplayer.exe") $s1="Correct version 9.0.0.2980" & @TAB & "Correct size 73728" & @LF $s2="Detected version " & $ver1 & @TAB & "Detected size " & $size1 & @LF & @LF $s3="Location: C:\Program Files\Window Media Player\wmplayer.exe" $s = $s1 & $s2 & $s3 MsgBox(0, "Windows Media Player - Trojan", $s) MsgBox(0,"ErrorLevel1",@error) ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $ver2 = FileGetVersion("c:\windows\sysbckup\shlwapi.dll") MsgBox(0,"ErrorLevel2",@error) ElseIf @error = 1 Then $size2 = FileGetSize("c:\windows\sysbckup\shlwapi.dll") $s1="Correct version 5.50.4134.600" & @TAB & "Correct size 300304" & @LF $s2="Detected version " & $ver2 & @TAB & "Detected size " & $size2 & @LF & @LF $s3="Location: C:\windows\system\shlwapi.dll" & @LF & @LF $s4="Backup: C:\windows\sysbckup\shlwapi.dll" $s = $s1 & $s2 & $s3 & $s4 MsgBox(0, "Shell Light-weight Utility Library - Spyware", $s) EndIf MsgBox(0,"ErrorLevel3",@error) -------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
megahyperion Posted April 25, 2005 Share Posted April 25, 2005 This will work with no errors if there are no errors, I had to mod the directory locations for XP pro FileGetVersion(@ProgramFilesDir & "\windows media player\wmplayer.exe") If @error = 1 Then $ver1 = FileGetVersion(@ProgramFilesDir & "\windows media player\wmplayer.exe") $size1 = FileGetSize(@ProgramFilesDir & "\windows media player\wmplayer.exe") $s1="Correct version 9.0.0.2980" & @TAB & "Correct size 73728" & @LF $s2="Detected version " & $ver1 & @TAB & "Detected size " & $size1 & @LF & @LF $s3="Location: "& @ProgramFilesDir & "\windows media player\wmplayer.exe" $s = $s1 & $s2 & $s3 MsgBox(0, "Windows Media Player - Trojan", $s) EndIf ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ FileGetVersion(@SystemDir & "\shlwapi.dll") If @error = 1 Then $ver2 = FileGetVersion(@SystemDir & "\shlwapi.dll") $size2 = FileGetSize(@SystemDir & "\shlwapi.dll") $s1="Correct version 5.50.4134.600" & @TAB & "Correct size 300304" & @LF $s2="Detected version " & $ver2 & @TAB & "Detected size " & $size2 & @LF & @LF $s3="Location:"& @SystemDir & "\shlwapi.dll" & @LF & @LF $s4="Backup:"& @SystemDir & "\shlwapi.dll" $s = $s1 & $s2 & $s3 & $s4 MsgBox(0, "Shell Light-weight Utility Library - Spyware", $s) EndIf I used this to test with errors FileGetVersion(@ProgramFilesDir & "\windows media player\wmplayer1.exe") If @error = 1 Then $ver1 = FileGetVersion(@ProgramFilesDir & "\windows media player\wmplayer.exe") $size1 = FileGetSize(@ProgramFilesDir & "\windows media player\wmplayer.exe") $s1="Correct version 9.0.0.2980" & @TAB & "Correct size 73728" & @LF $s2="Detected version " & $ver1 & @TAB & "Detected size " & $size1 & @LF & @LF $s3="Location: "& @ProgramFilesDir & "\windows media player\wmplayer.exe" $s = $s1 & $s2 & $s3 MsgBox(0, "Windows Media Player - Trojan", $s) EndIf ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ FileGetVersion(@SystemDir & "\shlwapi1.dll") If @error = 1 Then $ver2 = FileGetVersion(@SystemDir & "\shlwapi.dll") $size2 = FileGetSize(@SystemDir & "\shlwapi.dll") $s1="Correct version 5.50.4134.600" & @TAB & "Correct size 300304" & @LF $s2="Detected version " & $ver2 & @TAB & "Detected size " & $size2 & @LF & @LF $s3="Location:"& @SystemDir & "\shlwapi.dll" & @LF & @LF $s4="Backup:"& @SystemDir & "\shlwapi.dll" $s = $s1 & $s2 & $s3 & $s4 MsgBox(0, "Shell Light-weight Utility Library - Spyware", $s) EndIf since there are no files by that name I get an error on both and they both work. The whole app works on my machine now Link to comment Share on other sites More sharing options...
rdasheiff Posted April 25, 2005 Author Share Posted April 25, 2005 Thanks. I did try two if/then/EndIf sets before but obviously had some wrong logic in the code. Link to comment Share on other sites More sharing options...
megahyperion Posted April 25, 2005 Share Posted April 25, 2005 No problem, You need to have your @error right after the statement you want to check the error in. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now