Sign in to follow this  
Followers 0
Shanheavel

DLL and EXE

10 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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.

:)

I think you don't understand me ;)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

PsaltyDS meant to say DllCall(), surely.

Advanced user could try


♡♡♡

.

eMyvnE

Share this post


Link to post
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
Sign in to follow this  
Followers 0