1

I have an application with an API I am trying to reverse engineer to discover the .NET and COM classes it exposes. I am able to load all the .NET Assemblies in PowerShell via

ls 'C:\Program Files\MyApp\Bin\*.dll'| %{Add-Type -Path $_.FullName}

I can then use reflection to find out all the types, and instantiate them VIA New-Object. However, what if I have a DLL that exposes COM objects, for example a VB6 ActiveX dll. Will Add-Type -Path expose the COM objects in those DLLs, or do I need to Register them with Regsvr32?

4

1 回答 1

2

自从我做 COM 以来已经有一段时间了,但是...... COM 组件通常将它们的元数据放在类型库中。因此,将 COM dll 加载到 PowerShell 中可能对发现没有多大帮助(除非 PowerShell 自动生成 .NET 包装程序集)。我会使用 .NET 工具tlbimp.exe在 COM 组件周围创建一个 .NET 包装器。然后,您将能够使用Add-Type加载生成的包装器并检查它。

于 2012-08-09T16:37:56.440 回答