News:

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

hutch, question for you

Started by zemtex, July 24, 2011, 01:28:03 AM

Previous topic - Next topic

zemtex

In your masm1k example. I see that you use polink to merge the code and data section. But you have declared only a code section, my question to you, why so?  :bg

In my understanding, /merge will automatically merge the two for you and automatically fix addresses, am I wrong? You can perfectly define a data section too, but why do you have only a code section?
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

hutch--

Pretty straight forward, I wanted to avoid the extra 512 bytes by having any .DATA or .DATA? section. In anything much larger than a demo like this it just does not matter as you need some form of data that is both read/write. In a simple demo you can put data in the code section if its read only.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zemtex

What happens with aligning when you merge the two? Will it be screwed up?
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

dedndave

it may be "screwed up" - lol - or, it may just be misaligned
you can align the data easily enough...
        ALIGN   4
        dd ?


you can also put data in the code section and use VirtualProtect to allow the data to be written to

hutch--

The align directive works in both the DATA and CODE sections so what you put there should still be there after the sections are merged. Take care with merged sections as there may be cases where DEP from the OS in later versions may complain if the sections are merged.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zemtex

dedndave, yes I'm familiar with VirtualProtect.

hutch, DEP is usually only active for system applications, it will not interfere with other apps.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

hutch--

That depends on your OS settings, you can still configure a computer to run non-DEP apps but you cannot safely distribute that type of code as many machines have it configured to protect all applications.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zemtex

True.

If programs need to change access rights, it is most likely a knowledgeable user who is using the program, so I would bet he knows how to handle that. People don't shoot moose unless they want to eat moosemeat.  :P

Unless you're changing access rights on the program just to perform a few "internal tricks" that has little to do with the functionality of the program.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.