#include<cssm.h>
CSSM_GUID dl_guid =
{ 0x5fc43dc1, 0x732, 0x11d0, { 0xbb, 0x14, 0x0, 0xaa, 0x0, 0x36, 0x67, 0x2d } };
CSSM_SPI_DL_FUNCS FunctionTable;
CSSM_REGISTRATION_INFO DLRegInfo;
CSSM_MODULE_FUNCS Services;
CSSM_SPI_MEMORY_FUNCS DLMemoryFunctions;
BOOL DllMain ( HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
/* Fill in Registration information */
DLRegInfo.Initialize = DL_Initialize;
DLRegInfo.Terminate = DL_Uninitialize;
DLRegInfo.EventNotify = DL_EventNotify;
DLRegInfo.GetModuleInfo = NULL;
DLRegInfo.FreeModuleInfo = NULL;
DLRegInfo.ThreadSafe = CSSM_TRUE;
DLRegInfo.ServiceSummary = CSSM_SERVICE_DL;
DLRegInfo.NumberOfServiceTables = 1;
DLRegInfo.Services = &Services;
/* Fill in Services */
Services.ServiceType = CSSM_SERVICE_DL;
Services.DlFuncs = &FunctionTable;
/* Fill in FunctionTable with function pointers */
FunctionTable.Authenticate = DL_Authenticate;
FunctionTable.DbOpen = DL_DbOpen;
FunctionTable.DbClose = DL_DbClose;
FunctionTable.DbCreate = DL_DbCreate;
FunctionTable.DbDelete = DL_DbDelete;
FunctionTable.DbImport = DL_DbImport;
FunctionTable.DbExport = DL_DbExport;
FunctionTable.DbSetRecordParsingFunctions = DL_DbSetRecordParsingFunctions;
FunctionTable.DbGetRecordParsingFunctions = DL_DbGetRecordParsingFunctions;
FunctionTable.GetDbNameFromHandle = DL_GetDbNameFromHandle;
FunctionTable.DataInsert = DL_DataInsert;
FunctionTable.DataDelete = DL_DataDelete;
FunctionTable.DataGetFirst = DL_DataGetFirst;
FunctionTable.DataGetNext = DL_DataGetNext;
FunctionTable.DataAbortQuery = DL_DataAbortQuery;
FunctionTable.FreeUniqueRecord = DL_FreeUniqueRecord;
FunctionTable.PassThrough = DL_PassThrough;
/* Call CSSM_RegisterServices to register the FunctionTable */
/* with CSSM and to receive the application's memory upcall table */
if (CSSM_ RegisterServices (&dl_guid, &DLRegInfo,
&DLMemoryFunctions,NULL) != CSSM_OK)
return FALSE;
/* Make the upcall table available to all functions in this library */
break;
}
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
if (CSSM_DeregisterServices (&dl_guid) != CSSM_OK)
return FALSE;
break;
}
return TRUE;
}