0

I'm working with a C++ project where two processes (running on the same machine) are communicating with each other via TCP, using WinSock. The process 'A' loads several Dll's which must be used by process 'B'.

However, I'm having trouble understanding how to use the send/recv methods in this case, for sending and receiving the HMODULE. Is it possible? and if so, what would be the correct way. (I've bee trying something as the following):

Process A:

        HMODULE hmod = LoadLibrary(L"MathFunc.dll");
        iResult = send( Socket, (char*)hmod, sizeof(HMODULE), 0 );

Process B:

typedef double (* addFunc)(double, double);

int __cdecl main(void) 
{
...
HMODULE receiver;
iResult = recv(ClientSocket, (char*)&receiver, sizeof(HMODULE), 0);
addFunc adder = (addFunc)GetProcAddress(receiver, "Add");
double resi = adder(1.0, 2.0);
...
return 0;
}

Thanks.

1 Answers1

1

The process 'A' loads several Dll's which must be used by process 'B'.

This is already impossible, let alone sending HMODULES around. A process must load its own DLLs.

user207421
  • 305,947
  • 44
  • 307
  • 483