Author Topic: Identifying Source Assemblies/Files  (Read 2474 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Identifying Source Assemblies/Files
« on: August 31, 2012, 08:17:08 AM »
This thread over at AUGI got me wondering how one goes about detecting the source assembly for a given CommandMethod (or LISP, if that's even possible?), so I fired up IlSpy, added a new list, and added everything in the installation folder for the specified version.

Perhaps I am simply unfamiliar with how to effectively search for what I am after using IlSpy, or there's a plug-in available to do so... I don't really know.

Being unsuccessful at that, got me wondering if it was possible to instead (and here's probably where my LISP background will allow me to use incorrect .NET terminology)... Code a .NET Event monitor that would, upon CommandWillStart Event, detect the calling, or perhaps source, assembly where the active CommandMethod resides.

TIA
"How we think determines what we do, and what we do determines what we get."

TheMaster

  • Guest
Re: Identifying Source Assemblies/Files
« Reply #1 on: August 31, 2012, 09:26:13 AM »
This thread over at AUGI got me wondering how one goes about detecting the source assembly for a given CommandMethod (or LISP, if that's even possible?), so I fired up IlSpy, added a new list, and added everything in the installation folder for the specified version.

Perhaps I am simply unfamiliar with how to effectively search for what I am after using IlSpy, or there's a plug-in available to do so... I don't really know.

Being unsuccessful at that, got me wondering if it was possible to instead (and here's probably where my LISP background will allow me to use incorrect .NET terminology)... Code a .NET Event monitor that would, upon CommandWillStart Event, detect the calling, or perhaps source, assembly where the active CommandMethod resides.

TIA

There's no way to do that other than to scan all assemblies looking for CommandMethod attributes attached to methods, and unless you want to use ReflectionOnly assembly loading, then you can only do that with assemblies that are loaded.


BlackBox

  • King Gator
  • Posts: 3770
Re: Identifying Source Assemblies/Files
« Reply #2 on: August 31, 2012, 09:56:27 AM »
Thanks for the prompt response, Tony.

I'm certainly not trying to change the way anything loads for production purposes.

Regretfully, I do not fully understand... Is it not possible to search for a specific CommandMethod through multiple assemblies that are loaded in IlSpy, or other?

Sorry for my confusion here.
"How we think determines what we do, and what we do determines what we get."

TheMaster

  • Guest
Re: Identifying Source Assemblies/Files
« Reply #3 on: September 07, 2012, 08:59:25 PM »
Thanks for the prompt response, Tony.

I'm certainly not trying to change the way anything loads for production purposes.

Regretfully, I do not fully understand... Is it not possible to search for a specific CommandMethod through multiple assemblies that are loaded in IlSpy, or other?

Sorry for my confusion here.

You can use reflection to search for anything, but the assembly you search must be loaded into the process from which the search is done.

The call stack allows a method to find out who is calling it (including the assembly, class and method), but in the case of a command method, the caller is always AcMgd.dll, so it's of no use unless the command method were to call one of your own APIs, and from there, you can then get the caller's identity.

BlackBox

  • King Gator
  • Posts: 3770
Re: Identifying Source Assemblies/Files
« Reply #4 on: September 07, 2012, 09:17:31 PM »
Thanks for clarifying this for me, Tony. :beer:
"How we think determines what we do, and what we do determines what we get."