try compile the following code and diassemble it,what's the result?
the code is not correctly generated,and the entrypoint is also not correct.
I think it's a bug,but I need more test....
.386
.Model Flat,StdCall
Option Casemap :None
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includeLib \masm32\lib\kernel32.lib
.CODE
Dprint PROC errMsg:DWORD
CONST segment
mes0 db "a",0
CONST ends
;mov eax,offset mes0
ret
Dprint ENDP
;;Prog Entry Point
;;//////////////////////////////////////////////////////////
_StArT PROC uses eax ecx
;LOCAL wsa:WSADATA
@ep:
invoke ExitProcess,0
@e2ep:
invoke Dprint,ebx
jmp @ep
RET
;;////////////////////////////////////////////////////////
_StArT ENDP
END _StArT
the code is not correctly generated,and the entrypoint is also not correct.
I think it's a bug,but I need more test....
.386
.Model Flat,StdCall
Option Casemap :None
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includeLib \masm32\lib\kernel32.lib
.CODE
Dprint PROC errMsg:DWORD
CONST segment
mes0 db "a",0
CONST ends
;mov eax,offset mes0
ret
Dprint ENDP
;;Prog Entry Point
;;//////////////////////////////////////////////////////////
_StArT PROC uses eax ecx
;LOCAL wsa:WSADATA
@ep:
invoke ExitProcess,0
@e2ep:
invoke Dprint,ebx
jmp @ep
RET
;;////////////////////////////////////////////////////////
_StArT ENDP
END _StArT
As fas as I remeber its the CONST segment definition at the beginning of a proc which may cause problems.
Can be avoided by using simplified segment directives (.const).
Can be avoided by using simplified segment directives (.const).
Try putting the following code into the .DATA section
Your current code is trying to use "Dprint" as the code entry point where what you need is a label after the ".code" directive that is matched at the end of the file with "end yourlabel".
Like this,
Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
;CONST segment
;mes0 db "a",0
;CONST ends
.data
mes0 db "a",0
Your current code is trying to use "Dprint" as the code entry point where what you need is a label after the ".code" directive that is matched at the end of the file with "end yourlabel".
Like this,
; put your data here.
.data
mes0 db "a",0
;put your code here
.code
startlabel: ; <<<<< entry point
; write your application code here
end startlabel
Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
hutch,
the question is _StArT is a procedure name,also is a label,in my code,I also used
end _StArT
to define entrypoint explicitly,but masm did the wrong thing,I can't understand this behaviour of MASM,the solution is very simple,but I think it's a BUG of MASM.
the question is _StArT is a procedure name,also is a label,in my code,I also used
end _StArT
to define entrypoint explicitly,but masm did the wrong thing,I can't understand this behaviour of MASM,the solution is very simple,but I think it's a BUG of MASM.
What do you want to tell us? You've found a bug, or you want to know how to get the workaround to avoid such bug?
If your purpose is the first one, you'd better send a mail to M$ rather than post it to a messageboard. If it's the latter one, as you've said, "the solution is very simple", you have got it.
btw, it's not strange for such a bug. No software is bug free.
If your purpose is the first one, you'd better send a mail to M$ rather than post it to a messageboard. If it's the latter one, as you've said, "the solution is very simple", you have got it.
btw, it's not strange for such a bug. No software is bug free.
Hume,
Your problem apart from the suggestion that does work is that your first label is the proc name
Yet you close the program with
Same rule applies, make sure the label AT the entry point is matched by the END label at the end of the code.
MASM does have the odd bug here and there but this problem is a mistake in your code, not a bug in MASM.
Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
Your problem apart from the suggestion that does work is that your first label is the proc name
Dprint
Yet you close the program with
END _StArT
Same rule applies, make sure the label AT the entry point is matched by the END label at the end of the code.
MASM does have the odd bug here and there but this problem is a mistake in your code, not a bug in MASM.
Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
hutch,
I think it's not caused by the
Dprint procwww
....
if you remove the const segment definition,then all is OK.
if you place the const segment definition anywhere else,then it's OK.
I think there may be a bug in CONST segmentation parsing.
I think it's not caused by the
Dprint procwww
....
if you remove the const segment definition,then all is OK.
if you place the const segment definition anywhere else,then it's OK.
I think there may be a bug in CONST segmentation parsing.
Hume,
MASM syntax is set by MASM, not by opinion, the code entry point is at the start of the .code section and in an ordinary MASM executable in 32 bit, this is 1000h. It can vary depending on the structure of the EXE file.
Now when you mess up the entry point with a procedure that cannot get parameters passed to it, you need to fix the file first, not pass the buck to MASM. To go over it again, match the label at the entry point with the end statement at the end of your code.
Remember that NOTHING is passed at the entry point so having stack based parameters is a mistake. When you fix the mistakes in the file, THEN you can play with a .CONST segment if you can get it to work.
Regards,
hutch at movsd dot com
MASM syntax is set by MASM, not by opinion, the code entry point is at the start of the .code section and in an ordinary MASM executable in 32 bit, this is 1000h. It can vary depending on the structure of the EXE file.
Now when you mess up the entry point with a procedure that cannot get parameters passed to it, you need to fix the file first, not pass the buck to MASM. To go over it again, match the label at the entry point with the end statement at the end of your code.
Remember that NOTHING is passed at the entry point so having stack based parameters is a mistake. When you fix the mistakes in the file, THEN you can play with a .CONST segment if you can get it to work.
Regards,
hutch at movsd dot com