Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
Hi,
how can I just execute a sequence of bytes? I have a sequence of commands just copied from debugger, and I want to sory them into a pointer or to pass them to a function as a parameter and just to execute them direct.
Thanks in advance. John Fill
 
I am not sure I understand. You mean that you have some machine code generated from debug output that you now want to execute directly from another program?
 
I am not sure what it is you are trying to acomplish so this may not be of any help.

You could save the assembly commands to a file and have that file accessed by a macro that is run from within an inline assembly block. If you do it that way all you have to change each time is the saved file which is only slightly better than just cut and pasting the commands directly into the _asm block.

If you are dealing with the actual ones and zeros... there must be a way for directly executing binary but I dont know what it is, sorry.

I hope that helps, but I doubt it :(
 
TFS,
1. It is up to me what I want to do. I wanted just an answer.
2. Thank you for your answers, but you try to do it in a terrible way.
3. I found how to do it. It is just a snap. Look at the sample below:
//---------run.cpp--------------
#include<windows.h>
char* y=&quot;\xC3&quot;;
int WINAPI WinMain(HINSTANCE hi,HINSTANCE hp,LPSTR cm,int sh)
{
void (*ptr)();
ptr=(void (__cdecl *)())y;//yyy;
ptr();
return 0;
}
//---------run.cpp--------------:) John Fill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top