From: Simon on
Hi,

I know how to export functions from a DLL
And I know how to use WM_COPYDATA to do a very simple IPC.

But is it possible to export functions directly from the exe?

What I am aiming to do is.
1- Start my main application
2- The main application would then start another exe
3- The 'other' exe would contact the main application to get needed
information via some exposed API/Functions.

Would the above be possible?

Simon

From: Giovanni Dicanio on

"Simon" <spambucket(a)example.com> ha scritto nel messaggio
news:67lfdtF2p7l6uU1(a)mid.individual.net...

> But is it possible to export functions directly from the exe?
>
> What I am aiming to do is.
> 1- Start my main application
> 2- The main application would then start another exe
> 3- The 'other' exe would contact the main application to get needed
> information via some exposed API/Functions.
>
> Would the above be possible?

I think you can use OLE Automation for that.
The 'other' exe could expose an OLE Automation interface, like an object
model, with objects and some methods and properties defined for each object.
And your main exe can "pilot" the 'other.exe' using OLE Automation, e.g. the
main exe can ask the other.exe to create some objects, and the main exe can
then call methods on other.exe's objects.

(Sometimes the 'other.exe' is called OLE Automation Server, and the main exe
is the client.)

MFC gives good support for OLE Automation.

Giovanni


From: rodream on
It's possible.

EAT(Export Address Table) is alose Table of Address.
And, you can recognize exported symbol by this table.

Open the Dependency walker program and open some EXE. You can see EXE file
has a export function.

But, each Process(EXE) has their memory and each process can not access
another process's.
So, To access other process's code and data you have to use
WriteProcessMemory or code injection method.



--
WebSite :
Realization of Dream { imagine your dream} - http://rodream.net

WebMail :
rodream(a)naver.com


"Simon" wrote:

> Hi,
>
> I know how to export functions from a DLL
> And I know how to use WM_COPYDATA to do a very simple IPC.
>
> But is it possible to export functions directly from the exe?
>
> What I am aiming to do is.
> 1- Start my main application
> 2- The main application would then start another exe
> 3- The 'other' exe would contact the main application to get needed
> information via some exposed API/Functions.
>
> Would the above be possible?
>
> Simon
>
>
From: Joseph M. Newcomer on
None of these would be particularly good ideas for production code.

The previously-mentioned Automation interfaces or COM interfaces (they are different)
would allow this, and would be a better approach. Typically, you would export an ActiveX
(IDispatch) interface to your app. As pointed out, MFC provides lots of good support for
this. THis is considered the best way to provide support for an executable exporting
interfaces.
joe

On Mon, 28 Apr 2008 01:40:01 -0700, rodream <rodream(a)discussions.microsoft.com> wrote:

>It's possible.
>
>EAT(Export Address Table) is alose Table of Address.
>And, you can recognize exported symbol by this table.
>
>Open the Dependency walker program and open some EXE. You can see EXE file
>has a export function.
>
>But, each Process(EXE) has their memory and each process can not access
>another process's.
>So, To access other process's code and data you have to use
>WriteProcessMemory or code injection method.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: David Ching on
"Simon" <spambucket(a)example.com> wrote in message
news:67lfdtF2p7l6uU1(a)mid.individual.net...
> Hi,
>
> I know how to export functions from a DLL
> And I know how to use WM_COPYDATA to do a very simple IPC.
>
> But is it possible to export functions directly from the exe?
>
> What I am aiming to do is.
> 1- Start my main application
> 2- The main application would then start another exe
> 3- The 'other' exe would contact the main application to get needed
> information via some exposed API/Functions.
>
> Would the above be possible?
>
> Simon

Yes, you can export functions from a .exe just like you would for a .dll.
But as others have said, it's probably not going to do much good since you
can't call the exported functions of the .exe from another .exe (since the
..exe's are running in separate process spaces). Your idea of using
WM_COPYDATA to somehow do some simple IPC between the two .exe's will work;
however it's not clear how calling the other .exe's exported functions fit
in with that.

-- David