News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Code inside data

Started by Human, February 07, 2006, 02:56:36 PM

Previous topic - Next topic

Human

is there way to force masm to not complain and for example do

.data
assume cs:nothing
temp      dd 0
log_ptr      dd 0
file_handle dd 0
kernel      db "kernel32.dll",0
getprocaddress   db "GetProcAddress",0
file_name   db "log.txt",0

align 4
do_log:
   invoke CreateFile,o file_name,GENERIC_WRITE,FILE_SHARE_READ,0,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE,0
   mov file_handle,eax
   invoke WriteFile,file_handle,o log,log_ptr,o temp,0
   invoke CloseHandle,file_handle
   ret

because sometimes i need it to some code be in data section and some in code
its just a small example. case is i need to build table of logging but begining will be modified so have to be in data
i know i can put all log write in code and do just call near ptr logging
but i want to know how to force it that way, in time of dos or tasm its possible, and it compiles and iat can be in code and we have call to iat from data

P1

We need a reasonable explaination for this request.

Topic Lock until we get one.

It's basically not needed for legitimate software.

Please PM a moderator to get this topic unlocked.

And if this is a learning exercise, be my guest, go learn, giving you an answer is not learning.

Regards,  P1  :8)