Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
6.9 KiB

  1. #ifndef _PHBK
  2. #define _PHBK
  3. #include "ccsv.h"
  4. #include "debug.h"
  5. #include "icwsupport.h"
  6. #ifdef WIN16
  7. #include <malloc.h>
  8. #define DllExportH extern "C" HRESULT WINAPI __export
  9. #else
  10. #define DllExportH extern "C" HRESULT WINAPI __stdcall
  11. //#define DllExportH extern "C" __declspec(dllexport) HRESULT WINAPI
  12. #endif
  13. #define MsgBox(m,s) MessageBox(GetSz(m),GetSz(IDS_TITLE),s)
  14. #define cbAreaCode 6 // maximum number of characters in an area code, not including \0
  15. #define cbCity 19 // maximum number of chars in city name, not including \0
  16. #define cbAccessNumber 15 // maximum number of chars in phone number, not including \0
  17. #define cbStateName 31 // maximum number of chars in state name, not including \0
  18. // check this against state.pbk delivered by mktg
  19. #define cbBaudRate 6 // maximum number of chars in a baud rate, not including \0
  20. #if defined(WIN16)
  21. #define cbDataCenter 12 // max length of data center string
  22. #else
  23. #define cbDataCenter (MAX_PATH+1) // max length of data center string
  24. #endif
  25. #define NO_AREA_CODE 0xFFFFFFFF
  26. #define PHONE_ENTRY_ALLOC_SIZE 500
  27. #define INF_SUFFIX TEXT(".ISP")
  28. #define INF_APP_NAME TEXT("ISP INFO")
  29. #define INF_PHONE_BOOK TEXT("PhoneBookFile")
  30. #define INF_DEFAULT TEXT("SPAM SPAM SPAM SPAM SPAM SPAM EGGS AND SPAM")
  31. #define STATE_FILENAME TEXT("STATE.ICW")
  32. #define FILE_NAME_800950 TEXT("800950.DAT")
  33. #define TEMP_BUFFER_LENGTH 1024
  34. #define MAX_INFCODE 9
  35. #define TYPE_SIGNUP_TOLLFREE 0x83
  36. #define TYPE_SIGNUP_TOLL 0x82
  37. #define TYPE_REGULAR_USAGE 0x42
  38. #define MASK_SIGNUP_TOLLFREE 0xB3
  39. #define MASK_SIGNUP_TOLL 0xB3
  40. #define MASK_REGULAR_USAGE 0x73
  41. // 8/13/96 jmazner for Normandy bug #4597
  42. // ported from core\client\phbk 10/15/96
  43. #define MASK_TOLLFREE_BIT 0x01 // Bit #1: 1=tollfree, 0=charge
  44. #define TYPE_SET_TOLLFREE 0x01 // usage: type |= TYPE_SET_TOLLFREE
  45. // want TYPE_SET_TOLL to be a DWORD to match pSuggestInfo->fType
  46. #define TYPE_SET_TOLL ~((DWORD)TYPE_SET_TOLLFREE) // usage: type &= TYPE_SET_TOLL
  47. #define MASK_ISDN_BIT 0x04 // Bit #3: 1=ISDN, 0=Non-ISDN
  48. #define MASK_ANALOG_BIT 0x08 // Bit #4: 1=Analog, 0=Non-Analog
  49. #define clineMaxATT 16
  50. #define NXXMin 200
  51. #define NXXMax 999
  52. #define cbgrbitNXX ((NXXMax + 1 - NXXMin) / 8)
  53. // Phone number select dialog flags
  54. //
  55. #define FREETEXT_SELECTION_METHOD 0x00000001
  56. #define PHONELIST_SELECTION_METHOD 0x00000002
  57. #define AUTODIAL_IN_PROGRESS 0x00000004
  58. #define DIALERR_IN_PROGRESS 0x00000008
  59. // Phone number type
  60. //
  61. #define ANALOG_TYPE 0
  62. #define ISDN_TYPE 1
  63. #define BOTH_ISDN_ANALOG 2
  64. typedef struct
  65. {
  66. DWORD dwIndex; // index number
  67. BYTE bFlipFactor; // for auto-pick
  68. DWORD fType; // phone number type
  69. WORD wStateID; // state ID
  70. DWORD dwCountryID; // TAPI country ID
  71. DWORD dwAreaCode; // area code or NO_AREA_CODE if none
  72. DWORD dwConnectSpeedMin; // minimum baud rate
  73. DWORD dwConnectSpeedMax; // maximum baud rate
  74. TCHAR szCity[cbCity + sizeof('\0')]; // city name
  75. TCHAR szAccessNumber[cbAccessNumber + sizeof('\0')]; // access number
  76. TCHAR szDataCenter[cbDataCenter + sizeof('\0')]; // data center access string
  77. TCHAR szAreaCode[cbAreaCode + sizeof('\0')]; //Keep the actual area code string around.
  78. } ACCESSENTRY, far *PACCESSENTRY; // ae
  79. typedef struct {
  80. DWORD dwCountryID; // country ID that this state occurred in
  81. PACCESSENTRY paeFirst; // pointer to first access entry for this state
  82. TCHAR szStateName[cbStateName + sizeof('\0')]; // state name
  83. } STATE, far *LPSTATE;
  84. typedef struct tagIDLOOKUPELEMENT {
  85. DWORD dwID;
  86. LPLINECOUNTRYENTRY pLCE;
  87. PACCESSENTRY pFirstAE;
  88. } IDLOOKUPELEMENT, far *LPIDLOOKUPELEMENT;
  89. typedef struct tagCNTRYNAMELOOKUPELEMENT {
  90. LPTSTR psCountryName;
  91. DWORD dwNameSize;
  92. LPLINECOUNTRYENTRY pLCE;
  93. } CNTRYNAMELOOKUPELEMENT, far *LPCNTRYNAMELOOKUPELEMENT;
  94. typedef struct tagIDXLOOKUPELEMENT {
  95. DWORD dwIndex;
  96. PACCESSENTRY pAE;
  97. } IDXLOOKUPELEMENT,far *LPIDXLOOKUPELEMENT;
  98. typedef struct tagSUGGESTIONINFO
  99. {
  100. DWORD dwCountryID;
  101. DWORD wAreaCode;
  102. DWORD wExchange;
  103. WORD wNumber;
  104. DWORD fType; // 9/6/96 jmazner Normandy
  105. DWORD bMask; // make this struct look like the one in %msnroot%\core\client\phbk\phbk.h
  106. PACCESSENTRY *rgpAccessEntry;
  107. } SUGGESTINFO, far *PSUGGESTINFO;
  108. typedef struct tagNPABlock
  109. {
  110. WORD wAreaCode;
  111. BYTE grbitNXX [cbgrbitNXX];
  112. } NPABLOCK, far *LPNPABLOCK;
  113. class CPhoneBook
  114. {
  115. //friend HRESULT DllExport PhoneBookLoad(LPCTSTR pszISPCode, DWORD *pdwPhoneID);
  116. //friend class CDialog;
  117. // 1/9/96 jmazner Normandy #13185
  118. //friend class CAccessNumDlg;
  119. friend class CSelectNumDlg;
  120. public:
  121. void far * operator new( size_t cb ) { return GlobalAlloc(GPTR,cb); };
  122. void operator delete( void far * p ) {GlobalFree(p); };
  123. CPhoneBook();
  124. ~CPhoneBook();
  125. HRESULT Init(LPCTSTR pszISPCode);
  126. HRESULT Merge(LPCTSTR pszChangeFilename);
  127. HRESULT Suggest(PSUGGESTINFO pSuggest);
  128. HRESULT GetCanonical(PACCESSENTRY pAE, LPTSTR psOut);
  129. private:
  130. PACCESSENTRY m_rgPhoneBookEntry;
  131. HANDLE m_hPhoneBookEntry;
  132. DWORD m_cPhoneBookEntries;
  133. LPLINECOUNTRYENTRY m_rgLineCountryEntry;
  134. LPLINECOUNTRYLIST m_pLineCountryList;
  135. LPIDLOOKUPELEMENT m_rgIDLookUp;
  136. LPCNTRYNAMELOOKUPELEMENT m_rgNameLookUp;
  137. LPSTATE m_rgState;
  138. DWORD m_cStates;
  139. #if !defined(WIN16)
  140. BOOL m_bScriptingAvailable;
  141. #endif
  142. TCHAR m_szINFFile[MAX_PATH];
  143. TCHAR m_szINFCode[MAX_INFCODE];
  144. TCHAR m_szPhoneBook[MAX_PATH];
  145. BOOL ReadPhoneBookDW(DWORD far *pdw, CCSVFile far *pcCSVFile);
  146. BOOL ReadPhoneBookW(WORD far *pw, CCSVFile far *pcCSVFile);
  147. BOOL ReadPhoneBookSZ(LPTSTR psz, DWORD dwSize, CCSVFile far *pcCSVFile);
  148. BOOL ReadPhoneBookB(BYTE far *pb, CCSVFile far *pcCSVFile);
  149. HRESULT ReadOneLine(PACCESSENTRY pAccessEntry, CCSVFile far *pcCSVFile);
  150. BOOL FixUpFromRealloc(PACCESSENTRY paeOld, PACCESSENTRY paeNew);
  151. };
  152. #ifdef __cplusplus
  153. extern "C" {
  154. #endif
  155. extern HINSTANCE g_hInstDll; // instance for this DLL
  156. extern HWND g_hWndMain;
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #endif // _PHBK