home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 May / CHIPCD200305.iso / super / altn / md_en.exe / MDUSERIMPORTS.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  2003-04-08  |  29.6 KB  |  943 lines

  1. int GetAppPath(const char* pszKey, char* pszBuffer);
  2. int GetIniPath(const char* pszKey, char* pszBuffer);
  3.  
  4. #ifndef MDUSER_DLL
  5.  
  6. #include <stdio.h>
  7. #include "MDUserImports.h"
  8.  
  9. HINSTANCE hMDUSER = NULL;
  10. bool MDUserDllLoaded = false;
  11.  
  12. #ifndef _EMAIL_GUARDIAN_
  13. MD_ClearSettingsCacheP        MD_ClearSettingsCache;
  14. MD_SetGhostCountP            MD_SetGhostCount;
  15. MD_GetStringKeyP            MD_GetStringKey;
  16. MD_SetStringKeyP            MD_SetStringKey;
  17. MD_GetIntKeyP                MD_GetIntKey;
  18. MD_SetIntKeyP                MD_SetIntKey;
  19. MD_GetBoolKeyP                MD_GetBoolKey;
  20. MD_SetBoolKeyP                MD_SetBoolKey;
  21. MD_RenameSectionP            MD_RenameSection;
  22. MD_DeleteSectionP            MD_DeleteSection;
  23. MD_DeleteKeyP                MD_DeleteKey;
  24. MD_GetSectionNamesP            MD_GetSectionNames;
  25. #endif
  26. MD_FlagReloadUsersP            MD_FlagReloadUsers;
  27. MD_CreateFileNameP            MD_CreateFileName;
  28. MD_InitMessageInfoP         MD_InitMessageInfo;
  29. MD_GetSharedUserInfoP        MD_GetSharedUserInfo;
  30. MD_GetSharedListMemberInfoP MD_GetSharedListMemberInfo;
  31. MD_VerifyMessageInfoP        MD_VerifyMessageInfo;
  32. MD_SpoolMessageP            MD_SpoolMessage;
  33. MD_SendInstantMessageP        MD_SendInstantMessage;
  34. MD_GetDomainNamesP            MD_GetDomainNames;
  35. MD_GetDomainsGABP            MD_GetDomainsGAB;
  36. MD_GetDomainIPP                MD_GetDomainIP;
  37. MD_GetDomainCountP            MD_GetDomainCount;
  38. MD_GetDomainNameUsingIPP    MD_GetDomainNameUsingIP;
  39. MD_FilterStringP            MD_FilterString;
  40. MD_FilterUserInfoP            MD_FilterUserInfo;
  41. MD_RegisterWindowP            MD_RegisterWindow;
  42. MD_UnregisterWindowP        MD_UnregisterWindow;
  43. MD_SendAppMessageP            MD_SendAppMessage;
  44. MD_ReloadUsersP             MD_ReloadUsers;
  45. MD_GetAppDirP                MD_GetAppDir;
  46. MD_SetIsMDConfigP            MD_SetIsMDConfig;
  47. MD_GetIsMDConfigP            MD_GetIsMDConfig;
  48. MD_GetDBPathP                MD_GetDBPath;
  49. MD_AddToQueueListP            MD_AddToQueueList;
  50. MD_RemoveFromQueueListP        MD_RemoveFromQueueList;
  51. MD_IsAlreadyAQueueP         MD_IsAlreadyAQueue;
  52. MD_InitUserInfoP            MD_InitUserInfo;
  53. MD_ImportUserInfoP            MD_ImportUserInfo;
  54. MD_ExportAllUsersP            MD_ExportAllUsers;
  55. MD_GetLicensesUsedP            MD_GetLicensesUsed;
  56. MD_IsAVLicenseTooSmallP        MD_IsAVLicenseTooSmall;
  57. MD_AddUserP                 MD_AddUser;
  58. MD_ChangeUserP                MD_ChangeUser;
  59. MD_DeleteUserP                MD_DeleteUser;
  60. MD_VerifyUserInfoP            MD_VerifyUserInfo;
  61. MD_UserCountP                MD_UserCount;
  62. MD_GetCalendarOnlyCountP    MD_GetCalendarOnlyCount;
  63. MD_IsProVersionP            MD_IsProVersion;
  64. MD_IsTrialVersionP            MD_IsTrialVersion;
  65. MD_GetPublicIMAPFolderAccessP MD_GetPublicIMAPFolderAccess;
  66. MD_IsSystemAddressP            MD_IsSystemAddress;
  67. MD_VerifyAccountDBP            MD_VerifyAccountDB;
  68. MD_IsDBConnectedP            MD_IsDBConnected;
  69.  
  70. MD_FindFirstP                MD_FindFirst;
  71. MD_FindNextP                MD_FindNext;
  72. MD_FindCloseP                MD_FindClose;
  73. MD_FindFirstRuleP            MD_FindFirstRule;
  74. MD_FindNextRuleP            MD_FindNextRule;
  75. MD_GetEditIMAPRulesP        MD_GetEditIMAPRules; 
  76. MD_SetEditIMAPRulesP        MD_SetEditIMAPRules;
  77. MD_ReadRuleP                MD_ReadRule;    
  78. MD_MoveRuleUpP                MD_MoveRuleUp;
  79. MD_MoveRuleDownP            MD_MoveRuleDown;
  80. MD_RuleStructToRuleStringP  MD_RuleStructToRuleString;
  81. MD_RuleStringToRuleStructP  MD_RuleStringToRuleStruct;
  82. MD_AddRuleP                 MD_AddRule; 
  83. MD_DeleteRuleP                MD_DeleteRule;
  84. MD_ChangeRuleP                MD_ChangeRule;
  85. MD_InitMultiPOPItemP        MD_InitMultiPOPItem;
  86. MD_AddMultiPOPItemP            MD_AddMultiPOPItem;
  87. MD_DeleteMultiPOPItemP        MD_DeleteMultiPOPItem;
  88. MD_GetMultiPOPItemsP        MD_GetMultiPOPItems;
  89. MD_SetMultiPOPItemsP        MD_SetMultiPOPItems;
  90. MD_DeleteAllAliasesP        MD_DeleteAllAliases;
  91. MD_CreateAliasP                MD_CreateAlias;
  92. MD_DeleteAliasP                MD_DeleteAlias;
  93. MD_GetIMAPFoldersP            MD_GetIMAPFolders;
  94. MD_CreateIMAPFolderP        MD_CreateIMAPFolder;
  95. MD_ValidateUserP            MD_ValidateUser;
  96. MD_LogonUserP                MD_LogonUser;
  97. MD_GetByAliasP                MD_GetByAlias;
  98. MD_UserExistsP                MD_UserExists;
  99. MD_GetByEmailP                MD_GetByEmail;
  100. MD_GetByFullNameP            MD_GetByFullName;
  101. MD_GetByMailboxP            MD_GetByMailbox;
  102. MD_GetByMailDirP            MD_GetByMailDir;
  103. MD_GetFreeP                 MD_GetFree;
  104. MD_GetUserInfoP             MD_GetUserInfo;
  105. MD_SetUserInfoP             MD_SetUserInfo;
  106. MD_GetEmailP                MD_GetEmail;
  107. MD_GetMailboxP                MD_GetMailbox;
  108. MD_SetMailboxP                MD_SetMailbox;
  109. MD_GetDomainP                MD_GetDomain;
  110. MD_SetDomainP                MD_SetDomain;
  111. MD_GetFullNameP             MD_GetFullName;
  112. MD_SetFullNameP             MD_SetFullName;
  113. MD_GetMailDirP                MD_GetMailDir;
  114. MD_SetMailDirP                MD_SetMailDir;
  115. MD_GetPasswordP             MD_GetPassword;
  116. MD_SetPasswordP             MD_SetPassword;
  117. MD_GetAutoDecodeP            MD_GetAutoDecode;
  118. MD_SetAutoDecodeP            MD_SetAutoDecode;
  119. MD_GetIsForwardingP         MD_GetIsForwarding;
  120. MD_SetIsForwardingP         MD_SetIsForwarding;
  121. MD_GetAllowAccessP            MD_GetAllowAccess;
  122. MD_SetAllowAccessP            MD_SetAllowAccess;
  123. MD_GetAllowChangeViaEmailP    MD_GetAllowChangeViaEmail;
  124. MD_SetAllowChangeViaEmailP    MD_SetAllowChangeViaEmail;
  125. MD_GetKeepForwardedMailP    MD_GetKeepForwardedMail;
  126. MD_SetKeepForwardedMailP    MD_SetKeepForwardedMail;
  127. MD_GetHideFromEveryoneP     MD_GetHideFromEveryone;
  128. MD_SetHideFromEveryoneP     MD_SetHideFromEveryone;
  129. MD_GetEncryptMailP            MD_GetEncryptMail;
  130. MD_SetEncryptMailP            MD_SetEncryptMail;
  131. MD_GetApplyQuotasP            MD_GetApplyQuotas;
  132. MD_SetApplyQuotasP            MD_SetApplyQuotas;
  133. MD_GetEnableMultiPOPP        MD_GetEnableMultiPOP;
  134. MD_SetEnableMultiPOPP        MD_SetEnableMultiPOP;
  135. MD_GetCanModifyGABP            MD_GetCanModifyGAB;
  136. MD_SetCanModifyGABP            MD_SetCanModifyGAB;
  137. MD_GetIsCalendarOnlyP        MD_GetIsCalendarOnly;
  138. MD_SetIsCalendarOnlyP        MD_SetIsCalendarOnly;
  139. MD_GetMaxDiskSpaceP         MD_GetMaxDiskSpace;
  140. MD_SetMaxDiskSpaceP         MD_SetMaxDiskSpace;
  141. MD_GetMaxMessageCountP        MD_GetMaxMessageCount;
  142. MD_SetMaxMessageCountP        MD_SetMaxMessageCount;
  143. MD_GetForwardingInfoP        MD_GetForwardingInfo;
  144. MD_SetForwardingInfoP        MD_SetForwardingInfo;
  145. MD_GetAutoRespInfoP            MD_GetAutoRespInfo;
  146. MD_SetAutoRespInfoP            MD_SetAutoRespInfo;
  147. MD_RestrictInboundMailP        MD_RestrictInboundMail;
  148. MD_SetInboundMailRestrictionsP    MD_SetInboundMailRestrictions;
  149. MD_RestrictOutboundMailP    MD_RestrictOutboundMail;
  150. MD_SetOutboundMailRestrictionsP     MD_SetOutboundMailRestrictions;
  151. MD_GetCommentsP                MD_GetComments;
  152. MD_SetCommentsP                MD_SetComments;
  153. MD_EraseAutoRespP            MD_EraseAutoResp;
  154. MD_UpdateAutoRespDomainsP   MD_UpdateAutoRespDomains;
  155. MD_GetMailFormatP            MD_GetMailFormat;
  156. MD_SetMailFormatP            MD_SetMailFormat;
  157. MD_GetSignatureFileP        MD_GetSignatureFile;
  158. MD_SetSignatureFileP        MD_SetSignatureFile;
  159. MD_GetFileCountP            MD_GetFileCount;
  160. MD_GetDirSizeP                MD_GetDirSize;
  161. MD_GetPruningFlagsP            MD_GetPruningFlags;
  162. MD_SetPruningFlagsP            MD_SetPruningFlags;
  163. MD_GetUseDefaultPruningP    MD_GetUseDefaultPruning;
  164. MD_SetUseDefaultPruningP    MD_SetUseDefaultPruning;
  165. MD_GetWebConfigBitP         MD_GetWebConfigBit;
  166. MD_GetWebConfigBitsP        MD_GetWebConfigBits;
  167. MD_SetWebConfigBitP         MD_SetWebConfigBit;
  168. MD_SetWebConfigBitsP        MD_SetWebConfigBits;
  169. MD_IsDynamicPasswordStrP    MD_IsDynamicPasswordStr;
  170. MD_GetMaxUIDLCountP         MD_GetMaxUIDLCount;
  171. MD_SetMaxUIDLCountP         MD_SetMaxUIDLCount;
  172. MD_GetMaxMessageSizeP        MD_GetMaxMessageSize;
  173. MD_SetMaxMessageSizeP        MD_SetMaxMessageSize;
  174. MD_AddToLdapAddrBookP       MD_AddToLdapAddrBook;
  175. MD_DeleteFromLdapAddrBookP    MD_DeleteFromLdapAddrBook;
  176. MD_ChangeLdapAddrBookP        MD_ChangeLdapAddrBook;
  177.  
  178. MD_InitGatewayInfoP            MD_InitGatewayInfo;
  179. MD_VerifyGatewayInfoP        MD_VerifyGatewayInfo;
  180. MD_WriteGatewayP            MD_WriteGateway;
  181. MD_FreeGatewayP                MD_FreeGateway;
  182. MD_DeleteGatewayP            MD_DeleteGateway;
  183.  
  184. MD_IsAddressInWorldClientAddressBookP MD_IsAddressInWorldClientAddressBook;
  185.  
  186.  
  187. #define GET_FUNC(s) s## = (s##P) GetProcAddress(hMDUSER, #s); result &= (s## != NULL);
  188.  
  189. bool LoadMDUserDll(char* MDUserDll, bool LoadUsers, bool IgnoreFail, bool PopupErrors)
  190. {
  191.     int Num;
  192.     return LoadMDUserDll(Num, MDUserDll, LoadUsers, IgnoreFail, PopupErrors);
  193. }
  194.  
  195. bool LoadMDUserDll(int& Result, char* MDUserDll, bool LoadUsers, bool IgnoreFail, bool PopupErrors)
  196. {
  197.     Result = 0;
  198.     
  199.     if (MDUserDll == NULL)
  200.     {        
  201.         // Oh my gosh.    I had to change this at the last minute because this function
  202.         // was assuming that the DLL would always be in the same directory as the 
  203.         // program that was using it! (see above commented code).  This is often not
  204.         // the case (WebConfig, WorldClient, et.al.) - Arvel 04/03/01.
  205.  
  206.         char szWorkBuffer[MAX_PATH];
  207.         char szAppPath[MAX_PATH+1];
  208.  
  209.         // Don't add trialing backslashes to these reg key values because doing that
  210.         // breaks Windows 95.
  211.     #ifndef _EMAIL_GUARDIAN_
  212.         strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
  213.     #else
  214.         strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\EmailGuardian");
  215.     #endif
  216.  
  217.         if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
  218.         {
  219.             if (PopupErrors)
  220.             {
  221.                 char Message[256];
  222.                 sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
  223.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  224.             }
  225.             return false;
  226.         }
  227.         if (szAppPath[0] == '\0')
  228.         {
  229.             if (PopupErrors)
  230.             {
  231.                 char Message[256];
  232.                 sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
  233.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  234.             }
  235.         }
  236.  
  237.         char szIniPath[256];
  238.  
  239.         if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
  240.         {
  241.             if (PopupErrors)
  242.             {
  243.                 char Message[256];
  244.                 sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
  245.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  246.             }
  247.             return false;
  248.         }
  249.         
  250.         char szDllType[16];
  251.         GetPrivateProfileString("Advanced", "UserDllType", "", szDllType, sizeof(szDllType), szIniPath);
  252.         
  253.         char szDll[256];
  254.         sprintf(szDll, "%s\\MDUser%s.dll", szAppPath, szDllType);
  255.         
  256.         hMDUSER = LoadLibrary(szDll);
  257.     }
  258.     else
  259.         hMDUSER = LoadLibrary(MDUserDll);
  260.  
  261.     if (hMDUSER == NULL)
  262.     {
  263.         Result = GetLastError();
  264.         return false;
  265.     }
  266.  
  267.     bool result = true;
  268.  
  269. #ifndef _EMAIL_GUARDIAN_
  270.     GET_FUNC(MD_ClearSettingsCache);
  271.     GET_FUNC(MD_SetGhostCount);
  272.     GET_FUNC(MD_GetStringKey);
  273.     GET_FUNC(MD_SetStringKey);
  274.     GET_FUNC(MD_GetIntKey);
  275.     GET_FUNC(MD_SetIntKey);
  276.     GET_FUNC(MD_GetBoolKey);
  277.     GET_FUNC(MD_SetBoolKey);
  278.     GET_FUNC(MD_RenameSection);
  279.     GET_FUNC(MD_DeleteSection);
  280.     GET_FUNC(MD_DeleteKey);
  281.     GET_FUNC(MD_GetSectionNames);
  282. #endif
  283.     GET_FUNC(MD_FlagReloadUsers);
  284.     GET_FUNC(MD_CreateFileName);
  285.     GET_FUNC(MD_InitMessageInfo)
  286.     GET_FUNC(MD_GetSharedUserInfo)
  287.     GET_FUNC(MD_GetSharedListMemberInfo)
  288.     GET_FUNC(MD_VerifyMessageInfo)
  289.     GET_FUNC(MD_SpoolMessage)
  290.     GET_FUNC(MD_SendInstantMessage)
  291.     GET_FUNC(MD_GetDomainsGAB)
  292.     GET_FUNC(MD_GetDomainNames)
  293.     GET_FUNC(MD_GetDomainIP)
  294.     GET_FUNC(MD_GetDomainCount)
  295.     GET_FUNC(MD_GetDomainNameUsingIP)
  296.     GET_FUNC(MD_FilterString)
  297.     GET_FUNC(MD_FilterUserInfo)
  298.     GET_FUNC(MD_RegisterWindow)
  299.     GET_FUNC(MD_UnregisterWindow)
  300.     GET_FUNC(MD_SendAppMessage)
  301.     GET_FUNC(MD_ReloadUsers)
  302.     GET_FUNC(MD_GetAppDir)
  303.     GET_FUNC(MD_SetIsMDConfig)
  304.     GET_FUNC(MD_GetIsMDConfig)
  305.     GET_FUNC(MD_GetDBPath)
  306.     GET_FUNC(MD_IsAlreadyAQueue)
  307.     GET_FUNC(MD_AddToQueueList)
  308.     GET_FUNC(MD_RemoveFromQueueList)
  309.     GET_FUNC(MD_InitUserInfo)
  310.     GET_FUNC(MD_ImportUserInfo)
  311.     GET_FUNC(MD_ExportAllUsers)
  312.     GET_FUNC(MD_GetLicensesUsed)
  313.     GET_FUNC(MD_IsAVLicenseTooSmall)
  314.     GET_FUNC(MD_AddUser)
  315.     GET_FUNC(MD_ChangeUser)
  316.     GET_FUNC(MD_DeleteUser)
  317.     GET_FUNC(MD_VerifyUserInfo)
  318.     GET_FUNC(MD_UserCount)
  319.     GET_FUNC(MD_GetCalendarOnlyCount)
  320.     GET_FUNC(MD_IsProVersion)
  321.     GET_FUNC(MD_IsTrialVersion)
  322.     GET_FUNC(MD_GetPublicIMAPFolderAccess)
  323.     GET_FUNC(MD_IsSystemAddress)
  324.     GET_FUNC(MD_VerifyAccountDB)
  325.     GET_FUNC(MD_IsDBConnected)
  326.     GET_FUNC(MD_FindFirst)
  327.     GET_FUNC(MD_FindNext)
  328.     GET_FUNC(MD_FindClose)
  329.     GET_FUNC(MD_FindFirstRule)
  330.     GET_FUNC(MD_FindNextRule)
  331.     GET_FUNC(MD_GetEditIMAPRules)
  332.     GET_FUNC(MD_SetEditIMAPRules)
  333.     GET_FUNC(MD_ReadRule)
  334.     GET_FUNC(MD_MoveRuleUp)
  335.     GET_FUNC(MD_MoveRuleDown)
  336.     GET_FUNC(MD_RuleStringToRuleStruct)
  337.     GET_FUNC(MD_RuleStructToRuleString)
  338.     GET_FUNC(MD_AddRule)
  339.     GET_FUNC(MD_DeleteRule)
  340.     GET_FUNC(MD_ChangeRule)
  341.     GET_FUNC(MD_InitMultiPOPItem)
  342.     GET_FUNC(MD_AddMultiPOPItem)
  343.     GET_FUNC(MD_DeleteMultiPOPItem)
  344.     GET_FUNC(MD_GetMultiPOPItems)
  345.     GET_FUNC(MD_SetMultiPOPItems)
  346.     GET_FUNC(MD_DeleteAllAliases)
  347.     GET_FUNC(MD_CreateAlias)
  348.     GET_FUNC(MD_DeleteAlias)
  349.     GET_FUNC(MD_GetIMAPFolders)
  350.     GET_FUNC(MD_CreateIMAPFolder)
  351.     GET_FUNC(MD_ValidateUser)
  352.     GET_FUNC(MD_LogonUser)
  353.     GET_FUNC(MD_GetByAlias)
  354.     GET_FUNC(MD_UserExists)
  355.     GET_FUNC(MD_GetByEmail)
  356.     GET_FUNC(MD_GetByFullName)
  357.     GET_FUNC(MD_GetByMailbox)
  358.     GET_FUNC(MD_GetByMailDir)
  359.     GET_FUNC(MD_GetFree)
  360.     GET_FUNC(MD_GetUserInfo)
  361.     GET_FUNC(MD_SetUserInfo)
  362.     GET_FUNC(MD_GetEmail)
  363.     GET_FUNC(MD_GetMailbox)
  364.     GET_FUNC(MD_SetMailbox)
  365.     GET_FUNC(MD_GetDomain)
  366.     GET_FUNC(MD_SetDomain)
  367.     GET_FUNC(MD_GetFullName)
  368.     GET_FUNC(MD_SetFullName)
  369.     GET_FUNC(MD_GetMailDir)
  370.     GET_FUNC(MD_SetMailDir)
  371.     GET_FUNC(MD_GetPassword)
  372.     GET_FUNC(MD_SetPassword)
  373.     GET_FUNC(MD_GetAutoDecode)
  374.     GET_FUNC(MD_SetAutoDecode)
  375.     GET_FUNC(MD_GetIsForwarding)
  376.     GET_FUNC(MD_SetIsForwarding)
  377.     GET_FUNC(MD_GetAllowAccess)
  378.     GET_FUNC(MD_SetAllowAccess)
  379.     GET_FUNC(MD_GetAllowChangeViaEmail)
  380.     GET_FUNC(MD_SetAllowChangeViaEmail)
  381.     GET_FUNC(MD_GetKeepForwardedMail)
  382.     GET_FUNC(MD_SetKeepForwardedMail)
  383.     GET_FUNC(MD_GetHideFromEveryone)
  384.     GET_FUNC(MD_SetHideFromEveryone)
  385.     GET_FUNC(MD_GetEncryptMail)
  386.     GET_FUNC(MD_SetEncryptMail)
  387.     GET_FUNC(MD_GetApplyQuotas)
  388.     GET_FUNC(MD_SetApplyQuotas)
  389.     GET_FUNC(MD_GetEnableMultiPOP)
  390.     GET_FUNC(MD_SetEnableMultiPOP)
  391.     GET_FUNC(MD_GetCanModifyGAB)
  392.     GET_FUNC(MD_SetCanModifyGAB)
  393.     GET_FUNC(MD_GetIsCalendarOnly)
  394.     GET_FUNC(MD_SetIsCalendarOnly)
  395.     GET_FUNC(MD_GetMaxDiskSpace)
  396.     GET_FUNC(MD_SetMaxDiskSpace)
  397.     GET_FUNC(MD_GetMaxMessageCount)
  398.     GET_FUNC(MD_SetMaxMessageCount)
  399.     GET_FUNC(MD_GetForwardingInfo)
  400.     GET_FUNC(MD_SetForwardingInfo)
  401.     GET_FUNC(MD_GetAutoRespInfo)
  402.     GET_FUNC(MD_SetAutoRespInfo)
  403.     GET_FUNC(MD_RestrictInboundMail)
  404.     GET_FUNC(MD_SetInboundMailRestrictions)
  405.     GET_FUNC(MD_RestrictOutboundMail)
  406.     GET_FUNC(MD_SetOutboundMailRestrictions)
  407.     GET_FUNC(MD_GetComments)
  408.     GET_FUNC(MD_SetComments)
  409.     GET_FUNC(MD_EraseAutoResp)
  410.     GET_FUNC(MD_UpdateAutoRespDomains)
  411.     GET_FUNC(MD_GetMailFormat)
  412.     GET_FUNC(MD_SetMailFormat)
  413.     GET_FUNC(MD_GetSignatureFile)
  414.     GET_FUNC(MD_SetSignatureFile)
  415.     GET_FUNC(MD_GetFileCount)
  416.     GET_FUNC(MD_GetDirSize)
  417.     GET_FUNC(MD_GetPruningFlags)
  418.     GET_FUNC(MD_SetPruningFlags)
  419.     GET_FUNC(MD_GetUseDefaultPruning)
  420.     GET_FUNC(MD_SetUseDefaultPruning)
  421.     GET_FUNC(MD_GetWebConfigBit)
  422.     GET_FUNC(MD_GetWebConfigBits)
  423.     GET_FUNC(MD_SetWebConfigBit)
  424.     GET_FUNC(MD_SetWebConfigBits)
  425.     GET_FUNC(MD_IsDynamicPasswordStr)
  426.     GET_FUNC(MD_GetMaxUIDLCount)
  427.     GET_FUNC(MD_SetMaxUIDLCount)
  428.     GET_FUNC(MD_GetMaxMessageSize)
  429.     GET_FUNC(MD_SetMaxMessageSize)
  430.     GET_FUNC(MD_AddToLdapAddrBook)
  431.     GET_FUNC(MD_DeleteFromLdapAddrBook)
  432.     GET_FUNC(MD_ChangeLdapAddrBook)
  433.     GET_FUNC(MD_InitGatewayInfo)
  434.     GET_FUNC(MD_VerifyGatewayInfo)
  435.     GET_FUNC(MD_WriteGateway)
  436.     GET_FUNC(MD_FreeGateway)
  437.     GET_FUNC(MD_DeleteGateway)
  438.     GET_FUNC(MD_IsAddressInWorldClientAddressBook);
  439.  
  440.     if (!result)
  441.         result = IgnoreFail;
  442.  
  443.     if (!result)
  444.     {
  445.         FreeMDUserDll();
  446.         Result = 1;
  447.         return false;
  448.     }
  449.     else
  450.     {
  451.         MDUserDllLoaded = true;
  452.         if (LoadUsers)
  453.             MD_ReloadUsers();
  454.         return true;
  455.     }
  456. }
  457.  
  458. void FreeMDUserDll()
  459. {
  460.     MDUserDllLoaded = false;
  461.  
  462.     if (hMDUSER != NULL)
  463.         FreeLibrary(hMDUSER), hMDUSER = NULL;
  464. }
  465.  
  466. #endif  // MDUSER_DLL
  467.  
  468.  
  469. #ifndef MDLIST_DLL
  470. #include <stdio.h>
  471. #include "MDUserImports.h"
  472.  
  473. HINSTANCE hMDLIST = NULL;
  474. #define GET_FUNC2(s) s## = (s##P) GetProcAddress(hMDLIST, #s); result &= (s## != NULL);
  475.  
  476. MD_ClearListSettingsCacheP    MD_ClearListSettingsCache;
  477. MD_GetListStringKeyP        MD_GetListStringKey;
  478. MD_GetListLongKeyP            MD_GetListLongKey;
  479. MD_GetListBoolKeyP          MD_GetListBoolKey;
  480. MD_ListRemoveMemberP        MD_ListRemoveMember;
  481. MD_ListDefaultModeP            MD_ListDefaultMode;
  482. MD_ListAddMemberP            MD_ListAddMember;
  483. MD_ListWriteMemberP            MD_ListWriteMember;
  484. MD_ListSetRealNameP            MD_ListSetRealName;
  485. MD_ListSetDigestP            MD_ListSetDigest;
  486. MD_ListSetNomailP            MD_ListSetNomail;
  487. MD_ListSetReadOnlyP            MD_ListSetReadOnly;
  488. MD_ListSetNormalP            MD_ListSetNormal;
  489. MD_ListSuppressedP            MD_ListSuppressed;
  490. MD_ListRemoveFromAllP        MD_ListRemoveFromAll;
  491. MD_ListIsMemberP            MD_ListIsMember;
  492. MD_ListNotificationAddressP MD_ListNotificationAddress;
  493. MD_ListPrecedenceLevelP        MD_ListPrecedenceLevel;
  494. MD_ListInsertCaptionP        MD_ListInsertCaption;
  495. MD_ListMemberCountP            MD_ListMemberCount;
  496. MD_ListPasswordP            MD_ListPassword;
  497. MD_ListSubscribeNoteP        MD_ListSubscribeNote;
  498. MD_ListUnsubscribeNoteP        MD_ListUnsubscribeNote;
  499. MD_ListMsgTooBigNoteP        MD_ListMsgTooBigNote;
  500. MD_ListArchiveCatalogP        MD_ListArchiveCatalog;
  501. MD_ListDigestMBFP            MD_ListDigestMBF;
  502. MD_ListSendSubAuthP            MD_ListSendSubAuth;
  503. MD_ListSendUnSubAuthP        MD_ListSendUnSubAuth;
  504. MD_ListModeratedP            MD_ListModerated;
  505. MD_ListAllowSubscribeP        MD_ListAllowSubscribe;
  506. MD_ListDigestHourP            MD_ListDigestHour;
  507. MD_InitListInfoP            MD_InitListInfo;
  508. MD_VerifyListInfoP            MD_VerifyListInfo;
  509. MD_WriteListP                MD_WriteList;
  510. MD_DeleteListP                MD_DeleteList;
  511. MD_ListGetCountP            MD_ListGetCount;
  512. MD_ListGetNamesP            MD_ListGetNames;
  513. MD_ListExistsP                MD_ListExists;
  514. MD_ListUpdateDomainP        MD_ListUpdateDomain;
  515.  
  516. MD_FindFirstListMemberP        MD_FindFirstListMember;
  517. MD_FindNextListMemberP        MD_FindNextListMember;
  518. MD_FindCloseListMemberP        MD_FindCloseListMember;
  519. MD_GetListMemberP            MD_GetListMember;
  520.  
  521.  
  522. bool LoadMDListDll(char* MDListDll, bool IgnoreFail, bool PopupErrors)
  523. {
  524.     int Result;
  525.     return LoadMDListDll(Result, MDListDll, IgnoreFail, PopupErrors);
  526. }
  527.  
  528. bool LoadMDListDll(int &Result, char* MDListDll, bool IgnoreFail, bool PopupErrors)
  529. {
  530.     if (MDListDll == NULL)
  531.     {        
  532.         // Oh my gosh.    I had to change this at the last minute because this function
  533.         // was assuming that the DLL would always be in the same directory as the 
  534.         // program that was using it! (see above commented code).  This is often not
  535.         // the case (WebConfig, WorldClient, et.al.) - Arvel 04/03/01.
  536.         
  537.         char szWorkBuffer[MAX_PATH];
  538.         char szAppPath[MAX_PATH+1];
  539.  
  540.         // Don't add trialing backslashes to these reg key values because doing that
  541.         // breaks Windows 95.
  542.     #ifndef _EMAIL_GUARDIAN_
  543.         strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
  544.     #else
  545.         strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\EmailGuardian");
  546.     #endif
  547.  
  548.         if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
  549.         {
  550.             if (PopupErrors)
  551.             {
  552.                 char Message[256];
  553.                 sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
  554.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  555.             }
  556.             return false;
  557.         }
  558.         if (szAppPath[0] == '\0')
  559.         {
  560.             if (PopupErrors)
  561.             {
  562.                 char Message[256];
  563.                 sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
  564.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  565.             }
  566.         }
  567.  
  568.         char szIniPath[256];
  569.  
  570.         if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
  571.         {
  572.             if (PopupErrors)
  573.             {
  574.                 char Message[256];
  575.                 sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
  576.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  577.             }
  578.             return false;
  579.         }
  580.         
  581.         char szDllType[16];
  582.         GetPrivateProfileString("Advanced", "ListDllType", "", szDllType, sizeof(szDllType), szIniPath);
  583.         
  584.         char szDll[256];
  585.         sprintf(szDll, "%s\\MDList%s.dll", szAppPath, szDllType);
  586.  
  587.         hMDLIST = LoadLibrary(szDll);
  588.     }
  589.     else
  590.         hMDLIST = LoadLibrary(MDListDll);
  591.  
  592.     if (hMDLIST == NULL)
  593.     {
  594.         Result = GetLastError();
  595.         return false;
  596.     }
  597.  
  598.     bool result = true;
  599.  
  600.     GET_FUNC2(MD_ClearListSettingsCache)
  601.     GET_FUNC2(MD_GetListStringKey)
  602.     GET_FUNC2(MD_GetListLongKey)
  603.     GET_FUNC2(MD_GetListBoolKey)
  604.     GET_FUNC2(MD_ListRemoveMember)
  605.     GET_FUNC2(MD_ListDefaultMode)
  606.     GET_FUNC2(MD_ListAddMember)
  607.     GET_FUNC2(MD_ListWriteMember)
  608.     GET_FUNC2(MD_ListSetRealName)
  609.     GET_FUNC2(MD_ListSetDigest)
  610.     GET_FUNC2(MD_ListSetNomail)
  611.     GET_FUNC2(MD_ListSetReadOnly)
  612.     GET_FUNC2(MD_ListSetNormal)
  613.     GET_FUNC2(MD_ListSuppressed)
  614.     GET_FUNC2(MD_ListRemoveFromAll)
  615.     GET_FUNC2(MD_ListIsMember)
  616.     GET_FUNC2(MD_ListNotificationAddress)
  617.     GET_FUNC2(MD_ListPrecedenceLevel)
  618.     GET_FUNC2(MD_ListInsertCaption)
  619.     GET_FUNC2(MD_ListMemberCount)
  620.     GET_FUNC2(MD_ListPassword)
  621.     GET_FUNC2(MD_ListSubscribeNote)
  622.     GET_FUNC2(MD_ListUnsubscribeNote)
  623.     GET_FUNC2(MD_ListMsgTooBigNote)
  624.     GET_FUNC2(MD_ListArchiveCatalog)
  625.     GET_FUNC2(MD_ListDigestMBF)
  626.     GET_FUNC2(MD_ListSendSubAuth)
  627.     GET_FUNC2(MD_ListSendUnSubAuth)
  628.     GET_FUNC2(MD_ListModerated)    
  629.     GET_FUNC2(MD_ListAllowSubscribe)
  630.     GET_FUNC2(MD_ListDigestHour)
  631.     GET_FUNC2(MD_InitListInfo)
  632.     GET_FUNC2(MD_VerifyListInfo)
  633.     GET_FUNC2(MD_WriteList)
  634.     GET_FUNC2(MD_DeleteList)
  635.     GET_FUNC2(MD_FindFirstListMember)
  636.     GET_FUNC2(MD_FindNextListMember)
  637.     GET_FUNC2(MD_FindCloseListMember)
  638.     GET_FUNC2(MD_GetListMember)
  639.     GET_FUNC2(MD_ListGetCount)
  640.     GET_FUNC2(MD_ListGetNames)
  641.     GET_FUNC2(MD_ListExists)
  642.     GET_FUNC2(MD_ListUpdateDomain)
  643.  
  644.     if (!result)
  645.         result = IgnoreFail;
  646.  
  647.     if (!result)
  648.     {
  649.         FreeMDListDll();
  650.         Result = 1;
  651.         return false;
  652.     }
  653.     else
  654.     {
  655.         return true;
  656.     }
  657. }
  658.  
  659. void FreeMDListDll()
  660. {
  661.  
  662.     if (hMDLIST != NULL)
  663.         FreeLibrary(hMDLIST), hMDLIST = NULL;
  664. }
  665. #endif // MDLIST_DLL
  666.  
  667.  
  668.  
  669. #ifndef MDCALENDAR_DLL
  670.  
  671. HINSTANCE hMDCALENDAR = NULL;
  672. #define GET_FUNC3(s) s## = (s##P) GetProcAddress(hMDCALENDAR, #s); result &= (s## != NULL);
  673.  
  674. #ifndef _EMAIL_GUARDIAN_
  675.  
  676. /*****************************/
  677. /* Calendaring API functions */
  678. /*****************************/
  679.  
  680. MD_CalInitCalItemP                            MD_CalInitCalItem;
  681. MD_CalInitCalItem2P                            MD_CalInitCalItem2;
  682. MD_CalFreeCalItemP                            MD_CalFreeCalItem;
  683. MD_CalProcessICalendarFileP                    MD_CalProcessICalendarFile;
  684. MD_CalSendICalendarMessageP                    MD_CalSendICalendarMessage;
  685. MD_CalSendIMNotificationsP                    MD_CalSendIMNotifications;
  686. MD_CalGetCalItemP                            MD_CalGetCalItem;
  687. MD_CalGetMultipleCalItemsP                    MD_CalGetMultipleCalItems;
  688. MD_CalWriteCalItemP                            MD_CalWriteCalItem;
  689. MD_CalDeleteCalItemP                        MD_CalDeleteCalItem;
  690. MD_CalEventOverlapsP                        MD_CalEventOverlaps;
  691. MD_CalGetTodaysEventsP                        MD_CalGetTodaysEvents;
  692. MD_CalDayHasEventsP                            MD_CalDayHasEvents;
  693. MD_CalSetEventTextP                            MD_CalSetEventText;
  694. MD_CalAppendEventTextP                        MD_CalAppendEventText;
  695. MD_CalSetReminderTimeP                        MD_CalSetReminderTime;
  696. MD_CalDeleteReminderP                        MD_CalDeleteReminder;
  697. MD_CalSetMeetingPlannerP                    MD_CalSetMeetingPlanner;
  698. MD_CalSetEventCreatorP                        MD_CalSetEventCreator;
  699. MD_CalSetAccessToEventP                        MD_CalSetAccessToEvent;
  700. MD_CalGetAccessToEventP                        MD_CalGetAccessToEvent;
  701. MD_CalIsCalEnabledP                            MD_CalIsCalEnabled;
  702. MD_CalSetIsCalEnabledP                        MD_CalSetIsCalEnabled;
  703. MD_CalIsCalRestrictedP                        MD_CalIsCalRestricted;
  704. MD_CalSetIsCalRestrictedP                    MD_CalSetIsCalRestricted;
  705. MD_CalIsEventWithinConstraintsP                MD_CalIsEventWithinConstraints;
  706. MD_CalIsMeetingLocationFreeP                MD_CalIsMeetingLocationFree;
  707. MD_CalFindFirstFreeTimeBlockP                MD_CalFindFirstFreeTimeBlock;
  708. MD_CalScheduleMeetingP                        MD_CalScheduleMeeting;
  709. MD_CalPreProcessMeetingP                    MD_CalPreProcessMeeting;
  710. MD_CalGetGlobalMemoP                        MD_CalGetGlobalMemo;
  711. MD_CalSetGlobalMemoP                        MD_CalSetGlobalMemo;
  712. MD_CalDeleteGlobalMemoP                        MD_CalDeleteGlobalMemo;
  713. MD_CalCanSetGlobalMemoP                        MD_CalCanSetGlobalMemo;
  714. MD_CalCanSetPersonalMemoP                    MD_CalCanSetPersonalMemo;
  715. MD_CalSetGlobalMemoRightsP                    MD_CalSetGlobalMemoRights;
  716. MD_CalGetGlobalMemoDefaultsP                MD_CalGetGlobalMemoDefaults;
  717. MD_CalSetGlobalMemoDefaultsP                MD_CalSetGlobalMemoDefaults;
  718. MD_CalGetPersonalMemoP                        MD_CalGetPersonalMemo;
  719. MD_CalSetPersonalMemoP                        MD_CalSetPersonalMemo;
  720. MD_CalDeletePersonalMemoP                    MD_CalDeletePersonalMemo;
  721. MD_CalSetMeetingLocationP                    MD_CalSetMeetingLocation;
  722. MD_CalCreateMeetingLocationP                MD_CalCreateMeetingLocation;
  723. MD_CalDeleteMeetingLocationP                MD_CalDeleteMeetingLocation;
  724. MD_CalGetAllMeetingLocationsP                MD_CalGetAllMeetingLocations;
  725. MD_CalSetGlobalAccessPermissionP            MD_CalSetGlobalAccessPermission;
  726. MD_CalGetGlobalAccessPermissionP            MD_CalGetGlobalAccessPermission;
  727. MD_CalSetDefGlobalAccessPermissionP            MD_CalSetDefGlobalAccessPermission;
  728. MD_CalGetDefGlobalAccessPermissionP            MD_CalGetDefGlobalAccessPermission;
  729. MD_CalSetDefGlobalAccessPermissionListP        MD_CalSetDefGlobalAccessPermissionList;
  730. MD_CalGetGlobalAccessPermissionListP        MD_CalGetGlobalAccessPermissionList;
  731. MD_CalGetGlobalMemoPermissionListP            MD_CalGetGlobalMemoPermissionList;
  732. MD_CalSetGlobalMemoPermissionListP            MD_CalSetGlobalMemoPermissionList;
  733. MD_CalExportCalItemsP                        MD_CalExportCalItems;
  734. MD_CalImportCalItemsP                        MD_CalImportCalItems;
  735. MD_CalOpenFolderP                            MD_CalOpenFolder;
  736. MD_CalCloseFolderP                            MD_CalCloseFolder;
  737.  
  738. #endif  // _EMAIL_GUARDIAN_
  739.  
  740.  
  741. bool LoadMDCalendarDll(char* MDCalendarDll, bool IgnoreFail, bool PopupErrors)
  742. {
  743.     int Result;
  744.     return LoadMDCalendarDll(Result, MDCalendarDll, IgnoreFail, PopupErrors);
  745. }
  746.  
  747. bool LoadMDCalendarDll(int &Result, char* MDCalendarDll, bool IgnoreFail, bool PopupErrors)
  748. {
  749.     if (MDCalendarDll == NULL)
  750.     {        
  751.         // Oh my gosh.    I had to change this at the last minute because this function
  752.         // was assuming that the DLL would always be in the same directory as the 
  753.         // program that was using it! (see above commented code).  This is often not
  754.         // the case (WebConfig, WorldClient, et.al.) - Arvel 04/03/01.
  755.         
  756.         char szWorkBuffer[MAX_PATH];
  757.         char szAppPath[MAX_PATH+1];
  758.  
  759.         // Don't add trialing backslashes to these reg key values because doing that
  760.         // breaks Windows 95.
  761.     #ifndef _EMAIL_GUARDIAN_
  762.         strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
  763.     #else
  764.         strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\EmailGuardian");
  765.     #endif
  766.  
  767.         if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
  768.         {
  769.             if (PopupErrors)
  770.             {
  771.                 char Message[256];
  772.                 sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
  773.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  774.             }
  775.             return false;
  776.         }
  777.         if (szAppPath[0] == '\0')
  778.         {
  779.             if (PopupErrors)
  780.             {
  781.                 char Message[256];
  782.                 sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
  783.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  784.             }
  785.         }
  786.  
  787.         char szIniPath[256];
  788.  
  789.         if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
  790.         {
  791.             if (PopupErrors)
  792.             {
  793.                 char Message[256];
  794.                 sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
  795.                 ::MessageBox(0, Message, "Fatal Error", 0L);
  796.             }
  797.             return false;
  798.         }
  799.         
  800.         char szDllType[16];
  801.         GetPrivateProfileString("Advanced", "CalendarDllType", "", szDllType, sizeof(szDllType), szIniPath);
  802.         
  803.         char szDll[256];
  804.         sprintf(szDll, "%s\\MDCalendar%s.dll", szAppPath, szDllType);
  805.  
  806.         hMDCALENDAR = LoadLibrary(szDll);
  807.     }
  808.     else
  809.         hMDCALENDAR = LoadLibrary(MDCalendarDll);
  810.  
  811.     if (hMDCALENDAR == NULL)
  812.     {
  813.         Result = GetLastError();
  814.         return false;
  815.     }
  816.  
  817.     bool result = true;
  818.  
  819. #ifndef _EMAIL_GUARDIAN_
  820.     GET_FUNC3(MD_CalInitCalItem)
  821.     GET_FUNC3(MD_CalInitCalItem2)
  822.     GET_FUNC3(MD_CalFreeCalItem)
  823.     GET_FUNC3(MD_CalProcessICalendarFile)
  824.     GET_FUNC3(MD_CalSendICalendarMessage)
  825.     GET_FUNC3(MD_CalSendIMNotifications)
  826.     GET_FUNC3(MD_CalGetCalItem)
  827.     GET_FUNC3(MD_CalGetMultipleCalItems)
  828.     GET_FUNC3(MD_CalWriteCalItem)
  829.     GET_FUNC3(MD_CalDeleteCalItem)
  830.     GET_FUNC3(MD_CalEventOverlaps)
  831.     GET_FUNC3(MD_CalGetTodaysEvents)
  832.     GET_FUNC3(MD_CalDayHasEvents)
  833.     GET_FUNC3(MD_CalSetEventText)
  834.     GET_FUNC3(MD_CalAppendEventText)
  835.     GET_FUNC3(MD_CalSetReminderTime)
  836.     GET_FUNC3(MD_CalDeleteReminder)
  837.     GET_FUNC3(MD_CalSetMeetingPlanner)
  838.     GET_FUNC3(MD_CalSetEventCreator)
  839.     GET_FUNC3(MD_CalSetAccessToEvent)
  840.     GET_FUNC3(MD_CalGetAccessToEvent)
  841.     GET_FUNC3(MD_CalIsCalEnabled)
  842.     GET_FUNC3(MD_CalSetIsCalEnabled)
  843.     GET_FUNC3(MD_CalIsCalRestricted)
  844.     GET_FUNC3(MD_CalSetIsCalRestricted)
  845.     GET_FUNC3(MD_CalIsEventWithinConstraints)
  846.     GET_FUNC3(MD_CalIsMeetingLocationFree)
  847.     GET_FUNC3(MD_CalFindFirstFreeTimeBlock)
  848.     GET_FUNC3(MD_CalScheduleMeeting)
  849.     GET_FUNC3(MD_CalPreProcessMeeting)
  850.     GET_FUNC3(MD_CalGetGlobalMemo)
  851.     GET_FUNC3(MD_CalSetGlobalMemo)
  852.     GET_FUNC3(MD_CalDeleteGlobalMemo)
  853.     GET_FUNC3(MD_CalCanSetGlobalMemo)
  854.     GET_FUNC3(MD_CalCanSetPersonalMemo)
  855.     GET_FUNC3(MD_CalSetGlobalMemoRights)
  856.     GET_FUNC3(MD_CalGetGlobalMemoDefaults)
  857.     GET_FUNC3(MD_CalSetGlobalMemoDefaults)
  858.     GET_FUNC3(MD_CalGetPersonalMemo)
  859.     GET_FUNC3(MD_CalSetPersonalMemo)
  860.     GET_FUNC3(MD_CalDeletePersonalMemo)
  861.     GET_FUNC3(MD_CalSetMeetingLocation)
  862.     GET_FUNC3(MD_CalCreateMeetingLocation)
  863.     GET_FUNC3(MD_CalDeleteMeetingLocation)
  864.     GET_FUNC3(MD_CalGetAllMeetingLocations)
  865.     GET_FUNC3(MD_CalSetGlobalAccessPermission)
  866.     GET_FUNC3(MD_CalGetGlobalAccessPermission)
  867.     GET_FUNC3(MD_CalSetDefGlobalAccessPermission)
  868.     GET_FUNC3(MD_CalGetDefGlobalAccessPermission)
  869.     GET_FUNC3(MD_CalSetDefGlobalAccessPermissionList)
  870.     GET_FUNC3(MD_CalGetGlobalAccessPermissionList)
  871.     GET_FUNC3(MD_CalGetGlobalMemoPermissionList)
  872.     GET_FUNC3(MD_CalSetGlobalMemoPermissionList)
  873.     GET_FUNC3(MD_CalExportCalItems)
  874.     GET_FUNC3(MD_CalImportCalItems)
  875.     GET_FUNC3(MD_CalOpenFolder)
  876.     GET_FUNC3(MD_CalCloseFolder)
  877. #endif
  878.  
  879.     if (!result)
  880.         result = IgnoreFail;
  881.  
  882.     if (!result)
  883.     {
  884.         FreeMDCalendarDll();
  885.         Result = 1;
  886.         return false;
  887.     }
  888.     else
  889.     {
  890.         return true;
  891.     }
  892. }
  893.  
  894. void FreeMDCalendarDll()
  895. {
  896.  
  897.     if (hMDCALENDAR != NULL)
  898.         FreeLibrary(hMDCALENDAR), hMDCALENDAR = NULL;
  899. }
  900. #endif // MDCALENDAR_DLL
  901.  
  902.  
  903. int GetAppPath(const char* pszKey, char* pszBuffer)
  904. {
  905.     int nResult = ERROR_SUCCESS;
  906.  
  907.     pszBuffer[0] = '\0';
  908.  
  909.     
  910.     HKEY hKey;
  911.     nResult = (int)RegOpenKeyEx(HKEY_LOCAL_MACHINE, pszKey, 0, KEY_QUERY_VALUE, &hKey);
  912.     if (nResult == ERROR_SUCCESS)
  913.     {
  914.         unsigned long uSize = 254;
  915.         nResult =  (int)RegQueryValueEx(hKey, "AppPath", NULL, NULL, (unsigned char*)pszBuffer, &uSize);
  916.         RegCloseKey(hKey);
  917.     }
  918.     
  919.     return nResult;
  920. }
  921.  
  922. int GetIniPath(const char* pszKey, char* pszBuffer)
  923. {
  924.     int nResult = ERROR_SUCCESS;
  925.  
  926.     pszBuffer[0] = '\0';
  927.  
  928.     
  929.     HKEY hKey;
  930.     nResult = (int)RegOpenKeyEx(HKEY_LOCAL_MACHINE, pszKey, 0, KEY_QUERY_VALUE, &hKey);
  931.     if (nResult == ERROR_SUCCESS)
  932.     {
  933.         unsigned long uSize = 254;
  934.         nResult =  (int)RegQueryValueEx(hKey, "IniPath", NULL, NULL, (unsigned char*)pszBuffer, &uSize);
  935.         RegCloseKey(hKey);
  936.     }
  937.     
  938.     return nResult;
  939.  
  940. }
  941.  
  942.  
  943.