home *** CD-ROM | disk | FTP | other *** search
- int GetAppPath(const char* pszKey, char* pszBuffer);
- int GetIniPath(const char* pszKey, char* pszBuffer);
-
- #ifndef MDUSER_DLL
-
- #include <stdio.h>
- #include "MDUserImports.h"
-
- HINSTANCE hMDUSER = NULL;
- bool MDUserDllLoaded = false;
-
- #ifndef _EMAIL_GUARDIAN_
- MD_ClearSettingsCacheP MD_ClearSettingsCache;
- MD_SetGhostCountP MD_SetGhostCount;
- MD_GetStringKeyP MD_GetStringKey;
- MD_SetStringKeyP MD_SetStringKey;
- MD_GetIntKeyP MD_GetIntKey;
- MD_SetIntKeyP MD_SetIntKey;
- MD_GetBoolKeyP MD_GetBoolKey;
- MD_SetBoolKeyP MD_SetBoolKey;
- MD_RenameSectionP MD_RenameSection;
- MD_DeleteSectionP MD_DeleteSection;
- MD_DeleteKeyP MD_DeleteKey;
- MD_GetSectionNamesP MD_GetSectionNames;
- #endif
- MD_FlagReloadUsersP MD_FlagReloadUsers;
- MD_CreateFileNameP MD_CreateFileName;
- MD_InitMessageInfoP MD_InitMessageInfo;
- MD_GetSharedUserInfoP MD_GetSharedUserInfo;
- MD_GetSharedListMemberInfoP MD_GetSharedListMemberInfo;
- MD_VerifyMessageInfoP MD_VerifyMessageInfo;
- MD_SpoolMessageP MD_SpoolMessage;
- MD_SendInstantMessageP MD_SendInstantMessage;
- MD_GetDomainNamesP MD_GetDomainNames;
- MD_GetDomainsGABP MD_GetDomainsGAB;
- MD_GetDomainIPP MD_GetDomainIP;
- MD_GetDomainCountP MD_GetDomainCount;
- MD_GetDomainNameUsingIPP MD_GetDomainNameUsingIP;
- MD_FilterStringP MD_FilterString;
- MD_FilterUserInfoP MD_FilterUserInfo;
- MD_RegisterWindowP MD_RegisterWindow;
- MD_UnregisterWindowP MD_UnregisterWindow;
- MD_SendAppMessageP MD_SendAppMessage;
- MD_ReloadUsersP MD_ReloadUsers;
- MD_GetAppDirP MD_GetAppDir;
- MD_SetIsMDConfigP MD_SetIsMDConfig;
- MD_GetIsMDConfigP MD_GetIsMDConfig;
- MD_GetDBPathP MD_GetDBPath;
- MD_AddToQueueListP MD_AddToQueueList;
- MD_RemoveFromQueueListP MD_RemoveFromQueueList;
- MD_IsAlreadyAQueueP MD_IsAlreadyAQueue;
- MD_InitUserInfoP MD_InitUserInfo;
- MD_ImportUserInfoP MD_ImportUserInfo;
- MD_ExportAllUsersP MD_ExportAllUsers;
- MD_GetLicensesUsedP MD_GetLicensesUsed;
- MD_IsAVLicenseTooSmallP MD_IsAVLicenseTooSmall;
- MD_AddUserP MD_AddUser;
- MD_ChangeUserP MD_ChangeUser;
- MD_DeleteUserP MD_DeleteUser;
- MD_VerifyUserInfoP MD_VerifyUserInfo;
- MD_UserCountP MD_UserCount;
- MD_GetCalendarOnlyCountP MD_GetCalendarOnlyCount;
- MD_IsProVersionP MD_IsProVersion;
- MD_IsTrialVersionP MD_IsTrialVersion;
- MD_GetPublicIMAPFolderAccessP MD_GetPublicIMAPFolderAccess;
- MD_IsSystemAddressP MD_IsSystemAddress;
- MD_VerifyAccountDBP MD_VerifyAccountDB;
- MD_IsDBConnectedP MD_IsDBConnected;
-
- MD_FindFirstP MD_FindFirst;
- MD_FindNextP MD_FindNext;
- MD_FindCloseP MD_FindClose;
- MD_FindFirstRuleP MD_FindFirstRule;
- MD_FindNextRuleP MD_FindNextRule;
- MD_GetEditIMAPRulesP MD_GetEditIMAPRules;
- MD_SetEditIMAPRulesP MD_SetEditIMAPRules;
- MD_ReadRuleP MD_ReadRule;
- MD_MoveRuleUpP MD_MoveRuleUp;
- MD_MoveRuleDownP MD_MoveRuleDown;
- MD_RuleStructToRuleStringP MD_RuleStructToRuleString;
- MD_RuleStringToRuleStructP MD_RuleStringToRuleStruct;
- MD_AddRuleP MD_AddRule;
- MD_DeleteRuleP MD_DeleteRule;
- MD_ChangeRuleP MD_ChangeRule;
- MD_InitMultiPOPItemP MD_InitMultiPOPItem;
- MD_AddMultiPOPItemP MD_AddMultiPOPItem;
- MD_DeleteMultiPOPItemP MD_DeleteMultiPOPItem;
- MD_GetMultiPOPItemsP MD_GetMultiPOPItems;
- MD_SetMultiPOPItemsP MD_SetMultiPOPItems;
- MD_DeleteAllAliasesP MD_DeleteAllAliases;
- MD_CreateAliasP MD_CreateAlias;
- MD_DeleteAliasP MD_DeleteAlias;
- MD_GetIMAPFoldersP MD_GetIMAPFolders;
- MD_CreateIMAPFolderP MD_CreateIMAPFolder;
- MD_ValidateUserP MD_ValidateUser;
- MD_LogonUserP MD_LogonUser;
- MD_GetByAliasP MD_GetByAlias;
- MD_UserExistsP MD_UserExists;
- MD_GetByEmailP MD_GetByEmail;
- MD_GetByFullNameP MD_GetByFullName;
- MD_GetByMailboxP MD_GetByMailbox;
- MD_GetByMailDirP MD_GetByMailDir;
- MD_GetFreeP MD_GetFree;
- MD_GetUserInfoP MD_GetUserInfo;
- MD_SetUserInfoP MD_SetUserInfo;
- MD_GetEmailP MD_GetEmail;
- MD_GetMailboxP MD_GetMailbox;
- MD_SetMailboxP MD_SetMailbox;
- MD_GetDomainP MD_GetDomain;
- MD_SetDomainP MD_SetDomain;
- MD_GetFullNameP MD_GetFullName;
- MD_SetFullNameP MD_SetFullName;
- MD_GetMailDirP MD_GetMailDir;
- MD_SetMailDirP MD_SetMailDir;
- MD_GetPasswordP MD_GetPassword;
- MD_SetPasswordP MD_SetPassword;
- MD_GetAutoDecodeP MD_GetAutoDecode;
- MD_SetAutoDecodeP MD_SetAutoDecode;
- MD_GetIsForwardingP MD_GetIsForwarding;
- MD_SetIsForwardingP MD_SetIsForwarding;
- MD_GetAllowAccessP MD_GetAllowAccess;
- MD_SetAllowAccessP MD_SetAllowAccess;
- MD_GetAllowChangeViaEmailP MD_GetAllowChangeViaEmail;
- MD_SetAllowChangeViaEmailP MD_SetAllowChangeViaEmail;
- MD_GetKeepForwardedMailP MD_GetKeepForwardedMail;
- MD_SetKeepForwardedMailP MD_SetKeepForwardedMail;
- MD_GetHideFromEveryoneP MD_GetHideFromEveryone;
- MD_SetHideFromEveryoneP MD_SetHideFromEveryone;
- MD_GetEncryptMailP MD_GetEncryptMail;
- MD_SetEncryptMailP MD_SetEncryptMail;
- MD_GetApplyQuotasP MD_GetApplyQuotas;
- MD_SetApplyQuotasP MD_SetApplyQuotas;
- MD_GetEnableMultiPOPP MD_GetEnableMultiPOP;
- MD_SetEnableMultiPOPP MD_SetEnableMultiPOP;
- MD_GetCanModifyGABP MD_GetCanModifyGAB;
- MD_SetCanModifyGABP MD_SetCanModifyGAB;
- MD_GetIsCalendarOnlyP MD_GetIsCalendarOnly;
- MD_SetIsCalendarOnlyP MD_SetIsCalendarOnly;
- MD_GetMaxDiskSpaceP MD_GetMaxDiskSpace;
- MD_SetMaxDiskSpaceP MD_SetMaxDiskSpace;
- MD_GetMaxMessageCountP MD_GetMaxMessageCount;
- MD_SetMaxMessageCountP MD_SetMaxMessageCount;
- MD_GetForwardingInfoP MD_GetForwardingInfo;
- MD_SetForwardingInfoP MD_SetForwardingInfo;
- MD_GetAutoRespInfoP MD_GetAutoRespInfo;
- MD_SetAutoRespInfoP MD_SetAutoRespInfo;
- MD_RestrictInboundMailP MD_RestrictInboundMail;
- MD_SetInboundMailRestrictionsP MD_SetInboundMailRestrictions;
- MD_RestrictOutboundMailP MD_RestrictOutboundMail;
- MD_SetOutboundMailRestrictionsP MD_SetOutboundMailRestrictions;
- MD_GetCommentsP MD_GetComments;
- MD_SetCommentsP MD_SetComments;
- MD_EraseAutoRespP MD_EraseAutoResp;
- MD_UpdateAutoRespDomainsP MD_UpdateAutoRespDomains;
- MD_GetMailFormatP MD_GetMailFormat;
- MD_SetMailFormatP MD_SetMailFormat;
- MD_GetSignatureFileP MD_GetSignatureFile;
- MD_SetSignatureFileP MD_SetSignatureFile;
- MD_GetFileCountP MD_GetFileCount;
- MD_GetDirSizeP MD_GetDirSize;
- MD_GetPruningFlagsP MD_GetPruningFlags;
- MD_SetPruningFlagsP MD_SetPruningFlags;
- MD_GetUseDefaultPruningP MD_GetUseDefaultPruning;
- MD_SetUseDefaultPruningP MD_SetUseDefaultPruning;
- MD_GetWebConfigBitP MD_GetWebConfigBit;
- MD_GetWebConfigBitsP MD_GetWebConfigBits;
- MD_SetWebConfigBitP MD_SetWebConfigBit;
- MD_SetWebConfigBitsP MD_SetWebConfigBits;
- MD_IsDynamicPasswordStrP MD_IsDynamicPasswordStr;
- MD_GetMaxUIDLCountP MD_GetMaxUIDLCount;
- MD_SetMaxUIDLCountP MD_SetMaxUIDLCount;
- MD_GetMaxMessageSizeP MD_GetMaxMessageSize;
- MD_SetMaxMessageSizeP MD_SetMaxMessageSize;
- MD_AddToLdapAddrBookP MD_AddToLdapAddrBook;
- MD_DeleteFromLdapAddrBookP MD_DeleteFromLdapAddrBook;
- MD_ChangeLdapAddrBookP MD_ChangeLdapAddrBook;
-
- MD_InitGatewayInfoP MD_InitGatewayInfo;
- MD_VerifyGatewayInfoP MD_VerifyGatewayInfo;
- MD_WriteGatewayP MD_WriteGateway;
- MD_FreeGatewayP MD_FreeGateway;
- MD_DeleteGatewayP MD_DeleteGateway;
-
- MD_IsAddressInWorldClientAddressBookP MD_IsAddressInWorldClientAddressBook;
-
-
- #define GET_FUNC(s) s## = (s##P) GetProcAddress(hMDUSER, #s); result &= (s## != NULL);
-
- bool LoadMDUserDll(char* MDUserDll, bool LoadUsers, bool IgnoreFail, bool PopupErrors)
- {
- int Num;
- return LoadMDUserDll(Num, MDUserDll, LoadUsers, IgnoreFail, PopupErrors);
- }
-
- bool LoadMDUserDll(int& Result, char* MDUserDll, bool LoadUsers, bool IgnoreFail, bool PopupErrors)
- {
- Result = 0;
-
- if (MDUserDll == NULL)
- {
- // Oh my gosh. I had to change this at the last minute because this function
- // was assuming that the DLL would always be in the same directory as the
- // program that was using it! (see above commented code). This is often not
- // the case (WebConfig, WorldClient, et.al.) - Arvel 04/03/01.
-
- char szWorkBuffer[MAX_PATH];
- char szAppPath[MAX_PATH+1];
-
- // Don't add trialing backslashes to these reg key values because doing that
- // breaks Windows 95.
- #ifndef _EMAIL_GUARDIAN_
- strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
- #else
- strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\EmailGuardian");
- #endif
-
- if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- return false;
- }
- if (szAppPath[0] == '\0')
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- }
-
- char szIniPath[256];
-
- if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- return false;
- }
-
- char szDllType[16];
- GetPrivateProfileString("Advanced", "UserDllType", "", szDllType, sizeof(szDllType), szIniPath);
-
- char szDll[256];
- sprintf(szDll, "%s\\MDUser%s.dll", szAppPath, szDllType);
-
- hMDUSER = LoadLibrary(szDll);
- }
- else
- hMDUSER = LoadLibrary(MDUserDll);
-
- if (hMDUSER == NULL)
- {
- Result = GetLastError();
- return false;
- }
-
- bool result = true;
-
- #ifndef _EMAIL_GUARDIAN_
- GET_FUNC(MD_ClearSettingsCache);
- GET_FUNC(MD_SetGhostCount);
- GET_FUNC(MD_GetStringKey);
- GET_FUNC(MD_SetStringKey);
- GET_FUNC(MD_GetIntKey);
- GET_FUNC(MD_SetIntKey);
- GET_FUNC(MD_GetBoolKey);
- GET_FUNC(MD_SetBoolKey);
- GET_FUNC(MD_RenameSection);
- GET_FUNC(MD_DeleteSection);
- GET_FUNC(MD_DeleteKey);
- GET_FUNC(MD_GetSectionNames);
- #endif
- GET_FUNC(MD_FlagReloadUsers);
- GET_FUNC(MD_CreateFileName);
- GET_FUNC(MD_InitMessageInfo)
- GET_FUNC(MD_GetSharedUserInfo)
- GET_FUNC(MD_GetSharedListMemberInfo)
- GET_FUNC(MD_VerifyMessageInfo)
- GET_FUNC(MD_SpoolMessage)
- GET_FUNC(MD_SendInstantMessage)
- GET_FUNC(MD_GetDomainsGAB)
- GET_FUNC(MD_GetDomainNames)
- GET_FUNC(MD_GetDomainIP)
- GET_FUNC(MD_GetDomainCount)
- GET_FUNC(MD_GetDomainNameUsingIP)
- GET_FUNC(MD_FilterString)
- GET_FUNC(MD_FilterUserInfo)
- GET_FUNC(MD_RegisterWindow)
- GET_FUNC(MD_UnregisterWindow)
- GET_FUNC(MD_SendAppMessage)
- GET_FUNC(MD_ReloadUsers)
- GET_FUNC(MD_GetAppDir)
- GET_FUNC(MD_SetIsMDConfig)
- GET_FUNC(MD_GetIsMDConfig)
- GET_FUNC(MD_GetDBPath)
- GET_FUNC(MD_IsAlreadyAQueue)
- GET_FUNC(MD_AddToQueueList)
- GET_FUNC(MD_RemoveFromQueueList)
- GET_FUNC(MD_InitUserInfo)
- GET_FUNC(MD_ImportUserInfo)
- GET_FUNC(MD_ExportAllUsers)
- GET_FUNC(MD_GetLicensesUsed)
- GET_FUNC(MD_IsAVLicenseTooSmall)
- GET_FUNC(MD_AddUser)
- GET_FUNC(MD_ChangeUser)
- GET_FUNC(MD_DeleteUser)
- GET_FUNC(MD_VerifyUserInfo)
- GET_FUNC(MD_UserCount)
- GET_FUNC(MD_GetCalendarOnlyCount)
- GET_FUNC(MD_IsProVersion)
- GET_FUNC(MD_IsTrialVersion)
- GET_FUNC(MD_GetPublicIMAPFolderAccess)
- GET_FUNC(MD_IsSystemAddress)
- GET_FUNC(MD_VerifyAccountDB)
- GET_FUNC(MD_IsDBConnected)
- GET_FUNC(MD_FindFirst)
- GET_FUNC(MD_FindNext)
- GET_FUNC(MD_FindClose)
- GET_FUNC(MD_FindFirstRule)
- GET_FUNC(MD_FindNextRule)
- GET_FUNC(MD_GetEditIMAPRules)
- GET_FUNC(MD_SetEditIMAPRules)
- GET_FUNC(MD_ReadRule)
- GET_FUNC(MD_MoveRuleUp)
- GET_FUNC(MD_MoveRuleDown)
- GET_FUNC(MD_RuleStringToRuleStruct)
- GET_FUNC(MD_RuleStructToRuleString)
- GET_FUNC(MD_AddRule)
- GET_FUNC(MD_DeleteRule)
- GET_FUNC(MD_ChangeRule)
- GET_FUNC(MD_InitMultiPOPItem)
- GET_FUNC(MD_AddMultiPOPItem)
- GET_FUNC(MD_DeleteMultiPOPItem)
- GET_FUNC(MD_GetMultiPOPItems)
- GET_FUNC(MD_SetMultiPOPItems)
- GET_FUNC(MD_DeleteAllAliases)
- GET_FUNC(MD_CreateAlias)
- GET_FUNC(MD_DeleteAlias)
- GET_FUNC(MD_GetIMAPFolders)
- GET_FUNC(MD_CreateIMAPFolder)
- GET_FUNC(MD_ValidateUser)
- GET_FUNC(MD_LogonUser)
- GET_FUNC(MD_GetByAlias)
- GET_FUNC(MD_UserExists)
- GET_FUNC(MD_GetByEmail)
- GET_FUNC(MD_GetByFullName)
- GET_FUNC(MD_GetByMailbox)
- GET_FUNC(MD_GetByMailDir)
- GET_FUNC(MD_GetFree)
- GET_FUNC(MD_GetUserInfo)
- GET_FUNC(MD_SetUserInfo)
- GET_FUNC(MD_GetEmail)
- GET_FUNC(MD_GetMailbox)
- GET_FUNC(MD_SetMailbox)
- GET_FUNC(MD_GetDomain)
- GET_FUNC(MD_SetDomain)
- GET_FUNC(MD_GetFullName)
- GET_FUNC(MD_SetFullName)
- GET_FUNC(MD_GetMailDir)
- GET_FUNC(MD_SetMailDir)
- GET_FUNC(MD_GetPassword)
- GET_FUNC(MD_SetPassword)
- GET_FUNC(MD_GetAutoDecode)
- GET_FUNC(MD_SetAutoDecode)
- GET_FUNC(MD_GetIsForwarding)
- GET_FUNC(MD_SetIsForwarding)
- GET_FUNC(MD_GetAllowAccess)
- GET_FUNC(MD_SetAllowAccess)
- GET_FUNC(MD_GetAllowChangeViaEmail)
- GET_FUNC(MD_SetAllowChangeViaEmail)
- GET_FUNC(MD_GetKeepForwardedMail)
- GET_FUNC(MD_SetKeepForwardedMail)
- GET_FUNC(MD_GetHideFromEveryone)
- GET_FUNC(MD_SetHideFromEveryone)
- GET_FUNC(MD_GetEncryptMail)
- GET_FUNC(MD_SetEncryptMail)
- GET_FUNC(MD_GetApplyQuotas)
- GET_FUNC(MD_SetApplyQuotas)
- GET_FUNC(MD_GetEnableMultiPOP)
- GET_FUNC(MD_SetEnableMultiPOP)
- GET_FUNC(MD_GetCanModifyGAB)
- GET_FUNC(MD_SetCanModifyGAB)
- GET_FUNC(MD_GetIsCalendarOnly)
- GET_FUNC(MD_SetIsCalendarOnly)
- GET_FUNC(MD_GetMaxDiskSpace)
- GET_FUNC(MD_SetMaxDiskSpace)
- GET_FUNC(MD_GetMaxMessageCount)
- GET_FUNC(MD_SetMaxMessageCount)
- GET_FUNC(MD_GetForwardingInfo)
- GET_FUNC(MD_SetForwardingInfo)
- GET_FUNC(MD_GetAutoRespInfo)
- GET_FUNC(MD_SetAutoRespInfo)
- GET_FUNC(MD_RestrictInboundMail)
- GET_FUNC(MD_SetInboundMailRestrictions)
- GET_FUNC(MD_RestrictOutboundMail)
- GET_FUNC(MD_SetOutboundMailRestrictions)
- GET_FUNC(MD_GetComments)
- GET_FUNC(MD_SetComments)
- GET_FUNC(MD_EraseAutoResp)
- GET_FUNC(MD_UpdateAutoRespDomains)
- GET_FUNC(MD_GetMailFormat)
- GET_FUNC(MD_SetMailFormat)
- GET_FUNC(MD_GetSignatureFile)
- GET_FUNC(MD_SetSignatureFile)
- GET_FUNC(MD_GetFileCount)
- GET_FUNC(MD_GetDirSize)
- GET_FUNC(MD_GetPruningFlags)
- GET_FUNC(MD_SetPruningFlags)
- GET_FUNC(MD_GetUseDefaultPruning)
- GET_FUNC(MD_SetUseDefaultPruning)
- GET_FUNC(MD_GetWebConfigBit)
- GET_FUNC(MD_GetWebConfigBits)
- GET_FUNC(MD_SetWebConfigBit)
- GET_FUNC(MD_SetWebConfigBits)
- GET_FUNC(MD_IsDynamicPasswordStr)
- GET_FUNC(MD_GetMaxUIDLCount)
- GET_FUNC(MD_SetMaxUIDLCount)
- GET_FUNC(MD_GetMaxMessageSize)
- GET_FUNC(MD_SetMaxMessageSize)
- GET_FUNC(MD_AddToLdapAddrBook)
- GET_FUNC(MD_DeleteFromLdapAddrBook)
- GET_FUNC(MD_ChangeLdapAddrBook)
- GET_FUNC(MD_InitGatewayInfo)
- GET_FUNC(MD_VerifyGatewayInfo)
- GET_FUNC(MD_WriteGateway)
- GET_FUNC(MD_FreeGateway)
- GET_FUNC(MD_DeleteGateway)
- GET_FUNC(MD_IsAddressInWorldClientAddressBook);
-
- if (!result)
- result = IgnoreFail;
-
- if (!result)
- {
- FreeMDUserDll();
- Result = 1;
- return false;
- }
- else
- {
- MDUserDllLoaded = true;
- if (LoadUsers)
- MD_ReloadUsers();
- return true;
- }
- }
-
- void FreeMDUserDll()
- {
- MDUserDllLoaded = false;
-
- if (hMDUSER != NULL)
- FreeLibrary(hMDUSER), hMDUSER = NULL;
- }
-
- #endif // MDUSER_DLL
-
-
- #ifndef MDLIST_DLL
- #include <stdio.h>
- #include "MDUserImports.h"
-
- HINSTANCE hMDLIST = NULL;
- #define GET_FUNC2(s) s## = (s##P) GetProcAddress(hMDLIST, #s); result &= (s## != NULL);
-
- MD_ClearListSettingsCacheP MD_ClearListSettingsCache;
- MD_GetListStringKeyP MD_GetListStringKey;
- MD_GetListLongKeyP MD_GetListLongKey;
- MD_GetListBoolKeyP MD_GetListBoolKey;
- MD_ListRemoveMemberP MD_ListRemoveMember;
- MD_ListDefaultModeP MD_ListDefaultMode;
- MD_ListAddMemberP MD_ListAddMember;
- MD_ListWriteMemberP MD_ListWriteMember;
- MD_ListSetRealNameP MD_ListSetRealName;
- MD_ListSetDigestP MD_ListSetDigest;
- MD_ListSetNomailP MD_ListSetNomail;
- MD_ListSetReadOnlyP MD_ListSetReadOnly;
- MD_ListSetNormalP MD_ListSetNormal;
- MD_ListSuppressedP MD_ListSuppressed;
- MD_ListRemoveFromAllP MD_ListRemoveFromAll;
- MD_ListIsMemberP MD_ListIsMember;
- MD_ListNotificationAddressP MD_ListNotificationAddress;
- MD_ListPrecedenceLevelP MD_ListPrecedenceLevel;
- MD_ListInsertCaptionP MD_ListInsertCaption;
- MD_ListMemberCountP MD_ListMemberCount;
- MD_ListPasswordP MD_ListPassword;
- MD_ListSubscribeNoteP MD_ListSubscribeNote;
- MD_ListUnsubscribeNoteP MD_ListUnsubscribeNote;
- MD_ListMsgTooBigNoteP MD_ListMsgTooBigNote;
- MD_ListArchiveCatalogP MD_ListArchiveCatalog;
- MD_ListDigestMBFP MD_ListDigestMBF;
- MD_ListSendSubAuthP MD_ListSendSubAuth;
- MD_ListSendUnSubAuthP MD_ListSendUnSubAuth;
- MD_ListModeratedP MD_ListModerated;
- MD_ListAllowSubscribeP MD_ListAllowSubscribe;
- MD_ListDigestHourP MD_ListDigestHour;
- MD_InitListInfoP MD_InitListInfo;
- MD_VerifyListInfoP MD_VerifyListInfo;
- MD_WriteListP MD_WriteList;
- MD_DeleteListP MD_DeleteList;
- MD_ListGetCountP MD_ListGetCount;
- MD_ListGetNamesP MD_ListGetNames;
- MD_ListExistsP MD_ListExists;
- MD_ListUpdateDomainP MD_ListUpdateDomain;
-
- MD_FindFirstListMemberP MD_FindFirstListMember;
- MD_FindNextListMemberP MD_FindNextListMember;
- MD_FindCloseListMemberP MD_FindCloseListMember;
- MD_GetListMemberP MD_GetListMember;
-
-
- bool LoadMDListDll(char* MDListDll, bool IgnoreFail, bool PopupErrors)
- {
- int Result;
- return LoadMDListDll(Result, MDListDll, IgnoreFail, PopupErrors);
- }
-
- bool LoadMDListDll(int &Result, char* MDListDll, bool IgnoreFail, bool PopupErrors)
- {
- if (MDListDll == NULL)
- {
- // Oh my gosh. I had to change this at the last minute because this function
- // was assuming that the DLL would always be in the same directory as the
- // program that was using it! (see above commented code). This is often not
- // the case (WebConfig, WorldClient, et.al.) - Arvel 04/03/01.
-
- char szWorkBuffer[MAX_PATH];
- char szAppPath[MAX_PATH+1];
-
- // Don't add trialing backslashes to these reg key values because doing that
- // breaks Windows 95.
- #ifndef _EMAIL_GUARDIAN_
- strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
- #else
- strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\EmailGuardian");
- #endif
-
- if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- return false;
- }
- if (szAppPath[0] == '\0')
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- }
-
- char szIniPath[256];
-
- if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- return false;
- }
-
- char szDllType[16];
- GetPrivateProfileString("Advanced", "ListDllType", "", szDllType, sizeof(szDllType), szIniPath);
-
- char szDll[256];
- sprintf(szDll, "%s\\MDList%s.dll", szAppPath, szDllType);
-
- hMDLIST = LoadLibrary(szDll);
- }
- else
- hMDLIST = LoadLibrary(MDListDll);
-
- if (hMDLIST == NULL)
- {
- Result = GetLastError();
- return false;
- }
-
- bool result = true;
-
- GET_FUNC2(MD_ClearListSettingsCache)
- GET_FUNC2(MD_GetListStringKey)
- GET_FUNC2(MD_GetListLongKey)
- GET_FUNC2(MD_GetListBoolKey)
- GET_FUNC2(MD_ListRemoveMember)
- GET_FUNC2(MD_ListDefaultMode)
- GET_FUNC2(MD_ListAddMember)
- GET_FUNC2(MD_ListWriteMember)
- GET_FUNC2(MD_ListSetRealName)
- GET_FUNC2(MD_ListSetDigest)
- GET_FUNC2(MD_ListSetNomail)
- GET_FUNC2(MD_ListSetReadOnly)
- GET_FUNC2(MD_ListSetNormal)
- GET_FUNC2(MD_ListSuppressed)
- GET_FUNC2(MD_ListRemoveFromAll)
- GET_FUNC2(MD_ListIsMember)
- GET_FUNC2(MD_ListNotificationAddress)
- GET_FUNC2(MD_ListPrecedenceLevel)
- GET_FUNC2(MD_ListInsertCaption)
- GET_FUNC2(MD_ListMemberCount)
- GET_FUNC2(MD_ListPassword)
- GET_FUNC2(MD_ListSubscribeNote)
- GET_FUNC2(MD_ListUnsubscribeNote)
- GET_FUNC2(MD_ListMsgTooBigNote)
- GET_FUNC2(MD_ListArchiveCatalog)
- GET_FUNC2(MD_ListDigestMBF)
- GET_FUNC2(MD_ListSendSubAuth)
- GET_FUNC2(MD_ListSendUnSubAuth)
- GET_FUNC2(MD_ListModerated)
- GET_FUNC2(MD_ListAllowSubscribe)
- GET_FUNC2(MD_ListDigestHour)
- GET_FUNC2(MD_InitListInfo)
- GET_FUNC2(MD_VerifyListInfo)
- GET_FUNC2(MD_WriteList)
- GET_FUNC2(MD_DeleteList)
- GET_FUNC2(MD_FindFirstListMember)
- GET_FUNC2(MD_FindNextListMember)
- GET_FUNC2(MD_FindCloseListMember)
- GET_FUNC2(MD_GetListMember)
- GET_FUNC2(MD_ListGetCount)
- GET_FUNC2(MD_ListGetNames)
- GET_FUNC2(MD_ListExists)
- GET_FUNC2(MD_ListUpdateDomain)
-
- if (!result)
- result = IgnoreFail;
-
- if (!result)
- {
- FreeMDListDll();
- Result = 1;
- return false;
- }
- else
- {
- return true;
- }
- }
-
- void FreeMDListDll()
- {
-
- if (hMDLIST != NULL)
- FreeLibrary(hMDLIST), hMDLIST = NULL;
- }
- #endif // MDLIST_DLL
-
-
-
- #ifndef MDCALENDAR_DLL
-
- HINSTANCE hMDCALENDAR = NULL;
- #define GET_FUNC3(s) s## = (s##P) GetProcAddress(hMDCALENDAR, #s); result &= (s## != NULL);
-
- #ifndef _EMAIL_GUARDIAN_
-
- /*****************************/
- /* Calendaring API functions */
- /*****************************/
-
- MD_CalInitCalItemP MD_CalInitCalItem;
- MD_CalInitCalItem2P MD_CalInitCalItem2;
- MD_CalFreeCalItemP MD_CalFreeCalItem;
- MD_CalProcessICalendarFileP MD_CalProcessICalendarFile;
- MD_CalSendICalendarMessageP MD_CalSendICalendarMessage;
- MD_CalSendIMNotificationsP MD_CalSendIMNotifications;
- MD_CalGetCalItemP MD_CalGetCalItem;
- MD_CalGetMultipleCalItemsP MD_CalGetMultipleCalItems;
- MD_CalWriteCalItemP MD_CalWriteCalItem;
- MD_CalDeleteCalItemP MD_CalDeleteCalItem;
- MD_CalEventOverlapsP MD_CalEventOverlaps;
- MD_CalGetTodaysEventsP MD_CalGetTodaysEvents;
- MD_CalDayHasEventsP MD_CalDayHasEvents;
- MD_CalSetEventTextP MD_CalSetEventText;
- MD_CalAppendEventTextP MD_CalAppendEventText;
- MD_CalSetReminderTimeP MD_CalSetReminderTime;
- MD_CalDeleteReminderP MD_CalDeleteReminder;
- MD_CalSetMeetingPlannerP MD_CalSetMeetingPlanner;
- MD_CalSetEventCreatorP MD_CalSetEventCreator;
- MD_CalSetAccessToEventP MD_CalSetAccessToEvent;
- MD_CalGetAccessToEventP MD_CalGetAccessToEvent;
- MD_CalIsCalEnabledP MD_CalIsCalEnabled;
- MD_CalSetIsCalEnabledP MD_CalSetIsCalEnabled;
- MD_CalIsCalRestrictedP MD_CalIsCalRestricted;
- MD_CalSetIsCalRestrictedP MD_CalSetIsCalRestricted;
- MD_CalIsEventWithinConstraintsP MD_CalIsEventWithinConstraints;
- MD_CalIsMeetingLocationFreeP MD_CalIsMeetingLocationFree;
- MD_CalFindFirstFreeTimeBlockP MD_CalFindFirstFreeTimeBlock;
- MD_CalScheduleMeetingP MD_CalScheduleMeeting;
- MD_CalPreProcessMeetingP MD_CalPreProcessMeeting;
- MD_CalGetGlobalMemoP MD_CalGetGlobalMemo;
- MD_CalSetGlobalMemoP MD_CalSetGlobalMemo;
- MD_CalDeleteGlobalMemoP MD_CalDeleteGlobalMemo;
- MD_CalCanSetGlobalMemoP MD_CalCanSetGlobalMemo;
- MD_CalCanSetPersonalMemoP MD_CalCanSetPersonalMemo;
- MD_CalSetGlobalMemoRightsP MD_CalSetGlobalMemoRights;
- MD_CalGetGlobalMemoDefaultsP MD_CalGetGlobalMemoDefaults;
- MD_CalSetGlobalMemoDefaultsP MD_CalSetGlobalMemoDefaults;
- MD_CalGetPersonalMemoP MD_CalGetPersonalMemo;
- MD_CalSetPersonalMemoP MD_CalSetPersonalMemo;
- MD_CalDeletePersonalMemoP MD_CalDeletePersonalMemo;
- MD_CalSetMeetingLocationP MD_CalSetMeetingLocation;
- MD_CalCreateMeetingLocationP MD_CalCreateMeetingLocation;
- MD_CalDeleteMeetingLocationP MD_CalDeleteMeetingLocation;
- MD_CalGetAllMeetingLocationsP MD_CalGetAllMeetingLocations;
- MD_CalSetGlobalAccessPermissionP MD_CalSetGlobalAccessPermission;
- MD_CalGetGlobalAccessPermissionP MD_CalGetGlobalAccessPermission;
- MD_CalSetDefGlobalAccessPermissionP MD_CalSetDefGlobalAccessPermission;
- MD_CalGetDefGlobalAccessPermissionP MD_CalGetDefGlobalAccessPermission;
- MD_CalSetDefGlobalAccessPermissionListP MD_CalSetDefGlobalAccessPermissionList;
- MD_CalGetGlobalAccessPermissionListP MD_CalGetGlobalAccessPermissionList;
- MD_CalGetGlobalMemoPermissionListP MD_CalGetGlobalMemoPermissionList;
- MD_CalSetGlobalMemoPermissionListP MD_CalSetGlobalMemoPermissionList;
- MD_CalExportCalItemsP MD_CalExportCalItems;
- MD_CalImportCalItemsP MD_CalImportCalItems;
- MD_CalOpenFolderP MD_CalOpenFolder;
- MD_CalCloseFolderP MD_CalCloseFolder;
-
- #endif // _EMAIL_GUARDIAN_
-
-
- bool LoadMDCalendarDll(char* MDCalendarDll, bool IgnoreFail, bool PopupErrors)
- {
- int Result;
- return LoadMDCalendarDll(Result, MDCalendarDll, IgnoreFail, PopupErrors);
- }
-
- bool LoadMDCalendarDll(int &Result, char* MDCalendarDll, bool IgnoreFail, bool PopupErrors)
- {
- if (MDCalendarDll == NULL)
- {
- // Oh my gosh. I had to change this at the last minute because this function
- // was assuming that the DLL would always be in the same directory as the
- // program that was using it! (see above commented code). This is often not
- // the case (WebConfig, WorldClient, et.al.) - Arvel 04/03/01.
-
- char szWorkBuffer[MAX_PATH];
- char szAppPath[MAX_PATH+1];
-
- // Don't add trialing backslashes to these reg key values because doing that
- // breaks Windows 95.
- #ifndef _EMAIL_GUARDIAN_
- strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
- #else
- strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\EmailGuardian");
- #endif
-
- if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- return false;
- }
- if (szAppPath[0] == '\0')
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- }
-
- char szIniPath[256];
-
- if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
- {
- if (PopupErrors)
- {
- char Message[256];
- sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
- ::MessageBox(0, Message, "Fatal Error", 0L);
- }
- return false;
- }
-
- char szDllType[16];
- GetPrivateProfileString("Advanced", "CalendarDllType", "", szDllType, sizeof(szDllType), szIniPath);
-
- char szDll[256];
- sprintf(szDll, "%s\\MDCalendar%s.dll", szAppPath, szDllType);
-
- hMDCALENDAR = LoadLibrary(szDll);
- }
- else
- hMDCALENDAR = LoadLibrary(MDCalendarDll);
-
- if (hMDCALENDAR == NULL)
- {
- Result = GetLastError();
- return false;
- }
-
- bool result = true;
-
- #ifndef _EMAIL_GUARDIAN_
- GET_FUNC3(MD_CalInitCalItem)
- GET_FUNC3(MD_CalInitCalItem2)
- GET_FUNC3(MD_CalFreeCalItem)
- GET_FUNC3(MD_CalProcessICalendarFile)
- GET_FUNC3(MD_CalSendICalendarMessage)
- GET_FUNC3(MD_CalSendIMNotifications)
- GET_FUNC3(MD_CalGetCalItem)
- GET_FUNC3(MD_CalGetMultipleCalItems)
- GET_FUNC3(MD_CalWriteCalItem)
- GET_FUNC3(MD_CalDeleteCalItem)
- GET_FUNC3(MD_CalEventOverlaps)
- GET_FUNC3(MD_CalGetTodaysEvents)
- GET_FUNC3(MD_CalDayHasEvents)
- GET_FUNC3(MD_CalSetEventText)
- GET_FUNC3(MD_CalAppendEventText)
- GET_FUNC3(MD_CalSetReminderTime)
- GET_FUNC3(MD_CalDeleteReminder)
- GET_FUNC3(MD_CalSetMeetingPlanner)
- GET_FUNC3(MD_CalSetEventCreator)
- GET_FUNC3(MD_CalSetAccessToEvent)
- GET_FUNC3(MD_CalGetAccessToEvent)
- GET_FUNC3(MD_CalIsCalEnabled)
- GET_FUNC3(MD_CalSetIsCalEnabled)
- GET_FUNC3(MD_CalIsCalRestricted)
- GET_FUNC3(MD_CalSetIsCalRestricted)
- GET_FUNC3(MD_CalIsEventWithinConstraints)
- GET_FUNC3(MD_CalIsMeetingLocationFree)
- GET_FUNC3(MD_CalFindFirstFreeTimeBlock)
- GET_FUNC3(MD_CalScheduleMeeting)
- GET_FUNC3(MD_CalPreProcessMeeting)
- GET_FUNC3(MD_CalGetGlobalMemo)
- GET_FUNC3(MD_CalSetGlobalMemo)
- GET_FUNC3(MD_CalDeleteGlobalMemo)
- GET_FUNC3(MD_CalCanSetGlobalMemo)
- GET_FUNC3(MD_CalCanSetPersonalMemo)
- GET_FUNC3(MD_CalSetGlobalMemoRights)
- GET_FUNC3(MD_CalGetGlobalMemoDefaults)
- GET_FUNC3(MD_CalSetGlobalMemoDefaults)
- GET_FUNC3(MD_CalGetPersonalMemo)
- GET_FUNC3(MD_CalSetPersonalMemo)
- GET_FUNC3(MD_CalDeletePersonalMemo)
- GET_FUNC3(MD_CalSetMeetingLocation)
- GET_FUNC3(MD_CalCreateMeetingLocation)
- GET_FUNC3(MD_CalDeleteMeetingLocation)
- GET_FUNC3(MD_CalGetAllMeetingLocations)
- GET_FUNC3(MD_CalSetGlobalAccessPermission)
- GET_FUNC3(MD_CalGetGlobalAccessPermission)
- GET_FUNC3(MD_CalSetDefGlobalAccessPermission)
- GET_FUNC3(MD_CalGetDefGlobalAccessPermission)
- GET_FUNC3(MD_CalSetDefGlobalAccessPermissionList)
- GET_FUNC3(MD_CalGetGlobalAccessPermissionList)
- GET_FUNC3(MD_CalGetGlobalMemoPermissionList)
- GET_FUNC3(MD_CalSetGlobalMemoPermissionList)
- GET_FUNC3(MD_CalExportCalItems)
- GET_FUNC3(MD_CalImportCalItems)
- GET_FUNC3(MD_CalOpenFolder)
- GET_FUNC3(MD_CalCloseFolder)
- #endif
-
- if (!result)
- result = IgnoreFail;
-
- if (!result)
- {
- FreeMDCalendarDll();
- Result = 1;
- return false;
- }
- else
- {
- return true;
- }
- }
-
- void FreeMDCalendarDll()
- {
-
- if (hMDCALENDAR != NULL)
- FreeLibrary(hMDCALENDAR), hMDCALENDAR = NULL;
- }
- #endif // MDCALENDAR_DLL
-
-
- int GetAppPath(const char* pszKey, char* pszBuffer)
- {
- int nResult = ERROR_SUCCESS;
-
- pszBuffer[0] = '\0';
-
-
- HKEY hKey;
- nResult = (int)RegOpenKeyEx(HKEY_LOCAL_MACHINE, pszKey, 0, KEY_QUERY_VALUE, &hKey);
- if (nResult == ERROR_SUCCESS)
- {
- unsigned long uSize = 254;
- nResult = (int)RegQueryValueEx(hKey, "AppPath", NULL, NULL, (unsigned char*)pszBuffer, &uSize);
- RegCloseKey(hKey);
- }
-
- return nResult;
- }
-
- int GetIniPath(const char* pszKey, char* pszBuffer)
- {
- int nResult = ERROR_SUCCESS;
-
- pszBuffer[0] = '\0';
-
-
- HKEY hKey;
- nResult = (int)RegOpenKeyEx(HKEY_LOCAL_MACHINE, pszKey, 0, KEY_QUERY_VALUE, &hKey);
- if (nResult == ERROR_SUCCESS)
- {
- unsigned long uSize = 254;
- nResult = (int)RegQueryValueEx(hKey, "IniPath", NULL, NULL, (unsigned char*)pszBuffer, &uSize);
- RegCloseKey(hKey);
- }
-
- return nResult;
-
- }
-
-
-