About DAPI
I am doing the migration of a project from vc6 to vs2005, and it include dapi.h which could not be found in vs2005's installation folder. I want to know what is dapi and its functions. Where could i get it now? thanks for your help!
October 19th, 2007 4:35am
You are in the wrong place to find your solution
Please go to
http://forums.microsoft.com/MSDN/
Deli
Free Windows Admin Tool Kit Click here and download it now
October 19th, 2007 6:42pm
As i known, DAPI is the interface of Exchange Server, so I post my question here.
October 20th, 2007 3:31am
OK I found DAPI information here (this is very old stuff like more than7 year ago)
http://support.microsoft.com/kb/280136
So you want to use dapi againt exchange 200x?
Exchange 200x uses Active Directory for the Directory unlike Exchange 5.5 that hosts its own directory
You want to find more information about ADSI programming (Active Directory Service Interface) to access the directory
http://msdn2.microsoft.com/en-us/library/aa125368.aspx
Deli
Free Windows Admin Tool Kit Click here and download it now
October 20th, 2007 3:48am
Thanks a million for your reply! I am working on a project that using DAPI. Here is some sample codes:
Code Block
#include <dapi.h>
typedef DWORD APIENTRY LPFNDAPIGETSITEINFO(DWORD,LPTSTR,PSITE_INFO*);
typedef DAPI_EVENT* APIENTRY LPFNDAPISTART(LPDAPI_HANDLE,LPDAPI_PARMS);
typedef DAPI_EVENT* APIENTRY LPFNDAPIWRITE(DAPI_HANDLE,DWORD,PDAPI_ENTRY,PDAPI_ENTRY,PULONG,LPTSTR, LPTSTR);
typedef DAPI_EVENT* APIENTRY LPFNDAPIREAD(DAPI_HANDLE, DWORD, LPTSTR, PDAPI_ENTRY, PDAPI_ENTRY*, PDAPI_ENTRY*);
typedef DAPI_EVENT* APIENTRY LPFNDAPIEND(LPDAPI_HANDLE);
typedef DAPI_EVENT* APIENTRY LPFNDAPIFREEMEMORY(LPVOID);
.......
void XXXX::StartDAPI(char* szDSAName,char* szContainer) {
char szError[256];
if (!(strlen(szDSAName) && strlen(szContainer))) {
m_hDAPISession = NULL;
return;
}
m_hDapiDLL = LoadLibrary("DAPI.DLL");
if (m_hDapiDLL == NULL) {
m_hDAPISession = NULL;
return;
}
DAPI_EVENT* pDAPIEvent = NULL;
DAPI_PARMS DAPIParms = {0};
PSITE_INFO pSiteInfo;
m_lpfnDAPIGetSiteInfo = (LPFNDAPIGETSITEINFO*)GetProcAddress(m_hDapiDLL,"DAPIGetSiteInfoA@12");
m_lpfnDAPIStart = (LPFNDAPISTART*)GetProcAddress(m_hDapiDLL,"DAPIStartA@8");
m_lpfnDAPIRead = (LPFNDAPIREAD*)GetProcAddress(m_hDapiDLL,"DAPIReadA@24");
m_lpfnDAPIWrite = (LPFNDAPIWRITE*)GetProcAddress(m_hDapiDLL,"DAPIWriteA@28");
m_lpfnDAPIFreeMemory = (LPFNDAPIFREEMEMORY*)GetProcAddress(m_hDapiDLL,"DAPIFreeMemory@4");
m_lpfnDAPIEnd = (LPFNDAPIEND*)GetProcAddress(m_hDapiDLL,"DAPIEnd@4");
if (!( m_lpfnDAPIGetSiteInfo && m_lpfnDAPIStart && m_lpfnDAPIRead &&
m_lpfnDAPIWrite && m_lpfnDAPIEnd && m_lpfnDAPIFreeMemory))
return; // functions failed to load
pDAPIEvent = (DAPI_EVENT*)m_lpfnDAPIGetSiteInfo(NULL,szDSAName,&pSiteInfo);
if (pDAPIEvent) {
ReportDAPIEvent(pDAPIEvent,szError);
m_hDAPISession = NULL;
return;
}
DAPIParms.dwDAPISignature = DAPI_SIGNATURE;
DAPIParms.dwFlags = DAPI_EVENT_ALL | DAPI_MODIFY_REPLACE_PROPERTIES | DAPI_RESTRICT_ACCESS ;
DAPIParms.pszDSAName = pSiteInfo->objServer.pszName;
DAPIParms.pszBasePoint = pSiteInfo->objSite.pszDNString;
DAPIParms.pszContainer = szContainer;
DAPIParms.pszNTDomain = pSiteInfo->objSite.pszDisplayName;
DAPIParms.pszCreateTemplate = NULL;
DAPIParms.pAttributes = NULL;
pDAPIEvent = m_lpfnDAPIStart(
&m_hDAPISession,
&DAPIParms);
if (pDAPIEvent != NULL){
ReportDAPIEvent(pDAPIEvent,szError);
m_hDAPISession = NULL;
return;
}
...
}
Now I have to migrate it from vc6 to vs2005 and I am not familiar about Exchange server.
Deli Pro-Exchange wrote:
OK I found DAPI information here (this is very old stuff like more than7 year ago)
http://support.microsoft.com/kb/280136
here is another information about this : http://support.microsoft.com/kb/189531
but I don't know what i should install exactly, the Platform SDK? But the OS i am using now is Vista and I didn't find PSDK for Vista.
Deli Pro-Exchange wrote:
So you want to use dapi againt exchange 200x?
Exchange 200x uses Active Directory for the Directory unlike Exchange 5.5 that hosts its own directory
You want to find more information about ADSI programming (Active Directory Service Interface) to access the directory
http://msdn2.microsoft.com/en-us/library/aa125368.aspx
Deli
Did you meanthat dapi is the interface of Exchange5.5 and it has been changed into ADSI after exchange 2000?Is dapi been discarded? If so I think I should use the substitute (maybe ADSI?), or I should get the newest version of dapi files.
October 20th, 2007 4:09am
I have found the following info from http://support.microsoft.com/kb/252886
It seems that DAPI has been dropped foreverby microsoft since exchange 2000! I think the only way to solve my problem is using ADSI as you recommended. But I am afraid ADSI will be dropped someday...
INFO: Exchange 2000 Does Not Support Directory API
View products that this article applies to.
Article ID
:
252886
Last Review
:
February 22, 2007
Revision
:
2.2
This article was previously published under Q252886
SUMMARY
The Directory API (DAPI) is not supported under Exchange 2000. DAPI code that was written for previous versions of Exchange will not work against the Exchange 2000 directory. Instead, you should use Active Directory Services Interface (ADSI) or Light-weight Directory Access Protocol (LDAP) API to programmatically manipulate the Exchange 2000 directory.
Back to the top
MORE INFORMATION
Exchange 2000 Directory Services is tightly integrated with and dependent on Microsoft Windows 2000 Directory Services. DAPI is a technology specific to earlier versions of Microsoft Exchange. Because of the tight integration with the Windows 2000 directory structure, DAPI support is not included in Exchange 2000. LDAP API is supported in Exchange 2000, but Microsoft recommends that you use ADSI to develop custom directory solutions.Earlier versions of Exchange Server running on Windows NT platforms will still support DAPI, and these earlier servers can participate in Exchange 2000 organizations. However, any directory solutions that target Exchange 2000 or Windows 2000 directory objects must use ADSI or LDAP API as the mechanism for doing so.You cannot use the Exchange 2000 .dll files with DAPI to programmatically access an Exchange 5.x server. You must use Exchange Server version 5.x .dll files.
Free Windows Admin Tool Kit Click here and download it now
October 20th, 2007 5:05am
It's very unlikely that Microsoft will drop ADSI programming as it is the defacto standard to access Active Directory and any other LDAP compliant directory
ADSI is in the .NET Framework and it is not going away any time soon!
Powershell for Exchange is also build on the .NET framework and also uses ADSI underneath
Your investment will be worth the time
Deli
October 20th, 2007 1:40pm