问题描述
我有一个用于身份验证的C ++ DLL,Windows服务在每次登录时都会加载该C ++ DLL.
I have a C++ DLL that is used for authentication that gets loaded by a Windows service for every login.
在该DLL中,我使用Windows ADSI函数 ADsOpenObject()从 Active Directory 获取用户对象.
In that DLL I use the Windows ADSI function ADsOpenObject() to get a user object from Active Directory.
HRESULT hr = ADsOpenObject(L"LDAP://rootDSE",
L"username",
L"password",
m_dwADSFlags,
IID_IDirectorySearch,
(void**)&m_DSSearch);
通常,这种方法已经存在多年了.但是目前我收到错误代码
Generally this works since years. But currently I get the error code
是 OUT_OF_MEMORY .当我重新启动使用我的DLL的服务时,它可以正常运行数周,但随后开始出现错误.
which is OUT_OF_MEMORY. When I restart the service that is using my DLL then it runs fine for weeks but then the errors start occuring.
现在我找不到什么内存不足.任务计划程序看起来不错,可用内存充足.
我该怎么做才能解决这个问题?
Now I can't find what is out of memory. The task scheduler looks fine and free memory is plenty.
What can I do to fix that?
推荐答案
它是E_OUTOFMEMORY,一个COM错误代码.该描述不是很有帮助,Microsoft代码(而不只是内存)往往会针对 any 资源不足"错误返回此错误代码.通过达到内部限制,可能是winapi调用失败.
It is E_OUTOFMEMORY, a COM error code. The description isn't very helpful, this error code tends to be returned for any "out of resources" errors by Microsoft code, not just memory. Could by an internal limit being reached, could be a winapi call that fails.
并且不一定限于所涉及的直接软件.例如,泄漏内核池内存的恶意设备驱动程序可能是事故的间接来源.
And it is not necessarily limited to the direct software involved. A mishaving device driver that leaks kernel pool memory can be the indirect source of the mishap for example.
如果您可以在应用程序"事件日志中找到某些内容,可以很幸运,可以在报告错误的计算机以及域服务器中查找.任务管理器可能会提供一个线索,添加句柄","GDI对象",用户对象",提交大小",页面池"和"NP池"列.除此以外,很难提供具体的建议.毫无疑问,这是一个泄漏,当您必须定期重新启动计算机以进行恢复时,它会发出巨大的嘎嘎声.祝你好运.
You'll be lucky if you can find something back in the Application event log, look both in the machine that reports the error as well as the domain server. Task Manager might give a clue, add the Handles, GDI Objects, USER Object, Commit size, Page pool and NP Pool columns. Pretty hard to give specific advice beyond this. It is no doubt a leak, quacks loudly like one when you have to restart a machine periodically to recover. Good luck hunting it down.
这篇关于ADsOpenObject()返回-2147024882(0x8007000E)->记不清的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!