开发者

SnmpExtensionInit not invoked

开发者 https://www.devze.com 2023-03-13 23:20 出处:网络
I am trying to add an extension to the Windows SNMP agent and have followed the sketchy documentation that is available.The dll has been built and the two entries have been placed into the registry.Re

I am trying to add an extension to the Windows SNMP agent and have followed the sketchy documentation that is available. The dll has been built and the two entries have been placed into the registry. Restarting the SNMP service seems to load the DLL. DllMain is called with the following reasons: DLL_PROCESS_DETACH, DLL_PROCESS_ATTACH, DLL_THREAD_ATTACH, DLL_PROCESS_DETACH. But SnmpExtensionInit never seems to get called. Any i开发者_开发问答deas? TIA.


Can you give the declaration of your SnmpExtensionInit. Sorry it's in french, but try your DLL with slxSNMPInfo tool. This tool just load your DLL and try to invoke SnmpExtensionInit.


Edited (after your comment)

"Err SNMP DLL not detected !" in slwSNMPInfo.exe attest that your DLL does not export "SnmpExtensionInit" function. You can also verify this with Dependency Walker tool.

To export correctly your functions in a Windows DLL you can use a definition file (a .def file) like this :

LIBRARY YOUR-DLL-NAME

DESCRIPTION 'SNMP Extension Agent for Windows NT.'

SEGMENTS
  _TEXT      PRELOAD
  INIT_TEXT  PRELOAD

HEAPSIZE  1024

EXPORTS
  SnmpExtensionInit
  SnmpExtensionTrap
  SnmpExtensionQuery

Or you can change your functions déclarations (all the three)

__declspec(dllexport) BOOL SnmpExtensionInit (DWORD dwTimeZeroReference,
                                              HANDLE *hPollForTrapEvent,
                                              AsnObjectIdentifier *supportedView);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号