473,379 Members | 1,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

changing execution path

Is it possible to change execution path in c++ without jumping to asm

eg:

int* arrayEncrypted
int* arrayUnEncrypted

after unencrypting from the encrypted to the unencrypted can I jump the ip
address to arrayUnEncrypted without resorting to assembly. currently doing
it like this but it defeats the point of my exercise to use assembly

asm
{
push arrayUnEncrypted
ret
}

Is there a c++ way of doing this?
Jul 19 '05 #1
6 3830
Kris <so*****@optusnet.com.au> wrote:
Is it possible to change execution path in c++ without jumping to asm

eg:

int* arrayEncrypted
int* arrayUnEncrypted

after unencrypting from the encrypted to the unencrypted can I jump the ip
address to arrayUnEncrypted without resorting to assembly. currently doing
it like this but it defeats the point of my exercise to use assembly

asm
{
push arrayUnEncrypted
ret
}

Is there a c++ way of doing this?


I.e. arrayDecrypted contains a sequence of ints which would be
interpreted by your processor as machine code if the IP would point
there?

If so, no, there is no portable way to do that in C++, and using asm
seems to be a reasonable alternative in this case.

Andre'
Jul 19 '05 #2
Yep, more properly arrayEncrypted & arrayUnEncrypted are unsigned chars
which is equivalent to bytes for me here.

unencrypted will contain executable code once finished unencryptins so would
like to jump to there.

If this is clearer.

Thanks for the advice Andre.

I am trying to avoid jumping to assembly language here as Im converting back
from it to c++.
just a reverse engineering exercise.
Can it be done in c or another language?

I remember vaguly about labels ending with : to mark point in executable but
I think this was assembly language for some processor again.

Can a goto handle the jumpmaybe?

"André Pönitz" <po*****@gmx.net> wrote in message
news:bk**********@anderson.hrz.tu-chemnitz.de...
Kris <so*****@optusnet.com.au> wrote:
Is it possible to change execution path in c++ without jumping to asm

eg:

int* arrayEncrypted
int* arrayUnEncrypted

after unencrypting from the encrypted to the unencrypted can I jump the ip address to arrayUnEncrypted without resorting to assembly. currently doing it like this but it defeats the point of my exercise to use assembly

asm
{
push arrayUnEncrypted
ret
}

Is there a c++ way of doing this?


I.e. arrayDecrypted contains a sequence of ints which would be
interpreted by your processor as machine code if the IP would point
there?

If so, no, there is no portable way to do that in C++, and using asm
seems to be a reasonable alternative in this case.

Andre'

Jul 19 '05 #3
Kris <so*****@optusnet.com.au> wrote:
Can it be done in c or another language?
Not in C.

[In fact almost everything that can be done in C can be done in C++]
I remember vaguly about labels ending with : to mark point in executable but
I think this was assembly language for some processor again.

Can a goto handle the jumpmaybe?


No.

Andre'
Jul 19 '05 #4
"Kris" <so*****@optusnet.com.au> wrote in message news:<3f***********************@news.optusnet.com. au>...
Is it possible to change execution path in c++ without jumping to asm

eg:

int* arrayEncrypted
int* arrayUnEncrypted

after unencrypting from the encrypted to the unencrypted can I jump the ip
address to arrayUnEncrypted without resorting to assembly. currently doing
it like this but it defeats the point of my exercise to use assembly

asm
{
push arrayUnEncrypted
ret
}

Is there a c++ way of doing this?


C++ has no knowledge of IP (instruction pointer I presume). So what is
your real problem? If you want to swap the contents of arrays, swap
the pointers values. If not, let us know more.

Dan
Jul 19 '05 #5
Kris wrote:
Is it possible to change execution path in c++ without jumping to asm

eg:

int* arrayEncrypted
int* arrayUnEncrypted

after unencrypting from the encrypted to the unencrypted can I jump the ip
address to arrayUnEncrypted without resorting to assembly. currently doing
it like this but it defeats the point of my exercise to use assembly

asm
{
push arrayUnEncrypted
ret
}

Is there a c++ way of doing this?


In most C/C++ implementations this will work.

typedef void (*funcptr)();

void execute_buffer( void * buffer )
{

funcptr ptr = (funcptr) ( buffer );

ptr();

}

Jul 19 '05 #6
Kris wrote:
Yep, more properly...

<snip>

Kris, please don't top-post. See section 5 of the FAQ for posting
guidelines.

http://www.parashift.com/c++-faq-lite/

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: karoshi | last post by:
Hello, I want to gain insight into the access and running of scripts by the php engine on my production box. Most scripts are executed via cronjobs and they invoke a lot of other php scripts....
24
by: Charles Crume | last post by:
Hello; My "index.htm" page has 3 frames (content, navigation bar, and logo). I set the "SRC" of the "logo" frame to a blank gif image and then want to change it's contents after the other two...
16
by: chris | last post by:
im new to javascript but slowly getting better what i want to do is have some text on the screen and when an event happens for example click a button the text would change to what i want. how...
2
by: Paolo Pignatelli | last post by:
I am trying to get an output/file like this (below) in an XML file (MyXmlFile.xml) (which I will use for a slide show) -- <gallery timer="3" order="sequential" fadetime="2" looping="yes"...
2
by: Bassel Tabbara | last post by:
I wrote the following code: oApp = new Outlook.Application(); oApp = new Outlook.Application(); oNameSpace= oApp.GetNamespace("MAPI"); oNameSpace.Logon(null,null,true,true); //gets defaultfolder...
10
by: greenb | last post by:
Our asp.net web app uses a .NET component (DLL) in the bin directory to call several stored procedures back to back to perform updates. They don't return any data. Sometimes the total execution...
4
by: Mikael Olofsson | last post by:
Hi! This is in Python 2.3.4 under WinXP. I have a situation where I think changing the behaviour of a namespace would be very nice. The goal is to be able to run a python file from another in...
4
by: VK | last post by:
As per discussion in the thread http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/117e4f3a30f4d1c3 I'm proposing to add new FAQ entry: ...
17
by: blufox | last post by:
Hi All, Can i change the execution path of methods in my process at runtime? e.g a()->b()->c()->d()->e() Now, i want execution to be altered at runtime as -
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.