![]() |
VS2005 - Code bytes to asm instructions? |
Post Reply
|
Page 12> |
| Author | |
Matts_User_Name
Senior Member
Joined: 10 August 2006 Location: USA Online Status: Offline Posts: 675 |
Post Options
Quote Reply
Topic: VS2005 - Code bytes to asm instructions?Posted: 11 July 2009 at 3:56am |
|
BTW, I am curious what you do: http://forum.sysinternals.com/forum_posts.asp?TID=19549 Edited by Matts_User_Name - 11 July 2009 at 3:56am |
|
![]() |
|
wj32
Senior Member
Joined: 16 January 2009 Location: Australia Online Status: Offline Posts: 704 |
Post Options
Quote Reply
Posted: 11 July 2009 at 3:04am |
Thanks. That was 1.5 weeks ago... ![]() Edited by wj32 - 11 July 2009 at 3:04am |
|
|
MCTS: Windows Internals
Process Hacker, a free and open source process viewer. |
|
![]() |
|
molotov
Moderator Group
Joined: 04 October 2006 Online Status: Offline Posts: 17492 |
Post Options
Quote Reply
Posted: 11 July 2009 at 1:32am |
|
TS stands for Technology Specialist, I believe.
(And BTW - nice work, wj32! ![]() )Edited by molotov - 11 July 2009 at 1:33am |
|
|
Daily affirmation:
net helpmsg 4006 |
|
![]() |
|
Matts_User_Name
Senior Member
Joined: 10 August 2006 Location: USA Online Status: Offline Posts: 675 |
Post Options
Quote Reply
Posted: 10 July 2009 at 11:24pm |
|
"define byte" makes more sense to me than "emit". When I hear emit I think of a flashlight, although I guess a mnemonic could be "emit" = light= flashlight = Windows Internals books = asm. lol. I guess instead, one could do #define db _asm _emit and use db [byte] instead of _emit [byte] in an _asm{} block or _asm _emit [byte] BTW, @ wj32 congrats on the exam score. At first I thought TS was for Terminal Services, but I guess it is for Trouble Shooting Edited by Matts_User_Name - 10 July 2009 at 11:31pm |
|
![]() |
|
wj32
Senior Member
Joined: 16 January 2009 Location: Australia Online Status: Offline Posts: 704 |
Post Options
Quote Reply
Posted: 10 July 2009 at 11:20pm |
|
Emit? In NASM we just use db!
|
|
|
MCTS: Windows Internals
Process Hacker, a free and open source process viewer. |
|
![]() |
|
Matts_User_Name
Senior Member
Joined: 10 August 2006 Location: USA Online Status: Offline Posts: 675 |
Post Options
Quote Reply
Posted: 10 July 2009 at 9:11pm |
|
Actually now experimenting with this for an hour or so I should clarify a few things for anyone else that comes across this in the future wondering the same thing (probably assembly noobs like me) 1. It appears that on the keywords emit and asm, there appears to be no difference between a single underscore _ or a double one __. Both work. (But any more than 2 or less than 1, will not) 2. semicolons on code inside asm{} blocks are not required. 3. To put an instruction on 1 line, this will actually NOT work and cause a different result (see the code bytes(opcodes) in the VS's Disassembly window, which is Alt+8 when debugging) _emit(0xB8); _emit(0x00); _emit(0x00); _emit(0x00); _emit(0x00); You either must put each emit on its own line like this: (BTW this is a mov eax, 0x00000000 instruction) _emit 0xB8 _emit 0x00 _emit 0x00 _emit 0x00 _emit 0x10 OR you can do this (I found this way from here http://msdn.microsoft.com/en-us/library/1b80826t%28VS.80%29.aspx ) _asm _emit 0xB8 _asm _emit 0x00 _asm _emit 0x00 _asm _emit 0x00 _asm _emit 0x00 Note: The _asm keyword is REQUIRED before every _emit even when enclosed in an _asm{} block. Trust me I tried it various other ways. OR even easier for multiple lines you could create a #define var like this: #define bt _asm _emit bt 0xB8 bt 0x00 bt 0x00 bt 0x00 bt 0x00 This is actually pretty cool how flexible "#define" can be (Nothing like that would ever go over well in VB6, haha) Anyway, well that's it for for now. Thanks for showing me the emit keyword BanMe. It was what I was seeking. It could have at least been named better than "emit", no wonder I couldn't find it, haha. BTW, if anyone is curious what sparked my interest in this: It is because I am experimenting with code caves (just for fun really) in VB6 where I have to manually write in the code bytes (opcodes) to create a call stack, and I wanted to see what assembly instructions that VS2005's disassembly window translated some of the bytes to. Edited by Matts_User_Name - 10 July 2009 at 9:12pm |
|
![]() |
|
Matts_User_Name
Senior Member
Joined: 10 August 2006 Location: USA Online Status: Offline Posts: 675 |
Post Options
Quote Reply
Posted: 10 July 2009 at 4:28pm |
|
Thanks. That is what I was looking for. Kind of sucks you have to type __emit every time, but hey it works. They should have made it more simple like: __emit 0x68, 0xE4, 0xB2, 0xA7, 0xD8; instead of: __emit 0x68; __emit 0xE4; __emit 0xB2; __emit 0xA7; __emit 0xD8; |
|
![]() |
|
BanMe
Groupie
Joined: 18 August 2006 Location: United States Online Status: Offline Posts: 58 |
Post Options
Quote Reply
Posted: 10 July 2009 at 3:18pm |
|
of course that doesn't work.. you have __emit opcodes.. for that to work.. ;] regards BanMe |
|
![]() |
|
wj32
Senior Member
Joined: 16 January 2009 Location: Australia Online Status: Offline Posts: 704 |
Post Options
Quote Reply
Posted: 10 July 2009 at 7:43am |
No... I typed exactly what you have shown in the image and it doesn't work. |
|
|
MCTS: Windows Internals
Process Hacker, a free and open source process viewer. |
|
![]() |
|
Matts_User_Name
Senior Member
Joined: 10 August 2006 Location: USA Online Status: Offline Posts: 675 |
Post Options
Quote Reply
Posted: 10 July 2009 at 4:16am |
|
I tried it in ollydbg, but it appears to not work if it is not a valid executable (I am not really familiar with it anyway) Plus I found that CFF Explorer's "Quick disassembler" was a lot easier/more sinple to use than olly. (olly is too scarry because of how cryptic & robust it appears) But that method is for using hex bytes inside of files, and I am trying to do this in VS2005 if possible. Ex: In the editor, if I entered 68 then in the disassembler window would show a push. ![]() see what I mean now? Edited by Matts_User_Name - 10 July 2009 at 4:17am |
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |