📄 p2kman.asm
字号:
push offset DevMonitor_Proc
push 0
push 0
call CreateThread
mov Thread_Handle, eax
push offset ini_file
push 0
push offset ini_AutoFileList
push offset ini_general
call GetPrivateProfileIntA
mov AutoUpd, eax
push 0
push AutoUpd
push 0F1h ; BM_SetCheck
push 1020
push [ebp+arg_0]
call SendDlgItemMessageA
pop ecx
pop edx
pop edi
pop esi
mov eax, 1
leave
retn 10h
Dev_Notify:
mov eax, [ebp+arg_8]
cmp eax, 1
jz Dev_conn
cmp eax, 0
jnz dev_done
push offset str_not_conn
push 1019
push Dlg_hwnd
call SetDlgItemTextA
jmp dev_done
Dev_Conn:
push offset str_conn
push 1019
push Dlg_hwnd
call SetDlgItemTextA
cmp AutoUpd, 1
jnz dev_done
push [ebp+arg_0]
call ListP2K
dev_done:
mov eax, 1
leave
retn 10h
;-----------------------------------
;-----------------------------------
;-----------------------------------
;-----------------------------------
;-----------------------------------
WM_NOTIFY: ; Proceed mouse or kbd events on window
mov eax, [ebp+arg_C]
mov eax,[eax+8]
cmp eax, -5
je lv_rclick
cmp eax, -6Ch ; LVN_COLUMNCLICK
je lvn_columnclick ; default
jmp dlg_exit
lv_rclick:
; Find selected item
push 2 ; flags - search for selected item
push -1 ; start from beginning
push 100Ch ; LVM_GETNEXTITEM
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
mov lv_Item, 0
mov lv_SubItem, 0
mov lv_Text, offset lv_get_text
mov lv_TextMax, 105h
push offset lv_Mask
push eax
push 102Dh ; LVM_GETITEMTEXT
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
push offset Cursor_X
call GetCursorPos
xor ecx, ecx
push ecx
push ds:Menu_Handle
call GetSubMenu
push eax
push [ebp+arg_0]
call SetForegroundWindow
pop eax
push 0
push [ebp+arg_0]
push 0
push ds:Cursor_Y
push ds:Cursor_X
push 2
push eax
call TrackPopupMenu
push 0
push 0
push 0
push [ebp+arg_0]
call PostMessageA
jmp dlg_exit
lvn_columnclick:
mov esi, [ebp+arg_C]
mov eax, LV_Sort_id
mov ecx, [esi+10h]
cmp ecx, eax
jnz short @@skip_?
mov cl, LV_Sort_dir
test cl, cl
setz LV_Sort_dir
@@skip_?:
mov lv_Col_mask, 1
mov lv_col_fmt, 0
push offset lv_Col_Mask
push eax
push 101Ah ; LVM_SETCOLUMN
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
mov cl, LV_Sort_dir
and ecx, 0FFh
mov lv_col_extra, ecx
mov lv_col_mask, 11h
mov lv_col_fmt, 1800h ; image, on_right
push offset lv_Col_Mask
mov edx, [esi+10h]
push edx
push 101Ah ; LVM_SETCOLUMN
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
mov eax, [esi+10h]
mov LV_Sort_id, eax
push offset LV_Sort_Proc
push eax
push 1030h
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
jmp dlg_exit
;------------------------------------
Dlg_close:
push 0
push [ebp+arg_0]
call EndDialog
mov eax, 1
leave
retn 10h
Dlg_Proc endp
DevMonitor_Proc proc near
@@init_fail:
push 3E8h
call Sleep
call COM_Find
cmp eax, 0
jnz @@no_comm
call Switch_mode
push 1388h
call Sleep
@@no_comm:
call FindUSBClass
cmp _DevIF, 0
jz @@init_fail
mov DevFound, 1
push 0
push 1
push 402h
push Dlg_hwnd
call SendMessageA
mov eax, Dev_Name_Ptr
add eax, 4
push eax
push offset str_devclass_key
push offset str_buf
call wsprintfA
add esp, 0Ch
mov byte ptr [str_buf+56h], '#'
mov byte ptr [str_buf+57h], '#'
mov byte ptr [str_buf+59h], '#'
push offset Key_Class_handle ; handle
push 20019h ; access mask
push 0 ; res
push offset str_buf ; subkey
push 80000002h ; key
call RegOpenKeyExA
push 0 ; async flag
push 0; Key_Event
push 5 ;notify filter - name+last_set
push 1 ; flag subkey notify
push Key_Class_handle
call RegNotifyChangeKeyValue
push Key_Class_handle
call RegCloseKey
push _DevIF
call CloseHandle
push Dev_Name_Ptr
call GlobalFree
mov DevFound, 0
mov _DevIF, 0
push 0
push 0
push 402h
push Dlg_hwnd
call SendMessageA
push 1388h
call Sleep
jmp @@init_fail
DevMonitor_Proc endp
; Add new line to ListBox with args:
; arg_0 - hwnd
; arg_4 - file size
; arg_8 - file attr
; arg_C - file name
; arg_10 - file type
; arg_14 - file icon
AddRow proc near
arg_0 = dword ptr 08h
arg_4 = dword ptr 0Ch
arg_8 = dword ptr 10h
arg_C = dword ptr 14h
arg_10 = dword ptr 18h
arg_14 = dword ptr 1Ch
push ebp
mov ebp, esp
pusha
mov lv_Mask, 7
mov lv_Item, 0
mov lv_SubItem, 0
mov lv_State, 0
mov lv_StateMask, 0
mov lv_TextMax, 0
mov lv_Image, 2
mov lv_LParam, 0
mov eax, [ebp+arg_C]
push esi
push ecx
xor esi, esi
@@loop:
mov cl, [eax+esi]
mov [str_buf+esi],cl
inc esi
mov ecx, FileList_RecSize
sub ecx, 8
cmp esi, ecx
jb @@loop
mov byte ptr [str_buf+ecx], 0
pop ecx
pop esi
mov eax, offset str_buf
mov lv_Text, eax
mov eax, [ebp+arg_C]
mov lv_LParam, eax
push offset lv_Mask
push 0
push 1007h ; InsertItem
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
mov lv_Item, eax
push [ebp+arg_8]
push offset str_hex
push offset str_buf
call wsprintfA
add esp, 0Ch
mov lv_SubItem,1
push offset lv_Mask
mov eax, offset str_buf
mov lv_Text, eax
push 0
push 102Eh ; set item text
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
push [ebp+arg_4]
push offset str_dec
push offset str_buf
call wsprintfA
add esp, 0Ch
mov eax,offset str_buf
mov lv_Text,eax
mov lv_SubItem,2
push offset lv_Mask
push 0
push 102Eh ; set item text
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
mov lv_SubItem,3
push offset lv_Mask
mov eax, [ebp+arg_10]
mov lv_Text, eax
push 0
push 102Eh ; set item text
push 3F0h
push [ebp+arg_0]
call SendDlgItemMessageA
popa
leave
retn 18h
AddRow endp
LV_Sort_Proc proc near
arg_0 = dword ptr 8
arg_4 = dword ptr 0Ch
arg_8 = dword ptr 10h
push ebp
mov ebp, esp
push ecx
push edx
mov eax, [ebp+arg_8]
cmp eax, 1
je @@attr
cmp eax, 2
je @@size
cmp eax, 3
je @@type
mov ecx, [ebp+arg_0]
mov edx, [ebp+arg_4]
@@next_name:
mov al, [ecx]
cmp al, [edx]
ja @@name_a
jb @@name_b
inc ecx
inc edx
cmp al, 0
jz @@exit
mov eax, [ebp+arg_0]
add eax, FileList_RecSize
sub eax, 8
cmp ecx, eax
jnz @@next_name
@@name_b:
mov eax, 0
jmp @@exit
@@name_a:
mov eax, 1
jmp @@exit
@@attr:
mov eax, [ebp+arg_0]
mov edx, FileList_RecSize
mov ecx, [eax+edx-8]
mov eax, [ebp+arg_4]
mov edx, [eax+edx-8]
xor eax, eax
cmp ecx, edx
setnb al
jmp @@exit
@@size:
mov eax, [ebp+arg_0]
mov edx, FileList_RecSize
mov ecx, [eax+edx-4]
mov eax, [ebp+arg_4]
mov edx, [eax+edx-4]
xor eax, eax
cmp ecx, edx
setnb al
jmp @@exit
@@type:
push [ebp+arg_0]
call GetFile_ext
mov ecx, eax
push [ebp+arg_4]
call GetFile_ext
mov edx, eax
@@next_type:
mov al, [ecx]
cmp al, [edx]
ja @@type_a
jb @@type_b
inc ecx
inc edx
cmp al, 0
jz @@exit
mov eax, [ebp+arg_0]
add eax, FileList_RecSize
sub eax, 8
cmp ecx, eax
jnz @@next_type
@@type_b:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -