;added to (my prev.post) code (thanks for help jimh)
;i want to read file in ram and works with gdi
;but after 3 file we have error not full name in message box and edi.
;
;pImjump dd offset szback<= this addres +9 inc edi ???
;how can i to do better? sorry for my english
Init_Scene PROTO
.data
imvol db 7; ------------------------ bmp need create 7 files by text editor *.bmp for test or paintbrush
szback db "back.bmp", 0 ; ôîí
szbexit db "exit.bmp", 0
szbwin db "win.bmp", 0
szbfull db "full.bmp", 0
szbb640 db "640.bmp",0
szb800 db "800.bmp",0
szb1024 db "1024.bmp"
pImjump dd szback, szbexit, szbwin, szbfull, szbb640, szb800,szb1024; ------------ jump table
.data?
hFile dd ? ;HANDLE
.code
Init_Scene proc
pusha
xor ecx,ecx
mov BYTE PTR cl,imvol
mov edi,pImjump
nextfile : push ecx
invoke CreateFile,edi,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL ;edi--- name file
.IF EAX==INVALID_HANDLE_VALUE
INVOKE MessageBox, hwnd,edi ,offset szErFile, MB_ICONERROR
INVOKE ExitProcess, 0
.ENDIF
mov hFile, eax
INVOKE MessageBox, hwnd,edi, offset szOkFile, MB_OK
INVOKE CloseHandle,hFile
pop ecx
dec ecx
cmp ecx,0
je ex
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi ;<======9 ????????
jmp nextfile
ex: popa
ret
Init_Scene endp
I don't know about the rest of the inner loop (just glanced at the code), but you didn't NULL-terminate the variable, "szb1024".
szb1024 db "1024.bmp",0
Besides what jimh said about the last filename not having a NULL terminator, the only thing I can see is the "inc edi" lines (all nine of them) should be just one add edi, 4 to move to the next string offset (which are DD values)..
Relvinian
null i forgert when make copy it dont nessary radasm check sintacs. add edi,4 dont work i try yet .correct jnly first name:*(
Quote from: ScorpForeva on January 12, 2005, 02:34:09 PM
.data
szback db "back.bmp", 0 ; ôîí
szbexit db "exit.bmp", 0
szbwin db "win.bmp", 0
szbfull db "full.bmp", 0
szbb640 db "640.bmp",0
szb800 db "800.bmp",0
szb1024 db "1024.bmp"
pImjump dd szback, szbexit, szbwin, szbfull, szbb640, szb800,szb1024; ------------ jump table
.code
mov edi,pImjump
nextfile :
invoke CreateFile,edi,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL ;edi--- name file
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi
inc edi ;<======9 ????????
jmp nextfile
Look carefully. Not all of your string entries are 9 bytes apart.
After the first entry, you don't make any use of the address (not jump) table.
i dont understend. why ? get main addres , used offset. when i use real mode early as jump table its worked.
you rigth tenkey ! i must use another algoritm ! or use only 9 bytes name of file!
Hi,
Try scanning for the 0 value inside the string instead adding 9 to the pointer. That is first use the string. Then increment the pointer until it reaches a null
Thomas Antony :U :U
If you want to fully use the string table you've created, do this:
mov esi, OFFSET pImjump ; get address of first table entry
nextfile:
mov edi, [esi] ; get string address from table entry
; ... use string address by using EDI
; ... test for end of table
add esi,4 ; adjust address to next table entry
jmp nextfile