针对64位时就GetOwnerModuleFromTcpEntry奇怪的问题 [英] Weird issue regarding GetOwnerModuleFromTcpEntry when targeting x64

查看:274
本文介绍了针对64位时就GetOwnerModuleFromTcpEntry奇怪的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我是第一次的海报,我很抱歉,如果我无意中漏掉任何信息的关键部分,但在这​​里不言而喻。

Since I am a first time poster, I do apologize if I unintentionally left out any key piece of information, but here it goes.

背景:我在的 MIB_TCPROW_OWNER_MODULE ,以及它如何援助表示函数在确定哪些进程拥有TCP端点。我已经达到了数组中的第一个项目是在运行的服务的列表中,这给我们带来了奇怪的问题的服务指标的结论。我使用的Visual Studio 2012(更新三)在Windows 7的测试程序下UAC = requireAdministrator运行(但是asInvoker产生相同的结果,)。

Background: I am doing some testing to find out what the undocumented member array ‘OwningModuleInfo’ in MIB_TCPROW_OWNER_MODULE is and how it aid said function in determining what process owns the TCP endpoint. I have reached the conclusion that the first item in the array is the index of the service in the list of running services, which brings us to the weird issue. I am using Visual Studio 2012 (update 3) on Windows 7. The test app is running under UAC = requireAdministrator (asInvoker produces the same result, however).

问题:当我瞄准64位,然后在TCP表中某些条目的 GetOwnerModuleFromTcpEntry 失败,返回126 - 指定的模块找不到。当我的目标Win32中,这个问题就不存在了。因为我知道,这时候进入由服务所特有的情况,我想只是调用我的测试功能之前,下面的伪呼叫(现针对64):

Problem: When I target x64, then for some entries in the tcp table, GetOwnerModuleFromTcpEntry fails and returns "126 - The specified module could not be found.". When I target Win32, this problem disappears. Since I know that this only happens when the entry is owned by a service, I tried the following dummy call just before the call to my test function (now targeting x64):

SC_HANDLE serviceManager = OpenSCManager(
    NULL,
    NULL,
    SC_MANAGER_ENUMERATE_SERVICE);

CloseServiceHandle(serviceManager);

MyTestFunction(); // Prints the TCP table along with owner information

现在,它工作得很好。接电话到OpenSCManager走一遍,它失败。告诉我,这是不是真的搞砸了?

Now, it works just fine. Take the call to OpenSCManager away again, and it fails. Tell me that this is not really messed up?

  • 在我审查每一个编译器和连接器的设置我能找到。
  • 在我有双重检查,所以我连接到正确的库。
  • 在我创建了一个C ++ / CLI版本相同的code,这既适用于Win32和x64工作正常。
    • 检查内存/校准/指针的问题。
    • I have reviewed every compiler and linker setting I could find.
    • I have double checked so I am linking to the proper libraries.
    • I created a C++/CLI version with identical code, which works fine both for Win32 and x64.
      • Checked for memory/alignment/pointer issues.

      从试运行的示例输出,而不哑呼叫

      Pid:   2896
      Owner: Skype.exe
      
      Pid:   848
      Owner: Error 126 - The specified module could not be found.
      
      Pid:   2896
      Owner: Skype.exe
      
      Pid:   3756
      Owner: Error 126 - The specified module could not be found.
      

      随着虚拟呼叫

      Pid:   2896
      Owner: Skype.exe
      
      Pid:   848
      Owner: RpcSs
      
      Pid:   2896
      Owner: Skype.exe
      
      Pid:   3756
      Owner: WMPNetworkSvc
      

      短这是微软部分中的一个错误,我显然失去了一些东西,我在我的穷途末路。所以,如果有人可以轻推我的方向是正确的,什么我可能会丢失,这将是极大的AP preciated。

      Short of this being a bug on Microsoft’ part, I am obviously missing something and I’m at the end of my rope. So if someone could nudge me in the right direction as to what I might be missing, it would be greatly appreciated.

      推荐答案

      这个问题似乎是,ADVAPI32.DLL未加载。所述功能似乎假定调用它时,这显然是不总是的情况下advapi32.dll中被加载。我仍然不知道为什么ADVAPI32.DLL不会自动加载,但我想这是另外一个问题。

      The problem seems to be that advapi32.dll is not loaded. Said function seems to assume that advapi32.dll is loaded when calling it, which apparently is not always the case. I still do not know why advapi32.dll isn't loaded automatically, but I guess that is another question.

      <一个href="http://social.msdn.microsoft.com/Forums/en-US/1d18416e-4bba-4803-8e54-3ef160c1fb4f/weird-error-returned-by-getownermodulefromtcpentry-when-targeting-x64"相对=nofollow>请参阅MSDN论坛的主题。

      这篇关于针对64位时就GetOwnerModuleFromTcpEntry奇怪的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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