can i make readable only data inside proc. ????
shouldn't be a problem... define a label at the end of your proc, after the ret, and put your data there?
Afternoon, AceEmbler.
Cheers,
Scronty
.code
...
jmp @F
mylabel db "My read-only data",0
@@:
invoke MessageBox, NULL, addr mylabel, NULL, MB_OK
...
Cheers,
Scronty
This is the best way for the processor.
MyProc PROC something:DWORD
mov eax, something
CONST SEGMENT
somthingElse DWORD 123
CONST ENDS
add eax, somthingElse
ret
MyProc ENDP
...it told me so itself. ;)scronty, why do the jmp version when you can just place the data after the final ret?
This is the best way for the processor.
MyProc PROC something:DWORD
mov eax, something
CONST SEGMENT
somthingElse DWORD 123
CONST ENDS
add eax, somthingElse
ret
MyProc ENDP
...it told me so itself. ;) Is this method working for *.lib or *.dll ???
Is this method working for *.lib or *.dll ???
AceEmbler,
Bitrake's code places your data in another segment (section), if I am not wrong, therefore it works for both dll and lib
Anyway fodder's suggestion for code after ret is applicable, but just remember that if you place data in code section, you cannot write to it unless of course you change the section flags to writeable too.
Bitrake's code places your data in another segment (section), if I am not wrong, therefore it works for both dll and lib
Anyway fodder's suggestion for code after ret is applicable, but just remember that if you place data in code section, you cannot write to it unless of course you change the section flags to writeable too.
Yes, I cannot see where it would result in a problem?
So where are section defined in our app ??
So where are section defined in our app ??
_TEXT SEGMENT READONLY PAGE PUBLIC FLAT 'CODE'
_TEXT ENDS
CONST SEGMENT READONLY PAGE PUBLIC FLAT 'CONST'
CONST ENDS
_DATA SEGMENT PAGE PUBLIC FLAT 'DATA'
_DATA ENDS
_BSS SEGMENT PAGE PUBLIC FLAT 'BSS'
_BSS ENDS
ASSUME CS:FLAT, DS:FLAT, SS:FLAT, ES:FLAT
The above is a direct replacement for .MODEL FLAT except using PAGE alignment.how our app knows that this is segment with data not instructions ??? i thought its somewhere in PE
The linker will create another section in the PE file based on the SEGMENT name and parameters.