Author Topic: x64 Dll Wrapper for a X32 Dll  (Read 4441 times)

caraveiro

  • Regular Member
  • *
  • Posts: 17
  • Quam olim da capo.
x64 Dll Wrapper for a X32 Dll
« on: July 05, 2015, 03:48:09 AM »
Hi there!

I need to call a legacy 32bit Dll from Excel x64. As Excel x64 does NOT support calling x32 Dlls I think that the only solution is to build a wrapper.

I found this article useful:

http://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/

Quote
The solution: a surrogate process

This issue can be solved by loading the dependency DLL into a separate 32-bit process space. The main module, running as a 64-bit process, can then access the dependency DLL across the process boundary using IPC (http://msdn2.microsoft.com/en-us/library/aa365574.aspx).


How do I do a surrogate process in asm?

Any clues?
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC

BogdanOntanu

  • Global Moderator
  • Member
  • *****
  • Posts: 63
    • Solar_OS, Solar_Asm and HE RTS Game
Re: x64 Dll Wrapper for a X32 Dll
« Reply #1 on: July 05, 2015, 07:06:39 AM »
Nothing special about it. Just a simple x32 process that loads the x32 bits DLL.

It will have to wait on an IPC mechanism (for example via network sockets) for a message from the x64 application and it will send back the results of the x32 DLL function call.

It is kind of a lot of work.

IMHO it is much better to rewrite the x32 DLL into an x64 DLL.

« Last Edit: July 09, 2015, 06:03:34 AM by BogdanOntanu »
Ambition is a lame excuse for the ones not brave enough to be lazy, www.oby.ro

jj2007

  • Member
  • *****
  • Posts: 10656
  • Assembler is fun ;-)
    • MasmBasic
Re: x64 Dll Wrapper for a X32 Dll
« Reply #2 on: July 08, 2015, 07:42:42 AM »
Probably (=haven't tested that), you can use CreateProcess, ShellExecute or similar to launch the 32-bit process, and e.g. SendMessage hWnd, WM_COPYDATA or similar to exchange data.

caraveiro

  • Regular Member
  • *
  • Posts: 17
  • Quam olim da capo.
Re: x64 Dll Wrapper for a X32 Dll
« Reply #3 on: July 10, 2015, 12:38:14 PM »
Thank you guys.

I'll stay with Excel32 for a long time.

 :icon_eek:

"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC