如何在非托管 C++ dll 中查找调用程序程序集名称 [英] How to find caller assembly name in unmanaged c++ dll

查看:31
本文介绍了如何在非托管 C++ dll 中查找调用程序程序集名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非托管 C++ dll.我正在从 c# (.net 3.5)

I have an unmanaged c++ dll. I am calling external methods of this unmanaged dll from c# (.net 3.5)

我正在寻找一种方法来查找 witch c# 程序集正在调用我的非托管 c++ dll(进入我的 c++ dll)(至少,程序集的名称)

I am looking for a way to find witch c# assembly is calling my unmanaged c++ dll (into my c++ dll) (at least, name of assembly)

当然,我不想向方法传递任何额外的参数.

提前致谢

推荐答案

我终于找到了解决方案.

Finally I found the solution.

我正在寻找一种方法来限制对我的非托管 dll 的不允许访问.所以我爬取了我的调用者程序集位置的堆栈跟踪.

I was looking for a way to restrict not allowed access to my unmanaged dll. So I crawled the stack trace for my caller assembly location.

最后我决定检查调用者程序集的公钥令牌(通过这种方式找到)并验证它.

Finally I decided to check public key token of caller assembly (found this way) and validate it.

感谢您的时间和答案...

Thanks from you time and answers...

这篇关于如何在非托管 C++ dll 中查找调用程序程序集名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆