Jump to content
Sign in to follow this  
Sabeeh

Alternate Of Autoit Code in C++

Recommended Posts

Sabeeh
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 by Sabeeh

Share this post


Link to post
Share on other sites
trancexx

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

Alternatively, malloc/calloc functions and the address-of operator.

Share this post


Link to post
Share on other sites
Sabeeh

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 by Sabeeh

Share this post


Link to post
Share on other sites
trancexx

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
trancexx

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

He wants to be spoonfed.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

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

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 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

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 by Sabeeh

Share this post


Link to post
Share on other sites
Sabeeh

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 by Sabeeh

Share this post


Link to post
Share on other sites
trancexx

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

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++
  1. $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 by Sabeeh

Share this post


Link to post
Share on other sites
trancexx

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

C++ 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

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 by Sabeeh

Share this post


Link to post
Share on other sites
trancexx

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

trancexx, <snip> you are great thanks

i already told you that i'm not c++ developer i'm android developer

 

 

if struc pointer t then its like Polymorphism

auto 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 pointer

whaterver->member;
thanks again for help

i converted all of your RunBinary.au3 Code in c++ but some part of code still need some changing

Edited by Melba23
Removed full name

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×