WallBreaker2 / op

Windows消息模拟,gdi,dx,opengl截图,找图,找字(OCR)
MIT License
424 stars 160 forks source link

c#调用时报错:“无法在 DLL“op_x64.dll”中找到名为“FindWindow”的入口点” #16

Closed jonathanpeng closed 4 years ago

jonathanpeng commented 4 years ago

[DllImport("op_x64.dll", EntryPoint = "FindWindow")] public static extern long FindWindow(string className, string title);

运行时抛出异常:System.EntryPointNotFoundException:“无法在 DLL“op_x64.dll”中找到名为“FindWindow”的入口点。”

jonathanpeng commented 4 years ago
     42   29 0003BF60 ?FindWindowByProcess@libop@@QEAAJPEB_W00PEAJ@Z
     43   2A 0003BFA0 ?FindWindowByProcessId@libop@@QEAAJJPEB_W0PEAJ@Z
     44   2B 0003BFE0 ?FindWindowExW@libop@@QEAAJJPEB_W0PEAJ@Z
     45   2C 0003C000 ?FindWindowW@libop@@QEAAJPEB_W0PEAJ@Z

修改为 [DllImport(@"op_x64.dll", EntryPoint = @"?FindWindowW@libop@@QEAAJPEB_W0PEAJ@Z")] public static extern long FindWindow(string className, string title); 之后抛出异常: System.AccessViolationException:“尝试读取或写入受保护的内存。这通常指示其他内存已损坏。”

jonathanpeng commented 4 years ago

盼望能回复一下,c#确实调用不起来,如果可以的话我可以协助写一个c#的demo @WallBreaker2

jonathanpeng commented 4 years ago

以com组件的形式调用: opLib.IOpInterface op = new opLib.OpInterface(); int hwndOp = op.FindWindow(null, "*无标题 - 记事本"); 同样还是提示: System.AccessViolationException HResult=0x80004003 Message=尝试读取或写入受保护的内存。这通常指示其他内存已损坏。 Source=<无法计算异常源> StackTrace: <无法计算异常堆栈跟踪>

用的是x86的dll,程序编译目标平台也是x86

WallBreaker2 commented 4 years ago

c#我不太熟,不过32位我测试是可以成功调用的

---原始邮件--- 发件人: "jonathanpeng"<notifications@github.com> 发送时间: 2020年3月27日(星期五) 凌晨3:07 收件人: "WallBreaker2/op"<op@noreply.github.com>; 抄送: "Mention"<mention@noreply.github.com>;"DeepFire"<784942619@qq.com>; 主题: Re: [WallBreaker2/op] c#调用时报错:“无法在 DLL“op_x64.dll”中找到名为“FindWindow”的入口点” (#16)

盼望能回复一下,c#确实调用不起来,如果可以的话我可以协助写一个c#的demo @WallBreaker2

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jonathanpeng commented 4 years ago

c#我不太熟,不过32位我测试是可以成功调用的 ---原始邮件--- 发件人: "jonathanpeng"<notifications@github.com> 发送时间: 2020年3月27日(星期五) 凌晨3:07 收件人: "WallBreaker2/op"<op@noreply.github.com>; 抄送: "Mention"<mention@noreply.github.com>;"DeepFire"<784942619@qq.com>; 主题: Re: [WallBreaker2/op] c#调用时报错:“无法在 DLL“op_x64.dll”中找到名为“FindWindow”的入口点” (#16) 盼望能回复一下,c#确实调用不起来,如果可以的话我可以协助写一个c#的demo @WallBreaker2 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

32位我也试过了,抛出同样的异常,请问能否把32位调用的示例贴一下,我学习一下。我试过com组件和dllimport都是一样的结果

WallBreaker2 commented 4 years ago

不能传null,必须是字符串

jonathanpeng commented 4 years ago

不能传null,必须是字符串

nice, 这样确实可以了 int hwndOpCom = opCom.FindWindow(string.Empty, "无标题 - 记事本"); 之前调用user32习惯了传null = =|| IntPtr hwnd = User32.FindWindow(null, "无标题 - 记事本");

ackurdeeve commented 4 years ago

不能传null,必须是字符串

nice, 这样确实可以了 int hwndOpCom = opCom.FindWindow(string.Empty, "无标题 - 记事本"); 之前调用user32习惯了传null = =|| IntPtr hwnd = User32.FindWindow(null, "无标题 - 记事本");

兄弟,能给个C# dllimport调用的demo吗。。从dm过来的,好不习惯。谢谢。 1,不太清楚这个entrypoint怎么确定? 2,怎么生成这个dll的实例?