📄 rmecleaner.asm
字号:
.if FUNC(FileExists, offset m_szTempFilePath) == TRUE
;获取当前已经处理文件的大小,并更新进度条位置
mov eax,m_dwTempFileLength
mov dwTempLength, eax
invoke CreateFile, offset m_szTempFilePath,NULL,FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL
mov hFileHandle,eax
invoke GetFileSize, eax,NULL
mov m_dwTempFileLength, eax
invoke CloseHandle, hFileHandle
mov eax,dwTempLength
.if eax != m_dwTempFileLength
;更新进度条位置
;----------------------------------------------------------------------------
;计算比例
xor edx,edx
mov eax, m_dwTempFileLength
mov edx,100
mul edx
div m_dwSrcFileLength
mov ebx,eax
invoke dwtoa, ebx,addr szStrTemp
;------------------------------------------------
invoke SendMessage, m_hWndProgress,PBM_SETPOS,m_dwTempFileLength,0 ;位置
invoke lstrcpy, addr szTempBuffer,CTEXT("Real 文件弹出广告修复器 v1.0 - ")
invoke lstrcat, addr szTempBuffer,addr szStrTemp
invoke lstrcat, addr szTempBuffer,CTEXT("%")
invoke SendMessage, m_hWndMain,WM_SETTEXT,0,addr szTempBuffer
.endif
.endif
mov hProcess,FUNC(OpenProcess, PROCESS_QUERY_INFORMATION,FALSE,m_dwProcessID)
.if eax == 0
;进程已经完成处理
mov m_dwProcessID,0
invoke KillTimer, m_hWndMain,m_dwTimerID ;关闭计时器
mov m_dwTimerID,0
;删除文件和目录
invoke DelTempFiles
;恢复窗体状态
invoke LoadCursor, 0, IDC_ARROW
invoke SetClassLong, m_hWndMain,GCL_HCURSOR,eax
invoke EnableWindow, m_hWndBtnBrower,TRUE
invoke EnableWindow, m_hWndBtnRepair,TRUE
invoke EnableWindow, m_hWndEditPath,TRUE
.if FUNC(FileExists, offset m_szTempFilePath) == FALSE
invoke MessageBox, m_hWndMain,CTEXT("无法修复文件: 文件已经损坏或者拒绝访问(13211)! "),CTEXT("文件错误"),MB_ICONERROR
.else
ABS(m_dwSrcFileLength-m_dwTempFileLength)
.if eax>1024*64
invoke SendMessage, m_hWndMain,WM_SETTEXT,0,CTEXT("Real 文件弹出广告修复器 v1.0 - 任务中断")
invoke MessageBox, m_hWndMain,CTEXT("无法修复文件: 文件已经损坏或者拒绝访问(13212)! "),CTEXT("文件错误"),MB_ICONERROR
invoke DeleteFile, m_szTempFilePath
.else
.if FUNC(MoveFileEx, offset m_szTempFilePath,offset m_szSrcFilePath,MOVEFILE_REPLACE_EXISTING)
invoke SendMessage, m_hWndMain,WM_SETTEXT,0,CTEXT("Real 文件弹出广告修复器 v1.0 - 任务完成")
invoke lstrcpy, addr szTempBuffer,CTEXT("成功修复文件: ")
invoke lstrcat, addr szTempBuffer,offset m_szSrcFilePath
invoke lstrcat, addr szTempBuffer,CTEXT(". ")
invoke MessageBox, m_hWndMain,addr szTempBuffer,CTEXT("提示"), MB_ICONASTERISK
;---------------------------------------------------------------------------
invoke lstrcpy, addr szTempBuffer,CTEXT(" /select,")
invoke lstrcat, addr szTempBuffer,offset m_szSrcFilePath
invoke ShellExecute, NULL,NULL,CTEXT("explorer.exe"),addr szTempBuffer, NULL, SW_SHOWNORMAL
.else
invoke lstrcpy, addr szTempBuffer,CTEXT("已经修复文件: ")
invoke lstrcat, addr szTempBuffer,offset m_szSrcFilePath
invoke lstrcat, addr szTempBuffer,CTEXT(", 但由于源文件拒绝访问, 无法将.TMP文件重命名为.RMVB文件, 请手动将.TMP文件改名为.RMVB文件! ")
invoke MessageBox, m_hWndMain,addr szTempBuffer,CTEXT("警告"), MB_ICONWARNING
;--------------------------------------------------------------------
invoke lstrcpy, addr szTempBuffer,CTEXT(" /select,")
invoke lstrcat, addr szTempBuffer,addr m_szTempFilePath
invoke ShellExecute, NULL,NULL,CTEXT("explorer.exe"),addr szTempBuffer, NULL, SW_SHOWNORMAL
.endif
.endif
.endif
invoke SendMessage, m_hWndMain,WM_SETTEXT,0,CTEXT("Real 文件弹出广告修复器 v1.0 - AQiu Software Studio.")
invoke ShowWindow, m_hWndProgress,SW_HIDE
.endif
invoke CloseHandle,hProcess
Ret
OnTimer EndP
FileExists proc lpFileName:DWORD
;判断文件是否存在
LOCAL hFileHandle :HANDLE
LOCAL FindFileData :WIN32_FIND_DATA
invoke FindFirstFile, lpFileName,addr FindFileData
.if eax != INVALID_HANDLE_VALUE
invoke FindClose, eax
mov eax, FindFileData.dwFileAttributes
and eax,FILE_ATTRIBUTE_DIRECTORY
jne FindEnd
mov eax,TRUE
ret
.endif
FindEnd:
mov eax, FALSE
ret
FileExists EndP
IsRmEventRunning proc
;Find each process and display it.
LOCAL snapshot :HANDLE
LOCAL processinfo :PROCESSENTRY32
LOCAL status :BOOL
local szStrTemp[32] :BYTE
mov processinfo.dwSize, sizeof processinfo
invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS, 0
mov snapshot,eax
.if snapshot == NULL
mov eax,FALSE
ret
.endif
invoke Process32First, snapshot, addr processinfo
LoopStatus:
cmp eax,0
je LoopEnd
invoke szUpper,addr processinfo.szExeFile
invoke lstrcmp, eax,CTEXT("RMEC.EXE")
;比较结果,相等:EAX=0
cmp eax,0
jne LoopNext ;下一个进程
;RMEC.exe 进程存在]
mov eax,processinfo.th32ProcessID
mov m_dwProcessID,eax
mov eax,TRUE
invoke CloseHandle, snapshot
ret
LoopNext:
invoke Process32Next, snapshot,addr processinfo
jmp LoopStatus
LoopEnd:
invoke CloseHandle, snapshot
mov eax,FALSE
ret
IsRmEventRunning endp
SaveResourceToFile proc hInstance:DWORD,lpResName:DWORD,lpResType:DWORD,lpFileName:DWORD
LOCAL hFileHandle :HANDLE
LOCAL dwResSize :DWORD
LOCAL hGlobal :HGLOBAL
LOCAL hRsrc :HRSRC
.if FUNC(FindResource, hInstance,lpResName,lpResType) == NULL
jmp @srfResourceError
.else
mov hRsrc,eax
.if FUNC(LoadResource, hInstance,eax) == NULL
jmp @srfResourceError
.else
;装入资源成功
mov hGlobal,eax
mov dwResSize,FUNC(SizeofResource, hInstance,hRsrc)
.endif
.endif
;---------------------------------------------------------
;建立文件
mov hFileHandle,FUNC(CreateFile, lpFileName,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)
.if eax == INVALID_HANDLE_VALUE
jmp @srfResourceError
.endif
.if FUNC(WriteFile, hFileHandle,hGlobal,dwResSize,addr dwResSize,NULL) == 0
jmp @srfResourceError
.endif
invoke CloseHandle, hFileHandle
invoke FreeResource, hGlobal
mov eax,TRUE
ret
@srfResourceError:
mov eax,FALSE
Ret
SaveResourceToFile EndP
DelTempFiles proc
;删除文件和目录
invoke DeleteFile, addr m_szExecFilePath
invoke DeleteFile, addr m_szDllFilePath
invoke DeleteFile, addr m_szEventsFilePath
invoke RemoveDirectory, addr m_szRMecToolsDir
invoke RemoveDirectory, addr m_szRMecTmpDir
Ret
DelTempFiles EndP
szUpper proc text:DWORD
; -----------------------------
; converts string to upper case
; invoke szUpper,offset szString
; -----------------------------
mov eax, text
dec eax
@@:
add eax, 1
cmp BYTE PTR [eax], 0
je @F
cmp BYTE PTR [eax], "a"
jb @B
cmp BYTE PTR [eax], "z"
ja @B
sub BYTE PTR [eax], 32
jmp @B
@@:
mov eax, text
ret
szUpper endp
dwtoa proc dwValue:DWORD, lpBuffer:DWORD
; -------------------------------------------------------------
; convert DWORD to ascii string
; invoke dwtoa,edx,ADDR buffer
; Uses: eax, ecx, edx.
; -------------------------------------------------------------
push ebx
push esi
push edi
mov eax, dwValue
mov edi, [lpBuffer]
test eax,eax
jnz sign
zero:
mov word ptr [edi],30h
jmp dtaexit
sign:
jns pos
mov byte ptr [edi],'-'
neg eax
add edi, 1
pos:
mov ecx, 3435973837
mov esi, edi
.while (eax > 0)
mov ebx,eax
mul ecx
shr edx, 3
mov eax,edx
lea edx,[edx*4+edx]
add edx,edx
sub ebx,edx
add bl,'0'
mov [edi],bl
add edi, 1
.endw
mov byte ptr [edi], 0 ; terminate the string
; We now have all the digits, but in reverse order.
.while (esi < edi)
sub edi, 1
mov al, [esi]
mov ah, [edi]
mov [edi], al
mov [esi], ah
add esi, 1
.endw
dtaexit:
pop edi
pop esi
pop ebx
ret
dwtoa endp
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -