การแข่งขันสร้างโปรแกรมตรวจหาไวรัสที่ Registry [You must be registered and logged in to see this link.]
ลำดับการส่ง (ตัวเลขต่อท้าย คือตัวเลขเวลาที่ส่ง ซึ่งเสร็จภายในระยะเวลา 1 วันทั้งคู่)
[You must be registered and logged in to see this image.]
โค้ดคำสั่งของคุณ Aut
- Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 496, 314, 192, 124)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 465, 257)
$Button1 = GUICtrlCreateButton("Button1", 16, 280, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 392, 280, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $rrr = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", $r3 = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
RegDelete("HKEY_CURRENT_USER\123")
For $i = 1 To 100
$rvar = RegEnumVal($rrr, $i)
If @error Then ExitLoop
$rread = RegRead($rrr, $rvar)
RegWrite("HKEY_CURRENT_USER\123", $rvar, "REG_SZ", $rread)
Next
GUICtrlSetData($Edit1, "สำรองแล้วนะ" & @CRLF)
Case $Button2
GUICtrlSetData($Edit1, "หาไวรัส..." & @CRLF)
For $i = 1 To 100
$r1 = RegEnumVal($rrr, $i)
If @error Then ExitLoop
For $i2 = 1 To 100
$r2 = RegEnumVal("HKEY_CURRENT_USER\123", $i2)
If @error Then ExitLoop
If StringInStr($r1, $r2) Then $r3 = 1
Next
If $r3 = 0 Then GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "เจอไวรัสคือ " & $r1 & @CRLF)
$r3 = 0
Next
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "เสร็จ")
EndSwitch
WEnd
โค้ดคำสั่งของคุณ sak20102005
- Code:
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#NoTrayIcon
#include <GuiEdit.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
Global $hForm, $hEdit, $Button1, $Button2, $title = 'RegVirScan'
Global $nMsg, $i, $REV, $RR, $Button3, $PID, $newtitle = 'RegVirScanning...'
Global $tiptxt = 'See message RegVirScan.log to the desktop'&@CRLF&'ถ้าแสกนครั้งเดียว กรุณาแสกนซ้ำอีกครั้ง'
Global $iconfile = @ScriptDir&'\scan.ico', $readreg
Global $hkeynum = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run'
Global $hkeyread = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run'
$hForm = GUICreate($title, 496, 314, -1, -1)
GUISetIcon($iconfile, -1, $hForm)
$hEdit = GUICtrlCreateEdit("", 16, 8, 465, 257)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Scan", 16, 280, 75, 25, $WS_GROUP)
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("Open log", 405, 280, 75, 25, $WS_GROUP)
GUICtrlSetCursor(-1, 0)
GUICtrlCreateLabel("Design by:sak20102005", 186, 282, 118, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
For $x = 255 To 0 Step -3
WinSetTrans($title, "", $x)
Sleep(1)
Next
Exit
Case $Button1
virautorun()
$PID = ProcessExists("notepad.exe")
If $PID Then ProcessClose($PID)
WinSetTitle($title,"", $newtitle)
If _GUICtrlEdit_GetText($hEdit) <> '' Then _GUICtrlEdit_SetText($hEdit, '')
For $i = 1 to 100
$REV = RegEnumVal($hkeynum, $i)
$RR = RegRead($hkeyread, $REV)
If @error <> 0 Then ExitLoop
_GUICtrlEdit_AppendText($hEdit, @CRLF & $RR)
Sleep(500)
Next
WinSetTitle($newtitle, "", $title)
ToolTip($tiptxt, 365, 350, "Scan complete.", 1, 1)
_FileWriteLog(@DesktopDir & "\RegVirScan.log", _GUICtrlEdit_GetText($hEdit))
Sleep(4000)
ToolTip("")
Case $Button2
If FileExists(@DesktopDir & "\RegVirScan.log") Then
ShellExecute(@DesktopDir & "\RegVirScan.log")
Else
MsgBox(0, "", "Can not found File.log")
EndIf
EndSwitch
WEnd
Func virautorun()
If Not RegRead($hkeyread, "Virustest") = 'Virus.exe' Then
MsgBox(0, "", "No, virus.")
ToolTip("Write Virus to registry. You try Scan.", 365, 350, "")
RegWrite($hkeyread, "VirusTest", "REG_SZ", "Virus.exe")
Else
MsgBox(0, "", "Virus processing..")
EndIf
EndFunc
########ผลการทดสอบการทำงานของโปรแกรมต่อด้านล่างครับ##################