473,772 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing execution path

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

eg:

int* arrayEncrypted
int* arrayUnEncrypte d

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

asm
{
push arrayUnEncrypte d
ret
}

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

eg:

int* arrayEncrypted
int* arrayUnEncrypte d

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

asm
{
push arrayUnEncrypte d
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 & arrayUnEncrypte d 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.ne t> wrote in message
news:bk******** **@anderson.hrz .tu-chemnitz.de...
Kris <so*****@optusn et.com.au> wrote:
Is it possible to change execution path in c++ without jumping to asm

eg:

int* arrayEncrypted
int* arrayUnEncrypte d

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

asm
{
push arrayUnEncrypte d
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*****@optusn et.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*****@optusn et.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* arrayUnEncrypte d

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

asm
{
push arrayUnEncrypte d
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* arrayUnEncrypte d

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

asm
{
push arrayUnEncrypte d
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
3076
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. I can backtrace these files, but a lot of other scripts are run by our users from the command line and I want to know if it possible to instruct the engine to log the names of these script files.
24
3530
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 frames have been loaded by using a javascript statement from the "navigation" frame, as shown below: top.window.ccs_logo.src = 'images/ccs_logo.gif'; alert(top.window.ccs_logo.src);
16
2130
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 would i do this ??
2
2510
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" xpos="0" ypos="0"> <image path="images2/Test1.jpg" />
2
4684
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 for my Outlook Outbox oOutboxFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox); But it won't work and it is giving me the following error:
10
6873
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 time can take 2-3 minutes, but even though I have set the executionTimeout in web.config to a high number of seconds (2400), the request will still time out after 90 seconds. The user sees a Request timed out error. The app logs a ThreadAborted...
4
1565
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 a separate namespace in such a way that a NameError is not raised if a non-existing variable is used in the file. The file that I want to run is taken out of context, and some needed variables may be missing that are normally there when used in...
4
1560
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: ---------------------------------------------------------------- I'm changing my page but nothing is changing on the screen. Why? ---------------------------------------------------------------- You may be experiencing the repaint delay problem. All existing browsers do not update...
17
2396
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 -
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.