Jump to content

DLL and EXE


Recommended Posts

Hello.

I'm trying to add *.DLL into my program *.EXE with Autoit3 Wrapper.

I'm using resource.au3 from topic. If somone has easier idea to add DLL into EXE then please write. :)

...
#include "resources.au3"

;Add MyLib.dll 
#AutoIt3Wrapper_Res_File_Add=MyLib.dll, rt_rcdata, LIB

;Get MyLib.dll as string
$LibAsString = _ResourceGetAsString("LIB")

;Try to open this DLL
DllOpen($LibAsString)

...
;Use DLL

It doesn't work. I can save "LIB" to file *.DLL without problem but I need to use library from memory (from EXE).

Can someone tell me how to do it, please?

Link to comment
Share on other sites

Why are you getting the resource as a string? What makes you think you can execute a string? Use _ResourceSaveToFile() instead.

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Developers

I think you don't understand me :)

I want to use DLL without saving it to file. I need DLLOpen from resource "LIB".

Maybe we understand what you want, but not what the problem is with saving the DLL to a file first before using it? Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Maybe we understand what you want, but not what the problem is with saving the DLL to a file first before using it?

I'm making some program and I don't like when people edit my DLLs using program like Winhex. It's safer method.

Edited by Adrian777
Link to comment
Share on other sites

  • Developers

I'm making some program and I don't like when people edit my DLLs using program like Winhex. It's safer method.

That doesn't make much sense for 2 reasons:

1. They could "patch" your script as easy as any other file.

2. You could FileInstall() the DLL with each run so whatever they change will be overwritten each time you start the script EXE.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Zedna

When I use the DLLs in the normal method (by DllCall)

DllOpen("SomeLib.dll")
DllCall("SomeLib.dll, "int", ...)

it works great.

But when I use:

Dim $DllBinary = ... ;My DLL binary code from MemoryDllGen.au3 
MemoryDllOpen($DllBinary) ;It returns 0   :(
MemoryDllCall($DllBinary, "int",...)
MemoryDllExit()
...

It doesn't work.

Link to comment
Share on other sites

DllOpen() requires a string file name. DllCall() requires either the string filename or a handle to the already open DLL. You can't pass it a binary like that.

The correct way to do it would be to save $DllBinary to a .dll file and then use that. But you knew that...

:)

Edit: Tweaked statement per trancexx nagging below.

;)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...