   Please help changin c++ code to asm syntax
  Hi im new to asm and as practice I wanted to write asm code wich call''s a function wich takes a string(type) as parameter. To learn how to do this I''ve made so that VSoutputs an asm file whit c/c++ source in it. But im still unsure how to deal calls whit strings becose the allocator function and maybe others(well ya it''s a nested class structure all the way from basic_string) are needed before the string can be pushed.   // heres the simble code what im trying to turn in asmvoid printstr(string str){cout<<str<<endl;}int main(){string stri = "test string";printstr(stri);return 0;}// visual studio generated asm code starts here; string stri = "test string";leaeax, DWORD PTR $T8697[ebp]pusheaxpushOFFSET FLAT:??_C@_0M@MDMJ@test?5string?$AA@ ; `string''leaecx, DWORD PTR _stri$[ebp]call??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDABV?$allocator@D@1@@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >movDWORD PTR __$EHRec$[ebp+8], 0; printstr(stri);subesp, 16; 00000010Hmovecx, espmovDWORD PTR $T8698[ebp], espleaedx, DWORD PTR _stri$[ebp]pushedxcall??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >movDWORD PTR -44+[ebp], eaxcall?printstr@@YAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z ; printstraddesp, 16// and ends here// what I''ve done so far is is:subesp, 16; okmovecx, esp ; okmovDWORD PTR $T8698[ebp], esp  ; huh T ?leaedx, DWORD PTR stri; okpushedx ; okcall??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >movDWORD PTR -44+[ebp], eax ; 44 ?callprintstr ; okaddesp, 16 ; and doneAs you can see I can''t figure whats the correct syntax for first call becose of that messy line full of symbols and other detail like that T... something to do whit templates I asume?It would be great if some one could show how to code that c++ code to a asm! 
  This ASM code is highly dirty.Find some program that deassembles an .EXE or type in the command like "-debug file.exe" and start debuggin'' "Tonight we strike,there is thunder in the sky,together we''ll fight,some of us will die,but they''ll always remember that we''ve made a stand and many will die by hand!" - ManOwaR ;  Problem is in C++, it will be very, very... VERY hard to translate this simple c++ into ASM. Class''es arent something natural for ASM... IMHO it is a suecide About suecide...If i was you and i would be realy in need to have this small pice of code in assembly i would first write in C functions that do exacly what string class do but using only structures and other "tools" supported on clean C. Porting C to ASM is much simpler than C++, but simpler not simple anyway "Woman be my slave !!!" - ManOwaR ;quote:Original post by Estor  Problem is in C++, it will be very, very... VERY hard to translate this simple c++ into ASM. Class''es arent something natural for ASM... IMHO it is a suecide About suecide...If i was you and i would be realy in need to have this small pice of code in assembly i would first write in C functions that do exacly what string class do but using only structures and other "tools" supported on clean C. Porting C to ASM is much simpler than C++, but simpler not simple anyway "Woman be my slave !!!" - ManOwaR  Hey Estor,nice going with the "Pleasure Slave"!Hail and Kill!   "Tonight we strike,there is thunder in the sky,together we''ll fight,some of us will die,but they''ll always remember that we''ve made a stand and many will die by hand!" - ManOwaR ;  To Estor:That is my first and last solution. :/Well is there an alternative way to call function like call address in asm?Or could I some way have pointer to the allocator function?Then calling would be easy! ;  try to search for some c++ decompiler or diassembler....... ;  Try getting a free compiler (GCC and MinGW come to mind) and use some of the compile options to compile to assembly which pretty much all of them should have (MinGW does so GCC definatly should msvc should but Im not sure.) ;  Hi again.You say that get disassempler. Well I hapend to have one. But what im suposed to do whit, hack the exe? ;  This problem is really bothering me...Could some one explain what should I do exactly? ;quote:Original post by Craazer    You say that get disassempler. Well I hapend to have one. But what im suposed to do whit, hack the exe?   Please look at the assembly listing in your disassembler.The good dasms even show you automatically where your procedures start._Or_, compile with some good IDE (i recommend VS.net 2003) and request assembly listings at compiler settings. Usually, you get the symbolic info as well (var&func names) when using this method.EDIT:I think all compilers support assembly listings, not just the ones with IDE  EDIT 2: Yohumbus already offered this option, sorry! [edited by - Nik02 on August 9, 2003 12:21:08 PM] [edited by - Nik02 on August 9, 2003 12:23:35 PM]