durs / node-activex

Node.JS Implementaion of ActiveXObject
MIT License
329 stars 62 forks source link

Is it possible to add Variables to returned Object ? VARDESC -> GetVarDesc #70

Open Cupidazul opened 4 years ago

Cupidazul commented 4 years ago

There is a list of functions " FUNCDESC -> GetFuncDesc " in results. But no Variables description, this should be possible: " VARDESC -> GetVarDesc "

Microsoft docs.: https://docs.microsoft.com/en-us/windows/win32/api/oaidl/nf-oaidl-itypeinfo-getvardesc

Example: https://www.codeguru.com/cpp/com-tech/activex/misc/article.php/c2569/Writing-a-simple-Typelibrary-browser.htm

durs commented 4 years ago

In 1.17 version additionaly appended methods - list member mathods by names (ITypeInfo::GetFuncDesc) vars - list member variables by names (ITypeInfo::GetVarDesc) but in Excel.Application __vars is empty

Cupidazul commented 4 years ago

Awesome! Yuri, keep up this awesome work. If you need a contributer count me in. I'll help you guys in any way I can.

Cheers!

Cupidazul commented 4 years ago

I've tested, and all __vars came up empty for several ActiveXObjects .

[__vars]: {}, < ok! exists now, but its empty
[__methods]: { ... } < ok!

examples: InternetExplorer.Application WMPlayer.OCX WScript.Shell

I'll do some more testing...

Cupidazul commented 4 years ago

I've got some code for disp.cpp and disp.h that we might check, can I contribute ?

But still it's not working... I'm having trouble with tagELEMDESC, that is a property of :

typedef struct tagVARDESC { MEMBERID memid; LPOLESTR lpstrSchema; / [switch_is][switch_type] / union { / [case()] / ULONG oInst; / [case()] / VARIANT *lpvarValue; } DUMMYUNIONNAME; ELEMDESC elemdescVar; WORD wVarFlags; VARKIND varkind; } VARDESC;

typedef struct tagVARDESC *LPVARDESC;

Cupidazul commented 4 years ago

we probably should replicate: https://github.com/microsoft/VCSamples/blob/master/VC2010Samples/MFC/ole/TstCon/MethInfo.Cpp

durs commented 4 years ago

here is the same implementation as ours, the problem is where to get the correct ITypeInfo interface

вт, 7 апр. 2020 г. в 15:45, Cupid@zul notifications@github.com:

we probably should replicate:

https://github.com/microsoft/VCSamples/blob/master/VC2010Samples/MFC/ole/TstCon/MethInfo.Cpp

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/durs/node-activex/issues/70#issuecomment-610365160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMMNLYNU2SYZSSRV7I7V3RLMN77ANCNFSM4MCGJHAA .

Cupidazul commented 4 years ago

Ok, I will try to investigate on my side, If I find a sollution I'll share it with all you guys.

somanuell commented 4 years ago

can I contribute ?

You can do what I and others did: fork and submit PR

durs commented 4 years ago

Yes, of course, any ideas for developing the project are accepted.

чт, 9 апр. 2020 г. в 15:28, somanuell notifications@github.com:

can I contribute ? You can do what I and others did: fork and submit PR

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/durs/node-activex/issues/70#issuecomment-611500716, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMMNMWSLGC3LOCTZ42MQLRLW5O5ANCNFSM4MCGJHAA .

Cupidazul commented 4 years ago

Ok will do just that. I'll do what you said. fork and contribute. I just nee to do some more testing the check If all Activex functions are working.

but I found it !!! :) I was able to debug the c++ code in node...

when previouly there were only about like just 19 Methods, now I got all 71 objects, Methods and Properties...

but it's getting there:

__methods: { QueryInterface: { name: 'QueryInterface', dispid: 1610612736, invkind: 1, flags: 1, argcnt: 2 }, AddRef: { name: 'AddRef', dispid: 1610612737, invkind: 1, flags: 1, argcnt: 0 }, Release: { name: 'Release', dispid: 1610612738, invkind: 1, flags: 1, argcnt: 0 }, GetTypeInfoCount: { name: 'GetTypeInfoCount', dispid: 1610678272, invkind: 1, flags: 1, argcnt: 1 }, GetTypeInfo: { name: 'GetTypeInfo', dispid: 1610678273, invkind: 1, flags: 1, argcnt: 3 }, GetIDsOfNames: { name: 'GetIDsOfNames', dispid: 1610678274, invkind: 1, flags: 1, argcnt: 5 }, Invoke: { name: 'Invoke', dispid: 1610678275, invkind: 1, flags: 1, argcnt: 8 }, GoBack: { name: 'GoBack', dispid: 100, invkind: 1, flags: 0, argcnt: 0 }, GoForward: { name: 'GoForward', dispid: 101, invkind: 1, flags: 0, argcnt: 0 }, GoHome: { name: 'GoHome', dispid: 102, invkind: 1, flags: 0, argcnt: 0 }, GoSearch: { name: 'GoSearch', dispid: 103, invkind: 1, flags: 0, argcnt: 0 }, Navigate: { name: 'Navigate', dispid: 104, invkind: 1, flags: 0, argcnt: 5 }, Refresh: { name: 'Refresh', dispid: -550, invkind: 1, flags: 0, argcnt: 0 }, Refresh2: { name: 'Refresh2', dispid: 105, invkind: 1, flags: 0, argcnt: 1 }, Stop: { name: 'Stop', dispid: 106, invkind: 1, flags: 0, argcnt: 0 }, Application: { name: 'Application', dispid: 200, invkind: 2, flags: 0, argcnt: 0 }, Parent: { name: 'Parent', dispid: 201, invkind: 2, flags: 0, argcnt: 0 }, Container: { name: 'Container', dispid: 202, invkind: 2, flags: 0, argcnt: 0 }, Document: { name: 'Document', dispid: 203, invkind: 2, flags: 0, argcnt: 0 }, TopLevelContainer: { name: 'TopLevelContainer', dispid: 204, invkind: 2, flags: 0, argcnt: 0 }, Type: { name: 'Type', dispid: 205, invkind: 2, flags: 0, argcnt: 0 }, Left: { name: 'Left', dispid: 206, invkind: 4, flags: 0, argcnt: 1 }, Top: { name: 'Top', dispid: 207, invkind: 4, flags: 0, argcnt: 1 }, Width: { name: 'Width', dispid: 208, invkind: 4, flags: 0, argcnt: 1 }, Height: { name: 'Height', dispid: 209, invkind: 4, flags: 0, argcnt: 1 }, LocationName: { name: 'LocationName', dispid: 210, invkind: 2, flags: 0, argcnt: 0 }, LocationURL: { name: 'LocationURL', dispid: 211, invkind: 2, flags: 0, argcnt: 0 }, Busy: { name: 'Busy', dispid: 212, invkind: 2, flags: 0, argcnt: 0 }, Quit: { name: 'Quit', dispid: 300, invkind: 1, flags: 0, argcnt: 0 }, ClientToWindow: { name: 'ClientToWindow', dispid: 301, invkind: 1, flags: 0, argcnt: 2 }, PutProperty: { name: 'PutProperty', dispid: 302, invkind: 1, flags: 0, argcnt: 2 }, GetProperty: { name: 'GetProperty', dispid: 303, invkind: 1, flags: 0, argcnt: 1 }, Name: { name: 'Name', dispid: 0, invkind: 2, flags: 0, argcnt: 0 }, HWND: { name: 'HWND', dispid: -515, invkind: 2, flags: 0, argcnt: 0 }, FullName: { name: 'FullName', dispid: 400, invkind: 2, flags: 0, argcnt: 0 }, Path: { name: 'Path', dispid: 401, invkind: 2, flags: 0, argcnt: 0 }, Visible: { name: 'Visible', dispid: 402, invkind: 4, flags: 0, argcnt: 1 }, StatusBar: { name: 'StatusBar', dispid: 403, invkind: 4, flags: 0, argcnt: 1 }, StatusText: { name: 'StatusText', dispid: 404, invkind: 4, flags: 0, argcnt: 1 }, ToolBar: { name: 'ToolBar', dispid: 405, invkind: 4, flags: 0, argcnt: 1 }, MenuBar: { name: 'MenuBar', dispid: 406, invkind: 4, flags: 0, argcnt: 1 }, FullScreen: { name: 'FullScreen', dispid: 407, invkind: 4, flags: 0, argcnt: 1 }, Navigate2: { name: 'Navigate2', dispid: 500, invkind: 1, flags: 0, argcnt: 5 }, QueryStatusWB: { name: 'QueryStatusWB', dispid: 501, invkind: 1, flags: 0, argcnt: 1 }, ExecWB: { name: 'ExecWB', dispid: 502, invkind: 1, flags: 0, argcnt: 4 }, ShowBrowserBar: { name: 'ShowBrowserBar', dispid: 503, invkind: 1, flags: 0, argcnt: 3 }, ReadyState: { name: 'ReadyState', dispid: -525, invkind: 2, flags: 4, argcnt: 0 }, Offline: { name: 'Offline', dispid: 550, invkind: 4, flags: 0, argcnt: 1 }, Silent: { name: 'Silent', dispid: 551, invkind: 4, flags: 0, argcnt: 1 }, RegisterAsBrowser: { name: 'RegisterAsBrowser', dispid: 552, invkind: 4, flags: 0, argcnt: 1 }, RegisterAsDropTarget: { name: 'RegisterAsDropTarget', dispid: 553, invkind: 4, flags: 0, argcnt: 1 }, TheaterMode: { name: 'TheaterMode', dispid: 554, invkind: 4, flags: 0, argcnt: 1 }, AddressBar: { name: 'AddressBar', dispid: 555, invkind: 4, flags: 0, argcnt: 1 }, Resizable: { name: 'Resizable', dispid: 556, invkind: 4, flags: 0, argcnt: 1 } },

Cupidazul commented 4 years ago

Ok. forked, patched and submitted my proposal. all seems to be working well on my tests. newest version of Electron also recompiles, and node has no issues on compilation also.

Cupidazul commented 4 years ago

I'm somewhat new to this git fork thingy, I thank you kindly @somanuell and @durs for your understanding.

I'm not sure if I should increment the version, so I didn't, still on 1.17.0 just to be alligned with yours, I did fix package.json on my fork, because "main" was pointing to a directory that didnt exists './lib/activex', I'm not sure but maybe node roots back to index.js if main is not found... Also, I'm not a big fan of "global.ActiveXObject", programmers tend to choose this by them selves, if they need it. For example, i have some libs that import this one, and globals are criterious at least for me.

Since I'm working on a big project I don't have much time to spend on my fork, but I really liked the challenge, It was a weekend well spend tshooting c++ addon in VisualStudio... I might come to it later and propose some more nice tweaks/ideas. But for now It fills my needs as it is.

my commit: https://github.com/Cupidazul/node-activex/commit/fa22b13c83cf13a184bce83e3570e3e349578824#diff-5c642255e7776906657fe386f789ee9e

Quick Explanation: @durs was right, there are no VARS on GetTypeLib. these are mostly Methods and Properties. for back reference, i used these materials on my quest: https://computer-vision-talks.com/how-to-debug-nodejs-addons-in-visual-studio/ https://www.codeguru.com/cpp/com-tech/activex/misc/article.php/c2569/Writing-a-simple-Typelibrary-browser.htm https://github.com/microsoft/VCSamples/blob/master/VC2010Samples/MFC/ole/TstCon/MethInfo.Cpp https://adapt-and-attack.com/2017/12/19/internetexplorer-application-for-c2/ http://www.adp-gmbh.ch/win/tlb/index.html#test https://pubs.opengroup.org/onlinepubs/098759899/CHP17GDC.HTM http://wi.wu.ac.at:8002/rgf/rexx/orx13/tmp/InternetExplorer.Application_1.html

Awesome Lib! Keep up the good work. cheers from Portugal ! Cupid@zul

Cupidazul commented 4 years ago

I followed @somanuell recommendation and created a PR , its my first time at this, so, warn me if I did something wrong...

Cupidazul commented 4 years ago

that said, you may close this issue also.