动态加载mapi32.dll时出错 [英] Error while dynamically loading mapi32.dll
问题描述
我们的应用程序使用简单MAPI发送电子邮件.我们的一位客户在通过终端服务器上的会话发送电子邮件时遇到问题.
Our application uses Simple MAPI to send e-mails. One of our clients has problems sending e-mail from a session on his terminal server.
mapi32.dll加载了对LoadLibrary的调用,该调用成功,但是随后我们的应用程序尝试获取函数MAPILogon
,MAPILogOff
,MAPISendMail
,MAPIFreeBuffer
和MAPIResolveName
的地址.问题在于,除了MAPIFreeBuffer
之外,对于具有ERROR_ACCESS_DENIED
(代码:5)的那些功能,GetProcAddress
失败.看起来有点安全.
The mapi32.dll is loaded with a call to LoadLibrary which succeeds, but then our application tries to get the addresses of the functions MAPILogon
, MAPILogOff
, MAPISendMail
, MAPIFreeBuffer
and MAPIResolveName
. The problem is that GetProcAddress
fails for those functions with an ERROR_ACCESS_DENIED
(code: 5) except for MAPIFreeBuffer
. It looks like some sort of security thing.
该如何解决?还是应该使用其他方法发送邮件?
How can I fix this or should I use another method to send mail?
FWI,这里是有关操作系统和注册表项HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows Messaging子系统的更多信息:
FWI, here some more information about OS and contents of registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem:
OS info: 5.2.3790 VER_PLATFORM_WIN32_NT Service Pack 2
Contents of SOFTWARE\Microsoft\Windows Messaging Subsystem
InstallCmd: rundll32 setupapi,InstallHinfSection MSMAIL 132 msmail.inf
MAPI: 1
CMCDLLNAME: mapi.dll
CMCDLLNAME32: mapi32.dll
CMC: 1
MAPIX: 1
MAPIXVER: 1.0.0.1
OLEMessaging: 1
Contents of SOFTWARE\Microsoft\Windows Messaging Subsystem\MSMapiApps
inetsw95.exe:
choosusr.dll:
msab32.dll:
nwab32.dll:
outstore.dll: Microsoft Outlook
CDOEXM.DLL:
EMSMDB32.DLL:
EMSABP32.DLL:
newprof.exe: Microsoft Outlook
outlook.exe:
wfxmsrvr.exe: Microsoft Outlook
msexcimc.exe:
exchng32.exe:
schdmapi.dll: Microsoft Outlook
pilotcfg.exe: Microsoft Outlook
mailmig.exe: Microsoft Outlook
admin.exe:
msspc32.dll: Microsoft Outlook
cnfnot32.exe: Microsoft Outlook
ilpilot.exe: Microsoft Outlook
events.exe:
我正在使用Delphi 7.0,但这没关系.
I'm on Delphi 7.0, but that shouldn't matter.
编辑,添加了版本信息:
C:\ WINDOWS \ system32 \ mapi32.dll的文件版本信息
Fileversion info of C:\WINDOWS\system32\mapi32.dll
Fileversion: 6.5.7226.0
FileDescription=Extended MAPI 1.0 for Windows NT
CompanyName=Microsoft Corporation
InternalName=MAPI32
Comments=Service Pack 1
LegalCopyRight=Copyright (C) 1986-2003 Microsoft Corp. All rights reserved.
LegalTradeMarks=Microsoft(R) and Windows(R) are registered trademarks of Microsoft Corporation.
OriginalFileName=MAPI32.DLL
ProductName=Microsoft Exchange
ProductVersion=6.5
C:\ Program Files \ Common Files \ SYSTEM \ MSMAPI \ 1043 \ msmapi32.dll的文件版本信息
Fileversion info of C:\Program Files\Common Files\SYSTEM\MSMAPI\1043\msmapi32.dll
Fileversion: 11.0.5601.0
FileDescription=Extended MAPI 1.0 for Windows NT
CompanyName=Microsoft Corporation
InternalName=MAPI32.DLL
LegalCopyRight=Copyright © 1995-2003 Microsoft Corporation. All rights reserved.
OriginalFileName=MAPI32.DLL
ProductName=MAPI32
ProductVersion=11.0.5601
推荐答案
我发现了问题.正如您在我的问题中看到的那样,mapi32.dll由Exchange服务器提供. (版本6.5.7226 = Microsoft Exchange Server 2003 SP1 ).根据本网站 出于安全原因,Exchange 2003不支持简单MAPI:
I found the problem. As you can see in my question the mapi32.dll is provided by Exchange server. (Version 6.5.7226 = Microsoft Exchange Server 2003 SP1). According to this site Exchange 2003 does not support Simple MAPI for security reasons:
从Exchange 2003开始,Exchange不再实现简单MAPI.删除了API,以减少潜在的攻击面
As of Exchange 2003, Exchange no longer implements Simple MAPI. The API was removed to reduce the potential attack surface
这就是我无法获得简单MAPI调用的ProcAddresses的原因.
So that is the reason I cannot get the ProcAddresses of the Simple MAPI calls.
看来我必须去支持扩展MAPI.
It looks like I have to go support Extended MAPI.
这篇关于动态加载mapi32.dll时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!