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.

182 lines
5.8 KiB

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