flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Don't know if this has been posted...

Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Code:
db "INSERT COPYRIGHT INFO HERE"    


I don't know if it creats some kind of annonymous identifyer or not, but if you put it in the data section of your code, or anywhere that isn't executed (for obvious safety resons) you can easily make sure that no one just steals your DLLs and programs and calls them their own. (This is assuming that they don't know assembly or that they're not expecting you to actually put a copyright identifier in there.)

It also is a nice way of temporarily commenting your code for looking at sections in a hex editor.
Post 14 Dec 2006, 02:19
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
tantrikwizard



Joined: 13 Dec 2006
Posts: 142
tantrikwizard
this is a great idea, i've use something similar in c++ apps wrapped in a macro EmbedString(psz) which would be turned off or on with conditional compilation, it makes things a bit easier when disassembling memory dumps, though I'm a bit of a noob with fasm's macro syntax, is it possible to do in fasm? I'm curious if a macro can take an instruction as a parameter and both embed the textual representation of the instruction and emit the opcode. It could be very handy in debugging to have say, a .d or .dump macro .dump mov eax, ebx.

jmp @F
db 'mov eax, ebx'
@@:
mov eax, ebx[/code]
Post 14 Dec 2006, 04:03
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Not sure what you mean, but you could probably do it in 2 seperate instructions. And if you mean using fasm to take a source code and assemble it and put the source beside it, only jumped over, you could probably edit the fasm source to do that.
Post 14 Dec 2006, 04:08
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
[code]
DEBUG=1 ;change to 0 to disable
macro embedstring str
{
local ..forward
if DEBUG=1
jmp ..forward
db str,0
..forward:
end if
}
embedstring "abcd"
embedstring <"abcd",10,13,"xxx">
Post 14 Dec 2006, 12:43
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
tantrikwizard



Joined: 13 Dec 2006
Posts: 142
tantrikwizard
kohlrak wrote:
Not sure what you mean


Sorry I was unclear, what I mean is it would be nice to have a single macro that both embeds the text of the instruction being executed and encodes the instruction. something quick and dirty like a D macro.

Code:
D NOP    


produces

jmp ..forward
db 'NOP'
..forward
NOP

This way the NOP instruction is both assembled and the string 'NOP' is embedded in the binary before it's executed. It would help when looking at memory dumps, one could read which instructions were being executed at given locations because the string representation of the instruction will be displayed. It would certainly over-bloat the binary but should be able to turn off instruction string embedding after debugging similar to vid's example.
Post 14 Dec 2006, 15:07
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7712
Location: Kraków, Poland
Tomasz Grysztar
Well, the listing is a much more traditional approach to this problem, however here's my quick try to make a macro like what you proposed:
Code:
macro record_instruction [ins]
{
  macro ins [operand]
  \{
    \common
      \local ..skip
      jmp ..skip
      irps symbol, ins operand \\{ db 20h,\\`symbol \\}
      ..skip:
      ins operand
  \}
}
; with this macro you define which instructions
; will make the textal dumps of themselves:
record_instruction add,mov,nop     
Post 14 Dec 2006, 15:21
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
I take it that listing is the same thing only it dosn't rely on the macro?
Post 14 Dec 2006, 23:54
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
But they could easily find this by opening your app in a hex editor and then replace your string with theirs (if it is equal in length; and if it is shorter, pad it up with spaces or NULs)
Post 12 Aug 2007, 08:20
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.

Powered by rwasa.