Jump to content

Using a COM property out of not registered DLL?


Recommended Posts

Hi,

for some of my Scripts i need a function to change some file properties. I have downloaded a .dll file from Microsoft with the function i need. Now my problem: It is a COM function.

How can i call it without the need, to register the dll? Is it possible?

I tried to translate some VB code (only working with registered DLL):

Set oFile = CreateObject("DSOFile.OleDocumentProperties")
oFile.Open("c:\tmp\test.txt")
oFile.SummaryProperties.Comments = "Test Comment"
oFile.Save
oFile.Close

Now my Script:

$dll = DllOpen("dsofile.dll")
$oFile = ObjCreate("DSOFile.OleDocumentProperties")
If Not @error Then
MsgBox(4096, "ObjCreate Test", "ObjCreate() of a DSO File Object successful !")
Else
MsgBox(4096, "ObjCreate Test", "Failed to create Object. Error code: " & Hex(@error, 8))
EndIf
DllClose($dll)
Exit

If i run the script above, i get the error code: 800401F3

This semms to be "Object not found" or something similar.

Maybe i can call the function out of the DLL with dllcall, but how?

I used DLL Export Viewer to get the following information (not all functions in this dll file):

Function names:

_OleDocumentProperties::Close

_OleDocumentProperties::CLSID

_OleDocumentProperties::IsOleFile

_OleDocumentProperties::Open

_OleDocumentProperties::Save

CustomProperties::Add

CustomProperty::Remove

SummaryProperties::Comments

I´m not very familiar with dllcall and com objects, so maybe someone knows how to do it?

Link to comment
Share on other sites

There is experimental feature available in some latest versions of AutoIt that allows you to create COM objects from modules without any demand on user to register anything.

It would be something like this:

; Object identifiers
Global Const $sCLSID_OleDocumentProperties = "{58968145-CF05-4341-995F-2EE093F6ABA3}"
Global Const $IID_OleDocumentProperties = "{58968145-CF01-4341-995F-2EE093F6ABA3}"

$sDll = "dsofile.dll" ; location and name of your dll
$hDll = DllOpen($sDll) ; open it

; Experimenal feature. Try with newer versions of AutoIt
$oObj = ObjCreate($sCLSID_OleDocumentProperties, $IID_OleDocumentProperties, $hDll)

; Check for errors and work with object
;...
Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

There is experimental feature available in some latest versions of AutoIt that allows you to create COM objects from modules without any demand on user to register anything.

It would be something like this:

; Object identifiers
Global Const $sCLSID_OleDocumentProperties = "{58968145-CF05-4341-995F-2EE093F6ABA3}"
Global Const $IID_OleDocumentProperties = "{58968145-CF01-4341-995F-2EE093F6ABA3}"

$sDll = "dsofile.dll" ; location and name of your dll
$hDll = DllOpen($sDll) ; open it

; Experimenal feature. Try with newer versions of AutoIt
$oObj = ObjCreate($sCLSID_OleDocumentProperties, $IID_OleDocumentProperties, $hDll)

; Check for errors and work with object
;...

That works, thank you :)

Link to comment
Share on other sites

  • 6 years later...
On 3/23/2013 at 2:43 AM, trancexx said:

There is experimental feature available in some latest versions of AutoIt that allows you to create COM objects from modules without any demand on user to register anything.

It would be something like this:

 

; Object identifiers
Global Const $sCLSID_OleDocumentProperties = "{58968145-CF05-4341-995F-2EE093F6ABA3}"
Global Const $IID_OleDocumentProperties = "{58968145-CF01-4341-995F-2EE093F6ABA3}"

$sDll = "dsofile.dll" ; location and name of your dll
$hDll = DllOpen($sDll) ; open it

; Experimenal feature. Try with newer versions of AutoIt
$oObj = ObjCreate($sCLSID_OleDocumentProperties, $IID_OleDocumentProperties, $hDll)

; Check for errors and work with object
;...

 

@trancexx I tried it with your Subrogation function instead of using DllOpen function but failed.

https://www.autoitscript.com/forum/topic/108969-subrogation/

Can you improve it or is there any other way to create a COM object using an hActiveX from memory ?

Thanks for the help  ♥️

Link to comment
Share on other sites

If you can't find an alternative you can also use software like Enigma Virtual Box or Boxed App with your compiled exe, that way you can virtualize any types of files, dynamic libraries (*.dll), ActiveX/COM objects (*.dll, *.ocx), video and music files (*.avi, *.mp3), text files (*.txt, *.doc), etc.

 

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...