correction of previous revision

git-svn-id: svn://kolibrios.org@1144 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2009-08-26 11:31:41 +00:00
parent d7d25fb0e8
commit 5d45c37af3
3 changed files with 80 additions and 16 deletions

View File

@ -28,8 +28,6 @@ CODE
redraw: ; redraw event handler
call draw_window ; at first create and draw the window
mcall 9, procinfo, -1
wait_event: ; main cycle
mov eax, 10
mcall
@ -90,7 +88,5 @@ end if
UDATA
sc system_colors
procinfo rb 1024
MEOS_APP_END
; <--- end of MenuetOS application --->

View File

@ -0,0 +1,68 @@
filename equ 'kosilka.exe'
virtual at 0
file filename:3Ch,4
load pehea dword from 0
file filename:pehea,0F8h+28h*3
load NumberOfSections word from 4+6
load SizeOfOptionalHeader word from 4+14h
if NumberOfSections<>3
error Expected three sections, .text, .bss and .reloc
end if
if SizeOfOptionalHeader<>0E0h
error Nonstandard PE header
end if
load RelocsRVA dword from 4+0A0h
load RelocsSize dword from 4+0A4h
load ImageBase dword from 4+34h
load TextRVA dword from 4+0F8h+0Ch
load TextSize dword from 4+0F8h+8
load TextOffs dword from 4+0F8h+14h
load BSSSize dword from 4+0F8h+28h+10h
load RelocRVA dword from 4+0F8h+28h*2+0Ch
load RelocOffs dword from 4+0F8h+28h*2+14h
if BSSSize
error Second section expected to be .bss
end if
if RelocRVA<>RelocsRVA
error Third section expected to be .reloc
end if
;file 'test.exe':pehea+0F8h,28h
;load physofs dword from 4+14h
;load mem dword from 4+8
;file 'test.exe':physofs+16,4
;load sz dword from $-4
end virtual
file filename:TextOffs,TextSize
while RelocsSize>8
virtual at 0
file filename:RelocOffs,8
load CurRelocPage dword from 0
load CurRelocChunkSize dword from 4
end virtual
RelocsSize=RelocsSize-CurRelocChunkSize
CurRelocChunkSize = CurRelocChunkSize-8
RelocOffs=RelocOffs+8
while CurRelocChunkSize
virtual at 0
file filename:RelocOffs,2
RelocOffs=RelocOffs+2
CurRelocChunkSize=CurRelocChunkSize-2
load s word from 0
end virtual
CurRelocType = s shr 12
RelocItem = CurRelocPage + (s and 0xFFF)
if CurRelocType=0
else if CurRelocType=3
load z dword from RelocItem-TextRVA
store dword z-(TextRVA+ImageBase) at RelocItem-TextRVA
else
error Unexpected relocation type
end if
end while
end while
store dword TextSize at 10h
store dword RelocRVA-TextRVA at 14h

View File

@ -25,7 +25,7 @@ START:
or eax, eax
jnz exit
; invoke sort.START, 1
invoke sort.START, 1
mov ecx, 1 ; for 15.4: 1 = tile
cmp word [@PARAMS], '\T'
@ -540,20 +540,20 @@ load_directory:
mov [eax+4], ebx
test ebx, ebx
jz free_directory
; push 0 ; sort mode
; push ebx
; add eax, 32
; push eax
; call [SortDir]
push 0 ; sort mode
push ebx
add eax, 32
push eax
call [SortDir]
xor eax, eax
mov edi, [directory_ptr]
add edi, 32 + 40
.scan:
mov esi, [last_name_component]
inc esi
; push edi
; invoke strcmpi
; pop edi
push edi
invoke strcmpi
pop edi
jz .found
inc eax
add edi, 304
@ -995,8 +995,8 @@ align 4
library \
libio , 'libio.obj' , \
libgfx , 'libgfx.obj' , \
libimg , 'libimg.obj' ;, \
; sort , 'sort.obj'
libimg , 'libimg.obj' , \
sort , 'sort.obj'
import libio , \
libio.init , 'lib_init' , \
@ -1022,7 +1022,7 @@ import libimg , \
img.destroy , 'img_destroy', \
img.draw , 'img_draw'
;import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
bFirstDraw db 0
;-----------------------------------------------------------------------------