home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / tssutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  10.1 KB  |  269 lines

  1. #ifndef TSSUTIL_H
  2. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  3. #define TSSUTIL_H
  4.  
  5. #include <bpcreg.h>
  6.  
  7. #if defined(_AFX)
  8. #include <afxpriv.h>
  9. // build a class to override the standard GUID in basetyps.h
  10. // in order to put them into STL containers and dump them to mfc dumpcontexts.
  11. class GUID2 : public GUID {
  12. public:
  13.         inline GUID2() {}
  14.         inline GUID2(const GUID2 &g) {
  15.             ASSERT(sizeof(*this) == sizeof(g));
  16.             memcpy(this, &g, sizeof(*this));
  17.         }
  18.         inline GUID2(const struct _GUID &g) {
  19.             ASSERT(sizeof(*this) == sizeof(g));
  20.             memcpy(this, &g, sizeof(*this));
  21.         }
  22.         inline GUID2(const struct _GUID *g) {
  23.             ASSERT(sizeof(*this) == sizeof(*g));
  24.             memcpy(this, g, sizeof(*this));
  25.         }
  26.         GUID2 & operator=(const GUID2 &g) {
  27.             if (&g != this) {
  28.                 ASSERT(sizeof(*this) == sizeof(struct _GUID));
  29.                 memcpy(this, &g, sizeof(*this));
  30.             }
  31.             return *this;
  32.         }
  33.         GUID2 & operator=(const struct _GUID &g) {
  34.             if (&g != this) {
  35.                 ASSERT(sizeof(*this) == sizeof(g));
  36.                 memcpy(this, &g, sizeof(*this));
  37.             }
  38.             return *this;
  39.         }
  40.         void inline Dump(CDumpContext &dc) const {
  41.             OLECHAR guidstr[64];
  42.             int rc = StringFromGUID2(*this, guidstr, sizeof(guidstr));
  43.             ASSERT(rc);
  44.             USES_CONVERSION;
  45.             dc << OLE2T(guidstr);
  46.             return;
  47.         }
  48.         bool inline operator<(const GUID2 &op2) const {
  49.             if (memcmp(this, &op2, sizeof(GUID2)) < 0) {
  50.                     return true;
  51.             }
  52.             return false;
  53.         }
  54.         bool inline operator>(const GUID2 &op2) const {
  55.             if (memcmp(this, &op2, sizeof(GUID2)) > 0) {
  56.                     return true;
  57.             }
  58.             return false;
  59.         }
  60.         bool inline operator==(const GUID2 &op2) const {
  61.             if (!memcmp(this, &op2, sizeof(GUID2))) {
  62.                     return true;
  63.             }
  64.             return false;
  65.         }
  66.         bool inline operator!=(const GUID2 &op2) const {
  67.             if (memcmp(this, &op2, sizeof(GUID2))) {
  68.                     return true;
  69.             }
  70.             return false;
  71.         }
  72.         bool inline operator<(const GUID &op2) const {
  73.             if (memcmp(this, &op2, sizeof(GUID)) < 0) {
  74.                     return true;
  75.             }
  76.             return false;
  77.         }
  78.         bool inline operator>(const GUID &op2) const {
  79.             if (memcmp(this, &op2, sizeof(GUID)) > 0) {
  80.                     return true;
  81.             }
  82.             return false;
  83.         }
  84.         bool inline operator==(const GUID &op2) const {
  85.             if (!memcmp(this, &op2, sizeof(GUID))) {
  86.                     return true;
  87.             }
  88.             return false;
  89.         }
  90.         bool inline operator!=(const GUID &op2) const {
  91.             if (memcmp(this, &op2, sizeof(GUID))) {
  92.                     return true;
  93.             }
  94.             return false;
  95.         }
  96.  
  97. };
  98.  
  99. inline CDumpContext &operator<<(CDumpContext &dc, const GUID2 &g)
  100. {
  101.     g.Dump(dc);
  102.     return dc;
  103. }
  104.  
  105. inline CDumpContext &operator<<(CDumpContext &dc, const GUID &g)
  106. {
  107.     GUID2 g2(g);
  108.     g2.Dump(dc);
  109.     return dc;
  110. }
  111.  
  112. class CTuningSpaceInfo {
  113.     inline void copy(CTuningSpaceInfo &lhs, const CTuningSpaceInfo &rhs) {
  114.         ASSERT(&rhs != &lhs);
  115.         lhs.m_lTS = rhs.m_lTS;
  116.         lhs.m_csName = rhs.m_csName;
  117.         lhs.m_csDesc = rhs.m_csDesc;
  118.         lhs.m_FilterClass = rhs.m_FilterClass;
  119.         lhs.m_FilterCategory = rhs.m_FilterCategory;
  120.         lhs.m_csFilterName = rhs.m_csFilterName;
  121.         lhs.m_dwInputType = rhs.m_dwInputType;
  122.     }
  123. public:
  124.     long m_lTS;
  125.     CString m_csName;
  126.     CString m_csDesc;
  127.     CLSID m_FilterClass;
  128.     CLSID m_FilterCategory;
  129.     CString m_csFilterName;
  130.     DWORD m_dwInputType;
  131.  
  132.     CTuningSpaceInfo() {}
  133.     CTuningSpaceInfo(long lTS) : m_lTS(lTS) {}
  134.     inline CTuningSpaceInfo(const CTuningSpaceInfo &tsi) { copy(*this, tsi); }
  135.     inline CTuningSpaceInfo &operator=(const CTuningSpaceInfo &rhs) {
  136.         if (&rhs != this) {
  137.             copy(*this, rhs);
  138.         }
  139.         return *this;
  140.     }
  141. };
  142.  
  143. inline CDumpContext& operator<<(CDumpContext &d, const CTuningSpaceInfo&tsi) {
  144.     d << "Tuning Space = " << tsi.m_lTS << ":\r\n";
  145.     d << "\tName = " << tsi.m_csName << "\r\n";
  146.     d << "\tDesc = " << tsi.m_csName << "\r\n"; 
  147.     d << "\tFilter Class = " << static_cast<GUID2>(tsi.m_FilterClass) << "\r\n";
  148.     d << "\tFilter Category = " << static_cast<GUID2>(tsi.m_FilterCategory) << "\r\n";
  149.     d << "\tFilter Name = " << tsi.m_csFilterName << "\r\n";
  150.     d << "\tInput Type = " << tsi.m_dwInputType << "\r\n";
  151.     return d;
  152. }
  153.  
  154. #endif
  155.  
  156. const int g_nMaxNameLen = 64;
  157.  
  158. extern const LPCTSTR g_strRestrictSuffix;
  159.  
  160. extern const LPCTSTR g_strAdultsGrp;
  161. extern const LPCTSTR g_strUsersGrp;
  162. extern const LPCTSTR g_strGuestAccountName;
  163. extern const LPCTSTR g_strRestrictQueryOwner;
  164. extern const LPCTSTR g_strRestrictQueryBase;
  165. extern const LPCTSTR g_strQueryBase;
  166.  
  167.  
  168. #ifdef _AFX
  169. CString TSS_RestrictionQueryName(LPCTSTR UserName);
  170. #endif
  171. void TSS_RestrictionQueryName(LPCTSTR UserName, TCHAR sz[g_nMaxNameLen]);
  172.  
  173. bool TSS_QuitDuringInstall(VOID);
  174.  
  175. #ifdef _AFX
  176. CString TSS_GetProductDir();
  177. #endif
  178. void TSS_GetProductDir(TCHAR sz[MAX_PATH]);
  179.  
  180. #ifdef _AFX
  181. CString TSS_GetSystemFile();
  182. #endif
  183. void TSS_GetSystemFile(TCHAR sz[MAX_PATH]);
  184.  
  185. #ifdef _AFX
  186. CString TSS_GetDatabaseFile();
  187. CString TSS_GetDatabaseReplacementFile(VOID);
  188. CString TSS_GetEPGDatabaseFile();
  189. CString TSS_GetAMFilter();
  190. void TSS_GetDefaultVBITuning(long &lTS, long &lChan);
  191. BOOL TSS_GetTuningSpaceInfoEx(class CTuningSpaceInfo &tsi);
  192. void TSS_GetLoaderName(const CString &csGuid, CString &csLoaderName);
  193. long TSS_FindSType(ULONG ulTuningSpace, BYTE ubLCID);
  194. void TSS_MkDeviceName(ULONG ulVendorId, ULONG ulDeviceId, CString &Name);
  195. HRESULT TSS_FindProvider(ULONG ulVendorId, ULONG ulDeviceId, CString &csProviderDll, CString &csProviderDesc);
  196. void TSS_GetAudioPin(LPTSTR *szPinName);
  197. void TSS_SetAudioPin(LPCTSTR szPinName);
  198. #endif
  199. BOOL TSS_GetTuningSpaceInfo(const long lTS, CLSID &cid, DWORD &dwInputType);
  200. const DWORD DEFVOL = 5000;
  201. const DWORD DEFBAL = 0;
  202.  
  203. void TSS_GetAudio(LPCTSTR szDevName, DWORD &Vol, DWORD &Bal);
  204. void TSS_SetAudio(LPCTSTR szDevName, DWORD Vol, DWORD Bal);
  205.  
  206. DWORD TSS_GetCountryCode(void);
  207. // get tuning space number from active movie filter class id
  208. BOOLEAN TSS_GetAMFilter(TCHAR sz[MAX_PATH]);
  209. void TSS_GetDatabaseFile(TCHAR sz[MAX_PATH]);
  210. BOOL TSS_GetDatabaseReplacementFile(TCHAR sz[MAX_PATH]);
  211. void TSS_GetEPGDatabaseFile(TCHAR sz[MAX_PATH]);
  212. BOOLEAN TSS_GetLoaderName(LPCTSTR szGuid, LPTSTR szLoaderName, DWORD &dwSize);
  213. BOOLEAN TSS_GetTuningIDs(LPCTSTR szGuid, DWORD *dwTuningID, DWORD &dwBytes);
  214. BOOLEAN TSS_GetTuningIDsAnalogCheck(LPCTSTR szGuid, DWORD *dwTuningID, DWORD &dwBytes);
  215. BOOLEAN TSS_SetAMFilter(TCHAR sz[MAX_PATH]);
  216. BOOLEAN TSS_SetLoaderAttempt(LPCTSTR szGuid);
  217. BOOLEAN TSS_SetLoaderCompletion(LPCTSTR szGuid, DWORD dwResult);
  218. // global
  219. BOOLEAN TSS_GetLoaderAttempt(LPTSTR szGuid, DWORD *pcbLen, SYSTEMTIME *pstTime);
  220. BOOLEAN TSS_GetLoaderCompletion(LPTSTR szGuid, DWORD *pcbLen, SYSTEMTIME *pstTime, DWORD *pdwResult);
  221. // specific loader
  222. BOOLEAN TSS_GetLoaderAttempt(LPCTSTR szGuid, SYSTEMTIME *pstTime);
  223. BOOLEAN TSS_GetLoaderCompletion(LPCTSTR szGuid, SYSTEMTIME *pstTime, DWORD *pdwResult);
  224. BOOLEAN TSS_GetDTVLoaderCSSByte(LPCTSTR szGuid, BYTE *pbCSSByte);
  225. BOOLEAN TSS_SetDTVLoaderCSSByte(LPCTSTR szGuid, BYTE *pbCSSByte);
  226. BOOLEAN TSS_GetLoaderReadPrefix(LPCTSTR szGuid, LPTSTR szPrefix, DWORD &dwSize);
  227. BOOLEAN TSS_GetLoaderWritePrefix(LPCTSTR szGuid, LPTSTR szPrefix, DWORD &dwSize);
  228. BOOLEAN TSS_GetLoaderReadFile(LPCTSTR szGuid, LPTSTR szReadFile, DWORD dwSize);
  229. BOOLEAN TSS_SetLoaderReadFile(LPCTSTR szGuid, LPTSTR szReadFile);
  230. BOOLEAN TSS_GetSSLoaderRegionID(LPCTSTR szGuid, DWORD *pdwRegion);
  231. BOOLEAN TSS_SetSSLoaderRegionID(LPCTSTR szGuid, DWORD dwRegion);
  232. BOOLEAN TSS_GetSSLoaderPreviousRegionID(LPCTSTR szGuid, DWORD *pdwPreviousRegion);
  233. BOOLEAN TSS_SetSSLoaderPreviousRegionID(LPCTSTR szGuid, DWORD dwPreviousRegion);
  234. BOOLEAN TSS_GetSSLoaderRegionIDValid(LPCTSTR szGuid, BOOL *pfRegionIDValid);
  235. BOOLEAN TSS_SetSSLoaderRegionIDValid(LPCTSTR szGuid, BOOL fRegionIDValid);
  236. BOOLEAN TSS_GetSSLoaderScanReturnCode(LPCTSTR szGuid, DWORD *pdwScanReturnCode);
  237. BOOLEAN TSS_SetSSLoaderScanReturnCode(LPCTSTR szGuid, DWORD dwScanReturnCode);
  238. BOOLEAN TSS_GetSSLoaderChannel(LPCTSTR szGuid, DWORD *pdwChannel);
  239. BOOLEAN TSS_SetSSLoaderChannel(LPCTSTR szGuid, DWORD dwChannel);
  240. BOOLEAN TSS_GetSSLoaderLine(LPCTSTR szGuid, DWORD *pdwLine);
  241. BOOLEAN TSS_SetSSLoaderLine(LPCTSTR szGuid, DWORD dwLine);
  242. BOOLEAN TSS_GetLoaderPostalCode(LPTSTR szPostalCode, DWORD cb);
  243. BOOLEAN TSS_SetLoaderPostalCode(LPCTSTR szPostalCode);
  244. BOOLEAN TSS_GetSSLoaderListenReturnCode(LPCTSTR szGuid, DWORD *pdwListenReturnCode);
  245. BOOLEAN TSS_SetSSLoaderListenReturnCode(LPCTSTR szGuid, DWORD dwListenReturnCode);
  246. BOOLEAN TSS_GetSSLoaderListenReturnCodeCount(LPCTSTR szGuid, DWORD *pdwListenReturnCodeCount);
  247. BOOLEAN TSS_SetSSLoaderListenReturnCodeCount(LPCTSTR szGuid, DWORD dwListenReturnCodeCount);
  248. BOOLEAN TSS_GetLoaderLastCompactSize(DWORD *pdwLastCompactSize);
  249. BOOLEAN TSS_SetLoaderLastCompactSize(DWORD dwLastCompactSize);
  250.  
  251. void TSS_ThrowOleDispatchException(SCODE sc, LPCTSTR lpszDescription = NULL, UINT nHelpID = 0, WORD wCode = 0, LPCTSTR szHelpFile = NULL, LPCTSTR szSource = NULL);
  252. void TSS_ThrowOleDispatchException(SCODE sc, UINT nDescriptionID = 0, UINT nHelpID = 0, WORD wCode = 0, LPCTSTR szHelpFile = NULL, LPCTSTR szSource = NULL);
  253. void TSS_ThrowOleDispatchException(LPEXCEPINFO pInfo);
  254.  
  255. void TSS_BracketizeTableOrQuery(TCHAR sz[g_nMaxNameLen]);
  256.  
  257. BOOL TSS_IsValidUserName(LPCTSTR szUserName);
  258.  
  259. #if defined(_AFX) && defined(__AFXDAO_H)
  260. void ThrowDispatchExceptFromDaoExcept(CDaoException *e);
  261. #endif
  262.  
  263. #if defined(_DEBUG) && defined(_AFX)
  264. void TSS_GetTraceLevel(int iAppNameSID, DWORD &dwTraceLevel);
  265. #endif
  266.  
  267. #pragma option pop /*P_O_Pop*/
  268. #endif // TSSUTIL_H
  269.