2006-10-12 01:19:10 +02:00
|
|
|
macro opendialog redproc,openoff,erroff,path
|
|
|
|
{
|
|
|
|
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
|
|
|
|
local run_fileinfo, param
|
|
|
|
local getmesloop, loox, mred, mkey, mbutton, mgetmes
|
|
|
|
local dlg_is_work, ready, procinfo
|
|
|
|
;
|
|
|
|
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
|
|
|
|
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
|
|
|
|
;
|
|
|
|
|
|
|
|
cld
|
|
|
|
;; mov esi,path
|
|
|
|
mov edi,path
|
2006-12-29 15:50:24 +01:00
|
|
|
xor eax,eax
|
|
|
|
mov ecx,(1024+16)/4
|
|
|
|
rep stosd
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
;mov [get_loops],0
|
|
|
|
mov [dlg_pid_get],0
|
|
|
|
|
|
|
|
; Get my PID in dec format 4 bytes
|
|
|
|
mov eax,9
|
|
|
|
mov ebx,procinfo
|
2007-05-10 15:48:35 +02:00
|
|
|
or ecx,-1
|
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
; convert eax bin to param dec
|
|
|
|
mov eax,dword [procinfo+30] ;offset of myPID
|
|
|
|
mov edi,param+4-1 ;offset to 4 bytes
|
|
|
|
mov ecx,4
|
|
|
|
mov ebx,10
|
|
|
|
cld
|
|
|
|
new_d:
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
add dl,'0'
|
|
|
|
mov [edi],dl
|
|
|
|
dec edi
|
|
|
|
loop new_d
|
|
|
|
|
|
|
|
; wirite 1 byte space to param
|
|
|
|
mov [param+4],byte 32 ;Space for next parametr
|
|
|
|
; and 1 byte type of dialog to param
|
|
|
|
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
|
|
|
|
|
|
|
|
;
|
|
|
|
; STEP2 prepare IPC area for get messages
|
|
|
|
;
|
|
|
|
|
|
|
|
; prepare IPC area
|
|
|
|
mov [path],dword 0
|
|
|
|
mov [path+4],dword 8
|
|
|
|
|
|
|
|
; define IPC memory
|
|
|
|
mov eax,60
|
|
|
|
mov ebx,1 ; define IPC
|
|
|
|
mov ecx,path ; offset of area
|
2006-12-29 15:50:24 +01:00
|
|
|
mov edx,1024+16 ; size
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
; change wanted events list 7-bit IPC event
|
|
|
|
mov eax,40
|
|
|
|
mov ebx,01000111b
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
;
|
|
|
|
; STEP 3 run SYSTEM XTREE with parameters
|
|
|
|
;
|
|
|
|
|
2006-12-29 15:50:24 +01:00
|
|
|
mov eax,70
|
2006-10-12 01:19:10 +02:00
|
|
|
mov ebx,run_fileinfo
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
call redproc
|
|
|
|
|
|
|
|
mov [get_loops],0
|
|
|
|
getmesloop:
|
|
|
|
mov eax,23
|
|
|
|
mov ebx,50 ;0.5 sec
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-12-29 15:50:24 +01:00
|
|
|
dec eax
|
|
|
|
jz mred
|
|
|
|
dec eax
|
|
|
|
jz mkey
|
|
|
|
dec eax
|
|
|
|
jz mbutton
|
|
|
|
cmp al, 7-3
|
|
|
|
jz mgetmes
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
; Get number of procces
|
|
|
|
mov ebx,procinfo
|
|
|
|
mov ecx,-1
|
|
|
|
mov eax,9
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
mov ebp,eax
|
|
|
|
|
|
|
|
loox:
|
|
|
|
mov eax,9
|
|
|
|
mov ebx,procinfo
|
|
|
|
mov ecx,ebp
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax,[DLGPID]
|
|
|
|
cmp [procinfo+30],eax ;IF Dialog find
|
|
|
|
je dlg_is_work ;jmp to dlg_is_work
|
|
|
|
dec ebp
|
|
|
|
jnz loox
|
|
|
|
|
|
|
|
jmp erroff
|
|
|
|
|
|
|
|
dlg_is_work:
|
|
|
|
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
|
|
|
|
je erroff ;TESTODP2 terminated too
|
|
|
|
|
|
|
|
cmp [dlg_pid_get],dword 1
|
|
|
|
je getmesloop
|
|
|
|
inc [get_loops]
|
|
|
|
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
|
|
|
|
jae erroff
|
|
|
|
jmp getmesloop
|
|
|
|
|
|
|
|
mred:
|
|
|
|
call redproc
|
|
|
|
jmp getmesloop
|
|
|
|
mkey:
|
|
|
|
mov eax,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall ; read (eax=2)
|
2006-10-12 01:19:10 +02:00
|
|
|
jmp getmesloop
|
|
|
|
mbutton:
|
|
|
|
mov eax,17 ; get id
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp ah,1 ; button id=1 ?
|
|
|
|
jne getmesloop
|
|
|
|
mov eax,-1 ; close this program
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
mgetmes:
|
|
|
|
|
|
|
|
; If dlg_pid_get then second message get jmp to still
|
|
|
|
cmp [dlg_pid_get],dword 1
|
|
|
|
je ready
|
|
|
|
|
|
|
|
; First message is number of PID SYSXTREE dialog
|
|
|
|
|
|
|
|
; convert PID dec to PID bin
|
|
|
|
movzx eax,byte [path+16]
|
|
|
|
sub eax,48
|
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [path+16+1]
|
|
|
|
add eax,ebx
|
|
|
|
sub eax,48
|
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [path+16+2]
|
|
|
|
add eax,ebx
|
|
|
|
sub eax,48
|
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [path+16+3]
|
|
|
|
add eax,ebx
|
|
|
|
sub eax,48
|
|
|
|
mov [DLGPID],eax
|
|
|
|
|
|
|
|
; Claear and prepare IPC area for next message
|
|
|
|
mov [path],dword 0
|
|
|
|
mov [path+4],dword 8
|
|
|
|
mov [path+8],dword 0
|
|
|
|
mov [path+12],dword 0
|
|
|
|
mov [path+16],dword 0
|
|
|
|
|
|
|
|
; Set dlg_pid_get for get next message
|
|
|
|
mov [dlg_pid_get],dword 1
|
|
|
|
call redproc ;show DLG_PID
|
|
|
|
jmp getmesloop
|
|
|
|
|
|
|
|
ready:
|
|
|
|
;
|
|
|
|
; The second message get
|
|
|
|
; Second message is 100 bytes path to SAVE/OPEN file
|
|
|
|
; shl path string on 16 bytes
|
|
|
|
;
|
|
|
|
cld
|
|
|
|
mov esi,path+16
|
|
|
|
mov edi,path
|
2006-12-29 15:50:24 +01:00
|
|
|
mov ecx,1024/4
|
|
|
|
rep movsd
|
2006-10-12 01:19:10 +02:00
|
|
|
mov [edi],byte 0
|
|
|
|
|
|
|
|
jmp openoff
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
get_loops dd 0
|
|
|
|
dlg_pid_get dd 0
|
|
|
|
DLGPID dd 0
|
|
|
|
|
|
|
|
param:
|
|
|
|
dd 0 ; My dec PID
|
|
|
|
dd 0,0 ; Type of dialog
|
|
|
|
|
|
|
|
run_fileinfo:
|
2006-12-29 15:50:24 +01:00
|
|
|
dd 7
|
2006-10-12 01:19:10 +02:00
|
|
|
dd 0
|
|
|
|
dd param
|
|
|
|
dd 0
|
2006-12-29 15:50:24 +01:00
|
|
|
dd 0
|
2006-10-12 01:19:10 +02:00
|
|
|
;run_filepath
|
2007-06-08 17:54:05 +02:00
|
|
|
db '/sys/SYSXTREE',0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
procinfo:
|
|
|
|
times 1024 db 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
macro savedialog redproc,openoff,erroff,path
|
|
|
|
{
|
|
|
|
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
|
|
|
|
local run_fileinfo, run_filepath, param
|
|
|
|
local getmesloop, loox, mred, mkey, mbutton, mgetmes
|
|
|
|
local dlg_is_work, ready, procinfo
|
|
|
|
;
|
|
|
|
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
|
|
|
|
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
|
|
|
|
;
|
|
|
|
|
|
|
|
cld
|
|
|
|
;; mov esi,path
|
|
|
|
mov edi,path
|
2006-12-29 15:50:24 +01:00
|
|
|
xor eax,eax
|
|
|
|
mov ecx,(1024+16)/4
|
2006-10-12 01:19:10 +02:00
|
|
|
rep stosb
|
|
|
|
|
|
|
|
;mov [get_loops],0
|
|
|
|
mov [dlg_pid_get],0
|
|
|
|
|
|
|
|
; Get my PID in dec format 4 bytes
|
|
|
|
mov eax,9
|
|
|
|
mov ebx,procinfo
|
|
|
|
mov ecx,-1
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
; convert eax bin to param dec
|
|
|
|
mov eax,dword [procinfo+30] ;offset of myPID
|
|
|
|
mov edi,param+4-1 ;offset to 4 bytes
|
|
|
|
mov ecx,4
|
|
|
|
mov ebx,10
|
|
|
|
cld
|
|
|
|
new_d:
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
add dl,'0'
|
|
|
|
mov [edi],dl
|
|
|
|
dec edi
|
|
|
|
loop new_d
|
|
|
|
|
|
|
|
; wirite 1 byte space to param
|
|
|
|
mov [param+4],byte 32 ;Space for next parametr
|
|
|
|
; and 1 byte type of dialog to param
|
|
|
|
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog)
|
|
|
|
|
|
|
|
;
|
|
|
|
; STEP2 prepare IPC area for get messages
|
|
|
|
;
|
|
|
|
|
|
|
|
; prepare IPC area
|
|
|
|
mov [path],dword 0
|
|
|
|
mov [path+4],dword 8
|
|
|
|
|
|
|
|
; define IPC memory
|
|
|
|
mov eax,60
|
|
|
|
mov ebx,1 ; define IPC
|
2006-12-29 15:50:24 +01:00
|
|
|
mov ecx,path ; offset of area
|
|
|
|
mov edx,1024+16 ; size
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
; change wanted events list 7-bit IPC event
|
|
|
|
mov eax,40
|
|
|
|
mov ebx,01000111b
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
;
|
|
|
|
; STEP 3 run SYSTEM XTREE with parameters
|
|
|
|
;
|
|
|
|
|
2006-12-29 15:50:24 +01:00
|
|
|
mov eax,70
|
2006-10-12 01:19:10 +02:00
|
|
|
mov ebx,run_fileinfo
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
call redproc
|
|
|
|
|
|
|
|
mov [get_loops],0
|
|
|
|
getmesloop:
|
|
|
|
mov eax,23
|
|
|
|
mov ebx,50 ;0.5 sec
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-12-29 15:50:24 +01:00
|
|
|
dec eax
|
|
|
|
jz mred
|
|
|
|
dec eax
|
|
|
|
jz mkey
|
|
|
|
dec eax
|
|
|
|
jz mbutton
|
|
|
|
cmp al, 7-3
|
|
|
|
jz mgetmes
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
; Get number of procces
|
|
|
|
mov ebx,procinfo
|
|
|
|
mov ecx,-1
|
|
|
|
mov eax,9
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
mov ebp,eax
|
|
|
|
|
|
|
|
loox:
|
|
|
|
mov eax,9
|
|
|
|
mov ebx,procinfo
|
|
|
|
mov ecx,ebp
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax,[DLGPID]
|
|
|
|
cmp [procinfo+30],eax ;IF Dialog find
|
|
|
|
je dlg_is_work ;jmp to dlg_is_work
|
|
|
|
dec ebp
|
|
|
|
jnz loox
|
|
|
|
|
|
|
|
jmp erroff
|
|
|
|
|
|
|
|
dlg_is_work:
|
|
|
|
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
|
|
|
|
je erroff ;TESTODP2 terminated too
|
|
|
|
|
|
|
|
cmp [dlg_pid_get],dword 1
|
|
|
|
je getmesloop
|
|
|
|
inc [get_loops]
|
|
|
|
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
|
|
|
|
jae erroff
|
|
|
|
jmp getmesloop
|
|
|
|
|
|
|
|
mred:
|
|
|
|
call redproc
|
|
|
|
jmp getmesloop
|
|
|
|
mkey:
|
|
|
|
mov eax,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall ; read (eax=2)
|
2006-10-12 01:19:10 +02:00
|
|
|
jmp getmesloop
|
|
|
|
mbutton:
|
|
|
|
mov eax,17 ; get id
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp ah,1 ; button id=1 ?
|
|
|
|
jne getmesloop
|
|
|
|
mov eax,-1 ; close this program
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-10-12 01:19:10 +02:00
|
|
|
mgetmes:
|
|
|
|
|
|
|
|
; If dlg_pid_get then second message get jmp to still
|
|
|
|
cmp [dlg_pid_get],dword 1
|
|
|
|
je ready
|
|
|
|
|
|
|
|
; First message is number of PID SYSXTREE dialog
|
|
|
|
|
|
|
|
; convert PID dec to PID bin
|
|
|
|
movzx eax,byte [path+16]
|
|
|
|
sub eax,48
|
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [path+16+1]
|
|
|
|
add eax,ebx
|
|
|
|
sub eax,48
|
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [path+16+2]
|
|
|
|
add eax,ebx
|
|
|
|
sub eax,48
|
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [path+16+3]
|
|
|
|
add eax,ebx
|
|
|
|
sub eax,48
|
|
|
|
mov [DLGPID],eax
|
|
|
|
|
|
|
|
; Claear and prepare IPC area for next message
|
|
|
|
mov [path],dword 0
|
|
|
|
mov [path+4],dword 8
|
|
|
|
mov [path+8],dword 0
|
|
|
|
mov [path+12],dword 0
|
|
|
|
mov [path+16],dword 0
|
|
|
|
|
|
|
|
; Set dlg_pid_get for get next message
|
|
|
|
mov [dlg_pid_get],dword 1
|
|
|
|
call redproc ;show DLG_PID
|
|
|
|
jmp getmesloop
|
|
|
|
|
|
|
|
ready:
|
|
|
|
;
|
|
|
|
; The second message get
|
|
|
|
; Second message is 100 bytes path to SAVE/OPEN file
|
|
|
|
; shl path string on 16 bytes
|
|
|
|
;
|
|
|
|
cld
|
|
|
|
mov esi,path+16
|
|
|
|
mov edi,path
|
2006-12-29 15:50:24 +01:00
|
|
|
mov ecx,1024/4
|
|
|
|
rep movsd
|
2006-10-12 01:19:10 +02:00
|
|
|
mov [edi],byte 0
|
|
|
|
|
|
|
|
jmp openoff
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
get_loops dd 0
|
|
|
|
dlg_pid_get dd 0
|
|
|
|
DLGPID dd 0
|
|
|
|
|
|
|
|
param:
|
|
|
|
dd 0 ; My dec PID
|
|
|
|
dd 0,0 ; Type of dialog
|
|
|
|
|
|
|
|
run_fileinfo:
|
2006-12-29 15:50:24 +01:00
|
|
|
dd 7
|
2006-10-12 01:19:10 +02:00
|
|
|
dd 0
|
|
|
|
dd param
|
|
|
|
dd 0
|
2006-12-29 15:50:24 +01:00
|
|
|
dd 0
|
2006-10-12 01:19:10 +02:00
|
|
|
;run_filepath:
|
2007-06-08 17:54:05 +02:00
|
|
|
db '/sys/SYSXTREE',0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
procinfo:
|
|
|
|
times 1024 db 0
|
|
|
|
}
|
|
|
|
;-----------------------------------------------------------
|