flat assembler
Message board for the users of flat assembler.

Index > Main > correct this code

Author
Thread Post new topic Reply to topic
redasmm



Joined: 14 Oct 2005
Posts: 4
redasmm
please correct this code Confused

file db '\x.spc',0
spc rb 66048 ;Dim spc(66048) As Byte

struc sx
{
.cBytes dd ?
.fFixedDisk dd ?
.nErrCode dd ?
.Reserved1 dd ?
.Reserved2 dd ?
.szPathName rb 128
}
OFSTRUCT sx

;Type OFSTRUCT
;cBytes As Byte
;fFixedDisk As Byte
;nErrCode As Integer
;Reserved1 As Integer
;Reserved2 As Integer
;szPathName(128) As Byte
;End Type

xor ebx,ebx
invoke OpenFile,file,OFSTRUCT,ebx
mov ebp,eax
invoke ReadFile,ebp,spc(0),66048,ebx,ebx ;spc(0) ?
invoke CloseHandle,ebp

thx
Post 17 Oct 2005, 19:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
if used inside stackframe procedure cahnging EBP (mov ebp,eax) may be problem, try to use ECX or whatever.
Post 17 Oct 2005, 20:53
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Ancient One



Joined: 28 Feb 2005
Posts: 55
Ancient One
Code:
struc sx 
{ 
.cBytes dd ? 
.fFixedDisk dd ? 
.nErrCode dd ? 
.Reserved1 dd ? 
.Reserved2 dd ? 
.szPathName rb 128 
} 
OFSTRUCT sx 
    

should be
Code:
struc OFSTRUCT
{ 
.cBytes dd ? 
.fFixedDisk dd ? 
.nErrCode dd ? 
.Reserved1 dd ? 
.Reserved2 dd ? 
.szPathName rb 128 
} 
sx OFSTRUCT
    


change
Code:
invoke OpenFile,file,OFSTRUCT,ebx 
    

to
Code:
invoke OpenFile,file,sx,ebx 
    


change spc(0) to just spc.

and file is a reserved keyword in fasm. use other name. also it's better to put any reserved (rb, rd, etc) at the end of source.
Post 18 Oct 2005, 03:20
View user's profile Send private message MSN Messenger Reply with quote
redasmm



Joined: 14 Oct 2005
Posts: 4
redasmm
thx Wink
Post 18 Oct 2005, 15:45
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.