Results 1 to 3 of 3

Thread: The buggy MSVC...

  1. #1

    The buggy MSVC...

    well,

    this is a bit funny... I am working in a project using multiple compilers. So far, nothing strange: every compiler has its own idioms.
    It is also well known that MSVC cpp (c preprocessor) is a bit buggy, but...
    look to the hack I had to do to compile a piece of code that compiles flawlessy on other compilers:

    Code:
    void func()
    {
    	...
    	//
            MY_CODE_IN_MACRO(...);
    #ifdef MS_FIX_BUGGY_CPP_VERY_UGLY_HACK
    	};
    	};
    	};
    #endif
    	...
    };
    the fun is, if I generate the ".i" files the cpp correctly expands the macro (so the #conditional block is not needed) but as long as I compile it normally, it complais of those missing closing brackets!!

    ---
    well, that's interesting: now it compiles, but it totally REFUSE to generate the proper code, which it generates if the macro is... not macroed (and there it complais not of the brackets). Bah.
    ---
    well, in the end, it seems that it is due to the fact that the code contains inline __asm statements: probably the compiler isnt capable of expanding assembler AND macro at the same time...
    Last edited by Maximus; February 7th, 2010 at 19:39.
    I want to know God's thoughts ...the rest are details.
    (A. Einstein)
    --------
    ..."a shellcode is a command you do at the linux shell"...

  2. #2
    did you have a look at this
    http://msdn.microsoft.com/en-us/library/352sth8z.aspx
    ?

  3. #3
    Hi,

    thanks alot, that solved my issue!

    I did try to write down even single asm statemets, but without any success.
    By the way, I'd like to point that "__asm opcode; __asm opcode;" won't work, but indeed IT SHOULD, as the ';' is used for comment *within* an asm block, and not after the single instruction -on such context, it *is* a c-statement terminator!

    Assembly-style comments that start with a semicolon ( continue to the end of the line. This causes problems in macros because the compiler ignores everything after the comment
    __asm opcode;__asm opcode; should work, but it will not. bah.

    Well, thanks alot
    I want to know God's thoughts ...the rest are details.
    (A. Einstein)
    --------
    ..."a shellcode is a command you do at the linux shell"...

Similar Threads

  1. ARTeam: TheMida Loader (PEB dll hooker templates for MSVC) by deroko
    By Shub-nigurrath in forum Tools of Our Trade (TOT) Messageboard
    Replies: 1
    Last Post: August 8th, 2008, 12:09
  2. Compiling cmdline plugin with MSVC++
    By spockdude in forum OllyDbg Support Forums
    Replies: 6
    Last Post: December 18th, 2006, 21:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •