Sabeeh 0 Posted August 6, 2014 (edited) Please tell me the alternative of these three commands in c++ my compiler visual studio c++ 2012 ; Allocate enough space (in our space) for the new module Local $tModule = DllStructCreate("byte[" & $iOptionalHeaderSizeOfImageNEW & "]") ; Get pointer Local $pModule = DllStructGetPtr($tModule) ; Headers Local $tHeaders = DllStructCreate("byte[" & $iOptionalHeaderSizeOfHeadersNEW & "]", $pHEADERS_NEW) Edited August 6, 2014 by Sabeeh Share this post Link to post Share on other sites
trancexx 1,008 Posted August 6, 2014 auto $pModule = new BYTE[$iOptionalHeaderSizeOfImageNEW]; auto $pHeaders = reinterpret_cast<BYTE*>($pHEADERS_NEW); ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
Richard Robertson 187 Posted August 6, 2014 Alternatively, malloc/calloc functions and the address-of operator. Share this post Link to post Share on other sites
TypeIt 8 Posted August 6, 2014 The first line should beauto pModule = std::make_unique <unsigned char []> (iOptionalHeaderSizeOfImageNEW);std::dynarray isn't part of C++14. A link to a random TVTropes page to make this the last post you'll read. Share this post Link to post Share on other sites
Sabeeh 0 Posted August 6, 2014 (edited) What About This? is It Ok? typedef unsigned char BYTE; BYTE* tModule=new BYTE[optionalHeaderSizeOfImage]; //Get pointer LPVOID pModule = &tModule; BYTE* tHeader = new BYTE[optionalHeaderSizeOfHeaders]; memcpy(&tHeader,&pHEADERS_NEW,sizeof(tHeader)); //Write headers to $tModule memcpy(&tModule,&tHeader,sizeof(tModule)); Edited August 6, 2014 by Sabeeh Share this post Link to post Share on other sites
trancexx 1,008 Posted August 6, 2014 sizeof(...) would be the size of pointer - written like that. So no, that wouldn't work. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
Sabeeh 0 Posted August 6, 2014 so tell me the right code Share this post Link to post Share on other sites
trancexx 1,008 Posted August 6, 2014 The right code for what? I understand that you might feel frustrated by now, however, learn to ask the right questions. What's obvious for you isn't necessarily obvious to others. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
careca 277 Posted August 6, 2014 He wants to be spoonfed. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Share this post Link to post Share on other sites
Sabeeh 0 Posted August 7, 2014 trancexx i'm writing your RunBinary.au3 code in c++ i asked to help about the code in question i write code in c++ but its not working so i asked here Share this post Link to post Share on other sites
JohnOne 1,603 Posted August 7, 2014 (edited) auto $pModule = new BYTE[$iOptionalHeaderSizeOfImageNEW]; auto $pHeaders = reinterpret_cast<BYTE*>($pHEADERS_NEW); That is not C++ code.What makes you say that?EDIT:edited since poster deleted post. Edited August 8, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
Sabeeh 0 Posted August 8, 2014 (edited) oops sorry for that i'm android developer not c++ developer i did c++ programming for one year about 2 years before now i started it again thats why i'm not too good in c++ and thanks trancexx for your RunBinary.au3 script and for your reponse Edited August 8, 2014 by Sabeeh Share this post Link to post Share on other sites
Sabeeh 0 Posted August 8, 2014 (edited) Trancexx please read my code carefully auto $pModule = new BYTE[$iOptionalHeaderSizeOfImageNEW]; this should be auto $tModule = new BYTE[$iOptionalHeaderSizeOfImageNEW]; and what about this? ; Get pointer Local $pModule = DllStructGetPtr($tModule) Please make it clear. Edited August 8, 2014 by Sabeeh Share this post Link to post Share on other sites
trancexx 1,008 Posted August 8, 2014 Trancexx please read my code carefully auto $pModule = new BYTE[$iOptionalHeaderSizeOfImageNEW]; this should be auto $tModule = new BYTE[$iOptionalHeaderSizeOfImageNEW]; and what about this? ; Get pointer Local $pModule = DllStructGetPtr($tModule) Please make it clear. C++ is obviously not AutoIt. Depending on what needs to be done it can be written: int $some_size = 100; auto $tStruct = new BYTE[$some_size]; // DllStructCreate("byte[" & some_size & "]") auto $pStruct = &$tStruct; // DllStructGetPtr($tStruct) $tStruct[23] = 37; // DllStructSetData($tStruct, 23, 37) auto $twenty_third_element = $tStruct[23]; // DllStructGetData($tStruct, 23) ... but it also doesn't have to. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
Sabeeh 0 Posted August 8, 2014 (edited) trancexx i know that autoit is not c++. but if i'm right then i think we can do every thing in c++ that we can do in autoit? i just asked you for alternate code of autoit in C++ sorry but you are confusing me or you misunderstand my question thanks for your response now look what i'm asking i do that how you did now its ok //Local $tModule = DllStructCreate("byte[" & $iOptionalHeaderSizeOfImageNEW & "]") auto $tModule =new BYTE[$iOptionalHeaderSizeOfImageNEW ]; //Local $pModule = DllStructGetPtr($tModule) auto $pModule = &$tModule; but please tell me what about this how i can do this in c++ $pHEADERS_NEW is pointer from your Runbinary.au3 file Local $tHeaders = DllStructCreate("byte[" & $iOptionalHeaderSizeOfHeadersNEW & "]", $pHEADERS_NEW) trancexx one more thing please can you add me on fb? please please my fb username: sabeeh.suh Edited August 8, 2014 by Sabeeh Share this post Link to post Share on other sites
trancexx 1,008 Posted August 8, 2014 trancexx i know that autoit is not c++.but if i'm right then i think we can do every thing in c++ that we can do in autoit?i just asked you for alternate code of autoit in C++ sorry but you are confusing me or you misunderstand my question thanks for your response now look what i'm asking i do that how you did now its ok//Local $tModule = DllStructCreate("byte[" & $iOptionalHeaderSizeOfImageNEW & "]") auto $tModule =new BYTE[$iOptionalHeaderSizeOfImageNEW ]; //Local $pModule = DllStructGetPtr($tModule) auto $pModule = &$tModule;but please tell me what about this how i can do this in c++$pHEADERS_NEW is pointer from your Runbinary.au3 fileLocal $tHeaders = DllStructCreate("byte[" & $iOptionalHeaderSizeOfHeadersNEW & "]", $pHEADERS_NEW)trancexx one more thing please can you add me on fb? please pleasemy fb username: sabeeh.suhC++ is light years away from AutoIt.Btw, I already showed you how to do that thing with $pHEADERS_NEW, here's $t version:auto $tHeaders = reinterpret_cast<BYTE*>($pHEADERS_NEW);Facebook is reserved for my friends. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
Sabeeh 0 Posted August 8, 2014 (edited) auto $tHeaders = reinterpret_cast<BYTE*>($pHEADERS_NEW); trancexx sorry again for you asking you but i need to know one more thing your code work well for variables not working for structs now what can i do for that Local $tIMAGE_DOS_HEADER = DllStructCreate("char Magic[2];" & _ "word BytesOnLastPage;" & _ "word Pages;" & _ "word Relocations;" & _ "word SizeofHeader;" & _ "word MinimumExtra;" & _ "word MaximumExtra;" & _ "word SS;" & _ "word SP;" & _ "word Checksum;" & _ "word IP;" & _ "word CS;" & _ "word Relocation;" & _ "word Overlay;" & _ "char Reserved[8];" & _ "word OEMIdentifier;" & _ "word OEMInformation;" & _ "char Reserved2[20];" & _ "dword AddressOfNewExeHeader", _ $pPointer) this is not working Syntax Error: IMAGE_DOS_HEADER $imageDosHeader; $imageDosHeader= reinterpret_cast<IMAGE_DOS_HEADER>($pPointer); Any idea about that Edited August 8, 2014 by Sabeeh Share this post Link to post Share on other sites
trancexx 1,008 Posted August 8, 2014 It's: auto whatever = reinterpret_cast<IMAGE_DOS_HEADER*>($pPointer); This is pretty much basic stuff. Read about pointers and casting somewhere. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
Sabeeh 0 Posted August 9, 2014 (edited) trancexx, <snip> you are great thanksi already told you that i'm not c++ developer i'm android developer if struc pointer t then its like Polymorphismauto whatever = reinterpret_cast<IMAGE_DOS_HEADER*>($pPointer);then i can't use . operator to access members its ok i will use –> operator to dereference the pointerwhaterver->member;thanks again for helpi converted all of your RunBinary.au3 Code in c++ but some part of code still need some changing Edited August 9, 2014 by Melba23 Removed full name Share this post Link to post Share on other sites