diff --git a/docs/FilterData.txt b/docs/FilterData.txt deleted file mode 100644 index 71772609e..000000000 --- a/docs/FilterData.txt +++ /dev/null @@ -1,18 +0,0 @@ -0000 02 00 00 00|01 00 80 00 -DWORD: format version? | DWORD: merit -0008 01 00 00 00|00 00 00 00 -DWORD: pin count | DWORD: ? -0010 3n|70 69|33|xx|00 00 00 -BYTE: 0x30+n, pin idx | WORD: 70 69, "pi" | BYTE: 0x33 (always?) | BYTE: (bit flags) 0 input, 8 output, 2 rendered, 1 allow none (unconfirmed), 4 allow many -0018 00 00 00 00|02 00 00 00 -DWORD: 0 | DWORD: type count -0020 00 00 00 00 00 00 00 00 -QWORD: 0 -0028 3n|74 79|33|00 00 00 00 -BYTE: 0x30+n, type idx | WORD: 74 79, "ty" | BYTE: 0x33 (always?) | DWORD: 0 -0030 38 00 00 00|48 00 00 00 -DWORD: major type offset | DWORD: subtype offset -0038 major type GUID ... -0040 ... major type GUID -0048 sub type GUID ... -0050 ... sub type GUID diff --git a/docs/todo/dvobsub.txt b/docs/todo/dvobsub.txt deleted file mode 100644 index db24bea22..000000000 --- a/docs/todo/dvobsub.txt +++ /dev/null @@ -1,5 +0,0 @@ -* stop sending ec_ole_event for external subs -* special sub file for redirecting to others, make it the only choice for web -* fix pitch probs with 180x... divx clip -- dragndrop subs to tray icon if possible -+ allow wildcards in search path, e.g. .\default.*.srt diff --git a/docs/todo/mpc.txt b/docs/todo/mpc.txt deleted file mode 100644 index 3f878e7db..000000000 --- a/docs/todo/mpc.txt +++ /dev/null @@ -1,71 +0,0 @@ -* accel table -* menu width -* new font chooser -* fix bbb.rm -* add cd/dvd loader to command line -* add functions for alt/ctrl/shift+wheel (alt:prev/next,ctrl:seekback/forw,shift:zoom in/out) -* shift+click seekbar seeks to keyframes -* save playlist -* enum audio outputs -* zoom presets -* toolbar presets -* dragndrop open video_ts.ifo as dvd -* also display frame size when displaying pannscan settings on status -* construct full path for playlist items -* menu/view/video frame/+50%,+200% -* open reg keys as readonly when possible for limited user accounts -* save capture bar/output to wav setting -* hide logo when going from one playlist item to another -* /add or /add /play to add to playlist -* vts*.ifo opening -* fullscreen resolution switch -* open whole dir with /cd too -* winlirc -* add more commands (e.g. dvd menu nav) and presets according to open *... modes -* add autolaunch handlers to reg -* open whole directory -* minimize to tray -* fix open dialog's filter -* avisynth's coinit workaround -* some mmx code in Rasterizer -* add secondary fullscreen to normal mode when resolution switching is enabled -* playlist/.. pos saving -* report media type when can't render pin -* calc autozoom window size incl.ing the sizing toolbars -* skip playlist items marked as invalid -* fix playlist playback order after dragndrop -* mark not openable files on the playlist (e.g. grayed out) after an error and do not open the again unless the user clicks them himself -* fix wm_appcommand for "usb soundcard speakers" -* menu/file/saveas... (cdda,cdxa,vts,other) -* dts reader reads ac3 too -* quicktime w/o activex -* audio switcher blocking OR returning error based on the stream -* offscreen rendering for quicktime -* remember last visited page in the options -* center window around the last center point when opening a new file with autozoom -* add dlg template to save subs in 8/16le/16be/utf8 encoding -* "ctrl+arrow" jump times in the options (for flash in frames), more levels, different commands for all of them -- activex -- seamless looping -- manually load filter when there are not rendered pins in the graph -- numpad +/- to ajdust audio timing -- open next/prev file in a directory when only one is on the playlist -+ right click menu on toolbars -+ tuner channel presets -+ rm/qt ripper -+ use playlist in dvd and capture mode -+ prebufferer reader filter -+ remember MRU sub/dub selection -+ open next file after "invalid" (done) and respect loop settings at the same time (not yet) -+ delete files from the playlist phisically (with yesno dialog) -* hook CreateFile to remove the share deny write flag with clsid_avidoc -+ hook dvd nav's reading and filter out all copy protection -* fix macrovision errors with the new detonators and the video renderers -+ replace the filters list box with treeview and list detailed info as the sub items -+ cue points, also modify the seekbar for it -+ make a subtitler filter for dvd subs and integrate it with the subtitle renderers -* search avi keyframes on a worker thread -+ auto-hide control bars in minimal mode -+ load winamp dsp plugins with the audio switcher -+ hook CreateFile and prebuffer files opened through (wireless) network using a worker thread for each. -+ "menu/play/goto last" AND/OR bookmarks to position only \ No newline at end of file diff --git a/docs/todo/vsfilter.txt b/docs/todo/vsfilter.txt deleted file mode 100644 index a07a87b24..000000000 --- a/docs/todo/vsfilter.txt +++ /dev/null @@ -1,2 +0,0 @@ -* special command for avisynth plugin to swap i420 and yv12 -* mod subpic to use bitsU/bitsV \ No newline at end of file diff --git a/docs/todo/vsrip.txt b/docs/todo/vsrip.txt deleted file mode 100644 index d3019e9e8..000000000 --- a/docs/todo/vsrip.txt +++ /dev/null @@ -1,2 +0,0 @@ -- detect menu vob or make it selectable -+ ALLVOBIDS \ No newline at end of file diff --git a/include/IBitRateInfo.h b/include/IBitRateInfo.h deleted file mode 100644 index d1eb116cd..000000000 --- a/include/IBitRateInfo.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -[uuid("EB2CD9E6-BA08-4acb-AA0F-3D8D0DD521CA")] -interface IBitRateInfo : public IUnknown -{ - STDMETHOD_(DWORD, GetCurrentBitRate) () = 0; - STDMETHOD_(DWORD, GetAverageBitRate) () = 0; -}; \ No newline at end of file diff --git a/include/IBufferInfo.h b/include/IBufferInfo.h deleted file mode 100644 index da72c1cca..000000000 --- a/include/IBufferInfo.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -[uuid("46070104-1318-4A82-8822-E99AB7CD15C1")] -interface IBufferInfo : public IUnknown -{ - STDMETHOD_(int, GetCount()) = 0; - STDMETHOD(GetStatus(int i, int& samples, int& size)) = 0; - STDMETHOD_(DWORD, GetPriority()) = 0; -}; \ No newline at end of file diff --git a/include/IChapterInfo.h b/include/IChapterInfo.h deleted file mode 100644 index 3cd126116..000000000 --- a/include/IChapterInfo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * Note: This interface was defined for the matroska container format - * originally, but can be implemented for other formats as well. - * - */ - -#pragma once - -typedef enum ChapterType { - AtomicChapter = 0, // only contain one element - SubChapter = 1, // contain a list of elements -}; - -#pragma pack(push, 1) -struct ChapterElement { - WORD Size; // size of this structure - BYTE Type; // see ChapterType - UINT ChapterId; // unique identifier for this element - REFERENCE_TIME rtStart; // REFERENCE_TIME in 100ns - REFERENCE_TIME rtStop; // REFERENCE_TIME in 100ns - struct ChapterElement() {Size = sizeof(*this);} -}; -struct ChapterElement2 : ChapterElement { - BOOL bDisabled; - struct ChapterElement2() {Size = sizeof(*this);} -}; -#pragma pack(pop) - -[uuid("8E128709-3DC8-4e49-B632-380FCF496B6D")] -interface IChapterInfo : public IUnknown -{ - #define CHAPTER_BAD_ID 0xFFFFFFFF - #define CHAPTER_ROOT_ID 0 - - // \param aChapterID is 0 for the top level one - STDMETHOD_(UINT, GetChapterCount) (UINT aChapterID) = 0; - - // \param aIndex start from 1 to GetChapterCount( aParentChapterId ) - STDMETHOD_(UINT, GetChapterId) (UINT aParentChapterId, UINT aIndex) = 0; - - STDMETHOD_(UINT, GetChapterCurrentId) () = 0; - - STDMETHOD_(BOOL, GetChapterInfo) (UINT aChapterID, struct ChapterElement* pStructureToFill) = 0; - - // \param PreferredLanguage Language code as in ISO-639-2 (3 chars) - // \param CountryCode Country code as in internet domains - STDMETHOD_(BSTR, GetChapterStringInfo) (UINT aChapterID, CHAR PreferredLanguage[3], CHAR CountryCode[2]) = 0; -}; \ No newline at end of file diff --git a/include/IKeyFrameInfo.h b/include/IKeyFrameInfo.h deleted file mode 100644 index fa40922f5..000000000 --- a/include/IKeyFrameInfo.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -[uuid("01A5BBD3-FE71-487C-A2EC-F585918A8724")] -interface IKeyFrameInfo : public IUnknown -{ - STDMETHOD (GetKeyFrameCount) (UINT& nKFs) = 0; // returns S_FALSE when every frame is a keyframe - STDMETHOD (GetKeyFrames) (const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs /* in, out*/) = 0; -}; \ No newline at end of file diff --git a/include/ITrackInfo.h b/include/ITrackInfo.h deleted file mode 100644 index 59310d032..000000000 --- a/include/ITrackInfo.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -typedef enum TrackType { - TypeVideo = 1, - TypeAudio = 2, - TypeComplex = 3, - TypeLogo = 0x10, - TypeSubtitle = 0x11, - TypeControl = 0x20 -}; - -#pragma pack(push, 1) - -struct TrackElement { - WORD Size; // Size of this structure - BYTE Type; // See TrackType - BOOL FlagDefault; // Set if the track is the default for its TrackType. - BOOL FlagLacing; // Set if the track may contain blocks using lacing. - UINT MinCache; // The minimum number of frames a player should be able to cache during playback. - UINT MaxCache; // The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. - CHAR Language[4]; // Specifies the language of the track, in the ISO-639-2 form. (end with '\0') -}; - -struct TrackExtendedInfoVideo { - WORD Size; // Size of this structure - BOOL Interlaced; // Set if the video is interlaced. - UINT PixelWidth; // Width of the encoded video frames in pixels. - UINT PixelHeight; // Height of the encoded video frames in pixels. - UINT DisplayWidth; // Width of the video frames to display. - UINT DisplayHeight; // Height of the video frames to display. - BYTE DisplayUnit; // Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). - BYTE AspectRatioType; // Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). -}; - -struct TrackExtendedInfoAudio { - WORD Size; // Size of this structure - FLOAT SamplingFreq; // Sampling frequency in Hz. - FLOAT OutputSamplingFrequency; // Real output sampling frequency in Hz (used for SBR techniques). - UINT Channels; // Numbers of channels in the track. - UINT BitDepth; // Bits per sample, mostly used for PCM. -}; - -#pragma pack(pop) - -[uuid("03E98D51-DDE7-43aa-B70C-42EF84A3A23D")] -interface ITrackInfo : public IUnknown -{ - STDMETHOD_(UINT, GetTrackCount) () = 0; - - // \param aTrackIdx the track index (from 0 to GetTrackCount()-1) - STDMETHOD_(BOOL, GetTrackInfo) (UINT aTrackIdx, struct TrackElement* pStructureToFill) = 0; - - // Get an extended information struct relative to the track type - STDMETHOD_(BOOL, GetTrackExtendedInfo) (UINT aTrackIdx, void* pStructureToFill) = 0; - - STDMETHOD_(BSTR, GetTrackCodecID) (UINT aTrackIdx) = 0; - STDMETHOD_(BSTR, GetTrackName) (UINT aTrackIdx) = 0; - STDMETHOD_(BSTR, GetTrackCodecName) (UINT aTrackIdx) = 0; - STDMETHOD_(BSTR, GetTrackCodecInfoURL) (UINT aTrackIdx) = 0; - STDMETHOD_(BSTR, GetTrackCodecDownloadURL) (UINT aTrackIdx) = 0; -}; diff --git a/include/atl/atlcache.h b/include/atl/atlcache.h deleted file mode 100644 index 7eacf9aa8..000000000 --- a/include/atl/atlcache.h +++ /dev/null @@ -1,3246 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLCACHE_H__ -#define __ATLCACHE_H__ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma warning (push) -#ifndef _ATL_NO_PRAGMA_WARNINGS -#pragma warning(disable: 4511) // copy constructor could not be generated -#pragma warning(disable: 4512) // assignment operator could not be generated -#endif //!_ATL_NO_PRAGMA_WARNINGS - -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible - -#ifndef _CPPUNWIND -#pragma warning(disable: 4702) // unreachable code -#endif -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -//forward declarations; -class CStdStatClass; -class CPerfStatClass; - -typedef struct __CACHEITEM -{ -} *HCACHEITEM; - -//Implementation of a cache that stores pointers to void -extern "C" __declspec(selectany) const IID IID_IMemoryCacheClient = {0xb721b49d, 0xbb57, 0x47bc, { 0xac, 0x43, 0xa8, 0xd4, 0xc0, 0x7d, 0x18, 0x3d } }; -extern "C" __declspec(selectany) const IID IID_IMemoryCache = { 0x9c6cfb46, 0xfbde, 0x4f8b, { 0xb9, 0x44, 0x2a, 0xa0, 0x5d, 0x96, 0xeb, 0x5c } }; -extern "C" __declspec(selectany) const IID IID_IMemoryCacheControl = { 0x7634b28b, 0xd819, 0x409d, { 0xb9, 0x6e, 0xfc, 0x9f, 0x3a, 0xba, 0x32, 0x9f } }; -extern "C" __declspec(selectany) const IID IID_IMemoryCacheStats = { 0xd4b6df2d, 0x4bc0, 0x4734, { 0x8a, 0xce, 0xb7, 0x3a, 0xb, 0x97, 0x59, 0x56 } }; - -__interface ATL_NO_VTABLE __declspec(uuid("b721b49d-bb57-47bc-ac43-a8d4c07d183d")) - IMemoryCacheClient : public IUnknown -{ - // IMemoryCacheClient methods - STDMETHOD( Free )(const void *pvData); -}; - -__interface ATL_NO_VTABLE __declspec(uuid("9c6cfb46-fbde-4f8b-b944-2aa05d96eb5c")) - IMemoryCache : public IUnknown -{ - // IMemoryCache Methods - STDMETHOD(Add)(LPCSTR szKey, void *pvData, DWORD dwSize, - FILETIME *pftExpireTime, - HINSTANCE hInstClient, HCACHEITEM *phEntry, - IMemoryCacheClient *pClient); - - STDMETHOD(LookupEntry)(LPCSTR szKey, HCACHEITEM * phEntry); - STDMETHOD(GetData)(const HCACHEITEM hEntry, void **ppvData, DWORD *pdwSize) const; - STDMETHOD(ReleaseEntry)(const HCACHEITEM hEntry); - STDMETHOD(RemoveEntry)(const HCACHEITEM hEntry); - STDMETHOD(RemoveEntryByKey)(LPCSTR szKey); - - STDMETHOD(Flush)(); -}; - -__interface ATL_NO_VTABLE __declspec(uuid("7634b28b-d819-409d-b96e-fc9f3aba329f")) - IMemoryCacheControl : public IUnknown -{ - // IMemoryCacheControl Methods - STDMETHOD(SetMaxAllowedSize)(DWORD dwSize); - STDMETHOD(GetMaxAllowedSize)(DWORD *pdwSize); - STDMETHOD(SetMaxAllowedEntries)(DWORD dwSize); - STDMETHOD(GetMaxAllowedEntries)(DWORD *pdwSize); - STDMETHOD(ResetCache)(); -}; - -__interface ATL_NO_VTABLE __declspec(uuid("d4b6df2d-4bc0-4734-8ace-b73a0b975956")) - IMemoryCacheStats : public IUnknown -{ - // IMemoryCacheStats Methods - STDMETHOD(ClearStats)(); - STDMETHOD(GetHitCount)(DWORD *pdwSize); - STDMETHOD(GetMissCount)(DWORD *pdwSize); - STDMETHOD(GetCurrentAllocSize)(DWORD *pdwSize); - STDMETHOD(GetMaxAllocSize)(DWORD *pdwSize); - STDMETHOD(GetCurrentEntryCount)(DWORD *pdwSize); - STDMETHOD(GetMaxEntryCount)(DWORD *pdwSize); - -}; - -struct DLL_CACHE_ENTRY -{ - HINSTANCE hInstDll; - DWORD dwRefs; - BOOL bAlive; - CHAR szDllName[MAX_PATH]; -}; - -inline bool operator==(const DLL_CACHE_ENTRY& entry1, const DLL_CACHE_ENTRY& entry2) -{ - return (entry1.hInstDll == entry2.hInstDll); -} - -// -// IDllCache -// An interface that is used to load and unload Dlls. -// -__interface ATL_NO_VTABLE __declspec(uuid("A12478AB-D261-42f9-B525-7589143C1C97")) - IDllCache : public IUnknown -{ - // IDllCache methods - virtual HINSTANCE Load(LPCSTR szFileName, void *pPeerInfo); - virtual BOOL Free(HINSTANCE hInstance); - virtual BOOL AddRefModule(HINSTANCE hInstance); - virtual BOOL ReleaseModule(HINSTANCE hInstance); - virtual HRESULT GetEntries(DWORD dwCount, DLL_CACHE_ENTRY *pEntries, DWORD *pdwCopied); - virtual HRESULT Flush(); -}; - -#ifndef ATL_CACHE_KEY_LENGTH -#define ATL_CACHE_KEY_LENGTH 128 -#endif - -typedef CFixedStringT CFixedStringKey; - -struct CFlusherCacheData -{ - CFlusherCacheData *pNext; - CFlusherCacheData *pPrev; - DWORD dwAccessed; - - CFlusherCacheData() - { - pNext = NULL; - pPrev = NULL; - dwAccessed = 0; - } -}; - -// No flusher -- only expired entries will be removed from the cache -// Also gives the skeleton for all of the flushers -class CNoFlusher -{ -public: - void Add(CFlusherCacheData * /*pItem*/) { } - void Remove(CFlusherCacheData * /*pItem*/) { } - void Access(CFlusherCacheData * /*pItem*/) { } - CFlusherCacheData * GetStart() const { return NULL; } - CFlusherCacheData * GetNext(CFlusherCacheData * /*pCur*/) const { return NULL; } - void Release(CFlusherCacheData * /*pItem*/){ } -}; - -// Old flusher -- oldest items are flushed first -class COldFlusher -{ -public: - CFlusherCacheData * pHead; - CFlusherCacheData * pTail; - - COldFlusher() : pHead(NULL), pTail(NULL) - { - } - - // Add it to the tail of the list - void Add(CFlusherCacheData * pItem) - { - ATLENSURE(pItem); - - pItem->pNext = NULL; - pItem->pPrev = pTail; - if (pHead) - { - pTail->pNext = pItem; - pTail = pItem; - } - else - { - pHead = pItem; - pTail = pItem; - } - } - - void Remove(CFlusherCacheData * pItem) - { - ATLENSURE(pItem); - - CFlusherCacheData * pPrev = pItem->pPrev; - CFlusherCacheData * pNext = pItem->pNext; - - if (pPrev) - pPrev->pNext = pNext; - else - pHead = pNext; - - if (pNext) - pNext->pPrev = pPrev; - else - pTail = pPrev; - - } - - void Access(CFlusherCacheData * /*pItem*/) - { - } - - void Release(CFlusherCacheData * /*pItem*/) - { - } - - CFlusherCacheData * GetStart() const - { - return pHead; - } - - CFlusherCacheData * GetNext(CFlusherCacheData * pCur) const - { - if (pCur != NULL) - return pCur->pNext; - else - return NULL; - } -}; - -// Least recently used flusher -- the item that was accessed the longest time ago is flushed -class CLRUFlusher : public COldFlusher -{ -public: - // Move it to the tail of the list - void Access(CFlusherCacheData * pItem) - { - ATLASSERT(pItem); - - Remove(pItem); - Add(pItem); - } -}; - -// Least often used flusher -class CLOUFlusher : public COldFlusher -{ -public: - // Adds to the tail of the list - void Add(CFlusherCacheData * pItem) - { - ATLENSURE(pItem); - pItem->dwAccessed = 1; - COldFlusher::Add(pItem); - } - - void Access(CFlusherCacheData * pItem) - { - ATLENSURE(pItem); - pItem->dwAccessed++; - - CFlusherCacheData * pMark = static_cast(pItem->pPrev); - if (!pMark) // The item is already at the head - return; - - if (pMark->dwAccessed >= pItem->dwAccessed) // The element before it has - return; // been accessed more times - - Remove(pItem); - - while (pMark && (pMark->dwAccessed < pItem->dwAccessed)) - pMark = static_cast(pMark->pPrev); - - // pMark points to the first element that has been accessed more times, - // so add pItem after pMark - if (pMark) - { - CFlusherCacheData *pNext = static_cast(pMark->pNext); - pMark->pNext = pItem; - pItem->pPrev = pMark; - - pItem->pNext = pNext; - pNext->pPrev = pItem; - } - else // Ran out of items -- put it on the head - { - pItem->pNext = pHead; - pItem->pPrev = NULL; - if (pHead) - pHead->pPrev = pItem; - else // the list was empty - pTail = pItem; - pHead = pItem; - } - } - - // We start at the tail and move forward for this flusher - CFlusherCacheData * GetStart() const - { - return pTail; - } - - CFlusherCacheData * GetNext(CFlusherCacheData * pCur) const - { - if (pCur != NULL) - return static_cast(pCur->pPrev); - else - return NULL; - } -}; - -template -class COrFlushers -{ - CFirst m_First; - CSecond m_Second; - BOOL m_bWhich; -public: - COrFlushers() - { - m_bWhich = FALSE; - } - - BOOL Switch() - { - m_bWhich = !m_bWhich; - return m_bWhich; - } - - void Add(CFlusherCacheData * pItem) - { - ATLASSERT(pItem); - m_First.Add(pItem); - m_Second.Add(pItem); - } - - void Remove(CFlusherCacheData * pItem) - { - ATLASSERT(pItem); - m_First.Remove(pItem); - m_Second.Remove(pItem); - } - - void Access(CFlusherCacheData * pItem) - { - ATLASSERT(pItem); - m_First.Access(pItem); - m_Second.Access(pItem); - } - void Release(CFlusherCacheData * pItem) - { - ATLASSERT(pItem); - m_First.Release(pItem); - m_Second.Release(pItem); - } - - CFlusherCacheData * GetStart() const - { - if (m_bWhich) - return m_First.GetStart(); - else - return m_Second.GetStart(); - } - - CFlusherCacheData * GetNext(CFlusherCacheData * pCur) const - { - if (m_bWhich) - return m_First.GetNext(pCur); - else - return m_Second.GetNext(pCur); - } -}; - -struct CCullerCacheData -{ - CCullerCacheData() - { - pNext = NULL; - pPrev = NULL; - nLifespan = 0; - } - CCullerCacheData *pNext; - CCullerCacheData *pPrev; - ULONGLONG nLifespan; - CFileTime cftExpireTime; -}; - -class CNoExpireCuller -{ -public: - void Add(CCullerCacheData * /*pItem*/) { } - void Commit(CCullerCacheData * /*pItem*/) { } - void Access(CCullerCacheData * /*pItem*/) { } - void Remove(CCullerCacheData * /*pItem*/) { } - void Start() { } - BOOL IsExpired(CCullerCacheData * /*pItem*/) { return FALSE; } - CCullerCacheData * GetExpired() { return NULL; } - void Release(CCullerCacheData * /*pItem*/){} - -}; - -class CExpireCuller -{ -public: - CFileTime m_cftCurrent; - CCullerCacheData *pHead; - CCullerCacheData *pTail; - - CExpireCuller() - { - pHead = NULL; - pTail = NULL; - } - - // Element is being added -- perform necessary initialization - void Add(CCullerCacheData * pItem) - { - (pItem); - ATLASSERT(pItem); - } - - // Expiration data has been set -- add to main list - // Head is the first item to expire - // a FILETIME of 0 indicates that the item should never expire - void Commit(CCullerCacheData * pItem) - { - ATLENSURE(pItem); - if (!pHead) - { - pHead = pItem; - pTail = pItem; - pItem->pNext = NULL; - pItem->pPrev = NULL; - return; - } - - if (CFileTime(pItem->cftExpireTime) == 0) - { - pTail->pNext = pItem; - pItem->pPrev = pTail; - pItem->pNext = NULL; - pTail = pItem; - return; - } - - CCullerCacheData * pMark = pHead; - while (pMark && (pMark->cftExpireTime < pItem->cftExpireTime)) - pMark = pMark->pNext; - - if (pMark) // An entry was found that expires after the added entry - { - CCullerCacheData *pPrev = pMark->pPrev; - if (pPrev) - pPrev->pNext = pItem; - else - pHead = pItem; - - pItem->pNext = pMark; - pItem->pPrev = pPrev; - pMark->pPrev = pItem; - } - else // Ran out of items -- put it on the tail - { - if (pTail) - pTail->pNext = pItem; - pItem->pPrev = pTail; - pItem->pNext = NULL; - pTail = pItem; - } - } - - void Access(CCullerCacheData * /*pItem*/) - { - } - - void Release(CCullerCacheData * /*pItem*/) - { - } - - void Remove(CCullerCacheData * pItem) - { - ATLENSURE(pItem); - CCullerCacheData *pPrev = pItem->pPrev; - CCullerCacheData *pNext = pItem->pNext; - - if (pPrev) - pPrev->pNext = pNext; - else - pHead = pNext; - - if (pNext) - pNext->pPrev = pPrev; - else - pTail = pPrev; - - } - - // About to start culling - void Start() - { - m_cftCurrent = CFileTime::GetCurrentTime(); - } - - BOOL IsExpired(CCullerCacheData *pItem) - { - if ((pItem->cftExpireTime != 0) && - m_cftCurrent > pItem->cftExpireTime) - return TRUE; - - return FALSE; - } - - // Get the next expired entry - CCullerCacheData * GetExpired() - { - if (!pHead) - return NULL; - if (IsExpired(pHead)) - return pHead; - - return NULL; - } -}; - -class CLifetimeCuller : public CExpireCuller -{ -public: - void Add(CCullerCacheData * pItem) - { - ATLENSURE(pItem); - pItem->nLifespan = 0; - CExpireCuller::Add(pItem); - } - - void Commit(CCullerCacheData * pItem) - { - ATLENSURE(pItem); - if (pItem->nLifespan == 0) - pItem->cftExpireTime = 0; - else - pItem->cftExpireTime = CFileTime(CFileTime::GetCurrentTime().GetTime() + pItem->nLifespan); - CExpireCuller::Commit(pItem); - } - - void Access(CCullerCacheData * pItem) - { - ATLASSERT(pItem); - CExpireCuller::Remove(pItem); - Commit(pItem); - } - - CCullerCacheData * GetExpired() - { - return static_cast(CExpireCuller::GetExpired()); - } -}; - -template <__int64 ftLifespan> -class CFixedLifetimeCuller : public CExpireCuller -{ -public: - void Commit(CCullerCacheData * pItem) - { - ATLASSERT(pItem); - __int64 nLifeSpan = ftLifespan; - if (nLifeSpan == 0) - pItem->cftExpireTime = 0; - else - pItem->cftExpireTime = CFileTime::GetCurrentTime() + CFileTimeSpan(ftLifespan); - - CExpireCuller::Commit(pItem); - } - - void Access(CCullerCacheData * pItem) - { - ATLASSERT(pItem); - CExpireCuller::Remove(pItem); - Commit(pItem); - } - - CCullerCacheData * GetExpired() - { - return static_cast(CExpireCuller::GetExpired()); - } -}; - - -template -class COrCullers -{ - CFirst m_First; - CSecond m_Second; -public: - void Add(CCullerCacheData * pItem) - { - m_First.Add(pItem); - m_Second.Add(pItem); - } - - void Access(CCullerCacheData * pItem) - { - m_First.Access(pItem); - m_Second.Access(pItem); - } - - void Remove(CCullerCacheData * pItem) - { - m_First.Remove(pItem); - m_Second.Remove(pItem); - } - - void Start() - { - m_First.Start(); - m_Second.Start(); - } - - void Release(CCullerCacheData *pItem) - { - m_First.Release(pItem); - m_Second.Release(pItem); - } - - void Commit(CCullerCacheData * pItem) - { - m_First.Commit(pItem); - m_Second.Commit(pItem); - } - CCullerCacheData * GetExpired() - { - CCullerCacheData *pItem = m_First.GetExpired(); - if (!pItem) - pItem = m_Second.GetExpired(); - - return pItem; - } - - BOOL IsExpired(CCullerCacheData * pItem) - { - return (m_First.IsExpired(pItem) || m_Second.IsExpired(pItem)); - } -}; - -// -//CMemoryCacheBase -// Description: -// This class provides the implementation of a generic cache that stores -// elements in memory. CMemoryCacheBase uses the CCacheDataBase generic -// cache element structure to hold items in the cache. The cache is -// implemented using the CAtlMap map class. CMemoryCache uses a wide -// character string as it's Key type to identify entries. Entries must -// have unique key values. If you try to add an entry with a key that -// is exactly the same as an existing key, the existing entry will be -// overwritten. -// -// Template Parameters: -// T: The class that inherits from this class. This class must implement -// void OnDestroyEntry(NodeType *pEntry); -// DataType: Specifies the type of the element to be stored in the memory -// cache such as CString or void* -// NodeInfo: Specifies any additional data that should be stored in each item -// in the cache -// keyType, keyTrait : specifies the key type and traits (see CAtlMap) -// Flusher : the class responsible for determining which data should be flushed -// when the cache is at a configuration limit -// Culler : the class responsible for determining which data should be removed -// from the cache due to expiration -// SyncClass:Specifies the class that will be used for thread synchronization -// when accessing the cache. The class interface for SyncClass must -// be identical to that of CComCriticalSection (see atlbase.h) -// StatClass: Class used to contain statistics about this cache. -template , - class Flusher=COldFlusher, - class Culler=CExpireCuller, - class SyncClass=CComCriticalSection, - class StatClass=CStdStatClass > - class CMemoryCacheBase -{ -protected: - typedef keyType keytype; - struct NodeType : public __CACHEITEM, - public NodeInfo, - public CFlusherCacheData, - public CCullerCacheData - { - NodeType() - { - pos = NULL; - dwSize = 0; - dwRef = 0; - } - - DataType Data; - POSITION pos; - DWORD dwSize; - DWORD dwRef; - }; - - typedef CAtlMap mapType; - SyncClass m_syncObj; - StatClass m_statObj; - Flusher m_flusher; - Culler m_culler; - - //memory cache configuration parameters - DWORD m_dwMaxAllocationSize; - DWORD m_dwMaxEntries; - - BOOL m_bInitialized; -public: - - mapType m_hashTable; - CMemoryCacheBase() : - m_dwMaxAllocationSize(0xFFFFFFFF), - m_dwMaxEntries(0xFFFFFFFF), - m_bInitialized(FALSE) - { - - } - - //Initializes the cache and the cache synchronization object - //Also the performance monitoring - HRESULT Initialize() - { - if (m_bInitialized) - return HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED); - HRESULT hr; - hr = m_syncObj.Init(); - - if (hr == S_OK) - hr = m_statObj.Initialize(); - - m_bInitialized = TRUE; - - return hr; - } - - //removes all entries whether or not they are initialized. - HRESULT Uninitialize() - { - if (!m_bInitialized) - return S_OK; - - //clear out the hash table - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - return hr; - - RemoveAllEntries(); - m_statObj.Uninitialize(); - - m_syncObj.Unlock(); - m_syncObj.Term(); - - m_bInitialized = FALSE; - - return S_OK; - } - - //Adds an entry to the cache. - //Also, adds an initial reference on the entry if phEntry is not NULL - HRESULT AddEntry( - const keyType &Key, //key for entry - const DataType &data, //See the DataType template parameter - DWORD dwSize, //Size of memory to be stored in the cache - HCACHEITEM *phEntry = NULL //out pointer that will contain a handle to the new - //cache entry on success. - ) - { - _ATLTRY - { - ATLASSUME(m_bInitialized); - - CAutoPtr spEntry(new NodeType); - - if (!spEntry) - return E_OUTOFMEMORY; - - NodeType *pEntry = spEntry; - - //fill entry - if (phEntry) - { - *phEntry = static_cast(pEntry); - pEntry->dwRef++; - } - pEntry->Data = data; - pEntry->dwSize = dwSize; - - CComCritSecLock lock(m_syncObj, false); - - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - { - return hr; - } - - POSITION pos = (POSITION)m_hashTable.Lookup(Key); - - if (pos != NULL) - { - RemoveAt(pos, FALSE); - m_hashTable.GetValueAt(pos) = pEntry; - } - else - { - pos = m_hashTable.SetAt(Key, pEntry); - } - spEntry.Detach(); - - pEntry->pos = pos; - m_statObj.AddElement(dwSize); - m_flusher.Add(pEntry); - m_culler.Add(pEntry); - - lock.Unlock(); - - if (!phEntry) - return CommitEntry(static_cast(pEntry)); - - return S_OK; - } - _ATLCATCHALL() - { - return E_FAIL; - } - } - - // Commits the entry to the cache - HRESULT CommitEntry(const HCACHEITEM hEntry) - { - ATLASSUME(m_bInitialized); - if (!hEntry || hEntry == INVALID_HANDLE_VALUE) - return E_INVALIDARG; - - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - { - return hr; - } - - NodeType *pEntry = static_cast(hEntry); - m_culler.Commit(pEntry); - m_syncObj.Unlock(); - return S_OK; - } - - // Looks up an entry and returns a handle to it, - // also updates access count and reference count - HRESULT LookupEntry(const keyType &Key, HCACHEITEM * phEntry) - { - ATLASSUME(m_bInitialized); - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - { - return hr; - } - - hr = E_FAIL; - - POSITION pos = (POSITION)m_hashTable.Lookup(Key); - if (pos != NULL) - { - NodeType * pEntry = m_hashTable.GetValueAt(pos); - m_flusher.Access(pEntry); - m_culler.Access(pEntry); - if (phEntry) - { - pEntry->dwRef++; - *phEntry = static_cast(pEntry); - } - - m_statObj.Hit(); - - hr = S_OK; - } - else - { - *phEntry = NULL; - m_statObj.Miss(); - } - m_syncObj.Unlock(); - - return hr; - } - - // Gets the data based on the handle. Is thread-safe as long as there is a - // reference on the data - HRESULT GetEntryData(const HCACHEITEM hEntry, DataType *pData, DWORD *pdwSize) const - { - ATLASSUME(m_bInitialized); - ATLASSERT(pData != NULL || pdwSize != NULL); // At least one should not be NULL - - if (!hEntry || hEntry == INVALID_HANDLE_VALUE) - return E_INVALIDARG; - - NodeType * pEntry = static_cast(hEntry); - if (pData) - *pData = pEntry->Data; - if (pdwSize) - *pdwSize = pEntry->dwSize; - - return S_OK; - } - - // Unreferences the entry based on the handle - DWORD ReleaseEntry(const HCACHEITEM hEntry) - { - ATLASSUME(m_bInitialized); - if (!hEntry || hEntry == INVALID_HANDLE_VALUE) - return (DWORD)-1; - - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - return (DWORD)-1; - - NodeType * pEntry = static_cast(hEntry); - m_flusher.Release(pEntry); - m_culler.Release(pEntry); - ATLASSERT(pEntry->dwRef > 0); - - DWORD dwRef = --pEntry->dwRef; - if ((pEntry->pos == NULL) && (pEntry->dwRef == 0)) - InternalRemoveEntry(pEntry); - - m_syncObj.Unlock(); - - return dwRef; - } - - // Increments the entry's reference count - DWORD AddRefEntry(const HCACHEITEM hEntry) - { - ATLASSUME(m_bInitialized); - if (!hEntry || hEntry == INVALID_HANDLE_VALUE) - return (DWORD)-1; - - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - return (DWORD)-1; - - NodeType * pEntry = static_cast(hEntry); - m_flusher.Access(pEntry); - m_culler.Access(pEntry); - DWORD dwRef = ++pEntry->dwRef; - m_syncObj.Unlock(); - - return dwRef; - } - - // Removes an entry from the cache regardless of whether or - // not it has expired. If there are references, it detaches - // the entry so that future lookups will fail, and when - // the ref count drops to zero, it will be deleted - HRESULT RemoveEntryByKey(const keyType &Key) - { - ATLASSUME(m_bInitialized); - HCACHEITEM hEntry; - HRESULT hr = LookupEntry(Key, &hEntry); - if (hr == S_OK) - hr = RemoveEntry(hEntry); - - return hr; - } - - // Removes the element from the cache. If there are still - // references, then the entry is detached. - HRESULT RemoveEntry(const HCACHEITEM hEntry) - { - ATLASSUME(m_bInitialized); - if (!hEntry || hEntry == INVALID_HANDLE_VALUE) - return E_INVALIDARG; - - _ATLTRY - { - CComCritSecLock lock(m_syncObj, false); - - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - NodeType * pEntry = static_cast(hEntry); - m_flusher.Release(pEntry); - m_culler.Release(pEntry); - ATLASSERT(pEntry->dwRef > 0); - pEntry->dwRef--; - if (pEntry->pos) - RemoveAt(pEntry->pos, TRUE); - else if ((long)pEntry->dwRef == 0) - InternalRemoveEntry(pEntry); - lock.Unlock(); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return S_OK; - } - - // CullEntries removes all expired items - HRESULT CullEntries() - { - ATLASSUME(m_bInitialized); - - _ATLTRY - { - CComCritSecLock lock(m_syncObj, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - m_culler.Start(); - - while (NodeType *pNode = static_cast(m_culler.GetExpired())) - RemoveAt(pNode->pos, TRUE); - - lock.Unlock(); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return S_OK; - } - - // FlushEntries reduces the cache to meet the configuration requirements - HRESULT FlushEntries() - { - ATLASSUME(m_bInitialized); - HRESULT hr = CullEntries(); - if (FAILED(hr)) - return hr; - - _ATLTRY - { - CComCritSecLock lock(m_syncObj, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - NodeType * pNode = static_cast(m_flusher.GetStart()); - - while (pNode && - (((m_statObj.GetCurrentEntryCount() > m_dwMaxEntries)) || - ((m_statObj.GetCurrentAllocSize() > m_dwMaxAllocationSize)))) - { - NodeType *pNext = static_cast(m_flusher.GetNext(pNode)); - - if (pNode->dwRef == 0) - RemoveAt(pNode->pos, TRUE); - - pNode = pNext; - } - lock.Unlock(); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return S_OK; - } - - HRESULT STDMETHODCALLTYPE SetMaxAllowedSize(DWORD dwSize) - { - m_dwMaxAllocationSize = dwSize; - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxAllowedSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_dwMaxAllocationSize; - return S_OK; - } - - HRESULT STDMETHODCALLTYPE SetMaxAllowedEntries(DWORD dwSize) - { - m_dwMaxEntries = dwSize; - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxAllowedEntries(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_dwMaxEntries; - return S_OK; - } - - - HRESULT ResetCache() - { - ATLASSUME(m_bInitialized); - HRESULT hr = E_UNEXPECTED; - if (SUCCEEDED(ClearStats())) - hr = RemoveAllEntries(); - return hr; - } - - HRESULT ClearStats() - { - m_statObj.ResetCounters(); - return S_OK; - } - - HRESULT RemoveAllEntries() - { - ATLASSUME(m_bInitialized); - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - return hr; - - m_hashTable.DisableAutoRehash(); - POSITION pos = m_hashTable.GetStartPosition(); - POSITION oldpos; - while (pos != NULL) - { - oldpos = pos; - m_hashTable.GetNext(pos); - RemoveAt(oldpos, TRUE); - } - m_hashTable.EnableAutoRehash(); - m_syncObj.Unlock(); - - return S_OK; - } - -protected: - - // Checks to see if the cache can accommodate any new entries within - // its allocation and entry count limits. - bool CanAddEntry(DWORD dwSizeToAdd) - { - return CheckAlloc(dwSizeToAdd) && CheckEntryCount(1); - } - - // Checks to see if the cache can accommodate dwSizeToAdd additional - // allocation within its allocation limit. - bool CheckAlloc(DWORD dwSizeToAdd) - { - if (m_dwMaxAllocationSize == 0xFFFFFFFF) - return true; //max allocation size setting hasn't been set - DWORD dwNew = m_statObj.GetCurrentAllocSize() + dwSizeToAdd; - return dwNew < m_dwMaxAllocationSize; - } - - - // Checks to see if the cache can accommodate dwNumEntriesToAdd - // additional entries within its limits. - bool CheckEntryCount(DWORD dwNumEntriesToAdd) - { - if (m_dwMaxEntries == 0xFFFFFFFF) - return true; //max entry size hasn't been set - DWORD dwNew = m_statObj.GetCurrentEntryCount() + dwNumEntriesToAdd; - return dwNew < m_dwMaxEntries; - - } - -protected: - // Takes the element at pos in the hash table and removes it from - // the cache. If there are no references, then the entry is - // deleted, otherwise it is deleted by ReleaseEntry when the - // refcount goes to zero. - HRESULT RemoveAt(POSITION pos, BOOL bDelete) - { - HRESULT hr = S_OK; - ATLASSERT(pos != NULL); - NodeType * pEntry = m_hashTable.GetValueAt(pos); - m_flusher.Remove(pEntry); - m_culler.Remove(pEntry); - if (bDelete) - m_hashTable.RemoveAtPos(pos); - - if ((long)pEntry->dwRef == 0) - hr = InternalRemoveEntry(pEntry); - else - pEntry->pos = NULL; - - return S_OK; - } - - // Does the actual destruction of the node. Deletes the - // NodeType struct and calls the inherited class's - // OnDestroyEntry function, where other necessary destruction - // can take place. Also updates the cache statistics. - // Inherited classes should call RemoveAt unless the element's - // refcount is zero and it has been removed from the - // culler and flusher lists. - HRESULT InternalRemoveEntry(NodeType * pEntry) - { - ATLENSURE(pEntry != NULL); - - T* pT = static_cast(this); - - ATLASSERT((long)pEntry->dwRef == 0); - - pT->OnDestroyEntry(pEntry); - - m_statObj.ReleaseElement(pEntry->dwSize); - - delete pEntry; - - return S_OK; - } -}; // CMemoryCacheBase - -class CCacheDataBase -{ -}; - -struct CCacheDataEx : public CCacheDataBase -{ - CCacheDataEx() - { - hInstance = NULL; - pClient = NULL; - } - - HINSTANCE hInstance; - IMemoryCacheClient * pClient; -}; - - -template , - class SyncClass=CComCriticalSection, - class CullClass=CExpireCuller > -class CMemoryCache: - public CMemoryCacheBase, DataType, CCacheDataEx, - keyType, KeyTrait, FlushClass, CullClass, SyncClass, StatClass> -{ -protected: - CComPtr m_spServiceProv; - CComPtr m_spDllCache; - typedef CMemoryCacheBase, DataType, CCacheDataEx, - keyType, KeyTrait, FlushClass, CullClass, SyncClass, StatClass> baseClass; -public: - virtual ~CMemoryCache() - { - } - - HRESULT Initialize(IServiceProvider * pProvider) - { - baseClass::Initialize(); - m_spServiceProv = pProvider; - if (pProvider) - return m_spServiceProv->QueryService(__uuidof(IDllCache), __uuidof(IDllCache), (void**)&m_spDllCache); - else - return S_OK; - } - - HRESULT AddEntry( - const keyType &Key, - const DataType &data, - DWORD dwSize, - FILETIME * pftExpireTime = NULL, - HINSTANCE hInstance = NULL, - IMemoryCacheClient * pClient = NULL, - HCACHEITEM *phEntry = NULL - ) - { - _ATLTRY - { - HRESULT hr; - NodeType * pEntry = NULL; - hr = baseClass::AddEntry(Key, data, dwSize, (HCACHEITEM *)&pEntry); - if (hr != S_OK) - return hr; - - pEntry->hInstance = hInstance; - pEntry->pClient = pClient; - if (pftExpireTime) - pEntry->cftExpireTime = *pftExpireTime; - - if (hInstance && m_spDllCache) - m_spDllCache->AddRefModule(hInstance); - - baseClass::CommitEntry(static_cast(pEntry)); - - if (phEntry) - *phEntry = static_cast(pEntry); - else - baseClass::ReleaseEntry(static_cast(pEntry)); - - return S_OK; - } - _ATLCATCHALL() - { - return E_FAIL; - } - } - - virtual void OnDestroyEntry(const NodeType * pEntry) - { - ATLASSERT(pEntry); - if (!pEntry) - return; - - if (pEntry->pClient) - pEntry->pClient->Free((void *)&pEntry->Data); - if (pEntry->hInstance && m_spDllCache) - m_spDllCache->ReleaseModule(pEntry->hInstance); - } -}; // CMemoryCache - -// CStdStatData - contains the data that CStdStatClass keeps track of -#define ATL_PERF_CACHE_OBJECT 100 - -struct CPerfStatObject : public CPerfObject -{ - DECLARE_PERF_CATEGORY(CPerfStatObject, ATL_PERF_CACHE_OBJECT, IDS_PERFMON_CACHE, IDS_PERFMON_CACHE_HELP, -1); - - BEGIN_COUNTER_MAP(CPerfStatObject) - DEFINE_COUNTER(m_nHitCount, IDS_PERFMON_HITCOUNT, IDS_PERFMON_HITCOUNT_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_nMissCount, IDS_PERFMON_MISSCOUNT, IDS_PERFMON_MISSCOUNT_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_nCurrentAllocations, IDS_PERFMON_CURRENTALLOCATIONS, IDS_PERFMON_CURRENTALLOCATIONS_HELP, PERF_COUNTER_RAWCOUNT, -3) - DEFINE_COUNTER(m_nMaxAllocations, IDS_PERFMON_MAXALLOCATIONS, IDS_PERFMON_MAXALLOCATIONS_HELP, PERF_COUNTER_RAWCOUNT, -3) - DEFINE_COUNTER(m_nCurrentEntries, IDS_PERFMON_CURRENTENTRIES, IDS_PERFMON_CURRENTENTRIES_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_nMaxEntries, IDS_PERFMON_MAXENTRIES, IDS_PERFMON_MAXENTRIES_HELP, PERF_COUNTER_RAWCOUNT, -1) - END_COUNTER_MAP() - - long m_nHitCount; - long m_nMissCount; - long m_nCurrentAllocations; - long m_nMaxAllocations; - long m_nCurrentEntries; - long m_nMaxEntries; -}; - -// CCachePerfMon - the interface to CPerfMon, with associated definitions -class CCachePerfMon : public CPerfMon -{ -public: - BEGIN_PERF_MAP(_T("ATL Server:Cache")) - CHAIN_PERF_CATEGORY(CPerfStatObject) - END_PERF_MAP() -}; - -// -//CStdStatClass -// Description -// This class provides the implementation of a standard cache statistics accounting class -class CStdStatClass -{ -protected: - CPerfStatObject* m_pStats; - CPerfStatObject m_stats; - -public: - - CStdStatClass() - { - m_pStats = &m_stats; - } - - // This function is not thread safe by design - HRESULT Initialize(CPerfStatObject* pStats = NULL) - { - if (pStats) - m_pStats = pStats; - else - m_pStats = &m_stats; - - ResetCounters(); - return S_OK; - } - - // This function is not thread safe by design - HRESULT Uninitialize() - { - m_pStats = &m_stats; - return S_OK; - } - - void Hit() - { - InterlockedIncrement(&m_pStats->m_nHitCount); - } - - void Miss() - { - InterlockedIncrement(&m_pStats->m_nMissCount); - } - - void AddElement(DWORD dwBytes) - { - DWORD nCurrentEntries = InterlockedIncrement(&m_pStats->m_nCurrentEntries); - AtlInterlockedUpdateMax(nCurrentEntries, &m_pStats->m_nMaxEntries); - - DWORD nCurrentAllocations = dwBytes + AtlInterlockedExchangeAdd(&m_pStats->m_nCurrentAllocations, dwBytes); - AtlInterlockedUpdateMax(nCurrentAllocations, &m_pStats->m_nMaxAllocations); - } - - void ReleaseElement(DWORD dwBytes) - { - InterlockedDecrement(&m_pStats->m_nCurrentEntries); - AtlInterlockedExchangeAdd(&m_pStats->m_nCurrentAllocations, -((long)dwBytes)); - } - - DWORD GetHitCount() - { - return m_pStats->m_nHitCount; - } - - DWORD GetMissCount() - { - return m_pStats->m_nMissCount; - } - - DWORD GetCurrentAllocSize() - { - return m_pStats->m_nCurrentAllocations; - } - - DWORD GetMaxAllocSize() - { - return m_pStats->m_nMaxAllocations; - } - - DWORD GetCurrentEntryCount() - { - return m_pStats->m_nCurrentEntries; - } - - DWORD GetMaxEntryCount() - { - return m_pStats->m_nMaxEntries; - } - - void ResetCounters() - { - m_pStats->m_nHitCount = 0; - m_pStats->m_nMissCount = 0; - m_pStats->m_nCurrentAllocations = 0; - m_pStats->m_nMaxAllocations = 0; - m_pStats->m_nCurrentEntries = 0; - m_pStats->m_nMaxEntries = 0; - } -}; // CStdStatClass - -// -// CNoStatClass -// This is a noop stat class -class CNoStatClass -{ -public: - HRESULT Initialize(){ return S_OK; } - HRESULT Uninitialize(){ return S_OK; } - void Hit(){ } - void Miss(){ } - void AddElement(DWORD){ } - void ReleaseElement(DWORD){ } - DWORD GetHitCount(){ return 0; } - DWORD GetMissCount(){ return 0; } - DWORD GetCurrentAllocSize(){ return 0; } - DWORD GetMaxAllocSize(){ return 0; } - DWORD GetCurrentEntryCount(){ return 0; } - DWORD GetMaxEntryCount(){ return 0; } - void ResetCounters(){ } -}; // CNoStatClass - -// -//CPerfStatClass -// Description -// This class provides the implementation of a cache statistics gathering class -// with PerfMon support -class CPerfStatClass : public CStdStatClass -{ - CPerfStatObject * m_pPerfObject; - CCachePerfMon m_PerfMon; - -public: - - HRESULT Initialize(__in_z_opt LPWSTR szName=NULL) - { - HRESULT hr; - WCHAR szPath[MAX_PATH]; - - if (!szName) - { - // default name is the name of the module - // we don't care about possible truncation if longer than max_path - // we just need an identifier - HINSTANCE hInst = _AtlBaseModule.GetModuleInstance(); - if (::GetModuleFileNameW(hInst, szPath, MAX_PATH) == 0) - { - return E_FAIL; - } - szPath[MAX_PATH-1] = 0; - szName = szPath; - } - - m_pPerfObject = NULL; - ATLTRACE(atlTraceCache, 2, _T("Initializing m_PerfMon\n")); - hr = m_PerfMon.Initialize(); - if (SUCCEEDED(hr)) - { - CPerfLock lock(&m_PerfMon); - if (FAILED(hr = lock.GetStatus())) - { - return hr; - } - - hr = m_PerfMon.CreateInstance(ATL_PERF_CACHE_OBJECT, 0, szName, reinterpret_cast(&m_pPerfObject)); - if (FAILED(hr)) - { - return hr; - } - - CStdStatClass::Initialize(m_pPerfObject); - } - else - ATLASSUME(m_pPerfObject == NULL); - - return hr; - } - - HRESULT Uninitialize() - { - CStdStatClass::Uninitialize(); - - if (m_pPerfObject != NULL) // Initialized m_pPerfObject successfully above - { - HRESULT hr = m_PerfMon.ReleaseInstance(m_pPerfObject); - if (hr != S_OK) - return hr; - - m_PerfMon.UnInitialize(); - } - - return S_OK; - } -}; // CPerfStatClass - -#ifndef ATL_BLOB_CACHE_TIMEOUT -#ifdef _DEBUG -#define ATL_BLOB_CACHE_TIMEOUT 1000 -#else -#define ATL_BLOB_CACHE_TIMEOUT 5000 -#endif // _DEBUG -#endif // ATL_BLOB_CACHE_TIMEOUT - -// -//CBlobCache -// Description: -// Implements a cache that stores pointers to void. Uses the generic CMemoryCacheBase class -// as the implementation. -template -class CBlobCache : public CMemoryCache, SyncObj, CullClass>, - public IMemoryCache, - public IMemoryCacheControl, - public IMemoryCacheStats, - public IWorkerThreadClient -{ - typedef CMemoryCache, SyncObj, CullClass> cacheBase; - - MonitorClass m_Monitor; - -protected: - HANDLE m_hTimer; - -public: - CBlobCache() : m_hTimer(NULL) - { - } - - HRESULT Initialize(IServiceProvider *pProv) - { - HRESULT hr = cacheBase::Initialize(pProv); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(ATL_BLOB_CACHE_TIMEOUT, - static_cast(this), (DWORD_PTR) this, &m_hTimer); - } - - template - HRESULT Initialize(IServiceProvider *pProv, CWorkerThread *pWorkerThread) - { - ATLASSERT(pWorkerThread); - - HRESULT hr = cacheBase::Initialize(pProv); - if (FAILED(hr)) - return hr; - - hr = m_Monitor.Initialize(pWorkerThread); - if (FAILED(hr)) - return hr; - - return m_Monitor.AddTimer(ATL_BLOB_CACHE_TIMEOUT, - static_cast(this), (DWORD_PTR) this, &m_hTimer); - } - - HRESULT Execute(DWORD_PTR dwParam, HANDLE /*hObject*/) - { - CBlobCache* pCache = (CBlobCache*)dwParam; - - if (pCache) - pCache->Flush(); - return S_OK; - } - - HRESULT CloseHandle(HANDLE hObject) - { - ATLASSUME(m_hTimer == hObject); - m_hTimer = NULL; - ::CloseHandle(hObject); - return S_OK; - } - - virtual ~CBlobCache() - { - if (m_hTimer) - { - ATLENSURE(SUCCEEDED(m_Monitor.RemoveHandle(m_hTimer))); - } - } - - HRESULT Uninitialize() - { - HRESULT hrMonitor=S_OK; - if (m_hTimer) - { - hrMonitor=m_Monitor.RemoveHandle(m_hTimer); - m_hTimer = NULL; - } - HRESULT hrShut=m_Monitor.Shutdown(); - HRESULT hrCache=cacheBase::Uninitialize(); - if(FAILED(hrMonitor)) - { - return hrMonitor; - } - if(FAILED(hrShut)) - { - return hrShut; - } - return hrCache; - } - // IUnknown methods - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv) - { - HRESULT hr = E_NOINTERFACE; - if (!ppv) - hr = E_POINTER; - else - { - if (InlineIsEqualGUID(riid, __uuidof(IUnknown)) || - InlineIsEqualGUID(riid, __uuidof(IMemoryCache))) - { - *ppv = (IUnknown *) (IMemoryCache *) this; - AddRef(); - hr = S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IMemoryCacheStats))) - { - *ppv = (IUnknown *) (IMemoryCacheStats*)this; - AddRef(); - hr = S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IMemoryCacheControl))) - { - *ppv = (IUnknown *) (IMemoryCacheControl*)this; - AddRef(); - hr = S_OK; - } - - } - return hr; - } - - ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - - // IMemoryCache Methods - HRESULT STDMETHODCALLTYPE Add(LPCSTR szKey, void *pvData, DWORD dwSize, - FILETIME *pftExpireTime, - HINSTANCE hInstClient, - HCACHEITEM *phEntry, - IMemoryCacheClient *pClient) - { - HRESULT hr = E_FAIL; - //if it's a multithreaded cache monitor we'll let the monitor take care of - //cleaning up the cache so we don't overflow our configuration settings. - //if it's not a threaded cache monitor, we need to make sure we don't - //overflow the configuration settings by adding a new element - if (m_Monitor.GetThreadHandle()==NULL) - { - if (!cacheBase::CanAddEntry(dwSize)) - { - //flush the entries and check again to see if we can add - cacheBase::FlushEntries(); - if (!cacheBase::CanAddEntry(dwSize)) - return E_OUTOFMEMORY; - } - } - _ATLTRY - { - hr = cacheBase::AddEntry(szKey, pvData, dwSize, - pftExpireTime, hInstClient, pClient, phEntry); - return hr; - } - _ATLCATCHALL() - { - return E_FAIL; - } - } - - HRESULT STDMETHODCALLTYPE LookupEntry(LPCSTR szKey, HCACHEITEM * phEntry) - { - return cacheBase::LookupEntry(szKey, phEntry); - } - - HRESULT STDMETHODCALLTYPE GetData(const HCACHEITEM hKey, void **ppvData, DWORD *pdwSize) const - { - return cacheBase::GetEntryData(hKey, ppvData, pdwSize); - } - - HRESULT STDMETHODCALLTYPE ReleaseEntry(const HCACHEITEM hKey) - { - return cacheBase::ReleaseEntry(hKey); - } - - HRESULT STDMETHODCALLTYPE RemoveEntry(const HCACHEITEM hKey) - { - return cacheBase::RemoveEntry(hKey); - } - - HRESULT STDMETHODCALLTYPE RemoveEntryByKey(LPCSTR szKey) - { - return cacheBase::RemoveEntryByKey(szKey); - } - - HRESULT STDMETHODCALLTYPE Flush() - { - return cacheBase::FlushEntries(); - } - - - HRESULT STDMETHODCALLTYPE SetMaxAllowedSize(DWORD dwSize) - { - return cacheBase::SetMaxAllowedSize(dwSize); - } - - HRESULT STDMETHODCALLTYPE GetMaxAllowedSize(DWORD *pdwSize) - { - return cacheBase::GetMaxAllowedSize(pdwSize); - } - - HRESULT STDMETHODCALLTYPE SetMaxAllowedEntries(DWORD dwSize) - { - return cacheBase::SetMaxAllowedEntries(dwSize); - } - - HRESULT STDMETHODCALLTYPE GetMaxAllowedEntries(DWORD *pdwSize) - { - return cacheBase::GetMaxAllowedEntries(pdwSize); - } - - HRESULT STDMETHODCALLTYPE ResetCache() - { - return cacheBase::ResetCache(); - } - - // IMemoryCacheStats methods - HRESULT STDMETHODCALLTYPE ClearStats() - { - m_statObj.ResetCounters(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetHitCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetHitCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMissCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMissCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxAllocSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMaxAllocSize(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetCurrentAllocSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetCurrentAllocSize(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxEntryCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMaxEntryCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetCurrentEntryCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetCurrentEntryCount(); - return S_OK; - } - -}; // CBlobCache - - -// -// CDllCache -// This class manages a cache to handle calls to LoadLibrary -// and FreeLibrary. -// It keeps dlls loaded even after the last call to free library -// a worker thread then calls FreeLibrary on unused dlls -// -#ifndef ATL_DLL_CACHE_TIMEOUT - #ifdef _DEBUG - #define ATL_DLL_CACHE_TIMEOUT 1000 // 1 sec default for debug builds - #else - #define ATL_DLL_CACHE_TIMEOUT 10*60000 // 10 minute default for retail builds - #endif -#endif - -class CNoDllCachePeer -{ -public: - struct DllInfo - { - }; - - BOOL Add(HINSTANCE /*hInst*/, DllInfo * /*pInfo*/) - { - return TRUE; - } - - void Remove(HINSTANCE /*hInst*/, DllInfo * /*pInfo*/) - { - } -}; - -// CDllCache -// Implements IDllCache, an interface that is used to load and unload Dlls. -// To use it, construct an instance of a CDllCache and call Initialize. -// The Initialize call has to match with the type of monitor class you -// templatize on. The monitor thread will call IWorkerThreadClient::Execute -// after its timeout expires. Make sure to Uninitialize the object before -// it is destroyed by calling Uninitialize -// -template -class CDllCache : public IDllCache, - public IWorkerThreadClient -{ -protected: - CComCriticalSection m_critSec; - CSimpleArray m_Dlls; - CSimpleArray m_DllInfos; - MonitorClass m_Monitor; - HANDLE m_hTimer; - - void RemoveDllEntry(DLL_CACHE_ENTRY& entry) - { - ::FreeLibrary(entry.hInstDll); - entry.hInstDll = NULL; - m_Dlls.RemoveAt(m_Dlls.GetSize()-1); - } - -public: - Peer m_Peer; - - CDllCache() : - m_hTimer(NULL) - { - - } - - HRESULT Initialize(DWORD dwTimeout=ATL_DLL_CACHE_TIMEOUT) - { - HRESULT hr = m_critSec.Init(); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(dwTimeout, this, 0, &m_hTimer); - } - - template - HRESULT Initialize(CWorkerThread *pWorkerThread, - DWORD dwTimeout=ATL_DLL_CACHE_TIMEOUT) - { - HRESULT hr = m_critSec.Init(); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(pWorkerThread); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(dwTimeout, this, 0, &m_hTimer); - } - - HRESULT Uninitialize() - { - HRESULT hr = S_OK; - HRESULT hrLatest = S_OK; - if (m_hTimer) - { - hrLatest=m_Monitor.RemoveHandle(m_hTimer); - if(FAILED(hrLatest) && SUCCEEDED(hr)) - { - hr=hrLatest; - } - m_hTimer = NULL; - } - m_Monitor.Shutdown(); - - // free all the libraries we've cached - int nLen = m_Dlls.GetSize(); - for (int i=0; i 0); - entry.bAlive = TRUE; - entry.dwRefs--; - m_critSec.Unlock(); - return TRUE; - } - } - - m_critSec.Unlock(); - // the dll wasn't found - // in the cache, so just - // pass along to ::FreeLibrary - return ::FreeLibrary(hInstDll); - } - - BOOL AddRefModule(HINSTANCE hInstDll) - { - HRESULT hr = m_critSec.Lock(); - if (FAILED(hr)) - return FALSE; - - int nLen = m_Dlls.GetSize(); - for (int i=0; i 0); - entry.dwRefs++; - m_critSec.Unlock(); - return TRUE; - } - } - - m_critSec.Unlock(); - return FALSE; - } - - BOOL ReleaseModule(HINSTANCE hInstDll) - { - HRESULT hr = m_critSec.Lock(); - if (FAILED(hr)) - return FALSE; - - int nLen = m_Dlls.GetSize(); - for (int i=0; i 0); - entry.bAlive = TRUE; - entry.dwRefs--; - m_critSec.Unlock(); - return TRUE; - } - } - m_critSec.Unlock(); - return FALSE; - } - - HRESULT GetEntries(DWORD dwCount, DLL_CACHE_ENTRY *pEntries, DWORD *pdwCopied) - { - if (!pdwCopied) - return E_POINTER; - - HRESULT hr = m_critSec.Lock(); - if (FAILED(hr)) - return hr; - - if (dwCount==0 || pEntries==NULL) - { - // just return the required size - *pdwCopied = m_Dlls.GetSize(); - m_critSec.Unlock(); - return S_OK; - } - - if (dwCount > (DWORD) m_Dlls.GetSize()) - dwCount = m_Dlls.GetSize(); - Checked::memcpy_s(pEntries, dwCount*sizeof(DLL_CACHE_ENTRY), m_Dlls.GetData(), dwCount*sizeof(DLL_CACHE_ENTRY)); - *pdwCopied = dwCount; - m_critSec.Unlock(); - return S_OK; - } - - HRESULT Flush() - { - HRESULT hr = m_critSec.Lock(); - if (FAILED(hr)) - return hr; - - int nLen = m_Dlls.GetSize(); - for (int i=0; i -class CStencilCache : - public CMemoryCacheBase, void *, CCacheDataEx, - CFixedStringKey, CStringElementTraitsI, - FlushClass, CullClass, SyncClass, StatClass>, - public IStencilCache, - public IStencilCacheControl, - public IWorkerThreadClient, - public IMemoryCacheStats, - public CComObjectRootEx -{ -protected: - typedef CMemoryCacheBase, void *, CCacheDataEx, - CFixedStringKey, CStringElementTraitsI, - FlushClass, CullClass, SyncClass, StatClass> cacheBase; - unsigned __int64 m_dwdwStencilLifespan; - - MonitorClass m_Monitor; - HANDLE m_hTimer; - CComPtr m_spDllCache; - -public: - - CStencilCache() : - m_dwdwStencilLifespan(ATL_STENCIL_LIFESPAN), - m_hTimer(NULL) - { - - } - - ~CStencilCache() - { - if (m_hTimer) - { - ATLENSURE(SUCCEEDED(m_Monitor.RemoveHandle(m_hTimer))); - } - } - - HRESULT Execute(DWORD_PTR dwParam, HANDLE /*hObject*/) - { - CStencilCache* pCache = (CStencilCache*)dwParam; - if (pCache) - pCache->FlushEntries(); - return S_OK; - } - - HRESULT CloseHandle(HANDLE hObject) - { - ATLASSUME(m_hTimer == hObject); - m_hTimer = NULL; - ::CloseHandle(hObject); - return S_OK; - } - - HRESULT Initialize(IServiceProvider *pProv, DWORD dwStencilCacheTimeout=ATL_STENCIL_CACHE_TIMEOUT, - __int64 dwdwStencilLifespan=ATL_STENCIL_LIFESPAN) - { - m_dwdwStencilLifespan = dwdwStencilLifespan; - HRESULT hr = cacheBase::Initialize(); - if (FAILED(hr)) - return hr; - hr = E_FAIL; - if (pProv) - hr = pProv->QueryService(__uuidof(IDllCache), __uuidof(IDllCache), (void**)&m_spDllCache); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(dwStencilCacheTimeout, this, (DWORD_PTR) this, &m_hTimer); - } - - template - HRESULT Initialize(IServiceProvider *pProv, CWorkerThread *pWorkerThread, - DWORD dwStencilCacheTimeout=ATL_STENCIL_CACHE_TIMEOUT, __int64 dwdwStencilLifespan=ATL_STENCIL_LIFESPAN) - { - m_dwdwStencilLifespan = dwdwStencilLifespan; - HRESULT hr = cacheBase::Initialize(); - if (FAILED(hr)) - return hr; - hr = E_FAIL; - if (pProv) - hr = pProv->QueryService(__uuidof(IDllCache), __uuidof(IDllCache), (void**)&m_spDllCache); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(pWorkerThread); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(dwStencilCacheTimeout, this, (DWORD_PTR) this, &m_hTimer); - } - - - BEGIN_COM_MAP(CStencilCache) - COM_INTERFACE_ENTRY(IMemoryCacheStats) - COM_INTERFACE_ENTRY(IStencilCache) - COM_INTERFACE_ENTRY(IStencilCacheControl) - END_COM_MAP() -//IStencilCache methods - STDMETHOD(CacheStencil)(LPCSTR szName, void *pStencil, DWORD dwSize, HCACHEITEM *phEntry, - HINSTANCE hInstance, IMemoryCacheClient *pClient) - { - NodeType * pEntry = NULL; - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - return hr; - - _ATLTRY - { - hr = cacheBase::AddEntry(szName, pStencil, dwSize, (HCACHEITEM *)&pEntry); - } - _ATLCATCHALL() - { - hr = E_FAIL; - } - if (hr != S_OK) - { - m_syncObj.Unlock(); - return hr; - } - - pEntry->hInstance = hInstance; - pEntry->pClient = pClient; - pEntry->nLifespan = m_dwdwStencilLifespan; - if (hInstance && m_spDllCache) - m_spDllCache->AddRefModule(hInstance); - - cacheBase::CommitEntry(static_cast(pEntry)); - - if (phEntry) - *phEntry = static_cast(pEntry); - else - cacheBase::ReleaseEntry(static_cast(pEntry)); - - m_syncObj.Unlock(); - return hr; - } - - STDMETHOD(LookupStencil)(LPCSTR szName, HCACHEITEM * phStencil) - { - return cacheBase::LookupEntry(szName, phStencil); - } - - STDMETHOD(GetStencil)(const HCACHEITEM hStencil, void ** pStencil) const - { - return cacheBase::GetEntryData(hStencil, pStencil, NULL); - } - - STDMETHOD(AddRefStencil)(const HCACHEITEM hStencil) - { - return cacheBase::AddRefEntry(hStencil); - } - - STDMETHOD(ReleaseStencil)(const HCACHEITEM hStencil) - { - return cacheBase::ReleaseEntry(hStencil); - } - - //IStencilCacheControl - - STDMETHOD(RemoveStencil)(const HCACHEITEM hStencil) - { - return cacheBase::RemoveEntry(hStencil); - } - - STDMETHOD(RemoveStencilByName)(LPCSTR szStencil) - { - return cacheBase::RemoveEntryByKey(szStencil); - } - - STDMETHOD(RemoveAllStencils)() - { - return cacheBase::RemoveAllEntries(); - } - - STDMETHOD(SetDefaultLifespan)(unsigned __int64 dwdwLifespan) - { - m_dwdwStencilLifespan = dwdwLifespan; - return S_OK; - } - - STDMETHOD(GetDefaultLifespan)(unsigned __int64 *pdwdwLifepsan) - { - HRESULT hr = E_POINTER; - if (pdwdwLifepsan) - { - *pdwdwLifepsan = m_dwdwStencilLifespan; - hr = S_OK; - } - return hr; - } - - virtual void OnDestroyEntry(const NodeType * pEntry) - { - ATLASSERT(pEntry); - if (!pEntry) - return; - - if (pEntry->pClient) - pEntry->pClient->Free((void *)&pEntry->Data); - if (pEntry->hInstance && m_spDllCache) - m_spDllCache->ReleaseModule(pEntry->hInstance); - } - - HRESULT Uninitialize() - { - HRESULT hrMonitor=S_OK; - if (m_hTimer) - { - hrMonitor=m_Monitor.RemoveHandle(m_hTimer); - m_hTimer = NULL; - } - m_Monitor.Shutdown(); - HRESULT hrCache=cacheBase::Uninitialize(); - if(FAILED(hrMonitor)) - { - return hrMonitor; - } - return hrCache; - } - // IMemoryCacheStats methods - HRESULT STDMETHODCALLTYPE ClearStats() - { - m_statObj.ResetCounters(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetHitCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetHitCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMissCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMissCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxAllocSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMaxAllocSize(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetCurrentAllocSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetCurrentAllocSize(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxEntryCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMaxEntryCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetCurrentEntryCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetCurrentEntryCount(); - return S_OK; - } -}; // CStencilCache - -// {105A8866-4059-45fe-86AE-FA0EABBFBBB4} -extern "C" __declspec(selectany) const IID IID_IFileCache = { 0x105a8866, 0x4059, 0x45fe, { 0x86, 0xae, 0xfa, 0xe, 0xab, 0xbf, 0xbb, 0xb4 } }; - -__interface ATL_NO_VTABLE __declspec(uuid("105A8866-4059-45fe-86AE-FA0EABBFBBB4")) - IFileCache : public IUnknown -{ - // IFileCache Methods - - STDMETHOD(AddFile)( - LPCSTR szFileName, - LPCSTR szTempFileName, - FILETIME *pftExpireTime, - void *pPeerInfo, - HCACHEITEM * phKey); - STDMETHOD(LookupFile)(LPCSTR szFileName, HCACHEITEM * phKey); - STDMETHOD(GetFile)(const HCACHEITEM hKey, LPSTR * pszFileName, void **ppPeerInfo); - STDMETHOD(ReleaseFile)(const HCACHEITEM hKey); - STDMETHOD(RemoveFile)(const HCACHEITEM hKey); - STDMETHOD(RemoveFileByName)(LPCSTR szFileName); - STDMETHOD(Flush)(); -}; - -#ifndef ATL_FILE_CACHE_TIMEOUT - #define ATL_FILE_CACHE_TIMEOUT 1000 -#endif - -class CNoFileCachePeer -{ -public: - struct PeerInfo - { - }; - - static BOOL Add(PeerInfo* /*pDest*/, PeerInfo * /*pSrc*/) - { - return TRUE; - } - - static BOOL Remove(const PeerInfo* /*pFileInfo*/) - { - return TRUE; - } -}; - -template -struct CCacheDataPeer : public CCacheDataBase -{ - typename Peer::PeerInfo PeerData; -}; - -// A class to keep track of files, with maintenance -- maximum size of cache, -// maximum number of entries, expiration of entries, etc. -- inherits from -// CMemoryCacheBase -template < - class MonitorClass, - class StatClass=CStdStatClass, - class FileCachePeer=CNoFileCachePeer, - class FlushClass=COldFlusher, - class SyncClass=CComCriticalSection, - class CullClass=CExpireCuller > -class CFileCache: - public CMemoryCacheBase, LPSTR, CCacheDataPeer, - CFixedStringKey, CStringElementTraits, - FlushClass, CullClass, SyncClass, StatClass>, - public IWorkerThreadClient, - public IFileCache, - public IMemoryCacheControl, - public IMemoryCacheStats -{ - typedef CMemoryCacheBase, LPSTR, CCacheDataPeer, - CFixedStringKey, CStringElementTraits, - FlushClass, CullClass, SyncClass, StatClass> cacheBase; - - MonitorClass m_Monitor; - -protected: - HANDLE m_hTimer; - -public: - - CFileCache() : m_hTimer(NULL) - { - } - - HRESULT Initialize() - { - HRESULT hr = cacheBase::Initialize(); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(ATL_FILE_CACHE_TIMEOUT, - static_cast(this), (DWORD_PTR) this, &m_hTimer); - } - - template - HRESULT Initialize(CWorkerThread *pWorkerThread) - { - ATLASSERT(pWorkerThread); - - HRESULT hr = cacheBase::Initialize(); - if (FAILED(hr)) - return hr; - hr = m_Monitor.Initialize(pWorkerThread); - if (FAILED(hr)) - return hr; - return m_Monitor.AddTimer(ATL_FILE_CACHE_TIMEOUT, - static_cast(this), (DWORD_PTR) this, &m_hTimer); - } - - - // Callback for CWorkerThread - HRESULT Execute(DWORD_PTR dwParam, HANDLE /*hObject*/) - { - CFileCache* pCache = (CFileCache*)dwParam; - - if (pCache) - pCache->Flush(); - return S_OK; - } - - HRESULT CloseHandle(HANDLE hObject) - { - ATLASSUME(m_hTimer == hObject); - m_hTimer = NULL; - ::CloseHandle(hObject); - return S_OK; - } - - ~CFileCache() - { - if (m_hTimer) - { - ATLENSURE(SUCCEEDED(m_Monitor.RemoveHandle(m_hTimer))); - m_hTimer = NULL; - } - } - - HRESULT Uninitialize() - { - HRESULT hrMonitor=S_OK; - if (m_hTimer) - { - hrMonitor=m_Monitor.RemoveHandle(m_hTimer); - m_hTimer = NULL; - } - m_Monitor.Shutdown(); - HRESULT hrCache=cacheBase::Uninitialize(); - if(FAILED(hrMonitor)) - { - return hrMonitor; - } - return hrCache; - } - - - // IUnknown methods - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv) - { - HRESULT hr = E_NOINTERFACE; - if (!ppv) - hr = E_POINTER; - else - { - if (InlineIsEqualGUID(riid, __uuidof(IUnknown)) || - InlineIsEqualGUID(riid, __uuidof(IFileCache))) - { - *ppv = (IUnknown *) (IFileCache *) this; - AddRef(); - hr = S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IMemoryCacheStats))) - { - *ppv = (IMemoryCacheStats*)this; - AddRef(); - hr = S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IMemoryCacheControl))) - { - *ppv = (IMemoryCacheControl*)this; - AddRef(); - hr = S_OK; - } - - } - return hr; - } - - ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - - // Adds a file to the cache. A file is created with a - // temporary name, and then Add is called with the temp - // file name and the final file name, along with expiration data, - // etc. A search on the file name will return the name of - // the file on disk (i.e. the temporary file) - HRESULT STDMETHODCALLTYPE AddFile( - LPCSTR szFileName, - LPCSTR szTempFileName, - FILETIME *pftExpireTime, - void* pPeerInfo, - HCACHEITEM * phKey = NULL) - { - WIN32_FILE_ATTRIBUTE_DATA fadData; - BOOL bRet = GetFileAttributesExA(szTempFileName, GetFileExInfoStandard, &fadData); - if (!bRet) - return AtlHresultFromLastError(); - - __int64 ddwFileSize = (static_cast<__int64>(fadData.nFileSizeHigh) << 32) + fadData.nFileSizeLow; - - DWORD dwRecordedFileSize = (DWORD) (ddwFileSize >> 10); - // Round the file size up to 1K if it is < 1K - if (dwRecordedFileSize == 0) - dwRecordedFileSize = 1; - - if (m_Monitor.GetThreadHandle()==NULL) - { - if (!cacheBase::CanAddEntry(dwRecordedFileSize)) - { - cacheBase::FlushEntries(); - if (!cacheBase::CanAddEntry(dwRecordedFileSize)) - return E_OUTOFMEMORY; - } - } - - NodeType *pEntry = NULL; - HRESULT hr = m_syncObj.Lock(); - if (FAILED(hr)) - return hr; - - hr = E_FAIL; - - // Make a private copy of the file name - CHeapPtr szTempFileCopy; - if (szTempFileCopy.Allocate(MAX_PATH)) - { - if (strlen(szTempFileName) >= MAX_PATH) - { - m_syncObj.Unlock(); - return E_FAIL; - } - Checked::strncpy_s(szTempFileCopy, MAX_PATH, szTempFileName, _TRUNCATE); - - _ATLTRY - { - hr = cacheBase::AddEntry(szFileName, szTempFileCopy, dwRecordedFileSize, (HCACHEITEM*)&pEntry); - szTempFileCopy.Detach(); - } - _ATLCATCHALL() - { - hr = E_FAIL; - } - } - - if (hr != S_OK) - { - m_syncObj.Unlock(); - return hr; - } - - - hr = (TRUE == FileCachePeer::Add(&pEntry->PeerData, - static_cast(pPeerInfo)) ? S_OK : E_FAIL); - if (hr == S_OK) - hr = cacheBase::CommitEntry(static_cast(pEntry)); - - if (hr != S_OK) - { - cacheBase::RemoveEntry(static_cast(pEntry)); - m_syncObj.Unlock(); - return hr; - } - - - if (pftExpireTime) - pEntry->cftExpireTime = *pftExpireTime; - - if (phKey) - *phKey = static_cast(pEntry); - else - cacheBase::ReleaseEntry(pEntry); - - m_syncObj.Unlock(); - return hr; - } - - // Action to take when the entry is removed from the cache - virtual void OnDestroyEntry(const NodeType * pEntry) - { - ATLASSERT(pEntry); - if (!pEntry) - return; - FileCachePeer::Remove(&pEntry->PeerData); - if (pEntry->Data) - { - DeleteFileA(pEntry->Data); - free(pEntry->Data); - const_cast(pEntry)->Data = NULL; - } - } - - // Looks up a file by name. Must be released after use - HRESULT STDMETHODCALLTYPE LookupFile(LPCSTR szFileName, HCACHEITEM * phKey) - { - return cacheBase::LookupEntry(szFileName, phKey); - } - - // Gets the name of the file on disk - HRESULT STDMETHODCALLTYPE GetFile(__in const HCACHEITEM hKey, __deref_out_z_opt LPSTR * pszFileName, __deref_out_opt void **ppPeerInfo) - { - NodeType *pEntry = (NodeType *)hKey; - if (ppPeerInfo) - *ppPeerInfo = &pEntry->PeerData; - return cacheBase::GetEntryData(hKey, pszFileName, NULL); - } - - // Releases a file - HRESULT STDMETHODCALLTYPE ReleaseFile(const HCACHEITEM hKey) - { - return cacheBase::ReleaseEntry(hKey); - } - - // Releases a file and marks it for deletion - HRESULT STDMETHODCALLTYPE RemoveFile(const HCACHEITEM hKey) - { - return cacheBase::RemoveEntry(hKey); - } - - // Removes a file by name -- this calls IMemoryCacheClient->Free - // on the file name, which by default (for CFileCache) deletes the - // file. - HRESULT STDMETHODCALLTYPE RemoveFileByName(LPCSTR szFileName) - { - return cacheBase::RemoveEntryByKey(szFileName); - } - - // Flushes the entries in the cache, eliminates expired entries, - // or if the cache exceeds the parameters (alloc size, num entries), - // culls items based on the sweep mode - HRESULT STDMETHODCALLTYPE Flush() - { - return cacheBase::FlushEntries(); - } - - // IMemoryCacheControl methods - HRESULT STDMETHODCALLTYPE SetMaxAllowedSize(DWORD dwSize) - { - return cacheBase::SetMaxAllowedSize(dwSize); - } - - HRESULT STDMETHODCALLTYPE GetMaxAllowedSize(DWORD *pdwSize) - { - return cacheBase::GetMaxAllowedSize(pdwSize); - } - - HRESULT STDMETHODCALLTYPE SetMaxAllowedEntries(DWORD dwSize) - { - return cacheBase::SetMaxAllowedEntries(dwSize); - } - - HRESULT STDMETHODCALLTYPE GetMaxAllowedEntries(DWORD *pdwSize) - { - return cacheBase::GetMaxAllowedEntries(pdwSize); - } - - HRESULT STDMETHODCALLTYPE ResetCache() - { - return cacheBase::ResetCache(); - } - - - // IMemoryCacheStats methods - HRESULT STDMETHODCALLTYPE ClearStats() - { - m_statObj.ResetCounters(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetHitCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetHitCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMissCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMissCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxAllocSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMaxAllocSize(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetCurrentAllocSize(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetCurrentAllocSize(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetMaxEntryCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetMaxEntryCount(); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetCurrentEntryCount(DWORD *pdwSize) - { - if (!pdwSize) - return E_POINTER; - *pdwSize = m_statObj.GetCurrentEntryCount(); - return S_OK; - } -}; // CFileCache - -class CDataConnection; // see atldbcli.h -__interface __declspec(uuid("52E7759B-D6CC-4a03-BDF3-80A6BDCA1F94")) -IDataSourceCache : public IUnknown -{ - // Method: Add - // Params: - // szConn: Connection string of data source to connect to - // ppDS: Out pointer to the newly added data source - // Comments: - // Attempts to open a connection to the specified data source - // using a CDataSource object. Once the connection is open, the - // CDatasource is cached. - STDMETHOD(Add)(LPCTSTR szID, LPCOLESTR szConn, CDataConnection *pDS); - - // Method: Remove - // Params: - // szConn: Specifies the connection string of the connection to close - // Comments: - // Closes the specified connection and removes it's entry from the cache - STDMETHOD(Remove)(LPCTSTR szID); - - // Method: Lookup - // Params: - // szConn: Specifies the connection string of the connection to look up - // ppDS: Out pointer to CDataSource object that is connected to the specified - // data source. - STDMETHOD(Lookup)(LPCTSTR szID, CDataConnection *pDS); - - // Method: Uninitialize - // Params: - // None - // Comments: - // Closes removes all connections from the cache. - STDMETHOD(Uninitialize)(); - -}; -#ifndef ATL_DS_CONN_STRING_LEN - #define ATL_DS_CONN_STRING_LEN 512 -#endif - -template <> -class CElementTraits< CDataConnection > : - public CElementTraitsBase< CDataConnection > -{ -public: - static ULONG Hash( INARGTYPE t ) - { - return( ULONG( ULONG_PTR( &t ) ) ); - } - - static bool CompareElements( INARGTYPE element1, INARGTYPE element2 ) - { - return( element1.m_session.m_spOpenRowset == element2.m_session.m_spOpenRowset); - } - - static int CompareElementsOrdered( INARGTYPE /*element1*/, INARGTYPE /*element2*/ ) - { - ATLASSERT(FALSE); - return -1; - } - -}; - -typedef CFixedStringT atlDataSourceKey; -typedef CAtlMap, CElementTraits > atlDataSourceCacheMap; - -template -class CDataSourceCache : - public IDataSourceCache, - public CComObjectRootEx -{ -public: - BEGIN_COM_MAP(CDataSourceCache) - COM_INTERFACE_ENTRY(IDataSourceCache) - END_COM_MAP() - - CDataSourceCache() - { - m_cs.Init(); - } - - virtual ~CDataSourceCache () - { - Uninitialize(); - } - - STDMETHOD(Uninitialize)() - { - HRESULT hr = m_cs.Lock(); - if (SUCCEEDED(hr)) - { - m_ConnectionMap.RemoveAll(); - m_cs.Unlock(); - } - - return hr; - } - - STDMETHOD(Add)(LPCTSTR szID, LPCOLESTR szConn, CDataConnection *pSession) - { - HRESULT hr = E_FAIL; - - if (!szID) - return E_INVALIDARG; // must have session name - - // Do a lookup to make sure we don't add multiple entries - // with the same name. Adding multiple entries with the same name - // could cause some entries to get orphaned. - hr = m_cs.Lock(); - if (FAILED(hr)) - { - return hr; - } - - const atlDataSourceCacheMap::CPair *pPair = - m_ConnectionMap.Lookup(szID); - if (!pPair) - { - // try to open connection - CDataConnection DS; - hr = DS.Open(szConn); - if (hr == S_OK) - { - _ATLTRY - { - if (m_ConnectionMap.SetAt(szID, DS)) - { - if (pSession) // we allow NULL here - *pSession = DS; // copy connection to output. - hr = S_OK; - } - else - hr = E_FAIL; // map add failed - } - _ATLCATCHALL() - { - hr = E_FAIL; - } - } - } - else // lookup succeeded, entry is already in cache - { - // Instead of opening a new connection, just copy - // the one we already have in the cache. - if (pSession) - *pSession = pPair->m_value; - hr = S_OK; - } - m_cs.Unlock(); - return hr; - } - - STDMETHOD(Remove)(LPCTSTR szID) - { - HRESULT hr = E_INVALIDARG; - if (!szID) - return hr; // must have session name - - hr = m_cs.Lock(); - if (SUCCEEDED(hr)) - { - hr = m_ConnectionMap.RemoveKey(szID) ? S_OK : E_FAIL; - m_cs.Unlock(); - } - - return hr; - } - - STDMETHOD(Lookup)(LPCTSTR szID, CDataConnection *pSession) - { - if (!szID||!pSession) - return E_POINTER; - - HRESULT hr = m_cs.Lock(); - bool bRet = true; - if (SUCCEEDED(hr)) - { - bRet = m_ConnectionMap.Lookup(szID, *pSession); - m_cs.Unlock(); - } - - return (bRet && (bool)*pSession)? hr : E_FAIL; - } - -protected: - atlDataSourceCacheMap m_ConnectionMap; - TCritSec m_cs; -}; - - -// Some helpers for using the datasource cache. -// -// Function: GetDataSource -// Params: -// pProvider: Pointer to IServiceProvider that provides the -// data source cache service -// szID: The name of the connection (can be same as szDS) -// szDS: OLEDB connection string for data source -// ppDS: Out pointer to CDataSource. The CDataSource will be connected -// to the OLEDB provider specified by szDS on successful return. -// RetVal: -// Returns S_OK on success. -static HRESULT ATL_NOINLINE GetDataSource(IServiceProvider *pProvider, - LPCTSTR szID, LPCOLESTR szConn, - CDataConnection *pSession) -{ - if (!pProvider || !szID || !szConn) - return E_POINTER; - - CComPtr spDSCache; - HRESULT hr; - hr = pProvider->QueryService(__uuidof(IDataSourceCache), __uuidof(IDataSourceCache), (void**)&spDSCache); - if (hr == S_OK && spDSCache) - { - hr = spDSCache->Add(szID, szConn, pSession); - } - return hr; -} - -// -// Function: RemoveDataSource -// Params: -// pProvider: Pointer to IServiceProvider that provides the -// data source cache service -// szID: Name of the datasource connection to remove from the cache -// RetVal: -// none -// Comments: -// Removes the datasource entry from the datasource cache. Since entries are -// copied to the client on calls to lookup and add, removing an entry will not -// release the connections of existing clients. -static HRESULT ATL_NOINLINE RemoveDataSource(IServiceProvider *pProvider, LPCTSTR szID) -{ - if (!pProvider || !szID) - return E_POINTER; - - CComPtr spDSCache; - HRESULT hr = pProvider->QueryService(__uuidof(IDataSourceCache), __uuidof(IDataSourceCache), (void**)&spDSCache); - if (spDSCache) - hr = spDSCache->Remove(szID); - return hr; -} - -} // namespace ATL -#pragma pack(pop) - -#pragma warning (pop) - -#endif // __ATLCACHE_H__ diff --git a/include/atl/atlcrypt.h b/include/atl/atlcrypt.h deleted file mode 100644 index 8e8ac7d4e..000000000 --- a/include/atl/atlcrypt.h +++ /dev/null @@ -1,376 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLCRYPT_H__ -#define __ATLCRYPT_H__ - -#pragma once - -#include -#include - - -#pragma pack(push,_ATL_PACKING) -namespace ATL -{ - -class CCryptKey; - -class CCryptProv -{ -protected: - HCRYPTPROV m_hProv; - -public: - CCryptProv() throw(); - CCryptProv( const CCryptProv& prov ) throw(); - explicit CCryptProv( HCRYPTPROV hProv, BOOL bTakeOwnership = FALSE ) throw(); - ~CCryptProv() throw(); - - CCryptProv& operator=( const CCryptProv& prov ) throw(); - - HRESULT AddRef() throw(); - void Attach( HCRYPTPROV hProv, BOOL bTakeOwnership = FALSE ) throw(); - HCRYPTPROV Detach() throw(); - HRESULT Release() throw(); - - - HRESULT Initialize(DWORD dwProviderType = PROV_RSA_FULL, - LPCTSTR szContainer = NULL, LPCTSTR szProvider = MS_DEF_PROV, - DWORD dwFlags = 0) throw(); - HRESULT InitVerifyContext(DWORD dwProviderType = PROV_RSA_FULL, - LPCTSTR szProvider = MS_DEF_PROV, DWORD dwFlags = 0) throw(); - HRESULT InitCreateKeySet(DWORD dwProviderType = PROV_RSA_FULL, - LPCTSTR szContainer = NULL, LPCTSTR szProvider = MS_DEF_PROV, - DWORD dwFlags = 0) throw(); - - HRESULT DeleteKeySet(DWORD dwProviderType = PROV_RSA_FULL, - LPCTSTR szContainer = NULL, LPCTSTR szProvider = MS_DEF_PROV, - DWORD dwFlags = 0) throw(); - - HRESULT Uninitialize(); - - HRESULT GetParam(DWORD dwParam, BYTE * pbData, DWORD * pdwDataLen, DWORD dwFlags = 0) throw(); - HRESULT SetParam( DWORD dwParam, BYTE* pbData, DWORD dwFlags = 0) throw(); - HRESULT GetName(__out_ecount_part_z(*pdwLength, *pdwLength) LPSTR szBuf, __inout DWORD * pdwLength) throw(); - HRESULT GetContainer(__out_ecount_part_z(*pdwLength, *pdwLength) LPSTR szBuf, __inout DWORD * pdwLength) throw(); - HRESULT GetImpType(DWORD * pdwImpType) throw(); - HRESULT GetVersion(DWORD * pdwVersion) throw(); - HRESULT GetProvType(DWORD * pdwType) throw(); - HRESULT GetSecurityDesc(SECURITY_INFORMATION * pSecInfo) throw(); - HRESULT SetSecurityDesc(SECURITY_INFORMATION SecInfo) throw(); - - HRESULT GenRandom(ULONG nLength, BYTE* pbBuffer ) throw(); - - inline HCRYPTPROV GetHandle() throw() - { - return m_hProv; - } -}; // class CCryptProv - - -// class CCryptHash -// Provides base functionality of hashes. -class CCryptHash -{ -protected: - HCRYPTHASH m_hHash; - -public: - CCryptHash() throw(); - CCryptHash( const CCryptHash& hash ) throw(); - explicit CCryptHash( HCRYPTHASH hHash, BOOL bTakeOwnership = FALSE ) throw(); - ~CCryptHash() throw(); - - void Attach( HCRYPTHASH hHash, BOOL bTakeOwnership = FALSE ) throw(); - void Destroy() throw(); - HCRYPTHASH Detach() throw(); - HCRYPTHASH Duplicate() const throw(); - - HRESULT Uninitialize() throw(); - HRESULT Detach(HCRYPTHASH * phHash) throw(); - HRESULT AddData(const BYTE * pbData, DWORD dwDataLen, DWORD dwFlags = 0) throw(); - HRESULT AddString(LPCTSTR szData, DWORD dwFlags = 0) throw(); - HRESULT GetParam(DWORD dwParam, BYTE * pbData, DWORD * pdwDataLen, DWORD dwFlags = 0) throw(); - HRESULT SetParam(DWORD dwParam, BYTE * pbData, DWORD dwFlags = 0) throw(); - HRESULT GetAlgId(ALG_ID * pAlgId) throw(); - HRESULT GetSize(DWORD * pdwSize) throw(); - HRESULT GetValue(BYTE * pBuf, DWORD * pdwSize) throw(); - HRESULT SetValue(BYTE * pBuf) throw(); - HRESULT Sign( - BYTE * pbSignature, - DWORD * pdwSigLen, - DWORD dwFlags = 0, - DWORD dwKeySpec = AT_SIGNATURE) throw(); - HRESULT VerifySignature( - const BYTE * pbSignature, - DWORD pdwSignLen, - CCryptKey &PubKey, - DWORD dwFlags = 0) throw(); - - inline HCRYPTHASH GetHandle() - { - return m_hHash; - } - static CCryptHash EmptyHash; - -}; // class CCryptHash - -// class CCryptKey -// Provides the functionality for cryptographic keys, i.e. encrypting, decrypting. -class CCryptKey -{ -protected: - HCRYPTKEY m_hKey; - -public: - CCryptKey() throw(); - CCryptKey( const CCryptKey& key ) throw(); - explicit CCryptKey( HCRYPTKEY hKey, BOOL bTakeOwnership = FALSE ) throw(); - ~CCryptKey() throw(); - - void Attach( HCRYPTKEY hKey, BOOL bTakeOwnership = FALSE ) throw(); - void Destroy() throw(); - HCRYPTKEY Detach() throw(); - HCRYPTKEY Duplicate() const throw(); - - HRESULT Uninitialize() throw(); - HRESULT Encrypt( - BOOL final, - BYTE * pbData, - DWORD * pdwDataLen, - DWORD dwBufLen, - CCryptHash &Hash = CCryptHash::EmptyHash) throw(); - - HRESULT Encrypt( - const BYTE * pbPlainText, - DWORD dwPlainTextLen, - BYTE * pbCipherText, - DWORD * pdwCipherTextLen, - CCryptHash &Hash = CCryptHash::EmptyHash) throw(); - - HRESULT Decrypt( - BOOL final, - BYTE * pbData, - DWORD * pdwDataLen, - CCryptHash &Hash = CCryptHash::EmptyHash) throw(); - HRESULT Decrypt( - const BYTE * pbCipherText, - DWORD dwCipherTextLen, - BYTE * pbPlainText, - DWORD * pdwPlainTextLen, - CCryptHash &Hash = CCryptHash::EmptyHash) throw(); - HRESULT EncryptString( - LPCTSTR szPlainText, - BYTE * pbCipherText, - DWORD * pdwCipherTextLen, - CCryptHash &Hash = CCryptHash::EmptyHash) throw(); - HRESULT ExportSimpleBlob( - CCryptKey &ExpKey, - DWORD dwFlags, - BYTE * pbData, - DWORD * pdwDataLen) throw(); - HRESULT ExportPublicKeyBlob( - CCryptKey &ExpKey, - DWORD dwFlags, - BYTE * pbData, - DWORD * pdwDataLen) throw(); - HRESULT ExportPrivateKeyBlob( - CCryptKey &ExpKey, - DWORD dwFlags, - BYTE * pbData, - DWORD * pdwDataLen) throw(); - HRESULT GetParam(DWORD dwParam, BYTE * pbData, DWORD * pdwDataLen, DWORD dwFlags = 0) throw(); - HRESULT SetParam(DWORD dwParam, BYTE * pbData, DWORD dwFlags = 0) throw(); - HRESULT GetAlgId(ALG_ID * pAlgId) throw(); - HRESULT SetAlgId(ALG_ID AlgId, DWORD dwFlags) throw(); - HRESULT GetBlockLength(DWORD * pdwBlockLen) throw(); - HRESULT GetKeyLength(DWORD * pdwKeyLen) throw(); - HRESULT GetSalt(BYTE * pbSalt, DWORD * pdwLength) throw(); - HRESULT SetSalt(BYTE * pbSalt) throw(); - HRESULT SetSaltEx(_CRYPTOAPI_BLOB * pBlobSalt) throw(); - HRESULT GetPermissions(DWORD * pdwPerms) throw(); - HRESULT SetPermissions(DWORD dwPerms) throw(); - HRESULT GetP(BYTE * pbP, DWORD * pdwLength) throw(); - HRESULT SetP(_CRYPTOAPI_BLOB * pBlobP) throw(); - HRESULT SetP(BYTE * pbP, DWORD dwLength) throw(); - HRESULT GetQ(BYTE * pbQ, DWORD * pdwLength) throw(); - HRESULT SetQ(_CRYPTOAPI_BLOB * pBlobQ) throw(); - HRESULT SetQ(BYTE * pbQ, DWORD dwLength) throw(); - HRESULT GetG(BYTE * pbG, DWORD * pdwLength) throw(); - HRESULT SetG(_CRYPTOAPI_BLOB * pBlobG) throw(); - HRESULT SetG(BYTE * pbG, DWORD dwLength) throw(); - HRESULT SetX() throw(); - HRESULT GetEffKeyLen(DWORD * pdwEffKeyLen) throw(); - HRESULT SetEffKeyLen(DWORD dwEffKeyLen) throw(); - HRESULT GetPadding(DWORD * pdwPadding) throw(); - HRESULT SetPadding(DWORD dwPadding) throw(); - HRESULT GetIV(BYTE * pbIV, DWORD * pdwLength) throw(); - HRESULT SetIV(BYTE * pbIV) throw(); - HRESULT GetMode(DWORD * pdwMode) throw(); - HRESULT SetMode(DWORD dwMode) throw(); - HRESULT GetModeBits(DWORD * pdwModeBits) throw(); - HRESULT SetModeBits(DWORD dwModeBits) throw(); - - inline HCRYPTKEY GetHandle() throw() - { - return m_hKey; - } - - static CCryptKey EmptyKey; -}; // class CCryptKey - - - -// Specific instances of Keys and Hashes - -// class CCryptDerivedKey -// A key that is derived from a hashed password. Two keys derived -// from the same password will be identical. -class CCryptDerivedKey : public CCryptKey -{ -public: - HRESULT Initialize( - CCryptProv &Prov, - CCryptHash &Hash, - ALG_ID algid = CALG_RC4, - DWORD dwFlags = CRYPT_EXPORTABLE) throw(); -}; // class CCryptDerivedKey - -// class CCryptRandomKey -// A randomly generated key. Can be used internally by a program -// to protect data during execution, or can be exported with Crypt.Export -// -// Currently it is possible to pass in AT_KEYEXCHANGE or AT_SIGNATURE -// for algid, but these two will generate keys for the current key set, and -// the resulting handle can only be used for exporting and importing keys or -// signing hashes. -class CCryptRandomKey : public CCryptKey -{ -public: - HRESULT Initialize( - CCryptProv &Prov, - ALG_ID algid = CALG_RC4, - DWORD dwFlags = CRYPT_EXPORTABLE) throw(); -}; // class CCryptRandomKey - -// class CCryptUserExKey -// Obtains the user's key exchange key pair. -class CCryptUserExKey : public CCryptKey -{ -public: - HRESULT Initialize(CCryptProv &Prov) throw(); - HRESULT Create(CCryptProv &Prov) throw(); -}; // class CCryptUserExKey - -// class CCryptUserSigKey -// Obtains the user's signature key pair -class CCryptUserSigKey : public CCryptKey -{ -public: - HRESULT Initialize(CCryptProv &Prov) throw(); - HRESULT Create(CCryptProv &Prov) throw(); -}; // class CCryptUserSigKey - -// class CCryptImportKey -// Forms a key from an imported key blob -class CCryptImportKey : public CCryptKey -{ -public: - HRESULT Initialize( - CCryptProv &Prov, - BYTE * pbData, - DWORD dwDataLen, - CCryptKey &PubKey, - DWORD dwFlags) throw(); -}; // class CCryptImportKey - - -// class CCryptHash -// A generic hash that may or may not take a key. -class CCryptKeyedHash : public CCryptHash -{ -public: - - HRESULT Initialize(CCryptProv &Prov, ALG_ID Algid, CCryptKey &Key, DWORD dwFlags) throw(); -}; // class CCryptKeyedHash - -// class CCryptMD5Hash -// RSA's MD5 hash (RSA's most recent hash as of 9/7/99); -class CCryptMD5Hash : public CCryptHash -{ -public: - - HRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw(); -}; // class CCryptMD5Hash - -// class CCryptMD4Hash -// RSA's MD4 hash -class CCryptMD4Hash : public CCryptHash -{ -public: - - HRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw(); -}; // class CCryptMD4Hash - - -// class CCryptMD2Hash -// RSA's MD2 hash -class CCryptMD2Hash : public CCryptHash -{ -public: - - HRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw(); -}; // class CCryptMD2Hash - - -// class CCryptSHAHash -// The Secure Hash Algorithm hash, from NIST and NSA. Technically, SHA-1. -class CCryptSHAHash : public CCryptHash -{ -public: - - HRESULT Initialize(CCryptProv &Prov, LPCTSTR szText = NULL) throw(); -}; // class CCryptSHAHash - -// The Secure Hash Algorithm, from NIST and NSA. Identical to CCryptSHA -typedef CCryptSHAHash CCryptSHA1Hash; - - -// class CCryptHMACHash -// Hash-base Message Authentication Code keyed hash -class CCryptHMACHash : public CCryptHash -{ -public: - HRESULT Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText = NULL) throw(); -}; // class CCryptHMACHash - -// class CCryptMACHash -// Message Authentication Code keyed hash. Believed to be less secure than HMAC -class CCryptMACHash : public CCryptHash -{ -public: - HRESULT Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText = NULL) throw(); -}; // class CCryptMACHash - -// class CCryptSSL3SHAMD5Hash -// Hash algorithm used by Secure Socket Layer -class CCryptSSL3SHAMD5Hash : public CCryptHash -{ -public: - HRESULT Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText = NULL) throw(); -}; // class CCryptSSl3SHAMD5Hash - -}; // namespace ATL - - -#include -#pragma pack(pop) -#endif // __ATLCRYPT_H__ diff --git a/include/atl/atlcrypt.inl b/include/atl/atlcrypt.inl deleted file mode 100644 index bfd119f87..000000000 --- a/include/atl/atlcrypt.inl +++ /dev/null @@ -1,1062 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - - -#ifndef __ATLCRYPT_INL__ -#define __ATLCRYPT_INL__ - -#pragma once - -#ifndef __ATLCRYPT_H__ - #error atlcrypt.inl requires atlcrypt.h to be included first -#endif - - -namespace ATL -{ - -inline CCryptProv::CCryptProv( const CCryptProv& prov ) throw() -{ - m_hProv = prov.m_hProv; - if (m_hProv) - AddRef(); -} - -inline CCryptProv::CCryptProv( HCRYPTPROV hProv, BOOL bTakeOwnership ) throw() -{ - m_hProv = hProv; - if (m_hProv && !bTakeOwnership) - AddRef(); -} - -inline CCryptProv::~CCryptProv() throw() -{ - Release(); -} - -inline CCryptProv& CCryptProv::operator=( const CCryptProv& prov ) throw() -{ - if(this!=&prov) - { - Release(); - - m_hProv = prov.m_hProv; - if( m_hProv != NULL ) - { - AddRef(); - } - } - return( *this ); -} - -inline HRESULT CCryptProv::AddRef() throw() -{ - ATLASSUME( m_hProv != NULL ); - - if (!CryptContextAddRef( m_hProv, NULL, 0)) - { - return AtlHresultFromLastError(); - } - return S_OK; -} - -inline void CCryptProv::Attach( HCRYPTPROV hProv, BOOL bTakeOwnership ) throw() -{ - ATLASSUME( m_hProv == NULL ); - - m_hProv = hProv; - if (m_hProv && !bTakeOwnership) - AddRef(); -} - -inline HCRYPTPROV CCryptProv::Detach() throw() -{ - HCRYPTPROV hProv; - - hProv = m_hProv; - m_hProv = NULL; - - return( hProv ); -} - - -inline CCryptProv::CCryptProv() throw() : - m_hProv( NULL ) -{ -} - -inline HRESULT CCryptProv::Release() throw() -{ - if( m_hProv != NULL ) - { - if (!CryptReleaseContext( m_hProv, 0 )) - { - return AtlHresultFromLastError(); - } - m_hProv = NULL; - } - return S_OK; -} - -inline HRESULT CCryptProv::Initialize( - DWORD dwProviderType, - LPCTSTR szContainer, - LPCTSTR szProvider, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hProv == NULL); - - if (!CryptAcquireContext(&m_hProv, szContainer, szProvider, dwProviderType, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptProv::InitVerifyContext( - DWORD dwProviderType, - LPCTSTR szProvider, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hProv == NULL); - - if (!CryptAcquireContext(&m_hProv, NULL, szProvider, dwProviderType, CRYPT_VERIFYCONTEXT | dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptProv::InitCreateKeySet( - DWORD dwProviderType, - LPCTSTR szContainer, - LPCTSTR szProvider, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hProv == NULL); - - if (!CryptAcquireContext(&m_hProv, szContainer, szProvider, dwProviderType, CRYPT_NEWKEYSET | dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptProv::DeleteKeySet( - DWORD dwProviderType, - LPCTSTR szContainer, - LPCTSTR szProvider, - DWORD dwFlags) throw() -{ - HCRYPTPROV hProv = NULL; - if (!CryptAcquireContext(&hProv, szContainer, szProvider, dwProviderType, CRYPT_DELETEKEYSET | dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - - -inline HRESULT CCryptProv::Uninitialize() throw() -{ - ATLASSUME(m_hProv != NULL); - - if (!CryptReleaseContext(m_hProv, 0)) - { - return AtlHresultFromLastError(); - } - else - { - m_hProv = NULL; - return S_OK; - } -} - -inline HRESULT CCryptProv::GetParam(DWORD dwParam, BYTE * pbData, DWORD * pdwDataLen, DWORD dwFlags) throw() -{ - ATLASSUME(m_hProv != NULL); - - if (!CryptGetProvParam(m_hProv, dwParam, pbData, pdwDataLen, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptProv::SetParam( DWORD dwParam, BYTE* pbData, DWORD dwFlags) throw() -{ - ATLASSUME(m_hProv != NULL); - - if (!CryptSetProvParam(m_hProv, dwParam, pbData, dwFlags )) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptProv::GetName(__out_bcount_part(*pdwLength, *pdwLength) LPSTR szBuf, __inout DWORD * pdwLength) throw() -{ - return GetParam(PP_NAME, (BYTE *)szBuf, pdwLength); -} - -inline HRESULT CCryptProv::GetContainer(__out_bcount_part(*pdwLength, *pdwLength) LPSTR szBuf, __inout DWORD * pdwLength) throw() -{ - return GetParam(PP_CONTAINER, (BYTE *)szBuf, pdwLength); -} - -inline HRESULT CCryptProv::GetImpType(DWORD * pdwImpType) throw() -{ - DWORD dwLength = sizeof(DWORD); - return GetParam(PP_IMPTYPE, (BYTE *)pdwImpType, &dwLength); -} - -inline HRESULT CCryptProv::GetVersion(DWORD * pdwVersion) throw() -{ - DWORD dwLength = sizeof(DWORD); - return GetParam(PP_VERSION, (BYTE *)pdwVersion, &dwLength); -} - -inline HRESULT CCryptProv::GetProvType(DWORD * pdwType) throw() -{ - DWORD dwLength = sizeof(DWORD); - return GetParam(PP_PROVTYPE, (BYTE * )pdwType, &dwLength); -} - -inline HRESULT CCryptProv::GetSecurityDesc(SECURITY_INFORMATION * pSecInfo) throw() -{ - DWORD dwSize = sizeof(SECURITY_INFORMATION); - return GetParam(PP_KEYSET_SEC_DESCR, (BYTE *)pSecInfo, &dwSize); -} - -inline HRESULT CCryptProv::SetSecurityDesc(SECURITY_INFORMATION SecInfo) throw() -{ - return SetParam(PP_KEYSET_SEC_DESCR, (BYTE *)&SecInfo); -} - -inline HRESULT CCryptProv::GenRandom(ULONG nLength, BYTE* pbBuffer ) throw() -{ - ATLASSUME(m_hProv != NULL); - - if (!CryptGenRandom( m_hProv, nLength, pbBuffer )) - { - return AtlHresultFromLastError(); - } - - return S_OK; -} - -inline CCryptHash::CCryptHash() throw() : - m_hHash( NULL ) -{ -} - -inline CCryptHash::CCryptHash( const CCryptHash& hash ) throw() -{ - m_hHash = hash.Duplicate(); -} - -inline CCryptHash::CCryptHash( HCRYPTHASH hHash, BOOL bTakeOwnership ) throw() -{ - if (bTakeOwnership) - m_hHash = hHash; - else - { - m_hHash = NULL; - BOOL bRet = ::CryptDuplicateHash( hHash, NULL, 0, &m_hHash ); - if (!bRet) - m_hHash = NULL; - } -} - -inline CCryptHash::~CCryptHash() throw() -{ - Destroy(); -} - -inline void CCryptHash::Attach( HCRYPTHASH hHash, BOOL bTakeOwnership ) throw() -{ - ATLASSUME( m_hHash == NULL ); - - if (bTakeOwnership) - m_hHash = hHash; - else - { - m_hHash = NULL; - BOOL bRet = ::CryptDuplicateHash( hHash, NULL, 0, &m_hHash ); - if (!bRet) - m_hHash = NULL; - } -} - -inline void CCryptHash::Destroy() throw() -{ - if( m_hHash != NULL ) - { - BOOL bSuccess; - - bSuccess = ::CryptDestroyHash( m_hHash ); - - // can fail if the cryptographic service provider - // (managed by CCryptProv) has already been destroyed - ATLASSERT( bSuccess ); - m_hHash = NULL; - } -} - -inline HCRYPTHASH CCryptHash::Detach() throw() -{ - HCRYPTHASH hHash; - - hHash = m_hHash; - m_hHash = NULL; - - return hHash; -} - -inline HCRYPTHASH CCryptHash::Duplicate() const throw() -{ - BOOL bSuccess; - HCRYPTHASH hHash; - - ATLASSUME( m_hHash != NULL ); - - hHash = NULL; - bSuccess = ::CryptDuplicateHash( m_hHash, NULL, 0, &hHash ); - if( !bSuccess ) - { - return NULL; - } - - return hHash; -} - -inline HRESULT CCryptHash::Uninitialize() throw() -{ - ATLASSUME(m_hHash != NULL); - - if (!CryptDestroyHash(m_hHash)) - { - return AtlHresultFromLastError(); - } - else - { - m_hHash = NULL; - return S_OK; - } -} - -inline HRESULT CCryptHash::Detach(HCRYPTHASH * phHash) throw() -{ - ATLASSERT(phHash); - if (!phHash) - return E_INVALIDARG; - - *phHash = m_hHash; - m_hHash = NULL; - - return S_OK; -} - -inline HRESULT CCryptHash::AddData(const BYTE * pbData, DWORD dwDataLen, DWORD dwFlags) throw() -{ - ATLASSUME(m_hHash != NULL); - - if (!CryptHashData(m_hHash, pbData, dwDataLen, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; - -} - -inline HRESULT CCryptHash::AddString(LPCTSTR szData, DWORD dwFlags) throw() -{ - return AddData((BYTE *)szData, (DWORD)_tcslen(szData) * sizeof(TCHAR), dwFlags); -} - -inline HRESULT CCryptHash::GetParam(DWORD dwParam, BYTE * pbData, DWORD * pdwDataLen, DWORD dwFlags) throw() -{ - ATLASSUME(m_hHash != NULL); - - if (!CryptGetHashParam(m_hHash, dwParam, pbData, pdwDataLen, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptHash::SetParam(DWORD dwParam, BYTE * pbData, DWORD dwFlags) throw() -{ - ATLASSUME(m_hHash != NULL); - - if (!CryptSetHashParam(m_hHash, dwParam, pbData, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptHash::GetAlgId(ALG_ID * pAlgId) throw() -{ - DWORD dwSize = sizeof(ALG_ID); - return GetParam(HP_ALGID, (BYTE *)pAlgId, &dwSize); -} - -inline HRESULT CCryptHash::GetSize(DWORD * pdwSize) throw() -{ - DWORD dwLength = sizeof(DWORD); - return GetParam(HP_HASHSIZE, (BYTE *)pdwSize, &dwLength); -} - -inline HRESULT CCryptHash::GetValue(BYTE * pBuf, DWORD * pdwSize) throw() -{ - return GetParam(HP_HASHVAL, pBuf, pdwSize); -} - -inline HRESULT CCryptHash::SetValue(BYTE * pBuf) throw() -{ - return SetParam(HP_HASHVAL, pBuf); -} - -inline HRESULT CCryptHash::Sign( - BYTE * pbSignature, - DWORD * pdwSigLen, - DWORD dwFlags, - DWORD dwKeySpec) throw() -{ - ATLASSUME(m_hHash != NULL); - - if (!CryptSignHash(m_hHash, dwKeySpec, NULL, dwFlags, pbSignature, pdwSigLen)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptHash::VerifySignature( - const BYTE * pbSignature, - DWORD dwSigLen, - CCryptKey &PubKey, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hHash != NULL); - - if (!CryptVerifySignature(m_hHash, pbSignature, dwSigLen, PubKey.GetHandle(), NULL, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -__declspec(selectany) CCryptHash CCryptHash::EmptyHash = CCryptHash(); -__declspec(selectany) CCryptKey CCryptKey::EmptyKey = CCryptKey(); -inline CCryptKey::CCryptKey() throw() : - m_hKey( NULL ) -{ -} - -inline CCryptKey::CCryptKey( const CCryptKey& key ) throw() -{ - m_hKey = key.Duplicate(); -} - -inline CCryptKey::CCryptKey( HCRYPTKEY hKey, BOOL bTakeOwnership ) throw() -{ - if (bTakeOwnership) - m_hKey = hKey; - else - { - BOOL bSuccess = ::CryptDuplicateKey( hKey, NULL, 0, &m_hKey ); - if( !bSuccess ) - m_hKey = NULL; - } -} - -inline CCryptKey::~CCryptKey() throw() -{ - Destroy(); -} - -inline void CCryptKey::Attach( HCRYPTKEY hKey, BOOL bTakeOwnership ) throw() -{ - ATLASSUME( m_hKey == NULL ); - if (bTakeOwnership) - m_hKey = hKey; - else - { - BOOL bSuccess = ::CryptDuplicateKey( hKey, NULL, 0, &m_hKey ); - if( !bSuccess ) - m_hKey = NULL; - } -} - -inline void CCryptKey::Destroy() throw() -{ - if( m_hKey != NULL ) - { - BOOL bSuccess; - - bSuccess = ::CryptDestroyKey( m_hKey ); - - // can fail if the cryptographic service provider - // (managed by CCryptProv) has already been destroyed - ATLASSERT( bSuccess ); - m_hKey = NULL; - } -} - -inline HCRYPTKEY CCryptKey::Detach() throw() -{ - HCRYPTKEY hKey; - - hKey = m_hKey; - m_hKey = NULL; - - return( hKey ); -} - -inline HCRYPTKEY CCryptKey::Duplicate() const throw() -{ - BOOL bSuccess; - - ATLASSUME( m_hKey != NULL ); - - HCRYPTKEY hKey = NULL; - bSuccess = ::CryptDuplicateKey( m_hKey, NULL, 0, &hKey ); - if( !bSuccess ) - return NULL; - - return hKey; -} - -inline HRESULT CCryptKey::Uninitialize() throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!CryptDestroyKey(m_hKey)) - { - return AtlHresultFromLastError(); - } - else - { - m_hKey = NULL; - return S_OK; - } -} - -inline HRESULT CCryptKey::Encrypt( - BOOL final, - BYTE * pbData, - DWORD * pdwDataLen, - DWORD dwBufLen, - CCryptHash &Hash) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!::CryptEncrypt(m_hKey, Hash.GetHandle(), final, 0, pbData, pdwDataLen, dwBufLen)) - { - return AtlHresultFromLastError(); - } - else return S_OK; - -} - -inline HRESULT CCryptKey::Decrypt(BOOL final, BYTE * pbData, DWORD * pdwDataLen, CCryptHash &Hash) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!::CryptDecrypt(m_hKey, Hash.GetHandle(), final, 0, pbData, pdwDataLen)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - - -inline HRESULT CCryptKey::Encrypt( - const BYTE * pbPlainText, - DWORD dwPlainTextLen, - BYTE * pbCipherText, - DWORD * pdwCipherTextLen, - CCryptHash &Hash) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (*pdwCipherTextLen < dwPlainTextLen) - return ERROR_MORE_DATA; - - Checked::memcpy_s(pbCipherText, dwPlainTextLen, pbPlainText, dwPlainTextLen); - DWORD dwSize = dwPlainTextLen; - if (!::CryptEncrypt(m_hKey, Hash.GetHandle(), TRUE, 0, pbCipherText, &dwSize, *pdwCipherTextLen)) - { - return AtlHresultFromLastError(); - } - - *pdwCipherTextLen = dwSize; - return S_OK; - -} - -inline HRESULT CCryptKey::Decrypt( - const BYTE * pbCipherText, - DWORD dwCipherTextLen, - BYTE * pbPlainText, - DWORD * pdwPlainTextLen, - CCryptHash &Hash) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (*pdwPlainTextLen < dwCipherTextLen) - return ERROR_MORE_DATA; - - Checked::memcpy_s(pbPlainText, dwCipherTextLen, pbCipherText, dwCipherTextLen); - DWORD dwSize = dwCipherTextLen; - if (!::CryptDecrypt(m_hKey, Hash.GetHandle(), TRUE, 0, pbPlainText, &dwSize)) - { - return AtlHresultFromLastError(); - } - - *pdwPlainTextLen = dwSize; - return S_OK; -} - -inline HRESULT CCryptKey::EncryptString( - LPCTSTR szPlainText, - BYTE * pbCipherText, - DWORD * pdwCipherTextLen, - CCryptHash &Hash) throw() -{ - DWORD dwSize = ((DWORD)_tcslen(szPlainText) + 1) * sizeof(TCHAR); - return Encrypt((BYTE *)szPlainText, dwSize, pbCipherText, pdwCipherTextLen, Hash); -} - -inline HRESULT CCryptKey::ExportSimpleBlob( - CCryptKey &ExpKey, - DWORD dwFlags, - BYTE * pbData, - DWORD * pdwDataLen) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!CryptExportKey(m_hKey, ExpKey.GetHandle(), SIMPLEBLOB, dwFlags, pbData, pdwDataLen)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptKey::ExportPublicKeyBlob( - CCryptKey &ExpKey, - DWORD dwFlags, - BYTE * pbData, - DWORD * pdwDataLen) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!CryptExportKey(m_hKey, ExpKey.GetHandle(), PUBLICKEYBLOB, dwFlags, pbData, pdwDataLen)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptKey::ExportPrivateKeyBlob( - CCryptKey &ExpKey, - DWORD dwFlags, - BYTE * pbData, - DWORD * pdwDataLen) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!CryptExportKey(m_hKey, ExpKey.GetHandle(), PRIVATEKEYBLOB, dwFlags, pbData, pdwDataLen)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptKey::GetParam(DWORD dwParam, BYTE * pbData, DWORD * pdwDataLen, DWORD dwFlags) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!CryptGetKeyParam(m_hKey, dwParam, pbData, pdwDataLen, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptKey::SetParam(DWORD dwParam, BYTE * pbData, DWORD dwFlags) throw() -{ - ATLASSUME(m_hKey != NULL); - - if (!CryptSetKeyParam(m_hKey, dwParam, pbData, dwFlags)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptKey::GetAlgId(ALG_ID * pAlgId) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_ALGID, (BYTE *)pAlgId, &dwSize); -} - -inline HRESULT CCryptKey::SetAlgId(ALG_ID AlgId, DWORD dwFlags) throw() -{ - return SetParam(KP_ALGID, (BYTE *)&AlgId, dwFlags); -} - -inline HRESULT CCryptKey::GetBlockLength(DWORD * pdwBlockLen) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_BLOCKLEN, (BYTE *)pdwBlockLen, &dwSize); -} - -inline HRESULT CCryptKey::GetKeyLength(DWORD * pdwKeyLen) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_KEYLEN, (BYTE *)pdwKeyLen, &dwSize); -} - -inline HRESULT CCryptKey::GetSalt(BYTE * pbSalt, DWORD * pdwLength) throw() -{ - return GetParam(KP_SALT, pbSalt, pdwLength); -} - -inline HRESULT CCryptKey::SetSalt(BYTE * pbSalt) throw() -{ - return SetParam(KP_SALT, pbSalt); -} - -inline HRESULT CCryptKey::SetSaltEx(_CRYPTOAPI_BLOB * pBlobSalt) throw() -{ - return SetParam(KP_SALT_EX, (BYTE *)pBlobSalt); -} - -inline HRESULT CCryptKey::GetPermissions(DWORD * pdwPerms) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_PERMISSIONS, (BYTE *)pdwPerms, &dwSize); -} - -inline HRESULT CCryptKey::SetPermissions(DWORD dwPerms) throw() -{ - return SetParam(KP_PERMISSIONS, (BYTE *)&dwPerms); -} - -inline HRESULT CCryptKey::GetP(BYTE * pbP, DWORD * pdwLength) throw() -{ - return GetParam(KP_P, (BYTE *)pbP, pdwLength); -} - -inline HRESULT CCryptKey::SetP(_CRYPTOAPI_BLOB * pBlobP) throw() -{ - return SetParam(KP_P, (BYTE *)pBlobP); -} - -inline HRESULT CCryptKey::SetP(BYTE * pbP, DWORD dwLength) throw() -{ - _CRYPTOAPI_BLOB blob = { dwLength, pbP }; - return SetParam(KP_P, (BYTE *)&blob); -} - -inline HRESULT CCryptKey::GetQ(BYTE * pbQ, DWORD * pdwLength) throw() -{ - return GetParam(KP_Q, (BYTE *)pbQ, pdwLength); -} - -inline HRESULT CCryptKey::SetQ(_CRYPTOAPI_BLOB * pBlobQ) throw() -{ - return SetParam(KP_Q, (BYTE *)pBlobQ); -} - -inline HRESULT CCryptKey::SetQ(BYTE * pbQ, DWORD dwLength) throw() -{ - _CRYPTOAPI_BLOB blob = { dwLength, pbQ }; - return SetParam(KP_Q, (BYTE *)&blob); -} - -inline HRESULT CCryptKey::GetG(BYTE * pbG, DWORD * pdwLength) throw() -{ - return GetParam(KP_G, (BYTE *)pbG, pdwLength); -} - -inline HRESULT CCryptKey::SetG(_CRYPTOAPI_BLOB * pBlobG) throw() -{ - return SetParam(KP_G, (BYTE *)pBlobG); -} - -inline HRESULT CCryptKey::SetG(BYTE * pbG, DWORD dwLength) throw() -{ - _CRYPTOAPI_BLOB blob = { dwLength, pbG }; - return SetParam(KP_G, (BYTE *)&blob); -} - -inline HRESULT CCryptKey::SetX() throw() -{ - return SetParam(KP_X, NULL); -} - -inline HRESULT CCryptKey::GetEffKeyLen(DWORD * pdwEffKeyLen) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_EFFECTIVE_KEYLEN, (BYTE *)pdwEffKeyLen, &dwSize); -} - -inline HRESULT CCryptKey::SetEffKeyLen(DWORD dwEffKeyLen) throw() -{ - return SetParam(KP_EFFECTIVE_KEYLEN, (BYTE *)&dwEffKeyLen); -} - -inline HRESULT CCryptKey::GetPadding(DWORD * pdwPadding) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_PADDING, (BYTE *)pdwPadding, &dwSize); -} - -inline HRESULT CCryptKey::SetPadding(DWORD dwPadding) throw() -{ - return SetParam(KP_PADDING, (BYTE *)&dwPadding); -} - -inline HRESULT CCryptKey::GetIV(BYTE * pbIV, DWORD * pdwLength) throw() -{ - return GetParam(KP_IV, pbIV, pdwLength); -} - -inline HRESULT CCryptKey::SetIV(BYTE * pbIV) throw() -{ - return SetParam(KP_IV, pbIV); -} - -inline HRESULT CCryptKey::GetMode(DWORD * pdwMode) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_MODE, (BYTE *)pdwMode, &dwSize); -} - -inline HRESULT CCryptKey::SetMode(DWORD dwMode) throw() -{ - return SetParam(KP_MODE, (BYTE *)&dwMode); -} - -inline HRESULT CCryptKey::GetModeBits(DWORD * pdwModeBits) throw() -{ - DWORD dwSize = sizeof(DWORD); - return GetParam(KP_MODE_BITS, (BYTE *)pdwModeBits, &dwSize); -} - -inline HRESULT CCryptKey::SetModeBits(DWORD dwModeBits) throw() -{ - return SetParam(KP_MODE_BITS, (BYTE *)&dwModeBits); -} - -inline HRESULT CCryptDerivedKey::Initialize( - CCryptProv &Prov, - CCryptHash &Hash, - ALG_ID algid, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptDeriveKey(Prov.GetHandle(), algid, Hash.GetHandle(), dwFlags, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptRandomKey::Initialize(CCryptProv &Prov, ALG_ID algid, DWORD dwFlags) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptGenKey(Prov.GetHandle(), algid, dwFlags, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; - -} - -inline HRESULT CCryptUserExKey::Initialize(CCryptProv &Prov) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptGetUserKey(Prov.GetHandle(), AT_KEYEXCHANGE, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptUserExKey::Create(CCryptProv &Prov) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptGenKey(Prov.GetHandle(), AT_KEYEXCHANGE, 0, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptUserSigKey::Initialize(CCryptProv &Prov) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptGetUserKey(Prov.GetHandle(), AT_SIGNATURE, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptUserSigKey::Create(CCryptProv &Prov) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptGenKey(Prov.GetHandle(), AT_SIGNATURE, 0, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptImportKey::Initialize( - CCryptProv &Prov, - BYTE * pbData, - DWORD dwDataLen, - CCryptKey &PubKey, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hKey == NULL); - - if (!CryptImportKey(Prov.GetHandle(), pbData, dwDataLen, PubKey.GetHandle(), dwFlags, &m_hKey)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptKeyedHash::Initialize( - CCryptProv &Prov, - ALG_ID Algid, - CCryptKey &Key, - DWORD dwFlags) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), Algid, Key.GetHandle(), dwFlags, &m_hHash)) - { - return AtlHresultFromLastError(); - } - else return S_OK; -} - -inline HRESULT CCryptMD5Hash::Initialize(CCryptProv &Prov, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_MD5, 0, 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - - if (szText!=NULL) - return AddString(szText); - else return S_OK; -} - -inline HRESULT CCryptMD4Hash::Initialize(CCryptProv &Prov, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_MD4, 0, 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - if (szText!=NULL) - return AddString(szText); - else return S_OK; -} - -inline HRESULT CCryptMD2Hash::Initialize(CCryptProv &Prov, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_MD2, 0, 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - if (szText!=NULL) - return AddString(szText); - else return S_OK; -} - -inline HRESULT CCryptSHAHash::Initialize(CCryptProv &Prov, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_SHA, 0, 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - if (szText!=NULL) - return AddString(szText); - else return S_OK; -} - -inline HRESULT CCryptHMACHash::Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_HMAC, Key.GetHandle(), 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - if (szText!=NULL) - return AddString(szText); - else return S_OK; - -} - -inline HRESULT CCryptMACHash::Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_MAC, Key.GetHandle(), 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - if (szText!=NULL) - return AddString(szText); - else return S_OK; - -} - -inline HRESULT CCryptSSL3SHAMD5Hash::Initialize(CCryptProv &Prov, CCryptKey &Key, LPCTSTR szText) throw() -{ - ATLASSUME(m_hHash == NULL); - - if (!CryptCreateHash(Prov.GetHandle(), CALG_SSL3_SHAMD5, Key.GetHandle(), 0, &m_hHash)) - { - return AtlHresultFromLastError(); - } - if (szText!=NULL) - return AddString(szText); - else return S_OK; - -} - -}; // namespace ATL - -#endif //__ATLCRYPT_INL__ diff --git a/include/atl/atlextmgmt.h b/include/atl/atlextmgmt.h deleted file mode 100644 index 59f8d4353..000000000 --- a/include/atl/atlextmgmt.h +++ /dev/null @@ -1,1279 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLEXTMGMT_H__ -#define __ATLEXTMGMT_H__ - -#pragma once -#pragma warning(push) -#pragma warning(disable: 4702) -#include -#include -#include -#include - -// -// You can change the local group that is used for authorizing -// site administrators by #define'ing ATL_DEFAULT_AUTH group -// to something else before including this header file. For -// example: -// #define ATL_DEFAULT_AUTHGRP CSid(_T("My Heros")) -// Verify that the logged on user is a member of -// the local group 'My Heros' before allowing them to -// administrate this site. -// -// #define ATL_DEFAULT_AUTHGRP Sids::World -// Allow everyone access -// -// #define ATL_DEFAULT_AUTHGRP Sids::Null -// Allow no one access -// -#ifndef ATL_DEFAULT_AUTHGRP - #define ATL_DEFAULT_AUTHGRP Sids::Admins() -#endif - -// If you #define ATL_NO_DEFAULT_AUTHORITY then there will be no authorization -// check before allowing access to management functions. You can also #define -// ATL_NO_DEFAULT_AUTHORITY and then declare you own instance of _Authority -// before #include-ing atlextmgmt.h to use a different authorization scheme. -#ifndef ATL_NO_DEFAULT_AUTHORITY - __declspec(selectany) CDefaultAuth _Authority; -#endif - -// You can choose which of the management handlers actually get used by -// #defining the following constants before including this header -// _ATL_THREADPOOL_MANAGEMENT (The thread pool manager web service and web based UI) -// _ATL_STENCILCACHE_MANAGEMENT (The stencil cache manager web service and web based UI) -// _ATL_DLLCACHE_MANAGEMENT (The DLL cache manager service and web based UI) - -// You can use the following constants to remove the web based UI if you don't -// want to use it. -// _ATL_THREADPOOL_NOUI (removes the thread pool mgr's stencil handler) -// _ATL_STENCILCACHE_NOUI (removes the stencil cache mgr's stencil handler) -// _ATL_DLLCACHE_NOUI (removes the dll cache mgr's stencil handler) - -// You can use the following constants to remove the web service management -// components individually -// _ATL_THREADPOOL_NOWEBSERVICE (removes the thread pool mgr's stencil handler) -// _ATL_STENCILCACHE_NOWEBSERVICE (removes the stencil cache mgr's stencil handler) -// _ATL_DLLCACHE_NOWEBSERVICE (removes the dll cache mgr's stencil handler) - - -// The following constants declare resource names of stencils included -// as resources in the module that uses this header. These stencils are -// used for the web based UI for the management objects. You can provide -// stencils of your own by including them as resources and redefining these -// constants before including this header. -#ifndef IDR_THREADMGR_SRF - #define IDR_THREADMGR_SRF "THREADMGR.SRF" -#endif - -#ifndef IDR_STENCILMGR_SRF - #define IDR_STENCILMGR_SRF "STENCILMGR.SRF" -#endif - -#ifndef IDR_DLLMGR_SRF - #define IDR_DLLMGR_SRF "DLLMGR.SRF" -#endif - -// A warning so users using the web based UI to manage their extension -// will remember to include the stencil resources in their projects -#if (defined(_ATL_THREADPOOL_MANAGEMENT) && !defined(_ATL_THREADPOOL_NOUI)) || (defined(_ATL_STENCILCACHE_MANAGEMENT) && !defined(_ATL_STENCILCACHE_NOUI)) || (defined(_ATL_DLLCACHE_MANAGEMENT) && !defined(_ATL_DLLCACHE_NOUI)) -#ifndef NO_ATL_MGMT_STENCIL_WARNING - #pragma message("*************** Please Note ***************") - #pragma message("Your usage of atlextmgmt.h requires you to include management") - #pragma message("stencil resources in your module's resource file.") - #pragma message("Please make sure you include atlsrv.rc in your resource file.\r\n") -#endif -#endif - -// These constants define the names used for the handler objects for the -// various services. You can change the names by redefining these constants -// before including this header - -#ifndef ID_THREADMGR_WEBSERVICE_NAME - #define ID_THREADMGR_WEBSERVICE_NAME "ThreadPoolManager" -#endif - -#ifndef ID_THREADMGR_WEBSERVICE_URL - #define ID_THREADMGR_WEBSERVICE_URL "http://www.microsoft.com/vc/atlserver/soap/ThreadPoolManager" -#endif - -#ifndef ID_THREADMGR_WEBSERVICE_WSDL - #define ID_THREADMGR_WEBSERVICE_WSDL "GenThreadPoolManagerWSDL" -#endif - -#ifndef ID_THREADMGR_SRFHANDLER_NAME - #define ID_THREADMGR_SRFHANDLER_NAME "ThreadMgrSrf" -#endif - -#ifndef ID_STENCILCACHEMGR_WEBSERVICE_NAME - #define ID_STENCILCACHEMGR_WEBSERVICE_NAME "StencilCacheManager" -#endif - -#ifndef ID_STENCILCACHEMGR_WEBSERVICE_URL - #define ID_STENCILCACHEMGR_WEBSERVICE_URL "http://www.microsoft.com/vc/atlserver/soap/StencilCacheManager" -#endif - -#ifndef ID_STENCILCACHEMGR_WEBSERVICE_WSDL - #define ID_STENCILCACHEMGR_WEBSERVICE_WSDL "GenStencilCacheManagerWSDL" -#endif - -#ifndef ID_STENCILCACHEMGR_SRFHANDLER_NAME - #define ID_STENCILCACHEMGR_SRFHANDLER_NAME "StencilMgrSrf" -#endif - -#ifndef ID_DLLCACHEMGR_WEBSERVICE_NAME - #define ID_DLLCACHEMGR_WEBSERVICE_NAME "DllCacheManager" -#endif - -#ifndef ID_DLLCACHEMGR_WEBSERVICE_URL - #define ID_DLLCACHEMGR_WEBSERVICE_URL "http://www.microsoft.com/vc/atlserver/soap/DllCacheManager" -#endif - -#ifndef ID_DLLCACHEMGR_WEBSERVICE_WSDL - #define ID_DLLCACHEMGR_WEBSERVICE_WSDL "GenDllCacheManagerWSDL" -#endif - - -#ifndef ID_DLLCACHEMGR_SRFHANDLER_NAME - #define ID_DLLCACHEMGR_SRFHANDLER_NAME "DllMgrSrf" -#endif - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -[emitidl(restricted)]; - -#define ATL_COLOR_TR1 RGB(0xd2, 0xff, 0xff) -#define ATL_COLOR_TR2 RGB(0xd2, 0xff, 0xd2) -#define ATL_COLOR_BODYBG RGB(0xec, 0xf9, 0xec) - -// _AtlRedirectToPage builds up a redirect URL from the -// current request plus a Handler= specification and -// redirects the user's browser to that page. -inline HTTP_CODE _AtlRedirectToPage( - IHttpServerContext *pContext, - CHttpRequest& request, - CHttpResponse& response, - const char *szHandler) -{ - ATLENSURE(pContext); - CStringA strRedirect("http://"); - - char buff[ATL_URL_MAX_URL_LENGTH]; - DWORD dwLen = static_cast(_countof(buff)); - if (!pContext->GetServerVariable("SERVER_NAME", buff, &dwLen)) - { - return HTTP_FAIL; - } - buff[_countof(buff)-1]='\0'; - strRedirect+=buff; - - dwLen = static_cast(_countof(buff)); - if (!request.GetUrl(buff, &dwLen)) - { - return HTTP_FAIL; - } - buff[_countof(buff)-1]='\0'; - strRedirect+=buff; - strRedirect+=szHandler; - - if (strRedirect.GetLength() >= ATL_URL_MAX_URL_LENGTH) - { - return HTTP_FAIL; - } - - BOOL bOK=response.Redirect(strRedirect.GetString()); - - return bOK ? HTTP_SUCCESS_NO_PROCESS : HTTP_FAIL; -} - -#ifdef _ATL_THREADPOOL_MANAGEMENT -/////////////////////////////////////////////////////////////////////// -// Thread pool management - -[ uuid("44e9962a-5207-4d2a-a466-5f08a76e0e5d"), object ] -__interface IThreadPoolMgr -{ - [id(0)] STDMETHOD(SetSize)([in] int nNumThreads); - [id(1)] STDMETHOD(GetSize)([out,retval] int *pnNumThreads); - -}; - - -class CThreadPoolMgrObject -{ -public: - CThreadPoolMgrObject() throw() - { - } - - HRESULT SetSize(int nNumThreads) throw() - { - if (!m_spThreadPoolConfig) - return E_UNEXPECTED; - - CRevertThreadToken revert; - if (!revert.Initialize()) - return E_FAIL; - - HRESULT hr = m_spThreadPoolConfig->SetSize(nNumThreads); - - DWORD dwErr = revert.Restore(); - if (dwErr) - return AtlHresultFromWin32(dwErr); - - return hr; - } - - - HRESULT GetSize(int *pnNumThreads) throw() - { - if (!m_spThreadPoolConfig) - return E_UNEXPECTED; - - return m_spThreadPoolConfig->GetSize(pnNumThreads); - - } - - HTTP_CODE Initialize(IServiceProvider *pProvider) throw() - { - ATLASSERT(pProvider); // should never be NULL - if (!pProvider) - return HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - - if (m_spThreadPoolConfig) - return HTTP_SUCCESS; // already initialized - - pProvider->QueryService(__uuidof(IThreadPoolConfig), &m_spThreadPoolConfig); - return m_spThreadPoolConfig ? HTTP_SUCCESS : HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - } - -private: - CComPtr m_spThreadPoolConfig; -}; - -#ifndef _ATL_THREADPOOL_NOWEBSERVICE -#pragma warning(push) -#pragma warning(disable:4199) -[ - soap_handler( - name= ID_THREADMGR_WEBSERVICE_NAME, - namespace= ID_THREADMGR_WEBSERVICE_URL, - protocol= "soap" - ), - request_handler( - name= ID_THREADMGR_WEBSERVICE_NAME, - sdl= ID_THREADMGR_WEBSERVICE_WSDL - ) -] -class CThreadPoolManager : - public IThreadPoolMgr -{ -#pragma warning(pop) -public: - [soap_method] - STDMETHOD(SetSize)(int nNumThreads) - { - return m_PoolMgr.SetSize(nNumThreads); - } - - [soap_method] - STDMETHOD(GetSize)(int *pnNumThreads) - { - return m_PoolMgr.GetSize(pnNumThreads); - } - - // override HandleRequest to Initialize our m_spServiceProvider - // and to handle authorizing the client. - HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider) - { - HTTP_CODE hcErr = m_PoolMgr.Initialize(pProvider); - if (hcErr != HTTP_SUCCESS) - return hcErr; - - // Make sure caller is authorized on this system -__if_exists(_Authority) -{ - hcErr = HTTP_FAIL; - ATLTRY(hcErr = _Authority.IsAuthorized(pRequestInfo, ATL_DEFAULT_AUTHGRP)) -} - if (hcErr == HTTP_SUCCESS) - { - hcErr = __super::HandleRequest(pRequestInfo, pProvider); - } - return hcErr; - } -private: - CThreadPoolMgrObject m_PoolMgr; -}; -#endif //_ATL_THREADPOOL_NOWEBSERVICE - -#ifndef _ATL_THREADPOOL_NOUI -#define INVALID_COMMAND_ID -1 -#define MAX_COMMAND_ID 64 - -[request_handler(name=ID_THREADMGR_SRFHANDLER_NAME)] -class CThreadMgrStencil -{ -public: - CThreadMgrStencil() : - m_nColor(ATL_COLOR_TR1) - { - - } - - [tag_name("GetSize")] - HTTP_CODE GetSize() - { - int nSize = 0; - HRESULT hr = m_PoolMgr.GetSize(&nSize); - if (SUCCEEDED(hr)) - { - m_HttpResponse << nSize; - } - else - m_HttpResponse << "size not found"; - - return HTTP_SUCCESS; - } - - [tag_name("GetTRColor")] - HTTP_CODE GetTRColor() - { - m_nColor = (m_nColor == ATL_COLOR_TR1) ? ATL_COLOR_TR2 : ATL_COLOR_TR1; - TCHAR cr[8]; - if (RGBToHtml(m_nColor, cr, sizeof(cr))) - m_HttpResponse << cr; - - return HTTP_SUCCESS; - } - - [tag_name("GetBodyColor")] - HTTP_CODE GetBodyColor() - { - TCHAR cr[8]; - if (RGBToHtml(ATL_COLOR_BODYBG, cr, sizeof(cr))) - m_HttpResponse << cr; - return HTTP_SUCCESS; - } - - - HTTP_CODE ValidateAndExchange() throw() - { - _ATLTRY - { - // Initialize the thread pool manager instance. Internally - // the initialize function will only intialize it's data structures - // once. - HTTP_CODE hcErr = m_PoolMgr.Initialize(m_spServiceProvider); - if (hcErr != HTTP_SUCCESS) - return hcErr; - -__if_exists(_Authority) -{ - // Make sure caller is authorized on this system - hcErr = HTTP_FAIL; - ATLTRY(hcErr = _Authority.IsAuthorized(m_pRequestInfo, ATL_DEFAULT_AUTHGRP)) - if (hcErr != HTTP_SUCCESS) - return hcErr; -} - - - m_HttpResponse.SetContentType("text/html"); - - CString strHandler, strOptParam; - int nCmdToExec = INVALID_COMMAND_ID; - - if (m_HttpRequest.GetMethod() == CHttpRequest::HTTP_METHOD_POST) - { - // check to see if we have a "Method" form variable and can execute a command - DWORD dwErr = m_HttpRequest.FormVars.Exchange("Method", &strHandler); - if (dwErr == VALIDATION_S_OK) - { - if (strHandler == _T("ExecuteCommand")) - { - // get the value of the command parameter so we can execute it - dwErr = m_HttpRequest.FormVars.Validate("command", &nCmdToExec, 0, MAX_COMMAND_ID); - if (dwErr == VALIDATION_S_OK) - { - // get the optional parameter if it's there. - m_HttpRequest.FormVars.Validate("DynValue", &strOptParam, 0, MAX_COMMAND_ID); - - hcErr = ExecCommand(nCmdToExec, strOptParam); - return hcErr; - } - } - } - } - - // If we had a proper command to execute, we would have done it by now. - // Just handle like it's a normal request to view the thread count. - hcErr = LoadStencilResource(m_hInstHandler, IDR_THREADMGR_SRF); - return hcErr; - - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - } - - HTTP_CODE ExecCommand(int nCmdToExec, CString& strOptParam) - { - switch (nCmdToExec) - { - case 0: - TCHAR *pStop = NULL; - int nValue = _tcstoul(strOptParam, &pStop, 10); - m_PoolMgr.SetSize(nValue); - break; - }; - - return _AtlRedirectToPage( - m_spServerContext, - m_HttpRequest, - m_HttpResponse, - "?Handler=" ID_THREADMGR_SRFHANDLER_NAME - ); - } -private: - CThreadPoolMgrObject m_PoolMgr; - long m_nColor; - CString m_strUrl; - -}; - - -#endif // _ATL_THREADPOOL_NOUI -#endif // _ATL_THREADPOOL_MANAGEMENT - -#ifdef _ATL_STENCILCACHE_MANAGEMENT -////////////////////////////////////////////////////////////////////// -// Stencil cache management -class CStencilCacheMgrObject -{ -public: - CStencilCacheMgrObject() - { - - } - - HRESULT GetCurrentEntryCount(__int64 *pdwSize) - { - ATLASSUME(m_spMemCacheStats); - if (!pdwSize) - return E_INVALIDARG; - - DWORD dwValue; - HRESULT hr = m_spMemCacheStats->GetCurrentEntryCount(&dwValue); - if (hr == S_OK) - { - *pdwSize = dwValue; - } - return hr; - } - - HRESULT ClearStats() - { - ATLENSURE(m_spMemCacheStats); - return m_spMemCacheStats->ClearStats(); - } - - HRESULT GetHitCount(__int64 *pdwSize) - { - ATLENSURE(m_spMemCacheStats); - if (!pdwSize) - return E_INVALIDARG; - - DWORD dwValue; - HRESULT hr = m_spMemCacheStats->GetHitCount(&dwValue); - if (hr == S_OK) - { - *pdwSize = dwValue; - } - return hr; - } - - HRESULT GetMissCount(__int64 *pdwSize) - { - ATLENSURE(m_spMemCacheStats); - if (!pdwSize) - return E_INVALIDARG; - - DWORD dwValue; - - HRESULT hr = m_spMemCacheStats->GetMissCount(&dwValue); - if (hr == S_OK) - { - *pdwSize = dwValue; - } - return hr; - } - - HRESULT GetCurrentAllocSize(__int64 *pdwSize) - { - ATLENSURE(m_spMemCacheStats); - if (!pdwSize) - return E_INVALIDARG; - - DWORD dwValue; - - HRESULT hr = m_spMemCacheStats->GetCurrentAllocSize(&dwValue); - if (hr == S_OK) - { - *pdwSize = dwValue; - } - return hr; - } - - HRESULT GetMaxAllocSize(__int64 *pdwSize) - { - ATLENSURE(m_spMemCacheStats); - if (!pdwSize) - return E_INVALIDARG; - - DWORD dwValue; - - HRESULT hr = m_spMemCacheStats->GetMaxAllocSize(&dwValue); - if (hr == S_OK) - { - *pdwSize = dwValue; - } - return hr; - } - - - HRESULT GetMaxEntryCount(__int64 *pdwSize) - { - ATLENSURE(m_spMemCacheStats); - if (!pdwSize) - return E_INVALIDARG; - - DWORD dwValue; - - HRESULT hr = m_spMemCacheStats->GetMaxEntryCount(&dwValue); - if (hr == S_OK) - { - *pdwSize = dwValue; - } - return hr; - } - - - HRESULT RemoveStencil(__int64 hStencil) - { - ATLENSURE(m_spStencilCacheControl); - return m_spStencilCacheControl->RemoveStencil((const HCACHEITEM)hStencil); - } - - HRESULT RemoveStencilByName(BSTR szStencil) throw() - { - ATLENSURE_RETURN(m_spStencilCacheControl); - return m_spStencilCacheControl->RemoveStencilByName(CW2A(szStencil)); - } - - - HRESULT RemoveAllStencils() - { - ATLENSURE(m_spStencilCacheControl); - return m_spStencilCacheControl->RemoveAllStencils(); - } - - // we show lifespan in milliseconds in the UI so we have to - // do the conversion to 100ns intervals here. - HRESULT SetDefaultLifespan(unsigned __int64 dwdwLifespan) - { - ATLENSURE(m_spStencilCacheControl); - // convert to 100ns intervals - return m_spStencilCacheControl->SetDefaultLifespan(dwdwLifespan * CFileTime::Millisecond); - } - - HRESULT GetDefaultLifespan(unsigned __int64 *pdwdwLifespan) - { - ATLENSURE(m_spStencilCacheControl); - ATLENSURE(pdwdwLifespan!=NULL); - *pdwdwLifespan = 0; - unsigned __int64 dwls = 0; - HRESULT hr = m_spStencilCacheControl->GetDefaultLifespan(&dwls); - - // convert to milliseconds - if (SUCCEEDED(hr)) - { - dwls /= CFileTime::Millisecond; - *pdwdwLifespan = dwls; - } - - return hr; - } - - HTTP_CODE Initialize(IServiceProvider *pProvider) throw() - { - - ATLASSERT(pProvider); // should never be NULL - if (!pProvider) - return HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - - - if (m_spMemCacheStats && m_spStencilCacheControl) - return HTTP_SUCCESS; // already initialized - - CComPtr spStencilCache; - pProvider->QueryService(__uuidof(IStencilCache), &spStencilCache); - if (spStencilCache) - { - if (!m_spMemCacheStats) - { - spStencilCache->QueryInterface(__uuidof(IMemoryCacheStats), - (void**)&m_spMemCacheStats); - } - if (!m_spStencilCacheControl) - { - spStencilCache->QueryInterface(__uuidof(IStencilCacheControl), - (void**)&m_spStencilCacheControl); - } - } - - return (m_spMemCacheStats && m_spStencilCacheControl) - ? HTTP_SUCCESS : HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - } - -private: - CComPtr m_spMemCacheStats; - CComPtr m_spStencilCacheControl; -}; - - -#ifndef _ATL_STENCILCACHE_NOWEBSERVICE - -[ uuid("3813895C-4C4C-41df-95F4-12220140B164"), object ] -__interface IStencilCacheMgr -{ - // data access - [id(0)] STDMETHOD(GetCurrentEntryCount)([out,retval] __int64 *pdwSize); - [id(1)] STDMETHOD(GetHitCount)([out,retval] __int64 *pdwSize); - [id(2)] STDMETHOD(GetMissCount)([out,retval] __int64 *pdwSize); - [id(3)] STDMETHOD(GetCurrentAllocSize)([out,retval] __int64 *pdwSize); - [id(4)] STDMETHOD(GetMaxAllocSize)([out,retval] __int64 *pdwSize); - [id(5)] STDMETHOD(GetMaxEntryCount)([out,retval] __int64 *pdwSize); - [id(6)] STDMETHOD(GetDefaultLifespan)([out,retval] unsigned __int64 *pdwdwLifespan); - - // commands - [id(7)] STDMETHOD(ClearStats)(); - [id(8)] STDMETHOD(RemoveStencil)([in] __int64 hStencil); - [id(9)] STDMETHOD(RemoveStencilByName)([in] BSTR szStencil); - [id(10)] STDMETHOD(RemoveAllStencils)(); - [id(11)] STDMETHOD(SetDefaultLifespan)([in] unsigned __int64 dwdwLifespan); -}; - -#pragma warning(push) -#pragma warning(disable:4199) -[ - soap_handler( name= ID_STENCILCACHEMGR_WEBSERVICE_NAME, - namespace= ID_STENCILCACHEMGR_WEBSERVICE_URL, - protocol= "soap" - ), - request_handler( - name= ID_STENCILCACHEMGR_WEBSERVICE_NAME, - sdl= ID_STENCILCACHEMGR_WEBSERVICE_WSDL ) -] -class CStencilCacheManager : - public IStencilCacheMgr -{ -#pragma warning(pop) -public: - [ soap_method ] - STDMETHOD(GetCurrentEntryCount)(__int64 *pdwSize) - { - return m_MgrObj.GetCurrentEntryCount(pdwSize); - } - - [ soap_method ] - STDMETHOD(ClearStats)() - { - return m_MgrObj.ClearStats(); - } - - [ soap_method ] - STDMETHOD(GetHitCount)(__int64 *pdwSize) - { - return m_MgrObj.GetHitCount(pdwSize); - } - - [ soap_method ] - STDMETHOD(GetMissCount)(__int64 *pdwSize) - { - return m_MgrObj.GetMissCount(pdwSize); - } - - [ soap_method ] - STDMETHOD(GetCurrentAllocSize)(__int64 *pdwSize) - { - return m_MgrObj.GetCurrentAllocSize(pdwSize); - } - - [ soap_method ] - STDMETHOD(GetMaxAllocSize)(__int64 *pdwSize) - { - return m_MgrObj.GetMaxAllocSize(pdwSize); - } - - [ soap_method ] - STDMETHOD(GetMaxEntryCount)(__int64 *pdwSize) - { - return m_MgrObj.GetMaxEntryCount(pdwSize); - } - - [ soap_method ] - STDMETHOD(RemoveStencil)(__int64 hStencil) - { - return m_MgrObj.RemoveStencil(hStencil); - } - - [ soap_method ] - STDMETHOD(RemoveStencilByName)(BSTR bstrStencil) - { - return m_MgrObj.RemoveStencilByName(bstrStencil); - } - - [ soap_method ] - STDMETHOD(RemoveAllStencils)() - { - return m_MgrObj.RemoveAllStencils(); - } - - // we show lifespan in milliseconds in the UI. - // m_MgrObj handles the conversion to 100ns intervals. - [ soap_method ] - STDMETHOD(SetDefaultLifespan)(unsigned __int64 dwdwLifespan) - { - return m_MgrObj.SetDefaultLifespan(dwdwLifespan); - } - - [ soap_method ] - STDMETHOD(GetDefaultLifespan)(unsigned __int64 *pdwdwLifespan) - { - return m_MgrObj.GetDefaultLifespan(pdwdwLifespan); - } - - HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider) - { - HTTP_CODE hcErr = m_MgrObj.Initialize(pProvider); - if (hcErr != HTTP_SUCCESS) - return hcErr; - -__if_exists(_Authority) -{ - // Make sure caller is authorized on this system - hcErr = HTTP_FAIL; - ATLTRY(hcErr = _Authority.IsAuthorized(pRequestInfo, ATL_DEFAULT_AUTHGRP)) -} - if (hcErr == HTTP_SUCCESS) - { - hcErr = __super::HandleRequest(pRequestInfo, pProvider); - } - return hcErr; - } -private: - CStencilCacheMgrObject m_MgrObj; -}; -#endif //_ATL_STENCILCACHE_NOWEBSERVICE -#ifndef _ATL_STENCILCACHE_NOUI -typedef HRESULT (CStencilCacheMgrObject::*PFNGETDATA)(__int64 *pdwSize); - -struct CCache_data -{ - PFNGETDATA m_pfn; - char m_sz[128]; -}; - -#define INVALID_DATA_PTR ((DWORD_PTR) -1) -#define INVALID_COMMAND_ID -1 -#define MAX_COMMAND_ID 64 -#define ATL_STENCILCACHECMD_CLEARALLSTATS 0 -#define ATL_STENCILCACHECMD_REMOVESTENCIL 1 -#define ATL_STENCILCACHECMD_REMOVEALLSTENCILS 2 -#define ATL_STENCILCACHECMD_SETDEFLIFESPAN 3 - -[request_handler(name=ID_STENCILCACHEMGR_SRFHANDLER_NAME)] -class CStencilMgr -{ -public: - CStencilMgr() - { - m_pData = (CCache_data*)INVALID_DATA_PTR; - m_nColor = ATL_COLOR_TR1; - } - - HTTP_CODE ValidateAndExchange() throw() - { - _ATLTRY - { - HTTP_CODE hcErr = m_MgrObj.Initialize(m_spServiceProvider); - if (hcErr != HTTP_SUCCESS) - return hcErr; - -__if_exists(_Authority) -{ - // Make sure caller is authorized on this system - hcErr = HTTP_FAIL; - ATLTRY(hcErr = _Authority.IsAuthorized(m_pRequestInfo, ATL_DEFAULT_AUTHGRP)) - if (hcErr != HTTP_SUCCESS) - return hcErr; -} - m_HttpResponse.SetContentType("text/html"); - - // check to see if we have a "Handler" form variable - CString strHandler, strOptParam; - int nCmdToExec; - - if (m_HttpRequest.GetMethod() == CHttpRequest::HTTP_METHOD_POST) - { - DWORD dwErr = m_HttpRequest.FormVars.Exchange("Method", &strHandler); - if (dwErr == VALIDATION_S_OK) - { - if (strHandler == _T("ExecuteCommand")) - { - // get the value of the command parameter so we can execute it - dwErr = m_HttpRequest.FormVars.Validate("command", &nCmdToExec, 0, MAX_COMMAND_ID); - if (dwErr == VALIDATION_S_OK) - { - // get the optional parameter if it's there. - m_HttpRequest.FormVars.Validate("DynValue", &strOptParam, 0, MAX_COMMAND_ID); - hcErr = ExecCommand(nCmdToExec, strOptParam); - return hcErr; - } - } - } - } - hcErr = LoadStencilResource(m_hInstHandler, IDR_STENCILMGR_SRF); - return hcErr; - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - } - - HTTP_CODE ExecCommand(int nCmdToExec, CString& strOptParam) - { - switch (nCmdToExec) - { - case ATL_STENCILCACHECMD_CLEARALLSTATS: - m_MgrObj.ClearStats(); - break; - - case ATL_STENCILCACHECMD_REMOVESTENCIL: - m_MgrObj.RemoveStencilByName(strOptParam.AllocSysString()); - break; - - case ATL_STENCILCACHECMD_REMOVEALLSTENCILS: - m_MgrObj.RemoveAllStencils(); - break; - - case ATL_STENCILCACHECMD_SETDEFLIFESPAN: - TCHAR *pStop = NULL; - m_MgrObj.SetDefaultLifespan(_tcstoul(strOptParam, &pStop, 10)); - break; - }; - - return _AtlRedirectToPage( - m_spServerContext, - m_HttpRequest, - m_HttpResponse, - "?Handler=" ID_STENCILCACHEMGR_SRFHANDLER_NAME - ); - - } - - [tag_name("GetNextStencilCacheStats")] - HTTP_CODE GetNextStencilCacheStats() - { - if (m_pData == (CCache_data*)INVALID_DATA_PTR) - { - m_pData = GetCacheData(); - return HTTP_SUCCESS; - } - m_pData++; - - if (m_pData->m_pfn != NULL) - return HTTP_SUCCESS; - - m_pData = (CCache_data*)INVALID_DATA_PTR; - return HTTP_S_FALSE; - - } - - [tag_name("GetCacheValue")] - HTTP_CODE GetCacheValue() - { - ATLENSURE(m_pData); - ATLENSURE(m_pData != (CCache_data*)INVALID_DATA_PTR); - m_HttpResponse << m_pData->m_sz; - return HTTP_SUCCESS; - } - - [tag_name("GetCacheQuantity")] - HTTP_CODE GetCacheQuantity() - { - ATLENSURE(m_pData); - ATLENSURE(m_pData != (CCache_data*)INVALID_DATA_PTR); - __int64 dwValue = 0; - PFNGETDATA pfn = m_pData->m_pfn; - ATLENSURE(pfn); - CStencilCacheMgrObject *pMgr = &m_MgrObj; - (pMgr->*pfn)(&dwValue); - - m_HttpResponse << dwValue; - return HTTP_SUCCESS; - } - - [tag_name("GetTRColor")] - HTTP_CODE GetTRColor() - { - m_nColor = (m_nColor == ATL_COLOR_TR1) ? ATL_COLOR_TR2 : ATL_COLOR_TR1; - TCHAR cr[8]; - if (RGBToHtml(m_nColor, cr, sizeof(cr))) - m_HttpResponse << cr; - - return HTTP_SUCCESS; - } - - [tag_name("GetBodyColor")] - HTTP_CODE GetBodyColor() - { - TCHAR cr[8]; - if (RGBToHtml(ATL_COLOR_BODYBG, cr, sizeof(cr))) - m_HttpResponse << cr; - return HTTP_SUCCESS; - } -private: - static CCache_data* GetCacheData() - { - static CCache_data cache_data[] = - { - {(PFNGETDATA)&CStencilCacheMgrObject::GetCurrentEntryCount, "Current Cache Entry Count(stencils)"}, - {(PFNGETDATA)&CStencilCacheMgrObject::GetHitCount, "Cache Hit Count(stencils)"}, - {(PFNGETDATA)&CStencilCacheMgrObject::GetMissCount, "Cache Miss Count(stencils)"}, - {(PFNGETDATA)&CStencilCacheMgrObject::GetCurrentAllocSize, "Cache memory allocation(bytes)"}, - {(PFNGETDATA)&CStencilCacheMgrObject::GetMaxAllocSize, "Cache maximum allocation size(bytes)"}, - {(PFNGETDATA)&CStencilCacheMgrObject::GetMaxEntryCount, "Cache maximum entry count(stencils)"}, - {(PFNGETDATA)&CStencilCacheMgrObject::GetDefaultLifespan, "Default stencil lifespan(ms)"}, - {NULL, NULL} - }; - return cache_data; - } - - CStencilCacheMgrObject m_MgrObj; - CCache_data *m_pData; - long m_nColor; -}; -//__declspec(selectany) CComObjectGlobal CStencilMgr::m_cachemgr; -#endif // _ATL_STENCILCACHE_NOUI -#endif // _ATL_STENCILCACHE_MANAGEMENT - -////////////////////////////////////////////////////////////////////// -// DLL cache management -#ifdef _ATL_DLLCACHE_MANAGEMENT - - -#ifndef _ATL_DLLCACHE_NOWEBSERVICE -[export] -#endif -struct _DLL_CACHE_ENTRY -{ - DWORD hInstDll; - DWORD dwRefs; - BSTR szDllName; -}; - - -class CDllMgrObject -{ -public: - HRESULT GetEntries(DWORD dwCount, _DLL_CACHE_ENTRY *pEntries, DWORD *pdwCopied) - { - ATLASSUME(m_spDllCache); - HRESULT hr = E_FAIL; - DLL_CACHE_ENTRY *pe = NULL; - - if (!m_spDllCache) - return E_UNEXPECTED; - - if (dwCount != 0 && pEntries == NULL) - return E_UNEXPECTED; // asking for entries but no place to put them - - if (!pdwCopied) - return E_POINTER; - *pdwCopied = 0; - - if (dwCount) - { - pe = new DLL_CACHE_ENTRY[dwCount]; - if (!pe) - return E_OUTOFMEMORY; - } - - hr = m_spDllCache->GetEntries(dwCount, pe, pdwCopied); - if (hr == S_OK && dwCount != 0 && pEntries != NULL) - { - // SysAllocString our path strings - for (DWORD i = 0; i<*pdwCopied; i++) - { - pEntries[i].hInstDll = (DWORD)(DWORD_PTR)pe[i].hInstDll; - pEntries[i].dwRefs = pe[i].dwRefs; - pEntries[i].szDllName = ::SysAllocString(CA2W(pe[i].szDllName)); - } - } - - delete [] pe; - return hr; - } - - - HRESULT GetEntryCount(DWORD *pdwCount) - { - ATLASSUME(m_spDllCache); - if (!m_spDllCache) - return E_UNEXPECTED; - - return m_spDllCache->GetEntries(0, NULL, pdwCount); - } - - HTTP_CODE Initialize(IServiceProvider *pProvider) - { - ATLASSERT(pProvider); // should never be NULL - if (!pProvider) - return HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - - if (m_spDllCache) - return HTTP_SUCCESS; // already initialized - - pProvider->QueryService(__uuidof(IDllCache), &m_spDllCache); - return m_spDllCache ? HTTP_SUCCESS : HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - } - -private: - CComPtr m_spDllCache; - -}; // CDllMgrObject - - -#ifndef _ATL_DLLCACHE_NOWEBSERVICE -// _DLL_CACHE_ENTRY is our own version of DLL_CACHE_ENTRY(atlcache.h) that -// uses a BSTR instead of a fixed length string for the szDllName for compatiblility -// with our SOAP implementation. -[ uuid("A0C00AF8-CEA5-46b9-97ED-FDEE55B583EF"), object ] -__interface IDllCacheMgr -{ - [id(0)] STDMETHOD(GetEntries)([in] DWORD dwCount, [out] _DLL_CACHE_ENTRY *pEntries, [out, retval] DWORD *pdwCopied); - [id(1)] STDMETHOD(GetEntryCount)([out, retval] DWORD *pdwCount); - -}; - - -#pragma warning(push) -#pragma warning(disable:4199) -[ - soap_handler( - name= ID_DLLCACHEMGR_WEBSERVICE_NAME, - namespace= ID_DLLCACHEMGR_WEBSERVICE_URL, - protocol= "soap" - ), - request_handler( - name= ID_DLLCACHEMGR_WEBSERVICE_NAME, - sdl= ID_DLLCACHEMGR_WEBSERVICE_WSDL - ) -] -class CDllCacheManager : - public IDllCacheMgr -{ -#pragma warning(pop) -public: - [soap_method] - HRESULT GetEntries(DWORD dwCount, _DLL_CACHE_ENTRY *pEntries, DWORD *pdwCopied) - { - return m_MgrObj.GetEntries(dwCount, pEntries, pdwCopied); - } - - [soap_method] - STDMETHOD(GetEntryCount)(DWORD *pdwCount) - { - return m_MgrObj.GetEntries(0, NULL, pdwCount); - } - - HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider) - { - HTTP_CODE hcErr = m_MgrObj.Initialize(pProvider); - if (hcErr != HTTP_SUCCESS) - return hcErr; - -__if_exists(_Authority) -{ - // Make sure caller is authorized on this system - hcErr = HTTP_FAIL; - ATLTRY(hcErr = _Authority.IsAuthorized(pRequestInfo, ATL_DEFAULT_AUTHGRP)) -} - if (hcErr == HTTP_SUCCESS) - { - hcErr = __super::HandleRequest(pRequestInfo, pProvider); - } - return hcErr; - } - -protected: - CDllMgrObject m_MgrObj; -}; -#endif _ATL_DLLCACHE_NOWEBSERVICE - -#ifndef _ATL_DLLCACHE_NOUI -#define INVALID_INDEX -1 - -[ - request_handler(name=ID_DLLCACHEMGR_SRFHANDLER_NAME) -] -class CDllCacheMgr -{ -public: - CDllCacheMgr() : m_nColor(ATL_COLOR_TR1), - m_nEnumCount(INVALID_INDEX), - m_nEnumIndex(INVALID_INDEX), - m_pEntries(NULL) - { - - } - - [tag_name("GetTRColor")] - HTTP_CODE GetTRColor() - { - m_nColor = (m_nColor == ATL_COLOR_TR1) ? ATL_COLOR_TR2 : ATL_COLOR_TR1; - TCHAR cr[8]; - if (RGBToHtml(m_nColor, cr, sizeof(cr))) - m_HttpResponse << cr; - - return HTTP_SUCCESS; - } - - [tag_name("GetBodyColor")] - HTTP_CODE GetBodyColor() - { - TCHAR cr[8]; - if (RGBToHtml(ATL_COLOR_BODYBG, cr, sizeof(cr))) - m_HttpResponse << cr; - return HTTP_SUCCESS; - } - - - [tag_name("GetNumEntries")] - HTTP_CODE GetNumEntries() - { - DWORD dwEntries = 0; - m_MgrObj.GetEntryCount(&dwEntries); - m_HttpResponse << dwEntries; - return HTTP_SUCCESS; - } - - - [tag_name("EnumEntries")] - HTTP_CODE EnumEntries() - { - // we lock the cache while we enum entries so no entries - // will be removed during the enumeration request. - if (m_nEnumIndex == INVALID_INDEX) - { - // set up for the iteration - m_MgrObj.GetEntryCount((DWORD*)&m_nEnumCount); - if (!m_nEnumCount) - return HTTP_S_FALSE; // nothing to enum - - m_pEntries = new _DLL_CACHE_ENTRY[m_nEnumCount]; - if (!m_pEntries) - return HTTP_ERROR(500, ISE_SUBERR_OUTOFMEM); - - DWORD dwFetched = INVALID_INDEX; - - if (S_OK != m_MgrObj.GetEntries(m_nEnumCount, m_pEntries, &dwFetched)) - return HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - - m_nEnumIndex = 0; - return HTTP_SUCCESS; - } - - m_nEnumIndex++; - if (m_nEnumIndex < m_nEnumCount) - return HTTP_SUCCESS; // continue iterating - - else - { - // done, clean up - for (int i = 0; i< m_nEnumCount; i++) - { - ::SysFreeString(m_pEntries[i].szDllName); - } - delete [] m_pEntries; - m_pEntries = NULL; - m_nEnumCount = INVALID_INDEX; - m_nEnumIndex = INVALID_INDEX; - return HTTP_S_FALSE; // terminate iterations. - } - } - - [tag_name("GetDllName")] - HTTP_CODE GetDllName() - { - m_HttpResponse << m_pEntries[m_nEnumIndex].szDllName; - return HTTP_SUCCESS; - } - - [tag_name("GetDllReferences")] - HTTP_CODE GetDllReferences() - { - m_HttpResponse << m_pEntries[m_nEnumIndex].dwRefs; - return HTTP_SUCCESS; - } - - HTTP_CODE ValidateAndExchange() - { - - HTTP_CODE hcErr = m_MgrObj.Initialize(m_spServiceProvider); - if (hcErr != HTTP_SUCCESS) - return hcErr; - -__if_exists(_Authority) -{ - // Make sure caller is authorized on this system - hcErr = HTTP_FAIL; - ATLTRY(hcErr = _Authority.IsAuthorized(m_pRequestInfo, ATL_DEFAULT_AUTHGRP)) - if (hcErr != HTTP_SUCCESS) - return hcErr; -} - hcErr = LoadStencilResource(m_hInstHandler, IDR_DLLMGR_SRF); - m_HttpResponse.SetContentType("text/html"); - return hcErr; - - } - - CDllMgrObject m_MgrObj; - long m_nColor; - int m_nEnumCount; - int m_nEnumIndex; - _DLL_CACHE_ENTRY *m_pEntries; - -}; - -#endif // _ATL_DLLCACHE_NOUI -#endif // _ATL_DLLCACHE_MANAGEMENT - -}; // ATL - -#pragma pack(pop) -#pragma warning(pop) -#endif // __ATLEXTMGMT_H__ diff --git a/include/atl/atlhtml.h b/include/atl/atlhtml.h deleted file mode 100644 index 4922e580d..000000000 --- a/include/atl/atlhtml.h +++ /dev/null @@ -1,1682 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLHTML_H__ -#define __ATLHTML_H__ - -#pragma once - -#include -#include -#include - - - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -#define TAGF_NONE 0 -#define TAGF_HASEND 1 -#define TAGF_BLOCK 2 - - -struct ATL_HTML_TAG -{ - LPCTSTR szTagName; - UINT uFlags; -}; - -enum ATL_HTML_TAGS { - ATL_HTML_TAG_BODY, - ATL_HTML_TAG_A, - ATL_HTML_TAG_B, - ATL_HTML_TAG_I, - ATL_HTML_TAG_U, - ATL_HTML_TAG_FONT, - ATL_HTML_TAG_IMG, - ATL_HTML_TAG_HR, - ATL_HTML_TAG_BR, - ATL_HTML_TAG_DIV, - ATL_HTML_TAG_BLOCKQUOTE, - ATL_HTML_TAG_ADDRESS, - ATL_HTML_TAG_P, - ATL_HTML_TAG_H1, - ATL_HTML_TAG_H2, - ATL_HTML_TAG_H3, - ATL_HTML_TAG_H4, - ATL_HTML_TAG_H5, - ATL_HTML_TAG_H6, - ATL_HTML_TAG_PRE, - ATL_HTML_TAG_Q, - ATL_HTML_TAG_SUB, - ATL_HTML_TAG_SUP, - ATL_HTML_TAG_INS, - ATL_HTML_TAG_DEL, - ATL_HTML_TAG_EM, - ATL_HTML_TAG_STRONG, - ATL_HTML_TAG_DFN, - ATL_HTML_TAG_CODE, - ATL_HTML_TAG_SAMP, - ATL_HTML_TAG_KBD, - ATL_HTML_TAG_VAR, - ATL_HTML_TAG_CITE, - ATL_HTML_TAG_ABBR, - ATL_HTML_TAG_ACRONYM, - ATL_HTML_TAG_OL, - ATL_HTML_TAG_UL, - ATL_HTML_TAG_LI, - ATL_HTML_TAG_DL, - ATL_HTML_TAG_DT, - ATL_HTML_TAG_DD, - ATL_HTML_TAG_TABLE, - ATL_HTML_TAG_TR, - ATL_HTML_TAG_TD, - ATL_HTML_TAG_FORM, - ATL_HTML_TAG_INPUT, - ATL_HTML_TAG_SELECT, - ATL_HTML_TAG_OPTION, - ATL_HTML_TAG_HEAD, - ATL_HTML_TAG_HTML, - ATL_HTML_TAG_MAP, - ATL_HTML_TAG_AREA, - ATL_HTML_TAG_BASE, - ATL_HTML_TAG_BDO, - ATL_HTML_TAG_BIG, - ATL_HTML_TAG_BUTTON, - ATL_HTML_TAG_IFRAME, - ATL_HTML_TAG_LABEL, - ATL_HTML_TAG_LINK, - ATL_HTML_TAG_META, - ATL_HTML_TAG_NOFRAMES, - ATL_HTML_TAG_NOSCRIPT, - ATL_HTML_TAG_COL, - ATL_HTML_TAG_COLGROUP, - ATL_HTML_TAG_FIELDSET, - ATL_HTML_TAG_LEGEND, - ATL_HTML_TAG_TBODY, - ATL_HTML_TAG_TEXTAREA, - ATL_HTML_TAG_TFOOT, - ATL_HTML_TAG_TH, - ATL_HTML_TAG_TITLE, - ATL_HTML_TAG_TT, - ATL_HTML_TAG_SMALL, - ATL_HTML_TAG_SPAN, - ATL_HTML_TAG_OBJECT, - ATL_HTML_TAG_PARAM, - ATL_HTML_TAG_LAST }; - -extern __declspec(selectany) const ATL_HTML_TAG s_tags[] = -{ - { _T("body"), TAGF_HASEND | TAGF_BLOCK }, - { _T("a"), TAGF_HASEND }, - { _T("b"), TAGF_HASEND }, - { _T("i"), TAGF_HASEND }, - { _T("u"), TAGF_HASEND }, - { _T("font"), TAGF_HASEND }, - { _T("img"), TAGF_NONE }, - { _T("hr"), TAGF_NONE }, - { _T("br"), TAGF_NONE }, - { _T("div"), TAGF_HASEND | TAGF_BLOCK }, - { _T("blockquote"), TAGF_HASEND | TAGF_BLOCK }, - { _T("adress"), TAGF_HASEND }, - { _T("p"), TAGF_HASEND | TAGF_BLOCK }, - { _T("h1"), TAGF_HASEND | TAGF_BLOCK}, - { _T("h2"), TAGF_HASEND | TAGF_BLOCK}, - { _T("h3"), TAGF_HASEND | TAGF_BLOCK }, - { _T("h4"), TAGF_HASEND | TAGF_BLOCK }, - { _T("h5"), TAGF_HASEND | TAGF_BLOCK }, - { _T("h6"), TAGF_HASEND | TAGF_BLOCK }, - { _T("pre"), TAGF_HASEND | TAGF_BLOCK }, - { _T("q"), TAGF_HASEND }, - { _T("sub"), TAGF_HASEND }, - { _T("sup"), TAGF_HASEND }, - { _T("ins"), TAGF_HASEND }, - { _T("del"), TAGF_HASEND }, - { _T("em"), TAGF_HASEND }, - { _T("strong"), TAGF_HASEND }, - { _T("dfn"), TAGF_HASEND }, - { _T("code"), TAGF_HASEND }, - { _T("samp"), TAGF_HASEND }, - { _T("kbd"), TAGF_HASEND }, - { _T("var"), TAGF_HASEND }, - { _T("cite"), TAGF_HASEND }, - { _T("abbr"), TAGF_HASEND }, - { _T("acronym"), TAGF_HASEND }, - { _T("ol"), TAGF_HASEND | TAGF_BLOCK }, - { _T("ul"), TAGF_HASEND | TAGF_BLOCK }, - { _T("li"), TAGF_HASEND }, - { _T("dl"), TAGF_HASEND | TAGF_BLOCK }, - { _T("dt"), TAGF_HASEND }, - { _T("dd"), TAGF_HASEND }, - { _T("table"), TAGF_HASEND }, - { _T("tr"), TAGF_HASEND }, - { _T("td"), TAGF_HASEND }, - { _T("form"), TAGF_HASEND }, - { _T("input"), TAGF_HASEND }, - { _T("select"), TAGF_HASEND }, - { _T("option"), TAGF_HASEND }, - { _T("head"), TAGF_HASEND | TAGF_BLOCK }, - { _T("html"), TAGF_HASEND | TAGF_BLOCK }, - { _T("map"), TAGF_HASEND | TAGF_BLOCK }, - { _T("area"), TAGF_BLOCK }, - { _T("base"), TAGF_BLOCK }, - { _T("bdo"), TAGF_HASEND }, - { _T("big"), TAGF_HASEND }, - { _T("button"), TAGF_HASEND }, - { _T("iframe"), TAGF_HASEND }, - { _T("label"), TAGF_HASEND }, - { _T("link"), TAGF_NONE }, - { _T("meta"), TAGF_BLOCK }, - { _T("noframes"), TAGF_BLOCK }, - { _T("noscript"), TAGF_BLOCK }, - { _T("col"), TAGF_BLOCK }, - { _T("colgroup"), TAGF_HASEND | TAGF_BLOCK }, - { _T("fieldset"), TAGF_HASEND | TAGF_BLOCK }, - { _T("legend"), TAGF_HASEND | TAGF_BLOCK }, - { _T("tbody"), TAGF_HASEND | TAGF_BLOCK }, - { _T("textarea"), TAGF_HASEND | TAGF_BLOCK }, - { _T("tfoot"), TAGF_HASEND | TAGF_BLOCK }, - { _T("th"), TAGF_HASEND | TAGF_BLOCK }, - { _T("title"), TAGF_HASEND | TAGF_BLOCK }, - { _T("tt"), TAGF_HASEND }, - { _T("small"), TAGF_HASEND }, - { _T("span"), TAGF_HASEND }, - { _T("object"), TAGF_HASEND | TAGF_BLOCK }, - { _T("param"), TAGF_NONE }, -}; - -class AtlHtmlAttrs -{ -public: - CString m_strAttrs; - - AtlHtmlAttrs() - { - - } - -#pragma warning(push) -#pragma warning(disable : 4793) - AtlHtmlAttrs(int nCount, ...) - { - va_list args; - - va_start(args, nCount); - for (int i=0; i(szAttrs[0]))) -#else - if (!iswspace(szAttrs[0])) -#endif - m_strAttrs = _T(" "); - m_strAttrs += szAttrs; - } - } - - operator LPCTSTR() - { - return m_strAttrs; - } - -}; - -class CStreamOnWriteStream : public IStream -{ -public: - IWriteStream *m_pWriteStream; - - CStreamOnWriteStream() - { - m_pWriteStream = NULL; - } - - void Init(IWriteStream *pWriteStream) - { - m_pWriteStream = pWriteStream; - } - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void **ppv) - { - if (!ppv) - return E_POINTER; - - *ppv = NULL; - - if (IsEqualGUID(riid, IID_IUnknown) || - IsEqualGUID(riid, IID_IStream) || - IsEqualGUID(riid, IID_ISequentialStream)) - { - *ppv = (IStream *) this; - } - if (!*ppv) - return E_NOINTERFACE; - return S_OK; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - - // ISequentialStream methods - HRESULT STDMETHODCALLTYPE Read(void * /*pDest*/, ULONG /*dwMaxLen*/, ULONG * /*pdwRead*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE Write(const void *pv, ULONG cb, ULONG *pcbWritten) - { - ATLASSUME(m_pWriteStream); - HRESULT hr = m_pWriteStream->WriteStream((const char *) pv, cb, pcbWritten); - return (hr==S_OK) ? S_OK : STG_E_WRITEFAULT; - } - - // IStream methods - HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER /*dlibMove*/, DWORD /*dwOrigin*/, ULARGE_INTEGER * /*plibNewPosition*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER /*libNewSize*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE CopyTo(IStream * /*pstm*/, ULARGE_INTEGER /*cb*/, ULARGE_INTEGER * /*pcbRead*/, ULARGE_INTEGER * /*pcbWritten*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE Commit(DWORD /*grfCommitFlags*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE Revert(void) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER /*libOffset*/, ULARGE_INTEGER /*cb*/, DWORD /*dwLockType*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER /*libOffset*/, ULARGE_INTEGER /*cb*/, DWORD /*dwLockType*/) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE Stat(STATSTG * /*pstatstg*/, DWORD /*grfStatFlag*/) - { - return E_NOTIMPL; - } - - - HRESULT STDMETHODCALLTYPE Clone(IStream ** /*ppstm*/) - { - return E_NOTIMPL; - } -}; - -class CStreamFormatter -{ -protected: - CStreamOnWriteStream m_sows; - IStream *m_pStream; - BOOL m_bAddCRLF; - BOOL m_bEmitUnicode; - UINT m_nConversionCodepage; - -public: - CStreamFormatter() - { - m_pStream = NULL; - m_bAddCRLF = TRUE; - m_bEmitUnicode = FALSE; - m_nConversionCodepage = _AtlGetConversionACP(); - } - - void Initialize(IStream *pStream, BOOL bAddCRLF=TRUE) - { - m_pStream = pStream; - m_bAddCRLF = bAddCRLF; - } - - void Initialize(IWriteStream *pWriteStream, BOOL bAddCRLF=TRUE) - { - m_bAddCRLF = bAddCRLF; - m_sows.Init(pWriteStream); - m_pStream = &m_sows; - } - - void EmitUnicode(BOOL bEmitUnicode) - { - m_bEmitUnicode = bEmitUnicode; - } - - void SetConversionCodepage(UINT nConversionCodepage) - { - m_nConversionCodepage = nConversionCodepage; - } - - void AddCRLF(bool bNewVal) - { - m_bAddCRLF = bNewVal; - } - - HRESULT WriteRaw(LPCTSTR szString, int nCount=-1) - { - ATLENSURE_RETURN(szString != NULL); - if (!m_pStream) - return E_FAIL; - - if (m_bEmitUnicode) - { -#ifdef _UNICODE - LPCWSTR sz = szString; - if (nCount == -1) - nCount = (int) wcslen(szString); -#else - CA2W sz(szString, m_nConversionCodepage); - nCount = (int) wcslen(sz); -#endif - DWORD dwWritten; - return m_pStream->Write(sz, (DWORD) nCount*sizeof(WCHAR), &dwWritten); - } - else - { -#ifdef _UNICODE - CW2A sz(szString, m_nConversionCodepage); - nCount = (int) strlen(sz); -#else - LPCSTR sz = szString; - if (nCount == -1) - nCount = (int) strlen(szString); -#endif - DWORD dwWritten; - return m_pStream->Write(sz, (DWORD) nCount, &dwWritten); - } - } - - HRESULT StartTag(int nTagIndex, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - if (nTagIndex < 0 || nTagIndex >= ATL_HTML_TAG_LAST) - return E_INVALIDARG; - if (m_bAddCRLF && (s_tags[nTagIndex].uFlags & TAGF_BLOCK)) - WriteRaw(_T("\r\n")); - HRESULT hr = StartTag(s_tags[nTagIndex].szTagName, szContent, szAttrs); - if (FAILED(hr)) - return hr; - if (m_bAddCRLF && (s_tags[nTagIndex].uFlags & TAGF_BLOCK)) - WriteRaw(_T("\r\n")); - return S_OK; - } - - HRESULT StartTag(LPCTSTR szTag, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - HRESULT hr; - hr = WriteRaw(_T("<")); - if (FAILED(hr)) - return hr; - hr = WriteRaw(szTag); - if (FAILED(hr)) - return hr; - hr = WriteAttributes(szAttrs); - if (FAILED(hr)) - return hr; - hr = WriteRaw(_T(">")); - if (FAILED(hr)) - return hr; - if (szContent && *szContent) - { - WriteRaw(szContent); - EndTag(szTag); - } - return S_OK; - } - - HRESULT EndTag(int nTagIndex) - { - if (nTagIndex < 0 || nTagIndex >= ATL_HTML_TAG_LAST) - return E_INVALIDARG; - if (m_bAddCRLF && (s_tags[nTagIndex].uFlags & TAGF_BLOCK)) - WriteRaw(_T("\r\n")); - HRESULT hr = EndTag(s_tags[nTagIndex].szTagName); - if (FAILED(hr)) - return hr; - if (m_bAddCRLF && (s_tags[nTagIndex].uFlags & TAGF_BLOCK)) - WriteRaw(_T("\r\n")); - return S_OK; - } - - HRESULT EndTag(LPCTSTR szTag) - { - HRESULT hr = WriteRaw(_T("")); - } - - HRESULT WriteAttributes(LPCTSTR szAttrs) - { - if (szAttrs && szAttrs[0]) - { -#ifndef UNICODE - if (!isspace(static_cast(szAttrs[0]))) -#else - if (!iswspace(szAttrs[0])) -#endif - WriteRaw(_T(" ")); - return WriteRaw(szAttrs); - } - - return S_OK; - } - -#pragma warning(push) -#pragma warning(disable : 4793) - HRESULT WriteFormatted(LPCTSTR szFormat, ...) - { - ATLASSERT(szFormat != NULL); - if (!m_pStream) - return E_FAIL; - - va_list args; - va_start(args, szFormat); - - - TCHAR buffFixed[1024]; - CTempBuffer buffHeap; - TCHAR *szTemp = buffFixed; - int nCount = _vstprintf_s((LPTSTR)szTemp, _countof(buffFixed), szFormat, args); - if (nCount < 0) - { - // we'll have to dynamically allocate the buffer - nCount = _vsctprintf(szFormat, args); - szTemp = NULL; - ATLTRY(szTemp = buffHeap.Allocate(nCount + 1)); - if (!szTemp) - return E_OUTOFMEMORY; - nCount = _vstprintf_s(szTemp, nCount+1, szFormat, args); - } - - va_end(args); - - if (nCount > 0) - return WriteRaw(szTemp, (DWORD) nCount); - return E_UNEXPECTED; - } -#pragma warning(pop) -}; - -template -class CSimpleStack -{ -public: - int m_nTop; - TData m_Data[nMax]; - - CSimpleStack() - { - m_nTop = -1; - } - - bool IsEmpty() - { - return (m_nTop == -1); - } - - bool Push(const TData *pData) - { - if (m_nTop + 1 >= nMax) - return false; - - m_nTop++; - - m_Data[m_nTop] = *pData; - return true; - } - - bool Pop(TData *pData) - { - if (m_nTop < 0) - return false; - - *pData = m_Data[m_nTop]; - m_nTop--; - return true; - } -}; - - -struct HTML_SCHEME -{ - CString strBgColor; - CString strLinkColor; - CString strVLinkColor; - CString strALinkColor; - CString strBackground; - int nTopMargin; - int nLeftMargin; - - CString strTdBgColor; - CString strTableBgColor; - CString strTrBgColor; - - HTML_SCHEME() - { - nTopMargin = -1; - nLeftMargin = -1; - } -}; - -template -class CHtmlGenBase : public CStreamFormatter -{ -public: - T* GetOuter() - { - return static_cast(this); - } - - enum ATL_HTML_FORM_METHOD { ATL_HTML_FORM_METHOD_NONE=0, ATL_HTML_FORM_METHOD_GET, ATL_HTML_FORM_METHOD_POST, ATL_HTML_FORM_METHOD_MULTIPART }; - - CHtmlGenBase() - { - m_nWidthPercent = -1; - m_nHeightPercent = -1; - m_nFormMethod = ATL_HTML_FORM_METHOD_NONE; - m_pScheme = NULL; - } - - void SetScheme(HTML_SCHEME *pScheme) - { - m_pScheme = pScheme; - } - - HRESULT body(LPCTSTR szBgColor=NULL, LPCTSTR szBackground=NULL, LPCTSTR szTopMargin=NULL, LPCTSTR szLeftMargin=NULL, - LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szBgColor && *szBgColor) - Attrs.Add(_T("bgColor"), szBgColor); - else if (m_pScheme && m_pScheme->strBgColor.GetLength()) - Attrs.Add(_T("bgColor"), m_pScheme->strBgColor); - - if (szBackground && *szBackground) - Attrs.Add(_T("background"), szBackground); - else if (m_pScheme && m_pScheme->strBackground.GetLength()) - Attrs.Add(_T("background"), m_pScheme->strBackground); - - if (m_pScheme && m_pScheme->strLinkColor.GetLength()) - Attrs.Add(_T("link"), m_pScheme->strLinkColor); - - if (m_pScheme && m_pScheme->strALinkColor.GetLength()) - Attrs.Add(_T("alink"), m_pScheme->strALinkColor); - - if (m_pScheme && m_pScheme->strVLinkColor.GetLength()) - Attrs.Add(_T("vlink"), m_pScheme->strVLinkColor); - - if (szTopMargin && *szTopMargin) - Attrs.Add(_T("topmargin"), szTopMargin); - else if (m_pScheme && m_pScheme->nTopMargin != -1) - Attrs.AddFormat(_T("topmargin=\"%d\""), m_pScheme->nTopMargin); - - if (szLeftMargin && *szLeftMargin) - Attrs.Add(_T("leftmargin"), szLeftMargin); - else if (m_pScheme && m_pScheme->nLeftMargin != -1) - Attrs.AddFormat(_T("leftmargin=\"%d\""), m_pScheme->nLeftMargin); - - return GetOuter()->StartTag(ATL_HTML_TAG_BODY, NULL, Attrs); - } - - HRESULT bodyEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_BODY); - } - - HRESULT a(LPCTSTR szHref, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (m_strState.GetLength()==0) - { - if (szHref && *szHref) - Attrs.Add(_T("href"), szHref); - return GetOuter()->StartTag(ATL_HTML_TAG_A, szContent, Attrs); - } - - const TCHAR *szQuestion = NULL; - if(szHref) - szQuestion = _tcschr(szHref, '?'); - - CString strHref = szHref; - if (!szQuestion) - strHref.Append("?"); - else - strHref.Append("&"); - - strHref += m_strState; - - if (szHref && *szHref) - Attrs.Add(_T("href"), strHref); - - return GetOuter()->StartTag(ATL_HTML_TAG_A, szContent, Attrs); - } - - HRESULT aEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_A); - } - - HRESULT b(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_B, szContent, szAttrs); - } - - HRESULT bEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_B); - } - - HRESULT i(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_I, szContent, szAttrs); - } - - HRESULT iEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_I); - } - - HRESULT u(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_U, szContent, szAttrs); - } - - HRESULT uEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_U); - } - - HRESULT font(LPCTSTR szFace, LPCTSTR szSize=NULL, LPCTSTR szColor=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - if (szFace && *szFace) - Attrs.Add(_T("face"), szFace); - if (szSize && *szSize) - Attrs.Add(_T("size"), szSize); - if (szColor && *szColor) - Attrs.Add(_T("color"), szColor); - return GetOuter()->StartTag(ATL_HTML_TAG_FONT, NULL, Attrs); - } - - HRESULT font(COLORREF clrColor, LPCTSTR szAttrs=NULL) - { - TCHAR szColor[8]; - _stprintf_s(szColor, _countof(szColor), _T("#%02x%02x%02x"), GetRValue(clrColor), - GetGValue(clrColor), GetBValue(clrColor)); - return GetOuter()->font(NULL, NULL, szColor, szAttrs); - } - - HRESULT fontEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_FONT); - } - - HRESULT img(LPCTSTR szSrc, LPCTSTR szAttrs=NULL) - { - ATLASSERT(szSrc && *szSrc); - - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - Attrs.Add(_T("src"), szSrc); - - return GetOuter()->StartTag(ATL_HTML_TAG_IMG, NULL, Attrs); - } - - HRESULT br(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_BR, NULL, szAttrs); - } - - HRESULT hr(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_HR, NULL, szAttrs); - } - - HRESULT div(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_DIV, szContent, szAttrs); - } - - HRESULT divEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_DIV); - } - - HRESULT blockquote(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_BLOCKQUOTE, szContent, szAttrs); - } - - HRESULT blockquoteEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_BLOCKQUOTE); - } - - HRESULT address(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_ADDRESS, szContent, szAttrs); - } - - HRESULT addressEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_ADDRESS); - } - - HRESULT p(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_P, szContent, szAttrs); - } - - HRESULT pEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_P); - } - - HRESULT h(int nLevel=1, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - if (nLevel < 1 || nLevel > 6) - return E_INVALIDARG; - return GetOuter()->StartTag(ATL_HTML_TAG_H1+nLevel-1, szContent, szAttrs); - } - - HRESULT hEnd(int nLevel=1) - { - if (nLevel < 1 || nLevel > 6) - return E_INVALIDARG; - return GetOuter()->EndTag(ATL_HTML_TAG_H1+nLevel-1); - } - - HRESULT pre(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_PRE, szContent, szAttrs); - } - - HRESULT preEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_PRE); - } - - HRESULT q(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_Q, szContent, szAttrs); - } - - HRESULT qEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_Q); - } - - HRESULT sub(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_SUB, szContent, szAttrs); - } - - HRESULT subEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_SUB); - } - - HRESULT sup(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_SUP, szContent, szAttrs); - } - - HRESULT supEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_SUP); - } - - HRESULT ins(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_INS, szContent, szAttrs); - } - - HRESULT insEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_INS); - } - - HRESULT del(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_DEL, szContent, szAttrs); - } - - HRESULT delEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_DEL); - } - - - HRESULT em(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_EM, szContent, szAttrs); - } - - HRESULT emEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_EM); - } - - HRESULT strong(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_STRONG, szContent, szAttrs); - } - - HRESULT strongEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_STRONG); - } - - HRESULT dfn(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_DFN, szContent, szAttrs); - } - - HRESULT dfnEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_DFN); - } - - HRESULT code(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_CODE, szContent, szAttrs); - } - - HRESULT codeEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_CODE); - } - - HRESULT samp(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_SAMP, szContent, szAttrs); - } - - HRESULT sampEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_SAMP); - } - - HRESULT kbd(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_KBD, szContent, szAttrs); - } - - HRESULT kbdEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_KBD); - } - - HRESULT var(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_VAR, szContent, szAttrs); - } - - HRESULT varEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_VAR); - } - - HRESULT cite(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_CITE, szContent, szAttrs); - } - - HRESULT citeEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_CITE); - } - - HRESULT abbr(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_ABBR, szContent, szAttrs); - } - - HRESULT abbrEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_ABBR); - } - - HRESULT acronym(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_ACRONYM, szContent, szAttrs); - } - - HRESULT acronymEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_ACRONYM); - } - - - HRESULT ol(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_OL, NULL, szAttrs); - } - - HRESULT ul(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_UL, NULL, szAttrs); - } - - HRESULT olEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_OL); - } - - HRESULT ulEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_UL); - } - - HRESULT li(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_LI, szContent, szAttrs); - } - - HRESULT liEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_LI); - } - - HRESULT dl(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_DL, szContent, szAttrs); - } - - HRESULT dlEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_DL); - } - - HRESULT dt(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_DT, szContent, szAttrs); - } - - HRESULT dtEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_DT); - } - - HRESULT dd(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_DD, szContent, szAttrs); - } - - HRESULT ddEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_DD); - } - - void SetSizePercent(int nWidth, int nHeight) - { - m_nWidthPercent = nWidth; - m_nHeightPercent = nHeight; - } - - HRESULT table(int nBorderWidth=0, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - m_RowStack.Push(&m_tableState); - m_tableState.Clear(); - - Attrs.AddFormat(_T("border=\"%d\""), nBorderWidth); - - if (m_nWidthPercent != -1) - Attrs.AddFormat(_T("width=\"%d%%\""), m_nWidthPercent); - if (m_nHeightPercent != -1) - Attrs.AddFormat(_T("height=\"%d%%\""), m_nHeightPercent); - - if (m_pScheme && m_pScheme->strTableBgColor.GetLength()) - Attrs.Add(_T("bgcolor"), m_pScheme->strTableBgColor); - - m_nWidthPercent = -1; - m_nHeightPercent = -1; - return GetOuter()->StartTag(ATL_HTML_TAG_TABLE, NULL, Attrs); - } - - HRESULT tableEnd() - { - if (m_tableState.m_bRowOpen) - GetOuter()->trEnd(); - m_RowStack.Pop(&m_tableState); - return GetOuter()->EndTag(ATL_HTML_TAG_TABLE); - } - - HRESULT tr(LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (m_RowStack.IsEmpty()) - GetOuter()->table(); - if (m_tableState.m_bRowOpen) - GetOuter()->trEnd(); - m_tableState.m_bRowOpen = true; - - if (m_pScheme && m_pScheme->strTrBgColor.GetLength()) - Attrs.Add(_T("bgcolor"), m_pScheme->strTrBgColor); - return GetOuter()->StartTag(ATL_HTML_TAG_TR, NULL, Attrs); - } - - HRESULT td(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (!m_tableState.m_bRowOpen) - GetOuter()->tr(); - m_tableState.m_bDataOpen = true; - if (m_pScheme && m_pScheme->strTdBgColor.GetLength()) - Attrs.Add(_T("bgColor"), m_pScheme->strTdBgColor); - - HRESULT hr = GetOuter()->StartTag(ATL_HTML_TAG_TD, szContent, Attrs); - if (FAILED(hr)) - return hr; - if (szContent) - m_tableState.m_bDataOpen = false; - return S_OK; - } - - HRESULT tdEnd() - { - if (!m_tableState.m_bDataOpen) - return S_OK; - m_tableState.m_bDataOpen = false; - return GetOuter()->EndTag(ATL_HTML_TAG_TD); - } - - HRESULT trEnd() - { - if (!m_tableState.m_bRowOpen) - return S_OK; - if (m_tableState.m_bDataOpen) - GetOuter()->tdEnd(); - m_tableState.m_bRowOpen = false; - return GetOuter()->EndTag(ATL_HTML_TAG_TR); - } - - HRESULT form(LPCTSTR szAction, ATL_HTML_FORM_METHOD nMethod=ATL_HTML_FORM_METHOD_GET, LPCTSTR szAttrs=NULL) - { - static const LPCTSTR s_szFormMethods[] = { NULL, _T("get"), _T("post"), _T("multipart-www-url-encoded") }; - return GetOuter()->form(szAction, s_szFormMethods[nMethod], szAttrs); - } - - HRESULT form(LPCTSTR szAction, LPCTSTR szMethod, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szAction && *szAction) - Attrs.Add(_T("action"), szAction); - if (szMethod && *szMethod) - Attrs.Add(_T("method"), szMethod); - - return GetOuter()->StartTag(ATL_HTML_TAG_FORM, NULL, Attrs); - } - - HRESULT input(LPCTSTR szType, LPCTSTR szName, LPCTSTR szValue, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szType && *szType) - Attrs.Add(_T("type"), szType); - if (szName && *szName) - Attrs.Add(_T("name"), szName); - if (szValue && *szValue) - Attrs.Add(_T("value"), szValue); - return GetOuter()->StartTag(ATL_HTML_TAG_INPUT, NULL, Attrs); - } - - HRESULT submit(LPCTSTR szValue=NULL, LPCTSTR szName=NULL, LPCTSTR szAttrs=NULL) - { - return input(_T("submit"), szName, szValue, szAttrs); - } - - HRESULT textarea(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_TEXTAREA, szContent, szAttrs); - } - - HRESULT textareaEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_TEXTAREA); - } - - HRESULT formEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_FORM); - } - - - HRESULT select(LPCTSTR szName, BOOL bMultiple=FALSE, LPCTSTR szAttrs=NULL) - { - ATLASSERT(szName && *szName); - - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - Attrs.Add(_T("name"), szName); - if (bMultiple) - Attrs.Add(_T("multiple"), NULL); - return GetOuter()->StartTag(ATL_HTML_TAG_SELECT, NULL, Attrs); - } - - HRESULT option(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_OPTION, szContent, szAttrs); - } - - HRESULT optionEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_OPTION); - } - - HRESULT selectEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_SELECT); - } - - - HRESULT head(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_HEAD, NULL, szAttrs); - } - - HRESULT headEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_HEAD); - } - - HRESULT html(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_HTML, NULL, szAttrs); - } - - HRESULT htmlEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_HTML); - } - - HRESULT map(LPCTSTR szName, LPCTSTR szAttrs=NULL) - { - ATLASSERT(szName && *szName); - - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - Attrs.Add(_T("name"), szName); - return GetOuter()->StartTag(ATL_HTML_TAG_MAP, NULL, Attrs); - } - - HRESULT mapEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_MAP); - } - - HRESULT area(LPCTSTR szAlt, LPCTSTR szHref=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szAlt && *szAlt) - Attrs.Add(_T("alt"), szAlt); - if (szHref && *szHref) - Attrs.Add(_T("href"), szHref); - return GetOuter()->StartTag(ATL_HTML_TAG_AREA, NULL, Attrs); - } - - HRESULT base(LPCTSTR szHref, LPCTSTR szAttrs=NULL) - { - ATLASSERT(szHref && *szHref); - - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - Attrs.Add(_T("href"), szHref); - return GetOuter()->StartTag(ATL_HTML_TAG_BASE, NULL, Attrs); - } - - HRESULT bdo(LPCTSTR szDir, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - ATLASSERT(szDir&& *szDir); - - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - Attrs.Add(_T("dir"), szDir); - return GetOuter()->StartTag(ATL_HTML_TAG_BDO, szContent, Attrs); - } - - HRESULT bdoEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_BDO); - } - - HRESULT big(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_BIG, szContent, szAttrs); - } - - HRESULT bigEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_BIG); - } - - HRESULT button(LPCTSTR szName=NULL, LPCTSTR szValue=NULL, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szName && *szName) - Attrs.Add(_T("name"), szName); - if (szValue && *szValue) - Attrs.Add(_T("value"), szValue); - return GetOuter()->StartTag(ATL_HTML_TAG_BUTTON, szContent, Attrs); - } - - HRESULT buttonEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_BUTTON); - } - - HRESULT iframe(LPCTSTR szSrc=NULL, LPCTSTR szWidth=NULL, LPCTSTR szHeight=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szSrc && *szSrc) - Attrs.Add(_T("src"), szSrc); - if (szWidth && *szWidth) - Attrs.Add(_T("width"), szWidth); - if (szHeight && *szHeight) - Attrs.Add(_T("height"), szHeight); - return GetOuter()->StartTag(ATL_HTML_TAG_IFRAME, NULL, Attrs); - } - - HRESULT iframeEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_IFRAME); - } - - HRESULT label(LPCTSTR szFor=NULL, LPCTSTR szAccessKey=NULL, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szFor && *szFor) - Attrs.Add(_T("for"), szFor); - if (szAccessKey && *szAccessKey) - Attrs.Add(_T("accesskey"), szAccessKey); - return GetOuter()->StartTag(ATL_HTML_TAG_LABEL, szContent, Attrs); - } - - HRESULT labelEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_LABEL); - } - - HRESULT link(LPCTSTR szRel=NULL, LPCTSTR szHref=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szRel && *szRel) - Attrs.Add(_T("rel"), szRel); - if (szHref && *szHref) - Attrs.Add(_T("href"), szHref); - return GetOuter()->StartTag(ATL_HTML_TAG_LINK, NULL, Attrs); - } - - HRESULT meta(LPCTSTR szName=NULL, LPCTSTR szContent=NULL, LPCTSTR szHttpEquiv=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (szName && *szName) - Attrs.Add(_T("name"), szName); - if (szContent && *szContent) - Attrs.Add(_T("content"), szContent); - if (szHttpEquiv && *szHttpEquiv) - Attrs.Add(_T("http-equiv"), szHttpEquiv); - return GetOuter()->StartTag(ATL_HTML_TAG_META, NULL, Attrs); - } - - HRESULT noframes(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_NOFRAMES, szContent, szAttrs); - } - - HRESULT noframesEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_NOFRAMES); - } - - HRESULT noscript(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_NOSCRIPT, szContent, szAttrs); - } - - HRESULT noscriptEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_NOSCRIPT); - } - - HRESULT col(int nSpan=1, LPCTSTR szWidth=NULL, LPCTSTR szHeight=NULL, LPCTSTR szVAlign=NULL, - LPCTSTR szHAlign=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - - if (nSpan != 1) - Attrs.AddFormat(_T("span"), _T("\"%d\""), nSpan); - if (szWidth && *szWidth) - Attrs.Add(_T("width"), szWidth); - if (szHeight && *szHeight) - Attrs.Add(_T("height"), szHeight); - if (szVAlign && *szVAlign) - Attrs.Add(_T("valign"), szVAlign); - if (szHAlign && *szHAlign) - Attrs.Add(_T("align"), szHAlign); - return GetOuter()->StartTag(ATL_HTML_TAG_COL, NULL, Attrs); - } - - HRESULT colgroup(int nSpan=1, LPCTSTR szWidth=NULL, LPCTSTR szHeight=NULL, LPCTSTR szVAlign=NULL, - LPCTSTR szHAlign=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - if (nSpan != 1) - Attrs.AddFormat(_T("span"), _T("\"%d\""), nSpan); - if (szWidth && *szWidth) - Attrs.Add(_T("width"), szWidth); - if (szHeight && *szHeight) - Attrs.Add(_T("height"), szHeight); - if (szVAlign && *szVAlign) - Attrs.Add(_T("valign"), szVAlign); - if (szHAlign && *szHAlign) - Attrs.Add(_T("align"), szHAlign); - return GetOuter()->StartTag(ATL_HTML_TAG_COL, NULL, Attrs); - } - - HRESULT colgroupEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_COLGROUP); - } - - HRESULT fieldset(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_FIELDSET, NULL, szAttrs); - } - - HRESULT fieldsetEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_FIELDSET); - } - - HRESULT legend(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_LEGEND, szContent, szAttrs); - } - - HRESULT legendEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_LEGEND); - } - - HRESULT tbody(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_TBODY, NULL, szAttrs); - } - - HRESULT tbodyEnd() - { - return GetOuter()->StartTag(ATL_HTML_TAG_TBODY); - } - - HRESULT tfoot(LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_TFOOT, NULL, szAttrs); - } - - HRESULT tfootEnd() - { - return GetOuter()->StartTag(ATL_HTML_TAG_TFOOT); - } - - HRESULT th(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - if (!m_tableState.m_bRowOpen) - GetOuter()->tr(); - m_tableState.m_bDataOpen = true; - return GetOuter()->StartTag(ATL_HTML_TAG_TH, szContent, szAttrs); - } - - HRESULT thEnd() - { - ATLASSUME(m_tableState.m_bDataOpen); - m_tableState.m_bDataOpen = false; - return GetOuter()->EndTag(ATL_HTML_TAG_TH); - } - - HRESULT title(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_TITLE, szContent, szAttrs); - } - - HRESULT titleEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_TITLE); - } - - HRESULT tt(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_TT, szContent, szAttrs); - } - - HRESULT ttEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_TT); - } - - // unfortunately, we can't use small since it is defined as char - // in rpcndr.h! - HRESULT _small(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_SMALL, szContent, szAttrs); - } - - HRESULT _smallEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_SMALL); - } - - HRESULT span(LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - return GetOuter()->StartTag(ATL_HTML_TAG_SPAN, szContent, szAttrs); - } - - HRESULT spanEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_SPAN); - } - - HRESULT object(LPCTSTR szClassId, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - if (szClassId && *szClassId) - Attrs.Add(_T("classid"), szClassId); - return GetOuter()->StartTag(ATL_HTML_TAG_OBJECT, szContent, Attrs); - } - - HRESULT object(REFCLSID rclsid, LPCTSTR szContent=NULL, LPCTSTR szAttrs=NULL) - { - USES_CONVERSION_EX; - OLECHAR szClsid[64]; - CString strClassId; - int i = StringFromGUID2(rclsid, szClsid, 64); - if (!i) - return E_FAIL; - szClsid[i-2] = 0; // don't want curly braces - strClassId.Format(_T("clsid:%s"), OLE2T_EX_DEF(szClsid+1)); - return object(strClassId, szContent, szAttrs); - } - - HRESULT objectEnd() - { - return GetOuter()->EndTag(ATL_HTML_TAG_OBJECT); - } - - HRESULT param(LPCTSTR szName, LPCTSTR szValue, LPCTSTR szAttrs=NULL) - { - ATLASSERT(szName && *szName); - - AtlHtmlAttrs Attrs; - Attrs.Set(szAttrs); - - Attrs.Add(_T("name"), szName); - if (szValue && *szValue) - Attrs.Add(_T("value"), szValue); - return GetOuter()->StartTag(ATL_HTML_TAG_PARAM, NULL, Attrs); - } - -private: - CString m_strState; - HTML_SCHEME *m_pScheme; - - struct TableState - { - TableState() : m_bRowOpen(false), m_bDataOpen(false) - { - - } - - void Clear() - { - m_bRowOpen = false; - m_bDataOpen = false; - } - - bool m_bRowOpen; - bool m_bDataOpen; - }; - - ATL_HTML_FORM_METHOD m_nFormMethod; - - TableState m_tableState; - CSimpleStack m_RowStack; - - int m_nWidthPercent; - int m_nHeightPercent; -}; - -class CHtmlGen : public CHtmlGenBase -{ -public: -}; - -} // namespace ATL -#pragma pack(pop) - -#endif // __ATLHTML_H__ diff --git a/include/atl/atlhttp.h b/include/atl/atlhttp.h deleted file mode 100644 index e8a4321e6..000000000 --- a/include/atl/atlhttp.h +++ /dev/null @@ -1,725 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLHTTP_H__ -#define __ATLHTTP_H__ - -#pragma once -#ifndef __CPPUNWIND -#pragma warning(push) -#pragma warning(disable: 4702) -#endif -#ifndef _WINSOCKAPI_ - #include -#endif -#include -#include -#include -#include -#define SECURITY_WIN32 -#include -#include -#ifndef _ATL_NO_DEFAULT_LIBS -#pragma comment(lib, "ws2_32.lib") -#pragma comment(lib, "SECUR32.LIB") -#endif // !_ATL_NO_DEFAULT_LIBS - -#include - -#pragma warning(push) -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -template -class CAtlHttpClientT; -class CAtlBaseAuthObject; - -enum status_headerparse{ - ATL_HEADER_PARSE_COMPLETE=0, - ATL_HEADER_PARSE_HEADERNOTCOMPLETE, - ATL_HEADER_PARSE_HEADERERROR -}; - -enum readstate{rs_init=0, rs_readheader, rs_scanheader, rs_readbody, rs_complete}; - -#define ATL_HEADER_END "\r\n\r\n" -#define ATL_HEADER_END_LEN 4 -#define ATL_DW_HEADER_END 0x0a0d0a0d -#define ATL_FIELDNAME_DELIMITER _T(':') -#define ATL_MAX_FIELDNAME_LEN 1024 -#define ATL_MAX_VALUE_LEN 1024 -#define ATL_AUTH_HDR_SIZE 1024 -#define ATL_READ_BUFF_SIZE 2048 -#define ATL_INVALID_STATUS -1 -#define ATL_HTTP_HEADER _T(" HTTP/1.1\r\n") -#define ATL_HTTP_HEADER_PROXY _T(" HTTP/1.1\r\n") -#ifndef ATL_HTTP_USERAGENT - #define ATL_HTTP_USERAGENT _T("User-Agent: Microsoft-ATL-Native/") _T(_ATL_VER_RBLD) _T("\r\n") -#endif - -#define ATL_IS_INVALIDCREDHANDLE(x) ((x.dwLower==0xFFFFFFFF) && (x.dwUpper==0xFFFFFFFF)) -#define ATL_HTTP_AUTHTYPE_NTLM _T("NTLM") -#define ATL_HTTP_AUTHTYPE_BASIC _T("BASIC") -#define ATL_HTTP_METHOD_GET _T("GET") -#define ATL_HTTP_METHOD_POST _T("POST") - -#ifndef MAX_REALM_LEN - #define MAX_REALM_LEN 1024 -#endif - -#ifndef _ATL_MAX_AUTH_BUFF - #define _ATL_MAX_AUTH_BUFF 512 -#endif - -__interface IAuthInfo; -typedef bool (WINAPI *PFNATLCHUNKEDCB)(BYTE** ppData, DWORD *pdwSize, DWORD_PTR dwParam); -typedef bool (WINAPI *PFNATLSTATUSCALLBACK)(DWORD dwBytesSent, DWORD_PTR dwParam); - -#define ATL_HTTP_FLAG_AUTO_REDIRECT 0x1 -#define ATL_HTTP_FLAG_PROCESS_RESULT 0x2 -#define ATL_HTTP_FLAG_SEND_CALLBACK 0x4 -#define ATL_HTTP_FLAG_SEND_BLOCKS 0x8 -#define ATL_HTTP_FLAG_INVALID_FLAGS 0xFFFFFFFF - -#ifndef ATL_HTTP_DEFAULT_BLOCK_SIZE - #define ATL_HTTP_DEFAULT_BLOCK_SIZE 4096 -#endif - -#define ATL_HTTP_CLIENT_EMPTY_READ_RETRIES 5 - -struct ATL_NAVIGATE_DATA -{ - LPCTSTR szExtraHeaders; - LPCTSTR szMethod; - LPCTSTR szDataType; - DWORD dwDataLen; - DWORD dwFlags; - DWORD dwTimeout; - DWORD dwSendBlockSize; - DWORD dwReadBlockSize; - DWORD_PTR m_lParamSend; - DWORD_PTR m_lParamRead; - DWORD_PTR m_lParamChunkCB; - short nPort; - BYTE *pData; - PFNATLCHUNKEDCB pfnChunkCallback; - PFNATLSTATUSCALLBACK pfnSendStatusCallback; - PFNATLSTATUSCALLBACK pfnReadStatusCallback; -}; - -class CAtlNavigateData : public ATL_NAVIGATE_DATA -{ -public: - CAtlNavigateData() throw(); // public construction - CAtlNavigateData(const CAtlNavigateData &rhs); - CAtlNavigateData(const ATL_NAVIGATE_DATA &rhs); - CAtlNavigateData& operator=(const CAtlNavigateData &rhs); - CAtlNavigateData& operator=(const ATL_NAVIGATE_DATA &rhs); - DWORD SetFlags(DWORD dwNewFlags) throw(); // set all flags - DWORD GetFlags() throw(); // get value of flags - DWORD AddFlags(DWORD dwFlagsToAdd) throw(); // add one or more flags to existing flags - DWORD RemoveFlags(DWORD dwFlagsToRemove) throw(); // remove one or more flags from existing flags - LPCTSTR SetExtraHeaders(LPCTSTR szNewHeaders) throw(); // set the extra request headers - LPCTSTR GetExtraHeaders() throw(); // get the extra request headers - LPCTSTR SetMethod(LPCTSTR szNewMethod) throw(); // set the HTTP request method - LPCTSTR GetMethod() throw(); // get the HTTP request method - short SetPort(short newPort) throw(); // set the TCP port for this request - short GetPort() throw(); // get the TCP port for this request - void SetPostData(BYTE *pData, DWORD dwDataLen, LPCTSTR szDataType) throw(); // Set data to be sent as the reqeust entity body - DWORD SetSocketTimeout(DWORD dwNewTimeout) throw(); // Set the timeout for this socket - DWORD GetSocketTimeout() throw(); // Get the timeout for this socket - DWORD SetSendBlockSize(DWORD dwBlockSize) throw(); // Set the size of the blocks used to send data - DWORD GetSendBlockSize() throw(); // get the size of the blocks used to send data - DWORD SetReadBlockSize(DWORD dwBlockSize) throw(); // Set the size of the blocks used to send data - DWORD GetReadBlockSize() throw(); // get the size of the blocks used to send data - PFNATLCHUNKEDCB SetChunkCallback(PFNATLCHUNKEDCB pfn, DWORD_PTR dwParam) throw(); // set the callback function used for sending chunked data - PFNATLCHUNKEDCB GetChunkCallback() throw(); // get the chunked callback function - PFNATLSTATUSCALLBACK SetSendStatusCallback(PFNATLSTATUSCALLBACK pfn, DWORD_PTR dwData) throw(); // sets a function pointer to be called after bytes are sent over the socket - PFNATLSTATUSCALLBACK GetSendStatusCallback() throw(); // returns current status callback function - PFNATLSTATUSCALLBACK SetReadStatusCallback(PFNATLSTATUSCALLBACK pfn, DWORD_PTR dwData) throw(); - PFNATLSTATUSCALLBACK GetReadStatusCallback() throw(); -}; - -template -class CAtlHttpClientT : - private TSocketClass -{ -public: - CAtlHttpClientT() throw(); - virtual ~CAtlHttpClientT() - { - } - - // Use these functions to send an HTTP request and retrieve - // the response. - bool Navigate( - const CUrl* pUrl, - ATL_NAVIGATE_DATA *pNavData = NULL - ) throw(...); - - bool Navigate( - LPCTSTR szServer, - LPCTSTR szPath, - ATL_NAVIGATE_DATA *pNavData = NULL - ) throw(...); - - bool Navigate( - LPCTSTR szURL, - ATL_NAVIGATE_DATA *pNavData = NULL - ) throw(...); - - - // Performs navigation, sending data with Transfer-Coding: chunked - bool NavigateChunked( - const CUrl *pUrl, - ATL_NAVIGATE_DATA *pData - ) throw(); - - bool NavigateChunked( - LPCTSTR szServer, - LPCTSTR szPath, - ATL_NAVIGATE_DATA *pNavData - ) throw(); - - bool NavigateChunked( - LPCTSTR szURL, - ATL_NAVIGATE_DATA *pNavData - ) throw(); - - // Use to set/retrieve information about the proxy server used - // when making this request via a proxy server. - bool SetProxy(LPCTSTR szProxy = NULL, short nProxyPort = 0) throw(); - void RemoveProxy() throw(); - LPCTSTR GetProxy() const throw(); - short GetProxyPort() const throw(); - - // Use these functions to add/remove/find objects that will - // be used to authorize request when a 401 Not Authorized response - // is received. This class maps these objects by scheme name in map. - // Override NegotiateAuth to change the way authorization negotiation occurs. - bool AddAuthObj(LPCTSTR szScheme, CAtlBaseAuthObject *pObject, IAuthInfo *pInfo=NULL) throw(); - const CAtlBaseAuthObject* FindAuthObject(LPCTSTR szScheme) throw(); - bool RemoveAuthObject(LPCTSTR szScheme) throw(); - virtual bool NegotiateAuth(bool bProxy) throw(); - - - // Retrieve the value of a response header - bool GetHeaderValue(LPCTSTR szName, CString& strValue) const throw(); - bool GetHeaderValue(__in_z LPCTSTR szName, __out_ecount_part_z_opt(*pdwLen, *pdwLen) LPTSTR szBuffer, __inout DWORD *pdwLen) const throw(); - - DWORD GetResponseLength() throw(); // Get the number of bytes in the response - const BYTE* GetResponse() throw(); // Get the entire response - DWORD GetBodyLength() const throw(); // Get the length of the body of the response (everything after the \r\n\r\n) - const BYTE* GetBody() throw(); // Get the body of the response (length is determined by GetBodyLength()) - DWORD GetRawResponseHeaderLength() throw(); // Get the length of the raw request headers - bool GetRawResponseHeader(LPBYTE szBuffer, DWORD *pdwLen) throw(); // Get the raw request headers - LPCURL GetCurrentUrl() const throw(); // Get a pointer to the current URL for this request - DWORD GetFlags() const throw(); // Retrieve flags used for processing this request - int GetStatus() throw(); // Get the HTTP status code that resulted from making this request - LPCTSTR GetMethod() throw(); // Get the HTTP method used for making this request - BYTE* GetPostData() throw(); // Get a pointer to raw data being sent with this request - DWORD GetPostDataLen() throw(); // Get the length of the raw data sent with this request - LPCTSTR GetPostDataType() throw(); // Get the data type (sent as Content-Type header) for this request - DWORD GetLastError() throw(); // Retrieves errors from the underlying socket - const SOCKET& GetSocket() throw(); // Retrieves the underlying socket. Be careful! - void Close() throw(); // Close the connection - DWORD SetSocketTimeout(DWORD dwNewTimeout) throw(); // Sets a new socket timeout, returns the old timeout. - DWORD GetSocketTimeout() throw(); // retrieves the current socket timeout - void AuthProtocolFailed(LPCTSTR szProto) throw(); // notifies us of failure to connect with the named protocol - const ATL_NAVIGATE_DATA* GetCurrentNavdata(); - enum HTTP_RESPONSE_READ_STATUS - { - RR_OK = 0, // response was successfully processed - RR_FAIL, // an unknown error occurred reading the HTTP response - RR_STATUS_INVALID, // could not parse the status line - RR_PARSEHEADERS_FAILED, // failed to parse HTTP response headers - RR_READSOCKET_FAILED, // failed to read response data from socket - RR_READBODY_FAILED, // failed to successfully read the entity body of the HTTP response - RR_READCHUNKEDBODY_FAILED, // failed to read a 'Transfer-Encoding: chunked' response body - RR_NOT_READ // we haven't started reading the response. - }; - HTTP_RESPONSE_READ_STATUS GetResponseStatus(); - - -// Implementation - HTTP_RESPONSE_READ_STATUS ReadHttpResponse() throw(); - void ResetConnection() throw(); - bool ProcessStatus(DWORD dwFlags) throw(); - bool BuildRequest(/*out*/CString *pstrRequest, - LPCTSTR szDataType=NULL, - LPCTSTR szExtraHeaders=NULL) throw(); - - void SetSilentLogonOk(bool bSet) - { - m_bSilentLogonOk = bSet; - } -protected: - DWORD WriteWithNoData(LPCSTR pRequest, DWORD dwRequestLen); - DWORD WriteWithCallback(LPCSTR pRequest, DWORD dwRequestLen); - DWORD WriteWithChunks(LPCSTR pRequest, DWORD dwRequestLen); - DWORD WriteWithData(LPCSTR pRequest, DWORD dwRequestLen); - bool SetDefaultUrl(LPCTSTR szUrl, short nPortNumber=ATL_URL_DEFAULT_HTTP_PORT) throw(); - bool SetDefaultUrl(LPCURL pUrl, short nPortNumber=ATL_URL_DEFAULT_HTTP_PORT) throw(); - bool SetDefaultMethod(LPCTSTR szMethod) throw(); - void InitializeObject() throw(); - void ResetRequest() throw(); - bool ReadSocket() throw(); - unsigned char* FindHeaderEnd(unsigned char** ppBegin) throw(); - bool LookupRegProxy() throw(); - bool DisconnectIfRequired() throw(); - bool ConnectSocket() throw(); - - long GetContentLength() throw(); - LPCSTR NextLine(BYTE* pCurr) throw(); - bool IsMsgBodyChunked() throw(); - LPCSTR FindEndOfHeader(LPCSTR pszStart) throw(); - bool DecodeHeader(LPCSTR pHeaderStart, LPCSTR pHeaderEnd) throw(); - virtual void OnSetCookie(LPCTSTR /*szCookie*/) throw(); - LPCSTR ParseStatusLine(BYTE* pBuffer) throw(); - int CrackResponseHeader(LPCSTR pBuffer, /*out*/ LPCSTR *pEnd) throw(); - bool ReadBody(int nContentLen, int nCurrentBodyLen) throw(); - bool ReadChunkedBody() throw(); - bool ReconnectIfRequired() throw(); - bool CompleteURL(CString& strURL) throw(); - bool ProcessObjectMoved() throw(); - bool _SetDefaultUrl(LPCTSTR szURL, short nPort) throw(); - - enum CHUNK_STATE{ - READ_CHUNK_SIZE, // need to read the size of a chunk. - READ_CHUNK_SIZE_FOOTER, - READ_CHUNK_DATA, // need to read the actual data - READ_CHUNK_DATA_FOOTER, // need to read the chunk footer. - READ_CHUNK_TRAILER, // Read the trailer headers at the end of the chunk data - READ_CHUNK_TRAILER_FOOTER, // read the final crlf - CHUNK_READ_DATA_COMPLETE, // done reading chunk data. - }; - - enum CHUNK_LEX_RESULT{ - LEX_OK, - LEX_OUTOFDATA, - LEX_ERROR, - LEX_TRAILER_COMPLETE - }; - - CHUNK_LEX_RESULT get_chunked_size(__deref_inout char *&pBuffStart, __deref_inout char *&pBuffEnd, __inout long* pnChunkSize) throw(); - bool move_leftover_bytes(__in_ecount(nLen) char *pBufferStart, __in int nLen, __deref_inout char *&pBuffStart, __deref_inout char *&pBuffEnd) throw(); - CHUNK_LEX_RESULT get_chunked_data(__deref_inout char *&pBufferStart, __deref_inout char *&pBufferEnd, long nChunkSize, - __deref_out_ecount_part(*pnDataLen, *pnDataLen) char **ppDataStart, __inout long *pnDataLen) throw(); - CHUNK_LEX_RESULT consume_chunk_trailer(__deref_inout char *&pBufferStart, __deref_inout char *pBufferEnd) throw(); - CHUNK_LEX_RESULT consume_chunk_footer(__deref_inout char *&pBufferStart, __deref_inout char *&pBufferEnd) throw(); - - typedef CAtlMap< - CString, - CString, - CStringElementTraitsI, - CStringElementTraitsI - > HeaderMapType; - - typedef CAtlMap < - CString, - CAtlBaseAuthObject*, - CStringElementTraitsI - > AuthMapType; - - typedef CAtlArray< - CString, - CStringElementTraitsI - > AuthListType; - - HeaderMapType m_HeaderMap; // Map of response headers - AuthMapType m_AuthMap; // Map of pointers to authorization objects. - AuthListType m_AuthTypes; // list of authorization types the server is willing to use. - BOOL m_bSilentLogonOk; - CAtlIsapiBuffer<> m_current; // The entire response - CUrl m_urlCurrent; // URL of current request - - CString m_strMethod; // Current request method. - CString m_strProxy; // Path to current proxy server. - - long m_nStatus; // Current response status (from status line) - short m_nProxyPort; // Port used on current proxy server - DWORD m_dwBodyLen; // Length of body - DWORD m_dwHeaderLen; // Length of current raw headers - DWORD m_dwHeaderStart; - BYTE *m_pCurrent; - BYTE *m_pEnd; // the end of the data we've read fromt he socket; - ATL_NAVIGATE_DATA *m_pNavData; - HTTP_RESPONSE_READ_STATUS m_LastResponseParseError; -}; //CAtlHttpClientT -typedef CAtlHttpClientT CAtlHttpClient; - - -// Interface used to acquire authentication information from clients -__interface IAuthInfo -{ - HRESULT GetPassword(__out_ecount_part_z_opt(*pdwBuffSize, *pdwBuffSize) LPTSTR szPwd, __inout DWORD *pdwBuffSize); - HRESULT GetUsername(__out_ecount_part_z_opt(*pdwBuffSize, *pdwBuffSize) LPTSTR szUid, __inout DWORD *pdwBuffSize); - HRESULT GetDomain(__out_ecount_part_z_opt(*pdwBuffSize, *pdwBuffSize) LPTSTR szDomain, __inout DWORD *pdwBuffSize); -}; -typedef HRESULT (IAuthInfo::*PFNAUTHFUNC)(LPTSTR szPwd, DWORD *pdwSize); - -// pure virtual class that describes required functions for authoriztion -// objects -class CAtlBaseAuthObject -{ -public: - CAtlBaseAuthObject(); - virtual bool Authenticate(LPCTSTR szAuthTypes, bool bProxy) = 0; - virtual void Init(CAtlHttpClient *pSocket, IAuthInfo *pAuthInfo) = 0; - bool m_bFailed; -}; - -// strings used for authentication. -extern __declspec(selectany)const TCHAR * const g_pszWWWAuthenticate = _T("www-authenticate"); -extern __declspec(selectany)const TCHAR * const g_pszProxyAuthenticate = _T("proxy-authenticate"); - -// Performs NTLM authentication -class CNTLMAuthObject : - public CAtlBaseAuthObject -{ -public: - virtual ~CNTLMAuthObject() throw(); - CNTLMAuthObject() throw(); - CNTLMAuthObject(IAuthInfo *pAuthInfo) throw(); - void SetAuthInfo(IAuthInfo *pAuthInfo) throw(); - bool GetCredentialNames(CString& theName); - -// Implementation - // Called by the CAtlHttpClient class to authenticate a user. - virtual void Init(CAtlHttpClient *pSocket, IAuthInfo *pAuthInfo=NULL) throw(); - - // Called by the CAtlHttpClient class to initialize this authentication object. - virtual bool Authenticate(LPCTSTR szAuthTypes, bool bProxy) throw(); -protected: - bool AcquireCredHandle() throw(); - // This function creates an NTML Authorization header - // and sends it to the HTTP server. - bool SendSecurityInfo(SecBuffer *pSecBuffer, LPSTR *pszBuffer) throw(); - bool DoNTLMAuthenticate() throw(); - - IAuthInfo *m_pAuthInfo; - CAtlHttpClient *m_pSocket; - CredHandle m_hCredentials; - int m_nMaxTokenSize; - TimeStamp m_ts; - bool m_bProxy; - static const char * const m_pszFmtWWW; - static const char * const m_pszFmtProxy; - CAtlNavigateData m_CurrentRequestData; - -}; // CNTLMAuthObject - -// Performs BASIC authentication for an CAtlHttpClient -// object. Caller must implement an IAuthInfo interface -// and pass it to this object before this object attempts -// to authenticate or authentication will fail. -class CBasicAuthObject : - public CAtlBaseAuthObject -{ -public: - CBasicAuthObject() throw(); - CBasicAuthObject(IAuthInfo *pAuthInfo) throw(); - void SetAuthInfo(IAuthInfo *pAuthInfo) throw(); - LPCTSTR GetRealm() throw(); // Retrieve's the realm being used. - -// Implementation - // Called by the CAtlHttpClient class to authenticate a user. - virtual bool Authenticate(LPCTSTR szAuthTypes, bool bProxy) throw(); - - // Called by the CAtlHttpClient class to initialize this authentication object. - virtual void Init(CAtlHttpClient *pSocket, IAuthInfo *pAuthInfo=NULL) throw(); -protected: - bool DoBasicAuthenticate() throw(); - bool CrackRealm(LPCTSTR szHeader) throw(); - - IAuthInfo *m_pAuthInfo; - CAtlHttpClient *m_pClient; - TCHAR m_szRealm[MAX_REALM_LEN]; - bool m_bProxy; - static const char * const m_pszFmtWWW; - static const char * const m_pszFmtProxy; -}; // CBasicAuthObject - -__declspec(selectany)const char * const CBasicAuthObject::m_pszFmtWWW = "Authorization: Basic "; -__declspec(selectany)const char * const CBasicAuthObject::m_pszFmtProxy = "Proxy-Authorization: Basic "; -__declspec(selectany)const char * const CNTLMAuthObject::m_pszFmtWWW = "Authorization: NTLM %s\r\n"; -__declspec(selectany)const char * const CNTLMAuthObject::m_pszFmtProxy = "Proxy-Authorization: NTLM %s\r\n"; - -typedef CTempBuffer CAuthInfoBuffType; -inline bool _AtlGetAuthInfoHelper(IAuthInfo *pObj, PFNAUTHFUNC pFunc, CAuthInfoBuffType& buff, DWORD *dwLen) throw() -{ - ATLENSURE_RETURN_VAL(pObj, false); - ATLENSURE_RETURN_VAL(pFunc, false); - DWORD dwSize = _ATL_MAX_AUTH_BUFF; - bool bRet = true; - TCHAR *szValue = NULL; - _ATLTRY - { - szValue = buff.Allocate(_ATL_MAX_AUTH_BUFF); - HRESULT hr = E_FAIL; - if (szValue) - { - hr = (pObj->*pFunc)(szValue, &dwSize); - if (hr != S_OK) - { - if (hr == E_OUTOFMEMORY) - { - // buffer not big enough, try to allocate - szValue = buff.Reallocate(dwSize); - if (szValue) - { - // retry the call - if (S_OK != (pObj->*pFunc)(szValue, &dwSize)) - bRet = false; - } - else - bRet = false; - } - else - bRet = false; - } - } - else - bRet = false; - - } - _ATLCATCHALL() - { - bRet = false; - } - if (bRet) - *dwLen = (DWORD)_tcslen(szValue); - else - *dwLen = 0; - return bRet; -} - -// -// Security Service Provider Interface (sspi) Helper classes -// These classes are used as helpers for structures used in -// SSPI functions. -// -class CSecAuthIdentity : public SEC_WINNT_AUTH_IDENTITY_EX -{ -public: - CSecAuthIdentity() throw() - { - Version = SEC_WINNT_AUTH_IDENTITY_VERSION; - Length = sizeof(SEC_WINNT_AUTH_IDENTITY_EX); -#ifdef _UNICODE - Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; -#else - Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; -#endif - } - - - bool Init(IAuthInfo *pAuthInfo) throw() - { - if (!pAuthInfo) - return false; - - if (!_AtlGetAuthInfoHelper(pAuthInfo, &IAuthInfo::GetUsername, buffUserName, &UserLength)) - return false; - - if (!_AtlGetAuthInfoHelper(pAuthInfo, &IAuthInfo::GetPassword, buffPassword, &PasswordLength)) - return false; - - if (!_AtlGetAuthInfoHelper(pAuthInfo, &IAuthInfo::GetDomain, buffDomain, &DomainLength)) - return false; - -#ifndef _UNICODE - User = (unsigned char*)(char*)buffUserName; - Domain = DomainLength > 0 ? (unsigned char*)(char*)buffDomain : 0; - Password = PasswordLength > 0 ? (unsigned char*)(char*)buffPassword : 0; -#else - // have to cast to unsigned short *, because SEC_WINNT_AUTH_IDENTITY_EXW - // uses unsigned short instead of wchar_t - User = (unsigned short *)(wchar_t*)buffUserName; - Domain = DomainLength > 0 ? (unsigned short *)(wchar_t*)buffDomain : 0; - Password = PasswordLength > 0 ? (unsigned short *)(wchar_t*)buffPassword : 0; -#endif - return true; - } - -protected: - CAuthInfoBuffType buffUserName; - CAuthInfoBuffType buffPassword; - CAuthInfoBuffType buffDomain; -}; // CSecAuthIdentity - -class CSecBuffer : public SecBuffer -{ -public: - CSecBuffer() throw() - { - cbBuffer = 0; - BufferType = 0; - pvBuffer = NULL; - m_cbAlloc = 0; - } - - ~CSecBuffer() throw() - { - delete [] static_cast(pvBuffer); - } - - bool SetSize(unsigned long nSize) throw() - { - if (!nSize) - return false; - - if (pvBuffer) - { - delete [] static_cast(pvBuffer); - pvBuffer = NULL; - cbBuffer = 0; - m_cbAlloc = 0; - } - - ATLTRY(pvBuffer = static_cast(new unsigned char[nSize])); - if (pvBuffer) - { - cbBuffer = nSize; - BufferType = SECBUFFER_TOKEN; - m_cbAlloc = cbBuffer; - return true; - } - return false; - } - - bool ClearBuffer(unsigned long nSize) throw() - { - if(nSize > m_cbAlloc) - return false; - - ZeroMemory(pvBuffer, nSize); - cbBuffer = nSize; - return true; - } - - unsigned long Size() - { - return cbBuffer; - } - - unsigned char *Buffer() throw() - { - return static_cast(pvBuffer); - } - - operator SecBuffer*() throw() - { - return (SecBuffer*)this; - } - -protected: - unsigned long m_cbAlloc; - -}; // CSecBuffer - -class CSecBufferDesc : public SecBufferDesc -{ -public: - CSecBufferDesc() throw() - { - ulVersion = SECBUFFER_VERSION; - cBuffers = 0; - pBuffers = NULL; - } - - ~CSecBufferDesc() throw() - { - cBuffers = 0; - - if (pBuffers) - { - CSecBuffer *psb = (CSecBuffer*)pBuffers; - delete [] psb; - } - } - - // index is 0 based - CSecBuffer* Buffers(unsigned int i) throw() - { - if (i < cBuffers) - { - return (CSecBuffer*)(&pBuffers[i]); - } - - return NULL; - } - - bool AddBuffers(unsigned int nCount, unsigned int nBufferSize) throw() - { - if (!nCount) - return true; - - if (cBuffers == 0) - { - CSecBuffer *pSecBuffer = NULL; - ATLTRY(pSecBuffer = new CSecBuffer[nCount]); - if (!pSecBuffer) - return false; - CAutoVectorPtr spSecBuffer(pSecBuffer); - - for (unsigned int i=0; i spSecBuffer(pSecBuffer); - Checked::memcpy_s(pSecBuffer, (nCount + cBuffers)*sizeof(CSecBuffer), pBuffers, cBuffers*sizeof(CSecBuffer)); - delete [] pBuffers; - pBuffers=NULL; - - // initialize new buffers - for (unsigned int i=0; i(this); - } -}; // CSecBufferDesc - -} // namespace ATL - - -#include - -#pragma pack(pop) -#pragma warning(pop) - -#ifndef __CPPUNWIND -#pragma warning(pop) -#endif - -#endif // __ATLHTTP_H__ diff --git a/include/atl/atlhttp.inl b/include/atl/atlhttp.inl deleted file mode 100644 index 71294b49b..000000000 --- a/include/atl/atlhttp.inl +++ /dev/null @@ -1,3144 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLHTTP_INL__ -#define __ATLHTTP_INL__ - -#include - -#pragma warning(push) -#pragma warning(disable: 4061) // enumerate 'enum value' in switch of enum 'enum type' is not explicitly handled by a case label -#pragma warning(disable: 4062) // enumerate 'enum value' in switch of enum 'enum type' is not handled - -namespace ATL -{ - -///////////////////////////////////////////////////////////////////////////////// -// -// CAtlHttpClient -// Implementation of CAtlHttpClient member functions -// -///////////////////////////////////////////////////////////////////////////////// -template -inline CAtlHttpClientT::CAtlHttpClientT() throw() -{ - InitializeObject(); -} - -// Sets this object to a known state. -template -inline void CAtlHttpClientT::InitializeObject() throw() -{ - Close(); // will close the socket if it's already open - ResetRequest(); - SetSilentLogonOk(FALSE); -} - -template -inline void CAtlHttpClientT::ResetRequest() throw() -{ - // reset all data that has to do with the current request - m_HeaderMap.RemoveAll(); - m_current.Empty(); - m_urlCurrent.Clear(); - m_strMethod.Empty(); - m_nStatus = ATL_INVALID_STATUS; - m_dwBodyLen = 0; - m_dwHeaderLen = 0; - m_dwHeaderStart = 0; - m_pCurrent = NULL; - m_pNavData = NULL; - m_LastResponseParseError = RR_NOT_READ; - m_pEnd = NULL; - -} - - -// Use this function to retrieve an entity from a server via an HTTP -// request. This function will either request a connection from the -// server specified in the szURL parameter or request a connection from -// the proxy server. If a proxy server is to be used, you must call -// SetProxy prior to calling this function to specify the proxy server -// being used. Once the connection is established, an HTTP request -// is built and sent to the HTTP server. An attempt to read the HTTP -// response is then made. If the response is successfully read, the -// response will be parsed and stored in this class instance. The -// headers can be parsed via the LookupHeader function and the body -// of the response can be retrieved using the GetBody function. You -// can also retrieve the contents of the entire response by calling -// GetResponse. -template -inline bool CAtlHttpClientT::Navigate( - - LPCTSTR szUrl, - ATL_NAVIGATE_DATA *pNavData - ) throw(...) -{ - if (!szUrl || *szUrl == _T('\0')) - return false; - - CUrl url; - TCHAR szTmp[ATL_URL_MAX_URL_LENGTH]; - if(!AtlEscapeUrl(szUrl,szTmp,0,ATL_URL_MAX_URL_LENGTH-1,ATL_URL_BROWSER_MODE)) - return false; - - if(!url.CrackUrl(szTmp)) - return false; - - // Navigate - return Navigate(&url, pNavData); -} - -template -inline bool CAtlHttpClientT::Navigate( - LPCTSTR szServer, - LPCTSTR szPath, - ATL_NAVIGATE_DATA *pNavData - ) throw(...) -{ - // Create a URL - if (!szServer || *szServer == _T('\0')) - return false; - if (!szPath || *szPath == _T('\0')) - return false; - CUrl url; - url.SetScheme(ATL_URL_SCHEME_HTTP); - url.SetHostName(szServer); - url.SetUrlPath(szPath); - if (pNavData) - url.SetPortNumber(pNavData->nPort); - else - url.SetPortNumber(ATL_URL_DEFAULT_HTTP_PORT); - - TCHAR szUrl[ATL_URL_MAX_URL_LENGTH]; - DWORD dwMaxLen = ATL_URL_MAX_URL_LENGTH; - if (!url.CreateUrl(szUrl, &dwMaxLen)) - return false; - - // Navigate - return Navigate(szUrl, pNavData); -} - -template -inline bool CAtlHttpClientT::Navigate( - const CUrl *pUrl, - ATL_NAVIGATE_DATA *pData - ) throw(...) -{ - bool bRet = false; - if (!pUrl) - return false; - - ResetRequest(); - - CAtlNavigateData default_nav_data; - if (!pData) - m_pNavData = &default_nav_data; - else - m_pNavData = pData; - - ATLASSUME(m_pNavData); - - _ATLTRY - { - m_strMethod = m_pNavData->szMethod; - } - _ATLCATCHALL() - { - return false; - } - - SetSocketTimeout(m_pNavData->dwTimeout); - - // set m_urlCurrent - if (!SetDefaultUrl(pUrl, m_pNavData->nPort)) - return false; - DWORD dwSent = 0; - CString strRequest; - CString strExtraInfo; - - if (!BuildRequest(&strRequest, - m_pNavData->szMethod, - m_pNavData->szExtraHeaders)) - { - return false; - } - - - if (!ConnectSocket()) - return false; - - LPCTSTR szTRequest = strRequest; - CT2CA strARequest(szTRequest); - DWORD dwRequestLen = (DWORD)strlen(strARequest); - DWORD dwAvailable = dwRequestLen + m_pNavData->dwDataLen; - - if (m_pNavData->dwFlags & ATL_HTTP_FLAG_SEND_CALLBACK) - { - dwSent = WriteWithCallback(strARequest, dwRequestLen); - } - else if (!m_pNavData->pData) - dwSent = WriteWithNoData(strARequest, dwRequestLen); - else if (m_pNavData->pData && (m_pNavData->dwFlags & ATL_HTTP_FLAG_SEND_BLOCKS)) - { - dwSent = WriteWithChunks(strARequest, dwRequestLen); - } - else if(m_pNavData->pData) - { - dwSent = WriteWithData(strARequest, dwRequestLen); - } - - - // make sure everything was sent - if (dwSent == dwAvailable) - { - // Read the response - if (RR_OK == ReadHttpResponse()) - { - // if navigation isn't complete, try to complete - // it based on the status code and flags - if ((m_pNavData->dwFlags & ATL_HTTP_FLAG_PROCESS_RESULT)&& - !ProcessStatus(m_pNavData->dwFlags)) - { - bRet = false; - } - else - bRet = true; - } - else - bRet = false; - } - - if (!bRet) - Close(); // some kind of failure happened, close the socket. - - m_pNavData = NULL; - return bRet; -} - -template -inline DWORD CAtlHttpClientT::WriteWithNoData(LPCSTR pRequest, DWORD dwRequestLen) -{ - ATLASSUME(m_pNavData); - WSABUF Buffer; - Buffer.buf = (char*)pRequest; - Buffer.len = (int)dwRequestLen; - DWORD dwWritten = 0; - Write(&Buffer, 1, &dwWritten); - if (m_pNavData->pfnSendStatusCallback) - m_pNavData->pfnSendStatusCallback(dwWritten, m_pNavData->m_lParamSend); - return dwWritten; -} - -// The entity body will be retrieved from the client by calling their -// callback function. -template -inline DWORD CAtlHttpClientT::WriteWithCallback(LPCSTR pRequest, DWORD dwRequestLen) -{ - ATLASSUME(m_pNavData); - if (!(m_pNavData->pfnChunkCallback && - (m_pNavData->dwFlags & ATL_HTTP_FLAG_SEND_CALLBACK))) - return 0; // error, must have flag set and callback function - - // write the request - DWORD dwTotalWritten = 0; - WSABUF Buffer; - Buffer.buf = (char*)pRequest; - Buffer.len = (int)dwRequestLen; - DWORD dwWritten = 0; - Write(&Buffer, 1, &dwWritten); - if (m_pNavData->pfnSendStatusCallback) - if (!m_pNavData->pfnSendStatusCallback(dwWritten, m_pNavData->m_lParamSend)) - return 0; - if (!dwWritten) - return 0; // failure - dwTotalWritten += dwWritten; - - // start writing data; - while (m_pNavData->pfnChunkCallback((BYTE**)&Buffer.buf, (DWORD*)&Buffer.len, m_pNavData->m_lParamChunkCB) && - Buffer.len > 0 && - Buffer.buf != NULL) - { - Write(&Buffer, 1, &dwWritten); - if (dwWritten != Buffer.len) - return 0; - if (m_pNavData->pfnSendStatusCallback) - if (!m_pNavData->pfnSendStatusCallback(dwWritten, m_pNavData->m_lParamSend)) - return 0; - dwTotalWritten += dwWritten; - } - return dwTotalWritten; -} - -template -inline DWORD CAtlHttpClientT::WriteWithChunks(LPCSTR pRequest, DWORD dwRequestLen) -{ - ATLASSUME(m_pNavData); - if (!(m_pNavData->dwSendBlockSize > 0 && (m_pNavData->dwFlags & ATL_HTTP_FLAG_SEND_BLOCKS))) - return 0; // error, must have flag set and callback function - - // write the request - DWORD dwTotalWritten = 0; - WSABUF Buffer; - Buffer.buf = (char*)pRequest; - Buffer.len = (int)dwRequestLen; - DWORD dwWritten = 0; - Write(&Buffer, 1, &dwWritten); - if (m_pNavData->pfnSendStatusCallback) - if (!m_pNavData->pfnSendStatusCallback(dwWritten, m_pNavData->m_lParamSend)) - return 0; - if (!dwWritten) - return 0; // failure - dwTotalWritten += dwWritten; - - // start writing data; - DWORD dwDataWritten = 0; - DWORD dwDataLeft = m_pNavData->dwDataLen; - while (dwDataLeft) - { - Buffer.buf = (char*)(m_pNavData->pData + dwDataWritten); - Buffer.len = __min(dwDataLeft, m_pNavData->dwSendBlockSize); - Write(&Buffer, 1, &dwWritten); - if (dwWritten != Buffer.len) - return 0; - if (m_pNavData->pfnSendStatusCallback) - if (!m_pNavData->pfnSendStatusCallback(dwWritten, m_pNavData->m_lParamSend)) - return false; - dwTotalWritten += dwWritten; - dwDataWritten += dwWritten; - dwDataLeft -= dwWritten; - } - return dwTotalWritten; -} - -template -inline DWORD CAtlHttpClientT::WriteWithData(LPCSTR pRequest, DWORD dwRequestLen) -{ - WSABUF Buffers[2]; - Buffers[0].buf = (char*)pRequest; - Buffers[0].len = dwRequestLen; - Buffers[1].buf = (char*)m_pNavData->pData; - Buffers[1].len = m_pNavData->dwDataLen; - - DWORD dwWritten = 0; - Write(Buffers, 2, &dwWritten); - if (m_pNavData->pfnSendStatusCallback) - m_pNavData->pfnSendStatusCallback(dwWritten, m_pNavData->m_lParamSend); - - return dwWritten; -} - -template -bool CAtlHttpClientT::NavigateChunked( - LPCTSTR szServer, - LPCTSTR szPath, - ATL_NAVIGATE_DATA *pNavData - ) throw() -{ - // Create a URL - if (!szServer || *szServer == _T('\0')) - return false; - if (!szPath || *szPath == _T('\0')) - return false; - - if (!pNavData) - { - // To do chunked navigation you must specify an - // ATL_NAVIGATE_DATA structure that has the pfnChunkCallback - // member filled out. - ATLASSERT(FALSE); - return false; - } - CUrl url; - url.SetScheme(ATL_URL_SCHEME_HTTP); - url.SetHostName(szServer); - url.SetUrlPath(szPath); - if (pNavData) - url.SetPortNumber(pNavData->nPort); - else - url.SetPortNumber(ATL_URL_DEFAULT_HTTP_PORT); - - TCHAR szUrl[ATL_URL_MAX_URL_LENGTH]; - DWORD dwMaxLen = ATL_URL_MAX_URL_LENGTH; - if (!url.CreateUrl(szUrl, &dwMaxLen)) - return false; - - // Navigate - return NavigateChunked(szUrl, pNavData); -} - -template -bool CAtlHttpClientT::NavigateChunked( - LPCTSTR szURL, - ATL_NAVIGATE_DATA *pNavData - ) throw() -{ - if (!szURL || *szURL == _T('\0')) - return false; - - ResetRequest(); - - ATLASSERT(pNavData); - - CUrl url; - if (!url.CrackUrl(szURL)) - return false; - - // Navigate - return NavigateChunked(&url, pNavData); -} - -template -inline bool CAtlHttpClientT::NavigateChunked( - const CUrl *pUrl, - ATL_NAVIGATE_DATA *pNavData - ) throw() -{ - if (!pUrl) - return false; - - if (!pNavData) - { - // To do chunked navigation you must specify an - // ATL_NAVIGATE_DATA structure that has the pfnChunkCallback - // member filled out. - ATLASSERT(FALSE); - return false; - } - - m_pNavData = pNavData; - if (!pNavData->pfnChunkCallback) - return false; - - bool bRet = true; - - _ATLTRY - { - m_strMethod = m_pNavData->szMethod; - } - _ATLCATCHALL() - { - return false; - } - - SetSocketTimeout(m_pNavData->dwTimeout); - - // set m_urlCurrent - if (!SetDefaultUrl(pUrl, m_pNavData->nPort)) - return false; - - - DWORD dwSent = 0; - CString strRequest; - CString strExtraInfo; - - if (!BuildRequest(&strRequest, - m_pNavData->szMethod, - m_pNavData->szExtraHeaders // extra headers - )) - { - return false; - } - - if (!ConnectSocket()) - return false; - - WSABUF Buffers[3]; - - _ATLTRY - { - CT2A pRequest(strRequest); - - Buffers[0].buf = (char*)pRequest; - Buffers[0].len = strRequest.GetLength(); - - // send the first buffer which is the request - if (!Write(Buffers, 1, &dwSent)) - { - Close(); - return false; - } - } - _ATLCATCHALL() - { - Close(); - return false; - } - Buffers[0].buf = NULL; - Buffers[0].len = 0; - - CStringA strChunkSize; - - Buffers[2].buf = "\r\n"; - Buffers[2].len = 2; - int z = 0; - - // start sending the chunks - do - { - z++; - Buffers[1].buf = NULL; - Buffers[1].len = 0; - if (m_pNavData->pfnChunkCallback((BYTE**)&Buffers[1].buf, &Buffers[1].len, - m_pNavData->m_lParamChunkCB)) - { - _ATLTRY - { - if (Buffers[1].len > 0) - { - // send the chunk - strChunkSize.Format("%x\r\n", Buffers[1].len); - Buffers[0].buf = (char*)(LPCSTR)strChunkSize; - Buffers[0].len = strChunkSize.GetLength(); - if (!Write(Buffers, 3, &dwSent)) - { - bRet = false; - break; - } - } - else if (Buffers[1].len == 0) - { - strChunkSize = "0\r\n\r\n\r\n"; - Buffers[0].buf = (char*)(LPCSTR)strChunkSize; - Buffers[0].len = strChunkSize.GetLength(); - if (!Write(Buffers, 1, &dwSent)) - { - bRet = false; - break; - } - break; - } - } - _ATLCATCHALL() - { - bRet = false; - break; - } - } - else - { - bRet = false; - break; // something went wrong in callback - } - }while (Buffers[1].len > 0); - - strRequest.ReleaseBuffer(); - - if (bRet) - { - // Read the response - if (RR_OK == ReadHttpResponse()) - { - // if navigation isn't complete, try to complete - // it based on the status code and flags - if ((m_pNavData->dwFlags & ATL_HTTP_FLAG_PROCESS_RESULT) - && !ProcessStatus(m_pNavData->dwFlags)) - { - bRet = false; - } - bRet = true; - } - else - bRet = false; - } - - if (!bRet) - Close(); - - return bRet; -} - -template -inline bool CAtlHttpClientT::ConnectSocket() throw() -{ - bool bRet=false; - // connect to the correct server - if (GetProxy()) - { - //if we're using a proxy connect to the proxy - bRet=Connect(m_strProxy, m_nProxyPort); - } - else - { - bRet=Connect(m_urlCurrent.GetHostName(),m_urlCurrent.GetPortNumber()); // connect to the server - } - return bRet; -} - - -template -inline bool CAtlHttpClientT::BuildRequest(/*out*/CString *pstrRequest, - LPCTSTR szMethod, - LPCTSTR szExtraHeaders) throw() -{ - if (!m_pNavData) - return false; - _ATLTRY - { - // build up the request - CString strRequest = szMethod; - strRequest += _T(" "); - if (GetProxy()) - { - TCHAR buffURL[ATL_URL_MAX_URL_LENGTH]; - DWORD dwSize = ATL_URL_MAX_URL_LENGTH; - m_urlCurrent.CreateUrl(buffURL, &dwSize); - strRequest += buffURL; - - strRequest += ATL_HTTP_HEADER_PROXY; - CString strHost; - if (m_urlCurrent.GetPortNumber() != ATL_URL_DEFAULT_HTTP_PORT) - strHost.Format(_T("Host: %s:%d\r\n"), m_urlCurrent.GetHostName(), m_urlCurrent.GetPortNumber()); - else - strHost.Format(_T("Host: %s\r\n"), m_urlCurrent.GetHostName()); - strRequest += strHost; - - if (m_pNavData->dwDataLen>0) - { - CString strCL; - strCL.Format(_T("Content-Length: %d\r\n"), m_pNavData->dwDataLen); - strRequest += strCL; - } - - if (m_pNavData->szDataType) - { - strRequest += _T("Content-Type: "); - strRequest += m_pNavData->szDataType; - strRequest += _T("\r\n"); - } - - if (m_pNavData->szExtraHeaders) - strRequest += szExtraHeaders; - strRequest += ATL_HTTP_USERAGENT; - } - else - { - strRequest += m_urlCurrent.GetUrlPath(); - strRequest += m_urlCurrent.GetExtraInfo(); - strRequest += ATL_HTTP_HEADER; - - if (m_pNavData->dwDataLen > 0) - { - CString strCL; - strCL.Format(_T("Content-Length: %d\r\n"), m_pNavData->dwDataLen); - strRequest += strCL; - } - - if (m_pNavData->szDataType && - *m_pNavData->szDataType) - { - strRequest += _T("Content-Type: "); - strRequest += m_pNavData->szDataType; - strRequest += _T("\r\n"); - } - - if (szExtraHeaders) - strRequest += szExtraHeaders; - - - CString strHost; - strHost.Format(_T("Host: %s\r\n"), m_urlCurrent.GetHostName()); - strRequest += strHost; - strRequest += ATL_HTTP_USERAGENT; - } - strRequest += _T("\r\n"); - - - *pstrRequest = strRequest; - return true; - } - _ATLCATCHALL() - { - return false; - } -} - -template -inline bool CAtlHttpClientT::ReadSocket() throw() -{ - bool bRet = false; - unsigned char read_buff[ATL_READ_BUFF_SIZE]; - int dwSize = ATL_READ_BUFF_SIZE; - - // read some data - for (int i = 0; i < ATL_HTTP_CLIENT_EMPTY_READ_RETRIES; ++i) - { - bRet = Read(read_buff, (DWORD*)&dwSize); - if (!bRet) - return bRet; - - // notify user - if (m_pNavData) - { - if (m_pNavData->pfnReadStatusCallback) - bRet = m_pNavData->pfnReadStatusCallback(dwSize, m_pNavData->m_lParamRead); - if (!bRet) - return bRet; - } - - if (dwSize > 0) - { - // append the data to our internal buffer - // m_current holds bytes (not UNICODE!) - - if (!m_current.Append((LPCSTR)read_buff, dwSize)) - return FALSE; - - m_pEnd = ((BYTE*)(LPCSTR)m_current) + m_current.GetLength(); - m_pCurrent = (BYTE*)(LPCSTR)m_current; - break; - } - bRet = false; // nothing was read - } - - return bRet; -} - -// Starts searching for a complete header set at -// m_pCurrent. This function will only move m_pCurrent -// if a complete set is found. Returns the header beginning -// optionally. -template -inline unsigned char* CAtlHttpClientT::FindHeaderEnd(unsigned char** ppBegin) throw() -{ - if (!m_pCurrent) - return NULL; - - BYTE *pCurr = m_pCurrent; - BYTE *pBegin = m_pCurrent; - int nLen = m_current.GetLength(); - - if (pCurr >= (BYTE*)(LPCSTR)m_current + m_current.GetLength()) - return NULL; // no more chars in buffer - // look for the end of the header (the \r\n\r\n) - while (pCurr <= (pBegin + nLen - ATL_HEADER_END_LEN)) - { - - if (* ((UNALIGNED DWORD*)pCurr)==ATL_DW_HEADER_END) - { - // set m_pCurrent pointer to the end of the header - m_pCurrent = pCurr + ATL_HEADER_END_LEN; - if (ppBegin) - *ppBegin = pBegin; - return m_pCurrent; - } - pCurr++; - } - return NULL; -} - -// Call this function after sending an HTTP request over the socket. The complete -// HTTP response will be read. This function will also parse -// response headers into the response header map. -template -inline typename CAtlHttpClientT::HTTP_RESPONSE_READ_STATUS CAtlHttpClientT::ReadHttpResponse() -{ - // Read until we at least have the response headers - HTTP_RESPONSE_READ_STATUS result = RR_OK; - readstate state = rs_init; - unsigned char *pBodyBegin = NULL; - unsigned char *pHeaderBegin = NULL; - m_current.Empty(); - m_pCurrent = NULL; - m_LastResponseParseError = RR_OK; - - while (state != rs_complete) - { - switch(state) - { - case rs_init: - m_HeaderMap.RemoveAll(); - m_nStatus = ATL_INVALID_STATUS; - m_dwHeaderLen = 0; - m_dwBodyLen = 0; - state = rs_readheader; - // fall through - - case rs_readheader: - - // read from the socket until we have a complete set of headers. - pBodyBegin = FindHeaderEnd(&pHeaderBegin); - if (!pBodyBegin) - { - if (!ReadSocket()) - { - // Either reading from the socket failed, or there - // was not data to read. Set the nav status to error - // and change the state to complete. - state = rs_complete; - result = RR_READSOCKET_FAILED; - break; - } - else - break; // loop back and FindHeaderEnd again. - } - // we have a complete set of headers - m_dwHeaderLen = (DWORD)(pBodyBegin-pHeaderBegin); - m_dwHeaderStart = (DWORD)(pHeaderBegin - (BYTE*)(LPCSTR)m_current); - // fall through - state = rs_scanheader; - - case rs_scanheader: - // set m_nStatus and check for valid status - ParseStatusLine(pHeaderBegin); - // failed to set m_nStatus; - if (m_nStatus == ATL_INVALID_STATUS) - { - state = rs_complete; - result = RR_STATUS_INVALID; - break; - } - - else if (m_nStatus == 100) // continue - { - state = rs_init; - break; - } - - // crack all the headers and put them into a header map. We've already - // done the check to make sure we have a complete set of headers in - // rs_readheader above - if (ATL_HEADER_PARSE_COMPLETE != CrackResponseHeader((LPCSTR)pHeaderBegin, - (LPCSTR*)&pBodyBegin)) - { - // something bad happened while parsing the headers! - state = rs_complete; - result = RR_PARSEHEADERS_FAILED; - break; - } - state = rs_readbody; - // fall through - - case rs_readbody: - // headers are parsed and cracked, we're ready to read the rest - // of the response. - if (IsMsgBodyChunked()) - { - if (!ReadChunkedBody()) - { - result = RR_READCHUNKEDBODY_FAILED; - state = rs_complete; - break; - } - } - else - if (!ReadBody(GetContentLength(), m_current.GetLength()-(m_dwHeaderStart+m_dwHeaderLen))) - result = RR_READBODY_FAILED; - state = rs_complete; - //fall through - - case rs_complete: - // clean up the connection if the server requested a close; - DisconnectIfRequired(); - break; - } - } - m_LastResponseParseError = result; - return result; -} - -template -inline typename CAtlHttpClientT::HTTP_RESPONSE_READ_STATUS CAtlHttpClientT::GetResponseStatus() -{ - return m_LastResponseParseError; -} - -// Checks to see if the server has closed the connection. -// If it has, we create a new socket and reconnect it to -// the current server. This also clears the contents of the -// current response buffer. -template -inline void CAtlHttpClientT::ResetConnection() throw() -{ - ReconnectIfRequired(); - m_HeaderMap.RemoveAll(); - m_current.Empty(); - m_nStatus = ATL_INVALID_STATUS; - m_AuthTypes.RemoveAll(); // the server will keep sending back www-authenticate - // headers until the connection is authorized -} - -// Takes action based on the flags passed and the current -// status for this object. -template -inline bool CAtlHttpClientT::ProcessStatus(DWORD dwFlags) throw() -{ - switch(m_nStatus) - { - case 200: // In all these cases there is no further action - case 201: // to take. Any additional informaion is returned - case 202: // in the entity body. - case 203: - case 204: - case 205: - case 206: - case 304: - case 305: - return true; - break; - case 301: - case 302: - case 303: - if (dwFlags & ATL_HTTP_FLAG_AUTO_REDIRECT) - return ProcessObjectMoved(); - break; - case 401: // auth required - return NegotiateAuth(false); - break; - case 407: // proxy auth required - return NegotiateAuth(true); - break; - - } - return false; -} - -// Looks up the value of a response header in the header map. Call with -// NULL szBuffer to have length of the required buffer placed in -// pdwLen on output. - -// szName is the name of the header to look up. -// szBuffer is the buffer that will contain the looked up string. -// pdwLen contains the length of szBuffer in characters on input and the length -// of the string including NULL terminator in characters on output. -template -inline bool CAtlHttpClientT::GetHeaderValue(LPCTSTR szName, CString& strValue) const throw() -{ - _ATLTRY - { - return m_HeaderMap.Lookup(szName, strValue); - } - _ATLCATCHALL() - { - return false; - } -} - -template -inline bool CAtlHttpClientT::GetHeaderValue(__in_z LPCTSTR szName, __out_ecount_part_z_opt(*pdwLen, *pdwLen) LPTSTR szBuffer, __inout DWORD *pdwLen) const throw() -{ - CString strValue; - bool bRet = GetHeaderValue(szName, strValue); - DWORD nLen = strValue.GetLength(); - if (!bRet) - return false; - - if ((pdwLen && *pdwLen < nLen+1) || - (!szBuffer && pdwLen) ) - { - *pdwLen = nLen+1; - return true; - } - - if (!szBuffer) - return false; - - Checked::tcsncpy_s(szBuffer, nLen+1, (LPCTSTR)strValue, _TRUNCATE); - if (pdwLen) - *pdwLen = nLen+1; - return true; -} - -// Adds an authorization object to use for a particular scheme. -// This will overwrite an existing entry if an object for the -// same scheme has already been set. -template -inline bool CAtlHttpClientT::AddAuthObj(LPCTSTR szScheme, - CAtlBaseAuthObject *pObject, IAuthInfo *pInfo/*=NULL*/) throw() -{ - if (!pObject) - return false; - - pObject->Init(this, pInfo); - - _ATLTRY - { - POSITION pos = m_AuthMap.SetAt(szScheme, pObject); - if (!pos) - return false; - } - _ATLCATCHALL() - { - return false; - } - - return true; -} - -// Tries to find an authorization object to use for a particular -// scheme -template -inline const CAtlBaseAuthObject* CAtlHttpClientT::FindAuthObject(LPCTSTR szScheme) throw() -{ - CAtlBaseAuthObject *pObject = NULL; - if (m_AuthMap.Lookup(szScheme, pObject)) - { - return const_cast(pObject); - } - return NULL; -} - -// Removes an existing authorization object from the map. -template -inline bool CAtlHttpClientT::RemoveAuthObject(LPCTSTR szScheme) throw() -{ - return m_AuthMap.RemoveKey(szScheme); -} - -// Sets the current proxy server and port -template -inline bool CAtlHttpClientT::SetProxy(LPCTSTR szProxy, short nProxyPort) throw() -{ - if (!szProxy) - { - if (!LookupRegProxy()) - return false; - } - else - { - _ATLTRY - { - m_strProxy = szProxy; - m_nProxyPort = nProxyPort; - } - _ATLCATCHALL() - { - return false; - } - } - return true; -} - -// Removes the current proxy settings. -template -inline void CAtlHttpClientT::RemoveProxy() throw() -{ - m_strProxy.Empty(); - m_nProxyPort = ATL_URL_INVALID_PORT_NUMBER; -} - -// retrieves the current proxy -template -inline LPCTSTR CAtlHttpClientT::GetProxy() const throw() -{ - if (m_strProxy.GetLength()) - return (LPCTSTR)m_strProxy; - return NULL; -} - -template -inline short CAtlHttpClientT::GetProxyPort() const throw() -{ - return m_nProxyPort; -} - -// Gets the contents of the entire response buffer. -template -inline const BYTE* CAtlHttpClientT::GetResponse() throw() -{ - return (const BYTE*)(LPCSTR)m_current; -} - -template -inline DWORD CAtlHttpClientT::GetResponseLength() throw() -{ - return m_current.GetLength(); -} - -// Gets the length in bytes of the body of the -// current response -template -inline DWORD CAtlHttpClientT::GetBodyLength() const throw() -{ - return m_dwBodyLen; -} - -// Gets the contents of the body of the current response. This -// is the response without the headers. -template -inline const BYTE* CAtlHttpClientT::GetBody() throw() -{ - return (BYTE*)((LPCSTR)m_current + m_dwHeaderLen + m_dwHeaderStart); -} - -// Get the length of the header part of the response in bytes. -template -inline DWORD CAtlHttpClientT::GetRawResponseHeaderLength() throw() -{ - return m_dwHeaderLen >= 2 ? m_dwHeaderLen-2 : 0; // m_dwHeaderLen includes the final \r\n -} - -// buffer must include space for null terminator. -// on input, pdwLen specifies the size of szBuffer, -// on output, pdwLen holds the number of bytes copied -// to szBuffer, or the required size of szBuffer if -// szBuffer wasn't big enough -template -inline bool CAtlHttpClientT::GetRawResponseHeader(LPBYTE szBuffer, DWORD *pdwLen) throw() -{ - if (!pdwLen) - return false; - - DWORD header_len = GetRawResponseHeaderLength(); - if (header_len == 0) - return false; - - if (!szBuffer || *pdwLen < header_len+1) - { - *pdwLen = header_len+1; - return false; - } - - Checked::memcpy_s(szBuffer, *pdwLen, (BYTE*)(LPCSTR)m_current, header_len); - szBuffer[header_len]='\0'; - - *pdwLen = header_len+1; - return true; -} - -// Gets the current URL object. -template -inline LPCURL CAtlHttpClientT::GetCurrentUrl() const throw() -{ - return (LPCURL)&m_urlCurrent; -} - -template -inline bool CAtlHttpClientT::SetDefaultUrl( LPCTSTR szUrl, - short nPortNumber) throw() -{ - return _SetDefaultUrl(szUrl,nPortNumber); -} - -template -inline bool CAtlHttpClientT::SetDefaultUrl( LPCURL pUrl, - short nPortNumber) throw() -{ - m_urlCurrent = *pUrl; - return _SetDefaultUrl(NULL, nPortNumber); -} - -template -inline bool CAtlHttpClientT::SetDefaultMethod(LPCTSTR szMethod) throw() - -{ - _ATLTRY - { - m_strMethod = szMethod; - return true; - } - _ATLCATCHALL() - { - return false; - } -} - -template -inline DWORD CAtlHttpClientT::GetFlags() const throw() -{ - if (m_pNavData) - return m_pNavData->dwFlags; - else - return ATL_HTTP_FLAG_INVALID_FLAGS; -} - -template -inline bool CAtlHttpClientT::LookupRegProxy() throw() -{ - // attempt to look it up from the registry - CRegKey rkProxy; - ULONG nChars = ATL_URL_MAX_URL_LENGTH+1; - TCHAR szUrl[ATL_URL_MAX_URL_LENGTH+1] = { 0 }; - - DWORD dwErr = rkProxy.Open(HKEY_CURRENT_USER, - _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), KEY_READ); - if (dwErr == ERROR_SUCCESS) - { - dwErr = rkProxy.QueryStringValue(_T("ProxyServer"), szUrl, &nChars); - } - if (dwErr == ERROR_SUCCESS) - { - CUrl url; - if (url.CrackUrl(szUrl)) - { - if (url.GetScheme()==ATL_URL_SCHEME_UNKNOWN) - { - // without the scheme name (e.g. proxy:80) - m_strProxy = url.GetSchemeName(); - m_nProxyPort = (short)_ttoi(url.GetHostName()); - return true; - } - else if (url.GetHostName()) - { - // with the scheme (e.g. http://proxy:80) - m_strProxy = url.GetHostName(); - m_nProxyPort = url.GetPortNumber(); - return true; - } - } - } - return false; -} - -template -inline bool CAtlHttpClientT::DisconnectIfRequired() throw() -{ - CString strValue; - if (GetHeaderValue(_T("Connection"), strValue) && !strValue.CompareNoCase(_T("close"))) - { - Close(); - } - - return true; -} - -class CInitializeCOMThread -{ -public: - CInitializeCOMThread() - : m_bCoInit(FALSE),m_bShouldUninit(FALSE) - { - //At this point the Thread can be uninit, init to STA or init to MTA. - //CoInitialize can always fail unexpectedly. - HRESULT hr = ::CoInitialize(NULL); - if (SUCCEEDED(hr)) - { - m_bCoInit=TRUE; - m_bShouldUninit=TRUE; - } else if (hr == RPC_E_CHANGED_MODE) - { - m_bCoInit=TRUE; - } - } - ~CInitializeCOMThread() - { - if (m_bShouldUninit) - { - ::CoUninitialize(); - } - } - BOOL IsInitialized() { return m_bCoInit; } -protected: - BOOL m_bCoInit; - BOOL m_bShouldUninit; -}; -// Tries to find an authorization object that meets -template -inline bool CAtlHttpClientT::NegotiateAuth(bool bProxy) throw() -{ - //Test if can silently pass user credentials to server. - if (!m_bSilentLogonOk) - { - //Call CoInit, because ATL Http code cannot assume it has already been called by the user. - CInitializeCOMThread initThread; - if (initThread.IsInitialized()) - { - HRESULT hr = S_OK; - CComPtr spSecurityMgr; - - hr = CoCreateInstance(CLSID_InternetSecurityManager, NULL, CLSCTX_INPROC_SERVER, - IID_IInternetSecurityManager, (void**)&spSecurityMgr); - if (SUCCEEDED(hr)) - { - TCHAR szUrl[ATL_URL_MAX_URL_LENGTH]; - DWORD dwMaxLen = ATL_URL_MAX_URL_LENGTH; - if (!m_urlCurrent.CreateUrl(szUrl, &dwMaxLen)) - { - return false; - } - - CStringW strUrlW(szUrl); - DWORD dwPolicy=0xFFFF; - hr=spSecurityMgr->ProcessUrlAction(strUrlW.GetString(), - URLACTION_CREDENTIALS_USE, - reinterpret_cast(&dwPolicy), - sizeof(dwPolicy), - NULL, - 0, - PUAF_NOUI, - NULL); - - if (FAILED(hr) || dwPolicy != URLPOLICY_CREDENTIALS_SILENT_LOGON_OK) - { - return false; - } - } - else - { - // CoCreateInstance failed, return false - return false; - } - } - else - { - // CoInit failed, return false - return false; - } - } - - // szAuthHeaderValue should contain a comma separated list - // of authentication types - CAtlBaseAuthObject *pAuthObj = NULL; - bool bRet = false; - for (size_t i = 0; im_bFailed) - bRet = pAuthObj->Authenticate(m_AuthTypes[i], bProxy); - - if (bRet) - return bRet; - } - _ATLCATCHALL() - { - bRet = false; - } - } - return bRet; -} - -template -inline long CAtlHttpClientT::GetContentLength() throw() -{ - CString strValue; - if (GetHeaderValue(_T("Content-Length"), strValue)) - { - TCHAR *pStop = NULL; - return _tcstol(strValue, &pStop, 10); - } - else - return -1; -} - -template -inline LPCSTR CAtlHttpClientT::NextLine(BYTE* pCurr) throw() -{ - if (!pCurr) - return NULL; - - while ( pCurr < m_pEnd && *pCurr && !(*pCurr == '\r' && *(pCurr+1) == '\n')) - pCurr++; - - if (pCurr >= m_pEnd) - return NULL; - -// if (pCurr < m_pEnd-4) -// if (!memcmp(pCurr, ATL_HEADER_END, 4)) - //return NULL; - - return (LPCSTR)(pCurr+2); -} - -template -inline bool CAtlHttpClientT::IsMsgBodyChunked() throw() -{ - CString strValue; - return ( - GetHeaderValue(_T("Transfer-Encoding"), strValue) && - !strValue.CompareNoCase(_T("chunked")) - ); - -} - -// finds the end of an individual header field pointed to by -// pszStart. Header fields can be multi-line with multi-line -// header fields being a line that starts with some kind of -// white space. -template -inline LPCSTR CAtlHttpClientT::FindEndOfHeader(LPCSTR pszStart) throw() -{ - // move through all the lines until we come to one - // that doesn't start with white space - LPCSTR pLineStart = pszStart; - LPCSTR pHeaderEnd = NULL; - - do - { - pLineStart = NextLine((BYTE*)pLineStart); - }while (pLineStart && isspace(static_cast(*pLineStart)) && strncmp(pLineStart-2, ATL_HEADER_END, ATL_HEADER_END_LEN)); - - if (pLineStart > (LPCSTR)m_pEnd) - return NULL; // ran out of data in the buffer without finding the end of a line - // or the end of the headers. - - if (pLineStart) - pHeaderEnd = pLineStart-2; - else - pHeaderEnd = NULL; - - return pHeaderEnd; -} - -template -inline bool CAtlHttpClientT::DecodeHeader(LPCSTR pHeaderStart, LPCSTR pHeaderEnd) throw() -{ - _ATLTRY - { - if (!pHeaderStart || !pHeaderEnd) - return false; - LPCSTR pTemp = pHeaderStart; - while (*pTemp != ATL_FIELDNAME_DELIMITER && pTemp < pHeaderEnd) - pTemp++; - if (*pTemp == ATL_FIELDNAME_DELIMITER) - { - char szName[ATL_MAX_FIELDNAME_LEN]; - char szValue[ATL_MAX_VALUE_LEN]; - int nLen = (int)(pTemp-pHeaderStart) ; - ATLASSERT(nLen < ATL_MAX_FIELDNAME_LEN); - if (nLen >= ATL_MAX_FIELDNAME_LEN) - return false; // won't fit in the buffer. - Checked::memcpy_s(szName, ATL_MAX_FIELDNAME_LEN, pHeaderStart, nLen); - szName[nLen]=0; - - pTemp++; // move past delimiter; - while (isspace(static_cast(*pTemp)) && pTemp < pHeaderEnd) - pTemp++; - - nLen = (int)(pHeaderEnd-pTemp); - ATLASSERT(nLen < ATL_MAX_VALUE_LEN); - if (nLen >= ATL_MAX_VALUE_LEN) - return false; // won't fit in the buffer - Checked::memcpy_s(szValue, ATL_MAX_VALUE_LEN, pTemp, nLen); - szValue[nLen]=0; - - CString strExist; - CA2T pszName(szName); - CA2T pszValue(szValue); - - if (!_tcsicmp(pszName, _T("www-authenticate")) || - !_tcsicmp(pszName, _T("proxy-authenticate"))) - { - m_AuthTypes.Add(pszValue); - } - - if (!m_HeaderMap.Lookup(pszName, strExist)) - m_HeaderMap.SetAt(pszName, pszValue); - else - { - // field-values for headers with the same name can be appended - // per rfc2068 4.2, we do the appending so we don't have to - // store/lookup duplicate keys. - strExist += ','; - strExist += pszValue; - m_HeaderMap.SetAt(pszName, (LPCTSTR)strExist); - } - - // if it's a set-cookie header notify users so they can do - // somthing with it. - if (!_tcsicmp(pszName, _T("set-cookie"))) - OnSetCookie(pszValue); - } - - return true; - } - _ATLCATCHALL() - { - return false; - } -} - -template -inline void CAtlHttpClientT::OnSetCookie(LPCTSTR) throw() -{ - return; -} - -template -inline LPCSTR CAtlHttpClientT::ParseStatusLine(BYTE* pBuffer) throw() -{ - if (!pBuffer) - return NULL; - if (m_pEnd <= pBuffer) - return NULL; - - // find the first space' - while (pBuffer < m_pEnd && !isspace(static_cast(*pBuffer))) - pBuffer++; - - if (pBuffer >= m_pEnd) - return NULL; - - // move past the space - while (pBuffer < m_pEnd && isspace(static_cast(*pBuffer))) - pBuffer++; - - if (pBuffer >= m_pEnd) - return NULL; - - // pBuffer better be pointing at the status code now - LPCSTR pEnd = NULL; - if (*pBuffer >= '0' && *pBuffer <= '9') - { - // probably a good status code - errno_t errnoValue = AtlStrToNum(&m_nStatus, (LPSTR)pBuffer, (LPSTR*)&pEnd, 10); - if (errnoValue == ERANGE) - return NULL; // bad status code - } - else - return FALSE; // bad status code; - - if (!pEnd) - return FALSE; // bad status code; - - pBuffer = (BYTE*)pEnd; - // move to end of line - while (pBuffer < m_pEnd && *pBuffer != '\n') - pBuffer++; - - if (pBuffer >= m_pEnd) - return NULL; - - // set the return pointing to the first - // character after our status line. - return (LPCSTR)++pBuffer; -} - - -// pBuffer should start at the first character -// after the status line. -template -inline int CAtlHttpClientT::CrackResponseHeader(LPCSTR pBuffer, /*out*/ LPCSTR *pEnd) throw() -{ - // read up to the double /r/n - LPCSTR pszStartSearch = pBuffer; - if (!pEnd) - return ATL_HEADER_PARSE_HEADERERROR; - - *pEnd = NULL; - if (pszStartSearch == NULL) - return ATL_HEADER_PARSE_HEADERERROR; - - // start parsing headers - LPCSTR pHeaderStart = ParseStatusLine((BYTE*)pBuffer); - if (!pHeaderStart) - return ATL_HEADER_PARSE_HEADERERROR; - LPCSTR pHeaderEnd = NULL; - - while (pHeaderStart && *pHeaderStart && pHeaderStart < (LPCSTR)m_pEnd) - { - pHeaderEnd = FindEndOfHeader(pHeaderStart); - if (!pHeaderEnd) - break; // error - - DecodeHeader(pHeaderStart, pHeaderEnd); - - if (!strncmp(pHeaderEnd, ATL_HEADER_END, strlen(ATL_HEADER_END))) - { - *pEnd = pHeaderEnd + strlen(ATL_HEADER_END); - break; // we're done - } - else - pHeaderStart = pHeaderEnd+2; - } - - return ATL_HEADER_PARSE_COMPLETE; -} - -// Reads the body if the encoding is not chunked. -template -inline bool CAtlHttpClientT::ReadBody(int nContentLen, int nCurrentBodyLen) throw() -{ - // nCurrentBodyLen is the length of the body that has already been read - // nContentLen is the value of Content-Length - // current is the buffer that will contain the entire response - bool bRet = true; - ATLASSUME(m_pNavData); - if (!m_pNavData) - return false; - - CTempBuffer readbuff; - DWORD dwReadBuffSize = 0; - DWORD dwRead = 0; - if (m_pNavData->dwReadBlockSize) - { - ATLTRY(readbuff.Allocate(m_pNavData->dwReadBlockSize)); - dwReadBuffSize = m_pNavData->dwReadBlockSize; - } - else - { - ATLTRY(readbuff.Allocate(ATL_READ_BUFF_SIZE)); - dwReadBuffSize = ATL_READ_BUFF_SIZE; - } - - if (readbuff.operator BYTE*() == NULL) - return false; - - if (nContentLen != -1) // We know the content length. - { - // read the rest of the body. - while (nCurrentBodyLen < nContentLen) - { - dwRead = dwReadBuffSize; - // loop while dwRead == 0 - for (int nRetry = 0; nRetry < ATL_HTTP_CLIENT_EMPTY_READ_RETRIES; ++nRetry) - { - if (!Read(readbuff, &dwRead)) - return false; - - // notify user - if (m_pNavData) - { - if (m_pNavData->pfnReadStatusCallback) - if (!m_pNavData->pfnReadStatusCallback(dwRead, m_pNavData->m_lParamRead)) - return false; - } - - if (dwRead == 0) - continue; - nCurrentBodyLen += dwRead; - if (!m_current.Append((LPCSTR)(BYTE*)readbuff, dwRead)) - { - ATLASSERT(0); - return false; // error! - } - m_pEnd = ((BYTE*)(LPCSTR)m_current) + m_current.GetLength(); - break; - } - if (dwRead == 0) - return false; - } - m_dwBodyLen = nCurrentBodyLen; - } - else // We don't know content length. All we can do is - { // read until there is nothing else to read. - int nRetries = 0; - while (1) - { - dwRead = dwReadBuffSize; - if (Read((BYTE*)readbuff, (DWORD*)&dwRead)) - { - // notify user - if (m_pNavData) - { - if (m_pNavData->pfnReadStatusCallback) - bRet = m_pNavData->pfnReadStatusCallback(dwRead, m_pNavData->m_lParamRead); - if (!bRet) - return bRet; - } - - if (dwRead == 0) - { - if (nRetries++ < ATL_HTTP_CLIENT_EMPTY_READ_RETRIES) - continue; - break; - } - - nRetries = 0; - nCurrentBodyLen += dwRead; - if (!m_current.Append((LPCSTR)(BYTE*)readbuff, dwRead)) - return false; - m_pEnd = ((BYTE*)(LPCSTR)m_current) + m_current.GetLength(); - } - else - { - // notify user - if (m_pNavData) - { - if (m_pNavData->pfnReadStatusCallback) - bRet = m_pNavData->pfnReadStatusCallback(dwRead, m_pNavData->m_lParamRead); - if (!bRet) - return bRet; - } - - bRet = true; - break; - } - } - m_dwBodyLen = nCurrentBodyLen; - } - return bRet; -} - - -// This function moves pBuffStart only on success. On success, pBuffStart is moved -// to the element past the last element we consumed. -template -inline typename CAtlHttpClientT::CHUNK_LEX_RESULT CAtlHttpClientT::get_chunked_size(char *&pBuffStart, char *&pBuffEnd, long* pnChunkSize) throw() -{ - CHUNK_LEX_RESULT result = LEX_ERROR; - char *pStop = NULL; - - if (pBuffStart >= pBuffEnd) - result = LEX_OUTOFDATA; - else - { - long nResult = 0; - errno_t errnoValue = AtlStrToNum(&nResult, pBuffStart, &pStop, 16); - if (errnoValue != ERANGE && - nResult >= 0 && - nResult < 0xFFFFFFFF && - pStop <= pBuffEnd && - *pStop == '\r') - { - // move pBuffStart - // return chunk size - *pnChunkSize = nResult; - pBuffStart = pStop; - result = LEX_OK; - } - if (*pStop != '\r') - { - result = LEX_OUTOFDATA; // not enough data in the buffer - } - } - return result; -} - -template -inline bool CAtlHttpClientT::move_leftover_bytes( __in_ecount(nLen) char *pBufferStart, - __in int nLen, - __deref_inout_ecount(nLen) char *&pBuffStart, - __deref_inout char *& pBuffEnd) throw() -{ - bool bRet = true; - Checked::memcpy_s(pBufferStart, (pBuffEnd-pBuffStart), pBuffStart, nLen); - return bRet; -} - -template -inline typename CAtlHttpClientT::CHUNK_LEX_RESULT CAtlHttpClientT::get_chunked_data(char *&pBufferStart, - char *&pBufferEnd, - long nChunkSize, - char **ppDataStart, - long *pnDataLen) throw() -{ - CHUNK_LEX_RESULT result = LEX_ERROR; - if (pBufferStart + nChunkSize - 1 < pBufferEnd) - { - *ppDataStart = pBufferStart; - *pnDataLen = nChunkSize; - pBufferStart = pBufferStart + nChunkSize; - result = LEX_OK; - } - else if (pBufferStart + nChunkSize - 1 >= pBufferEnd) - result = LEX_OUTOFDATA; - - return result; -} - -template -inline typename CAtlHttpClientT::CHUNK_LEX_RESULT CAtlHttpClientT::consume_chunk_trailer(char *&pBufferStart, char *pBufferEnd) -{ - CHUNK_LEX_RESULT result = LEX_ERROR; - if (pBufferStart >= pBufferEnd) - return result; - - char *pHeaderEnd = NULL; - char *pTemp = pBufferStart; - // check for empty trailer, this means there are no more trailers - if ( (pTemp < pBufferEnd && *pTemp == '\r') && - (pTemp+1 < pBufferEnd && *(pTemp+1) == '\n')) - { - pBufferStart += 2; - return LEX_TRAILER_COMPLETE; - } - - while (pTemp <= pBufferEnd) - { - if ( (pTemp < pBufferEnd && *pTemp == '\r') && - (pTemp+1 < pBufferEnd && *(pTemp+1) == '\n')) - { - pHeaderEnd = pTemp; // success case - result = LEX_OK; - break; - } - pTemp++; - } - - if (result == LEX_OK) - { - DecodeHeader(pBufferStart, pHeaderEnd); - pBufferStart = pHeaderEnd + 2; - } - else if (result != LEX_OK && - pTemp > pBufferEnd) - result = LEX_OUTOFDATA; - return result; -} - -template -inline typename CAtlHttpClientT::CHUNK_LEX_RESULT CAtlHttpClientT::consume_chunk_footer(char *&pBufferStart, char *&pBufferEnd) -{ - CHUNK_LEX_RESULT result = LEX_ERROR; - if (pBufferStart < pBufferEnd && - (pBufferStart+1) <= pBufferEnd) - { - if ( *pBufferStart == '\r' && - *(pBufferStart+1) == '\n') - { - pBufferStart += 2; - result = LEX_OK; - } - } - else - result = LEX_OUTOFDATA; - return result; -} - -#define CHUNK_BUFF_SIZE 2048 - -template -inline bool CAtlHttpClientT::ReadChunkedBody() throw() -{ - // At this point, m_current contains the headers, up to and including the \r\n\r\n, - // plus any additional data that might have been read off the socket. So, we need - // to copy off the additional data into our read buffer before we start parsing the - // chunks. -#ifdef _DEBUG - // nReadCount, keeps track of how many socket reads we do. - int nReadCount = 0; -#endif - - // nChunkBuffCarryOver - // When we run out of data in the input buffer, this is the - // count of bytes that are left in the input that could not - // be lexed into anything useful. We copy this many bytes to - // the top of the input buffer before we fill the input buffer - // with more bytes from the socket - long nChunkBuffCarryOver = 0; - - // nChunkSize - // The size of the next chunk to be read from the input buffer. - long nChunkSize = 0; - - // t_chunk_buffer - // The heap allocated buffer that we holds data - // read from the socket. We will increase the size - // of this buffer to 2 times the max chunk size we - // need to read if we have to. - CHeapPtr t_chunk_buffer; - - // nTChunkBuffSize - // Keeps track of the allocated size of t_chunk_buffer. - // This size will change if we need to read chunks bigger - // than the currently allocated size of t_chunk_buffer. - long nTChunkBuffSize = CHUNK_BUFF_SIZE; - - // chunk_buffer & chunk_buffer_end - // Keeps track of the current location - // in t_chunk_buffer that we are lexing input from. - // chunk_buffer_end is the end of the input buffer we - // are lexing from. chunk_buffer_end is used as a marker - // to make sure we don't read past the end of our input buffer - char *chunk_buffer, *chunk_buffer_end; - - // cstate - // The current state of the chunk parsing state machine. We - // start out reading the size of the first chunk. - CHUNK_STATE cstate = READ_CHUNK_SIZE; - - // cresult - // Holds the value of the result of a lexing operation performed - // on the input buffer. - CHUNK_LEX_RESULT cresult = LEX_OK; - - CAtlIsapiBuffer<> result_buffer; - - // Initialize pointers and allocate the chunk buffer. - chunk_buffer = chunk_buffer_end = NULL; - if( !t_chunk_buffer.Allocate(nTChunkBuffSize) ) - return false; - - // copy the headers into a temporary buffer. - result_buffer.Append(m_current + m_dwHeaderStart, m_dwHeaderLen); - - // calculate number of bytes left in m_current past the headers - long leftover_in_m_current = m_current.GetLength() - (m_dwHeaderStart + m_dwHeaderLen); - - // copy the extra bytes that might have been read into m_current into the chunk buffer - if (leftover_in_m_current > 0) - { - if (leftover_in_m_current > nTChunkBuffSize) - { - if( ! t_chunk_buffer.Reallocate(leftover_in_m_current) ) - return false; - } - - chunk_buffer = (char*)t_chunk_buffer; - Checked::memcpy_s(chunk_buffer, leftover_in_m_current, ((LPCSTR)m_current)+ m_dwHeaderStart + m_dwHeaderLen, leftover_in_m_current); - chunk_buffer_end = chunk_buffer + leftover_in_m_current; - } - - m_current.Empty(); - m_dwBodyLen = 0; - m_dwHeaderStart = 0; - - // as we start the state machine, we should be either pointing at the first - // byte of chunked response or nothing, in which case we will need to get - // more data from the socket. - nChunkSize = 0; - - bool bDone = false; - - while(!bDone) - { - // if we run out of data during processing, chunk_buffer - // get set to null - if (!chunk_buffer || - chunk_buffer >= chunk_buffer_end) - { - // we ran out of data in our input buffer, we need - // to read more from the socket. - DWORD dwReadBuffSize = nTChunkBuffSize - nChunkBuffCarryOver; - chunk_buffer = t_chunk_buffer; - if (!Read((const unsigned char*)(chunk_buffer+nChunkBuffCarryOver), &dwReadBuffSize)) - { - ATLTRACE("ReadChunkedBody: Error reading from socket (%d)\n", GetLastError()); - return false; - } - else if(dwReadBuffSize == 0) - { - ATLTRACE("ReadChunkedBody: The socket read timed out and no bytes were read from the socket.\n"); - return false; - } -#ifdef _DEBUG - ATLTRACE("ReadChunkedBody read %d bytes from socket. Reads %d \n", dwReadBuffSize, ++nReadCount); -#endif - chunk_buffer_end = chunk_buffer + nChunkBuffCarryOver + dwReadBuffSize; - nChunkBuffCarryOver = 0; - } - - switch(cstate) - { - case READ_CHUNK_SIZE: - { - cresult = get_chunked_size(chunk_buffer, chunk_buffer_end, &nChunkSize); - switch(cresult) - { - case LEX_ERROR: - ATLTRACE("ReadChunkedBody Failed retrieving chunk size\n"); - return false; - break; - case LEX_OUTOFDATA: - nChunkBuffCarryOver = (long)(chunk_buffer_end - chunk_buffer); - if (!move_leftover_bytes((char*)t_chunk_buffer, nChunkBuffCarryOver, - chunk_buffer, chunk_buffer_end)) - { - ATLTRACE("failed to move leftover chunk data to head of buffer\n"); - return false; - } - chunk_buffer = chunk_buffer_end = NULL; - break; - case LEX_OK: - if (nChunkSize == 0) - { - cstate = CHUNK_READ_DATA_COMPLETE; - } - else if (nChunkSize + 2 > nTChunkBuffSize) - { - char *pBuffStart = (char*)t_chunk_buffer; - int nReadSoFar = (int)(chunk_buffer - pBuffStart); - int nTotal = (int)(chunk_buffer_end - pBuffStart); - if( FAILED(::ATL::AtlMultiply(&nTChunkBuffSize, nChunkSize, 2L))) - { - return false; - } - t_chunk_buffer.Reallocate(nTChunkBuffSize); - pBuffStart = (char*)t_chunk_buffer; - chunk_buffer = pBuffStart + nReadSoFar; - chunk_buffer_end = pBuffStart + nTotal; - cstate = READ_CHUNK_SIZE_FOOTER; - m_dwBodyLen += nChunkSize; - } - else - { - // everything is OK. move to next state - cstate = READ_CHUNK_SIZE_FOOTER; - m_dwBodyLen += nChunkSize; - } - break; - default: - ATLASSERT(0); - return false; - break; - } - } - break; - case READ_CHUNK_DATA: - { - char *pDataStart = NULL; - long nDataLen = 0; - cresult = LEX_OK; - cresult = get_chunked_data(chunk_buffer, chunk_buffer_end, - nChunkSize, &pDataStart, &nDataLen); - switch(cresult) - { - case LEX_ERROR: - ATLTRACE("ReadChunkedBody failed to retrieve chunk data\n"); - return false; - break; - case LEX_OUTOFDATA: - nChunkBuffCarryOver = (long)(chunk_buffer_end - chunk_buffer); - if (!move_leftover_bytes((char*)t_chunk_buffer, nChunkBuffCarryOver, - chunk_buffer, chunk_buffer_end)) - { - ATLTRACE("failed to move leftover chunk data to head of buffer\n"); - return false; - } - chunk_buffer = chunk_buffer_end = NULL; - break; - case LEX_OK: - result_buffer.Append(pDataStart, nDataLen); - cstate = READ_CHUNK_DATA_FOOTER; - break; - default: - ATLASSERT(0); - return false; - } - } - break; - case READ_CHUNK_SIZE_FOOTER: - case READ_CHUNK_DATA_FOOTER: - { - cresult = consume_chunk_footer(chunk_buffer, chunk_buffer_end); - switch(cresult) - { - case LEX_OK: - cstate = (cstate == READ_CHUNK_SIZE_FOOTER) ? READ_CHUNK_DATA : READ_CHUNK_SIZE; - break; - case LEX_ERROR: - ATLTRACE("Error consuming chunk footer!\n"); - return false; - break; - case LEX_OUTOFDATA: - nChunkBuffCarryOver = (long)(chunk_buffer_end - chunk_buffer); - if (!move_leftover_bytes((char*)t_chunk_buffer, nChunkBuffCarryOver, - chunk_buffer, chunk_buffer_end)) - { - ATLTRACE("failed to move leftover chunk data to head of buffer\n"); - return false; - } - chunk_buffer = chunk_buffer_end = NULL; - break; - default: - ATLASSERT(0); - return false; - - } - } - break; - case CHUNK_READ_DATA_COMPLETE: - { - // We read the chunk of size 0 - // consume the chunk footer. - DWORD dwLen = 0; - cresult = consume_chunk_footer(chunk_buffer, chunk_buffer_end); - if (GetHeaderValue((_T("Trailer")), NULL, &dwLen)) - { - cstate = READ_CHUNK_TRAILER; // start reading trailer headers - break; - } - else - bDone = true; - } - break; - case READ_CHUNK_TRAILER: - cresult = consume_chunk_trailer(chunk_buffer, chunk_buffer_end); - switch(cresult) - { - case LEX_OK: - cstate = READ_CHUNK_TRAILER; // keep reading - break; - case LEX_ERROR: - ATLTRACE("Error consuming chunk trailers!\n"); - return false; - break; - case LEX_OUTOFDATA: - nChunkBuffCarryOver = (long)(chunk_buffer_end - chunk_buffer); - if (!move_leftover_bytes((char*)t_chunk_buffer, nChunkBuffCarryOver, - chunk_buffer, chunk_buffer_end)) - { - ATLTRACE("failed to move leftover chunk data to head of buffer\n"); - return false; - } - chunk_buffer = chunk_buffer_end = NULL; - break; - case LEX_TRAILER_COMPLETE: - return true; - break; - default: - ATLASSERT(0); - return false; - - - - } - break; - - } - } - if (!m_current.Append((LPCSTR)result_buffer)) - return false; - - m_pEnd = ((BYTE*)(LPCSTR)m_current) + m_current.GetLength(); - - return true; -} - -template -inline bool CAtlHttpClientT::ReconnectIfRequired() throw() -{ - CString strValue; - // if we have a keep-alive header then return true - // else we have to close and re-open the connection - if (GetHeaderValue(_T("Connection"), strValue)) - { - if (!strValue.CompareNoCase(_T("keep-alive"))) - return true; // server said keep connection open. - } - else - { - return true; // there was no 'Connection' header - } - - if (!strValue.CompareNoCase(_T("close"))) - { - Close(); - ConnectSocket(); - } - return false; -} - -// Complete relative URLs and URLs -// that have a missing path. These are common with redirect headers. -// http://www.microsoft.com becomes http://www.microsoft.com/ -// localstart.asp becomes whatever our current (m_urlCurrent) -// path is plus localstart.asp -template -inline bool CAtlHttpClientT::CompleteURL(CString& strURL) throw() -{ - _ATLTRY - { - CString strUrlTemp = strURL; - strUrlTemp.Trim(); - CUrl url; - bool bErr = false; - if (url.CrackUrl(strUrlTemp)) - { - return true; // URL is already valid - } - - - // if we have a scheme and a host name but no - // path, then add the path of '/' - if (url.GetScheme() == ATL_URL_SCHEME_HTTP && - url.GetHostNameLength() > 0 && - !url.GetUrlPathLength() ) - { - url.SetUrlPath(_T("/")); - bErr = true; - } - // if we have leading / (absolute path) (ex: /Test/bbb.asp) we can concatinate it - // to it to our current URL (m_urlCurrent) scheme and host - else if (strUrlTemp[0] == _T('/')) - { - url = m_urlCurrent; - url.SetUrlPath(strUrlTemp); - bErr = true; - } - // relative path (ex: bbb.asp) - we don't have a valid url - // and the first char is not / - // Get the url from our current URL (m_urlCurrent) and add - // our relative paths - else - { - CString szPath; - url = m_urlCurrent; - - if (!url.GetUrlPathLength()) - { - szPath = _T('/'); // current URL has no path! - } - else - { - szPath = url.GetUrlPath(); - } - - // back up to the first / and insert our current url - int pos = szPath.ReverseFind(_T('/')); - if(pos == -1) - { - return false; - } - - szPath.GetBufferSetLength(pos+1); - szPath.ReleaseBuffer(); - - szPath += strURL; - url.SetUrlPath(szPath); - bErr = true; - } - if (!bErr) - { - return bErr; - } - DWORD dwLen = ATL_URL_MAX_PATH_LENGTH; - - return url.CreateUrl(strURL.GetBuffer(ATL_URL_MAX_PATH_LENGTH), - &dwLen) ? true : false; - } - _ATLCATCHALL() - { - return false; - } -} - -template -inline bool CAtlHttpClientT::ProcessObjectMoved() throw() -{ - _ATLTRY - { - // look for a location header - CString strValue; - CString strURLNew; - if (GetHeaderValue(_T("Location"), strValue)) - { - CString strRedirectReqHeaders=m_pNavData->szExtraHeaders; - ReconnectIfRequired(); - m_HeaderMap.RemoveAll(); - m_current.Empty(); - - - // create a new URL based on what is in the - // Location header and set it as this object's - // default Url - strURLNew = strValue; - CompleteURL(strURLNew); - CString strCurrHostName = m_urlCurrent.GetHostName(); - ATL_URL_PORT nCurrPort=m_urlCurrent.GetPortNumber(); - - SetDefaultUrl((LPCTSTR)strURLNew, m_urlCurrent.GetPortNumber()); - //If redirected (new url in strURLNew) to different host (server) or port, need a new socket. - if (m_urlCurrent.GetHostName()!=strCurrHostName || m_urlCurrent.GetPortNumber()!=nCurrPort) - { - Close(); - ConnectSocket(); - } - // build up a request. - CString strRequest; - BuildRequest(&strRequest, - m_strMethod, - strRedirectReqHeaders.GetString()); - - // send the request - DWORD dwSent = strRequest.GetLength(); - DWORD dwAvailable = dwSent; - if (!Write((BYTE*)((LPCSTR)CT2A(strRequest.GetBuffer(dwAvailable))), &dwSent)) - return false; - strRequest.ReleaseBuffer(); - - if (dwSent != dwAvailable) - return false; - - // read the response - if (RR_OK == ReadHttpResponse()) - { - if (m_pNavData) - ProcessStatus(m_pNavData->dwFlags); - } - } - return true; - } - _ATLCATCHALL() - { - return false; - } -} - -template -inline bool CAtlHttpClientT::_SetDefaultUrl(LPCTSTR szURL, short nPort) throw() -{ - - if (szURL) - if (!m_urlCurrent.CrackUrl(szURL)) // re-inits the field of the CUrl first - return false; - - ATL_URL_SCHEME currScheme = m_urlCurrent.GetScheme(); - if ( currScheme != ATL_URL_SCHEME_HTTP && - !TSocketClass::SupportsScheme(currScheme) ) - return false; // only support HTTP - - if (!m_urlCurrent.GetUrlPathLength()) - { - // no path, default to / - m_urlCurrent.SetUrlPath(_T("/")); - } - - if (!m_urlCurrent.GetHostNameLength()) - { - // no server name - return false; - } - - if (m_urlCurrent.GetPortNumber() == ATL_URL_INVALID_PORT_NUMBER) - m_urlCurrent.SetPortNumber(nPort); - return true; -} - -template -inline int CAtlHttpClientT::GetStatus() throw() -{ - return m_nStatus; -} - -template -inline LPCTSTR CAtlHttpClientT::GetMethod() throw() -{ - return m_strMethod; -} - -template -inline BYTE* CAtlHttpClientT::GetPostData() throw() -{ - if (m_pNavData) - return m_pNavData->pData; - return NULL; -} - -template -inline DWORD CAtlHttpClientT::GetPostDataLen() throw() -{ - if (m_pNavData) - return m_pNavData->dwDataLen; - return 0; -} - -template -inline LPCTSTR CAtlHttpClientT::GetPostDataType() throw() -{ - if (m_pNavData) - return m_pNavData->szDataType; - return NULL; -} - -template -inline DWORD CAtlHttpClientT::GetLastError() throw() -{ - return m_dwLastError; -} - -template -inline const SOCKET& CAtlHttpClientT::GetSocket() throw() -{ - return const_cast(m_socket); -} - -template -inline void CAtlHttpClientT::Close() throw() -{ - TSocketClass::Close(); -} - -template -inline DWORD CAtlHttpClientT::SetSocketTimeout(DWORD dwNewTimeout) throw() -{ - return TSocketClass::SetSocketTimeout(dwNewTimeout); -} - -template -inline DWORD CAtlHttpClientT::GetSocketTimeout() throw() -{ - return TSocketClass::GetSocketTimeout(); -} - -template -inline void CAtlHttpClientT::AuthProtocolFailed(LPCTSTR szProto) throw() -{ - CAtlBaseAuthObject *pAuthObj = NULL; - _ATLTRY - { - if (m_AuthMap.Lookup(szProto, pAuthObj) && pAuthObj) - { - pAuthObj->m_bFailed = true; - } - } - _ATLCATCHALL() - { - } -} - -template -inline const ATL_NAVIGATE_DATA* CAtlHttpClientT::GetCurrentNavdata() -{ - return m_pNavData; -} - - -///////////////////////////////////////////////////////////////////////////////// -// -// CNTLMAuthObject -// NTLM Security Authorization functions -// -///////////////////////////////////////////////////////////////////////////////// -inline CNTLMAuthObject::CNTLMAuthObject() throw() : - m_pSocket(NULL), - m_nMaxTokenSize(0), - m_pAuthInfo(NULL), - m_bProxy(false) -{ - SecInvalidateHandle(&m_hCredentials) -} - -inline CNTLMAuthObject::CNTLMAuthObject(IAuthInfo *pAuthInfo) throw() : - m_pSocket(NULL), - m_nMaxTokenSize(0), - m_pAuthInfo(pAuthInfo) -{ - SecInvalidateHandle(&m_hCredentials) -} - -inline CNTLMAuthObject::~CNTLMAuthObject() throw() -{ - if (!ATL_IS_INVALIDCREDHANDLE(m_hCredentials)) - FreeCredentialsHandle(&m_hCredentials); -} - -inline void CNTLMAuthObject::Init(CAtlHttpClient *pSocket, IAuthInfo *pAuthInfo) throw() -{ - m_pSocket = pSocket; - SetAuthInfo(pAuthInfo); -} - -inline void CNTLMAuthObject::SetAuthInfo(IAuthInfo *pAuthInfo) throw() -{ - m_pAuthInfo = pAuthInfo; -} - -inline bool CNTLMAuthObject::Authenticate(LPCTSTR /*szAuthTypes*/, bool bProxy) throw() -{ - m_bProxy = bProxy; - if (AcquireCredHandle()) - return DoNTLMAuthenticate(); - return false; -} - -inline bool CNTLMAuthObject::AcquireCredHandle() throw() -{ - PSecPkgInfo pPackageInfo = NULL; - SECURITY_STATUS SecurityStatus = SEC_E_OK; - - // Acquire a credentials handle on the NTLM security package - SecurityStatus = QuerySecurityPackageInfo(ATL_HTTP_AUTHTYPE_NTLM, - &pPackageInfo); - - if (SecurityStatus != SEC_E_OK) - return false; - - void *pAuthData = NULL; - CSecAuthIdentity CA; - if (m_pAuthInfo) - { - // if m_pAuthInfo has been set then the caller wants us - // to get credentials from them. - if (CA.Init(m_pAuthInfo)) - pAuthData = static_cast(&CA); - } - - SecurityStatus = AcquireCredentialsHandle( - 0, - pPackageInfo->Name, - SECPKG_CRED_OUTBOUND, - 0, - pAuthData, - 0, - 0, - &m_hCredentials, - &m_ts - ); - - m_nMaxTokenSize = pPackageInfo->cbMaxToken; - FreeContextBuffer(pPackageInfo); - return SecurityStatus == SEC_E_OK ? true : false; -} - -inline bool CNTLMAuthObject::DoNTLMAuthenticate() throw() -{ - bool bRet = false; - - m_CurrentRequestData = (*(const_cast(m_pSocket->GetCurrentNavdata()))); - // make sure we have a good credentials handle - ATLASSERT(!ATL_IS_INVALIDCREDHANDLE(m_hCredentials)); - if (ATL_IS_INVALIDCREDHANDLE(m_hCredentials)) - return false; - - SECURITY_STATUS SecurityStatus = SEC_E_OK; - - unsigned long ContextAttributes = 0; - CSecBufferDesc OutBufferDesc; - CtxtHandle SecurityContext; - SecInvalidateHandle(&SecurityContext); - - // Create a SecBufferDesc with one buffer of m_nMaxTokenSize - if (!OutBufferDesc.AddBuffers(1, m_nMaxTokenSize)) - return false; - - SecurityStatus = InitializeSecurityContext( - &m_hCredentials, - 0, - NULL, - ISC_REQ_CONNECTION, - 0, - 0, - 0, - 0, - &SecurityContext, - OutBufferDesc, - &ContextAttributes, - &m_ts - ); - - if ( (SecurityStatus == SEC_I_COMPLETE_NEEDED) || - (SecurityStatus == SEC_I_COMPLETE_AND_CONTINUE) ) - { - SecurityStatus = CompleteAuthToken( &SecurityContext, (PSecBufferDesc)OutBufferDesc); - } - - if (IS_ERROR(SecurityStatus)) - return false; - - // create an Authentication header with the contents of the - // security buffer and send it to the HTTP server. The output - // buffer will be pointing to a buffer that contains the - // response from the HTTP server on return. - LPSTR pszbuff = NULL; - if (!SendSecurityInfo(OutBufferDesc.Buffers(0), &pszbuff) || !pszbuff) - return false; - - CString strVal; - if (!m_pSocket->GetHeaderValue(m_bProxy ? g_pszProxyAuthenticate : g_pszWWWAuthenticate, strVal)) - return false; // wrong authentication type - - LPCTSTR szResponsecode = strVal; - TCHAR pszcode[ATL_AUTH_HDR_SIZE]; - if (szResponsecode) - { - // first four characters better be 'NTLM' - if (_tcsncicmp(szResponsecode, _T("NTLM"), 4) != 0) - return false; - - // skip NTLM - szResponsecode += 4; - - // skip space - while (*szResponsecode && _AtlIsHttpSpace(*szResponsecode)) - szResponsecode++; - - // find end of header - LPCTSTR pszend = szResponsecode; - while (*pszend && *pszend != _T('\r')) - pszend++; - bRet = false; - if (pszend) - { - // copy authentication data to our buffer - // and base64decode it. - int nlen = (int)(pszend-szResponsecode); - Checked::memcpy_s(pszcode, ATL_AUTH_HDR_SIZE, szResponsecode, nlen*sizeof(TCHAR)); - pszcode[pszend-szResponsecode]=0; - - // re-use OutBufferDesc here since we'll need to need - // a SecBufferDesc to pass to the next call to InitializeSecurityContext - // anyways. - if(!OutBufferDesc.Buffers(0)->ClearBuffer(m_nMaxTokenSize)) - return false; - - _ATLTRY - { - CT2A pszcode_a(pszcode); - bRet = Base64Decode(pszcode_a, - (int) strlen(pszcode_a), - (BYTE*)OutBufferDesc.Buffers(0)->pvBuffer, - (int*) &OutBufferDesc.Buffers(0)->cbBuffer) != FALSE; - } - _ATLCATCHALL() - { - bRet = false; - } - } - - if (!bRet) - return false; - - // Create buffers for the challenge data - CSecBufferDesc *InBufferDesc = &OutBufferDesc; - CSecBufferDesc OutBufferDesc2; - if (!OutBufferDesc2.AddBuffers(1, m_nMaxTokenSize)) - return false; - - // Process the challenge response from the server - SecurityStatus = InitializeSecurityContext( - 0, - &SecurityContext, - NULL, - 0, - 0, - 0 , - InBufferDesc, - 0, - &SecurityContext, - OutBufferDesc2, - &ContextAttributes, - &m_ts - ); - - if (IS_ERROR(SecurityStatus)) - return false; - - pszbuff = NULL; - if (SendSecurityInfo(OutBufferDesc2.Buffers(0), &pszbuff)) - { - // at this point we should be authenticated and either have the page - // we requested or be getting re-directed to another page under our - // authorization. Either way, we don't want to go through authorization - // code again if we are not authorized to prevent recursive authorization - // so we tell the client not to try this protocol again. - if (m_pSocket->GetStatus() == 401 || - m_pSocket->GetStatus() == 407) - { - // Authorization with this protocol failed. - // don't try it again. - m_pSocket->AuthProtocolFailed(_T("NTLM")); - } - bRet = m_pSocket->ProcessStatus(m_pSocket->GetFlags()); - } - } - - return bRet; -} -inline bool CNTLMAuthObject::GetCredentialNames(CString& theName) -{ - if (ATL_IS_INVALIDCREDHANDLE(m_hCredentials)) - return false; - - SecPkgCredentials_Names spcn; - if(!IS_ERROR(QueryCredentialsAttributes(&m_hCredentials, - SECPKG_CRED_ATTR_NAMES, (void*)&spcn))) - { - theName = spcn.sUserName; - return true; - } - return false; -} - -inline bool CNTLMAuthObject::SendSecurityInfo(SecBuffer *pSecBuffer, LPSTR *pszBuffer) throw() -{ - ATLASSERT(pSecBuffer); - ATLASSUME(m_pSocket); - ATLASSERT(pszBuffer); - - int nDest = ATL_AUTH_HDR_SIZE; - char auth_b64encoded[ATL_AUTH_HDR_SIZE]; - char auth_header[ATL_AUTH_HDR_SIZE]; - const char *pszFmtStr = m_bProxy ? m_pszFmtProxy : m_pszFmtWWW; - - if (!pSecBuffer || !pSecBuffer->pvBuffer || !pszBuffer) - return false; - *pszBuffer = 0; - - // Base64Encode will fail gracefully if buffer not big enough - if (Base64Encode((BYTE*)pSecBuffer->pvBuffer, pSecBuffer->cbBuffer, - auth_b64encoded, &nDest, ATL_BASE64_FLAG_NOCRLF)) - { - if (nDest < ATL_AUTH_HDR_SIZE) - { - auth_b64encoded[nDest]=0; - // make sure we have enough room in our header buffer - if ( (strlen(pszFmtStr)-2 + nDest) < ATL_AUTH_HDR_SIZE) - sprintf_s(auth_header, ATL_AUTH_HDR_SIZE, pszFmtStr, auth_b64encoded); - else - return false; - } - else - return false; - } - else - return false; - - // reset the connection if required - m_pSocket->ResetConnection(); - - // Resend the request with the authorization information - LPCURL pUrl = m_pSocket->GetCurrentUrl(); - bool bRet = false; - - TCHAR szUrl[ATL_URL_MAX_URL_LENGTH]; - DWORD dwMaxLen = ATL_URL_MAX_URL_LENGTH; - if( ! pUrl->CreateUrl(szUrl, &dwMaxLen) ) - return false; - - _ATLTRY - { - CA2CT hdr(auth_header); - CAtlNavigateData navigate_data(m_CurrentRequestData); - // append authorization header to extra headers - CString strHeaders = navigate_data.GetExtraHeaders(); - strHeaders += hdr; - navigate_data.SetExtraHeaders(strHeaders); - navigate_data.RemoveFlags(ATL_HTTP_FLAG_PROCESS_RESULT); - - bRet = m_pSocket->Navigate( szUrl, &navigate_data); - } - _ATLCATCHALL() - { - bRet = false; - } - if (bRet) - *pszBuffer = (LPSTR)m_pSocket->GetResponse(); - return bRet; -} - -///////////////////////////////////////////////////////////////////////////////// -// -// CBasicAuthObject -// BASIC Security Authorization functions -// -///////////////////////////////////////////////////////////////////////////////// -inline bool CBasicAuthObject::DoBasicAuthenticate() throw() -{ - bool bRet = false; - ATLASSUME(m_pClient); - ATLASSUME(m_pAuthInfo); - // Create an authentication string - CTempBuffer auth_string; - CAuthInfoBuffType buffUID; - CAuthInfoBuffType buffPWD; - - DWORD dwUID=0,dwPWD=0; - if (!_AtlGetAuthInfoHelper(m_pAuthInfo, &IAuthInfo::GetPassword, buffPWD, &dwPWD) || - !_AtlGetAuthInfoHelper(m_pAuthInfo, &IAuthInfo::GetUsername, buffUID, &dwUID)) - return false; - - _ATLTRY - { - if (!auth_string.Allocate((_ATL_MAX_AUTH_BUFF*2)+2)) - return false; - - Checked::tcscpy_s(auth_string, _ATL_MAX_AUTH_BUFF, buffUID); - Checked::tcscat_s(auth_string, _ATL_MAX_AUTH_BUFF, _T(":")); - Checked::tcscat_s(auth_string, _ATL_MAX_AUTH_BUFF, buffPWD); - - // Base64 encode the auth string - char *auth_string_enc = NULL; - CTempBuffer auth_string_buff; - CT2A auth_string_a(auth_string); - - int nLen = Base64EncodeGetRequiredLength((int)strlen((LPSTR)auth_string_a)); - auth_string_buff.Allocate(nLen+1); - if (!((char*)auth_string_buff)) - return false; - - auth_string_enc = (char*)auth_string_buff; - if (!Base64Encode((const BYTE*)(LPSTR)auth_string_a, (int)strlen((LPSTR)auth_string_a), - auth_string_enc, &nLen, ATL_BASE64_FLAG_NOCRLF)) - return false; - auth_string_buff[nLen]=0; - - // Format the Authentication header - int nLenFmt = (m_bProxy ? (int)strlen(m_pszFmtProxy) : (int)strlen(m_pszFmtWWW)) + 2; - nLen += nLenFmt; - ++nLen; // Space for '\0' - - CTempBuffer auth_header_buff; - ATLTRY(auth_header_buff.Allocate(nLen)); - if (!((char*)auth_header_buff)) - return false; - - char *auth_header = (char*)auth_header_buff; - Checked::strcpy_s(auth_header, nLen, m_bProxy ? m_pszFmtProxy : m_pszFmtWWW); - Checked::strcat_s(auth_header, nLen, auth_string_enc); - Checked::strcat_s(auth_header, nLen, "\r\n"); - - // Resend the request with the authorization information - LPCURL pUrl = m_pClient->GetCurrentUrl(); - TCHAR szUrl[ATL_URL_MAX_URL_LENGTH]; - DWORD dwMaxLen = ATL_URL_MAX_URL_LENGTH; - pUrl->CreateUrl(szUrl, &dwMaxLen); - - // reset the connection if required - m_pClient->ResetConnection(); - - CA2T hdr(auth_header); - CAtlNavigateData navigate_data(*(const_cast(m_pClient->GetCurrentNavdata()))); - // append authorization header to extra headers - CString strHeaders = navigate_data.GetExtraHeaders(); - strHeaders += hdr; - navigate_data.SetExtraHeaders(strHeaders); - navigate_data.RemoveFlags(ATL_HTTP_FLAG_PROCESS_RESULT); - bRet = m_pClient->Navigate( szUrl, - &navigate_data); - } - _ATLCATCHALL() - { - bRet = false; - } - - if (bRet) - { - // Request was successfully sent. Process the result. - if (m_pClient->GetStatus() == 401 || - m_pClient->GetStatus() == 407) - { - // Authorization with this protocol failed. - // don't try it again. - m_pClient->AuthProtocolFailed(_T("basic")); - } - bRet = m_pClient->ProcessStatus(m_pClient->GetFlags()); - } - return bRet; -} - -inline CBasicAuthObject::CBasicAuthObject() throw() -{ - m_pClient = NULL; - m_pAuthInfo = NULL; - m_szRealm[0] = 0; - m_bProxy = false; -} - -inline CBasicAuthObject::CBasicAuthObject(IAuthInfo *pAuthInfo) throw() -{ - m_pAuthInfo = pAuthInfo; - m_pClient = NULL; -} - -inline void CBasicAuthObject::SetAuthInfo(IAuthInfo *pAuthInfo) throw() -{ - m_pAuthInfo = pAuthInfo; -} - -// Called by the CAtlHttpClient class to -// authenticate a user. -inline bool CBasicAuthObject::Authenticate(LPCTSTR szAuthTypes, bool bProxy) throw() -{ - if (lstrlen(szAuthTypes) > ATL_AUTH_HDR_SIZE) - return false; - - m_bProxy = bProxy; - - if (!CrackRealm(szAuthTypes)) - return false; - return DoBasicAuthenticate(); -} - -inline LPCTSTR CBasicAuthObject::GetRealm() throw() -{ - return const_cast(m_szRealm); -} - -// Called by the CAtlHttpClient class to initialize -// this authentication object. -inline void CBasicAuthObject::Init(CAtlHttpClient *pSocket, IAuthInfo *pAuthInfo) throw() -{ - ATLASSERT(pSocket); - m_pClient = pSocket; - if (pAuthInfo) - SetAuthInfo(pAuthInfo); -} - -inline bool CBasicAuthObject::CrackRealm(LPCTSTR szHeader) throw() -{ - // szHeader is pointing at the - // "basic" in the header - // see if realm is available - const TCHAR *pStart = szHeader; - - // skip "basic" - pStart += 5; - - // skip space - while (*pStart && _AtlIsHttpSpace(*pStart)) - pStart++; - - // are we pointing at 'realm'? - if ((*pStart == 'r' || *pStart == 'R') && - (*(pStart+1) == 'e' || *(pStart+1) == 'E') && - (*(pStart+2) == 'a' || *(pStart+2) == 'A') && - (*(pStart+3) == 'l' || *(pStart+3) == 'L') && - (*(pStart+4) == 'm' || *(pStart+4) == 'M')) - { - // skip 'realm' - pStart += 5; - - // skip space - while (*pStart && _AtlIsHttpSpace(*pStart)) - pStart++; - - // skip '=' - if (*pStart && *pStart == _T('=')) - pStart++; - else - return false; // invalid realm - - // skip space - while (*pStart && _AtlIsHttpSpace(*pStart)) - pStart++; - - // skip quotes if they are there - if (*pStart == '\"') - pStart++; - - const TCHAR *pEnd = pStart; - while (*pEnd && *pEnd != '\"') - { - if (*pEnd == '\\' && *(pEnd + 1)) // escaped character, skip it - pEnd += 2; - else - pEnd++; - } - - if (*pEnd == '\"' && *(pEnd+1) != '\0') - return false; //trailing junk after the quoted realm - - if (*pEnd=='\0' || *pEnd =='\"') - { - int nLen = (int)(pEnd-pStart); - if (nLen < MAX_REALM_LEN) - { - Checked::tcsncpy_s(m_szRealm, _countof(m_szRealm), pStart, nLen); - m_szRealm[nLen]=0; - if (!AtlUnescapeUrl(m_szRealm, m_szRealm, NULL, MAX_REALM_LEN)) - return false; // error unescaping the string - } - else - return false; - } - } - return true; -} - -inline CAtlBaseAuthObject::CAtlBaseAuthObject() -{ - m_bFailed = false; -} - - -inline CAtlNavigateData::CAtlNavigateData() throw() -{ - dwFlags = ATL_HTTP_FLAG_AUTO_REDIRECT| - ATL_HTTP_FLAG_PROCESS_RESULT| - ATL_HTTP_FLAG_SEND_BLOCKS; - szExtraHeaders = NULL; - szMethod = ATL_HTTP_METHOD_GET; - nPort = ATL_URL_DEFAULT_HTTP_PORT; - pData = NULL; - dwDataLen = 0; - szDataType = NULL; - dwTimeout = ATL_SOCK_TIMEOUT; - dwSendBlockSize = ATL_HTTP_DEFAULT_BLOCK_SIZE; - dwReadBlockSize = ATL_HTTP_DEFAULT_BLOCK_SIZE; - pfnChunkCallback = NULL; - pfnSendStatusCallback = NULL; - pfnReadStatusCallback = NULL; - m_lParamSend = 0; - m_lParamRead = 0; -} - -inline CAtlNavigateData::CAtlNavigateData(const CAtlNavigateData &rhs) -{ - this->operator=(rhs); -} - -inline CAtlNavigateData::CAtlNavigateData(const ATL_NAVIGATE_DATA &rhs) -{ - this->operator=(rhs); -} - -inline CAtlNavigateData& CAtlNavigateData::operator=(const CAtlNavigateData &rhs) -{ - return this->operator=(static_cast(rhs)); -} - -inline CAtlNavigateData& CAtlNavigateData::operator=(const ATL_NAVIGATE_DATA &rhs) -{ - dwFlags = rhs.dwFlags; - szExtraHeaders = rhs.szExtraHeaders; - szMethod = rhs.szMethod; - nPort = rhs.nPort; - pData = rhs.pData; - dwDataLen = rhs.dwDataLen; - szDataType = rhs.szDataType; - dwTimeout = rhs.dwTimeout; - dwSendBlockSize = rhs.dwSendBlockSize; - dwReadBlockSize = rhs.dwReadBlockSize; - pfnChunkCallback = rhs.pfnChunkCallback; - pfnSendStatusCallback = rhs.pfnSendStatusCallback; - pfnReadStatusCallback = rhs.pfnReadStatusCallback; - m_lParamSend = rhs.m_lParamSend; - m_lParamRead = rhs.m_lParamRead; - return *this; -} - -inline DWORD CAtlNavigateData::SetFlags(DWORD dwNewFlags) throw() -{ - // check for mutually exclusive flags - if ((dwNewFlags & ATL_HTTP_FLAG_SEND_CALLBACK) && - (dwNewFlags & ATL_HTTP_FLAG_SEND_BLOCKS)) - { - ATLASSERT(0); - return ATL_HTTP_FLAG_INVALID_FLAGS; - } - - DWORD dwOldFlags = dwFlags; - dwFlags = dwNewFlags; - return dwOldFlags; -} - -inline DWORD CAtlNavigateData::GetFlags() throw() -{ - return dwFlags; -} - -inline DWORD CAtlNavigateData::AddFlags(DWORD dwFlagsToAdd) throw() -{ - // check for mutually exclusive flags - if ( - ((dwFlagsToAdd & ATL_HTTP_FLAG_SEND_CALLBACK) && - (dwFlags & ATL_HTTP_FLAG_SEND_BLOCKS)) || - ((dwFlagsToAdd & ATL_HTTP_FLAG_SEND_BLOCKS) && - (dwFlags & ATL_HTTP_FLAG_SEND_CALLBACK)) - ) - { - ATLASSERT(0); - return ATL_HTTP_FLAG_INVALID_FLAGS; - } - - DWORD dwOldFlags = dwFlags; - dwFlags |= dwFlagsToAdd; - return dwOldFlags; -} - -inline DWORD CAtlNavigateData::RemoveFlags(DWORD dwFlagsToRemove) throw() -{ - DWORD dwOldFlags = dwFlags; - dwFlags &= ~dwFlagsToRemove; - return dwOldFlags; -} - -inline LPCTSTR CAtlNavigateData::SetExtraHeaders(LPCTSTR szNewHeaders) throw() -{ - LPCTSTR szold = szExtraHeaders; - szExtraHeaders = szNewHeaders; - return szold; -} - -inline LPCTSTR CAtlNavigateData::GetExtraHeaders() throw() -{ - return szExtraHeaders; -} -inline LPCTSTR CAtlNavigateData::SetMethod(LPCTSTR szNewMethod) throw() -{ - LPCTSTR szold = szMethod; - szMethod = szNewMethod; - return szold; -} -inline LPCTSTR CAtlNavigateData::GetMethod() throw() -{ - return szMethod; -} -inline short CAtlNavigateData::SetPort(short newPort) throw() -{ - short oldport = nPort; - nPort = newPort; - return oldport; -} -inline short CAtlNavigateData::GetPort() throw() -{ - return nPort; -} -inline void CAtlNavigateData::SetPostData(BYTE *pd, DWORD len, LPCTSTR type) throw() -{ - pData = pd; - dwDataLen = len; - szDataType = type; -} - -inline DWORD CAtlNavigateData::SetSocketTimeout(DWORD dwNewTimeout) throw() -{ - DWORD dwold = dwTimeout; - dwTimeout = dwNewTimeout; - return dwold; -} -inline DWORD CAtlNavigateData::GetSocketTimeout() throw() -{ - return dwTimeout; -} -inline DWORD CAtlNavigateData::SetSendBlockSize(DWORD dwNewBlockSize) throw() -{ - DWORD dwold = dwSendBlockSize; - dwSendBlockSize = dwNewBlockSize; - return dwold; -} -inline DWORD CAtlNavigateData::GetSendBlockSize() throw() -{ - return dwSendBlockSize; -} - -inline DWORD CAtlNavigateData::SetReadBlockSize(DWORD dwNewBlockSize) throw() -{ - DWORD dwold = dwReadBlockSize; - dwReadBlockSize = dwNewBlockSize; - return dwold; -} - -inline DWORD CAtlNavigateData::GetReadBlockSize() throw() -{ - return dwReadBlockSize; -} - -inline PFNATLCHUNKEDCB CAtlNavigateData::SetChunkCallback(PFNATLCHUNKEDCB pfn, DWORD_PTR dwParam) throw() -{ - PFNATLCHUNKEDCB pold = pfnChunkCallback; - pfnChunkCallback = pfn; - m_lParamChunkCB = dwParam; - return pold; -} -inline PFNATLCHUNKEDCB CAtlNavigateData::GetChunkCallback() throw() -{ - return pfnChunkCallback; -} - -inline PFNATLSTATUSCALLBACK CAtlNavigateData::SetSendStatusCallback(PFNATLSTATUSCALLBACK pfn, DWORD_PTR dwData) throw() -{ - PFNATLSTATUSCALLBACK pold = pfnSendStatusCallback; - pfnSendStatusCallback = pfn; - m_lParamSend = dwData; - return pold; -} - -inline PFNATLSTATUSCALLBACK CAtlNavigateData::GetSendStatusCallback() throw() -{ - return pfnSendStatusCallback; -} - -inline PFNATLSTATUSCALLBACK CAtlNavigateData::SetReadStatusCallback(PFNATLSTATUSCALLBACK pfn, DWORD_PTR dwData) throw() -{ - PFNATLSTATUSCALLBACK pOld = pfnReadStatusCallback; - pfnReadStatusCallback = pfn; - m_lParamRead = dwData; - return pOld; -} - -inline PFNATLSTATUSCALLBACK CAtlNavigateData::GetReadStatusCallback() throw() -{ - return pfnReadStatusCallback; -} - -} // namespace ATL - -#pragma warning(pop) - -#endif // __ATLHTTP_INL__ diff --git a/include/atl/atlisapi.h b/include/atl/atlisapi.h deleted file mode 100644 index e812aecc5..000000000 --- a/include/atl/atlisapi.h +++ /dev/null @@ -1,10609 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSTENCIL_H__ -#include -#endif - -#ifndef __ATLISAPI_H__ -#define __ATLISAPI_H__ - -#pragma once -#include -#include // needed for cookie support -#include // needed for ECB and IIS support -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef ATL_NO_SOAP - #include -#endif -#ifndef ATL_NO_ACLAPI - #include -#endif -#ifndef ATL_NO_MMSYS -#pragma warning(push) -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union -#include -#pragma warning(pop) -#ifndef _ATL_NO_DEFAULT_LIBS -#pragma comment(lib, "winmm.lib") -#ifndef ATL_NO_SOAP -#pragma comment(lib, "msxml2.lib") -#endif -#endif // !_ATL_NO_DEFAULT_LIBS -#endif -#include - -#pragma warning(push) -#pragma warning(disable: 4291) // allow placement new -#pragma warning(disable: 4127) // conditional expression is constant -#pragma warning(disable: 4511) // copy constructor could not be generated -#pragma warning(disable: 4512) // assignment operator could not be generated -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible -#pragma warning(disable: 4191) // unsafe conversion from 'functionptr1' to 'functionptr2' -#pragma warning(disable: 4702) // unreachable code - -#include -#include - -#ifndef SESSION_COOKIE_NAME - #define SESSION_COOKIE_NAME "SESSIONID" -#endif - -// override this if you want to use a different CLSID for SAX -#ifndef ATLS_SAXXMLREADER_CLSID - #define ATLS_SAXXMLREADER_CLSID __uuidof(SAXXMLReader) -#endif // ATLS_SAXXMLREADER_CLSID - - -// This function is used in CValidateObject to determine if an empty -// request parameter really should be empty. You can -// specialize this function in your own code such as -// the following specialization for type long: -// template <> -// inline bool IsNullByType(long type) throw() -// { -// return type == 0; -// } -// You should provide your own specialization for this -// function if the comparison of type==0 is not adequate -// to discover whether or not your type is 0. -template -inline bool IsNullByType(__in TComp type) throw() -{ - return type == 0; -} - - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -// Default file extension for server response files -#ifndef ATL_DEFAULT_STENCIL_EXTENSION - #define ATL_DEFAULT_STENCIL_EXTENSION ".srf" -#endif -extern __declspec(selectany) const char * const c_AtlSRFExtension = ATL_DEFAULT_STENCIL_EXTENSION; -extern __declspec(selectany) const TCHAR * const c_tAtlSRFExtension = _T(ATL_DEFAULT_STENCIL_EXTENSION); -#define ATLS_EXTENSION_LEN (sizeof(ATL_DEFAULT_STENCIL_EXTENSION)-2) - -// Default file extension for handler DLLs -#ifndef ATL_DEFAULT_DLL_EXTENSION - #define ATL_DEFAULT_DLL_EXTENSION ".dll" -#endif -extern __declspec(selectany) const char * const c_AtlDLLExtension = ATL_DEFAULT_DLL_EXTENSION; -extern __declspec(selectany) const TCHAR * const c_tAtlDLLExtension = _T(ATL_DEFAULT_DLL_EXTENSION); -#define ATLS_DLL_EXTENSION_LEN (sizeof(ATL_DEFAULT_DLL_EXTENSION)-2) - -// maximum handler name length -#ifndef ATL_MAX_HANDLER_NAME_LEN - #define ATL_MAX_HANDLER_NAME_LEN 64 -#endif - -#ifndef ATL_HANDLER_NAME_DEFAULT -#define ATL_HANDLER_NAME_DEFAULT "Default" -#endif // ATL_DEFAULT_HANDLER_NAME - - -// maximum timeout for async guard mutex -#ifndef ATLS_ASYNC_MUTEX_TIMEOUT - #define ATLS_ASYNC_MUTEX_TIMEOUT 10000 -#endif - -#if defined(_M_IA64) || defined (_M_AMD64) -#define ATLS_FUNCID_INITIALIZEHANDLERS "InitializeAtlHandlers" -#define ATLS_FUNCID_GETATLHANDLERBYNAME "GetAtlHandlerByName" -#define ATLS_FUNCID_UNINITIALIZEHANDLERS "UninitializeAtlHandlers" -#elif defined(_M_IX86) -#define ATLS_FUNCID_INITIALIZEHANDLERS "_InitializeAtlHandlers@8" -#define ATLS_FUNCID_GETATLHANDLERBYNAME "_GetAtlHandlerByName@12" -#define ATLS_FUNCID_UNINITIALIZEHANDLERS "_UninitializeAtlHandlers@0" -#else -#error Unknown Platform. -#endif - -#define ATL_MAX_COOKIE_LEN 2048 -#define ATL_MAX_COOKIE_ELEM 1024 - - -// Defines a small value used for comparing the equality of floating point numbers. -#ifndef ATL_EPSILON - #define ATL_EPSILON .0001 -#endif - -#ifndef ATL_DEFAULT_PRECISION - #define ATL_DEFAULT_PRECISION 6 -#endif - -// Call this function to URL-encode a buffer and have the result appended to a CString passed by reference. -// -// A space in the input string is encoded as a plus sign (+). -// Other unsafe characters (as determined by AtlIsUnsafeUrlChar) are encoded as escaped octets. -// An escaped octet is a percent sign (%) followed by two digits representing the hexadecimal code of the character. -// -// string A CStringA reference to which will be appended the encoded version of szBuf. -// -// szBuf The string to be URL-encoded. -ATL_NOINLINE inline bool EscapeToCString(__inout CStringA& string, __in LPCSTR szBuf) -{ - ATLENSURE( szBuf != NULL ); - - _ATLTRY - { - CHAR szEscaped[512]; - LPSTR pszStr = szEscaped; - DWORD dwLen = 0; - - while (*szBuf) - { - if (dwLen+4 >= _countof(szEscaped)) - { - *pszStr = '\0'; - string.Append(szEscaped, dwLen); - pszStr = szEscaped; - dwLen = 0; - } - if (AtlIsUnsafeUrlChar(*szBuf)) - { - if (*szBuf == ' ') - { - dwLen++; - *pszStr++ = '+'; - } - else - { - LPSTR pszTmp = pszStr; - *pszTmp++ = '%'; - unsigned char ch = (unsigned char)*szBuf; - if (ch < 16) - { - *pszTmp++ = '0'; - } - Checked::ultoa_s((unsigned char)ch, pszTmp, szEscaped + _countof(szEscaped) - pszTmp, 16); - pszStr+= sizeof("%FF")-1; - dwLen+= sizeof("%FF")-1; - } - } - else - { - *pszStr++ = *szBuf; - dwLen++; - } - szBuf++; - } - - *pszStr = '\0'; - string.Append(szEscaped, dwLen); - } - _ATLCATCHALL() - { - return false; - } - - return true; -} - -// UNICODE overload for EscapeToCString -// follow specifications detailed in RFC document on -// Internationalized Uniform Resource Identifiers (IURI) -inline bool EscapeToCString(__inout CStringA& string, __in_z LPCWSTR wszBuf) throw() -{ - _ATLTRY - { - // convert string to UTF8 - CFixedStringT strConvert; - - // get the required length for conversion - int nSrcLen = (int) wcslen(wszBuf); - int nLen = AtlUnicodeToUTF8(wszBuf, nSrcLen, NULL, 0); - if (!nLen) - { - return false; - } - - // allocate MBCS conversion string - LPSTR sz = strConvert.GetBuffer(nLen+1); - if (!sz) - { - return false; - } - - // do the UNICODE to UTF8 conversion - nLen = AtlUnicodeToUTF8(wszBuf, nSrcLen, sz, nLen); - if (!nLen) - { - return false; - } - - // null-terminate - sz[nLen] = '\0'; - - // delegate to ANSI version of EscapeToCString - if (!EscapeToCString(string, sz)) - { - return false; - } - - strConvert.ReleaseBuffer(nLen); - } - _ATLCATCHALL() - { - return false; - } - - return true; -} - -struct CDefaultErrorProvider -{ - struct HTTP_ERROR_TEXT - { - UINT uHttpError; // the Http Error value - UINT uHttpSubError; // Allows for customization of error text based on srf specific errors. - LPCSTR szHeader; // the string that should appear in the http response header - UINT uResId; // the resource id of the string to send back as the body - }; - - - // GetErrorText retrieves the http response header string - // and a resource id of the response body for a given - // http error code - // uError: Http error code to retrieve information for - // ppszHeader: pointer to LPCSTR that receives the response header string - // ppszHeader is optional - // puResId: pointer to UINT that receives the response body resource id - // puResId is optional - static BOOL GetErrorText(__in UINT uError, __in UINT uSubErr, __deref_out_opt LPCSTR *ppszHeader, __out_opt UINT *puResId) throw() - { - static const HTTP_ERROR_TEXT s_Errors[] = - { - { 200, SUBERR_NONE, "OK", 0 }, - { 201, SUBERR_NONE, "Created", 0 }, - { 202, SUBERR_NONE, "Accepted", 0 }, - { 203, SUBERR_NONE, "Non-Authoritative Information", 0 }, - { 204, SUBERR_NONE, "No Content", 0 }, - { 204, DBG_SUBERR_ALREADY_DEBUGGING, "Already being debugged by another user", 0}, - { 204, DBG_SUBERR_NOT_DEBUGGING, "Not currently debugging a process", 0}, - { 204, DBG_SUBERR_INVALID_SESSION, "Requested DebugSessionID does not match current DebugSessionID", 0}, - { 204, DBG_SUBERR_BAD_ID, "DebugSessionID corrupted or not provided", 0 }, - { 204, DBG_SUBERR_COCREATE, "Could not CoCreate the debugger", 0 }, - { 204, DBG_SUBERR_ATTACH, "Could not attach to process", 0 }, - { 205, SUBERR_NONE, "Reset Content", 0 }, - { 206, SUBERR_NONE, "Partial Content", 0 }, - { 300, SUBERR_NONE, "Multiple Choices", 0 }, - { 301, SUBERR_NONE, "Moved Permanently", 0 }, - { 302, SUBERR_NONE, "Found", 0 }, - { 303, SUBERR_NONE, "See Other", 0 }, - { 304, SUBERR_NONE, "Not Modified", 0 }, - { 305, SUBERR_NONE, "Use Proxy", 0 }, - { 306, SUBERR_NONE, "(Unused)", 0 }, - { 307, SUBERR_NONE, "Temporary Redirect", 0 }, - { 400, SUBERR_NONE, "Bad Request", IDS_ATLSRV_BAD_REQUEST }, - { 401, SUBERR_NONE, "Unauthorized", IDS_ATLSRV_AUTH_REQUIRED }, - { 402, SUBERR_NONE, "Payment Required", 0 }, - { 403, SUBERR_NONE, "Forbidden", IDS_ATLSRV_FORBIDDEN }, - { 404, SUBERR_NONE, "Not Found", IDS_ATLSRV_NOT_FOUND }, - { 405, SUBERR_NONE, "Method Not Allowed", 0 }, - { 406, SUBERR_NONE, "Not Acceptable", 0 }, - { 407, SUBERR_NONE, "Proxy Authentication Required", 0 }, - { 408, SUBERR_NONE, "Request Timeout", 0 }, - { 409, SUBERR_NONE, "Conflict", 0 }, - { 410, SUBERR_NONE, "Gone", 0 }, - { 411, SUBERR_NONE, "Length Required", 0 }, - { 412, SUBERR_NONE, "Precondition Failed", 0 }, - { 413, SUBERR_NONE, "Request Entity Too Long", 0 }, - { 414, SUBERR_NONE, "Request-URI Too Long", 0 }, - { 415, SUBERR_NONE, "Unsupported Media Type", 0 }, - { 416, SUBERR_NONE, "Requested Range Not Satisfiable", 0 }, - { 417, SUBERR_NONE, "Expectation Failed", 0 }, - { 500, SUBERR_NONE, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR }, - { 500, ISE_SUBERR_BADSRF, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_BADSRF }, - { 500, ISE_SUBERR_HNDLFAIL, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_HNDLFAIL }, - { 500, ISE_SUBERR_SYSOBJFAIL, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL}, - { 500, ISE_SUBERR_READFILEFAIL, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_READFILEFAIL}, - { 500, ISE_SUBERR_LOADFILEFAIL, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL}, - { 500, ISE_SUBERR_LOADLIB, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_LOADLIB}, - { 500, ISE_SUBERR_HANDLERIF, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_HANDLERIF}, - { 500, ISE_SUBERR_OUTOFMEM, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_OUTOFMEM}, - { 500, ISE_SUBERR_UNEXPECTED, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_UNEXPECTED}, - { 500, ISE_SUBERR_STENCIL_PARSE_FAIL, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL}, - { 500, ISE_SUBERR_STENCIL_LOAD_FAIL, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL}, - { 500, ISE_SUBERR_HANDLER_NOT_FOUND, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND}, - { 500, ISE_SUBERR_BAD_HANDLER_TAG, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG}, - { 500, ISE_SUBERR_LONGMETHODNAME, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME}, - { 500, ISE_SUBERR_LONGHANDLERNAME, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME}, - { 500, ISE_SUBERR_NO_HANDLER_TAG, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG}, - { 500, ISE_SUBERR_IMPERSONATIONFAILED, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED}, - { 500, ISE_SUBERR_ISAPISTARTUPFAILED, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED}, - { 500, ISE_SUBERR_SOAPNOSOAPACTION, "Internal Server Error", IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION}, - - { 501, SUBERR_NONE, "Not Implemented", IDS_ATLSRV_NOT_IMPLEMENTED }, - { 502, SUBERR_NONE, "Bad Gateway", IDS_ATLSRV_BAD_GATEWAY }, - { 503, SUBERR_NONE, "Service Unavailable", IDS_ATLSRV_SERVICE_NOT_AVAILABLE }, - { 504, SUBERR_NONE, "Gateway Timeout", 0 }, - { 505, SUBERR_NONE, "HTTP Version Not Supported", 0 }, - }; - - // look for the error - for (int i=0; i -void GetStatusHeader(__inout CStringA &strStatus, __in DWORD dwStatus, __in DWORD dwSubStatus, __in HttpUserErrorTextProvider* pErrorProvider, __out_opt UINT *puResId = NULL) throw(...) -{ - ATLENSURE( pErrorProvider != NULL ); - - LPCSTR szHeadErr = NULL; - // First, we check for the error text in the extension's user error text provider - BOOL bRet = pErrorProvider->GetErrorText(dwStatus, dwSubStatus, &szHeadErr, puResId); - if (!bRet) - { - szHeadErr = ""; - } - - char szBuf[512]; - Checked::itoa_s(dwStatus, szBuf, _countof(szBuf), 10); - - // add the space after the 3 digit response code - szBuf[3] = ' '; - szBuf[4] = '\0'; - strStatus.SetString(szBuf, 4); - strStatus.Append(szHeadErr); -} - -template -void RenderError(__in IHttpServerContext *pServerContext, __in DWORD dwStatus, __in DWORD dwSubStatus, __in HttpUserErrorTextProvider* pErrorProvider) -{ - ATLENSURE( pServerContext != NULL ); - ATLENSURE( pErrorProvider != NULL ); - _ATLTRY - { - UINT uResId = 0; - - CFixedStringT strStatus; - GetStatusHeader(strStatus, dwStatus, dwSubStatus, pErrorProvider, &uResId); - pServerContext->SendResponseHeader(NULL, strStatus, FALSE); - - LPCSTR szBody = strStatus; - DWORD dwBodyLen = strStatus.GetLength(); - CFixedStringT strBody; - if (uResId) - { - // load the body string from a resource - if (strBody.LoadString(uResId)) - { - szBody = strBody; - dwBodyLen = strBody.GetLength(); - } - } - - pServerContext->WriteClient((void *) szBody, &dwBodyLen); - } - _ATLCATCHALL() - { - // last resort message when low on memory - LPCSTR szError; - BOOL bRes; - bRes = CDefaultErrorProvider::GetErrorText(dwStatus, dwSubStatus, &szError, 0); - if (!bRes) - bRes = CDefaultErrorProvider::GetErrorText(dwStatus, SUBERR_NONE, &szError, 0); - if (!bRes) - bRes = CDefaultErrorProvider::GetErrorText(500, SUBERR_NONE, &szError, 0); - if(!szError) - { - szError="Unknown Error"; // last resort, can't localize - } - DWORD dwBodyLen = (DWORD) strlen(szError); - pServerContext->WriteClient((void *) szError, &dwBodyLen); - } -} - -// Call this function to retrieve the full canonical physical path - // of a file relative to the current script. -// -// Returns TRUE on success, FALSE on error. -// -// szFile A file path relative to the current script directory for which -// you are trying to retrieve the full path. -// -// szFullFileName A caller-allocated buffer of at least MAX_PATH characters in length. -// On success, contains the the full canonical path of szFile. -// -// pServerContext The context for the current request. The context is used to obtain the -// current script directory. -inline BOOL GetScriptFullFileName( - __in LPCSTR szFile, - __in_ecount(MAX_PATH) LPSTR szFullFileName, - __in IHttpServerContext* pServerContext) throw(...) -{ - ATLENSURE( szFile != NULL ); - ATLASSERT( szFullFileName != NULL ); - ATLENSURE( pServerContext != NULL ); - - char szTmpScriptPath[MAX_PATH]; - LPCSTR szTmp = pServerContext->GetScriptPathTranslated(); - - if (!szTmp) - { - return FALSE; - } - - if (!SafeStringCopy(szTmpScriptPath, szTmp)) - { - // path is too long - return FALSE; - } - - CHAR *szScriptPath = szTmpScriptPath; - - LPSTR szBackslash; - if (*szFile != '\\') - { - szBackslash = strrchr(szScriptPath, '\\'); - - ATLASSERT( *(szScriptPath+strlen(szScriptPath)) != '\\'); - - if (szBackslash) - szBackslash++; - } - else - { - // handle case where szFile is of the form \directory\etc\etc - szBackslash = strchr(szScriptPath, '\\'); - } - - if (szBackslash) - *szBackslash = '\0'; - - int nScriptPathLen = (int)(szBackslash ? strlen(szScriptPath) : 0); - int nFileLen = (int) strlen(szFile); - int newLen = nScriptPathLen + nFileLen; - - if ((newLen < nScriptPathLen) || (newLen < nFileLen) || (newLen > MAX_PATH-1)) - { - return FALSE; - } - CHAR szTemp[MAX_PATH]; - if (nScriptPathLen) - { - Checked::memcpy_s(szTemp, MAX_PATH, szScriptPath, nScriptPathLen); - } - Checked::memcpy_s(szTemp + nScriptPathLen, MAX_PATH-nScriptPathLen, szFile, nFileLen); - *(szTemp + newLen) = 0; - - return PathCanonicalizeA(szFullFileName, szTemp); -} - -enum ATLSRV_STATE -{ - ATLSRV_STATE_BEGIN, // The request has just arrived, and the type has not been determined - ATLSRV_STATE_CONTINUE, // The request is a continuation of an async request - ATLSRV_STATE_DONE, // The request is a continuation of an async request, but the server is done with it - ATLSRV_STATE_CACHE_DONE // The request is the callback of a cached page -}; - -enum ATLSRV_REQUESTTYPE -{ - ATLSRV_REQUEST_UNKNOWN=-1, // The request type isn't known yet - ATLSRV_REQUEST_STENCIL, // The request is for a .srf file - ATLSRV_REQUEST_DLL // The request is for a .dll file -}; - -// Flags the InitRequest can return in dwStatus -#define ATLSRV_INIT_USECACHE 1 -#define ATLSRV_INIT_USEASYNC 2 -#define ATLSRV_INIT_USEASYNC_EX 4 // required for use of NOFLUSH status - -typedef HTTP_CODE (IRequestHandler::*PFnHandleRequest)(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider); -typedef void (*PFnAsyncComplete)(AtlServerRequest *pRequestInfo, DWORD cbIO, DWORD dwError); - -struct AtlServerRequest -{ - DWORD cbSize; // For future compatibility - IHttpServerContext *pServerContext; // Necessary because it wraps the ECB - ATLSRV_REQUESTTYPE dwRequestType; // See the ATLSRV variables above - // Indicates whether it was called through an .srf file or through a .dll file - ATLSRV_STATE dwRequestState; // See the ATLSRV variables above - // Indicates what state of completion the request is in - IRequestHandler *pHandler; // Necessary because the callback (for async calls) must know where to - // route the request - HINSTANCE hInstDll; // Necessary in order to release the dll properly (for async calls) - IIsapiExtension *pExtension; // Necessary to requeue the request (for async calls) - IDllCache* pDllCache; // Necessary to release the dll in async callback - - HANDLE hFile; - HCACHEITEM hEntry; - IFileCache* pFileCache; - - HANDLE m_hMutex; // necessary to syncronize calls to HandleRequest - // if HandleRequest could potientially make an - // async call before returning. only used - // if indicated with ATLSRV_INIT_USEASYNC_EX - - DWORD dwStartTicks; // Tick count when the request was received - EXTENSION_CONTROL_BLOCK *pECB; - PFnHandleRequest pfnHandleRequest; - PFnAsyncComplete pfnAsyncComplete; - LPCSTR pszBuffer; // buffer to be flushed asyncronously - DWORD dwBufferLen; // length of data in pszBuffer - void* pUserData; // value that can be used to pass user data between parent and child handlers -}; - -inline void _ReleaseAtlServerRequest(__inout AtlServerRequest* pRequest) -{ - ATLENSURE(pRequest!=NULL); - if (pRequest->pHandler) - pRequest->pHandler->Release(); - if (pRequest->pServerContext) - pRequest->pServerContext->Release(); - if (pRequest->pDllCache && pRequest->hInstDll) - pRequest->pDllCache->ReleaseModule(pRequest->hInstDll); - if (pRequest->m_hMutex) - CloseHandle(pRequest->m_hMutex); -} - -typedef BOOL (__stdcall *GETATLHANDLERBYNAME)(LPCSTR szHandlerName, IIsapiExtension *pExtension, IUnknown **ppHandler); -typedef BOOL (__stdcall *INITIALIZEATLHANDLERS)(IHttpServerContext*, IIsapiExtension*); -typedef void (__stdcall *UNINITIALIZEATLHANDLERS)(); - -// initial size of thread worker heap (per thread) -// The heap is growable. The default initial is 16KB -#ifndef ATLS_WORKER_HEAP_SIZE -#define ATLS_WORKER_HEAP_SIZE 16384 -#endif - -class CIsapiWorker -{ -public: - typedef AtlServerRequest* RequestType; - HANDLE m_hHeap; -#ifndef ATL_NO_SOAP - CComPtr m_spReader; -#endif - - CIsapiWorker() throw() - { - m_hHeap = NULL; - } - - virtual ~CIsapiWorker() throw() - { - ATLASSUME(m_hHeap == NULL); - } - - virtual BOOL Initialize(__inout __crt_typefix(IIsapiExtension*) void *pvParam) - { - IIsapiExtension* pExtension = (IIsapiExtension*) pvParam; - ATLENSURE(pExtension); - if (!(pExtension->OnThreadAttach())) - return FALSE; - - m_hHeap = HeapCreate(HEAP_NO_SERIALIZE, ATLS_WORKER_HEAP_SIZE, 0); - if (!m_hHeap) - return FALSE; -#ifndef ATL_NO_SOAP - if (FAILED(m_spReader.CoCreateInstance(ATLS_SAXXMLREADER_CLSID, NULL, CLSCTX_INPROC_SERVER ))) - { - ATLASSERT( FALSE ); - ATLTRACE( atlTraceISAPI, 0, _T("MSXML3 is not installed -- web services will not work.") ); - } -#endif - return pExtension->SetThreadWorker(this); - } - - virtual void Terminate(__inout_opt __crt_typefix(IIsapiExtension*) void* pvParam) throw() - { - if (m_hHeap) - { - if (HeapDestroy(m_hHeap)) - m_hHeap = NULL; - else - { - ATLASSERT(FALSE); - } - } - -#ifndef ATL_NO_SOAP - m_spReader.Release(); -#endif - if (pvParam != NULL) - (static_cast(pvParam))->OnThreadTerminate(); - } - - void Execute(__inout AtlServerRequest *pRequestInfo, __inout __crt_typefix(IIsapiExtension*) void *pvParam, __reserved OVERLAPPED *pOverlapped) - { - ATLENSURE(pRequestInfo != NULL); - ATLENSURE(pvParam != NULL); - (pOverlapped); // unused - ATLASSUME(m_hHeap != NULL); - // any exceptions thrown at this point should have been caught in an - // override of DispatchStencilCall. They will not be thrown out of this - // function. - _ATLTRY - { - (static_cast(pvParam))->DispatchStencilCall(pRequestInfo); - } - _ATLCATCHALL() - { - ATLTRACE(_T("Warning. An uncaught exception was thrown from DispatchStencilCall\n")); - ATLASSERT(FALSE); - } - } - - virtual BOOL GetWorkerData(DWORD /*dwParam*/, void ** /*ppvData*/) throw() - { - return FALSE; - } -}; - -inline void _AtlGetScriptPathTranslated( - __in LPCSTR szPathTranslated, - __inout CFixedStringT& strScriptPathTranslated) -{ - ATLENSURE(szPathTranslated!=NULL); - LPCSTR szEnd = szPathTranslated; - - while (TRUE) - { - while (*szEnd != '.' && *szEnd != '\0') - szEnd++; - if (*szEnd == '\0') - break; - - szEnd++; - - size_t nLen(0); - if (!AsciiStrnicmp(szEnd, c_AtlDLLExtension+1, ATLS_DLL_EXTENSION_LEN)) - nLen = ATLS_DLL_EXTENSION_LEN; - else if (!AsciiStrnicmp(szEnd, c_AtlSRFExtension+1, ATLS_EXTENSION_LEN)) - nLen = ATLS_EXTENSION_LEN; - - if (nLen) - { - szEnd += nLen; - if (!*szEnd || *szEnd == '/' || *szEnd == '\\' || *szEnd == '?' || *szEnd == '#') - break; - } - } - - DWORD dwResult = (DWORD)(szEnd - szPathTranslated); - char *szScriptPathTranslated = NULL; - ATLTRY(szScriptPathTranslated = strScriptPathTranslated.GetBuffer(dwResult)); - if (szScriptPathTranslated) - { - Checked::memcpy_s(szScriptPathTranslated, dwResult, szPathTranslated, dwResult); - szScriptPathTranslated[dwResult] = '\0'; - strScriptPathTranslated.ReleaseBuffer(dwResult); - } -} - - -struct CStencilState -{ - CStencilState() throw() - { - dwIndex = 0; - locale = CP_ACP; - pIncludeInfo = NULL; - pParentInfo = NULL; - } - - DWORD dwIndex; - LCID locale; - AtlServerRequest* pIncludeInfo; - AtlServerRequest* pParentInfo; -}; - -class CWrappedServerContext: - public IHttpServerContext -{ -public: - CComPtr m_spParent; - - CWrappedServerContext() throw() - { - } - - virtual ~CWrappedServerContext() throw() - { - } - - CWrappedServerContext(__in IHttpServerContext *pParent) throw() - { - m_spParent = pParent; - } - - LPCSTR GetRequestMethod() - { - ATLENSURE(m_spParent); - return m_spParent->GetRequestMethod(); - } - - LPCSTR GetQueryString() - { - ATLENSURE(m_spParent); - return m_spParent->GetQueryString(); - } - - LPCSTR GetPathInfo() - { - ATLENSURE(m_spParent); - return m_spParent->GetPathInfo(); - } - - LPCSTR GetScriptPathTranslated() - { - ATLENSURE(m_spParent); - return m_spParent->GetScriptPathTranslated(); - } - - LPCSTR GetPathTranslated() - { - ATLENSURE(m_spParent); - return m_spParent->GetPathTranslated(); - } - - DWORD GetTotalBytes() - { - ATLENSURE(m_spParent); - return m_spParent->GetTotalBytes(); - } - - DWORD GetAvailableBytes() - { - ATLENSURE(m_spParent); - return m_spParent->GetAvailableBytes(); - } - - BYTE *GetAvailableData() - { - ATLENSURE(m_spParent); - return m_spParent->GetAvailableData(); - } - - LPCSTR GetContentType() - { - ATLENSURE(m_spParent); - return m_spParent->GetContentType(); - } - - __checkReturn BOOL GetServerVariable(__in_z LPCSTR pszVariableName, __out_ecount_part(*pdwSize,*pdwSize) LPSTR pvBuffer, __inout DWORD *pdwSize) - { - ATLENSURE(m_spParent); - return m_spParent->GetServerVariable(pszVariableName, pvBuffer, pdwSize); - } - - __checkReturn BOOL WriteClient(__in_bcount(*pdwBytes) void *pvBuffer, __inout DWORD *pdwBytes) - { - ATLENSURE(m_spParent); - return m_spParent->WriteClient(pvBuffer, pdwBytes); - } - - __checkReturn BOOL AsyncWriteClient(__in_bcount(*pdwBytes) void * pvBuffer, __inout DWORD * pdwBytes) - { - ATLENSURE(m_spParent); - return m_spParent->AsyncWriteClient(pvBuffer, pdwBytes); - } - - __checkReturn BOOL ReadClient(__out_bcount_part(*pdwSize,*pdwSize) void * pvBuffer, __inout DWORD * pdwSize) - { - ATLENSURE(m_spParent); - return m_spParent->ReadClient(pvBuffer, pdwSize); - } - - __checkReturn BOOL AsyncReadClient(__out_bcount_part(*pdwSize,*pdwSize) void * pvBuffer, __inout DWORD * pdwSize) - { - ATLENSURE(m_spParent); - return m_spParent->AsyncReadClient(pvBuffer, pdwSize); - } - - __checkReturn BOOL SendRedirectResponse(__in LPCSTR pszRedirectUrl) - { - ATLENSURE(m_spParent); - return m_spParent->SendRedirectResponse(pszRedirectUrl); - } - - __checkReturn BOOL GetImpersonationToken(__out HANDLE * pToken) - { - ATLENSURE(m_spParent); - return m_spParent->GetImpersonationToken(pToken); - } - - __checkReturn BOOL SendResponseHeader(__in LPCSTR pszHeader, __in LPCSTR pszStatusCode, __in BOOL fKeepConn) - { - ATLENSURE(m_spParent); - return m_spParent->SendResponseHeader(pszHeader, pszStatusCode, fKeepConn); - } - - __checkReturn BOOL DoneWithSession(__in DWORD dwHttpStatusCode) - { - ATLENSURE(m_spParent); - return m_spParent->DoneWithSession(dwHttpStatusCode); - } - - __checkReturn BOOL RequestIOCompletion(__in PFN_HSE_IO_COMPLETION pfn, DWORD * pdwContext) - { - ATLENSURE(m_spParent); - return m_spParent->RequestIOCompletion(pfn, pdwContext); - } - - BOOL TransmitFile(__in HANDLE hFile, __in_opt PFN_HSE_IO_COMPLETION pfn, void * pContext, - __in LPCSTR szStatusCode, __in DWORD dwBytesToWrite, __in DWORD dwOffset, __in_bcount_opt(dwHeadLen) void * pvHead, - __in DWORD dwHeadLen, __in_bcount_opt(dwTailLen) void * pvTail, __in DWORD dwTailLen, __in DWORD dwFlags) - { - ATLENSURE(m_spParent); - return m_spParent->TransmitFile(hFile, pfn, pContext, szStatusCode, - dwBytesToWrite, dwOffset, pvHead, dwHeadLen, pvTail, dwTailLen, - dwFlags); - } - - BOOL AppendToLog(__in LPCSTR szMessage, __in_opt DWORD* pdwLen) - { - ATLENSURE(m_spParent); - return m_spParent->AppendToLog(szMessage, pdwLen); - } - - BOOL MapUrlToPathEx(__in_bcount(dwLen) LPCSTR szLogicalPath, __in DWORD dwLen, __out HSE_URL_MAPEX_INFO *pumInfo) - { - ATLENSURE(m_spParent); - return m_spParent->MapUrlToPathEx(szLogicalPath, dwLen, pumInfo); - } -}; // class CWrappedServerContext - -// Wraps the EXTENSION_CONTROL_BLOCK structure used by IIS to provide -// an ISAPI extension with information about the current request and -// access to the web server's functionality. -class CServerContext : - public CComObjectRootEx, - public IHttpServerContext -{ -public: - BEGIN_COM_MAP(CServerContext) - COM_INTERFACE_ENTRY(IHttpServerContext) - END_COM_MAP() - - CServerContext() throw() - { - m_pECB = NULL; - m_bHeadersHaveBeenSent = false; - } - virtual ~CServerContext() throw() - { - } - - void Initialize(__in EXTENSION_CONTROL_BLOCK *pECB) - { - ATLENSURE(pECB); - m_pECB = pECB; - - // Initialize the translated script path - _AtlGetScriptPathTranslated(GetPathTranslated(), m_strScriptPathTranslated); - } - - // Returns a nul-terminated string that contains the HTTP method of the current request. - // Examples of common HTTP methods include "GET" and "POST". - // Equivalent to the REQUEST_METHOD server variable or EXTENSION_CONTROL_BLOCK::lpszMethod. - LPCSTR GetRequestMethod() - { - ATLENSURE(m_pECB); - return m_pECB->lpszMethod; - } - - // Returns a nul-terminated string that contains the query information. - // This is the part of the URL that appears after the question mark (?). - // Equivalent to the QUERY_STRING server variable or EXTENSION_CONTROL_BLOCK::lpszQueryString. - LPCSTR GetQueryString() - { - ATLENSURE(m_pECB); - return m_pECB->lpszQueryString; - } - - // Returns a nul-terminated string that contains the path of the current request. - // This is the part of the URL that appears after the server name, but before the query string. - // Equivalent to the PATH_INFO server variable or EXTENSION_CONTROL_BLOCK::lpszPathInfo. - LPCSTR GetPathInfo() - { - ATLENSURE(m_pECB); - return m_pECB->lpszPathInfo; - } - - // Call this function to retrieve a nul-terminated string containing the physical path of the script. - // - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the - // buffer (including the nul-terminating byte). - // The script path is the same as GetPathTranslated up to the first .srf or .dll. - // For example, if GetPathTranslated returns "c:\inetpub\vcisapi\hello.srf\goodmorning", - // then this function returns "c:\inetpub\vcisapi\hello.srf". - LPCSTR GetScriptPathTranslated() - { - ATLASSUME(m_pECB); - return m_strScriptPathTranslated; - } - - - // Returns a nul-terminated string that contains the translated path of the requested resource. - // This is the path of the resource on the local server. - // Equivalent to the PATH_TRANSLATED server variable or EXTENSION_CONTROL_BLOCK::lpszPathTranslated. - LPCSTR GetPathTranslated() - { - ATLENSURE(m_pECB); - return m_pECB->lpszPathTranslated; - } - - // Returns the total number of bytes to be received from the client. - // If this value is 0xffffffff, then there are four gigabytes or more of available data. - // In this case, ReadClient or AsyncReadClient should be called until no more data is returned. - // Equivalent to the CONTENT_LENGTH server variable or EXTENSION_CONTROL_BLOCK::cbTotalBytes. - DWORD GetTotalBytes() - { - ATLENSURE(m_pECB); - return m_pECB->cbTotalBytes; - } - - // Returns the number of bytes available in the request buffer accessible via GetAvailableData. - // If GetAvailableBytes returns the same value as GetTotalBytes, the request buffer contains the whole request. - // Otherwise, the remaining data should be read from the client using ReadClient or AsyncReadClient. - // Equivalent to EXTENSION_CONTROL_BLOCK::cbAvailable. - DWORD GetAvailableBytes() - { - ATLENSURE(m_pECB); - return m_pECB->cbAvailable; - } - - // Returns a pointer to the request buffer containing the data sent by the client. - // The size of the buffer can be determined by calling GetAvailableBytes. - // Equivalent to EXTENSION_CONTROL_BLOCK::lpbData - BYTE *GetAvailableData() - { - ATLENSURE(m_pECB); - return m_pECB->lpbData; - } - - // Returns a nul-terminated string that contains the content type of the data sent by the client. - // Equivalent to the CONTENT_TYPE server variable or EXTENSION_CONTROL_BLOCK::lpszContentType. - LPCSTR GetContentType() - { - ATLENSURE(m_pECB); - return m_pECB->lpszContentType; - } - - // Call this function to retrieve a nul-terminated string containing the value of the requested server variable. - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - // Equivalent to EXTENSION_CONTROL_BLOCK::GetServerVariable. - __checkReturn BOOL GetServerVariable( - __in LPCSTR pszVariableName, - __out_ecount_part(*pdwSize,*pdwSize) LPSTR pvBuffer, - __inout DWORD *pdwSize) - { - ATLENSURE(m_pECB); - ATLASSERT(pszVariableName); - ATLASSERT(pdwSize); - - if (pszVariableName && pdwSize) - { - return m_pECB->GetServerVariable(m_pECB->ConnID, (LPSTR) pszVariableName, - pvBuffer, pdwSize); - } - return FALSE; - } - - // Synchronously sends the data present in the given buffer to the client that made the request. - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // Equivalent to EXTENSION_CONTROL_BLOCK::WriteClient(..., HSE_IO_SYNC). - __checkReturn BOOL WriteClient(__in_bcount(*pdwBytes) void *pvBuffer, __inout DWORD *pdwBytes) - { - ATLENSURE(m_pECB); - ATLASSERT(pvBuffer); - ATLASSERT(pdwBytes); - - if (pvBuffer && pdwBytes) - { - return m_pECB->WriteClient(m_pECB->ConnID, pvBuffer, pdwBytes, HSE_IO_SYNC | HSE_IO_NODELAY); - } - return FALSE; - } - - // Asynchronously sends the data present in the given buffer to the client that made the request. - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // Equivalent to EXTENSION_CONTROL_BLOCK::WriteClient(..., HSE_IO_ASYNC). - __checkReturn BOOL AsyncWriteClient(__in_bcount(*pdwBytes) void *pvBuffer, __inout DWORD *pdwBytes) - { - ATLENSURE(m_pECB); - ATLASSERT(pvBuffer); - ATLASSERT(pdwBytes); - - if (pvBuffer && pdwBytes) - { - return m_pECB->WriteClient(m_pECB->ConnID, pvBuffer, pdwBytes, HSE_IO_ASYNC | HSE_IO_NODELAY); - } - return FALSE; - } - - // Call this function to synchronously read information from the body of the web client's HTTP request into the buffer supplied by the caller. - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // Equivalent to EXTENSION_CONTROL_BLOCK::ReadClient. - __checkReturn BOOL ReadClient(__out_ecount_part(*pdwSize,*pdwSize) void *pvBuffer, __inout DWORD *pdwSize) - { - ATLENSURE(m_pECB); - ATLASSERT(pvBuffer); - ATLASSERT(pdwSize); - - if (pvBuffer && pdwSize) - { - return m_pECB->ReadClient(m_pECB->ConnID, pvBuffer, pdwSize); - } - return FALSE; - } - - // Call this function to asynchronously read information from the body of the web client's HTTP request into the buffer supplied by the caller. - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // Equivalent to the HSE_REQ_ASYNC_READ_CLIENT server support function. - __checkReturn BOOL AsyncReadClient(__out_bcount_part(*pdwSize,*pdwSize) void *pvBuffer, __inout DWORD *pdwSize) - { - // To call this function successfully someone has to have already - // called RequestIOCompletion specifying the callback function - // to be used for IO completion. - ATLENSURE(m_pECB); - ATLASSERT(pvBuffer); - ATLASSERT(pdwSize); - - if (pvBuffer && pdwSize) - { - DWORD dwFlag = HSE_IO_ASYNC; - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_ASYNC_READ_CLIENT, pvBuffer, pdwSize, - &dwFlag); - } - return FALSE; - } - - // Call this function to redirect the client to the specified URL. - // The client receives a 302 (Found) HTTP status code. - // Returns TRUE on success, and FALSE on failure. - // Equivalent to the HSE_REQ_SEND_URL_REDIRECT_RESP server support function. - __checkReturn BOOL SendRedirectResponse(__in LPCSTR pszRedirectUrl) - { - ATLENSURE(m_pECB); - ATLENSURE(pszRedirectUrl); - - if (pszRedirectUrl) - { - DWORD dwSize = (DWORD) strlen(pszRedirectUrl); - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_SEND_URL_REDIRECT_RESP, - (void *) pszRedirectUrl, &dwSize, NULL); - } - return FALSE; - } - - // Call this function to retrieve a handle to the impersonation token for this request. - // An impersonation token represents a user context. You can use the handle in calls to ImpersonateLoggedOnUser or SetThreadToken. - // Do not call CloseHandle on the handle. - // Returns TRUE on success, and FALSE on failure. - // Equivalent to the HSE_REQ_GET_IMPERSONATION_TOKEN server support function. - __checkReturn BOOL GetImpersonationToken(__out HANDLE * pToken) - { - ATLENSURE(m_pECB); - if (pToken) - { - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_GET_IMPERSONATION_TOKEN, pToken, - NULL, NULL); - } - return FALSE; - } - - // Call this function to send an HTTP response header to the client including the HTTP status, server version, message time, and MIME version. - // Returns TRUE on success, and FALSE on failure. - // Equivalent to the HSE_REQ_SEND_RESPONSE_HEADER_EX server support function. - __checkReturn BOOL SendResponseHeader( - __in LPCSTR pszHeader = "Content-Type: text/html\r\n\r\n", - __in LPCSTR pszStatusCode = "200 OK", - __in BOOL fKeepConn=FALSE) - { - ATLENSURE(m_pECB); - - if (m_bHeadersHaveBeenSent) - return TRUE; - - HSE_SEND_HEADER_EX_INFO hex; - hex.pszStatus = pszStatusCode; - hex.pszHeader = pszHeader; - hex.cchStatus = (DWORD)(pszStatusCode ? strlen(pszStatusCode) : 0); - hex.cchHeader = (DWORD)(pszHeader ? strlen(pszHeader) : 0); - hex.fKeepConn = fKeepConn; - - m_bHeadersHaveBeenSent = true; - - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_SEND_RESPONSE_HEADER_EX, - &hex, NULL, NULL); - } - - // Call this function to terminate the session for the current request. - // Returns TRUE on success, and FALSE on failure. - // Equivalent to the HSE_REQ_DONE_WITH_SESSION server support function. - __checkReturn BOOL DoneWithSession(__in DWORD dwHttpStatusCode) - { - ATLENSURE(m_pECB); - - m_pECB->dwHttpStatusCode = dwHttpStatusCode; - - DWORD dwStatusCode = (dwHttpStatusCode >= 400) ? HSE_STATUS_ERROR : HSE_STATUS_SUCCESS; - - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_DONE_WITH_SESSION, &dwStatusCode, NULL, NULL); - } - - // Call this function to set a special callback function that will be used for handling the completion of asynchronous I/O operations. - // Returns TRUE on success, and FALSE on failure. - // Equivalent to the HSE_REQ_IO_COMPLETION server support function. - __checkReturn BOOL RequestIOCompletion(__in PFN_HSE_IO_COMPLETION pfn, DWORD *pdwContext) - { - ATLENSURE(m_pECB); - ATLASSERT(pfn); - - if (pfn) - { - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_IO_COMPLETION, pfn, NULL, pdwContext); - } - return FALSE; - } - - // Call this function to transmit a file asynchronously to the client. - // Returns TRUE on success, and FALSE on failure. - // Equivalent to the HSE_REQ_TRANSMIT_FILE server support function. - BOOL TransmitFile( - __in HANDLE hFile, - __in_opt PFN_HSE_IO_COMPLETION pfn, - void *pContext, - __in LPCSTR szStatusCode, - __in DWORD dwBytesToWrite, - __in DWORD dwOffset, - __in_bcount_opt(dwHeadLen) void *pvHead, - __in DWORD dwHeadLen, - __in_bcount_opt(dwTailLen) void *pvTail, - __in DWORD dwTailLen, - __in DWORD dwFlags) - { - ATLENSURE(m_pECB); - - HSE_TF_INFO tf; - tf.hFile = hFile; - tf.BytesToWrite = dwBytesToWrite; - tf.Offset = dwOffset; - tf.pContext = pContext; - tf.pfnHseIO = pfn; - tf.pHead = pvHead; - tf.HeadLength = dwHeadLen; - tf.pTail = pvTail; - tf.TailLength = dwTailLen; - tf.pszStatusCode = szStatusCode; - tf.dwFlags = dwFlags; - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_REQ_TRANSMIT_FILE, &tf, NULL, NULL); - } - - // Appends the string szMessage to the web server log for the current - // request. - // Returns TRUE on success, FALSE on failure. - // Equivalent to the HSE_APPEND_LOG_PARAMETER server support function. - BOOL AppendToLog(__in LPCSTR szMessage, __in_opt DWORD *pdwLen) - { - DWORD dwLen = 0; - if (!pdwLen) - { - if(!szMessage) - { - return FALSE; - } - dwLen = (DWORD)strlen(szMessage); - } - else - { - dwLen = *pdwLen; - } - - return m_pECB->ServerSupportFunction(m_pECB->ConnID, - HSE_APPEND_LOG_PARAMETER, (void *)szMessage, - &dwLen, NULL); - } - - // Maps a logical Url Path to a physical path - // Returns TRUE on success, FALSE on failure. - // Equivalent to the HSE_REQ_MAP_URL_TO_PATH_EX server support function. - // you can pass 0 for dwLen if szLogicalPath is null terminated - BOOL MapUrlToPathEx(__in_bcount(dwLen) LPCSTR szLogicalPath, __in DWORD dwLen, __out HSE_URL_MAPEX_INFO *pumInfo) - { - ATLENSURE(m_pECB!=NULL); - if (dwLen == 0) - dwLen = (DWORD) strlen(szLogicalPath); - return m_pECB->ServerSupportFunction(m_pECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, (void *) szLogicalPath, - &dwLen, (DWORD *) pumInfo); - } - -protected: - // The pointer to the extension control block provided by IIS. - EXTENSION_CONTROL_BLOCK *m_pECB; - bool m_bHeadersHaveBeenSent; - - // The translated script path - CFixedStringT m_strScriptPathTranslated; - -}; // class CServerContext - -class CPageCachePeer -{ -public: - - struct PeerInfo - { - CStringA strHeader; - CStringA strStatus; - }; - - static BOOL Add(__inout PeerInfo * pDest, __in PeerInfo * pSrc) throw() - { - _ATLTRY - { - PeerInfo *pIn = (PeerInfo *)pSrc; - pDest->strHeader = pIn->strHeader; - pDest->strStatus = pIn->strStatus; - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - static BOOL Remove(const PeerInfo * /*pDest*/) throw() - { - return TRUE; - } -}; - - -class CCacheServerContext : - public CComObjectRootEx, - public CWrappedServerContext, - public IPageCacheControl -{ -private: - - CAtlTemporaryFile m_cacheFile; - CComPtr m_spCache; - char m_szFullUrl[ATL_URL_MAX_URL_LENGTH + 1]; - FILETIME m_ftExpiration; - BOOL m_bIsCached; - CPageCachePeer::PeerInfo m_Headers; - -public: - - BEGIN_COM_MAP(CCacheServerContext) - COM_INTERFACE_ENTRY(IHttpServerContext) - COM_INTERFACE_ENTRY(IPageCacheControl) - END_COM_MAP() - - CCacheServerContext() throw() - { - } - virtual ~CCacheServerContext() throw() - { - } - - BOOL Initialize(__in IHttpServerContext *pParent, __in IFileCache *pCache) throw() - { - ATLASSERT(pParent); - ATLASSERT(pCache); - - if (pParent == NULL || pCache == NULL) - return FALSE; - - m_spParent = pParent; - m_spCache = pCache; - - if (FAILED(m_cacheFile.Create())) - return FALSE; - - LPCSTR szPathInfo = pParent->GetPathInfo(); - LPCSTR szQueryString = pParent->GetQueryString(); - if ( szPathInfo == NULL || szQueryString == NULL) - return FALSE; - - LPSTR szTo = m_szFullUrl; - int nSize = 0; - while (*szPathInfo && nSize < ATL_URL_MAX_URL_LENGTH) - { - *szTo++ = *szPathInfo++; - nSize++; - } - if (nSize >= ATL_URL_MAX_URL_LENGTH) - { - return FALSE; - } - *szTo++ = '?'; - nSize++; - while (*szQueryString && nSize < ATL_URL_MAX_URL_LENGTH) - { - *szTo++ = *szQueryString++; - nSize++; - } - if (nSize >= ATL_URL_MAX_URL_LENGTH) - { - return FALSE; - } - *szTo = '\0'; - - memset(&m_ftExpiration, 0x00, sizeof(FILETIME)); - m_bIsCached = TRUE; - - return TRUE; - } - - // IPageCacheControl methods - HRESULT GetExpiration(__out FILETIME *pftExpiration) throw() - { - ATLASSERT(pftExpiration); - if (!pftExpiration) - return E_INVALIDARG; - - *pftExpiration = m_ftExpiration; - - return S_OK; - } - - HRESULT SetExpiration(__in FILETIME ftExpiration) throw() - { - m_ftExpiration = ftExpiration; - - return S_OK; - } - - __checkReturn BOOL IsCached() throw() - { - return m_bIsCached; - } - - BOOL Cache(__in BOOL bCache) throw() - { - BOOL bRet = m_bIsCached; - m_bIsCached = bCache; - return bRet; - } - - __checkReturn BOOL WriteClient(__in_bcount(*pdwBytes) void *pvBuffer, __inout DWORD *pdwBytes) - { - ATLENSURE(pvBuffer); - ATLENSURE(pdwBytes); - - if (S_OK != m_cacheFile.Write(pvBuffer, *pdwBytes)) - return FALSE; - ATLENSURE(m_spParent); - return m_spParent->WriteClient(pvBuffer, pdwBytes); - } - - __checkReturn BOOL DoneWithSession(__in DWORD dwHttpStatusCode) - { - ATLENSURE(m_spParent); - - _ATLTRY - { - if (m_bIsCached) - { - CT2CA strFileName(m_cacheFile.TempFileName()); - m_cacheFile.HandsOff(); - m_spCache->AddFile(m_szFullUrl, strFileName, &m_ftExpiration, &m_Headers, NULL); - } - else - m_cacheFile.Close(); - } - _ATLCATCHALL() - { - m_cacheFile.Close(); - } - - return m_spParent->DoneWithSession(dwHttpStatusCode); - } - - __checkReturn BOOL GetImpersonationToken(__out HANDLE * pToken) - { - ATLTRACE(atlTraceISAPI, 0, _T("Getting impersonation token for cached page") - _T(" -- Caching a page that requires special privileges to build is a possible security problem. ") - _T("Future hits may get a cached page without going through the security checks done during the page creation process")); - ATLENSURE(m_spParent); - ATLASSERT(pToken); - return m_spParent->GetImpersonationToken(pToken); - } - - __checkReturn BOOL AppendToLog(__in LPCSTR szMessage, __in_opt DWORD* pdwLen) - { - ATLTRACE(atlTraceISAPI, 0, _T("Logging on cached page -- future hits will not log")); - ATLENSURE(m_spParent); - return m_spParent->AppendToLog(szMessage, pdwLen); - } - - __checkReturn BOOL SendResponseHeader( - __in LPCSTR pszHeader = "Content-Type: text/html\r\n\r\n", - __in LPCSTR pszStatusCode = "200 OK", - __in BOOL fKeepConn=FALSE) - { - ATLENSURE(m_spParent); - - m_Headers.strHeader = pszHeader; - m_Headers.strStatus = pszStatusCode; - - return m_spParent->SendResponseHeader(pszHeader, pszStatusCode, fKeepConn); - } - - // The methods below this point are actions that should not be performed on cached - // pages, as they will not behave correctly. - __checkReturn BOOL AsyncWriteClient(void * /*pvBuffer*/, DWORD * /*pdwBytes*/) - { - // Asynchronous calls will not work - ATLASSERT(FALSE); - return FALSE; - } - - __checkReturn BOOL ReadClient(void * /*pvBuffer*/, DWORD * /*pdwSize*/) - { - // Nobody should be reading from this client if the page is being cached - // Also, only GET's are cached anyway - ATLASSERT(FALSE); - return FALSE; - } - - __checkReturn BOOL AsyncReadClient(void * /*pvBuffer*/, DWORD * /*pdwSize*/) - { - ATLASSERT(FALSE); - return FALSE; - } - - __checkReturn BOOL SendRedirectResponse(LPCSTR /*pszRedirectUrl*/) - { - ATLASSERT(FALSE); - return FALSE; - } - - - __checkReturn BOOL RequestIOCompletion(PFN_HSE_IO_COMPLETION /*pfn*/, DWORD * /*pdwContext*/) - { - ATLASSERT(FALSE); - return FALSE; - } - - __checkReturn BOOL TransmitFile( - HANDLE /*hFile*/, - PFN_HSE_IO_COMPLETION /*pfn*/, - void * /*pContext*/, - LPCSTR /*szStatusCode*/, - DWORD /*dwBytesToWrite*/, - DWORD /*dwOffset*/, - void * /*pvHead*/, - DWORD /*dwHeadLen*/, - void * /*pvTail*/, - DWORD /*dwTailLen*/, - DWORD /*dwFlags*/) - { - ATLASSERT(FALSE); - return FALSE; - } -}; - - -// This class represents a collection of validation failures. -// Use this class in combination with CValidateObject to validate -// forms, cookies, or query strings and build up a collection of -// failures. If appropriate, use the information in the collection -// to return detailed responses to the client to help them correct the failures. - - -class CValidateContext -{ -public: - enum { ATL_EMPTY_PARAMS_ARE_FAILURES = 0x00000001 }; - - CValidateContext(__in DWORD dwFlags=0) throw() - { - m_bFailures = false; - m_dwFlags = dwFlags; - } - - bool SetResultAt(__in LPCSTR szName, __in DWORD type) - { - _ATLTRY - { - if (!VALIDATION_SUCCEEDED(type) || - (type == VALIDATION_S_EMPTY && (m_dwFlags & ATL_EMPTY_PARAMS_ARE_FAILURES))) - m_bFailures = true; - - return TRUE == m_results.SetAt(szName,type); - - } - _ATLCATCHALL() - { - } - - return false; - } - - // Call this function to add a validation result to the collection managed by this object. - // Each result is identified by a name and the type of result that occurred. - // The result codes are the VALIDATION_ codes defined at the top of this file. - // The bOnlyFailure parameter below is used to only allow failure results to - // be added to the list of failures. The reason you'd want to do this is that - // success codes should be the common case in validation routines so you can - // use bOnlyFailures to limit the number of allocations by this class's base - // map for mapping success results if you don't care about iterating successes. - - bool AddResult(__in LPCSTR szName, __in DWORD type, __in bool bOnlyFailures = true) throw() - { - _ATLTRY - { - if (!VALIDATION_SUCCEEDED(type) || - (type == VALIDATION_S_EMPTY && (m_dwFlags & ATL_EMPTY_PARAMS_ARE_FAILURES))) - m_bFailures = true; - - if (!bOnlyFailures) - return TRUE == m_results.Add(szName, type); // add everything - - else if (bOnlyFailures && - (!VALIDATION_SUCCEEDED(type) || - (type == VALIDATION_S_EMPTY && (m_dwFlags & ATL_EMPTY_PARAMS_ARE_FAILURES)))) - return TRUE == m_results.Add(szName, type); // only add failures - } - _ATLCATCHALL() - { - } - - return false; - } - - // Returns true if there are no validation failures in the collection, - // returns false otherwise. - __checkReturn bool ParamsOK() throw() - { - return !m_bFailures; - } - - // Returns the number of validation results in the collection. - __checkReturn int GetResultCount() throw() - { - return m_results.GetSize(); - } - - // Call this function to retrieve the name and type of a - // validation result based on its index in the collection. - // Returns true on success, false on failure. - // - // i The index of a result managed by this collection. - // - // strName On success, the name of the result with index i. - // - // type On success, the type of the result with index i. - __checkReturn bool GetResultAt(__in int i, __out CStringA& strName, __out DWORD& type) throw() - { - if ( i >= 0 && i < m_results.GetSize()) - { - _ATLTRY - { - strName = m_results.GetKeyAt(i); - type = m_results.GetValueAt(i); - } - _ATLCATCHALL() - { - return false; - } - return true; - } - return false; - } - - DWORD m_dwFlags; -protected: - CSimpleMap m_results; - bool m_bFailures; -}; // CValidateContext - - - -class CAtlValidator -{ -public: - template - static DWORD Validate( - __in T value, - __in TCompType nMinValue, - __in TCompType nMaxValue) throw() - { - DWORD dwRet = VALIDATION_S_OK; - if (value < static_cast(nMinValue)) - dwRet = VALIDATION_E_LENGTHMIN; - else if (value > static_cast(nMaxValue)) - dwRet = VALIDATION_E_LENGTHMAX; - return dwRet; - } - - static DWORD Validate( __in LPCSTR pszValue, __in int nMinChars, __in int nMaxChars) throw() - { - DWORD dwRet = VALIDATION_S_OK; - if(!pszValue) - { - return VALIDATION_E_FAIL; - } - int nChars = (int) strlen(pszValue); - if (nChars < nMinChars) - dwRet = VALIDATION_E_LENGTHMIN; - else if (nChars > nMaxChars) - dwRet = VALIDATION_E_LENGTHMAX; - return dwRet; - } - static DWORD Validate( __in double dblValue, __in double dblMinValue, __in double dblMaxValue) throw() - { - DWORD dwRet = VALIDATION_S_OK; - if ( dblValue < (dblMinValue - ATL_EPSILON) ) - dwRet = VALIDATION_E_LENGTHMIN; - else if ( dblValue > (dblMaxValue + ATL_EPSILON) ) - dwRet = VALIDATION_E_LENGTHMAX; - return dwRet; - } -}; - -// This class provides functions for retrieving and validating named values. -// -// The named values are expected to be provided in string form by the class used as -// the template parameter. CValidateObject provides the means of -// retrieving these values converted to data types chosen by you. You can validate the values -// by specifying a range for numeric values or by specifying a minimum and maximum length -// for string values. -// -// Call one of the Exchange overloads to retrieve a named value converted to your chosen data type. -// Call one of the Validate overloads to retrieve a named value converted to your chosen data type -// and validated against a minimum and maximum value or length supplied by you. -// -// To add validation functionality to the class TLookupClass, derive that class from CValidateObject -// and provide a Lookup function that takes a name as a string and returns the corresponding value -// also as a string: -// LPCSTR Lookup(LPCSTR szName); -template -class CValidateObject -{ -public: - // Exchange Routines - - // Call this function to retrieve a named value converted to your chosen data type. - // Returns one of the following validation status codes: - // VALIDATION_S_OK The named value was found and could be converted successfully - // VALIDATION_S_EMPTY The name was present, but the value was empty - // VALIDATION_E_PARAMNOTFOUND The named value was not found - // VALIDATION_E_INVALIDPARAM The name was present, but the value could not be converted to the requested data type - // VALIDATION_E_FAIL An unspecified error occurred - // Pass a pointer to a validation context object if you want to add - // failures to the collection managed by that object. - template - ATL_NOINLINE __checkReturn DWORD Exchange( - __in LPCSTR szParam, - __out T* pValue, - __inout_opt CValidateContext *pContext = NULL) const throw() - { - DWORD dwRet = VALIDATION_E_PARAMNOTFOUND; - if (pValue) - { - _ATLTRY - { - const TLookupClass *pT = static_cast(this); - LPCSTR szValue = pT->Lookup(szParam); - if (szValue) - { - if (*szValue=='\0') - dwRet = VALIDATION_S_EMPTY; - else - { - dwRet = ConvertNumber(szValue, pValue); - } - } - } - _ATLCATCHALL() - { - return VALIDATION_E_FAIL; - } - } - else - dwRet = VALIDATION_E_FAIL; // invalid input - - if (pContext) - pContext->AddResult(szParam, dwRet); - return dwRet; - } - - template<> - ATL_NOINLINE __checkReturn DWORD Exchange( - __in LPCSTR szParam, - __out_opt CString* pstrValue, - __in_opt CValidateContext *pContext) const throw() - { - _ATLTRY - { - LPCSTR pszValue = NULL; - DWORD dwRet = VALIDATION_E_PARAMNOTFOUND; - if (pstrValue) - { - dwRet = Exchange(szParam, &pszValue, pContext); - if (VALIDATION_SUCCEEDED(dwRet) && pstrValue != NULL) - *pstrValue = CA2T(pszValue); - } - else - { - dwRet = VALIDATION_E_FAIL; // invalid input - if (pContext) - pContext->AddResult(szParam, dwRet); - } - - return dwRet; - } - _ATLCATCHALL() - { - return VALIDATION_E_FAIL; - } - } - - template<> - ATL_NOINLINE __checkReturn DWORD Exchange( - __in LPCSTR szParam, - __deref_out_opt LPCSTR* ppszValue, - __inout_opt CValidateContext *pContext) const throw() - { - DWORD dwRet = VALIDATION_E_PARAMNOTFOUND; - if (ppszValue) - { - _ATLTRY - { - *ppszValue = NULL; - const TLookupClass *pT = static_cast(this); - LPCSTR szValue = pT->Lookup(szParam); - if (szValue) - { - if (*szValue=='\0') - dwRet = VALIDATION_S_EMPTY; - else - { - *ppszValue = szValue; - dwRet = VALIDATION_S_OK; - } - } - } - _ATLCATCHALL() - { - return VALIDATION_E_FAIL; - } - } - else - dwRet = VALIDATION_E_FAIL; // invalid input - - if (pContext) - pContext->AddResult(szParam, dwRet); - return dwRet; - } - - template<> - ATL_NOINLINE __checkReturn DWORD Exchange( - __in LPCSTR szParam, - __out GUID* pValue, - __inout_opt CValidateContext *pContext) const throw() - { - DWORD dwRet = VALIDATION_E_PARAMNOTFOUND; - if (pValue) - { - _ATLTRY - { - const TLookupClass *pT = static_cast(this); - LPCSTR szValue = pT->Lookup(szParam); - if (szValue) - { - if (*szValue=='\0') - dwRet = VALIDATION_S_EMPTY; - else - { - if (S_OK != CLSIDFromString(CA2W(szValue), pValue)) - { - dwRet = VALIDATION_E_INVALIDPARAM; - } - else - dwRet = VALIDATION_S_OK; - } - } - } - _ATLCATCHALL() - { - return VALIDATION_E_FAIL; - } - } - else - dwRet = VALIDATION_E_FAIL; // invalid input - - if (pContext) - pContext->AddResult(szParam, dwRet); - return dwRet; - } - - template<> - ATL_NOINLINE __checkReturn DWORD Exchange( - __in LPCSTR szParam, - __out bool* pbValue, - __inout_opt CValidateContext *pContext) const throw() - { - DWORD dwRet = VALIDATION_S_OK; - if (pbValue) - { - _ATLTRY - { - const TLookupClass *pT = static_cast(this); - LPCSTR szValue = pT->Lookup(szParam); - *pbValue = false; - if (szValue) - { - if (*szValue != '\0') - *pbValue = true; - } - } - _ATLCATCHALL() - { - return VALIDATION_E_FAIL; - } - } - else - dwRet = VALIDATION_E_FAIL; // invalid input - - if (pContext) - pContext->AddResult(szParam, dwRet); - - return dwRet; - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out ULONGLONG *pnVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pnVal); - if (!pnVal) - return VALIDATION_E_FAIL; - char *pEnd = NULL; - ULONGLONG n = 0; - errno_t errnoValue = AtlStrToNum(&n, szVal, &pEnd, 10); - if (pEnd == szVal || errnoValue == ERANGE) - { - return VALIDATION_E_INVALIDPARAM; - } - *pnVal = n; - return VALIDATION_S_OK; - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out LONGLONG *pnVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pnVal); - if (!pnVal) - return VALIDATION_E_FAIL; - char *pEnd = NULL; - LONGLONG n = 0; - errno_t errnoValue = AtlStrToNum(&n, szVal, &pEnd, 10); - if (pEnd == szVal || errnoValue == ERANGE) - { - return VALIDATION_E_INVALIDPARAM; - } - *pnVal = n; - return VALIDATION_S_OK; - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out double *pdblVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pdblVal); - if (!pdblVal) - return VALIDATION_E_FAIL; - char *pEnd = NULL; - double d = 0.0; - errno_t errnoValue = AtlStrToNum(&d, szVal, &pEnd); - if (pEnd == szVal || errnoValue == ERANGE) - { - return VALIDATION_E_INVALIDPARAM; - } - *pdblVal = d; - return VALIDATION_S_OK; - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out int *pnVal) const throw() - { - return ConvertNumber(szVal, (long*)pnVal); - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out unsigned int *pnVal) const throw() - { - return ConvertNumber(szVal, (unsigned long*)pnVal); - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out long *pnVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pnVal); - if (!pnVal) - return VALIDATION_E_FAIL; - char *pEnd = NULL; - long n = 0; - errno_t errnoValue = AtlStrToNum(&n, szVal, &pEnd, 10); - if (pEnd == szVal || errnoValue == ERANGE) - { - return VALIDATION_E_INVALIDPARAM; - } - *pnVal = n; - return VALIDATION_S_OK; - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out unsigned long *pnVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pnVal); - if (!pnVal) - return VALIDATION_E_FAIL; - char *pEnd = NULL; - unsigned long n = 0; - errno_t errnoValue = AtlStrToNum(&n, szVal, &pEnd, 10); - if (pEnd == szVal || errnoValue == ERANGE) - { - return VALIDATION_E_INVALIDPARAM; - } - *pnVal = n; - return VALIDATION_S_OK; - } - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out short *pnVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pnVal); - if (!pnVal) - return VALIDATION_E_FAIL; - long nVal = 0; - DWORD dwRet = ConvertNumber(szVal, &nVal); - if (dwRet == VALIDATION_S_OK) - { - // clamp to the size of a short - if(nVal <= SHRT_MAX && - nVal >= SHRT_MIN) - { - *pnVal = (short)nVal; - } - else - { - dwRet = VALIDATION_E_INVALIDPARAM; - } - } - return dwRet; - }; - - __checkReturn DWORD ConvertNumber(__in LPCSTR szVal, __out unsigned short *pnVal) const throw() - { - if (!szVal) - return VALIDATION_E_FAIL; - - ATLASSERT(pnVal); - if (!pnVal) - return VALIDATION_E_FAIL; - unsigned long nVal = 0; - DWORD dwRet = ConvertNumber(szVal, &nVal); - if (dwRet == VALIDATION_S_OK) - { - // clamp to the size of a short - if(nVal <= USHRT_MAX && - nVal >= 0) - { - *pnVal = (unsigned short)nVal; - } - else - { - dwRet = VALIDATION_E_INVALIDPARAM; - } - } - return dwRet; - }; - - // Call this function to retrieve a named value converted to your chosen data type - // and validated against a minimum and maximum value or length supplied by you. - // - // Returns one of the following validation status codes: - // VALIDATION_S_OK The named value was found and could be converted successfully - // VALIDATION_S_EMPTY The name was present, but the value was empty - // VALIDATION_E_PARAMNOTFOUND The named value was not found - // VALIDATION_E_INVALIDPARAM The name was present, but the value could not be converted to the requested data type - // VALIDATION_E_LENGTHMIN The name was present and could be converted to the requested data type, but the value was too small - // VALIDATION_E_LENGTHMAX The name was present and could be converted to the requested data type, but the value was too large - // VALIDATION_E_FAIL An unspecified error occurred - // - // Validate can be used to convert and validate name-value pairs - // such as those associated with HTTP requests (query string, form fields, or cookie values). - // The numeric specializations validate the minimum and maximum value. - // The string specializations validate the minimum and maximum length. - // - // Pass a pointer to a validation context object if you want to add - // failures to the collection managed by that object. - // - // Note that you can validate the value of a parameter without - // storing its value by passing NULL for the second parameter. However - // if you pass NULL for the second parameter, make sure you cast the NULL to a - // type so that the compiler will call the correct specialization of Validate. - template - ATL_NOINLINE __checkReturn DWORD Validate( - __in LPCSTR Param, - __out_opt T *pValue, - __in TCompType nMinValue, - __in TCompType nMaxValue, - __inout_opt CValidateContext *pContext = NULL) const throw() - { - T value; - DWORD dwRet = Exchange(Param, &value, pContext); - if ( dwRet == VALIDATION_S_OK ) - { - if (pValue) - *pValue = value; - dwRet = TValidator::Validate(value, nMinValue, nMaxValue); - if (pContext && dwRet != VALIDATION_S_OK) - pContext->AddResult(Param, dwRet); - } - else if (dwRet == VALIDATION_S_EMPTY && - !IsNullByType(nMinValue)) - { - dwRet = VALIDATION_E_LENGTHMIN; - if (pContext) - { - pContext->SetResultAt(Param, VALIDATION_E_LENGTHMIN); - } - } - - return dwRet; - } - - // Specialization for strings. Comparison is for number of characters. - template<> - ATL_NOINLINE __checkReturn DWORD Validate( - __in LPCSTR Param, - __deref_opt_out LPCSTR* ppszValue, - __in int nMinChars, - __in int nMaxChars, - __inout_opt CValidateContext *pContext) const throw() - { - LPCSTR pszValue = NULL; - DWORD dwRet = Exchange(Param, &pszValue, pContext); - if (dwRet == VALIDATION_S_OK ) - { - if (ppszValue) - *ppszValue = pszValue; - dwRet = TValidator::Validate(pszValue, nMinChars, nMaxChars); - if (pContext && dwRet != VALIDATION_S_OK) - pContext->AddResult(Param, dwRet); - } - else if (dwRet == VALIDATION_S_EMPTY && - nMinChars > 0) - { - dwRet = VALIDATION_E_LENGTHMIN; - if (pContext) - { - pContext->SetResultAt(Param, VALIDATION_E_LENGTHMIN); - } - } - - - return dwRet; - } - - // Specialization for CString so caller doesn't have to cast CString - template<> - ATL_NOINLINE __checkReturn DWORD Validate( - __in LPCSTR Param, - __out_opt CString* pstrValue, - __in int nMinChars, - __in int nMaxChars, - __inout_opt CValidateContext *pContext) const throw() - { - _ATLTRY - { - LPCSTR szValue; - DWORD dwRet = Validate(Param, &szValue, nMinChars, nMaxChars, pContext); - if (pstrValue && dwRet == VALIDATION_S_OK ) - *pstrValue = szValue; - return dwRet; - } - _ATLCATCHALL() - { - return VALIDATION_E_FAIL; - } - } - - // Specialization for doubles, uses a different comparison. - template<> - ATL_NOINLINE __checkReturn DWORD Validate( - __in LPCSTR Param, - __out_opt double* pdblValue, - __in double dblMinValue, - __in double dblMaxValue, - __inout_opt CValidateContext *pContext) const throw() - { - double dblValue; - DWORD dwRet = Exchange(Param, &dblValue, pContext); - if (dwRet == VALIDATION_S_OK) - { - if (pdblValue) - *pdblValue = dblValue; - dwRet = TValidator::Validate(dblValue, dblMinValue, dblMaxValue); - if (pContext && dwRet != VALIDATION_S_OK) - pContext->AddResult(Param, dwRet); - } - else if (dwRet == VALIDATION_S_EMPTY && - (dblMinValue < -ATL_EPSILON || - dblMinValue > ATL_EPSILON)) - { - dwRet = VALIDATION_E_LENGTHMIN; - if (pContext) - { - pContext->SetResultAt(Param, VALIDATION_E_LENGTHMIN); - } - } - return dwRet; - } -}; - -// Cookies provide a way for a server to store a small amount of data on a client -// and have that data returned to it on each request the client makes. -// Use this class to represent a cookie to be sent from the server to a client -// or to represent a cookie that has been returned by a client to the originating server. -// -// At the HTTP level, a cookie is an application-defined name-value pair -// plus some standard attribute-value pairs that describe the way in which the user agent (web browser) -// should interact with the cookie. The HTTP format of a cookie is described in RFC 2109. -// -// The CCookie class provides methods to set and get the application-defined name and value -// as well as methods for the standard attributes. In addition, CCookie provides an abstraction -// on top of the application-defined value that allows it to be treated as a collection of name-value -// pairs if that model makes sense to you. Cookies with a single value are known as single-valued cookies. -// Cookies whose value consists of name-value pairs are known as multi-valued cookies or dictionary cookies. -// -// You can set the name of a cookie by calling SetName or using the appropriate constructor. -// The name of a cookie can be 0 or more characters. -// -// You can set the value of a cookie by calling SetValue or using the appropriate constructor. -// If the cookie has a value set, it is a single-valued cookie and attempts to add a name-value pair will fail. -// You can remove the value of a cookie by calling SetValue(NULL). -// -// You can add a name-value pair to a cookie by calling AddValue. -// If the cookie has any name-value pairs, it is a multi-valued cookie and attempts to set the primary value will fail. -// You can remove all the name-value pairs of a cookie by calling RemoveAllValues. -// -// Class CCookie follows the same rules for creating cookies as ASP does. -class CCookie : - public CValidateObject -{ - typedef CAtlMap, - CStringElementTraits > mapType; - - const static DWORD ATLS_MAX_HTTP_DATE = 64; - -public: - // Constructs a named cookie. - CCookie(__in LPCSTR szName) throw(...) - { - ATLENSURE(SetName(szName)); - } - - // Constructs a single-valued cookie. - CCookie(__in LPCSTR szName, __in_opt LPCSTR szValue) throw(...) - { - ATLENSURE(SetName(szName)); - ATLENSURE(SetValue(szValue)); - } - - CCookie(__in const CCookie& thatCookie) throw(...) - { - Copy(thatCookie); - } - - CCookie& operator=(__in const CCookie& thatCookie) throw(...) - { - if(this!=&thatCookie) - { - return Copy(thatCookie); - } - return *this; - } - - CCookie() throw() - { - - } - - __checkReturn BOOL IsEmpty() const throw() - { - return m_strName.IsEmpty(); - } - - // Call this function to set the name of this cookie. - // Returns TRUE on success, FALSE on failure. - // The name of a cookie cannot contain whitespace, semicolons or commas. - // The name should not begin with a dollar sign ($) since such names are reserved for future use. - __checkReturn BOOL SetName(__in LPCSTR szName) throw() - { - _ATLTRY - { - if (szName && *szName) - { - m_strName = szName; - return TRUE; - } - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to retrieve the name of this cookie. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL GetName(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) const throw() - { - return CopyCString(m_strName, szBuff, pdwSize); - } - - // Call this function to retrieve the name of this cookie. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL GetName(__out CStringA &strName) const throw() - { - _ATLTRY - { - strName = m_strName; - return TRUE; - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to set the value of this cookie. - // Returns TRUE on success, FALSE on failure. - // Will fail if the cookie is multi-valued. - // Pass NULL to remove the cookie's value. - __checkReturn BOOL SetValue(__in_opt LPCSTR szValue) throw() - { - _ATLTRY - { - if (m_Values.GetCount()) - return FALSE; //already dictionary values in the cookie - - if (!szValue) - m_strValue.Empty(); - else - m_strValue = szValue; - - return TRUE; - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to retrieve the value of this cookie. - // Returns TRUE on success, FALSE on failure. - // Returns TRUE if there is no value or the value is of zero length. - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetValue(__out_ecount(*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) const throw() - { - return CopyCString(m_strValue, szBuff, pdwSize); - } - - // Call this function to retrieve the value of this cookie. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL GetValue(__out CStringA &strValue) const throw() - { - _ATLTRY - { - strValue = m_strValue; - return TRUE; - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to add a name-value pair to the cookie. - // Returns TRUE on success, FALSE on failure. - // Will fail if the cookie is single-valued. - // If the named value is already present in the cookie, calling this function - // will modify the current value, otherwise a new name-value pair is added to the cookie. - // Call RemoveValue or RemoveAllValues to remove the name-value pairs - // added by this function. - __checkReturn BOOL AddValue(__in LPCSTR szName, __in_opt LPCSTR szValue) throw() - { - if (m_strValue.GetLength()) - return FALSE; - _ATLTRY - { - return m_Values.SetAt(szName, szValue) != NULL; - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to modify a name-value pair associated with the cookie. - // Returns TRUE on success, FALSE on failure. - // Will fail if the cookie is single-valued. - // This function just calls AddValue so the name-value pair will be added if not already present. - // Use this function instead of AddValue to document the intentions of your call. - __checkReturn BOOL ModifyValue(__in LPCSTR szName, __in LPCSTR szValue) throw() - { - return AddValue(szName, szValue); - } - - // Call this function to remove a name-value pair from the collection managed by this cookie. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL RemoveValue(__in LPCSTR szName) throw() - { - return m_Values.RemoveKey(szName); - } - - // Call this function to remove all the name-value pairs from the collection managed by this cookie. - void RemoveAllValues() throw() - { - m_Values.RemoveAll(); - } - - // Call this function to add an attribute-value pair to the collection of attributes for this cookie. - // Returns TRUE on success, FALSE on failure. - // This function is equivalent to calling ModifyAttribute. - // Both functions will add the attribute if not already present or - // change its value if it has already been applied to the cookie. - __checkReturn BOOL AddAttribute(__in LPCSTR szName, __in LPCSTR szValue) throw() - { - if (!szName || !*szName || !szValue) - return FALSE; - - _ATLTRY - { - return (m_Attributes.SetAt(szName, szValue) != NULL); - } - _ATLCATCHALL() - { - } - return FALSE; - - } - - // Call this function to modify an attribute-value pair associated with the cookie. - // Returns TRUE on success, FALSE on failure. - // This function is equivalent to calling AddAttribute. - // Both functions will add the attribute if not already present or - // change its value if it has already been applied to the cookie. - __checkReturn BOOL ModifyAttribute(__in LPCSTR szName, __in LPCSTR szValue) throw() - { - return AddAttribute(szName, szValue); - } - - // Call this function to remove an attribute-value pair from the collection of attributes managed by this cookie. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL RemoveAttribute(__in LPCSTR szName) throw() - { - return m_Attributes.RemoveKey(szName); - } - - // Call this function to remove all the attribute-value pairs from the collection of attributes managed by this cookie. - void RemoveAllAttributes() throw() - { - m_Attributes.RemoveAll(); - } - - - // Call this function to set the Comment attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Comment attribute allows a web server to document its - // intended use of a cookie. This information may be displayed - // by supporting browsers so that the user of the web site can - // decide whether to initiate or continue a session with this cookie. - // This attribute is optional. - // Version 1 attribute. - __checkReturn BOOL SetComment(__in LPCSTR szComment) throw() - { - BOOL bRet = SetVersion(1); - if (bRet) - bRet = AddAttribute("comment", szComment); - return bRet; - } - - // Call this function to set the CommentUrl attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The CommentUrl attribute allows a web server to document its intended - // use of a cookie via a URL that the user of the web site can navigate to. - // The URL specified here should not send further cookies to the client to - // avoid frustrating the user. - // This attribute is optional. - // Version 1 attribute. - __checkReturn BOOL SetCommentUrl(__in LPCSTR szUrl) throw() - { - BOOL bRet = SetVersion(1); - if (bRet) - bRet = AddAttribute("commenturl", szUrl); - return bRet; - } - - // Call this function to add or remove the Discard attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Discard attribute does not have a value. - // Call SetDiscard(TRUE) to add the Discard attribute - // or SetDiscard(FALSE) to remove the Discard attribute. - // Setting the Discard attribute tells a web browser that it should - // discard this cookie when the browser exits regardless of the - // value of the Max-Age attribute. - // This attribute is optional. - // When omitted, the default behavior is that the Max-Age attribute - // controls the lifetime of the cookie. - // Version 1 attribute. - __checkReturn BOOL SetDiscard(__in BOOL bDiscard) throw() - { - BOOL bRet = FALSE; - LPCSTR szKey = "Discard"; - bRet = SetVersion(1); - if (bRet) - { - if (bDiscard == 0) - { - bRet = m_Attributes.RemoveKey(szKey); - } - else - { - _ATLTRY - { - bRet = m_Attributes.SetAt(szKey, " ") != 0; - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - } - return bRet; - } - - // Call this function to set the Domain attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Domain attribute is used to indicate the domain to which the current - // cookie applies. Browsers should only send cookies back to the relevant domains. - // This attribute is optional. - // When omitted, the default behavior is for - // browsers to use the full domain of the server originating the cookie. You can - // set this attribute value explicitly if you want to share cookies among several servers. - // Version 0 & Version 1 attribute. - __checkReturn BOOL SetDomain(__in LPCSTR szDomain) throw() - { - BOOL bRet = SetVersion(1); - if (bRet) - bRet = AddAttribute("domain", szDomain); - return bRet; - } - - // Call this function to set the Max-Age attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The value of the Max-Age attribute is a lifetime in seconds for the cookie. - // When the time has expired, compliant browsers will discard this cookie - // (if they haven't already done so as a result of the Discard attribute). - // If Max-Age is set to zero, the browser discards the cookie immediately. - // This attribute is the Version 1 replacement for the Expires attribute. - // This attribute is optional. - // When omitted, the default behavior is for browsers to discard cookies - // when the user closes the browser. - // Version 1 attribute. - __checkReturn BOOL SetMaxAge(__in UINT nMaxAge) throw() - { - BOOL bRet = FALSE; - bRet = SetVersion(1); - if (bRet) - { - CHAR buff[20]; - if (0 == _itoa_s(nMaxAge, buff, _countof(buff), 10)) - { - bRet = AddAttribute("max-age", buff); - } - } - return bRet; - } - - // Call this function to set the Path attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Path attribute specifies the subset of URLs to which this cookie applies. - // Only URLs that contain that path are allowed to read or modify the cookie. - // This attribute is optional. - // When omitted the default behavior is for browsers to treat the path of a cookie - // as the path of the request URL that generated the Set-Cookie response, up to, - // but not including, the right-most /. - // Version 0 & Version 1 attribute. - __checkReturn BOOL SetPath(__in LPCSTR szPath) throw() - { - BOOL bRet = SetVersion(1); - if (bRet) - bRet = AddAttribute("path", szPath); - return bRet; - } - - // Call this function to set the Port attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Port attribute specifies the port to which this cookie applies. - // Only URLs accessed via that port are allowed to read or modify the cookie. - // This attribute is optional. - // When omitted the default behavior is for browsers to return the cookie via any port. - // Version 1 attribute. - __checkReturn BOOL SetPort(__in LPCSTR szPort) throw() - { - BOOL bRet = SetVersion(1); - if (bRet) - bRet = AddAttribute("port", szPort); - return bRet; - } - - // Call this function to add or remove the Secure attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Secure attribute does not have a value. - // Call SetSecure(TRUE) to add the Secure attribute - // or SetSecure(FALSE) to remove the Secure attribute. - // Setting the Secure attribute tells a browser that it should - // transmit the cookie to the web server only via secure means such as HTTPS. - // This attribute is optional. - // When omitted, the default behavior is that the cookie - // will be sent via unsecured protocols. - // Version 0 & Version 1 attribute. - __checkReturn BOOL SetSecure(__in BOOL bSecure) throw() - { - BOOL bRet = FALSE; - LPCSTR szKey = "secure"; - bRet = SetVersion(1); - if (bRet) - { - if (bSecure == 0) - { - bRet = m_Attributes.RemoveKey(szKey); - } - else - { - _ATLTRY - { - bRet = m_Attributes.SetAt(szKey, " ") != 0; - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - } - return bRet; - } - - // Call this function to set the Version attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // This attribute is required for Version 1 cookies by RFC 2109 and must have a value of 1. - // However, you do not need to call SetVersion explicitly from your own code unless you need to - // force RFC 2109 compliance. CCookie will automatically set this attribute whenever - // you use a Version 1 attribute in your cookie. - // Version 1 attribute. - __checkReturn BOOL SetVersion(__in UINT nVersion) throw() - { - BOOL bRet = FALSE; - CHAR buff[20]; - if (0 == _itoa_s(nVersion, buff, _countof(buff), 10)) - { - bRet = AddAttribute("version", buff); - } - return bRet; - } - - // Call this function to set the Expires attribute of the cookie. - // Returns TRUE on success, FALSE on failure. - // The Expires attribute specifies an absolute date and time at which this cookie - // should be discarded by web browsers. Pass a SYSTEMTIME holding a Greenwich Mean Time (GMT) - // value or a string in the following format: - // Wdy, DD-Mon-YY HH:MM:SS GMT - // This attribute is optional. - // When omitted, the default behavior is for browsers to discard cookies - // when the user closes the browser. - // This attribute has been superceded in Version 1 by the Max-Age attribute, - // but you should continue to use this attribute for Version 0 clients. - // Version 0 attribute. - __checkReturn BOOL SetExpires(__in LPCSTR szExpires) throw() - { - return AddAttribute("expires", szExpires); - } - - __checkReturn BOOL SetExpires(__in const SYSTEMTIME &st) throw() - { - _ATLTRY - { - CFixedStringT strTime; - SystemTimeToHttpDate(st, strTime); - return SetExpires(strTime); - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to look up the value of a name-value pair applied to this cookie. - // Returns the requested value if present or NULL if the name was not found. - __checkReturn LPCSTR Lookup(__in_opt LPCSTR szName=NULL) const throw() - { - if (IsEmpty()) - return NULL; - - if (m_strValue.GetLength()) - { - ATLASSERT(szName == NULL); - return m_strValue; - } - - if (m_Values.GetCount()) - { - ATLENSURE_RETURN_VAL(szName, NULL); - const mapType::CPair *pPair = NULL; - ATLTRY(pPair = m_Values.Lookup(szName)); - if (pPair) - return (LPCSTR)pPair->m_value; - } - - return NULL; - } - - // Call this function to clear the cookie of all content - // including name, value, name-value pairs, and attributes. - void Empty() throw() - { - m_strName.Empty(); - m_strValue.Empty(); - m_Attributes.RemoveAll(); - m_Values.RemoveAll(); - } - - // Call this function to create a CCookie from a buffer. - // The passed in buffer contains a cookie header retrieved - // from the HTTP_COOKIE request variable - bool ParseValue(__in const char *pstart) - { - ATLASSERT(pstart); - if (!pstart || *pstart == '\0') - return false; - - // could be just a value or could be an array of name=value pairs - LPCSTR pEnd = pstart; - LPCSTR pStart = pstart; - CStringA name, value; - - while (*pEnd != '\0') - { - while (*pEnd && *pEnd != '=' && *pEnd != '&') - pEnd++; - - if (*pEnd == '\0' || *pEnd == '&') - { - if (pEnd > pStart) - CopyToCString(value, pStart, pEnd); - SetValue(value); - if (*pEnd == '&') - { - pEnd++; - pStart = pEnd; - continue; - } - return true; // we're done; - } - else if (*pEnd == '=' ) - { - // we have name=value - if (pEnd > pStart) - { - CopyToCString(name, pStart, pEnd); - } - else - { - pEnd++; - pStart = pEnd; - break; - } - - // skip '=' and go for value - pEnd++; - pStart = pEnd; - while (*pEnd && *pEnd != '&' && *pEnd != '=') - pEnd++; - if (pEnd > pStart) - CopyToCString(value, pStart, pEnd); - - ATLENSURE(AddValue(name, value)); - - if (*pEnd != '\0') - pEnd++; - pStart = pEnd; - - } - } - - return true; - } - - // Call this function to render this cookie - // into a buffer. Returns TRUE on success, FALSE on failure. - // On entry, pdwLen should point to a DWORD that indicates - // the size of the buffer in bytes. On exit, the DWORD contains - // the number of bytes transferred or available to be transferred - // into the buffer (including the nul-terminating byte). On - // success, the buffer will contain the correct HTTP - // representation of the current cookie suitable for sending to - // a client as the body of a Set-Cookie header. - __success(return==true) ATL_NOINLINE __checkReturn BOOL Render(__out_ecount_part_opt(*pdwLen,*pdwLen) LPSTR szCookieBuffer, __inout DWORD *pdwLen) const throw() - { - if (!pdwLen) - return FALSE; - CStringA strCookie; - CStringA name, value; - DWORD dwLenBuff = *pdwLen; - *pdwLen = 0; - - // A cookie must have a name! - if (!m_strName.GetLength()) - { - *pdwLen = 0; - return FALSE; - } - _ATLTRY - { - strCookie = m_strName; - int nValSize = (int) m_Values.GetCount(); - if (nValSize) - { - strCookie += '='; - POSITION pos = m_Values.GetStartPosition(); - for (int i=0; pos; i++) - { - m_Values.GetNextAssoc(pos, name, value); - strCookie += name; - if (value.GetLength()) - { - strCookie += '='; - strCookie += value; - } - if (i <= nValSize-2) - strCookie += '&'; - } - } - else - { - strCookie += '='; - if (m_strValue.GetLength()) - strCookie += m_strValue; - } - - CStringA strAttributes; - if (!RenderAttributes(strAttributes)) - return FALSE; - if (strAttributes.GetLength() > 0) - { - strCookie += "; "; - strCookie += strAttributes; - } - - DWORD dwLenCookie = strCookie.GetLength() + 1; - *pdwLen = dwLenCookie; - if (!szCookieBuffer) - return TRUE; // caller just wanted the length - - // see if buffer is big enough - if (dwLenCookie > dwLenBuff) - return FALSE; //buffer wasn't big enough - - // copy the buffer - Checked::strcpy_s(szCookieBuffer, *pdwLen, strCookie); - } - _ATLCATCHALL() - { - return FALSE; - } - return TRUE; - } - - POSITION GetFirstAttributePos() const throw() - { - return m_Attributes.GetStartPosition(); - } - - const CStringA& GetNextAttributeName(__inout POSITION& pos) const throw() - { - return m_Attributes.GetNextKey(pos); - } - - const CStringA& GetAttributeValueAt(__in POSITION pos) const throw() - { - return m_Attributes.GetValueAt(pos); - } - - BOOL GetNextAttrAssoc(__inout POSITION& pos, __out CStringA& key, - __out CStringA& val) const throw() - { - _ATLTRY - { - m_Attributes.GetNextAssoc(pos, key, val); - } - _ATLCATCHALL() - { - return FALSE; - } - return TRUE; - } - - POSITION GetFirstValuePos() const throw() - { - return m_Values.GetStartPosition(); - } - - const CStringA& GetNextValueName(__inout POSITION& pos) const throw() - { - return m_Values.GetNextKey(pos); - } - - const CStringA& GetValueAt(__in POSITION pos) const throw() - { - return m_Values.GetValueAt(pos); - } - - BOOL GetNextValueAssoc(__inout POSITION& pos, __out CStringA& key, - __out CStringA& val) const throw() - { - _ATLTRY - { - m_Values.GetNextAssoc(pos, key, val); - } - _ATLCATCHALL() - { - return FALSE; - } - return TRUE; - } - -protected: -// Implementation - BOOL RenderAttributes(__out CStringA& strAttributes) const throw() - { - _ATLTRY - { - strAttributes.Empty(); - - POSITION pos = m_Attributes.GetStartPosition(); - CStringA key, val; - for (int i=0; pos; i++) - { - if (i) - strAttributes += ";"; - m_Attributes.GetNextAssoc(pos, key, val); - strAttributes += key; - strAttributes += '='; - strAttributes += val; - } - } - _ATLCATCHALL() - { - return FALSE; - } - return TRUE; - } -private: - CCookie& Copy(__in const CCookie& thatCookie) throw(...) - { - m_strName = thatCookie.m_strName; - m_strValue = thatCookie.m_strValue; - POSITION pos = NULL; - CStringA strName, strValue; - if (!thatCookie.m_Attributes.IsEmpty()) - { - pos = thatCookie.m_Attributes.GetStartPosition(); - while (pos) - { - thatCookie.m_Attributes.GetNextAssoc(pos, strName, strValue); - m_Attributes.SetAt(strName, strValue); - } - } - if (!thatCookie.m_Values.IsEmpty()) - { - strName.Empty(); - strValue.Empty(); - pos = thatCookie.m_Values.GetStartPosition(); - while (pos) - { - thatCookie.m_Values.GetNextAssoc(pos, strName, strValue); - m_Values.SetAt(strName, strValue); - } - } - return *this; - } - - // Call this function to copy a substring to a CString reference and ensure nul-termination. - void CopyToCString(__out CStringA& string, __in_ecount(pEnd-pStart) LPCSTR pStart, __in LPCSTR pEnd) throw( ... ) - { - ATLENSURE( pStart != NULL ); - ATLENSURE( pEnd != NULL ); - - string.SetString(pStart, (int)(pEnd-pStart)); - string.Trim(); - } - - -public: - // These are implementation only, use at your own risk! - // Map of attribute-value pairs applied to this cookie. - mapType m_Attributes; - - // Map of name-value pairs applied to this cookie. - mapType m_Values; - - // The name of this cookie. - CStringA m_strName; - - // The value of this cookie. - CStringA m_strValue; - -}; // class CCookie - -class CSessionCookie : public CCookie -{ -public: - CSessionCookie() throw(...) - { - if (!SetName(SESSION_COOKIE_NAME) || - !SetPath("/")) - AtlThrow(E_OUTOFMEMORY); - } - - CSessionCookie(LPCSTR szSessionID) throw(...) - { - if (!SetName(SESSION_COOKIE_NAME) || - !SetPath("/") || - !SetSessionID(szSessionID) ) - AtlThrow(E_OUTOFMEMORY); - } - - BOOL SetSessionID(LPCSTR szSessionID) throw() - { - ATLASSERT(szSessionID && szSessionID[0]); - return SetValue(szSessionID); - } -}; // class CSessionCookie - -template<> -class CElementTraits< CCookie > : - public CElementTraitsBase< CCookie > -{ -public: - typedef const CCookie& INARGTYPE; - typedef CCookie& OUTARGTYPE; - - static ULONG Hash( __in INARGTYPE cookie ) - { - return CStringElementTraits::Hash( cookie.m_strName ); - } - - static bool CompareElements( __in INARGTYPE cookie1, __in INARGTYPE cookie2 ) - { - return( cookie1.m_strName == cookie2.m_strName ); - } - - static int CompareElementsOrdered( __in INARGTYPE cookie1, __in INARGTYPE cookie2 ) - { - return( cookie1.m_strName.Compare( cookie2.m_strName ) ); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Request and response classes and support functions - - -// This class is a wrapper for CAtlMap that allows maps to be chained. -// It simply adds a bool that tells whether or not a map shares values -template , typename VTraits=CElementTraits > -class CHttpMap -{ -private: - -#ifdef ATL_HTTP_PARAM_MULTIMAP - typedef CRBMultiMap MAPTYPE; -#else - typedef CAtlMap MAPTYPE; -#endif // ATL_HTTP_PARAM_MULTIMAP - -public: - - typedef typename KTraits::INARGTYPE KINARGTYPE; - typedef typename KTraits::OUTARGTYPE KOUTARGTYPE; - typedef typename VTraits::INARGTYPE VINARGTYPE; - typedef typename VTraits::OUTARGTYPE VOUTARGTYPE; - - typedef typename MAPTYPE::CPair CPair; - -private: - - bool m_bShared; - - MAPTYPE m_map; - -public: - - CHttpMap() throw() - : m_bShared(false) - { - } - - virtual ~CHttpMap() - { - } - - inline bool IsShared() const throw() - { - return m_bShared; - } - - inline void SetShared(__in bool bShared) throw() - { - m_bShared = bShared; - } - - // - // exposed lookup and iteration functionality - // - - inline size_t GetCount() const throw() - { - return m_map.GetCount(); - } - - inline bool IsEmpty() const throw() - { - return m_map.IsEmpty(); - } - - inline POSITION GetStartPosition() const throw() - { -#ifdef ATL_HTTP_PARAM_MULTIMAP - return m_map.GetHeadPosition(); -#else - return m_map.GetStartPosition(); -#endif // ATL_HTTP_PARAM_MULTIMAP - } - - // Lookup wrappers - bool Lookup( __in KINARGTYPE key, __out VOUTARGTYPE value ) const throw() - { - _ATLTRY - { -#ifdef ATL_HTTP_PARAM_MULTIMAP - CPair *p = Lookup(key); - if (p != NULL) - { - value = p->m_value; - return true; - } - return false; -#else - return m_map.Lookup(key, value); -#endif // ATL_HTTP_PARAM_MULTIMAP - } - _ATLCATCHALL() - { - return false; - } - } - - const CPair* Lookup( __in KINARGTYPE key ) const throw() - { -#ifdef ATL_HTTP_PARAM_MULTIMAP - POSITION pos = m_map.FindFirstWithKey(key); - if (pos != NULL) - { - return m_map.GetAt(pos); - } - return NULL; -#else - return m_map.Lookup(key); -#endif // ATL_HTTP_PARAM_MULTIMAP - } - - CPair* Lookup( __in KINARGTYPE key ) throw() - { -#ifdef ATL_HTTP_PARAM_MULTIMAP - POSITION pos = m_map.FindFirstWithKey(key); - if (pos != NULL) - { - return m_map.GetAt(pos); - } - return NULL; -#else - return m_map.Lookup(key); -#endif // ATL_HTTP_PARAM_MULTIMAP - } - - // iteration wrappers - void GetNextAssoc( __inout POSITION& pos, __out KOUTARGTYPE key, __out VOUTARGTYPE value ) const throw(...) - { - m_map.GetNextAssoc(pos, key, value); - } - - const CPair* GetNext( __inout POSITION& pos ) const throw() - { - return m_map.GetNext(pos); - } - - CPair* GetNext( __inout POSITION& pos ) throw() - { - return m_map.GetNext(pos); - } - - const K& GetNextKey( __inout POSITION& pos ) const throw() - { - return m_map.GetNextKey(pos); - } - - const V& GetNextValue( __inout POSITION& pos ) const throw() - { - return m_map.GetNextValue(pos); - } - - V& GetNextValue( __inout POSITION& pos ) throw() - { - return m_map.GetNextValue(pos); - } - - void GetAt( __in POSITION pos, __out KOUTARGTYPE key, __out VOUTARGTYPE value ) const throw(...) - { - return m_map.GetAt(pos, key, value); - } - - CPair* GetAt( __in POSITION pos ) throw() - { - return m_map.GetAt(pos); - } - - const CPair* GetAt( __in POSITION pos ) const throw() - { - return m_map.GetAt(pos); - } - - const K& GetKeyAt( __in POSITION pos ) const throw() - { - return m_map.GetKeyAt(pos); - } - - const V& GetValueAt( __in POSITION pos ) const throw() - { - return m_map.GetValueAt(pos); - } - - V& GetValueAt( __in POSITION pos ) throw() - { - return m_map.GetValueAt(pos); - } - - // modification wrappers - POSITION SetAt( __in KINARGTYPE key, __in_opt VINARGTYPE value ) throw(...) - { -#ifdef ATL_HTTP_PARAM_MULTIMAP - return m_map.Insert(key, value); -#else - return m_map.SetAt(key, value); -#endif // ATL_HTTP_PARAM_MULTIMAP - } - - bool RemoveKey( __in KINARGTYPE key ) throw() - { -#ifdef ATL_HTTP_PARAM_MULTIMAP - return (m_map.RemoveKey(key) != 0); -#else - return m_map.RemoveKey(key); -#endif // ATL_HTTP_PARAM_MULTIMAP - } - - virtual void RemoveAll() - { - m_map.RemoveAll(); - } -}; - -// This class is a wrapper for CHttpMap that assumes it's values are pointers that -// should be deleted on RemoveAll -template , typename VTraits=CElementTraits > -class CHttpPtrMap : public CHttpMap -{ -public: - typedef CHttpMap Base; - - void RemoveAll() - { - if (!IsShared()) - { - POSITION pos = GetStartPosition(); - while (pos) - { - GetNextValue(pos)->Free(); - } - } - Base::RemoveAll(); - } - - ~CHttpPtrMap() - { - RemoveAll(); - } -}; - -// This class represents a collection of request parameters - the name-value pairs -// found, for example, in a query string or in the data provided when a form is submitted to the server. -// Call Parse to build the collection from a string of URL-encoded data. -// Use the standard collection methods of the CHttpMap base class to retrieve the -// decoded names and values. -// Use the methods of the CValidateObject base class to validate the parameters. -class CHttpRequestParams : -#if (defined(ATL_HTTP_PARAM_MAP_CASEINSENSITIVE)) - public CHttpMap, CStringElementTraitsI >, -#else - public CHttpMap, CStringElementTraits >, -#endif - public CValidateObject -{ -public: -#if (defined(ATL_HTTP_PARAM_MAP_CASEINSENSITIVE)) - typedef CHttpMap, CStringElementTraitsI > BaseMap; -#else - typedef CHttpMap, CStringElementTraits > BaseMap; -#endif - - LPCSTR Lookup(__in LPCSTR szName) const throw() - { - _ATLTRY - { - if (!szName) - return NULL; - - const CPair *p = BaseMap::Lookup(szName); - if (p) - { - return p->m_value; - } - } - _ATLCATCHALL() - { - } - return NULL; - } - - // Call this function to build a collection of name-value pairs from a string of URL-encoded data. - // Returns TRUE on success, FALSE on failure. - // URL-encoded data: - // Each name-value pair is separated from the next by an ampersand (&) - // Each name is separated from its corresponding value by an equals signs (=) - // The end of the data to be parsed is indicated by a nul character (\0) or a pound symbol (#) - // A plus sign (+) in the input will be decoded as a space - // A percent sign (%) in the input signifies the start of an escaped octet. - // The next two digits represent the hexadecimal code of the character. - // For example, %21 is the escaped encoding for the US-ASCII exclamation mark and will be decoded as !. - // Common sources of URL-encoded data are query strings and the bodies of POST requests with content type of application/x-www-form-urlencoded. - // - // Parse and Render are complementary operations. - // Parse creates a collection from a string. - // Render creates a string from a collection. - ATL_NOINLINE __checkReturn BOOL Parse(__inout LPSTR szQueryString) throw() - { - while (szQueryString && *szQueryString) - { - LPSTR szUrlCurrent = szQueryString; - LPSTR szName = szUrlCurrent; - LPSTR szPropValue; - - while (*szQueryString) - { - if (*szQueryString == '=') - { - szQueryString++; - break; - } - if (*szQueryString == '&') - { - break; - } - if (*szQueryString == '+') - *szUrlCurrent = ' '; - else if (*szQueryString == '%') - { - // if there is a % without two characters - // at the end of the url we skip it - if (*(szQueryString+1) && *(szQueryString+2)) - { - short nFirstDigit = AtlHexValue(szQueryString[1]); - short nSecondDigit = AtlHexValue(szQueryString[2]); - - if( nFirstDigit < 0 || nSecondDigit < 0 ) - { - break; - } - *szUrlCurrent = static_cast(16*nFirstDigit+nSecondDigit); - szQueryString += 2; - } - else - *szUrlCurrent = '\0'; - } - else - *szUrlCurrent = *szQueryString; - - szQueryString++; - szUrlCurrent++; - } - - if (*szUrlCurrent == '&') - { - *szUrlCurrent++ = '\0'; - szQueryString++; - szPropValue = ""; - } - else - { - if (*szUrlCurrent) - *szUrlCurrent++ = '\0'; - - // we have the property name - szPropValue = szUrlCurrent; - while (*szQueryString && *szQueryString != '#') - { - if (*szQueryString == '&') - { - szQueryString++; - break; - } - if (*szQueryString == '+') - *szUrlCurrent = ' '; - else if (*szQueryString == '%') - { - // if there is a % without two characters - // at the end of the url we skip it - if (*(szQueryString+1) && *(szQueryString+2)) - { - short nFirstDigit = AtlHexValue(szQueryString[1]); - short nSecondDigit = AtlHexValue(szQueryString[2]); - - if( nFirstDigit < 0 || nSecondDigit < 0 ) - { - break; - } - *szUrlCurrent = static_cast(16*nFirstDigit+nSecondDigit); - szQueryString += 2; - } - else - *szUrlCurrent = '\0'; - } - else - *szUrlCurrent = *szQueryString; - szQueryString++; - szUrlCurrent++; - } - // we have the value - *szUrlCurrent = '\0'; - szUrlCurrent++; - } - - _ATLTRY - { - SetAt(szName, szPropValue); - } - _ATLCATCHALL() - { - return FALSE; - } - } - return TRUE; - } - - // Call this function to render the map of names and values into a buffer as a URL-encoded string. - // Returns TRUE on success, FALSE on failure. - // On entry, pdwLen should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - // On success, the buffer will contain the correct URL-encoded representation of the current object - // suitable for sending to a server as a query string or in the body of a form. - // URL-encoding: - // Each name-value pair is separated from the next by an ampersand (&) - // Each name is separated from its corresponding value by an equals signs (=) - // A space is encoded as a plus sign (+). - // Other unsafe characters (as determined by AtlIsUnsafeUrlChar) are encoded as escaped octets. - // An escaped octet is a percent sign (%) followed by two digits representing the hexadecimal code of the character. - // - // Parse and Render are complementary operations. - // Parse creates a collection from a string. - // Render creates a string from a collection. - ATL_NOINLINE __checkReturn BOOL Render(__out_ecount(pdwLen) LPSTR szParameters, __inout LPDWORD pdwLen) - { - ATLENSURE(szParameters); - ATLENSURE(pdwLen); - _ATLTRY - { - if (GetCount() == 0) - { - *szParameters = '\0'; - *pdwLen = 0; - return TRUE; - } - - CStringA strParams; - POSITION pos = GetStartPosition(); - while (pos != NULL) - { - LPCSTR szBuf = GetKeyAt(pos); - EscapeToCString(strParams, szBuf); - szBuf = GetValueAt(pos); - if (*szBuf) - { - strParams+= '='; - EscapeToCString(strParams, szBuf); - } - strParams+= '&'; - GetNext(pos); - } - - DWORD dwLen = strParams.GetLength(); - strParams.Delete(dwLen-1); - BOOL bRet = TRUE; - if (dwLen > *pdwLen) - { - bRet = FALSE; - } - else - { - dwLen--; - Checked::memcpy_s(szParameters, *pdwLen, static_cast(strParams), dwLen); - szParameters[dwLen] = '\0'; - } - - *pdwLen = dwLen; - return bRet; - } - _ATLCATCHALL() - { - return FALSE; - } - } - -}; // class CHttpRequestParams - -#ifndef MAX_TOKEN_LENGTH -#define MAX_TOKEN_LENGTH (MAX_PATH) -#endif - -// This class represents the information about a file that has been uploaded to the web server. -class CHttpRequestFile : public IHttpFile -{ -private: - - // The name of the form field used to upload the file. - CHAR m_szParamName[MAX_TOKEN_LENGTH]; - - // The original file name of the uploaded file as set by the client. - CHAR m_szFileName[MAX_PATH]; - - // The original path and file name of the uploaded file as set by the client. - CHAR m_szFullFileName[MAX_PATH]; - - // The MIME type of the uploaded file. - CHAR m_szContentType[MAX_TOKEN_LENGTH]; - - // The name of the uploaded file on the server. - CHAR m_szTempFileName[MAX_PATH]; - - // The size of the file in bytes. - ULONGLONG m_nFileSize; - -public: - - CHttpRequestFile() throw() - { - *m_szParamName = '\0'; - *m_szFileName = '\0'; - *m_szFullFileName = '\0'; - *m_szContentType = '\0'; - m_nFileSize = 0; - } - - __checkReturn BOOL Initialize( - __in_opt LPCSTR pParamName, - __in LPCSTR pFileName, - __in_opt LPCSTR pTempFileName, - __in_opt LPCSTR pContentType, - __in const ULONGLONG &nFileSize) - { - ATLENSURE( pFileName != NULL ); - - if (!SafeStringCopy(m_szFullFileName, pFileName)) - { - // path too long - return FALSE; - } - - if (pParamName && *pParamName) - { - if (!SafeStringCopy(m_szParamName, pParamName)) - { - // string too long - return FALSE; - } - } - - if (pTempFileName && *pTempFileName) - { - if (!SafeStringCopy(m_szTempFileName, pTempFileName)) - { - // path too long - return FALSE; - } - } - - if (pContentType && *pContentType) - { - if (!SafeStringCopy(m_szContentType, pContentType)) - { - // string too long - return FALSE; - } - } - - // Set m_szFileName to be the file name without the path. - // This is likely to be the most meaningful part of the - // original file name once the file reaches the server. - - LPSTR szTmp = m_szFullFileName; - LPSTR szFile = m_szFileName; - LPSTR pszLastCharFileBuf=m_szFileName + _countof(m_szFileName) - 1; - while (*szTmp) - { - if (*szTmp == '\\') - { - szFile = m_szFileName; - } - else - { - if (szFile > pszLastCharFileBuf) - { - return FALSE; - } - *szFile++ = *szTmp; - } - szTmp++; - } - if (szFile > pszLastCharFileBuf) - { - return FALSE; - } - *szFile = 0; - - m_nFileSize = nFileSize; - return TRUE; - } - - - //======================================= - // IHttpFile interface - //======================================= - __checkReturn LPCSTR GetParamName() - { - return m_szParamName; - } - - __checkReturn LPCSTR GetFileName() - { - return m_szFileName; - } - - __checkReturn LPCSTR GetFullFileName() - { - return m_szFullFileName; - } - - __checkReturn LPCSTR GetContentType() - { - return m_szContentType; - } - - __checkReturn LPCSTR GetTempFileName() - { - return m_szTempFileName; - } - - __checkReturn ULONGLONG GetFileSize() - { - return m_nFileSize; - } - - void Free() - { - delete this; - } - -}; // class CHttpRequestFile - - -// utility function to ReadData from a ServerContext -ATL_NOINLINE inline -__checkReturn BOOL ReadClientData(__inout IHttpServerContext *pServerContext, __out_ecount_part(*pdwLen,*pdwLen) LPSTR pbDest, __inout LPDWORD pdwLen, __in DWORD dwBytesRead) -{ - ATLENSURE(pServerContext != NULL); - ATLENSURE(pdwLen != NULL); - ATLENSURE(pbDest != NULL); - - _ATLTRY - { - DWORD dwToRead = *pdwLen; - DWORD dwAvailableBytes = pServerContext->GetAvailableBytes(); - DWORD dwRead(0); - - // Read from available data first - if (dwBytesRead < dwAvailableBytes) - { - LPBYTE pbAvailableData = pServerContext->GetAvailableData(); - pbAvailableData+= dwBytesRead; - DWORD dwAvailableToRead = __min(dwToRead, dwAvailableBytes-dwBytesRead); - Checked::memcpy_s(pbDest, *pdwLen, pbAvailableData, dwAvailableToRead); - dwBytesRead+= dwAvailableToRead; - dwToRead-= dwAvailableToRead; - pbDest+= dwAvailableToRead; - dwRead+= dwAvailableToRead; - } - - DWORD dwTotalBytes = pServerContext->GetTotalBytes(); - - // If there is still more to read after the available data is exhausted - if (dwToRead && dwBytesRead < dwTotalBytes) - { - DWORD dwClientBytesToRead = __min(pServerContext->GetTotalBytes()-dwBytesRead, dwToRead); - DWORD dwClientBytesRead = 0; - - // keep on reading until we've read the amount requested - do - { - dwClientBytesRead = dwClientBytesToRead; - if (!pServerContext->ReadClient(pbDest, &dwClientBytesRead)) - { - return FALSE; - } - dwClientBytesToRead-= dwClientBytesRead; - dwRead+= dwClientBytesRead; - pbDest+= dwClientBytesRead; - - } while (dwClientBytesToRead != 0 && dwClientBytesRead != 0); - - - } - - *pdwLen = dwRead; - } - _ATLCATCHALL() - { - return FALSE; - } - - return TRUE; -} - -#ifndef MAX_MIME_BOUNDARY_LEN - #define MAX_MIME_BOUNDARY_LEN 128 -#endif - -enum ATL_FORM_FLAGS -{ - ATL_FORM_FLAG_NONE = 0, - ATL_FORM_FLAG_IGNORE_FILES = 1, - ATL_FORM_FLAG_REFUSE_FILES = 2, - ATL_FORM_FLAG_IGNORE_EMPTY_FILES = 4, - ATL_FORM_FLAG_IGNORE_EMPTY_FIELDS = 8, -}; - -// Use this class to read multipart/form-data from the associated server context -// and generate files as necessary from the data in the body of the request. -class CMultiPartFormParser -{ -protected: - - LPSTR m_pCurrent; - LPSTR m_pEnd; - LPSTR m_pStart; - CHAR m_szBoundary[MAX_MIME_BOUNDARY_LEN+2]; - DWORD m_dwBoundaryLen; - BOOL m_bFinished; - CComPtr m_spServerContext; - -public: - - typedef CHttpMap > FILEMAPTYPE; - - CMultiPartFormParser(__in IHttpServerContext* pServerContext) throw() : - m_pCurrent(NULL), - m_pEnd(NULL), - m_pStart(NULL), - m_dwBoundaryLen(0), - m_bFinished(FALSE), - m_spServerContext(pServerContext) - { - *m_szBoundary = '\0'; - } - - ~CMultiPartFormParser() throw() - { - _ATLTRY - { - // free memory if necessary - if (m_spServerContext->GetTotalBytes() > m_spServerContext->GetAvailableBytes()) - { - free(m_pStart); - } - } - _ATLCATCHALL() - { - } - } - - // Call this function to read multipart/form-data from the current HTTP request, - // allowing files to be uploaded to the web server. - // - // Returns TRUE on success, FALSE on failure. - // - // Forms can be sent to a web server using one of two encodings: application/x-www-form-urlencoded or multipart/form-data. - // In addition to the simple name-value pairs typically associated with - // application/x-www-form-urlencoded form data, multipart/form-data (as - // described in RFC 2388) can also contain files to be uploaded - // to the web server. - // - // This function will generate a physical file for each file contained in the multipart/form-data request body. - // The generated files are stored in the server's temporary directory as returned by the - // GetTempPath API and are named using the GetTempFileName API. - // The information about each file can be obtained from the elements of the Files array. - // You can retrieve the original name of the file on the client, the name of the generated file on the server, - // the MIME content type of the uploaded file, the name of the form field associated with that file, and the size in - // bytes of the file. All this information is exposed by the CHttpRequestFile objects in the array. - // - // In addition to generating files and populating the Files array with information about them, - // this function also populates the pQueryParams array with the names and values of the other form fields - // contained in the current request. The file fields are also added to this array. The value of these fields - // is the full name of the generated file on the server. - // - // Note that files can be generated even if this function returns FALSE unless you specify either the - // ATL_FORM_FLAG_IGNORE_FILES or the ATL_FORM_FLAG_REFUSE_FILES flag. If you don't specify one of these - // flags, you should always check the Files array for generated files and delete any that are no longer - // needed to prevent your web server from running out of disk space. - // - // dwFlags can be a combination of one or more of the following values: - // ATL_FORM_FLAG_NONE Default behavior. - // ATL_FORM_FLAG_IGNORE_FILES Any attempt to upload files is ignored. - // ATL_FORM_FLAG_REFUSE_FILES Any attempt to upload files is treated as a failure. The function will return FALSE. - // ATL_FORM_FLAG_IGNORE_EMPTY_FILES Files with a size of zero bytes are ignored. - // ATL_FORM_FLAG_IGNORE_EMPTY_FIELDS Fields with no content are ignored. - ATL_NOINLINE BOOL GetMultiPartData( - __inout FILEMAPTYPE& Files, - __inout CHttpRequestParams* pQueryParams, - __in DWORD dwFlags=ATL_FORM_FLAG_NONE) throw() - { - _ATLTRY - { - if (!InitializeParser()) - { - return FALSE; - } - - //Get to the first boundary - if (!ReadUntilBoundary()) - { - return FALSE; - } - - CStringA strParamName; - CStringA strFileName; - CStringA strContentType; - CStringA strData; - BOOL bFound; - - while (!m_bFinished) - { - // look for "name" field - if (!GetMimeData(strParamName, "name=", sizeof("name=")-1, &bFound, TRUE) || !bFound) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed Form-Data")); - return FALSE; - } - - // see if it's a file - if (!GetMimeData(strFileName, "filename=", sizeof("filename=")-1, &bFound, TRUE)) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed Form-Data")); - return FALSE; - } - - if (bFound) - { - if (dwFlags & ATL_FORM_FLAG_REFUSE_FILES) - { - return FALSE; - } - - if (!strFileName.GetLength()) - { - if(!ReadUntilBoundary()) - { - return FALSE; - } - continue; - } - - if (!GetMimeData(strContentType, "Content-Type:", sizeof("Content-Type:")-1, &bFound, TRUE)) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed Form-Data")); - return FALSE; - } - - // move to the actual uploaded data - if (!MoveToData()) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed Form-Data")); - return FALSE; - } - - // if the user doesn't want files, don't save the file - if (dwFlags & ATL_FORM_FLAG_IGNORE_FILES) - { - if (!ReadUntilBoundary(NULL, NULL)) - { - return FALSE; - } - continue; - } - - CAtlTemporaryFile ctf; - HRESULT hr = ctf.Create(); - if (hr != S_OK) - return FALSE; - - if (!ReadUntilBoundary(NULL, &ctf)) - { - ctf.Close(); - return FALSE; - } - ULONGLONG nFileSize = 0; - if (ctf.GetSize(nFileSize) != S_OK) - return FALSE; - - if ((dwFlags & ATL_FORM_FLAG_IGNORE_EMPTY_FILES) && nFileSize == 0) - { - ctf.Close(); - continue; - } - - CAutoPtr spFile; - - CT2AEX szTempFileNameA(ctf.TempFileName()); - - ATLTRY(spFile.Attach(new CHttpRequestFile())); - if (!spFile) - { - return FALSE; - } - - if (!spFile->Initialize(strParamName, strFileName, szTempFileNameA, strContentType, nFileSize)) - { - // one of the strings was too long - return FALSE; - } - - if (!Files.SetAt(szTempFileNameA, spFile)) - { - return FALSE; - } - - spFile.Detach(); - - if (!pQueryParams || !pQueryParams->SetAt(strParamName, szTempFileNameA)) - { - return FALSE; - } - - ctf.HandsOff(); - - continue; - } - - // move to the actual uploaded data - if (!MoveToData()) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed Form-Data")); - return FALSE; - } - - if (!ReadUntilBoundary(&strData)) - { - return FALSE; - } - - if ((dwFlags & ATL_FORM_FLAG_IGNORE_EMPTY_FIELDS) && strData.GetLength() == 0) - continue; - - if (!pQueryParams || !pQueryParams->SetAt(strParamName, strData)) - { - return FALSE; - } - - } - - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - -private: - - // implementation - - // case insensitive substring search -- does not handle multibyte characters (unlike tolower) - // allows searching up to a maximum point in a string - inline char AtlCharLower(__in char ch) throw() - { - if (ch > 64 && ch < 91) - { - return ch+32; - } - - return ch; - } - - inline __checkReturn char * _stristr (__in const char * str1, __in const char * str2) - { - ATLENSURE(str1!=NULL); - ATLENSURE(str2!=NULL); - char *cp = (char *) str1; - char *s1, *s2; - - if ( !*str2 ) - return((char *)str1); - - while (*cp) - { - s1 = cp; - s2 = (char *) str2; - - while ( *s1 && *s2 && !(AtlCharLower(*s1)-AtlCharLower(*s2)) ) - { - s1++, s2++; - } - - if (!*s2) - { - return(cp); - } - - cp++; - } - - return(NULL); - } - - - inline __checkReturn char * _stristrex (__in const char * str1, __in const char * str2, __in const char * str1End) - { - ATLENSURE(str1!=NULL); - ATLENSURE(str2!=NULL); - char *cp = (char *) str1; - char *s1, *s2; - - if ( !*str2 ) - return((char *)str1); - - while (cp != str1End) - { - s1 = cp; - s2 = (char *) str2; - - while ( s1 != str1End && *s2 && !(AtlCharLower(*s1)-AtlCharLower(*s2)) ) - { - s1++, s2++; - } - - if (!*s2) - { - return (cp); - } - - if (s1 == str1End) - { - return (NULL); - } - - cp++; - } - - return(NULL); - } - - inline __checkReturn char * _strstrex (__in const char * str1, __in const char * str2, __in const char * str1End) - { - ATLENSURE(str1!=NULL); - ATLENSURE(str2!=NULL); - char *cp = (char *) str1; - char *s1, *s2; - - if ( !*str2 ) - return((char *)str1); - - while (cp != str1End) - { - s1 = cp; - s2 = (char *) str2; - - while ( s1 != str1End && *s2 && !((*s1)-(*s2)) ) - { - s1++, s2++; - } - - if (!*s2) - { - return (cp); - } - - if (s1 == str1End) - { - return (NULL); - } - - cp++; - } - - return(NULL); - } - - ATL_NOINLINE __checkReturn BOOL InitializeParser() throw() - { - ATLASSUME( m_spServerContext != NULL ); - - _ATLTRY - { - DWORD dwBytesTotal = m_spServerContext->GetTotalBytes(); - - // if greater than bytes available, allocate necessary space - if (dwBytesTotal > m_spServerContext->GetAvailableBytes()) - { - m_pStart = (LPSTR) malloc(dwBytesTotal); - if (!m_pStart) - { - return FALSE; - } - m_pCurrent = m_pStart; - DWORD dwLen = dwBytesTotal; - if (!ReadClientData(m_spServerContext, m_pStart, &dwLen, 0) || dwLen != dwBytesTotal) - { - return FALSE; - } - } - else - { - m_pStart = (LPSTR) m_spServerContext->GetAvailableData(); - } - - m_pCurrent = m_pStart; - m_pEnd = m_pCurrent + dwBytesTotal; - - //get the boundary - LPCSTR pszContentType = m_spServerContext->GetContentType(); - ATLASSERT(pszContentType != NULL); - - LPCSTR pszTmp = _stristr(pszContentType, "boundary="); - if (!pszTmp) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed Form-Data")); - return FALSE; - } - - pszTmp += sizeof("boundary=")-1; - BOOL bInQuote = FALSE; - if (*pszTmp == '\"') - { - bInQuote = TRUE; - pszTmp++; - } - - LPSTR pszMimeBoundary = m_szBoundary; - *pszMimeBoundary++ = '-'; - *pszMimeBoundary++ = '-'; - m_dwBoundaryLen = 2; - while (*pszTmp && (bInQuote || IsStandardBoundaryChar(*pszTmp))) - { - if (m_dwBoundaryLen >= MAX_MIME_BOUNDARY_LEN) - { - ATLTRACE(atlTraceISAPI, 0, _T("Malformed MIME boundary")); - return FALSE; - } - - if (*pszTmp == '\r' || *pszTmp == '\n') - { - if (bInQuote) - { - pszTmp++; - continue; - } - break; - } - if (bInQuote && *pszTmp == '"') - { - break; - } - - *pszMimeBoundary++ = *pszTmp++; - m_dwBoundaryLen++; - } - - *pszMimeBoundary = '\0'; - } - _ATLCATCHALL() - { - return FALSE; - } - - return TRUE; - } - - inline __checkReturn BOOL MoveToData() throw() - { - LPSTR szEnd = _strstrex(m_pCurrent, "\r\n\r\n", m_pEnd); - if (!szEnd) - { - return FALSE; - } - - m_pCurrent = szEnd+4; - if (m_pCurrent >= m_pEnd) - { - return FALSE; - } - - return TRUE; - } - - inline __checkReturn BOOL GetMimeData(__inout CStringA &str, __in_ecount(dwFieldLen) LPCSTR szField, __in DWORD dwFieldLen, __out LPBOOL pbFound, __in BOOL bIgnoreCase = FALSE) throw() - { - _ATLTRY - { - ATLASSERT( szField != NULL ); - ATLENSURE( pbFound != NULL ); - - *pbFound = FALSE; - - LPSTR szEnd = _strstrex(m_pCurrent, "\r\n\r\n", m_pEnd); - if (!szEnd) - { - return FALSE; - } - - LPSTR szDataStart = NULL; - - if (!bIgnoreCase) - { - szDataStart = _strstrex(m_pCurrent, szField, szEnd); - } - else - { - szDataStart = _stristrex(m_pCurrent, szField, szEnd); - } - - if (szDataStart) - { - szDataStart+= dwFieldLen; - if (szDataStart >= m_pEnd) - { - return FALSE; - } - - BOOL bInQuote = FALSE; - if (*szDataStart == '\"') - { - bInQuote = TRUE; - szDataStart++; - } - - LPSTR szDataEnd = szDataStart; - while (!bInQuote && (szDataEnd < m_pEnd) && (*szDataEnd == ' ' || *szDataEnd == '\t')) - { - szDataEnd++; - } - - if (szDataEnd >= m_pEnd) - { - return FALSE; - } - - while (szDataEnd < m_pEnd) - { - if (!IsValidTokenChar(*szDataEnd)) - { - if (*szDataEnd == '\"' || !bInQuote) - { - break; - } - } - szDataEnd++; - } - - if (szDataEnd >= m_pEnd) - { - return FALSE; - } - - str.SetString(szDataStart, (int)(szDataEnd-szDataStart)); - *pbFound = TRUE; - } - - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - ATL_NOINLINE __checkReturn BOOL ReadUntilBoundary(__inout_opt CStringA* pStrData=NULL, __inout_opt CAtlTemporaryFile* pCtf=NULL) throw() - { - _ATLTRY - { - LPSTR szBoundaryStart = m_pCurrent; - LPSTR szBoundaryEnd = NULL; - - do - { - szBoundaryStart = _strstrex(szBoundaryStart, m_szBoundary, m_pEnd); - if (szBoundaryStart) - { - if ((szBoundaryStart-m_pStart) >= 2) - { - if (*(szBoundaryStart-1) != 0x0a || *(szBoundaryStart-2) != 0x0d) - { - szBoundaryStart++; - continue; - } - } - szBoundaryEnd = szBoundaryStart+m_dwBoundaryLen; - if (szBoundaryEnd+2 >= m_pEnd) - { - return FALSE; - } - if (szBoundaryEnd[0] == '\r' && szBoundaryEnd[1] == '\n') - { - break; - } - if (szBoundaryEnd[0] == '-' && szBoundaryEnd[1] == '-') - { - m_bFinished = TRUE; - break; - } - szBoundaryStart++; - } - } while (szBoundaryStart && szBoundaryStart < m_pEnd); - - if (!szBoundaryStart || szBoundaryStart >= m_pEnd) - { - return FALSE; - } - - if ((szBoundaryStart-m_pStart) >= 2) - { - szBoundaryStart-= 2; - } - if (pStrData) - { - pStrData->SetString(m_pCurrent, (int)(szBoundaryStart-m_pCurrent)); - } - if (pCtf) - { - if (FAILED(pCtf->Write(m_pCurrent, (DWORD)(szBoundaryStart-m_pCurrent)))) - { - return FALSE; - } - } - - if (!m_bFinished) - { - m_pCurrent = szBoundaryEnd+2; - if (m_pCurrent >= m_pEnd) - { - return FALSE; - } - } - - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - static inline __checkReturn BOOL IsStandardBoundaryChar(__in CHAR ch) throw() - { - if ( (ch >= 'A' && ch <= 'Z') || - (ch >= 'a' && ch <= 'z') || - (ch >= '0' && ch <= '9') || - (ch == '\'') || - (ch == '+') || - (ch == '_') || - (ch == '-') || - (ch == '=') || - (ch == '?') ) - { - return TRUE; - } - - return FALSE; - } - - inline __checkReturn BOOL IsValidTokenChar(__in CHAR ch) throw() - { - return ( (ch != 0) && (ch != 0xd) && (ch != 0xa) && (ch != ' ') && (ch != '\"') ); - } - -private: - // Prevents copying. - CMultiPartFormParser(__in const CMultiPartFormParser& /*that*/) throw() - { - ATLASSERT(FALSE); - } - - const CMultiPartFormParser& operator=(__in const CMultiPartFormParser& /*that*/) throw() - { - ATLASSERT(FALSE); - return (*this); - } -}; // class CMultiPartFormParser - - -// 48K max form size -#ifndef DEFAULT_MAX_FORM_SIZE -#define DEFAULT_MAX_FORM_SIZE 49152 -#endif - -// This class provides access to the information contained in an HTTP request submitted to a web server. -// -// CHttpRequest provides access to the query string parameters, form fields, cookies, and files -// that make up an HTTP request, as well as many other important properties of the request. -class CHttpRequest : public IHttpRequestLookup -{ -protected: - // Implementation: Array used to map an HTTP request method (for example, "GET" or "POST") - // from a string to a numeric constant from the HTTP_METHOD enum (HTTP_METHOD_GET or HTTP_METHOD_HEAD). - static const char* const m_szMethodStrings[]; - - // Implementation: The server context. - CComPtr m_spServerContext; - - // Implementation: The number of bytes read from the body of the request. - DWORD m_dwBytesRead; - - // Implementation: TRUE if the request method was POST and the encoding was - // multipart/form-data, FALSE otherwise. - BOOL m_bMultiPart; - - CCookie m_EmptyCookie; - - // Implementation: Constructor function used to reinitialize all data members. - void Construct() throw() - { - m_spServerContext.Release(); - m_bMultiPart = FALSE; - m_dwBytesRead = 0; - if (m_pFormVars != &m_QueryParams) - delete m_pFormVars; - - m_pFormVars = NULL; - m_pFormVars = &m_QueryParams; - m_QueryParams.RemoveAll(); - m_QueryParams.SetShared(false); - - ClearFilesAndCookies(); - } - - void ClearFilesAndCookies() throw() - { - m_Files.RemoveAll(); - m_Files.SetShared(false); - m_requestCookies.RemoveAll(); - m_requestCookies.SetShared(false); - } - -public: - - // Implementation: The collection of query parameters (name-value pairs) obtained from the query string. - CHttpRequestParams m_QueryParams; - - // Implementation: The collection of form fields (name-value pairs). - // The elements of this collection are obtained from the query string for a GET request, - // or from the body of the request for a POST request. - CHttpRequestParams *m_pFormVars; - - // The array of CHttpRequestFiles obtained from the current request. - // See CHttpRequest::Initialize and CMultiPartFormParser::GetMultiPartData for more information. - typedef CHttpPtrMap > FileMap; - FileMap m_Files; - - // Implementation: The array of cookies obtained from the current request. - typedef CHttpMap > CookieMap; - CookieMap m_requestCookies; - - // Numeric constants for the HTTP request methods (such as GET and POST). - enum HTTP_METHOD - { - HTTP_METHOD_UNKNOWN=-1, - HTTP_METHOD_GET, - HTTP_METHOD_POST, - HTTP_METHOD_HEAD, - HTTP_METHOD_DELETE, - HTTP_METHOD_LINK, - HTTP_METHOD_UNLINK, - HTTP_METHOD_DEBUG // Debugging support for VS7 - }; - - // The collection of query parameters (name-value pairs) obtained from the query string. - // A read-only property. - __declspec(property(get=GetQueryParams)) const CHttpRequestParams& QueryParams; - - // Returns a reference to the collection of query parameters(name-value pairs) - // obtained from the query string. - const CHttpRequestParams& GetQueryParams() const throw() - { - return m_QueryParams; - } - - // The collection of form fields (name-value pairs). - // The elements of this collection are obtained from the query string for a GET request, - // or from the body of the request for a POST request. - // A read-only property. - __declspec(property(get=GetFormVars)) const CHttpRequestParams& FormVars; - - // Returns a reference to the collection of form fields (name-value pairs) - // obtained from the query string for a GET request, - // or from the body of the request for a POST request. - const CHttpRequestParams& GetFormVars() const throw() - { - return *m_pFormVars; - } - - CHttpRequest() throw() - { - m_bMultiPart = FALSE; - m_dwBytesRead = 0; - m_pFormVars = &m_QueryParams; - } - - virtual ~CHttpRequest() throw() - { - DeleteFiles(); - - if (m_pFormVars != &m_QueryParams) - { - delete m_pFormVars; - m_pFormVars = NULL; - } - } - - // Constructs and initializes the object. - CHttpRequest( - __in IHttpServerContext *pServerContext, - __in DWORD dwMaxFormSize=DEFAULT_MAX_FORM_SIZE, - __in DWORD dwFlags=ATL_FORM_FLAG_NONE) throw(...) - :m_pFormVars(NULL) - { - Construct(); - if (!Initialize(pServerContext, dwMaxFormSize, dwFlags)) - AtlThrow(E_FAIL); - } - - CHttpRequest(__in IHttpRequestLookup *pRequestLookup) throw(...) - :m_pFormVars(NULL) - { - if (!Initialize(pRequestLookup)) // Calls Construct for you - AtlThrow(E_FAIL); - } - - //========================================================================================= - // BEGIN IHttpRequestLoookup interface - //========================================================================================= - __success(return != NULL) __checkReturn POSITION GetFirstQueryParam(__deref_out LPCSTR *ppszName, __deref_out LPCSTR *ppszValue) - { - POSITION pos = m_QueryParams.GetStartPosition(); - if (pos != NULL) - { - ATLENSURE(ppszName != NULL); - ATLENSURE(ppszValue != NULL); - *ppszName = m_QueryParams.GetKeyAt(pos); - *ppszValue = m_QueryParams.GetValueAt(pos); - } - - return pos; - } - - __success(return != NULL) __checkReturn POSITION GetNextQueryParam(__in POSITION pos, __deref_out LPCSTR *ppszName, __deref_out LPCSTR *ppszValue) - { - ATLENSURE(pos != NULL); - - - POSITION posNext(pos); - m_QueryParams.GetNext(posNext); - if (posNext != NULL) - { - ATLENSURE(ppszName != NULL); - ATLENSURE(ppszValue != NULL); - *ppszName = m_QueryParams.GetKeyAt(posNext); - *ppszValue = m_QueryParams.GetValueAt(posNext); - } - - return posNext; - } - - __success(return != NULL) __checkReturn POSITION GetFirstFormVar(__deref_out LPCSTR *ppszName, __deref_out LPCSTR *ppszValue) - { - // if no form vars and just pointing to the query params, - // then return NULL - if (m_pFormVars == &m_QueryParams) - return NULL; - - POSITION pos = m_pFormVars->GetStartPosition(); - if (pos != NULL) - { - ATLENSURE(ppszName != NULL); - ATLENSURE(ppszValue != NULL); - *ppszName = m_pFormVars->GetKeyAt(pos); - *ppszValue = m_pFormVars->GetValueAt(pos); - } - - return pos; - } - - __success(return != NULL) __checkReturn POSITION GetNextFormVar(__in POSITION pos, __deref_out LPCSTR *ppszName, __deref_out LPCSTR *ppszValue) - { - ATLASSERT(pos != NULL); - ATLASSERT(ppszName != NULL); - ATLASSERT(ppszValue != NULL); - - POSITION posNext(pos); - m_pFormVars->GetNext(posNext); - if (posNext != NULL) - { - *ppszName = m_pFormVars->GetKeyAt(posNext); - *ppszValue = m_pFormVars->GetValueAt(posNext); - } - - return posNext; - } - - POSITION GetFirstFile(__in LPCSTR *ppszName, __deref_out IHttpFile **ppFile) - { - ATLASSERT(ppszName != NULL); - ATLASSERT(ppFile != NULL); - - POSITION pos = m_Files.GetStartPosition(); - if (pos != NULL) - { - *ppszName = m_Files.GetKeyAt(pos); - *ppFile = m_Files.GetValueAt(pos); - } - - return pos; - } - - __success(return != NULL) __checkReturn POSITION GetNextFile(__in POSITION pos, __deref_out LPCSTR *ppszName, __deref_out IHttpFile **ppFile) - { - ATLASSERT(pos != NULL); - ATLASSERT(ppszName != NULL); - ATLASSERT(ppFile != NULL); - - m_Files.GetNext(pos); - if (pos != NULL) - { - *ppszName = m_Files.GetKeyAt(pos); - *ppFile = m_Files.GetValueAt(pos); - } - - return pos; - } - - // Returns a pointer to the IHttpServerContext interface for the current request. - HRESULT GetServerContext(__deref_out_opt IHttpServerContext ** ppOut) - { - return m_spServerContext.CopyTo(ppOut); - } - //========================================================================================= - // END IHttpRequestLookup interface - //========================================================================================= - - __success(return != NULL) __checkReturn POSITION GetFirstCookie(__deref_out LPCSTR *ppszName, __deref_out const CCookie **ppCookie) throw() - { - ATLASSERT(ppszName != NULL); - ATLASSERT(ppCookie != NULL); - POSITION pos = NULL; - if (GetRequestCookies()) - { - pos = m_requestCookies.GetStartPosition(); - if (pos != NULL) - { - *ppszName = m_requestCookies.GetKeyAt(pos); - *ppCookie = &(m_requestCookies.GetValueAt(pos)); - } - } - return pos; - } - - __success(return != NULL) __checkReturn POSITION GetNextCookie(__in POSITION pos, __deref_out LPCSTR *ppszName, __deref_out const CCookie **ppCookie) throw() - { - ATLASSERT(pos != NULL); - ATLASSERT(ppszName != NULL); - ATLASSERT(ppCookie != NULL); - - POSITION posNext(pos); - m_requestCookies.GetNext(posNext); - if (posNext != NULL) - { - *ppszName = m_requestCookies.GetKeyAt(posNext); - *ppCookie = &(m_requestCookies.GetValueAt(posNext)); - } - return posNext; - } - - void SetServerContext(__in IHttpServerContext *pServerContext) throw() - { - m_spServerContext = pServerContext; - } - - BOOL Initialize(__in IHttpRequestLookup *pRequestLookup) throw() - { - _ATLTRY - { - ATLASSERT(pRequestLookup != NULL); - // if there's no pRequestLookup, just return - if (!pRequestLookup) - return TRUE; - - Construct(); - HRESULT hr = pRequestLookup->GetServerContext(&m_spServerContext); - if (FAILED(hr)) - return FALSE; - - LPCSTR szName(NULL); - LPCSTR szValue(NULL); - - // Initialize query params from the IHttpRequestLookup* - POSITION pos(pRequestLookup->GetFirstQueryParam(&szName, &szValue)); - while (pos != NULL) - { - m_QueryParams.SetAt(szName, szValue); - pos = pRequestLookup->GetNextQueryParam(pos, &szName, &szValue); - } - m_QueryParams.SetShared(true); - - // Initialize the form vars from the IHttpRequestLookup* - pos = pRequestLookup->GetFirstFormVar(&szName, &szValue); - if (pos) - { - m_pFormVars = NULL; - ATLTRY(m_pFormVars = new CHttpRequestParams); - if (!m_pFormVars) - return FALSE; - - while (pos != NULL) - { - m_pFormVars->SetAt(szName, szValue); - pos = pRequestLookup->GetNextFormVar(pos, &szName, &szValue); - } - m_pFormVars->SetShared(true); - } - else - { - m_pFormVars = &m_QueryParams; - } - - // Initialize the files from the IHttpRequestLookup* - IHttpFile *pFile(NULL); - pos = pRequestLookup->GetFirstFile(&szName, &pFile); - while (pos != NULL) - { - m_Files.SetAt(szName, pFile); - pos = pRequestLookup->GetNextFile(pos, &szName, &pFile); - } - m_Files.SetShared(true); - - // Initialzie the cookies form the IHttpRequestLookup* - BOOL bRet = FALSE; - CStringA strCookies; - bRet = GetCookies(strCookies); - if (bRet) - { - bRet = Parse(strCookies); - } - m_requestCookies.SetShared(false); - return bRet; - } // _ATLTRY - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to initialize the object with information about the current request. - // - // Returns TRUE on success, FALSE on failure. - // - // Call Initialize directly or via the appropriate constructor before using the methods and - // properties of the request object. - // - // Initialize does the following: - // - // Parses and decodes the query string into a collection of name-value pairs. - // This collection is accessible via the GetQueryParams method or the QueryParams property. - // - // Sets m_bMultiPart to TRUE if the request is a POST request with multipart/form-data encoding. - // - // Parses the body of a POST request if the size of the request data is less than or equal to dwMaxFormSize. - // The body of the request will consist of simple form fields and may also contain files if the request is encoded as multipart/form-data. - // In that case, the dwFlags parameter is passed to CMultiPartFormParser::GetMultiPartData to control the creation of the files. - // The collection of form fields is accessible via the GetFormVars method or the FormVars property. - // The collection of files is accessible via the m_Files member. - // - // Note that Initialize does not parse the cookies associated with a request. - // Cookies are not processed until an attempt is made to access a cookie in the collection. - BOOL Initialize( - __in IHttpServerContext *pServerContext, - __in DWORD dwMaxFormSize=DEFAULT_MAX_FORM_SIZE, - __in DWORD dwFlags=ATL_FORM_FLAG_NONE) throw() - { - _ATLTRY - { - ATLASSERT(pServerContext != NULL); - if (!pServerContext) - { - return FALSE; - } - - m_spServerContext = pServerContext; - - HTTP_METHOD httpMethod = GetMethod(); - LPCSTR pszQueryString = GetQueryString(); - if (pszQueryString && *pszQueryString) - { - // Parse the query string. - CHAR szQueryString[ATL_URL_MAX_URL_LENGTH]; - if (!SafeStringCopy(szQueryString, pszQueryString)) - { - return FALSE; - } - - if (!m_QueryParams.Parse(szQueryString)) - { - return FALSE; - } - } - - if (m_QueryParams.IsShared()) - { - return TRUE; - } - - // If this is a GET request, the collection of form fields - // is the same as the collection of query parameters. - if (httpMethod == HTTP_METHOD_GET) - { - m_pFormVars = &m_QueryParams; - return TRUE; - } - else if (httpMethod == HTTP_METHOD_POST) - { - LPCSTR szContentType = GetContentType(); - if (!szContentType) - return FALSE; - - // Don't parse the form data if the size is bigger than the maximum specified. - if (m_spServerContext->GetTotalBytes() > dwMaxFormSize) - { - if (strncmp(szContentType, "multipart/form-data", 19) == 0) - m_bMultiPart = TRUE; - - m_dwBytesRead = 0; - - return TRUE; - } - - // If POSTed data is urlencoded, call InitFromPost. - if (strncmp(szContentType, "application/x-www-form-urlencoded", 33) == 0 && !m_pFormVars->IsShared()) - return InitFromPost(); - - // If POSTed data is encoded as multipart/form-data, use CMultiPartFormParser. - if (strncmp(szContentType, "multipart/form-data", 19) == 0 && !m_pFormVars->IsShared()) - { - if (m_pFormVars != &m_QueryParams) - delete m_pFormVars; - m_pFormVars = NULL; - - CMultiPartFormParser FormParser(m_spServerContext); - ATLTRY(m_pFormVars = new CHttpRequestParams); - if (!m_pFormVars) - return FALSE; - - BOOL bRet = FormParser.GetMultiPartData(m_Files, m_pFormVars, dwFlags); - return bRet; - } - - // else initialize m_dwBytesRead for ReadData - m_dwBytesRead = 0; - } - - return TRUE; - } - _ATLCATCHALL() - { - } - return FALSE; - - } - - // Implementation: Call this function to initialize the collection of form fields - // from the body of an application/x-www-form-urlencoded POST request. - ATL_NOINLINE BOOL InitFromPost() throw() - { - _ATLTRY - { - ATLASSUME(m_spServerContext != NULL); - - // create our m_pFormVars - if (m_pFormVars == NULL || m_pFormVars == &m_QueryParams) - { - ATLTRY(m_pFormVars = new CHttpRequestParams); - if (m_pFormVars == NULL) - { - return FALSE; - } - } - - // read the form data into a buffer - DWORD dwBytesTotal = m_spServerContext->GetTotalBytes(); - CAutoVectorPtr szBuff; - if ((dwBytesTotal+1 < dwBytesTotal) || (dwBytesTotal < 0)) - { - return FALSE; - } - if (!szBuff.Allocate(dwBytesTotal+1)) - { - return FALSE; - } - // first copy the available - BOOL bRet = ReadClientData(m_spServerContext, szBuff, &dwBytesTotal, 0); - if (bRet) - { - szBuff[dwBytesTotal] = '\0'; - bRet = m_pFormVars->Parse(szBuff); - } - - return bRet; - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to remove the files listed in m_Files from the web server's hard disk. - // Returns the number of files deleted. - int DeleteFiles() throw() - { - int nDeleted = 0; - POSITION pos = m_Files.GetStartPosition(); - while (pos != NULL) - { - LPCSTR szTempFile = m_Files.GetKeyAt(pos); - if (szTempFile && DeleteFileA(szTempFile)) - { - nDeleted++; - } - m_Files.GetNext(pos); - } - - return nDeleted; - } - - // Read a specified amount of data into pbDest and return the bytes read in pdwLen. - // Returns TRUE on success, FALSE on failure. - BOOL ReadData(__out_ecount_part(*pdwLen,*pdwLen) LPSTR pDest, __inout LPDWORD pdwLen) - { - ATLENSURE(pDest); - ATLENSURE(pdwLen); - - BOOL bRet = ReadClientData(m_spServerContext, pDest, pdwLen, m_dwBytesRead); - if (bRet) - m_dwBytesRead+= *pdwLen; - return bRet; - } - - // Returns the number of bytes available in the request buffer accessible via GetAvailableData. - // If GetAvailableBytes returns the same value as GetTotalBytes, the request buffer contains the whole request. - // Otherwise, the remaining data should be read from the client using ReadData. - // Equivalent to EXTENSION_CONTROL_BLOCK::cbAvailable. - __checkReturn DWORD GetAvailableBytes() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetAvailableBytes(); - } - - // Returns the total number of bytes to be received from the client. - // If this value is 0xffffffff, then there are four gigabytes or more of available data. - // In this case, ReadData should be called until no more data is returned. - // Equivalent to the CONTENT_LENGTH server variable or EXTENSION_CONTROL_BLOCK::cbTotalBytes. - __checkReturn DWORD GetTotalBytes() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetTotalBytes(); - } - - // Returns a pointer to the request buffer containing the data sent by the client. - // The size of the buffer can be determined by calling GetAvailableBytes. - // Equivalent to EXTENSION_CONTROL_BLOCK::lpbData - __checkReturn LPBYTE GetAvailableData() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetAvailableData(); - } - - - // Returns a nul-terminated string that contains the query information. - // This is the part of the URL that appears after the question mark (?). - // Equivalent to the QUERY_STRING server variable or EXTENSION_CONTROL_BLOCK::lpszQueryString. - __checkReturn LPCSTR GetQueryString() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetQueryString(); - } - - // Returns a nul-terminated string that contains the HTTP method of the current request. - // Examples of common HTTP methods include "GET" and "POST". - // Equivalent to the REQUEST_METHOD server variable or EXTENSION_CONTROL_BLOCK::lpszMethod. - __checkReturn LPCSTR GetMethodString() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetRequestMethod(); - } - - // Returns an HTTP_METHOD enum value corresponding to the HTTP method of the current request. - // Returns HTTP_METHOD_UNKNOWN if the request method is not one of the following methods: - // GET - // POST - // HEAD - // DELETE - // LINK - // UNLINK - __checkReturn HTTP_METHOD GetMethod() throw(...) - { - LPCSTR szMethod = GetMethodString(); - if (!szMethod) - return HTTP_METHOD_UNKNOWN; - for (int i=0; m_szMethodStrings[i]; i++) - { - if (strcmp(szMethod, m_szMethodStrings[i]) == 0) - return (HTTP_METHOD) i; - } - return HTTP_METHOD_UNKNOWN; - } - - // Returns a nul-terminated string that contains the content type of the data sent by the client. - // Equivalent to the CONTENT_TYPE server variable or EXTENSION_CONTROL_BLOCK::lpszContentType. - __checkReturn LPCSTR GetContentType() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetContentType(); - } - - - // Call this function to retrieve a nul-terminated string containing the value of the "AUTH_USER" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetAuthUserName(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("AUTH_USER", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "APPL_PHYSICAL_PATH" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetPhysicalPath(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("APPL_PHYSICAL_PATH", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "AUTH_PASSWORD" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetAuthUserPassword(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("AUTH_PASSWORD", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "URL" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUrl(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("URL", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "REMOTE_HOST" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUserHostName(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("REMOTE_HOST", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "REMOTE_ADDR" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUserHostAddress(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("REMOTE_ADDR", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the physical path of the script. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - // The script path is the same as GetPathTranslated up to the first .srf or .dll. - // For example, if GetPathTranslated returns "c:\inetpub\vcisapi\hello.srf\goodmorning", - // then this function returns "c:\inetpub\vcisapi\hello.srf". - __checkReturn LPCSTR GetScriptPathTranslated() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetScriptPathTranslated(); - } - - // Returns a nul-terminated string that contains the physical path of the requested resource on the local server. - // Equivalent to the PATH_TRANSLATED server variable or EXTENSION_CONTROL_BLOCK::lpszPathTranslated. - __checkReturn LPCSTR GetPathTranslated() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetPathTranslated(); - } - - // Returns a nul-terminated string that contains the path of the current request. - // This is the part of the URL that appears after the server name, but before the query string. - // Equivalent to the PATH_INFO server variable or EXTENSION_CONTROL_BLOCK::lpszPathInfo. - __checkReturn LPCSTR GetPathInfo() throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetPathInfo(); - } - - // Call this function to determine whether the current request was authenticated. - __checkReturn BOOL GetAuthenticated() throw(...) - { - // We assume that if we get an authentication type from IIS, - // then the user has been authenticated. - CStringA strAuthType; - if (GetAuthenticationType(strAuthType) && - strAuthType.GetLength() > 0) - return TRUE; - - return FALSE; - } - - // Call this function to retrieve a nul-terminated string containing the value of the "AUTH_TYPE" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetAuthenticationType(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("AUTH_TYPE", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "REMOTE_USER" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUserName(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, DWORD __inout *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("REMOTE_USER", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "HTTP_USER_AGENT" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUserAgent(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("HTTP_USER_AGENT", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "HTTP_ACCEPT_LANGUAGE" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUserLanguages(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("HTTP_ACCEPT_LANGUAGE", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "HTTP_ACCEPT" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetAcceptTypes(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("HTTP_ACCEPT", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "HTTP_ACCEPT_ENCODING" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetAcceptEncodings(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("HTTP_ACCEPT_ENCODING", szBuff, pdwSize); - } - - - // Call this function to retrieve a nul-terminated string containing the value of the "HTTP_REFERER" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetUrlReferer(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("HTTP_REFERER", szBuff, pdwSize); - } - - // Call this function to retrieve a nul-terminated string containing the value of the "SCRIPT_NAME" server variable. - // - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - // - // On entry, pdwSize should point to a DWORD that indicates the size of the buffer in bytes. - // On exit, the DWORD contains the number of bytes transferred or available to be transferred into the buffer (including the nul-terminating byte). - __checkReturn BOOL GetScriptName(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuff, __inout DWORD *pdwSize) throw(...) - { - ATLENSURE(m_spServerContext); - return m_spServerContext->GetServerVariable("SCRIPT_NAME", szBuff, pdwSize); - } - - // Fills a buffer with the contents of the HTTP_COOKIE headers sent - // from the browser. - __checkReturn BOOL GetCookies(__out_ecount_part(*pdwSize,*pdwSize) LPSTR szBuf, __inout LPDWORD pdwSize) const throw(...) - { - ATLASSERT(szBuf != NULL); - - CStringA strCookie; - if (GetCookies(strCookie)) - { - ATLENSURE(pdwSize != NULL); - if (pdwSize && *pdwSize > (DWORD)strCookie.GetLength()) - { - Checked::strcpy_s(szBuf, *pdwSize, strCookie); - *pdwSize = strCookie.GetLength(); - return true; - } - } - return false; - } - - // Fills a CStringA with the contents of the HTTP_COOKIE headers sent - // from the browser. - __checkReturn BOOL GetCookies(__inout CStringA& strBuff) const throw() - { - return GetServerVariable("HTTP_COOKIE", strBuff); - } - - // Call this function to retrieve a reference to the specified cookie. - // Returns a CCookie reference to the specified cookie or a - // reference to an empty cookie if the name can not be found. - ATL_NOINLINE const CCookie& Cookies(__in LPCSTR szName) throw(...) - { - if (GetRequestCookies()) - { - // p->m_value is a const CCookie& - CookieMap::CPair *p = NULL; - ATLTRY(p = m_requestCookies.Lookup(szName)); - if (p) - { - return p->m_value; - } - } - m_EmptyCookie.Empty(); // make sure it is cleared. - return m_EmptyCookie; - } - - - // Call this function to retrieve the session cookie. - const CCookie& GetSessionCookie() throw(...) - { - return Cookies(SESSION_COOKIE_NAME); - } - - // Call this function to retrieve the value of the requested server variable in a CStringA object. - // Returns TRUE on success, and FALSE on failure. Call GetLastError to get extended error information. - // Equivalent to EXTENSION_CONTROL_BLOCK::GetServerVariable. - BOOL GetServerVariable(__in LPCSTR szVariable, __out CStringA &str) const - { - ATLENSURE(m_spServerContext); - - DWORD dwSize = 0; - BOOL bRet = FALSE; - _ATLTRY - { - m_spServerContext->GetServerVariable(szVariable, NULL, &dwSize); - bRet = m_spServerContext->GetServerVariable(szVariable, str.GetBuffer(dwSize), &dwSize); - if (dwSize > 0) - dwSize--; - str.ReleaseBuffer(dwSize); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - return bRet; - } - - // Call this function to retrieve the value of the "APPL_PHYSICAL_PATH" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetPhysicalPath(__out CStringA &str) throw() - { - return GetServerVariable("APPL_PHYSICAL_PATH", str); - } - - // Call this function to retrieve the value of the "REMOTE_HOST" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUserHostName(__out CStringA &str) throw() - { - return GetServerVariable("REMOTE_HOST", str); - } - - // Call this function to retrieve the value of the "REMOTE_ADDR" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUserHostAddress(__out CStringA &str) throw() - { - return GetServerVariable("REMOTE_ADDR", str); - } - - // Call this function to retrieve the value of the "AUTH_TYPE" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetAuthenticationType(__out CStringA &str) throw() - { - return GetServerVariable("AUTH_TYPE", str); - } - - // Call this function to retrieve the value of the "REMOTE_USER" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUserName(__out CStringA &str) throw() - { - return GetServerVariable("REMOTE_USER", str); - } - - // Call this function to retrieve the value of the "HTTP_USER_AGENT" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUserAgent(__out CStringA &str) throw() - { - return GetServerVariable("HTTP_USER_AGENT", str); - } - - // Call this function to retrieve the value of the "HTTP_ACCEPT_LANGUAGE" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUserLanguages(__out CStringA &str) throw() - { - return GetServerVariable("HTTP_ACCEPT_LANGUAGE", str); - } - - // Call this function to retrieve the value of the "AUTH_USER" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetAuthUserName(__out CStringA &str) throw() - { - return GetServerVariable("AUTH_USER", str); - } - - // Call this function to retrieve the value of the "AUTH_PASSWORD" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetAuthUserPassword(__out CStringA &str) throw() - { - return GetServerVariable("AUTH_PASSWORD", str); - } - - // Call this function to retrieve the value of the "URL" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUrl(__out CStringA &str) throw() - { - return GetServerVariable("URL", str); - } - - // Call this function to retrieve the value of the "HTTP_ACCEPT" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetAcceptTypes(__out CStringA &str) throw() - { - return GetServerVariable("HTTP_ACCEPT", str); - } - - // Call this function to retrieve the value of the "HTTP_ACCEPT_ENCODING" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetAcceptEncodings(__out CStringA& str) throw() - { - return GetServerVariable("HTTP_ACCEPT_ENCODING", str); - } - - // Call this function to retrieve the value of the "HTTP_REFERER" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetUrlReferer(__out CStringA &str) throw() - { - return GetServerVariable("HTTP_REFERER", str); - } - - // Call this function to retrieve the value of the "SCRIPT_NAME" server variable. - // Returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information. - __checkReturn BOOL GetScriptName(__out CStringA &str) throw() - { - return GetServerVariable("SCRIPT_NAME", str); - } - - // Implementation: Call this function to populate the collection - // of CCookie objects with the cookies in the current request. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL GetRequestCookies() throw() - { - BOOL bRet = FALSE; - - if (m_requestCookies.GetCount()) - return TRUE; // we already got the cookies! - - CStringA strCookies; - if (GetCookies(strCookies)) - { - bRet = Parse(strCookies); - } - return bRet; - } - -private: - struct Pair - { - Pair(__in const CStringA &n, __in const CStringA& v) - { - name = n; - value = v; - } - - Pair(__in const Pair& rhs) - { - name = rhs.name; - value = rhs.value; - } - - CStringA name; - CStringA value; - }; - static const int INVALID_COOKIE_VERSION = -1; -public: - - // Implementation: Call this function to populate m_requestCookies - // with a collection of CCookie objects which represents the - // cookies contained in szCookie header sent from the browser. - BOOL Parse(__in LPCSTR szCookieIn) - { - ATLENSURE(szCookieIn!=NULL); - UINT acp = GetACP(); - LPCSTR szStart; - LPCSTR szEnd; - CStringA name, value; - CAtlList pair_list; - - // create a list of name=value pairs - // these are separated by or ; - szStart = szCookieIn; - szEnd = szStart; - while (*szStart) - { - name.Empty(); - value.Empty(); - szStart = SkipSpace(szStart, (WORD)acp); - if (*szStart == '\0') - break; - - szEnd = szStart; - while (*szEnd && *szEnd != '=' && *szEnd != ';' ) - szEnd++; - - if (szEnd <= szStart) - { - if (*szEnd ==';') - { - szEnd++; - szStart = szEnd; - continue; - } - szStart = szEnd; - break; // no name or error - } - - CopyToCString(name, szStart, szEnd); - if (*szEnd == '\0' || *szEnd == ';' ) - { - // no value expected; - pair_list.AddTail(Pair(name, value)); - szStart = szEnd; - } - else if ( *szEnd == '=') - { - szEnd++; // skip '=' - szStart = szEnd; - while (*szEnd && *szEnd != ';') - szEnd++; - - if (szEnd <= szStart) - { - if (*szEnd == ';') - { - szEnd++; - szStart = szEnd; - continue; - } - szStart = szEnd; - pair_list.AddTail(Pair(name,value)); - break; // no value - } - - CopyToCString(value, szStart, szEnd); - pair_list.AddTail(Pair(name,value)); - szStart = szEnd; - } - } - - // now make cookies out of the list - // The first item could be $Version, which would - // be the version for all cookies in the list. - // any other $Version's found in the list will be ignored. - if (pair_list.GetCount() <= 0) - return TRUE; // nothing in the list - - // check for $Version - static const char szVersion[] = "$Version"; - int nVersion = INVALID_COOKIE_VERSION; - if (!strncmp(pair_list.GetHead().name, szVersion, sizeof(szVersion)+1)) - { - char *pStop = NULL; - errno_t errnoValue = AtlStrToNum(&nVersion, pair_list.GetHead().value, &pStop, 10); - if (errnoValue == ERANGE) - nVersion = INVALID_COOKIE_VERSION; // $Version contained garbage - pair_list.RemoveHead(); // Remove $Version - } - - POSITION pos = pair_list.GetHeadPosition(); - bool bInCookie = false; - CCookie cookie; - - while (pos) - { - const Pair &p = pair_list.GetNext(pos); - if (p.name[0] == '$') - { - if (!bInCookie) - return FALSE; // invalid cookie string - else - { - //add attribute to current cookie - if(!cookie.AddAttribute(p.name.Right(p.name.GetLength()-1),p.value)) - { - return FALSE; - } - } - } - else - { - if (!bInCookie) - { - bInCookie = true; - cookie.SetName(p.name); - cookie.ParseValue(p.value); - if (nVersion != INVALID_COOKIE_VERSION) - cookie.SetVersion(nVersion); - } - else - { - // add previous cookie - CStringA strPrevName; - if(!cookie.GetName(strPrevName)) - { - return FALSE; - } - m_requestCookies.SetAt(strPrevName, cookie); - - // empty current cookie and start over - cookie.Empty(); - cookie.SetName(p.name); - cookie.ParseValue(p.value); - if (nVersion != INVALID_COOKIE_VERSION) - cookie.SetVersion(nVersion); - - } - } - } - - if (!cookie.IsEmpty()) - { - CStringA strName; - if(!cookie.GetName(strName)) - { - return FALSE; - } - m_requestCookies.SetAt(strName, cookie); - } - return TRUE; - - } - -private: - // Call this function to copy a substring to a CString reference and ensure nul-termination. - inline void CopyToCString(__out CStringA& string, __in_ecount(pEnd-pStart) LPCSTR pStart, __in LPCSTR pEnd) throw( ... ) - { - ATLENSURE( pStart != NULL ); - ATLENSURE( pEnd != NULL ); - ATLENSURE( pEnd>=pStart ); - - string.SetString(pStart, (int)(pEnd-pStart)); - string.Trim(); - } - - inline LPCSTR SkipSpace(__in LPCSTR sz, __in WORD nCodePage) throw() - { - if (sz == NULL) - return NULL; - - while (isspace(static_cast(*sz))) - sz = CharNextExA(nCodePage, sz, 0); - return sz; - } -public: - - - __success(SUCCEEDED(return)) __checkReturn HRESULT STDMETHODCALLTYPE QueryInterface(__in REFIID riid, __deref_out void **ppv) - { - if (!ppv) - return E_POINTER; - if (InlineIsEqualGUID(riid, __uuidof(IHttpRequestLookup))) - { - *ppv = static_cast(static_cast(this)); - AddRef(); - return S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IUnknown))) - { - *ppv = static_cast(this); - AddRef(); - return S_OK; - } - return E_NOINTERFACE; - } - - ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - ULONG STDMETHODCALLTYPE Release() - { - return 1; - } -}; // class CHttpRequest - -__declspec(selectany) const char* const CHttpRequest::m_szMethodStrings[] = { - "GET", - "POST", - "HEAD", - "DELETE", - "LINK", - "UNLINK", - "DEBUG", // Debugging support for VS7 - NULL -}; - -// This class provides type conversions via the Write method -// and overloaded left shift << operator for writing -// data to the IWriteStream interface. The IWriteStream interface -// only accepts strings, but this helper class allows you to transparently -// pass many different types by providing automatic type conversions. -// -// Notes on Type Conversions: -// Numeric types are converted to their decimal representations. -// Floating point values are output with a precision of 6 decimal places. -// Currency values are converted according to the locale settings of the current thread. -class CWriteStreamHelper -{ -protected: - // Implementation: The IWriteStream interface. - IWriteStream *m_pStream; - UINT m_ulACP; - -public: - CWriteStreamHelper() throw() - :m_pStream(NULL) - { - m_ulACP = _AtlGetConversionACP(); - } - - CWriteStreamHelper(__in_opt IWriteStream *pStream) throw() - { - m_pStream = pStream; - m_ulACP = _AtlGetConversionACP(); - } - - // Attach a IWriteStream - IWriteStream *Attach(__in IWriteStream *pStream) throw() - { - IWriteStream *pRetStream = m_pStream; - m_pStream = pStream; - return pRetStream; - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in_z LPCSTR szOut) throw() - { - ATLASSUME(m_pStream != NULL); - - if (!szOut) - return FALSE; - - DWORD dwWritten; - return SUCCEEDED(m_pStream->WriteStream(szOut, (int) strlen(szOut), &dwWritten)); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in int n) throw() - { - CHAR szTmp[21]; - Checked::itoa_s(n, szTmp, _countof(szTmp), 10); - return Write(szTmp); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in unsigned int u) throw() - { - CHAR szTmp[21]; - Checked::ultoa_s(u, szTmp, _countof(szTmp), 10); - return Write(szTmp); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in short int w) throw() - { - return Write((int) w); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in unsigned short int w) throw() - { - return Write((unsigned int) w); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in long int dw) throw() - { - CHAR szTmp[21]; - Checked::ltoa_s(dw, szTmp, _countof(szTmp), 10); - return Write(szTmp); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in unsigned long int dw) throw() - { - CHAR szTmp[21]; - Checked::ultoa_s(dw, szTmp, _countof(szTmp), 10); - return Write(szTmp); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in double d, __in int nDigitCount=ATL_DEFAULT_PRECISION) throw() - { - ATLASSUME(m_pStream != NULL); - - CHAR szTmp[512]; - int nDec = 0; - int nSign = 0; - bool fWriteDec=true; - if (0 != _fcvt_s(szTmp, _countof(szTmp), d, nDigitCount, &nDec, &nSign)) - { - // too large - return FALSE; - } - - if (nSign != 0) - m_pStream->WriteStream("-", 1, NULL); - if (nDec < 0) - { - nDec *= -1; - m_pStream->WriteStream("0.", 2, NULL); - for (int i=0;iWriteStream("0", 1, NULL); - } - nDec = 0; - fWriteDec=false; - } - - char *p = szTmp; - while (*p) - { - // if the decimal lies at the end of the number - // (no digits to the right of the decimal, we don't - // print it. - if (nDec == 0 && fWriteDec) - m_pStream->WriteStream(".", 1, NULL); - m_pStream->WriteStream(p, 1, NULL); - nDec--; - p++; - } - return TRUE; - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in __int64 i) throw() - { - CHAR szTmp[21]; - Checked::i64toa_s(i, szTmp, _countof(szTmp), 10); - return Write(szTmp); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in unsigned __int64 i) throw() - { - CHAR szTmp[21]; - Checked::ui64toa_s(i, szTmp, _countof(szTmp), 10); - return Write(szTmp); - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in CURRENCY c) throw() - { - CHAR szDest[256]; - CHAR szNumber[32]; - - Checked::i64toa_s(c.int64, szNumber, _countof(szNumber), 10); - int nLen = (int) strlen(szNumber); - if (nLen < 5) - { - // prepend ascii zeros - Checked::memmove_s(szNumber+5-nLen, 32-(5-nLen), szNumber, nLen+1); - memset(szNumber, '0', 5-nLen); - nLen = 5; - } - - Checked::memmove_s(szNumber+nLen-3, 32-(nLen-3), szNumber+nLen-4, 5); - szNumber[nLen-4] = '.'; - - int nRet = GetCurrencyFormatA(GetThreadLocale(), 0, szNumber, NULL, szDest, sizeof(szDest)); - if (nRet > 0) - return Write(szDest); - - ATLASSERT(GetLastError()==ERROR_INSUFFICIENT_BUFFER); - - nRet = GetCurrencyFormatA(GetThreadLocale(), 0, szNumber, NULL, NULL, 0); - ATLASSERT(nRet > 0); - - if (nRet <= 0) - return FALSE; - - CAutoVectorPtr szBuffer; - if (!szBuffer.Allocate(nRet)) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - nRet = GetCurrencyFormatA(GetThreadLocale(), 0, szNumber, NULL, szBuffer, nRet); - - ATLASSERT(nRet > 0); - BOOL bRet = FALSE; - if (nRet > 0) - bRet = Write(szBuffer); - - return bRet; - } - - // Call this function to write data to the IWriteStream interface managed by this object. - // Returns TRUE on success, FALSE on failure. - BOOL Write(__in LPCWSTR wsz) throw() - { - ATLASSUME(m_pStream != NULL); - - BOOL bRet; - - _ATLTRY - { - CW2A sz(wsz, m_ulACP); - - if (!sz) - { - bRet = FALSE; - } - - DWORD dwWritten; - bRet = SUCCEEDED(m_pStream->WriteStream(sz, (int) strlen(sz), &dwWritten)); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - - return bRet; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in LPCSTR szStr) throw(...) - { - if (!Write(szStr)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in LPCWSTR wszStr) throw(...) - { - if (!Write(wszStr)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in int n) throw(...) - { - if (!Write(n)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in short int w) throw(...) - { - if (!Write(w)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in unsigned int u) throw(...) - { - if (!Write(u)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in long int dw) throw(...) - { - if (!Write(dw)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in unsigned long int dw) throw(...) - { - if (!Write(dw)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in double d) throw(...) - { - if (!Write(d)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in __int64 i) throw(...) - { - if (!Write(i)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in unsigned __int64 i) throw(...) - { - if (!Write(i)) - AtlThrow(E_FAIL); - return *this; - } - - // Use this operator to write data to the IWriteStream interface managed by this object. - CWriteStreamHelper& operator<<(__in CURRENCY c) throw(...) - { - if (!Write(c)) - AtlThrow(E_FAIL); - return *this; - } - - UINT SetConversionCodePage(__in UINT nNewCP) - { - UINT nOldCP = m_ulACP; - m_ulACP = nNewCP; - return nOldCP; - } -}; - - -template -class CAtlIsapiBuffer -{ -protected: - char m_szBuffer[dwSizeT]; - LPSTR m_pBuffer; - DWORD m_dwLen; - DWORD m_dwAlloc; - HANDLE m_hProcHeap; - -public: - CAtlIsapiBuffer() throw() - { - if (dwSizeT > 0) - m_szBuffer[0] = 0; - - m_pBuffer = m_szBuffer; - m_dwLen = 0; - m_dwAlloc = dwSizeT; - m_hProcHeap = GetProcessHeap(); - } - - CAtlIsapiBuffer(__in LPCSTR sz) - { - m_pBuffer = m_szBuffer; - m_dwLen = 0; - m_dwAlloc = dwSizeT; - m_hProcHeap = GetProcessHeap(); - - if (!Append(sz)) - AtlThrow(E_OUTOFMEMORY); - } - - ~CAtlIsapiBuffer() throw() - { - Free(); - } - - BOOL Alloc(__in DWORD dwSize) throw() - { - if (m_dwAlloc >= dwSize) - { - return TRUE; - } - if (m_pBuffer != m_szBuffer) - { - HeapFree(m_hProcHeap, 0, m_pBuffer); - m_dwLen = 0; - m_dwAlloc = 0; - } - m_pBuffer = (LPSTR)HeapAlloc(m_hProcHeap, 0, dwSize); - if (m_pBuffer) - { - m_dwAlloc = dwSize; - return TRUE; - } - return FALSE; - } - - BOOL ReAlloc(__in DWORD dwNewSize) throw() - { - if (dwNewSize <= m_dwAlloc) - return TRUE; - - if (m_pBuffer == m_szBuffer) - { - BOOL bRet = Alloc(dwNewSize); - if (bRet) - { - Checked::memcpy_s(m_pBuffer, dwNewSize, m_szBuffer, m_dwLen); - } - return bRet; - } - - LPSTR pvNew = (LPSTR )HeapReAlloc(m_hProcHeap, 0, m_pBuffer, dwNewSize); - if (pvNew) - { - m_pBuffer = pvNew; - m_dwAlloc = dwNewSize; - return TRUE; - } - return FALSE; - } - - void Free() throw() - { - if (m_pBuffer != m_szBuffer) - { - HeapFree(m_hProcHeap,0 , m_pBuffer); - m_dwAlloc = dwSizeT; - m_pBuffer = m_szBuffer; - } - Empty(); - } - - void Empty() throw() - { - if (m_pBuffer) - { - m_pBuffer[0]=0; - m_dwLen = 0; - } - } - - DWORD GetLength() throw() - { - return m_dwLen; - } - - BOOL Append(__in LPCSTR sz, __in int nLen = -1) throw() - { - if (!sz) - return FALSE; - - if (nLen == -1) - nLen = (int) strlen(sz); - - DWORD newLen = m_dwLen + nLen + 1; - if (newLen <= m_dwLen || newLen <= (DWORD)nLen) - { - return FALSE; - } - if (newLen > m_dwAlloc) - { - if (!ReAlloc(m_dwAlloc + (nLen+1 > ATL_ISAPI_BUFFER_SIZE ? nLen+1 : ATL_ISAPI_BUFFER_SIZE))) - return FALSE; - } - Checked::memcpy_s(m_pBuffer + m_dwLen, m_dwAlloc-m_dwLen, sz, nLen); - m_dwLen += nLen; - m_pBuffer[m_dwLen]=0; - return TRUE; - } - - operator LPCSTR() throw() - { - return m_pBuffer; - } - - CAtlIsapiBuffer& operator+=(__in LPCSTR sz) - { - if (!Append(sz)) - AtlThrow(E_OUTOFMEMORY); - return *this; - } -}; // class CAtlIsapiBuffer - -// This class represents the response that the web server will send back to the client. -// -// CHttpResponse provides friendly functions for building up the headers, cookies, and body of an HTTP response. -// The class derives from IWriteStream and CWriteStreamHelper, allowing you to call those classes' methods -// to build up the body of the response. By default, the class improves performance by buffering the response until it is complete before sending it back to the client. -class CHttpResponse : public IWriteStream, public CWriteStreamHelper -{ -private: - - // Implementation: A map of HTTP response headers. - // The key is the name of the response header. - // The value is the data for the response header. - CSimpleMap m_headers; - - // Implementation: Determines whether the response is currently being buffered. - BOOL m_bBufferOutput; - - // Implementation: Determines whether any output should be sent to the client. - // Intended mainly for HEAD requests, where the client should get the same headers - // (i.e. Content-Length) as for a GET request - BOOL m_bSendOutput; - - // Implementation: The limit in bytes of the response buffer. - // When the limit is reached, the buffer is automatically flushed - // and data is sent to the client. You can set this to ULONG_MAX - // to enable full buffering (this is the default, and is required - // for enabling keep alive connections). - DWORD m_dwBufferLimit; - - // Implementation: The server context. - CComPtr m_spServerContext; - - // Implementation: The HTTP status code for the response. - int m_nStatusCode; - - // Implementation: Determines whether the response headers have already been sent to the client. - BOOL m_bHeadersSent; - - // Implementation: Handle of the file being transmitted so it can be closed - // when the async I/O completes - HANDLE m_hFile; - -public: - // Implementation: The buffer used to store the response before - // the data is sent to the client. - CAtlIsapiBuffer<> m_strContent; - - // Numeric constants for the HTTP status codes used for redirecting client requests. - enum HTTP_REDIRECT - { - HTTP_REDIRECT_MULTIPLE=300, - HTTP_REDIRECT_MOVED=301, - HTTP_REDIRECT_FOUND=302, - HTTP_REDIRECT_SEE_OTHER=303, - HTTP_REDIRECT_NOT_MODIFIED=304, - HTTP_REDIRECT_USE_PROXY=305, - HTTP_REDIRECT_TEMPORARY_REDIRECT=307 - }; - - CHttpResponse() throw() - { - m_bBufferOutput = TRUE; - m_dwBufferLimit = ULONG_MAX; - m_nStatusCode = 200; - m_pStream = this; - m_bHeadersSent = FALSE; - m_bSendOutput = TRUE; - m_hFile = INVALID_HANDLE_VALUE; - } - - CHttpResponse(__in IHttpServerContext *pServerContext) - { - m_bBufferOutput = TRUE; - m_dwBufferLimit = ULONG_MAX; - m_nStatusCode = 200; - m_pStream = this; - m_bHeadersSent = FALSE; - ATLENSURE(Initialize(pServerContext)); - m_bSendOutput = TRUE; - m_hFile = INVALID_HANDLE_VALUE; - } - - // The destructor flushes the buffer if there is content that - // hasn't yet been sent to the client. - virtual ~CHttpResponse() throw() - { - Flush(TRUE); - if (m_hFile && m_hFile != INVALID_HANDLE_VALUE) - CloseHandle(m_hFile); - } - - // Call this function to initialize the response object with a pointer to the server context. - // Returns TRUE on success, FALSE on failure. - __checkReturn BOOL Initialize(__in IHttpServerContext *pServerContext) throw() - { - ATLASSERT(pServerContext != NULL); - if (!pServerContext) - return FALSE; - - m_spServerContext = pServerContext; - - return TRUE; - } - - // This is called to initialize the CHttpResponse for a child handler. By default, it - // assumes the parent will be responsible for sending the headers. - __checkReturn BOOL Initialize(__in IHttpRequestLookup *pLookup) throw(...) - { - ATLASSERT(pLookup); - if (!pLookup) - return FALSE; - - CComPtr spContext; - HRESULT hr = pLookup->GetServerContext(&spContext); - if (FAILED(hr)) - return FALSE; - - if (!Initialize(spContext)) - return FALSE; - - m_bHeadersSent = TRUE; - - return TRUE; - } - - // Returns a pointer to the IHttpServerContext interface for the current request. - __checkReturn HRESULT GetServerContext(__deref_out_opt IHttpServerContext ** ppOut) throw() - { - return m_spServerContext.CopyTo(ppOut); - } - - void Detach() - { - m_spServerContext.Release(); - HaveSentHeaders(TRUE); - } - // Call this function to set buffering options for the response. - // - // This function allows you to turn buffering on or off, and to set a size limit - // on the amount of data that will be buffered before being sent to the client. - // - // When you turn off buffering, the current contents of the buffer will be sent to the client. - // If you need to clear the buffer without sending the contents to the client, call ClearContent instead. - // - // When the size of the buffer is reduced below the current size of the buffered content, - // the entire buffer is flushed. - void SetBufferOutput(__in BOOL bBufferOutput, __in DWORD dwBufferLimit=ATL_ISAPI_BUFFER_SIZE) throw() - { - if (m_bBufferOutput && !bBufferOutput) - { - // before turning off buffering, flush - // the current contents - Flush(); - } - SetBufferLimit(dwBufferLimit); - - m_bBufferOutput = bBufferOutput; - } - - // Call this function to determine whether data written to the response object is being buffered or not. - // Returns TRUE if output is being buffered, FALSE otherwise. - __checkReturn BOOL GetBufferOutput() throw() - { - return m_bBufferOutput; - } - - // Call this function to determine whether the response headers have been sent - // Returns TRUE if headers have been sent, FALSE otherwise. - __checkReturn BOOL HaveSentHeaders() throw() - { - return m_bHeadersSent; - } - - // Call this function to override the m_bHeadersSent state. This is useful - // when you want child handlers (e.g. from an include or subhandler) to send the headers - void HaveSentHeaders(__in BOOL bSent) throw() - { - m_bHeadersSent = bSent; - } - - // Call this function to set a size limit on the amount of data buffered by the reponse object. - // When the size of the buffer is reduced below the current size of the buffered content, - // the entire buffer is flushed. - // See GetBufferLimit. - void SetBufferLimit(__in DWORD dwBufferLimit) throw() - { - if (m_bBufferOutput) - { - if (m_strContent.GetLength() >= dwBufferLimit) - { - // new buffer limit is less than the - // size currently buffered. So flush - // the current buffer - Flush(); - } - } - m_dwBufferLimit = dwBufferLimit; - } - - // Returns the current size limit of the buffer in bytes. - // See SetBufferLimit. - DWORD GetBufferLimit() throw() - { - return m_dwBufferLimit; - } - - // Returns the current value of the Content-Type header if present, otherwise returns NULL. - LPCSTR GetContentType() throw() - { - // return the content type from the - // header collection if any - _ATLTRY - { - CStringA strKey("Content-Type"); - - int nIndex = m_headers.FindKey(strKey); - if (nIndex >= 0) - return m_headers.GetValueAt(nIndex); - } - _ATLCATCHALL() - { - } - return NULL; - } - - // Call this function to set the Content-Type of the HTTP response. - // Examples of common MIME content types include text/html and text/plain. - BOOL SetContentType(__in_opt LPCSTR szContentType) throw() - { - _ATLTRY - { - if (!m_headers.SetAt("Content-Type", szContentType)) - return m_headers.Add("Content-Type", szContentType); - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to set the HTTP status code of the response. - // If not set explicitly, the default status code is 200 (OK). - // See GetStatusCode. - void SetStatusCode(__in int nCode) throw() - { - m_nStatusCode = nCode; - } - - // Returns the current HTTP status code of the response. - // See SetStatusCode. - int GetStatusCode() throw() - { - return m_nStatusCode; - } - - // Call this function to set the Cache-Control http header of the response. - // Examples of common Cache-Control header values: public, private, max-age=delta-seconds - BOOL SetCacheControl(__in_opt LPCSTR szCacheControl) throw() - { - _ATLTRY - { - if (!m_headers.SetAt("Cache-Control", szCacheControl)) - return m_headers.Add("Cache-Control", szCacheControl); - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to set the Expires HTTP header to the absolute date/time - // specified in the stExpires parameter - BOOL SetExpiresAbsolute(__in const SYSTEMTIME& stExpires) throw() - { - _ATLTRY - { - CStringA strExpires; - SystemTimeToHttpDate(stExpires, strExpires); - - if (!m_headers.SetAt("Expires", strExpires)) - return m_headers.Add("Expires", strExpires); - } - _ATLCATCHALL() - { - } - return FALSE; - } - - // Call this function to set the Expires HTTP header to a relative date/time - // value specified in minutes; - BOOL SetExpires(__in long lMinutes) throw() - { - CFileTime ft; - GetSystemTimeAsFileTime(&ft); - - // add the specified number of minutes - ft += CFileTimeSpan(((ULONGLONG)lMinutes)*60*10000000); - - SYSTEMTIME st; - FileTimeToSystemTime(&ft, &st); - return SetExpiresAbsolute(st); - } - - // Call this function to set whether or not to output to client. - // Intended primarily for HEAD requests - BOOL SetWriteToClient(__in BOOL bSendOutput) throw() - { - m_bSendOutput = bSendOutput; - return TRUE; - } - - // Call this function to determine whether or not the data is - // sent to the client. Intended primarily for HEAD requests - BOOL GetWriteToClient() throw() - { - return m_bSendOutput; - } - - // Call this function to write data to the response object. - // - // Returns S_OK on success, E_INVALIDARG or E_FAIL on failure. - // - // See WriteClient for comments on buffering. - // - // szOut A pointer to the first byte of the data to be written. - // - // nLen The number of bytes to write. If this parameter is -1, - // szOut is assumed to be a nul-terminated string and the - // whole string will be written. - // - // pdwWritten A DWORD pointer that can be used to get the number of bytes written. - // This parameter can be NULL. - __checkReturn HRESULT WriteStream(__in_z LPCSTR szOut, __in int nLen, __out_opt DWORD *pdwWritten) - { - ATLASSUME(m_spServerContext != NULL); - - if (pdwWritten) - *pdwWritten = 0; - if (nLen == -1) - { - if (!szOut) - return E_INVALIDARG; - nLen = (int) strlen(szOut); - } - BOOL bRet = WriteLen(szOut, nLen); - if (!bRet) - { - return AtlHresultFromLastError(); - } - if (pdwWritten) - *pdwWritten = nLen; - return S_OK; - } - - // Call this function to write data to the response object. - // - // Returns TRUE on success. FALSE on failure. - // - // If buffering is disabled, data is written directly to the client. - // If buffering is enabled, this function attempts to write to the buffer. - // If the buffer is too small to contain its existing data and the new data, - // the current contents of the buffer are flushed. - // If the buffer is still too small to contain the new data, that data is written - // directly to the client. Otherwise the new data is written to the buffer. - // - // Any headers that have been set in the response will be sent just before the - // data is written to the client if no headers have been sent up to that point. - // - // szOut A pointer to the first byte of the data to be written. - // - // nLen The number of bytes to write. - __checkReturn BOOL WriteLen(__in_ecount(dwLen) LPCSTR szOut, __in DWORD dwLen) throw() - { - ATLASSUME(m_spServerContext != NULL); - if (!szOut) - return FALSE; - - if (m_bBufferOutput) - { - if (m_strContent.GetLength()+dwLen >= m_dwBufferLimit) - { - if (!Flush()) - return FALSE; - } - if (dwLen <= m_dwBufferLimit) - return m_strContent.Append(szOut, dwLen); - } - BOOL bRet = SendHeadersInternal(); - - if (bRet && m_bSendOutput) - bRet = m_spServerContext->WriteClient((void *) szOut, &dwLen); - - return bRet; - } - - // Call this function to redirect the client to a different resource. - // - // Returns TRUE on success, FALSE on failure. - // - // szURL A nul-terminated string specifying the resource the client should navigate to. - // - // statusCode An HTTP status code from the HTTP_REDIRECT enumeration describing the reason - // for the redirection. - // - // bSendBody Specifies whether to generate and send a response body with the headers. - // - // This function allows (and RFC 2616 encourages) a response body to be sent - // with the following redirect types: - // HTTP_REDIRECT_MOVED - // HTTP_REDIRECT_FOUND - // HTTP_REDIRECT_SEE_OTHER - // HTTP_REDIRECT_TEMPORARY_REDIRECT - // No body will be sent with other redirect types. - // - // The response body contains a short hypertext note with a hyperlink to the new resource. - // A meta refresh tag is also included to allow browsers to automatically redirect - // the user to the resource even if they don't understand the redirect header. - // - // See RFC 2616 section 10.3 for more information on redirection. - BOOL Redirect(__in LPCSTR szUrl, __in HTTP_REDIRECT statusCode=HTTP_REDIRECT_MOVED, __in BOOL bSendBody=TRUE) throw(...) - { - CStringA strBody; - LPCSTR szBody = NULL; - if (bSendBody && - (HTTP_REDIRECT_MOVED == statusCode || HTTP_REDIRECT_FOUND == statusCode || - HTTP_REDIRECT_SEE_OTHER == statusCode || HTTP_REDIRECT_TEMPORARY_REDIRECT == statusCode)) - { - _ATLTRY - { - ATLENSURE(szUrl!=NULL); - strBody.Format( - "\r\n" - "\r\n" - "\r\n" - "\r\n" - "Please use the following link to access this resource:" - " %s\r\n" - "\r\n" - "\r\n", - szUrl, szUrl, szUrl); - } - _ATLCATCHALL() - { - return FALSE; - } - szBody = (LPCSTR) strBody; - } - return Redirect(szUrl, szBody, statusCode); - } - - // Call this function to redirect the client to a different resource. - // - // Returns TRUE on success, FALSE on failure. - // - // szURL A nul-terminated string specifying the resource the client should navigate to. - // - // szBody A nul-terminated string containing the body of the response to be sent to the client. - // - // statusCode An HTTP status code from the HTTP_REDIRECT enumeration describing the reason - // for the redirection. - // - // This function allows (and RFC 2616 encourages) a response body to be sent - // with the following redirect types: - // HTTP_REDIRECT_MOVED - // HTTP_REDIRECT_FOUND - // HTTP_REDIRECT_SEE_OTHER - // HTTP_REDIRECT_TEMPORARY_REDIRECT - // No body will be sent with other redirect types. - // - // The response body should contain a short hypertext note with a hyperlink to the new resource. - // You can include a meta refresh tag to allow browsers to automatically redirect - // the user to the resource even if they don't understand the redirect header. - // - // See RFC 2616 section 10.3 for more information on redirection. - BOOL Redirect(__in LPCSTR szUrl, __in LPCSTR szBody, __in HTTP_REDIRECT statusCode=HTTP_REDIRECT_MOVED) throw() - { - SetStatusCode(statusCode); - AppendHeader("Location", szUrl); - - _ATLTRY - { - if (!SendHeadersInternal()) - return FALSE; - } - _ATLCATCHALL() - { - return FALSE; - } - - if (szBody && - (HTTP_REDIRECT_MOVED == statusCode || HTTP_REDIRECT_FOUND == statusCode || - HTTP_REDIRECT_SEE_OTHER == statusCode || HTTP_REDIRECT_TEMPORARY_REDIRECT == statusCode)) - { - Write(szBody); - return Flush(); - } - return TRUE; - } - - // Call this function to append a header to the collection of HTTP headers managed by this object. - // - // szName A nul-teminated string containing the name of the HTTP header. - // - // szValue A nul-teminated string containing the value of the HTTP header. - BOOL AppendHeader(__in LPCSTR szName, __in_opt LPCSTR szValue) throw() - { - ATLASSERT(szName); - BOOL bRet = FALSE; - _ATLTRY - { - bRet = m_headers.Add(szName, szValue); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - return bRet; - } - - // Call this function to add a Set-Cookie header to the collection of HTTP headers managed by this object. - // - // pCookie A pointer to a CCookie object describing the cookie to be sent to the client. - BOOL AppendCookie(__in const CCookie *pCookie) - { - ATLENSURE(pCookie); - return AppendCookie((const CCookie&)*pCookie); - } - - // Call this function to add a Set-Cookie header to the collection of HTTP headers managed by this object. - // - // cookie A reference to a CCookie object describing the cookie to be sent to the client. - BOOL AppendCookie(__in const CCookie& cookie) throw() - { - CHAR szCookie[ATL_MAX_COOKIE_LEN]; - DWORD dwBuffSize = ATL_MAX_COOKIE_LEN; - BOOL bRet = FALSE; - bRet = cookie.Render(szCookie, &dwBuffSize); - if (bRet) - { - _ATLTRY - { - bRet = m_headers.Add("Set-Cookie", szCookie); - } - _ATLCATCHALL() - { - bRet = FALSE; - dwBuffSize = 0; - } - } - - if (!bRet && dwBuffSize > 0 && dwBuffSize+1 > dwBuffSize) //static buffer wasn't big enough. - { - //We'll have to try dynamically allocating it - //allocate a buffer - CAutoVectorPtr sz; - if (sz.Allocate(dwBuffSize+1)) - { - DWORD dwSizeNew = dwBuffSize + 1; - if (cookie.Render(sz, &dwSizeNew)) - { - _ATLTRY - { - bRet = m_headers.Add("Set-Cookie", (const char *) sz); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - } - } - return bRet; - } - - // Call this function to add a Set-Cookie header to the collection of HTTP headers managed by this object. - // - // szName A nul-terminated string containing the name of the cookie to be sent to the client. - // - // szValue A nul-terminated string containing the value of the cookie to be sent to the client. - BOOL AppendCookie(__in LPCSTR szName, __in_opt LPCSTR szValue) throw() - { - ATLASSERT(szName); - BOOL bRet = FALSE; - _ATLTRY - { - CCookie c(szName, szValue); - bRet = AppendCookie(c); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - return bRet; - } - - // Call this function to add a Set-Cookie header that removes a cookie value - // to the collection of HTTP headers managed by this object. - // - // szName A nul-terminated string containing the name of the cookie to be deleted - BOOL DeleteCookie(__in LPCSTR szName) throw() - { - ATLASSERT(szName); - BOOL bRet = FALSE; - _ATLTRY - { - CCookie cookie(szName, ""); - bRet=cookie.SetMaxAge(0); - if(bRet) - { - bRet = AppendCookie(cookie); - } - } - _ATLCATCHALL() - { - bRet = FALSE; - } - return bRet; - - } - - // Call this function to clear the collection of HTTP response headers maintained by this object. - // - // Note that clearing the headers includes removing all cookies associated with the response - // object. Cookies are sent to the client as Set-Cookie HTTP headers. - void ClearHeaders() throw() - { - m_headers.RemoveAll(); - } - - // Call this function to clear theresponse buffer without sending the contents to the client. - // If you need to empty the buffer but you do want the current contents sent to the client, call Flush instead. - void ClearContent() throw() - { - m_strContent.Empty(); - } - - // Call this function to send the current headers associated with this object to the client. - // - // Returns TRUE on success, FALSE on failure. - // - // The response headers are sent to the client using the current status code for the - // response object. See SetStatusCode and GetStatusCode. - BOOL SendHeadersInternal(__in BOOL fKeepConn=FALSE) - { - if (m_bHeadersSent) - return TRUE; - - ATLENSURE(m_spServerContext != NULL); - - CStringA strHeaders; - RenderHeaders(strHeaders); - - BOOL bRet = FALSE; - _ATLTRY - { - if (m_nStatusCode == 200) - { - bRet = m_spServerContext->SendResponseHeader(strHeaders, "200 OK", fKeepConn); - if (bRet) - { - m_bHeadersSent = TRUE; - } - return bRet; - } - - CFixedStringT strStatus; - CDefaultErrorProvider prov; - GetStatusHeader(strStatus, m_nStatusCode, SUBERR_NONE, &prov); - bRet = m_spServerContext->SendResponseHeader(strHeaders, strStatus, fKeepConn); - if (bRet) - { - m_bHeadersSent = TRUE; - } - } - _ATLCATCHALL() - { - bRet = FALSE; - } - return bRet; - } - - // Call this function to get a string containing all the HTTP headers associated with - // this object in a format suitable for sending to a client. - // - // strHeaders A CStringA reference to which will be appended the HTTP headers. - void RenderHeaders(CStringA& strHeaders) throw() - { - _ATLTRY - { - strHeaders.Preallocate(::ATL::AtlMultiplyThrow(m_headers.GetSize(),64)); - for (int i=0; iGetServerVariable("SERVER_PROTOCOL", szProtocol, &dwProtocolLen) && - !strcmp(szProtocol, "HTTP/1.0")) - AppendHeader("Connection", "Keep-Alive"); - Checked::itoa_s(m_strContent.GetLength(), szProtocol, _countof(szProtocol), 10); - AppendHeader("Content-Length", szProtocol); - bRet = SendHeadersInternal(TRUE); - } - else - bRet = SendHeadersInternal(); - } - if (m_bBufferOutput) - { - DWORD dwLen = 0; - - dwLen = m_strContent.GetLength(); - if (dwLen) - { - if (m_bSendOutput && - m_spServerContext->WriteClient((void *) (LPCSTR) m_strContent, &dwLen) != TRUE) - { - m_strContent.Empty(); - return FALSE; - } - m_strContent.Empty(); - } - } - } // _ATLTRY - _ATLCATCHALL() - { - bRet = FALSE; - } - return bRet; - } - - // Call this function to clear the response object of any headers - // and the contents of the buffer. - void ClearResponse() throw() - { - m_strContent.Empty(); - m_headers.RemoveAll(); - } - - BOOL AsyncPrep(__in BOOL fKeepConn=FALSE) throw() - { - ATLASSUME(m_spServerContext != NULL); - - return SendHeadersInternal(fKeepConn); - } - - BOOL AsyncFlush() throw() - { - ATLASSUME(m_spServerContext != NULL); - - BOOL bRet = SendHeadersInternal(); - - if (bRet && m_bBufferOutput) - { - DWORD dwLen = 0; - - dwLen = m_strContent.GetLength(); - if (dwLen) - { - _ATLTRY - { - if (m_spServerContext->AsyncWriteClient((void *) (LPCSTR) m_strContent, &dwLen) != TRUE) - { - bRet = FALSE; - } - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - } - - return bRet; - } - - BOOL TransmitFile(__in HANDLE hFile, __in LPCSTR szContentType="text/plain") throw() - { - ATLASSUME(m_spServerContext != NULL); - ATLASSERT(hFile != NULL && hFile != INVALID_HANDLE_VALUE); - - SetContentType(szContentType); - - if (m_strContent.GetLength()) - if (!Flush()) - return FALSE; - - BOOL bRet = SendHeadersInternal(); - if (bRet) - { - _ATLTRY - { - bRet = m_spServerContext->TransmitFile(hFile, NULL, NULL, NULL, - 0, 0, NULL, 0, NULL, 0, HSE_IO_ASYNC | HSE_IO_NODELAY); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - - return bRet; - } -}; // class CHttpResponse - - - -#define ATLS_FLAG_NONE 0 -#define ATLS_FLAG_ASYNC 1 // handler might do some async handling - -// push_macro/pop_macro doesn't work in a template definition. -#pragma push_macro("new") -#undef new -template -class PerThreadWrapper : public CComObjectNoLock -{ -public: - void *operator new(size_t /*size*/, void *p) throw() - { - return p; - } - - void operator delete(void * /*p*/) throw() - { - } - - STDMETHOD_(ULONG, Release)() throw() - { - ULONG l = InternalRelease(); - if (l == 0) - { - T *pT = static_cast(this); - ATLASSERT(pT->m_spExtension != NULL); - CIsapiWorker *pWorker = pT->m_spExtension->GetThreadWorker(); - ATLASSERT(pWorker); - - delete this; - if(pWorker) - { - HeapFree(pWorker->m_hHeap, HEAP_NO_SERIALIZE, this); - } - } - return l; - } -}; - -template -inline BOOL CreateRequestHandlerSync(__in IIsapiExtension *pExtension, __deref_out_opt IUnknown **ppOut) -{ - ATLENSURE(pExtension); - ATLENSURE(ppOut); - - CIsapiWorker *pWorker = pExtension->GetThreadWorker(); - ATLENSURE(pWorker); - void *pv = HeapAlloc(pWorker->m_hHeap, HEAP_NO_SERIALIZE, sizeof(PerThreadWrapper)); - if (!pv) - return FALSE; - - PerThreadWrapper *pHandler = new(pv) PerThreadWrapper; - *ppOut = static_cast(pHandler); - pHandler->m_spExtension = pExtension; - - (*ppOut)->AddRef(); - - return TRUE; -} -#pragma pop_macro("new") - -#define DECLARE_ASYNC_HANDLER() \ - static DWORD GetHandlerFlags() \ - { \ - return ATLS_FLAG_ASYNC; \ - } \ - DWORD GetAsyncFlags() \ - { \ - return ATLSRV_INIT_USEASYNC; \ - } - -#define DECLARE_ASYNC_HANDLER_EX() \ - static DWORD GetHandlerFlags() \ - { \ - return ATLS_FLAG_ASYNC; \ - } \ - DWORD GetAsyncFlags() \ - { \ - return (ATLSRV_INIT_USEASYNC|ATLSRV_INIT_USEASYNC_EX); \ - } - - -template -class IRequestHandlerImpl : public IRequestHandler -{ -public: - HINSTANCE m_hInstHandler; - CComPtr m_spServiceProvider; - CComPtr m_spServerContext; - CComPtr m_spExtension; - DWORD m_dwAsyncFlags; - - IRequestHandlerImpl() - :m_hInstHandler(NULL) - { - m_dwAsyncFlags = 0; - } - virtual ~IRequestHandlerImpl() - { - } - - HTTP_CODE GetFlags(__out DWORD *pdwStatus) - { - ATLASSERT(pdwStatus); - THandler *pT = static_cast(this); - - *pdwStatus = pT->GetAsyncFlags(); - if (pT->CachePage()) - *pdwStatus |= ATLSRV_INIT_USECACHE; - -#ifdef _DEBUG - if (*pdwStatus & (ATLSRV_INIT_USEASYNC|ATLSRV_INIT_USEASYNC_EX)) - ATLASSERT(pT->GetHandlerFlags() & ATLS_FLAG_ASYNC); -#endif - - return HTTP_SUCCESS; - } - - HTTP_CODE InitializeHandler(__in AtlServerRequest *pRequestInfo, __in IServiceProvider *pProvider) - { - ATLENSURE(pRequestInfo != NULL); - ATLENSURE(pProvider != NULL); - ATLENSURE(pRequestInfo->hInstDll != NULL); - ATLENSURE(pRequestInfo->pServerContext != NULL); - - // Initialize our internal references to required services - m_hInstHandler = pRequestInfo->hInstDll; - m_spServiceProvider = pProvider; - m_spServerContext = pRequestInfo->pServerContext; - - return HTTP_SUCCESS; - } - - HTTP_CODE InitializeChild(__in AtlServerRequest *pRequestInfo, __in IServiceProvider *pProvider, IHttpRequestLookup * /*pLookup*/) - { - return InitializeHandler(pRequestInfo, pProvider); - } - - void UninitializeHandler() - { - } - - HTTP_CODE HandleRequest( - AtlServerRequest* /*pRequestInfo*/, - IServiceProvider* /*pServiceProvider*/) - { - return HTTP_SUCCESS; - } - - DWORD GetAsyncFlags() - { - return m_dwAsyncFlags; - } - - void SetAsyncFlags(__in DWORD dwAsyncFlags) - { - ATLASSERT((dwAsyncFlags & ~(ATLSRV_INIT_USEASYNC|ATLSRV_INIT_USEASYNC_EX)) == 0); - m_dwAsyncFlags = dwAsyncFlags; - } - - BOOL CachePage() - { - return FALSE; - } - - static DWORD GetHandlerFlags() - { - return ATLS_FLAG_NONE; - } - - // Used to create new instance of this object. A pointer to this - // function is stored in the handler map in user's code. - static BOOL CreateRequestHandler(__in IIsapiExtension *pExtension, __deref_out_opt IUnknown **ppOut) - { - ATLASSERT(ppOut != NULL); - if (ppOut == NULL) - return false; - - *ppOut = NULL; - - if (THandler::GetHandlerFlags() & ATLS_FLAG_ASYNC) - { - THandler *pHandler = NULL; - ATLTRY(pHandler = new CComObjectNoLock); - if (!pHandler) - return FALSE; - *ppOut = static_cast(pHandler); - pHandler->m_spExtension = pExtension; - (*ppOut)->AddRef(); - } - else - { - if (!CreateRequestHandlerSync(pExtension, ppOut)) - return FALSE; - } - - return TRUE; - } - - // Used to initialize the class - // function is stored in the handler map in user's code. - static BOOL InitRequestHandlerClass(IHttpServerContext *pContext, IIsapiExtension *pExt) - { - (pContext); // unused - (pExt); // unused - return TRUE; - } - - // Used to uninitialize the class - // function is stored in the handler map in user's code. - static void UninitRequestHandlerClass() - { - return; - } -}; - -struct CRequestStats -{ - long m_lTotalRequests; - long m_lFailedRequests; - __int64 m_liTotalResponseTime; - long m_lAvgResponseTime; - long m_lCurrWaiting; - long m_lMaxWaiting; - long m_lActiveThreads; - - CRequestStats() throw() - { - m_lTotalRequests = 0; - m_lFailedRequests = 0; - m_liTotalResponseTime = 0; - m_lAvgResponseTime = 0; - m_lCurrWaiting = 0; - m_lMaxWaiting = 0; - m_lActiveThreads = 0; - } - - void RequestHandled(__in AtlServerRequest *pRequestInfo, __in BOOL bSuccess) - { - ATLENSURE(pRequestInfo); - - InterlockedIncrement(&m_lTotalRequests); - if (!bSuccess) - InterlockedIncrement(&m_lFailedRequests); - - long lTicks; - -#ifndef ATL_NO_MMSYS - lTicks = (long) (timeGetTime() - pRequestInfo->dwStartTicks); -#else - lTicks = (long) (GetTickCount() - pRequestInfo->dwStartTicks); -#endif - __int64 liTotalResponseTime = Add64(&m_liTotalResponseTime, lTicks); - long lAv = (long) (liTotalResponseTime / m_lTotalRequests); - InterlockedExchange(&m_lAvgResponseTime, lAv); - - InterlockedDecrement(&m_lActiveThreads); - } - - long GetTotalRequests() throw() - { - return m_lTotalRequests; - } - - long GetFailedRequests() throw() - { - return m_lFailedRequests; - } - - long GetAvgResponseTime() throw() - { - return m_lAvgResponseTime; - } - - void OnRequestReceived() throw() - { - long nCurrWaiting = InterlockedIncrement(&m_lCurrWaiting); - AtlInterlockedUpdateMax(nCurrWaiting, &m_lMaxWaiting); - } - - void OnRequestDequeued() throw() - { - InterlockedDecrement(&m_lCurrWaiting); - InterlockedIncrement(&m_lActiveThreads); - } - - long GetCurrWaiting() throw() - { - return m_lCurrWaiting; - } - - long GetMaxWaiting() throw() - { - return m_lMaxWaiting; - } - - long GetActiveThreads() throw() - { - return m_lActiveThreads; - } - -private: - // not actually atomic, but it will add safely. - - // the returned value is not 100% guaranteed to be - // correct, but should be correct more often than - // just reading the __int64 - // the 2 cases where the return value will not be - // a valid result value from an add are: - // * multiple threads wrap the low part in rapid succession - // * different threads are adding values with different signs - - // this is good enough for our use in RequestHandled - - // we always add positive values and we shouldn't wrap 32-bits often - inline __int64 Add64(__inout __int64* pn, long nAdd) - { - ATLENSURE(pn != NULL); - -#if defined(_WIN64) && defined(_M_CEE) - - // Use System::Threading::Interlocked::Add because InterlockedExchangeAdd is an intrisinc not supported in managed code - // with 64bits compilers. - // Also, System::Threading::Interlocked::Add support 64bits operands. - return System::Threading::Interlocked::Add(*pn, nAdd); - -#else - - long* pnLow = (long*)(LPBYTE(pn) + offsetof(LARGE_INTEGER, LowPart)); - long* pnHigh = (long*)(LPBYTE(pn) + offsetof(LARGE_INTEGER, HighPart)); - - long nOrigLow = InterlockedExchangeAdd(pnLow, nAdd); - long nNewLow = nOrigLow + nAdd; - long nNewHigh = *pnHigh; - if (nAdd > 0 && nNewLow < nOrigLow) - nNewHigh = InterlockedIncrement(pnHigh); - else if (nAdd < 0 && nNewLow > nOrigLow) - nNewHigh = InterlockedDecrement(pnHigh); - - LARGE_INTEGER li; - li.LowPart = nNewLow; - li.HighPart = nNewHigh; - return li.QuadPart; - -#endif - } -}; - -class CStdRequestStats : public CRequestStats -{ - -public: - HRESULT Initialize() throw() - { - return S_OK; - } - - void Uninitialize() throw() - { - } -}; - -#define PERF_REQUEST_OBJECT 100 - -struct CPerfRequestStatObject : public CPerfObject, - public CRequestStats -{ - DECLARE_PERF_CATEGORY_EX(PERF_REQUEST_OBJECT, IDS_PERFMON_REQUEST, IDS_PERFMON_REQUEST_HELP, PERF_DETAIL_NOVICE, 0, sizeof(CPerfRequestStatObject), MAX_PATH, -1); - BEGIN_COUNTER_MAP(CPerfRequestStatObject) - DEFINE_COUNTER(m_lTotalRequests, IDS_PERFMON_REQUEST_TOTAL, IDS_PERFMON_REQUEST_TOTAL_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_lFailedRequests, IDS_PERFMON_REQUEST_FAILED, IDS_PERFMON_REQUEST_FAILED_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_lTotalRequests, IDS_PERFMON_REQUEST_RATE, IDS_PERFMON_REQUEST_RATE_HELP, PERF_COUNTER_COUNTER, -1) - DEFINE_COUNTER(m_lAvgResponseTime, IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME, IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_lCurrWaiting, IDS_PERFMON_REQUEST_CURR_WAITING, IDS_PERFMON_REQUEST_CURR_WAITING_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_lMaxWaiting, IDS_PERFMON_REQUEST_MAX_WAITING, IDS_PERFMON_REQUEST_MAX_WAITING_HELP, PERF_COUNTER_RAWCOUNT, -1) - DEFINE_COUNTER(m_lActiveThreads, IDS_PERFMON_REQUEST_ACTIVE_THREADS, IDS_PERFMON_REQUEST_ACTIVE_THREADS, PERF_COUNTER_RAWCOUNT, -1) - END_COUNTER_MAP() -}; - -class CRequestPerfMon : public CPerfMon -{ -public: - BEGIN_PERF_MAP(_T("ATL Server:Request")) - CHAIN_PERF_CATEGORY(CPerfRequestStatObject) - END_PERF_MAP() -}; - -class CPerfMonRequestStats -{ - CRequestPerfMon m_PerfMon; - CPerfRequestStatObject * m_pPerfObjectInstance; - CPerfRequestStatObject * m_pPerfObjectTotal; - -public: - CPerfMonRequestStats() throw() - { - m_pPerfObjectInstance = NULL; - m_pPerfObjectTotal = NULL; - } - - HRESULT Initialize() throw() - { - HRESULT hr; - - m_pPerfObjectInstance = NULL; - m_pPerfObjectTotal = NULL; - - hr = m_PerfMon.Initialize(); - if (SUCCEEDED(hr)) - { - CPerfLock lock(&m_PerfMon); - if (FAILED(hr = lock.GetStatus())) - { - return hr; - } - - HINSTANCE hInst = _AtlBaseModule.GetModuleInstance(); - WCHAR szName[MAX_PATH]; - if (GetModuleFileNameW(hInst, szName, MAX_PATH) == 0) - { - return E_FAIL; - } - szName[MAX_PATH-1] = 0; - - hr = m_PerfMon.CreateInstanceByName(L"_Total", &m_pPerfObjectTotal); - if (FAILED(hr)) - { - return hr; - } - - hr = m_PerfMon.CreateInstanceByName(szName, &m_pPerfObjectInstance); - if (FAILED(hr)) - { - m_PerfMon.ReleaseInstance(m_pPerfObjectTotal); - m_pPerfObjectTotal = NULL; - return hr; - } - } - - return hr; - } - - void Uninitialize() throw() - { - if (m_pPerfObjectInstance != NULL) - m_PerfMon.ReleaseInstance(m_pPerfObjectInstance); - if (m_pPerfObjectTotal != NULL) - m_PerfMon.ReleaseInstance(m_pPerfObjectTotal); - - m_pPerfObjectInstance = NULL; - m_pPerfObjectTotal = NULL; - - m_PerfMon.UnInitialize(); - } - - void RequestHandled(__in AtlServerRequest *pRequestInfo, __in BOOL bSuccess) throw() - { - if (m_pPerfObjectInstance != NULL) - m_pPerfObjectInstance->RequestHandled(pRequestInfo, bSuccess); - if (m_pPerfObjectTotal != NULL) - m_pPerfObjectTotal->RequestHandled(pRequestInfo, bSuccess); - } - - long GetTotalRequests() throw() - { - if (m_pPerfObjectInstance != NULL) - return m_pPerfObjectInstance->GetTotalRequests(); - - return 0; - } - - long GetFailedRequests() throw() - { - if (m_pPerfObjectInstance != NULL) - return m_pPerfObjectInstance->GetFailedRequests(); - - return 0; - } - - long GetAvgResponseTime() throw() - { - if (m_pPerfObjectInstance != NULL) - return m_pPerfObjectInstance->GetAvgResponseTime(); - - return 0; - } - - void OnRequestReceived() throw() - { - if (m_pPerfObjectInstance != NULL) - m_pPerfObjectInstance->OnRequestReceived(); - if (m_pPerfObjectTotal != NULL) - m_pPerfObjectTotal->OnRequestReceived(); - } - - void OnRequestDequeued() throw() - { - if (m_pPerfObjectInstance != NULL) - m_pPerfObjectInstance->OnRequestDequeued(); - if (m_pPerfObjectTotal != NULL) - m_pPerfObjectTotal->OnRequestDequeued(); - } - - long GetCurrWaiting() throw() - { - if (m_pPerfObjectInstance != NULL) - return m_pPerfObjectInstance->GetCurrWaiting(); - - return 0; - } - - long GetMaxWaiting() throw() - { - if (m_pPerfObjectInstance != NULL) - return m_pPerfObjectInstance->GetMaxWaiting(); - - return 0; - } - - long GetActiveThreads() throw() - { - if (m_pPerfObjectInstance != NULL) - return m_pPerfObjectInstance->GetActiveThreads(); - - return 0; - } -}; - -class CNoRequestStats -{ -protected: - -public: - - HRESULT Initialize() throw() - { - return S_OK; - } - - void Uninitialize() throw() - { - } - - void RequestHandled(AtlServerRequest * /*pRequestInfo*/, BOOL /*bSuccess*/) throw() - { - } - - long GetTotalRequests() throw() - { - return 0; - } - - long GetFailedRequests() throw() - { - return 0; - } - - long GetAvgResponseTime() throw() - { - return 0; - } - - void OnRequestReceived() throw() - { - } - - void OnRequestDequeued() throw() - { - } - - long GetCurrWaiting() throw() - { - return 0; - } - - long GetMaxWaiting() throw() - { - return 0; - } - - long GetActiveThreads() throw() - { - return 0; - } -}; - -struct ATLServerDllInfo -{ - GETATLHANDLERBYNAME pfnGetHandler; - UNINITIALIZEATLHANDLERS pfnUninitHandlers; - INITIALIZEATLHANDLERS pfnInitHandlers; - IIsapiExtension *pExtension; - IHttpServerContext *pContext; -}; - -class CDllCachePeer -{ -public: - struct DllInfo : public ATLServerDllInfo - { - DllInfo& operator=(__in const DllInfo& right) throw() - { - if (this != &right) - { - pfnGetHandler = right.pfnGetHandler; - pfnUninitHandlers = right.pfnUninitHandlers; - pfnInitHandlers = right.pfnInitHandlers; - pExtension = right.pExtension; - pContext = right.pContext; - } - return *this; - } - }; - - BOOL Add(__in HINSTANCE hInst, __out DllInfo *pInfo) throw(...) - { - ATLENSURE(pInfo!=NULL); - pInfo->pfnInitHandlers = (INITIALIZEATLHANDLERS) GetProcAddress(hInst, ATLS_FUNCID_INITIALIZEHANDLERS); - - pInfo->pfnGetHandler = (GETATLHANDLERBYNAME) GetProcAddress(hInst, ATLS_FUNCID_GETATLHANDLERBYNAME); - if (!pInfo->pfnGetHandler) - return FALSE; - - pInfo->pfnUninitHandlers = (UNINITIALIZEATLHANDLERS) GetProcAddress(hInst, ATLS_FUNCID_UNINITIALIZEHANDLERS); - - if (pInfo->pfnInitHandlers) - { - pInfo->pfnInitHandlers(pInfo->pContext, pInfo->pExtension); - pInfo->pContext = NULL; // won't be valid after this call - } - - return TRUE; - } - - void Remove(HINSTANCE /*hInst*/, __in DllInfo *pInfo) throw(...) - { - ATLENSURE(pInfo!=NULL); - if (pInfo->pfnUninitHandlers) - (*pInfo->pfnUninitHandlers)(); - } - -}; - -inline bool operator==(__in const CDllCachePeer::DllInfo& left, __in const CDllCachePeer::DllInfo& right) throw() -{ - return ( (left.pfnGetHandler == right.pfnGetHandler) && - (left.pfnUninitHandlers == right.pfnUninitHandlers) && - (left.pfnInitHandlers == right.pfnInitHandlers) && - (left.pExtension == right.pExtension) && - (left.pContext == right.pContext) - ); -} - - - -// Helper function to impersonate the client -// on the current thread -inline BOOL AtlImpersonateClient(__in IHttpServerContext *pServerContext) -{ - ATLENSURE(pServerContext); - - // impersonate the calling client on the current thread - HANDLE hToken; - _ATLTRY - { - if (!pServerContext->GetImpersonationToken(&hToken)) - return FALSE; - } - _ATLCATCHALL() - { - return FALSE; - } - - if (!SetThreadToken(NULL, hToken)) - return FALSE; - return TRUE; -} - -// Helper class to set the thread impersonation token -// This is mainly used internally to ensure that we -// don't forget to revert to the process impersonation -// level -class CSetThreadToken -{ -public: - CSetThreadToken() : m_bShouldRevert(FALSE) {} - - BOOL Initialize(__in AtlServerRequest *pRequestInfo) - { - ATLENSURE(pRequestInfo); - m_bShouldRevert = AtlImpersonateClient(pRequestInfo->pServerContext); - return m_bShouldRevert; - } - - ~CSetThreadToken() throw() - { - if( m_bShouldRevert && !RevertToSelf() ) - { - _AtlRaiseException( (DWORD)EXCEPTION_ACCESS_VIOLATION ); - } - } -protected: - BOOL m_bShouldRevert; -}; - - -// push_macro/pop_macro doesn't work in a template definition. -#pragma push_macro("new") -#undef new - - -//Base is the user's class that derives from CComObjectRoot and whatever -//interfaces the user wants to support on the object -template -class _CComObjectHeapNoLock : public Base -{ - public: - typedef Base _BaseClass; - HANDLE m_hHeap; - - _CComObjectHeapNoLock(void* = NULL, HANDLE hHeap = NULL) - { - m_hHeap = hHeap; - } - // Set refcount to -(LONG_MAX/2) to protect destruction and - // also catch mismatched Release in debug builds - ~_CComObjectHeapNoLock() - { - m_dwRef = -(LONG_MAX/2); - FinalRelease(); -#ifdef _ATL_DEBUG_INTERFACES - _AtlDebugInterfacesModule.DeleteNonAddRefThunk(_GetRawUnknown()); -#endif - } - - //If InternalAddRef or InternalRelease is undefined then your class - //doesn't derive from CComObjectRoot - STDMETHOD_(ULONG, AddRef)() throw() {return InternalAddRef();} - STDMETHOD_(ULONG, Release)() throw() - { - ULONG l = InternalRelease(); - if (l == 0) - { - HANDLE hHeap = m_hHeap;; - this->~_CComObjectHeapNoLock(); - if (hHeap != NULL) - { - HeapFree(hHeap, 0, this); - } - } - return l; - } - //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP - STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject) throw() - {return _InternalQueryInterface(iid, ppvObject);} - - static HRESULT WINAPI CreateInstance(_CComObjectHeapNoLock** pp, HANDLE hHeap) throw(); -}; - - - -template -HRESULT WINAPI _CComObjectHeapNoLock::CreateInstance(__deref_out _CComObjectHeapNoLock** pp, __in HANDLE hHeap) throw() -{ - ATLASSERT(pp != NULL); - if (pp == NULL) - return E_POINTER; - *pp = NULL; - - HRESULT hRes = E_OUTOFMEMORY; - // Allocate a fixed block size to avoid fragmentation - void *pv = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, - __max(sizeof(AtlServerRequest), sizeof(_CComObjectHeapNoLock))); - if (pv == NULL) - { - return hRes; - } -#pragma warning(push) -#pragma warning(disable: 6280) - /* prefast noise VSW 493229 */ - _CComObjectHeapNoLock* p = new(pv) _CComObjectHeapNoLock(NULL, hHeap); -#pragma warning(pop) - - p->SetVoid(NULL); - p->InternalFinalConstructAddRef(); - hRes = p->_AtlInitialConstruct(); - if (SUCCEEDED(hRes)) - hRes = p->FinalConstruct(); - if (SUCCEEDED(hRes)) - hRes = p->_AtlFinalConstruct(); - p->InternalFinalConstructRelease(); - if (hRes != S_OK) - { - p->~_CComObjectHeapNoLock(); -#pragma warning(push) -#pragma warning(disable: 6280) - /* prefast noise VSW 493229 */ - HeapFree(hHeap, 0, p); -#pragma warning(pop) - p = NULL; - } - *pp = p; - return hRes; -} - -inline CServerContext* CreateServerContext(__in HANDLE hRequestHeap) throw() -{ - _CComObjectHeapNoLock* pContext; - _CComObjectHeapNoLock::CreateInstance(&pContext, hRequestHeap); - return pContext; -} -#pragma pop_macro("new") - -// _AtlGetHandlerName -// get handler name from stencil file. Ignore all server side comments -// szFileName - the file from which to extract the handler name -// szHandlerName - buffer into which handler name will be copied, -// it is assumed to be of size MAX_PATH+ATL_MAX_HANDLER_NAME+2 -inline HTTP_CODE _AtlGetHandlerName(__in LPCSTR szFileName, __out_ecount(MAX_PATH+ATL_MAX_HANDLER_NAME+2) LPSTR szHandlerName) -{ - ATLASSERT(szFileName); - ATLENSURE(szHandlerName); - - szHandlerName[0] = '\0'; - CAtlFile cfFile; - HRESULT hr; - - _ATLTRY - { - hr = cfFile.Create(CA2CTEX(szFileName), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING); - if (FAILED(hr) || cfFile.m_h == NULL || GetFileType(cfFile.m_h) != FILE_TYPE_DISK) - { - if (hr == AtlHresultFromWin32(ERROR_FILE_NOT_FOUND)) - return HTTP_NOT_FOUND; - else if (hr == AtlHresultFromWin32(ERROR_ACCESS_DENIED)) - return HTTP_UNAUTHORIZED; - else - return AtlsHttpError(500, IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL); - } - } - _ATLCATCHALL() - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); // CA2CTEX threw - } - - HTTP_CODE hcErr = HTTP_SUCCESS; - DWORD dwRead=0; - LPCSTR szHandler = "handler"; - LPCSTR pszHandlerPos = NULL; - LPSTR pszHandlerName = szHandlerName; - char szBuf[4097]; - LPSTR szCurly = NULL; - LPSTR pszBuf = NULL; - bool bInQuote = false; - - // state: - // 0 = default/unknown - // 1 = have "{" - // 2 = have "{{" -- skip spaces - // 3 = have "{{" -- check "handler" - // 4 = have "handler" -- skip spaces - // 5 = have "handler" -- get name - // 6 = scan until first '}' - // 7 = better be '}' - // 8 = done - int nState = 0; - - do - { - hr = cfFile.Read(szBuf, _countof(szBuf)-1, dwRead); - if (hr != S_OK) - { - return AtlsHttpError(500, ISE_SUBERR_READFILEFAIL); // failed reading - } - - szBuf[dwRead] = '\0'; - pszBuf = szBuf; - - while (*pszBuf && nState != 8) - { - switch (nState) - { - case 0: - // 0 = default/unknown - - // look for the first curly - szCurly = strchr(pszBuf, '{'); - if (!szCurly) - { - // skip to the end of the buffer - pszBuf = szBuf+dwRead-1; - } - else - { - pszBuf = szCurly; - nState = 1; - } - break; - case 1: - // 1 = have "{" - if (*pszBuf == '{') - { - nState = 2; - } - else - { - nState = 0; // if the next character is not a '{', start over - } - break; - case 2: - if (!isspace(static_cast(*pszBuf))) - { - pszHandlerPos = szHandler; - pszBuf--; - nState = 3; - } - break; - case 3: - // 3 = partial handler "h..." - if (*pszBuf != *pszHandlerPos) - { - // not a handler, skip tag - nState = 6; - } - else - { - pszHandlerPos++; - if (!*pszHandlerPos) // at the end of the "handler" part - nState = 4; - } - break; - case 4: - // 4 = have "handler" -- skip spaces - if (!isspace(static_cast(*pszBuf))) - { - if (*pszBuf == '\"') - { - bInQuote = true; - } - else - { - pszBuf--; - } - nState = 5; - } - break; - case 5: - // 5 = have "handler" -- get name - if (isspace(static_cast(*pszBuf)) && !bInQuote) - { - if (*(pszHandlerName-1) != '/') - { - // end of the name -- jump to getting the first '}' - nState = 6; - } - else - { - nState = 4; - } - } - else if (*pszBuf == '}') - { - // end of the name -- jump to getting the second '}' - nState = 7; - } - else if (*pszBuf == '\"') - { - if (bInQuote) - { - bInQuote = false; - } - else - { - hcErr = HTTP_FAIL; - nState = 8; - } - } - else - { - // ensure we don't overwrite the buffer - if (pszHandlerName-szHandlerName >= MAX_PATH+ATL_MAX_HANDLER_NAME_LEN+1) - { - hcErr = HTTP_FAIL; - nState = 8; - } - else - { - *pszHandlerName++ = *pszBuf; - } - } - break; - case 6: - // 6 = scan until first '}' - if (*pszBuf == '}') - nState = 7; - break; - case 7: - // 7 = better be '}' - if (*pszBuf != '}') - { - hcErr = AtlsHttpError(500, ISE_SUBERR_BAD_HANDLER_TAG); - nState = 8; - } - if (*szHandlerName) - nState = 8; - else - nState = 0; - break; - default: - ATLASSERT(FALSE); - return HTTP_INTERNAL_SERVER_ERROR; - } - - pszBuf++; - } - } while (dwRead != 0 && nState != 8); - - *pszHandlerName = '\0'; - - return hcErr; -} - -// _AtlCrackHandler cracks a request path of the form dll_path/handler_name into its -// constituent parts -// szHandlerDllName - the full handler path of the form "dll_path/handler_name" -// szDllPath - the DLL path (should be of length MAX_PATH) -// szHandlerName - the handler name (should be of length ATL_MAX_HANDLER_NAME_LEN+1) -// -inline BOOL _AtlCrackHandler( - __in_z LPCSTR szHandlerDllName, - __out_ecount_part(*pdwszDllPathLen,*pdwszDllPathLen) LPSTR szDllPath, - __inout LPDWORD pdwDllPathLen, - __out_ecount_part(*pdwHandlerNameLen,*pdwHandlerNameLen) LPSTR szHandlerName, - __inout LPDWORD pdwHandlerNameLen) -{ - ATLENSURE( szHandlerDllName != NULL ); - ATLASSERT( szDllPath != NULL ); - ATLENSURE( pdwDllPathLen != NULL ); - ATLASSERT( szHandlerName != NULL ); - ATLASSERT( pdwHandlerNameLen != NULL ); - - BOOL bRet = TRUE; - - // skip leading spaces - while (*szHandlerDllName && isspace(static_cast(*szHandlerDllName))) - ++szHandlerDllName; - - // get the handler name - LPCSTR szSlash = strchr(szHandlerDllName, '/'); - LPCSTR szEnd = NULL; - LPCSTR szSlashEnd = NULL; - - // if it is of the form / - if (szSlash) - { - szEnd = szSlash; - - // skip trailing spaces on - while (szEnd>szHandlerDllName && isspace(static_cast(*(szEnd-1)))) - --szEnd; - - szSlash++; - // skip leading whitespace - while (*szSlash && isspace(static_cast(*szSlash))) - szSlash++; - - // right trim szSlash; - szSlashEnd = szSlash; - while (*szSlashEnd && !isspace(static_cast(*szSlashEnd))) - szSlashEnd++; - } - else // only the - { - szSlash = ATL_HANDLER_NAME_DEFAULT; - szSlashEnd = szSlash+sizeof(ATL_HANDLER_NAME_DEFAULT)-1; - - // do it this way to handle paths with spaces - // (e.g. "some path\subdirectory one\subdirectory two\dll_name.dll") - szEnd = szHandlerDllName+strlen(szHandlerDllName); - - // skip trailing spaces - while (szEnd>szHandlerDllName && isspace(static_cast(*(szEnd-1)))) - --szEnd; - } - - // if the dll path is quoted, strip the quotes - if (*szHandlerDllName == '\"' && *(szEnd-1) == '\"' && szEnd > szHandlerDllName+2) - { - szHandlerDllName++; - szEnd--; - } - - if (*pdwDllPathLen > (DWORD)(szEnd-szHandlerDllName) && (szEnd-szHandlerDllName >= 0)) - { - Checked::memcpy_s(szDllPath, *pdwDllPathLen, szHandlerDllName, szEnd-szHandlerDllName); - szDllPath[szEnd-szHandlerDllName] = '\0'; - *pdwDllPathLen = (DWORD)(szEnd-szHandlerDllName); - } - else - { - *pdwDllPathLen = (DWORD)(szEnd-szHandlerDllName)+1; - bRet = FALSE; - } - - if (*pdwHandlerNameLen > (DWORD)(szSlashEnd-szSlash) && (szSlashEnd-szSlash >= 0)) - { - Checked::memcpy_s(szHandlerName, *pdwHandlerNameLen, szSlash, (szSlashEnd-szSlash)); - szHandlerName[szSlashEnd-szSlash] = '\0'; - *pdwHandlerNameLen = (DWORD)(szSlashEnd-szSlash); - } - else - { - *pdwHandlerNameLen = (DWORD)(szSlashEnd-szSlash)+1; - bRet = FALSE; - } - - return bRet; -} - -inline __checkReturn __success(return==HTTP_SUCCESS) HTTP_CODE _AtlLoadRequestHandler( - __in LPCSTR szDllPath, - __in LPCSTR szHandlerName, - __in IHttpServerContext *pServerContext, - __out HINSTANCE *phInstance, - __deref_out_opt IRequestHandler **ppHandler, - __in IIsapiExtension *pExtension, - __in IDllCache *pDllCache) throw(...) -{ - ATLENSURE(phInstance!=NULL); - ATLENSURE(ppHandler!=NULL); - ATLENSURE(pDllCache!=NULL); - *phInstance = NULL; - *ppHandler = NULL; - - ATLServerDllInfo DllInfo; - DllInfo.pExtension = pExtension; - DllInfo.pContext = pServerContext; - if (!IsFullPathA(szDllPath)) - { - CHAR szFileName[MAX_PATH]; - if (!GetScriptFullFileName(szDllPath, szFileName, pServerContext)) - { - return HTTP_FAIL; - } - - *phInstance = pDllCache->Load(szFileName, (void *)&DllInfo); - } - else - { - *phInstance = pDllCache->Load(szDllPath, (void *)&DllInfo); - } - if (!*phInstance) - { - ATLTRACE( "LoadLibrary failed: '%s' with error: %d\r\n", szDllPath, GetLastError() ); - return AtlsHttpError(500, ISE_SUBERR_LOADLIB); - } - - CComPtr spUnk; - - if (!DllInfo.pfnGetHandler || - !DllInfo.pfnGetHandler(szHandlerName, pExtension, &spUnk) || - FAILED(spUnk->QueryInterface(ppHandler))) - { - pDllCache->Free(*phInstance); - *phInstance = NULL; - return AtlsHttpError(500, ISE_SUBERR_HANDLER_NOT_FOUND); - } - - return HTTP_SUCCESS; -} // _AtlLoadRequestHandler - - -class CTransferServerContext : public CComObjectRootEx, - public CWrappedServerContext -{ -public: - char m_szFileName[MAX_PATH]; - char m_szQueryString[ATL_URL_MAX_PATH_LENGTH+1]; - CStringA m_strUrl; - IWriteStream *m_pStream; - - BEGIN_COM_MAP(CTransferServerContext) - COM_INTERFACE_ENTRY(IHttpServerContext) - END_COM_MAP() - - CTransferServerContext() throw() - { - m_pStream = NULL; - } - - BOOL Initialize(__in CTransferServerContext *pOtherContext) - { - ATLENSURE(pOtherContext!=NULL); - return Initialize(pOtherContext->m_strUrl, pOtherContext->m_pStream, pOtherContext->m_spParent); - } - - BOOL Initialize(__in LPCSTR szUrl, __in IWriteStream *pStream, __in IHttpServerContext *pParent) throw() - { - m_pStream = pStream; - m_spParent = pParent; - - _ATLTRY - { - m_strUrl = szUrl; // we store the URL in case we need to initialize another context from this context - } - _ATLCATCHALL() - { - return FALSE; - } - - long nUrlLen = m_strUrl.GetLength(); - m_szFileName[0] = '\0'; - - if (!IsFullPathA(szUrl)) - { - DWORD dwLen = MAX_PATH; - BOOL bRet = TRUE; - _ATLTRY - { - bRet = m_spParent->GetServerVariable( - "APPL_PHYSICAL_PATH", - m_szFileName, - &dwLen); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - - if (!bRet) - { - return bRet; - } - } - - // check for query params - LPCSTR szMark = strchr(szUrl, '?'); - if (szMark) - { - size_t nPathLen = szMark - szUrl; - size_t nLen; - - if ((nPathLen >= 0) && (nPathLen < MAX_PATH)) - { - nLen = strlen(m_szFileName) + nPathLen; - if (nLen < MAX_PATH) - { -#pragma warning(push) -#pragma warning(disable: 22008) - /* Prefast false warning about unbound nPathLen in the below fragment - - we already have necessary checks few lines above - */ - if (m_szFileName[0]) - { - Checked::strcat_s(m_szFileName, MAX_PATH-nLen, szUrl); - } - else - { - Checked::memcpy_s(m_szFileName, MAX_PATH, szUrl, nPathLen); - m_szFileName[nPathLen] = '\0'; - } -#pragma warning(pop) - } - else - { - return FALSE; // path would overwrite buffer - } - } - else - { - return FALSE; // path would overwrite buffer - } - - // save query params - nLen = strlen(szMark + 1); - if (nLen < ATL_URL_MAX_PATH_LENGTH) - { - Checked::strcpy_s(m_szQueryString, ATL_URL_MAX_PATH_LENGTH, szMark+1); - } - else - { - return FALSE; // url would overwrite buffer - } - } - else - { - // no query string - size_t nLen = strlen(m_szFileName) + nUrlLen; - if (nLen < MAX_PATH) - { - if (m_szFileName[0]) - { - Checked::strcat_s(m_szFileName, MAX_PATH-nLen, szUrl); - } - else - { - Checked::strcpy_s(m_szFileName, MAX_PATH, szUrl); - } - } - else - { - return FALSE; // path would be too long - } - m_szQueryString[0] = '\0'; - } - - return TRUE; - } - BOOL WriteClient(__in_bcount(*pdwBytes) void *pvBuffer, __inout DWORD *pdwBytes) - { - ATLENSURE(m_pStream != NULL); - - HRESULT hr = S_OK; - _ATLTRY - { - m_pStream->WriteStream((LPCSTR) pvBuffer, *pdwBytes, pdwBytes); - } - _ATLCATCHALL() - { - return FALSE; - } - - return SUCCEEDED(hr); - } - - LPCSTR GetQueryString() - { - ATLASSUME(m_spParent); - return m_szQueryString; - } - - LPCSTR GetScriptPathTranslated() - { - ATLASSUME(m_spParent); - return m_szFileName; - } - - LPCSTR GetPathTranslated() - { - ATLASSUME(m_spParent); - return m_szFileName; - } - - // Asynchronous writes will not work properly in a child handler - BOOL AsyncWriteClient(void * /*pvBuffer*/, DWORD * /*pdwBytes*/) - { - ATLASSERT(FALSE); - return FALSE; - } - - // These next few methods are to protect against attempting to parse form data twice - // We tell the new handler that it was a GET request - LPCSTR GetRequestMethod() - { - ATLASSUME(m_spParent); - return "GET"; - } - - // The handler should not query these methods -- they are only useful if attempting to - // parse form data, which is not allowed in child handlers. - BOOL ReadClient(void * /*pvBuffer*/, DWORD * /*pdwSize*/) - { - return FALSE; - } - - BOOL AsyncReadClient(void * /*pvBuffer*/, DWORD * /*pdwSize*/) - { - return FALSE; - } - - DWORD GetTotalBytes() - { - ATLASSERT(FALSE); - return 0; - } - - DWORD GetAvailableBytes() - { - ATLASSERT(FALSE); - return 0; - } - - BYTE *GetAvailableData() - { - ATLASSERT(FALSE); - return NULL; - } - - LPCSTR GetContentType() - { - ATLASSERT(FALSE); - return NULL; - } -}; - -class CAllocContextBase -{ -public: - virtual HTTP_CODE Alloc(IHttpServerContext **ppNewContext) = 0; -}; - -ATL_NOINLINE inline HTTP_CODE _AtlRenderInclude( - __in IHttpServerContext *pServerContextNew, - __in LPCSTR szFileName, - __in LPCSTR szQueryParams, - __in WORD wCodePage, - __in CAllocContextBase *pAllocContext, - __in IServiceProvider *pServiceProvider, - __in_opt IHttpRequestLookup *pLookup, - __inout_opt CStencilState* pState = NULL) -{ - ATLENSURE(pServiceProvider!=NULL); - AtlServerRequest* pRequestInfo = NULL; - HTTP_CODE hcErr = HTTP_SUCCESS; - - // get a pointer to the ISAPI extension - CComPtr spExtension; - if (S_OK != pServiceProvider->QueryInterface(&spExtension) || - !spExtension) - { - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - } - - // get a pointer to the extension's dll cache - CComPtr spDllCache; - if (S_OK != pServiceProvider->QueryService(__uuidof(IDllCache), - __uuidof(IDllCache), - (void**)&spDllCache) || - !spDllCache) - { - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - } - -#ifdef _DEBUG - bool bAsyncAllowed = false; -#endif - if (pState && pState->pIncludeInfo) - { - pRequestInfo = pState->pIncludeInfo; - pState->pIncludeInfo = NULL; -#ifdef _DEBUG - bAsyncAllowed = true; -#endif - } - else - { - ATLASSERT(spDllCache); - ATLASSERT(spExtension); - - pRequestInfo = spExtension->CreateRequest(); - if (pRequestInfo == NULL) - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - - pRequestInfo->dwRequestState = ATLSRV_STATE_BEGIN; - pRequestInfo->dwRequestType = ATLSRV_REQUEST_STENCIL; - pRequestInfo->pDllCache = spDllCache; - pRequestInfo->pExtension = spExtension; - pRequestInfo->pServerContext = pServerContextNew; - if (pState && pState->pParentInfo) - { - pRequestInfo->pUserData = pState->pParentInfo->pUserData; - } - - // Extract the file extension of the included file by searching - // for the first '.' from the right. - // Can't use _tcsrchr because we have to use the stencil's codepage - LPCSTR szDot = NULL; - LPCSTR szMark = szFileName; - ATLENSURE(szMark!=NULL); - while (*szMark) - { - if (*szMark == '.') - szDot = szMark; - - LPCSTR szNext = CharNextExA(wCodePage, szMark, 0); - if (szNext == szMark) - { - // embedded null - pRequestInfo->pServerContext = NULL; - spExtension->FreeRequest(pRequestInfo); - return HTTP_FAIL; - } - szMark = szNext; - } - - if (szDot && AsciiStricmp(szDot, c_AtlSRFExtension) == 0) - { - hcErr = spExtension->LoadDispatchFile(szFileName, pRequestInfo); - if (hcErr) - { - pRequestInfo->pServerContext = NULL; - spExtension->FreeRequest(pRequestInfo); - return hcErr; - } - } - else if (szDot && AsciiStricmp(szDot, c_AtlDLLExtension) == 0) - { - // Get the handler name if they used the asdf.dll?Handler=Default notation - char szHandlerName[ATL_MAX_HANDLER_NAME_LEN+1] = { '\0' }; - - LPCSTR szStart = strstr(szQueryParams, "Handler="); - if (szStart && - ((szStart == szQueryParams) || - ((szStart > szQueryParams) && (*(szStart-1) == '&')))) - { - szStart += 8; // Skip past "Handler" and the "=" - LPCSTR szEnd = strchr(szStart, '&'); - if (szEnd) - { - Checked::memcpy_s(szHandlerName, ATL_MAX_HANDLER_NAME_LEN+1, szStart, __min((szEnd-szStart), ATL_MAX_HANDLER_NAME_LEN)); - szHandlerName[__min((szEnd-szStart), ATL_MAX_HANDLER_NAME_LEN)] = '\0'; - } - else - { - if (!SafeStringCopy(szHandlerName, szStart)) - { - // handler name too long - pRequestInfo->pServerContext = NULL; - spExtension->FreeRequest(pRequestInfo); - return HTTP_FAIL; - } - } - } - else - { - ATLASSERT( ATL_MAX_HANDLER_NAME_LEN >= sizeof(ATL_HANDLER_NAME_DEFAULT) ); - Checked::memcpy_s(szHandlerName, ATL_MAX_HANDLER_NAME_LEN+1, ATL_HANDLER_NAME_DEFAULT, sizeof(ATL_HANDLER_NAME_DEFAULT)); - } - - pRequestInfo->dwRequestType = ATLSRV_REQUEST_DLL; - - hcErr = spExtension->LoadRequestHandler(szFileName, szHandlerName, pRequestInfo->pServerContext, - &pRequestInfo->hInstDll, &pRequestInfo->pHandler); - if (hcErr) - { - pRequestInfo->pServerContext = NULL; - spExtension->FreeRequest(pRequestInfo); - return hcErr; - } - } - else - { - // unknown extension - pRequestInfo->pServerContext = NULL; - spExtension->FreeRequest(pRequestInfo); - return HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - } - - DWORD dwStatus; - hcErr = pRequestInfo->pHandler->GetFlags(&dwStatus); - - if (hcErr) - { - pRequestInfo->pHandler->UninitializeHandler(); - pRequestInfo->pServerContext = NULL; - spExtension->FreeRequest(pRequestInfo); - return hcErr; - } - - if (dwStatus & (ATLSRV_INIT_USEASYNC | ATLSRV_INIT_USEASYNC_EX)) - { -#ifdef _DEBUG - bAsyncAllowed = true; -#endif - ATLENSURE(pAllocContext!=NULL); - hcErr = pAllocContext->Alloc(&pRequestInfo->pServerContext); - if (hcErr) - { - pRequestInfo->pHandler->UninitializeHandler(); - if (pRequestInfo->pServerContext == pServerContextNew) - { - pRequestInfo->pServerContext = NULL; - } - spExtension->FreeRequest(pRequestInfo); - return hcErr; - } - } - - hcErr = pRequestInfo->pHandler->InitializeChild(pRequestInfo, pServiceProvider, pLookup); - if (hcErr) - { - pRequestInfo->pHandler->UninitializeHandler(); - if (pRequestInfo->pServerContext == pServerContextNew) - { - pRequestInfo->pServerContext = NULL; - } - spExtension->FreeRequest(pRequestInfo); - return hcErr; - } - - pRequestInfo->pfnHandleRequest = &IRequestHandler::HandleRequest; - } - - if (pRequestInfo) - { - if (!hcErr) - { - ATLASSERT(pRequestInfo->pfnHandleRequest != NULL); - hcErr = (pRequestInfo->pHandler->*pRequestInfo->pfnHandleRequest)(pRequestInfo, pServiceProvider); - -#ifdef _DEBUG - // must use ATLSRV_INIT_USEASYNC to use ASYNC returns - if (IsAsyncStatus(hcErr)) - { - ATLASSERT(bAsyncAllowed); - } -#endif - - if (IsAsyncStatus(hcErr)) - { - ATLASSERT(pState); // state is required for async - if (IsAsyncContinueStatus(hcErr)) - { - pState->pIncludeInfo = pRequestInfo; - pRequestInfo->dwRequestState = ATLSRV_STATE_CONTINUE; - } - else if (IsAsyncDoneStatus(hcErr)) - { - pRequestInfo->pHandler->UninitializeHandler(); - if (pRequestInfo->pServerContext == pServerContextNew) - { - pRequestInfo->pServerContext = NULL; - } - spExtension->FreeRequest(pRequestInfo); - } - } - else - { - pRequestInfo->pHandler->UninitializeHandler(); - if (pRequestInfo->pServerContext == pServerContextNew) - { - pRequestInfo->pServerContext = NULL; - } - spExtension->FreeRequest(pRequestInfo); - } - } - } - else - { - hcErr = AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - } - - return hcErr; -} - -// CAllocTransferAsyncContext is an unsupported implementation detail, used -// for implementing _AtlTransferRequest. -class CAllocTransferAsyncContext : - public CAllocContextBase -{ -public: - CAllocTransferAsyncContext(CTransferServerContext *pInitialContext): - m_pInitialContext(pInitialContext) - { - } - - HTTP_CODE Alloc(IHttpServerContext** ppNewContext) - { - if (!ppNewContext) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - *ppNewContext = NULL; - - CComObjectNoLock* pServerContext = NULL; - ATLTRY(pServerContext = new CComObjectNoLock); - if (pServerContext == NULL) - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - pServerContext->Initialize(m_pInitialContext); - pServerContext->AddRef(); - *ppNewContext = pServerContext; - return HTTP_SUCCESS; - } -private: - CTransferServerContext *m_pInitialContext; -}; - -inline HTTP_CODE _AtlTransferRequest( - __in AtlServerRequest *pRequest, - __in IServiceProvider *pServiceProvider, - __in IWriteStream *pWriteStream, - __in_opt IHttpRequestLookup *pLookup, - __in LPCSTR szNewUrl, - __in WORD nCodePage, - __in bool bContinueAfterProcess, - __inout_opt CStencilState *pState) -{ - CComObjectStackEx serverContext; - if (!serverContext.Initialize(szNewUrl, pWriteStream, pRequest->pServerContext)) - return AtlsHttpError(500, 0); - CAllocTransferAsyncContext AsyncAllocObj(&serverContext); - HTTP_CODE hcErr = _AtlRenderInclude(static_cast(&serverContext), - serverContext.m_szFileName, - serverContext.m_szQueryString, - nCodePage, - &AsyncAllocObj, - pServiceProvider, - pLookup, - pState); - if (hcErr == HTTP_SUCCESS && bContinueAfterProcess) - return hcErr; - return HTTP_SUCCESS_NO_PROCESS; -} - -// -// This function is now deprecated. ATL is not using it anymore. -// -inline ATL_DEPRECATED("Do not use this function.") -void __cdecl AtlsSecErrHandlerFunc(int /* nCode */, void * /* pv */) -{ - // - // a buffer overflow has occurred in your code - // - ATLASSERT( FALSE ); - - // - // terminate process (safest thing to do) - // - TerminateProcess( GetCurrentProcess(), 1 ); -} - -// -// Class CIsapiExtension -// The main ISAPI Extension implementation. -// Template parameters -// ThreadPoolClass: Specifies the thread pool that will be used by the -// extension to queue incoming requests. CThreadPool is the -// default and is declared and implemented in ATLUTIL.H. This class -// templatizes on a worker thread class. The worker thread class -// represents an abstraction of a thread that will be used to -// process requests as they are dequeued from the pool's work queue. -// You would change this parameter if you wanted to use a completely -// different thread pool, or, more commonly, if you wanted to use -// a different worker thread class. Request processing code can -// access a pointer to the worker thread class, which allows the -// request handling code to easily access per-thread data. -// CRequestStatClass: Specifies the class to be used to track request statistics -// CNoRequestStats is the default which is a noop class. -// You would change this parameter to provide a class that will -// track request statistics for you. ATL provides CStdRequestStats -// and CPerfRequestStatObject but these classes should be used -// with caution because they require interlocked operations to -// keep track of request statistics which can affect server performance. -// HttpUserErrorTextProvider: This class provides error text messages -// and headers, including resource IDs of error messages to the -// isapi extension's error handling functions. You would change this -// parameter if you wanted to provide your own error headers and/or -// messages in response to error encountered during request processing. -// CPageCacheStats, CStencilCacheStats: These two classes are used to keep -// statistics about the page and stencil caches. You could change these -// paramters if you wanted to track statistics for these caches. ATL -// provides CPerfStatClass and CStdStatClass to store the stat data but -// using these classes can affect server performance because they use -// interlocked operations internally to store the data. -template < class ThreadPoolClass=CThreadPool, - class CRequestStatClass=CNoRequestStats, - class HttpUserErrorTextProvider=CDefaultErrorProvider, - class WorkerThreadTraits=DefaultThreadTraits, - class CPageCacheStats=CNoStatClass, - class CStencilCacheStats=CNoStatClass> -class CIsapiExtension : - public IServiceProvider, public IIsapiExtension, public IRequestStats -{ -private: - -#ifndef ATL_NO_CRITICAL_ISAPI_ERROR - - DWORD m_dwCriticalIsapiError; - -#endif // ATL_NO_CRITICAL_ISAPI_ERROR - -protected: - DWORD m_dwTlsIndex; - - typedef CWorkerThread extWorkerType; - - extWorkerType m_WorkerThread; - ThreadPoolClass m_ThreadPool; - - CDllCache m_DllCache; - CFileCache m_PageCache; - CComObjectGlobal > m_StencilCache; - HttpUserErrorTextProvider m_UserErrorProvider; - HANDLE m_hRequestHeap; - CComCriticalSection m_critSec; - - // Dynamic services stuff - struct ServiceNode - { - HINSTANCE hInst; - IUnknown *punk; - GUID guidService; - IID riid; - - ServiceNode() throw() - { - } - - ServiceNode(const ServiceNode& that) throw() - :hInst(that.hInst), punk(that.punk), guidService(that.guidService), riid(that.riid) - { - } - }; - - class CServiceEqualHelper - { - public: - static bool IsEqual(__in const ServiceNode& t1, __in const ServiceNode& t2) throw() - { - return (InlineIsEqualGUID(t1.guidService, t2.guidService) != 0 && - InlineIsEqualGUID(t1.riid, t2.riid) != 0); - } - }; - - CSimpleArray m_serviceMap; - -public: - CWin32Heap m_heap; - - CRequestStatClass m_reqStats; - - AtlServerRequest *CreateRequest() - { - // Allocate a fixed block size to avoid fragmentation - AtlServerRequest *pRequest = (AtlServerRequest *) HeapAlloc(m_hRequestHeap, - HEAP_ZERO_MEMORY, __max(sizeof(AtlServerRequest), sizeof(_CComObjectHeapNoLock))); - if (!pRequest) - return NULL; - pRequest->cbSize = sizeof(AtlServerRequest); - - return pRequest; - } - - void FreeRequest(__inout AtlServerRequest *pRequest) - { - _ReleaseAtlServerRequest(pRequest); - HeapFree(m_hRequestHeap, 0, pRequest); - } - - CIsapiExtension() throw() - { - m_hRequestHeap = NULL; -#ifdef _DEBUG - m_bDebug = FALSE; -#endif - -#ifndef ATL_NO_CRITICAL_ISAPI_ERROR - - m_dwCriticalIsapiError = 0; - -#endif // ATL_NO_CRITICAL_ISAPI_ERROR - } - - HTTP_CODE TransferRequest( - __in AtlServerRequest *pRequest, - __in IServiceProvider *pServiceProvider, - __in IWriteStream *pWriteStream, - __in_opt IHttpRequestLookup *pLookup, - __in LPCSTR szNewUrl, - __in WORD nCodePage, - __in bool bContinueAfterProcess, - __inout_opt CStencilState *pState) - { - HTTP_CODE hcErr; - _ATLTRY - { - hcErr = _AtlTransferRequest(pRequest, pServiceProvider, pWriteStream, - pLookup, szNewUrl, nCodePage, bContinueAfterProcess, pState); - } - _ATLCATCHALL() - { - hcErr = HTTP_FAIL; - } - return hcErr; - } - -#ifndef ATL_NO_CRITICAL_ISAPI_ERROR - - DWORD ReturnCriticalError(__in EXTENSION_CONTROL_BLOCK *pECB) - { - - _ATLTRY - { - ATLENSURE(pECB); - UINT uResId = 0; - LPCSTR szHeader = NULL; - - CStringA strStatus; - CStringA strBody; - CStringA strFormat; - CStringA strError; - - DWORD dwErr = GetCriticalIsapiError(); - if (!strError.LoadString(dwErr)) - { - strError.Format("Unknown Error %d", dwErr); - } - -#ifdef ATL_CRITICAL_ISAPI_ERROR_LOGONLY - // we've logged the real error - don't send detailed internal info to the user - m_UserErrorProvider.GetErrorText(500, - SUBERR_NONE, - &szHeader, - &uResId); - - if (!uResId || !strBody.LoadString(uResId)) - { - strBody = "A server error has occurred."; - } -#else - m_UserErrorProvider.GetErrorText(500, - ISE_SUBERR_ISAPISTARTUPFAILED, - &szHeader, - &uResId); - if (!uResId || !strFormat.LoadString(uResId)) - { - strFormat = "A critical error has occurred initializing this ISAPI extension: %s"; - } - strBody.Format(strFormat, strError); -#endif - strStatus.Format("500 %s", szHeader); - - HSE_SEND_HEADER_EX_INFO hex; - hex.pszStatus = (LPCSTR)strStatus; - hex.pszHeader = NULL; - hex.cchStatus = (DWORD)strStatus.GetLength(); - hex.cchHeader = 0; - hex.fKeepConn = FALSE; - - pECB->ServerSupportFunction(pECB->ConnID, - HSE_REQ_SEND_RESPONSE_HEADER_EX, - &hex, - NULL, - NULL); - - DWORD dwBodyLen = strBody.GetLength(); - pECB->WriteClient(pECB->ConnID, - (void *) (LPCSTR) strBody, - &dwBodyLen, - NULL); - } - _ATLCATCHALL() - { - return HSE_STATUS_ERROR; - } - return HSE_STATUS_SUCCESS; - } - -#endif // ATL_NO_CRITICAL_ISAPI_ERROR - - DWORD HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) throw() - { - -#ifndef ATL_NO_CRITICAL_ISAPI_ERROR - - if (GetCriticalIsapiError() != 0) - { - return ReturnCriticalError(lpECB); - } - -#endif // ATL_NO_CRITICAL_ISAPI_ERROR - - AtlServerRequest *pRequestInfo = NULL; - - _ATLTRY - { - pRequestInfo = CreateRequest(); - if (pRequestInfo == NULL) - return HSE_STATUS_ERROR; - - CServerContext *pServerContext = NULL; - ATLTRY(pServerContext = CreateServerContext(m_hRequestHeap)); - if (pServerContext == NULL) - { - FreeRequest(pRequestInfo); - return HSE_STATUS_ERROR; - } - - pServerContext->Initialize(lpECB); - pServerContext->AddRef(); - - pRequestInfo->pServerContext = pServerContext; - pRequestInfo->dwRequestType = ATLSRV_REQUEST_UNKNOWN; - pRequestInfo->dwRequestState = ATLSRV_STATE_BEGIN; - pRequestInfo->pExtension = static_cast(this); - pRequestInfo->pDllCache = static_cast(&m_DllCache); -#ifndef ATL_NO_MMSYS - pRequestInfo->dwStartTicks = timeGetTime(); -#else - pRequestInfo->dwStartTicks = GetTickCount(); -#endif - pRequestInfo->pECB = lpECB; - - m_reqStats.OnRequestReceived(); - - if (m_ThreadPool.QueueRequest(pRequestInfo)) - return HSE_STATUS_PENDING; - - if (pRequestInfo != NULL) - { - FreeRequest(pRequestInfo); - } - - } - _ATLCATCHALL() - { - } - - - - return HSE_STATUS_ERROR; - } - - - BOOL QueueRequest(__in AtlServerRequest * pRequestInfo) - { - return m_ThreadPool.QueueRequest(pRequestInfo); - } - - CIsapiWorker *GetThreadWorker() - { - return (CIsapiWorker *) TlsGetValue(m_dwTlsIndex); - } - - BOOL SetThreadWorker(__in CIsapiWorker *pWorker) - { - return TlsSetValue(m_dwTlsIndex, (void*)pWorker); - } - - // Configuration functions -- override in base class if another value is desired - virtual LPCSTR GetExtensionDesc() throw() { return "VC Server Classes"; } - virtual int GetNumPoolThreads() throw() { return 0; } - virtual int GetPoolStackSize() throw() { return 0; } - virtual HANDLE GetIOCompletionHandle() throw() { return INVALID_HANDLE_VALUE; } - virtual DWORD GetDllCacheTimeout() throw() { return ATL_DLL_CACHE_TIMEOUT; } - virtual DWORD GetStencilCacheTimeout() throw() { return ATL_STENCIL_CACHE_TIMEOUT; } - virtual LONGLONG GetStencilLifespan() throw() { return ATL_STENCIL_LIFESPAN; } - - BOOL OnThreadAttach() - { - return SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)); - } - - void OnThreadTerminate() - { - CoUninitialize(); - } - -#ifndef ATL_NO_CRITICAL_ISAPI_ERROR - - BOOL SetCriticalIsapiError(__in DWORD dwErr = 1) throw() - { - m_dwCriticalIsapiError = dwErr; - - // send the error to the event log - _ATLTRY - { - CStringA strBody; - CStringA strFormat; - CStringA strError; - - // format an error message - if (!strError.LoadString(dwErr)) - { - strError.Format("Unknown Error %d", dwErr); - } - - if (!strFormat.LoadString(IDS_ATLSRV_CRITICAL_LOGMESSAGE)) - { - strFormat = "A critical error has occurred initializing the ISAPI extension: %s"; - } - strBody.Format(strFormat, strError); - - // take the base module name as the app name - CPath path; - { - CStrBuf buf(path, MAX_PATH); - DWORD dwLen = ::GetModuleFileName(_AtlBaseModule.GetModuleInstance(), buf, MAX_PATH); - if (dwLen == MAX_PATH) - buf.SetLength(MAX_PATH); - } - path.StripPath(); - - // log the event - HANDLE h = RegisterEventSource(NULL, path); - if (h) - { - LPCSTR szBody = strBody; - ReportEventA(h, EVENTLOG_ERROR_TYPE, 0, 0, NULL, 1, 0, &szBody, NULL); - DeregisterEventSource(h); - } - } - _ATLCATCHALL() - { - } - - return TRUE; - } - - DWORD GetCriticalIsapiError() throw() - { - return m_dwCriticalIsapiError; - } - -#else - - BOOL SetCriticalIsapiError(__in DWORD dwErr = 1) throw() - { - dwErr; // not used - return FALSE; - } - - DWORD GetCriticalIsapiError() throw() - { - return 0; - } - -#endif // ATL_NO_CRITICAL_ISAPI_ERROR - - - BOOL GetExtensionVersion(__out HSE_VERSION_INFO* pVer) throw() - { - ATLASSERT(pVer!=NULL); - if(pVer==NULL) - { - return FALSE; - } - // allocate a Tls slot for storing per thread data - m_dwTlsIndex = TlsAlloc(); - - // create a private heap for request data - // this heap has to be thread safe to allow for - // async processing of requests - m_hRequestHeap = HeapCreate(0, 0, 0); - if (!m_hRequestHeap) - { - ATLTRACE(atlTraceISAPI, 0, _T("Failed creating request heap. Using process heap\n")); - m_hRequestHeap = GetProcessHeap(); - if (!m_hRequestHeap) - { - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED); - } - - } - - // create a private heap (synchronized) for - // allocations. This reduces fragmentation overhead - // as opposed to the process heap - HANDLE hHeap = HeapCreate(0, 0, 0); - if (!hHeap) - { - ATLTRACE(atlTraceISAPI, 0, _T("Failed creating extension heap. Using process heap\n")); - hHeap = GetProcessHeap(); - m_heap.Attach(hHeap, false); - } - else - { - m_heap.Attach(hHeap, true); - } - hHeap = NULL; - - if (S_OK != m_reqStats.Initialize()) - { - ATLTRACE(atlTraceISAPI, - 0, - _T("Initialization failed for request statistics perfmon support.\n") - _T("Check request statistics perfmon dll registration\n") ); - } - - if (S_OK != m_WorkerThread.Initialize()) - { - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_WORKERINITFAILED); - } - - if (m_critSec.Init() != S_OK) - { - HRESULT hrIgnore=m_WorkerThread.Shutdown(); - (hrIgnore); - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_CRITSECINITFAILED); - } - - if (S_OK != m_ThreadPool.Initialize(static_cast(this), GetNumPoolThreads(), GetPoolStackSize(), GetIOCompletionHandle())) - { - HRESULT hrIgnore=m_WorkerThread.Shutdown(); - (hrIgnore); - m_critSec.Term(); - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_THREADPOOLFAILED); - } - - if (FAILED(m_DllCache.Initialize(&m_WorkerThread, GetDllCacheTimeout()))) - { - HRESULT hrIgnore=m_WorkerThread.Shutdown(); - (hrIgnore); - m_ThreadPool.Shutdown(); - m_critSec.Term(); - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_DLLCACHEFAILED); - } - - if (FAILED(m_PageCache.Initialize(&m_WorkerThread))) - { - HRESULT hrIgnore=m_WorkerThread.Shutdown(); - (hrIgnore); - m_ThreadPool.Shutdown(); - m_DllCache.Uninitialize(); - m_critSec.Term(); - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_PAGECACHEFAILED); - } - - if (S_OK != m_StencilCache.Initialize(static_cast(this), - &m_WorkerThread, - GetStencilCacheTimeout(), - GetStencilLifespan())) - { - HRESULT hrIgnore=m_WorkerThread.Shutdown(); - (hrIgnore); - m_ThreadPool.Shutdown(); - m_DllCache.Uninitialize(); - m_PageCache.Uninitialize(); - m_critSec.Term(); - return SetCriticalIsapiError(IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED); - } - - pVer->dwExtensionVersion = HSE_VERSION; - Checked::strncpy_s(pVer->lpszExtensionDesc, HSE_MAX_EXT_DLL_NAME_LEN, GetExtensionDesc(), _TRUNCATE); - pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN - 1] = '\0'; - - return TRUE; - } - - BOOL TerminateExtension(DWORD /*dwFlags*/) throw() - { - m_critSec.Lock(); - for (int i=0; i < m_serviceMap.GetSize(); i++) - { - ATLASSUME(m_serviceMap[i].punk != NULL); - if(m_serviceMap[i].punk != NULL) - { - m_serviceMap[i].punk->Release(); - } - m_DllCache.ReleaseModule(m_serviceMap[i].hInst); - } - m_critSec.Unlock(); - - m_ThreadPool.Shutdown(); - m_StencilCache.Uninitialize(); - m_DllCache.Uninitialize(); - m_PageCache.Uninitialize(); - HRESULT hrShutdown=m_WorkerThread.Shutdown(); - m_reqStats.Uninitialize(); - m_critSec.Term(); - - // free the request heap - if (m_hRequestHeap != GetProcessHeap()) - HeapDestroy(m_hRequestHeap); - - // free the Tls slot that we allocated - TlsFree(m_dwTlsIndex); - - return SUCCEEDED(hrShutdown); - } - - static void WINAPI AsyncCallback(LPEXTENSION_CONTROL_BLOCK /*lpECB*/, - __in PVOID pContext, - __in DWORD cbIO, - __in DWORD dwError) throw(...) - { - AtlServerRequest *pRequestInfo = reinterpret_cast(pContext); - ATLENSURE(pRequestInfo); - if (pRequestInfo->m_hMutex) - { - // synchronize in case the previous async_noflush call isn't finished - // setting up state for the next call. - DWORD dwStatus = WaitForSingleObject(pRequestInfo->m_hMutex, ATLS_ASYNC_MUTEX_TIMEOUT); - if (dwStatus != WAIT_OBJECT_0 && dwStatus != WAIT_ABANDONED) - { - _ATLTRY - { - pRequestInfo->pExtension->RequestComplete(pRequestInfo, 500, ISE_SUBERR_UNEXPECTED); - } - _ATLCATCHALL() - { - ATLTRACE(_T("Warning: Uncaught user exception thrown and caught in AsyncCallback.\n")); - _ATLRETHROW; - } - return; - } - } - - if (pRequestInfo->pfnAsyncComplete != NULL) - ATLTRY((*pRequestInfo->pfnAsyncComplete)(pRequestInfo, cbIO, dwError)); - - if (pRequestInfo->dwRequestState == ATLSRV_STATE_DONE) - { - pRequestInfo->pExtension->RequestComplete(pRequestInfo, HTTP_ERROR_CODE(HTTP_SUCCESS), 0); - } - else if (pRequestInfo->dwRequestState == ATLSRV_STATE_CACHE_DONE) - { - CloseHandle(pRequestInfo->hFile); - pRequestInfo->pFileCache->ReleaseFile(pRequestInfo->hEntry); - pRequestInfo->pExtension->RequestComplete(pRequestInfo, HTTP_ERROR_CODE(HTTP_SUCCESS), 0); - } - else - { - HANDLE hMutex = pRequestInfo->m_hMutex; - pRequestInfo->pExtension->QueueRequest(pRequestInfo); - if (hMutex) - ReleaseMutex(hMutex); - } - } - - void HandleError(__in IHttpServerContext *pServerContext, __in DWORD dwStatus, __in DWORD dwSubStatus) throw() - { - RenderError(pServerContext, dwStatus, dwSubStatus, &m_UserErrorProvider); - } - - void RequestComplete(__inout AtlServerRequest *pRequestInfo, __in DWORD dwStatus, __in DWORD dwSubStatus) - { - ATLASSERT(pRequestInfo); - - if (pRequestInfo->pHandler != NULL) - pRequestInfo->pHandler->UninitializeHandler(); - - DWORD dwReqStatus = dwStatus; - if (!dwReqStatus) - dwReqStatus = 200; - - if (dwStatus >= 400) - { - if (dwSubStatus != SUBERR_NO_PROCESS) - HandleError(pRequestInfo->pServerContext, dwStatus, dwSubStatus); - m_reqStats.RequestHandled(pRequestInfo, FALSE); - } - else - m_reqStats.RequestHandled(pRequestInfo, TRUE); - - CComPtr spServerContext = pRequestInfo->pServerContext; - - FreeRequest(pRequestInfo); - - spServerContext->DoneWithSession(dwReqStatus); - } - - HTTP_CODE GetHandlerName(__in LPCSTR szFileName, __out_ecount(MAX_PATH+ATL_MAX_HANDLER_NAME+2) LPSTR szHandlerName) throw() - { - return _AtlGetHandlerName(szFileName, szHandlerName); - } - - HTTP_CODE LoadDispatchFile(__in LPCSTR szFileName, __out AtlServerRequest *pRequestInfo) - { - ATLASSERT(szFileName); - ATLASSERT(pRequestInfo); - - CStencil *pStencil = NULL; - HCACHEITEM hStencil = NULL; - - // Must have space for the path to the handler + the maximum size - // of the handler, plus the '/' plus the '\0' - CHAR szDllPath[MAX_PATH]; - CHAR szHandlerName[ATL_MAX_HANDLER_NAME_LEN+1]; - - pRequestInfo->pHandler = NULL; - pRequestInfo->hInstDll = NULL; - - m_StencilCache.LookupStencil(szFileName, &hStencil); - - // Stencil was found, check to see if it needs to be refreshed - if (hStencil) - { - m_StencilCache.GetStencil(hStencil, (void **) &pStencil); - pStencil->GetHandlerName(szDllPath, MAX_PATH, szHandlerName, ATL_MAX_HANDLER_NAME_LEN + 1); - - CFileTime cftCurr; - CFileTime cftLastChecked; - cftCurr = CFileTime::GetCurrentTime(); - - pStencil->GetLastChecked(&cftLastChecked); - - CFileTimeSpan span(ATL_STENCIL_CHECK_TIMEOUT * CFileTime::Millisecond); - - if (cftLastChecked + span < cftCurr) - { - CComPtr spCacheCtrl; - m_StencilCache.QueryInterface(__uuidof(IStencilCacheControl), reinterpret_cast(&spCacheCtrl)); - if (spCacheCtrl) - { - CFileTime cftLastModified; - pStencil->GetLastModified(&cftLastModified); - - // Resource based stencils have a last modified filetime of 0 - if (cftLastModified != 0) - { - // for file base stencils, we check whether the file - // has been modified since being put in the cache - WIN32_FILE_ATTRIBUTE_DATA fad; - pStencil->SetLastChecked(&cftCurr); - BOOL bRet = GetFileAttributesExA(szFileName, GetFileExInfoStandard, &fad); - - if ((bRet && cftLastModified < fad.ftLastWriteTime) || - !bRet) - { - // the file has changed or an error has occurred trying to read the file, - // so remove it from the cache and force a reload - spCacheCtrl->RemoveStencil(hStencil); - pStencil = NULL; - hStencil = NULL; - } - } - } - } - } - - - if (!hStencil) - { - CHAR szHandlerDllName[MAX_PATH+ATL_MAX_HANDLER_NAME_LEN+1]; - *szHandlerDllName = '\0'; - - // not in the cache, so open the file - HTTP_CODE hcErr = GetHandlerName(szFileName, szHandlerDllName); - if (hcErr) - return hcErr; - DWORD dwDllPathLen = MAX_PATH; - DWORD dwHandlerNameLen = ATL_MAX_HANDLER_NAME_LEN+1; - if (!_AtlCrackHandler(szHandlerDllName, szDllPath, &dwDllPathLen, szHandlerName, &dwHandlerNameLen)) - { - return AtlsHttpError(500, ISE_SUBERR_HANDLER_NOT_FOUND); - } - ATLASSERT(*szHandlerName); - ATLASSERT(*szDllPath); - if (!*szHandlerName) - { - return AtlsHttpError(500, ISE_SUBERR_HANDLER_NOT_FOUND); - } - } - else - { - m_StencilCache.ReleaseStencil(hStencil); - } - - - return LoadRequestHandler(szDllPath, szHandlerName, pRequestInfo->pServerContext, - &pRequestInfo->hInstDll, &pRequestInfo->pHandler); - } - - HTTP_CODE LoadDllHandler(__in LPCSTR szFileName, __in AtlServerRequest *pRequestInfo) - { - ATLASSERT(szFileName); - ATLENSURE(pRequestInfo); - - _ATLTRY - { - HTTP_CODE hcErr = HTTP_SUCCESS; - CHAR szHandler[ATL_MAX_HANDLER_NAME_LEN+1] = { 'D', 'e', 'f', 'a', 'u', 'l', 't', '\0' }; - LPCSTR szQueryString = pRequestInfo->pServerContext->GetQueryString(); - if (szQueryString != NULL) - { - LPCSTR szHdlr = strstr(szQueryString, "Handler="); - if (szHdlr != NULL) - { - if ((szHdlr == szQueryString) || - ((szHdlr > szQueryString) && (*(szHdlr-1) == '&'))) - { - int nCnt = 0; - LPSTR pszHandler = szHandler; - szHdlr += sizeof("Handler=")-1; - while (*szHdlr && *szHdlr != '&') - { - if (nCnt < ATL_MAX_HANDLER_NAME_LEN) - { - *pszHandler++ = *szHdlr++; - nCnt++; - } - else - { - hcErr = AtlsHttpError(500, ISE_SUBERR_HANDLER_NOT_FOUND); - break; - } - } - if (hcErr == HTTP_SUCCESS) - { - *pszHandler = '\0'; - } - } - } - } - - if (hcErr == HTTP_SUCCESS) - { - CHAR szFile[MAX_PATH+ATL_MAX_HANDLER_NAME_LEN+1]; - if (SafeStringCopy(szFile, szFileName)) - { - hcErr = LoadRequestHandler(szFile, szHandler, pRequestInfo->pServerContext, &pRequestInfo->hInstDll, &pRequestInfo->pHandler); - } - else - { - hcErr = AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - } - } - - return hcErr; - } - _ATLCATCHALL() - { - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - } - } - -#pragma warning(push) -#pragma warning(disable: 6014) - virtual __success(return) __checkReturn BOOL GetCacheServerContext(__in AtlServerRequest *pRequestInfo, __in IFileCache *pCache, __deref_out_opt IHttpServerContext **pCacheCtx) - { - ATLENSURE(pCacheCtx); - *pCacheCtx = NULL; - - CComObjectNoLock *pCacheServerContext = NULL; - ATLTRY(pCacheServerContext = new CComObjectNoLock); - if (!pCacheServerContext) - return FALSE; - - if (!pCacheServerContext->Initialize(pRequestInfo->pServerContext, pCache)) - { - delete pCacheServerContext; - return FALSE; - } - - pCacheServerContext->QueryInterface(__uuidof(IHttpServerContext), (void **) pCacheCtx); - - if (*pCacheCtx) - return TRUE; - - delete pCacheServerContext; - return FALSE; - } -#pragma warning(pop) - - virtual BOOL TransmitFromCache(__in AtlServerRequest* pRequestInfo, __out BOOL *pbAllowCaching) - { - ATLENSURE(pRequestInfo); - ATLENSURE(pbAllowCaching); - - *pbAllowCaching = TRUE; - - _ATLTRY - { - if (strcmp(pRequestInfo->pServerContext->GetRequestMethod(), "GET")) - return FALSE; - - char szUrl[ATL_URL_MAX_URL_LENGTH + 1]; - LPCSTR szPathInfo = pRequestInfo->pServerContext->GetPathInfo(); - LPCSTR szQueryString = pRequestInfo->pServerContext->GetQueryString(); - - int nSize = 0; - LPSTR szTo = szUrl; - ATLENSURE(szPathInfo!=NULL); - while (*szPathInfo && nSize < ATL_URL_MAX_URL_LENGTH) - { - *szTo++ = *szPathInfo++; - nSize++; - } - if (nSize >= ATL_URL_MAX_URL_LENGTH) - { - return FALSE; - } - *szTo++ = '?'; - nSize++; - ATLENSURE(szQueryString!=NULL); - while (*szQueryString && nSize < ATL_URL_MAX_URL_LENGTH) - { - *szTo++ = *szQueryString++; - nSize++; - } - if (nSize >= ATL_URL_MAX_URL_LENGTH) - { - return FALSE; - } - *szTo = '\0'; - - HCACHEITEM hEntry; - - if (S_OK == m_PageCache.LookupFile(szUrl, &hEntry)) - { - LPSTR szFileName; - CPageCachePeer::PeerInfo *pInfo; - m_PageCache.GetFile(hEntry, &szFileName, (void **)&pInfo); - ATLENSURE(pInfo); - CAtlFile file; - HRESULT hr = E_FAIL; - - CA2CTEX strFile(szFileName); - hr = file.Create(strFile, - GENERIC_READ, - FILE_SHARE_READ, - OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED); - - if (FAILED(hr) || GetFileType(file) != FILE_TYPE_DISK) - { - m_PageCache.ReleaseFile(hEntry); - *pbAllowCaching = FALSE; - return FALSE; - } - - pRequestInfo->pServerContext->SendResponseHeader( - pInfo->strHeader, pInfo->strStatus, FALSE); - HANDLE hFile = file.Detach(); - BOOL bRet = FALSE; - - pRequestInfo->dwRequestState = ATLSRV_STATE_CACHE_DONE; - pRequestInfo->hFile = hFile; - pRequestInfo->hEntry = hEntry; - pRequestInfo->pFileCache = &m_PageCache; - - bRet = pRequestInfo->pServerContext->TransmitFile( - hFile, // The file to transmit - AsyncCallback, pRequestInfo, // The async callback and context - pInfo->strStatus, // HTTP status code - 0, // Send entire file - 0, // Start at the beginning of the file - NULL, 0, // Head and length - NULL, 0, // Tail and length - HSE_IO_ASYNC | HSE_IO_DISCONNECT_AFTER_SEND | HSE_IO_NODELAY // Send asynchronously - ); - - if (!bRet) - { - m_PageCache.ReleaseFile(hEntry); - CloseHandle(hFile); - *pbAllowCaching = FALSE; - return FALSE; - } - return TRUE; - } - } - _ATLCATCHALL() - { - } - - return FALSE; - } - -#if defined(_DEBUG) || defined(ATLS_ENABLE_DEBUGGING) - - BOOL m_bDebug; - // F5 debugging support for VS7 - BOOL ProcessDebug(__inout AtlServerRequest *pRequestInfo) -{ - ATLENSURE(pRequestInfo); - static GUID clsidDebugger[] = { - {0x70F65411, 0xFE8C, 0x4248, {0xBC,0xFF,0x70,0x1C,0x8B,0x2F,0x45,0x29}}, // debugger clsid - {0x62A78AC2, 0x7D9A, 0x4377, {0xB9,0x7E,0x69,0x65,0x91,0x9F,0xDD,0x02}}, // reserved - {0xCC23651F, 0x4574, 0x438F, {0xB4,0xAA,0xBC,0xB2,0x8B,0x6B,0x3E,0xCF}}, // reserved - {0xDBFDB1D0, 0x04A4, 0x4315, {0xB1,0x5C,0xF8,0x74,0xF6,0xB6,0xE9,0x0B}}, // reserved - {0xA4FCB474, 0x2687, 0x4924, {0xB0,0xAD,0x7C,0xAF,0x33,0x1D,0xB8,0x26}}, // reserved - {0xBEB261F6, 0xD5F0, 0x43BA, {0xBA,0xF4,0x8B,0x79,0x78,0x5F,0xFF,0xAF}}, // reserved - {0x8E2F5E28, 0xD4E2, 0x44C0, {0xAA,0x02,0xF8,0xC5,0xBE,0xB7,0x0C,0xAC}}, // reserved - {0x08100915, 0x0F41, 0x4CCF, {0x95,0x64,0xEB,0xAA,0x5D,0x49,0x44,0x6C}} // reserved - }; - _ATLTRY - { - if (!_stricmp(pRequestInfo->pServerContext->GetRequestMethod(), "debug")) - { - // Debugger must be able to validate the client we are impersonating - // on an NT Domain so the client needs to use either NTLM or Negotiate. - DWORD dwAuthTypeSize = 64; - char szAuthType[64] = { 0 }; - - if ( !pRequestInfo->pServerContext->GetServerVariable("AUTH_TYPE", szAuthType, &dwAuthTypeSize) ) - { - // error retrieving authentication type - RequestComplete(pRequestInfo, 501, 0); - return FALSE; - } - - // if it's empty or not NTLM or negotiate we fail. - if ( !( *szAuthType != '\0 ' && - ( !_stricmp(szAuthType, "NTLM") || - !_stricmp(szAuthType, "Negotiate")) - ) ) - { - // wrong authorization type or not authorized - RequestComplete(pRequestInfo, 401, 0); - return FALSE; - } - - DWORD dwHeadersLen = 0; - CStringA strHeaders; - pRequestInfo->pServerContext->GetServerVariable("ALL_HTTP", NULL, &dwHeadersLen); - BOOL bRet = pRequestInfo->pServerContext->GetServerVariable("ALL_HTTP", strHeaders.GetBuffer(dwHeadersLen), &dwHeadersLen); - if (!bRet) - { - RequestComplete(pRequestInfo, 501, 0); - return FALSE; - } - strHeaders.ReleaseBuffer(dwHeadersLen - 1); - LPCSTR szCur = strHeaders; - - while(*szCur) - { - if (!strncmp(szCur, "HTTP_COMMAND:", 13)) - { - szCur += 13; - break; - } - - szCur = strchr(szCur, '\n'); - if (!szCur) - { - RequestComplete(pRequestInfo, 501, 0); - return FALSE; - } - - szCur++; - } - - - if (!_strnicmp(szCur, "start-debug", sizeof("start-debug")-sizeof('\0'))) - { - CCritSecLock Lock(m_critSec.m_sec); - if (m_bDebug) - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_ALREADY_DEBUGGING); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_ALREADY_DEBUGGING); // Already being debugged by another process - return FALSE; - } - CHttpRequest HttpRequest; - HttpRequest.Initialize(pRequestInfo->pServerContext); - HttpRequest.InitFromPost(); - LPCSTR szString; - szString = HttpRequest.FormVars.Lookup("DebugSessionID"); - if (!szString || !*szString) - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_INVALID_SESSION); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_INVALID_SESSION); - return FALSE; - } - CA2W szSessionID(szString); - if (!szSessionID) - { - HandleError(pRequestInfo->pServerContext, 500, ISE_SUBERR_OUTOFMEM); - RequestComplete(pRequestInfo, 500, ISE_SUBERR_OUTOFMEM); - return FALSE; - } - DWORD dwPid = GetCurrentProcessId(); - LPWSTR szPoint = szSessionID; - while (szPoint && *szPoint && wcsncmp(szPoint, L"autoattachclsid=", 16)) - { - szPoint = wcschr(szPoint, ';'); - if (szPoint) - szPoint++; - } - - if (!szPoint || !*szPoint) - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_BAD_ID); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_BAD_ID); - return FALSE; - } - - szPoint += (sizeof("autoattachclsid=") - 1); - WCHAR szClsid[39]; - szClsid[38] = '\0'; - Checked::wcsncpy_s(szClsid, _countof(szClsid), szPoint, _TRUNCATE); - if (szClsid[38] != '\0') - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_BAD_ID); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_BAD_ID); - return FALSE; - } - szClsid[38] = '\0'; - - CLSID clsidDebugAutoAttach = CLSID_NULL; - HRESULT hr = CLSIDFromString(szClsid, &clsidDebugAutoAttach); - - if (hr != S_OK) - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_BAD_ID); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_BAD_ID); - return FALSE; - } - - size_t i=0, - nArrSize = sizeof(clsidDebugger)/sizeof(GUID); - for (i=0; i= nArrSize) - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_BAD_ID); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_BAD_ID); - return FALSE; - } - - CComPtr spDebugAutoAttach; - hr = CoCreateInstance(clsidDebugAutoAttach, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER, __uuidof(IDebugAutoAttach), (void**)&spDebugAutoAttach); - if (FAILED(hr)) - { - if (hr == E_ACCESSDENIED) - RequestComplete(pRequestInfo, 401, 0); - else - { - HandleError(pRequestInfo->pServerContext, 204, DBG_SUBERR_COCREATE); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_COCREATE); - } - return FALSE; - } - hr = spDebugAutoAttach->AutoAttach(GUID_NULL, dwPid, AUTOATTACH_PROGRAM_WIN32, 0, szSessionID); - if (FAILED(hr)) - { - char szRetBuf[256]; - int nLen = sprintf_s(szRetBuf, _countof(szRetBuf), "204 HRESULT=0x%.08X;ErrorString=Unable to attach to worker process", hr); - if (nLen > 0) - { - DWORD dwLen = nLen; - pRequestInfo->pServerContext->SendResponseHeader(NULL, szRetBuf, FALSE); - pRequestInfo->pServerContext->WriteClient(szRetBuf, &dwLen); - RequestComplete(pRequestInfo, 204, DBG_SUBERR_ATTACH); - } - return FALSE; - } - m_bDebug = TRUE; - HandleError(pRequestInfo->pServerContext, 200, SUBERR_NONE); - RequestComplete(pRequestInfo, 200, SUBERR_NONE); - return FALSE; - } - else if (!_strnicmp(szCur, "stop-debug", sizeof("stop-debug")-sizeof('\0'))) - { - m_bDebug = FALSE; - HandleError(pRequestInfo->pServerContext, 200, SUBERR_NONE); - RequestComplete(pRequestInfo, 200, SUBERR_NONE); - return FALSE; - } - else - { - RequestComplete(pRequestInfo, 501, SUBERR_NONE); // Not Implemented - return FALSE; - } - } - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } -#endif // defined(_DEBUG) || defined(ATLS_ENABLE_DEBUGGING) - - BOOL DispatchStencilCall(__inout AtlServerRequest *pRequestInfo) - { - ATLENSURE(pRequestInfo!=NULL); - CSetThreadToken sec; - - m_reqStats.OnRequestDequeued(); - - if (!sec.Initialize(pRequestInfo)) - { - RequestComplete(pRequestInfo, 500, ISE_SUBERR_IMPERSONATIONFAILED); - return FALSE; - } - -#if defined(_DEBUG) || defined(ATLS_ENABLE_DEBUGGING) - if (!ProcessDebug(pRequestInfo)) - return TRUE; -#endif // defined(ATLS_ENABLE_DEBUGGING) - - if (pRequestInfo->m_hMutex) - { - // synchronize in case the previous async_noflush call isn't finished - // setting up state for the next call. - DWORD dwStatus = WaitForSingleObject(pRequestInfo->m_hMutex, ATLS_ASYNC_MUTEX_TIMEOUT); - if (dwStatus != WAIT_OBJECT_0 && dwStatus != WAIT_ABANDONED) - { - RequestComplete(pRequestInfo, 500, ISE_SUBERR_UNEXPECTED); - return FALSE; - } - } - -#ifdef _DEBUG - bool bAsyncAllowed = false; -#endif - HTTP_CODE hcErr = HTTP_SUCCESS; - if (pRequestInfo->dwRequestState == ATLSRV_STATE_BEGIN) - { - BOOL bAllowCaching = TRUE; - if (TransmitFromCache(pRequestInfo, &bAllowCaching)) // Page is in the cache, send it and bail - { // Async Callback will handle freeing pRequestInfo - return TRUE; - } - - // get the srf filename - LPCSTR szFileName = pRequestInfo->pServerContext->GetScriptPathTranslated(); - - if (!szFileName) - { - RequestComplete(pRequestInfo, 500, ISE_SUBERR_UNEXPECTED); - return FALSE; - } - - LPCSTR szDot = szFileName + strlen(szFileName) - 1; - - // load a handler - if (AsciiStricmp(szDot - ATLS_EXTENSION_LEN, c_AtlSRFExtension) == 0) - { - pRequestInfo->dwRequestType = ATLSRV_REQUEST_STENCIL; - hcErr = LoadDispatchFile(szFileName, pRequestInfo); - } - else if (AsciiStricmp(szDot - ATLS_DLL_EXTENSION_LEN, c_AtlDLLExtension) == 0) - { - pRequestInfo->dwRequestType = ATLSRV_REQUEST_DLL; - hcErr = LoadDllHandler(szFileName, pRequestInfo); - } - else - { - hcErr = HTTP_FAIL; - } - - if (hcErr) - { - RequestComplete(pRequestInfo, HTTP_ERROR_CODE(hcErr), HTTP_SUBERROR_CODE(hcErr)); - return TRUE; - } - - pRequestInfo->pfnHandleRequest = &IRequestHandler::HandleRequest; - - // initialize the handler - DWORD dwStatus = 0; - - hcErr = pRequestInfo->pHandler->GetFlags(&dwStatus); - if (hcErr) - { - RequestComplete(pRequestInfo, HTTP_ERROR_CODE(hcErr), HTTP_SUBERROR_CODE(hcErr)); - return FALSE; - } - - if (bAllowCaching && ((dwStatus & ATLSRV_INIT_USECACHE) != 0) && - !strcmp(pRequestInfo->pServerContext->GetRequestMethod(), "GET")) - { - CComPtr spCacheCtx; - if (!GetCacheServerContext(pRequestInfo, &m_PageCache, &spCacheCtx) || - !spCacheCtx) - { - RequestComplete(pRequestInfo, 500, ISE_SUBERR_OUTOFMEM); - return FALSE; - } - - pRequestInfo->pServerContext->Release(); - pRequestInfo->pServerContext = spCacheCtx.Detach(); - } - - if (dwStatus & (ATLSRV_INIT_USEASYNC | ATLSRV_INIT_USEASYNC_EX)) - { -#ifdef _DEBUG - bAsyncAllowed = true; -#endif - if (!pRequestInfo->pServerContext->RequestIOCompletion(AsyncCallback, (DWORD *)pRequestInfo)) - { - RequestComplete(pRequestInfo, 500, SUBERR_NONE); - return FALSE; - } - } - - if (dwStatus & ATLSRV_INIT_USEASYNC_EX) - { - pRequestInfo->m_hMutex = CreateMutex(NULL, FALSE, NULL); - if (pRequestInfo->m_hMutex == NULL) - { - RequestComplete(pRequestInfo, 500, ISE_SUBERR_SYSOBJFAIL); - return FALSE; - } - - DWORD dwMutexStatus = WaitForSingleObject(pRequestInfo->m_hMutex, 10000); - if (dwMutexStatus != WAIT_OBJECT_0 && dwMutexStatus != WAIT_ABANDONED) - { - RequestComplete(pRequestInfo, 500, ISE_SUBERR_UNEXPECTED); - return FALSE; - } - } - hcErr = pRequestInfo->pHandler->InitializeHandler(pRequestInfo, static_cast(this)); - } -#ifdef _DEBUG - else // pRequestInfo->dwRequestState != ATLSRV_STATE_BEGIN - { - bAsyncAllowed = true; - } -#endif - - ATLENSURE(pRequestInfo->pfnHandleRequest != NULL); - - if (hcErr == HTTP_SUCCESS) - hcErr = (pRequestInfo->pHandler->*pRequestInfo->pfnHandleRequest)(pRequestInfo, static_cast(this)); - - if (hcErr == HTTP_SUCCESS_NO_CACHE) - { - CComPtr spControl; - HRESULT hr = pRequestInfo->pServerContext->QueryInterface(__uuidof(IPageCacheControl), reinterpret_cast(&spControl)); - if (hr == S_OK) - spControl->Cache(FALSE); - } - -#ifdef _DEBUG - // must use ATLSRV_INIT_USEASYNC to use ASYNC returns - if (IsAsyncStatus(hcErr)) - ATLASSERT(bAsyncAllowed); - - // must use ATLSRV_INIT_USEASYNC_EX to use NOFLUSH returns - if (IsAsyncNoFlushStatus(hcErr)) - ATLASSERT(pRequestInfo->m_hMutex); -#endif - - // save hMutex in case pRequestInfo is deleted by AsyncCallback after - // we call StartAsyncFlush but before we check to see if we need to - // call ReleaseMutex - HANDLE hMutex = pRequestInfo->m_hMutex; - - if (IsAsyncStatus(hcErr)) - { - if (IsAsyncDoneStatus(hcErr)) - pRequestInfo->dwRequestState = ATLSRV_STATE_DONE; - else - pRequestInfo->dwRequestState = ATLSRV_STATE_CONTINUE; - - if (IsAsyncFlushStatus(hcErr) && !StartAsyncFlush(pRequestInfo)) - { - RequestComplete(pRequestInfo, 500, SUBERR_NONE); - pRequestInfo = NULL; - } - } - else - { - RequestComplete(pRequestInfo, HTTP_ERROR_CODE(hcErr), HTTP_SUBERROR_CODE(hcErr)); - pRequestInfo = NULL; - } - - if (hMutex) - ReleaseMutex(hMutex); - - return TRUE; - } - - BOOL StartAsyncFlush(__in AtlServerRequest *pRequestInfo) - { - ATLENSURE(pRequestInfo); - if (pRequestInfo->pszBuffer == NULL || pRequestInfo->dwBufferLen == 0) - { - ATLASSERT(FALSE); - return FALSE; - } - - ATLENSURE(pRequestInfo->pServerContext); - BOOL bRet = TRUE; - _ATLTRY - { - bRet = pRequestInfo->pServerContext->AsyncWriteClient( - LPVOID(pRequestInfo->pszBuffer), - &pRequestInfo->dwBufferLen); - } - _ATLCATCHALL() - { - bRet = FALSE; - } - - return bRet; - } - - long GetTotalRequests() - { - return m_reqStats.GetTotalRequests(); - } - - long GetFailedRequests() - { - return m_reqStats.GetFailedRequests(); - } - - long GetAvgResponseTime() - { - return m_reqStats.GetAvgResponseTime(); - } - - long GetCurrWaiting() - { - return m_reqStats.GetCurrWaiting(); - } - - long GetMaxWaiting() - { - return m_reqStats.GetMaxWaiting(); - } - - long GetActiveThreads() - { - return m_reqStats.GetActiveThreads(); - } - - __success(SUCCEEDED(return)) __checkReturn HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, __deref_out void **ppv) - { - if (!ppv) - return E_POINTER; - if (InlineIsEqualGUID(riid, __uuidof(IRequestStats))) - { - *ppv = static_cast(this); - AddRef(); - return S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IUnknown)) || - InlineIsEqualGUID(riid, __uuidof(IServiceProvider))) - { - *ppv = static_cast(this); - AddRef(); - return S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IIsapiExtension))) - { - *ppv = static_cast(this); - AddRef(); - return S_OK; - } - return E_NOINTERFACE; - } - - ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - - virtual __checkReturn HRESULT STDMETHODCALLTYPE QueryService( - __in REFGUID guidService, - __in REFIID riid, - __deref_out void **ppvObject) - { - if (!ppvObject) - return E_POINTER; - - if (InlineIsEqualGUID(guidService, __uuidof(IDllCache))) - return m_DllCache.QueryInterface(riid, ppvObject); - else if (InlineIsEqualGUID(guidService, __uuidof(IStencilCache))) - return m_StencilCache.QueryInterface(riid, ppvObject); - else if (InlineIsEqualGUID(guidService, __uuidof(IThreadPoolConfig))) - return m_ThreadPool.QueryInterface(riid, ppvObject); - else if (InlineIsEqualGUID(guidService, __uuidof(IAtlMemMgr))) - { - *ppvObject = static_cast(&m_heap); - return S_OK; - } -#ifndef ATL_NO_SOAP - else if (InlineIsEqualGUID(guidService, __uuidof(ISAXXMLReader))) - { - CIsapiWorker *p = GetThreadWorker(); - ATLENSURE( p != NULL ); - return p->m_spReader->QueryInterface(riid, ppvObject); - } -#endif - - // otherwise look it up in the servicemap - return GetService(guidService, riid, ppvObject); - } - - virtual HRESULT AddService(REFGUID guidService, REFIID riid, IUnknown *punkService, HINSTANCE hInstance) - { - if (!punkService) - return E_INVALIDARG; - - if (!m_DllCache.AddRefModule(hInstance)) - return E_FAIL; - - ServiceNode srvNode; - srvNode.hInst = hInstance; - srvNode.punk = punkService; - Checked::memcpy_s(&srvNode.guidService, sizeof(GUID), &guidService, sizeof(guidService)); - Checked::memcpy_s(&srvNode.riid, sizeof(IID), &riid, sizeof(riid)); - - CComCritSecLock lock(m_critSec, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - { - return hr; - } - - // if the service is already there, return S_FALSE - int nIndex = m_serviceMap.Find(srvNode); - if (nIndex >= 0) - return S_FALSE; - - if (!m_serviceMap.Add(srvNode)) - return E_OUTOFMEMORY; - - punkService->AddRef(); - return S_OK; - } - - virtual HRESULT RemoveService(__in REFGUID guidService, __in REFIID riid) - { - ServiceNode srvNode; - Checked::memcpy_s(&srvNode.guidService, sizeof(GUID), &guidService, sizeof(guidService)); - Checked::memcpy_s(&srvNode.riid, sizeof(IID), &riid, sizeof(riid)); - - CComCritSecLock lock(m_critSec, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - { - return hr; - } - - int nIndex = m_serviceMap.Find(srvNode); - if (nIndex < 0) - return S_FALSE; - - ATLASSUME(m_serviceMap[nIndex].punk != NULL); - m_serviceMap[nIndex].punk->Release(); - - HINSTANCE hInstRemove = m_serviceMap[nIndex].hInst; - - m_serviceMap.RemoveAt(nIndex); - - if (!m_DllCache.ReleaseModule(hInstRemove)) - return S_FALSE; - - return S_OK; - } - - __success(SUCCEEDED(return)) __checkReturn HRESULT GetService(__in REFGUID guidService, __in REFIID riid, __deref_out void **ppvObject) throw() - { - if (!ppvObject) - return E_POINTER; - - *ppvObject = NULL; - if (!m_serviceMap.GetSize()) - return E_NOINTERFACE; - - ServiceNode srvNode; - Checked::memcpy_s(&srvNode.guidService, sizeof(GUID), &guidService, sizeof(guidService)); - Checked::memcpy_s(&srvNode.riid, sizeof(IID), &riid, sizeof(riid)); - - CComCritSecLock lock(m_critSec, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - { - return hr; - } - - int nIndex = m_serviceMap.Find(srvNode); - if (nIndex < 0) - return E_NOINTERFACE; - - ATLASSUME(m_serviceMap[nIndex].punk != NULL); - return m_serviceMap[nIndex].punk->QueryInterface(riid, ppvObject); - } - - HTTP_CODE LoadRequestHandler(__in LPCSTR szDllPath, __in LPCSTR szHandlerName, __in IHttpServerContext *pServerContext, - __out HINSTANCE *phInstance, __deref_out IRequestHandler **ppHandler) - { - return _AtlLoadRequestHandler(szDllPath, szHandlerName, pServerContext, - phInstance, ppHandler, this, static_cast(&m_DllCache)); - } // LoadRequestHandler - -}; // class CIsapiExtension - - -//=========================================================================================== -// IMPORTANT NOTE TO USERS: -// DO NOT ASSUME *ANYTHING* ABOUT THE STRUCTURE OF THESE MAPS/ENTRIES/FUNCTIONS--THEY CAN -// AND *WILL* CHANGE IN THE FUTURE. CORRECT USAGE MANDATES THAT YOU USE THE MACROS PROVIDED. -// ABSOLUTELY NO GUARANTEES ABOUT BACKWARD COMPATABILITY ARE MADE FOR MANUALLY DEFINED -// HANDLERS OR FUNCTIONS. -//=========================================================================================== - -typedef BOOL (*CREATEHANDLERFUNC)(IIsapiExtension *pExtension, IUnknown **ppOut); -typedef BOOL (*INITHANDLERFUNC)(IHttpServerContext*, IIsapiExtension*); -typedef void (*UNINITHANDLERFUNC)(); - -struct _HANDLER_ENTRY -{ - LPCSTR szName; - CREATEHANDLERFUNC pfnCreate; - INITHANDLERFUNC pfnInit; - UNINITHANDLERFUNC pfnUninit; -}; -// definitions of data segments and _HANDLER_ENTRY delimiters -#pragma section("ATLS$A", read, shared) -#pragma section("ATLS$Z", read, shared) -#pragma section("ATLS$C", read, shared) -extern "C" -{ -__declspec(selectany) __declspec(allocate("ATLS$A")) ATL::_HANDLER_ENTRY * __phdlrA = NULL; -__declspec(selectany) __declspec(allocate("ATLS$Z")) ATL::_HANDLER_ENTRY * __phdlrZ = NULL; -} - -#if !defined(_M_IA64) -#pragma comment(linker, "/merge:ATLS=.rdata") -#endif - -#ifndef HANDLER_ENTRY_PRAGMA - -#if defined(_M_IX86) -#define HANDLER_ENTRY_PRAGMA(class, line) __pragma(comment(linker, "/include:___phdlrEntry_" #class "_" #line)); -#elif defined(_M_IA64) -#define HANDLER_ENTRY_PRAGMA(class, line) __pragma(comment(linker, "/include:__phdlrEntry_" #class "_" #line)); -#elif defined(_M_AMD64) -#define HANDLER_ENTRY_PRAGMA(class, line) __pragma(comment(linker, "/include:__phdlrEntry_" #class "_" #line)); -#else -#error Unknown Platform. define HANDLER_ENTRY_PRAGMA -#endif - -#endif // HANDLER_ENTRY_PRAGMA - -// DECLARE_REQUEST_HANDLER macro -#define __DECLARE_REQUEST_HANDLER_INTERNAL(handlerName, className, classQName, lineNum) \ -__declspec(selectany) ATL::_HANDLER_ENTRY __hdlrEntry_ ## className ## _ ## lineNum = { handlerName, classQName::CreateRequestHandler, classQName::InitRequestHandlerClass, classQName::UninitRequestHandlerClass }; \ -extern "C" __declspec(allocate("ATLS$C")) __declspec(selectany) \ -ATL::_HANDLER_ENTRY * const __phdlrEntry_ ## className ## _ ## lineNum = &__hdlrEntry_ ## className ## _ ## lineNum; \ -HANDLER_ENTRY_PRAGMA(className, lineNum) \ -__if_not_exists(GetAtlHandlerByName) \ -{ \ -extern "C" ATL_NOINLINE inline BOOL __declspec(dllexport) __stdcall GetAtlHandlerByName(LPCSTR szHandlerName, IIsapiExtension *pExtension, IUnknown **ppHandler) throw() \ -{ \ - *ppHandler = NULL; \ - ATL::_HANDLER_ENTRY **pEntry = &__phdlrA; \ - while (pEntry != &__phdlrZ) \ - { \ - if (*pEntry && (*pEntry)->szName) \ - { \ - if (strcmp((*pEntry)->szName, szHandlerName)==0) \ - { \ - return (*(*pEntry)->pfnCreate)(pExtension, ppHandler); \ - } \ - } \ - pEntry++; \ - } \ - return FALSE; \ -} \ -extern "C" ATL_NOINLINE inline BOOL __declspec(dllexport) __stdcall InitializeAtlHandlers(IHttpServerContext *pContext, IIsapiExtension *pExt) throw() \ -{ \ - ATL::_HANDLER_ENTRY **pEntry = &__phdlrA; \ - BOOL bRet = TRUE; \ - while (pEntry != &__phdlrZ) \ - { \ - if (*pEntry && (*pEntry)->szName && (*pEntry)->pfnInit) \ - { \ - bRet = (*(*pEntry)->pfnInit)(pContext, pExt); \ - if (!bRet) \ - break; \ - } \ - pEntry++; \ - } \ - if (!bRet) \ - { \ - if (pEntry == &__phdlrA) \ - return FALSE; \ - do \ - { \ - pEntry--; \ - if(*pEntry) \ - (*(*pEntry)->pfnUninit)(); \ - } \ - while (pEntry != &__phdlrA); \ - } \ - return bRet; \ -} \ -extern "C" ATL_NOINLINE inline void __declspec(dllexport) __stdcall UninitializeAtlHandlers() throw() \ -{\ - ATL::_HANDLER_ENTRY **pEntry = &__phdlrA; \ - while (pEntry != &__phdlrZ) \ - { \ - if (*pEntry && (*pEntry)->szName && (*pEntry)->pfnUninit) \ - { \ - (*(*pEntry)->pfnUninit)(); \ - } \ - pEntry++; \ - } \ -} \ -} - -#define __DECLARE_REQUEST_HANDLER(handlerName, className, classQName, lineNum) __DECLARE_REQUEST_HANDLER_INTERNAL(handlerName, className, classQName, lineNum) -#define DECLARE_REQUEST_HANDLER(handlerName, className, classQName) __DECLARE_REQUEST_HANDLER(handlerName, className, classQName, __COUNTER__) - -#define BEGIN_HANDLER_MAP() -#define HANDLER_ENTRY(handlerName, className) DECLARE_REQUEST_HANDLER(handlerName, className, className) -#define HANDLER_ENTRY_EX(handlerName, className, classQName) DECLARE_REQUEST_HANDLER(handlerName, className, classQName) -#define END_HANDLER_MAP() - -#define __HANDLER_ENTRY_SDL_INTERNAL(handlerString, handlerClass, handlerQClass, sdlClassName, lineNum)\ -_ATLSOAP_DECLARE_WSDL_SRF() \ -extern __declspec(selectany) const char const s_szClassName##sdlClassName##lineNum[]=handlerString;\ -typedef ATL::CSDLGenerator sdlClassName; \ -HANDLER_ENTRY_EX(handlerString, handlerClass, handlerQClass)\ -HANDLER_ENTRY(#sdlClassName, sdlClassName) - -#define __HANDLER_ENTRY_SDL(handlerString, handlerClass, handlerQClass, sdlClassName, lineNum) __HANDLER_ENTRY_SDL_INTERNAL(handlerString, handlerClass, handlerQClass, sdlClassName, lineNum) -#define HANDLER_ENTRY_SDL(handlerString, handlerClass, handlerQClass, sdlClassName) __HANDLER_ENTRY_SDL(handlerString, handlerClass, handlerQClass, sdlClassName, __COUNTER__) -// -// Use this class to check the authorization level of a client who is making -// a request to this application. This class checks for the stronger authentication -// levels (NTLM and Negotiate). You can call it directly from an implementation -// of HandleRequest to check authorization before handling a request. -#define MAX_AUTH_TYPE 50 -#define MAX_NAME_LEN 255 - -template -class CVerifyAuth -{ -public: - HTTP_CODE IsAuthorized(__in AtlServerRequest *pInfo, __in_opt const SID* psidAuthGroup) - { - ATLENSURE(pInfo); - ATLENSURE(pInfo->pServerContext); - ATLASSERT(psidAuthGroup); - ATLASSERT(::IsValidSid((PSID) psidAuthGroup)); - - HTTP_CODE hcErr = HTTP_UNAUTHORIZED; - char szAuthType[MAX_AUTH_TYPE]; - DWORD dwSize = MAX_AUTH_TYPE; - _ATLTRY - { - if (pInfo->pServerContext->GetServerVariable("AUTH_TYPE", - szAuthType, &dwSize)) - { - if (szAuthType[0] && (!_stricmp(szAuthType, "NTLM") - || !_stricmp(szAuthType, "Negotiate"))) - { - // if we were passed a group name - // we check to see that the logged on user is part - // of that group, else we just return success. - if (psidAuthGroup) - { - T* pT = static_cast(this); - if (pT->CheckAccount(pInfo->pServerContext, psidAuthGroup)) - hcErr = HTTP_SUCCESS; - else - hcErr = pT->HandleError(pInfo); - } - else - hcErr = HTTP_SUCCESS; - } - } - } - _ATLCATCHALL() - { - hcErr = HTTP_FAIL; - } - - return hcErr; - } - - virtual bool CheckAccount(IHttpServerContext *pContext, const SID *psidAuthGroup) throw() - { - (pContext); // unused - (psidAuthGroup); // unused - return false; - } - - HTTP_CODE HandleError(AtlServerRequest *pRequestInfo) throw() - { - pRequestInfo; // unused - return HTTP_FAIL; - } - - __checkReturn bool CheckAuthAccount(__in IHttpServerContext *pContext, __in const SID* psidAuthGroup) throw() - { - ATLASSERT(pContext); - ATLASSERT(psidAuthGroup); - if (!pContext || !psidAuthGroup) - return false; - - HANDLE hToken = INVALID_HANDLE_VALUE; - bool bIsMember; - _ATLTRY - { - if (!pContext->GetImpersonationToken(&hToken) || - hToken == INVALID_HANDLE_VALUE) - return false; - - CAccessToken tok; - tok.Attach(hToken); - bool bRet = tok.CheckTokenMembership(CSid(psidAuthGroup), &bIsMember); - tok.Detach(); - - if (!bRet) - return false; - } - _ATLCATCHALL() - { - bIsMember = false; - } - - return bIsMember; - } -}; - -// Checks that the user that is logging on is in the required group -class CDefaultAuth : - public CVerifyAuth -{ -public: - virtual bool CheckAccount(__in IHttpServerContext *pContext, __in const SID* psidAuthGroup) throw() - { - return CheckAuthAccount(pContext, psidAuthGroup); - } - - HTTP_CODE HandleError(__in AtlServerRequest *pRequestInfo) throw() - { - ATLASSERT(pRequestInfo); // should always be valid - if(!pRequestInfo) - { - return HTTP_FAIL; - } - - _ATLTRY - { - CHttpResponse response(pRequestInfo->pServerContext); - response.Write(GetErrorResponse()); - response.Flush(); - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - - return HTTP_SUCCESS_NO_PROCESS; - } - - virtual LPCSTR GetErrorResponse() - { - static const char *szResponse = "" - "

NOT AUTHORIZED

" - ""; - return szResponse; - } - -}; - -} // namespace ATL -#pragma pack(pop) - -#pragma warning(pop) - -#endif // __ATLISAPI_H__ diff --git a/include/atl/atlmime.h b/include/atl/atlmime.h deleted file mode 100644 index 06d4fd2f4..000000000 --- a/include/atl/atlmime.h +++ /dev/null @@ -1,2406 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLMIME_H__ -#define __ATLMIME_H__ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma warning(push) -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible - -#ifndef _CPPUNWIND -#pragma warning (push) -#pragma warning(disable: 4702) // unreachable code -#endif // _CPPUNWIND - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -#ifndef ATLMIME_SEPARATOR -#define ATLMIME_SEPARATOR "\r\n\r\n--" -#endif//ATLMIME_SEPARATOR - -#ifndef ATLMIME_VERSION -#define ATLMIME_VERSION "MIME-Version: 1.0" -#endif//ATLMIME_VERSION - -#ifndef ATLMIME_EMAIL -#define ATLMIME_EMAIL "email" -#endif//ATLMIME_EMAIL - -extern __declspec(selectany) const DWORD ATL_MIME_BOUNDARYLEN = 32; -extern __declspec(selectany) const DWORD ATL_MIME_DATE_LEN = 64; - -// Called when message is sent - sets the "Date:" field -inline size_t SetRfc822Time(__out_ecount_part_z_opt(dwLen, return) LPSTR szDate, __in size_t dwLen) throw() -{ - // Max buffer size required(including NULL) - 38 - const size_t s_dwMaxBufferLen = 38; - if (szDate == NULL) - { - return s_dwMaxBufferLen; - } - - if (dwLen < 38) - { - return 0; - } - static const LPCSTR s_months[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - - static const LPCSTR s_days[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - - SYSTEMTIME st; - DWORD dwTimeZoneId=TIME_ZONE_ID_UNKNOWN; - CHAR cDiff; - LONG ltzBias=0; - LONG ltzHour; - LONG ltzMinute; - TIME_ZONE_INFORMATION tzi; - - GetLocalTime(&st); - - // Gets TIME_ZONE_INFORMATION - memset(&tzi, 0, sizeof(tzi)); - dwTimeZoneId = GetTimeZoneInformation(&tzi); - switch (dwTimeZoneId) - { - case TIME_ZONE_ID_STANDARD: - ltzBias = tzi.Bias + tzi.StandardBias; - break; - - case TIME_ZONE_ID_DAYLIGHT: - ltzBias = tzi.Bias + tzi.DaylightBias; - break; - - case TIME_ZONE_ID_UNKNOWN: - default: - ltzBias = tzi.Bias; - break; - } - - // Set Hour Minutes and time zone dif - ltzHour = ltzBias / 60; - ltzMinute = ltzBias % 60; - cDiff = (ltzHour < 0) ? '+' : '-'; - - int nDay = (st.wDayOfWeek > 6) ? 0 : st.wDayOfWeek; - int nMonth = st.wMonth = (WORD)((st.wMonth < 1 || st.wMonth > 12) ? 0 : st.wMonth - 1); - - - // Constructs RFC 822 format: "ddd, dd mmm yyyy hh:mm:ss +/- hhmm\0" - sprintf_s(szDate, dwLen, "Date: %3s, %d %3s %4d %02d:%02d:%02d %c%02d%02d", - s_days[nDay], // "ddd" - st.wDay, // "dd" - s_months[nMonth], // "mmm" - st.wYear, // "yyyy" - st.wHour, // "hh" - st.wMinute, // "mm" - st.wSecond, // "ss" - cDiff, // "+" / "-" - abs (ltzHour), // "hh" - abs (ltzMinute)); // "mm" - return s_dwMaxBufferLen; -} - -inline DWORD GetContentTypeFromFileName(LPCTSTR szFileName, CSimpleString& strContentType) throw() -{ - if (szFileName == NULL) - { - return ERROR_INVALID_DATA; - } - - DWORD dwErr = ERROR_PATH_NOT_FOUND; - _ATLTRY - { - // get the file extension - TCHAR szExt[_MAX_EXT]; - Checked::tsplitpath_s(szFileName, NULL, 0, NULL, 0, NULL, 0, szExt, _countof(szExt)); - if (*szExt) - { - // Query the content type from the registry - CRegKey rkContentType; - dwErr = rkContentType.Open(HKEY_CLASSES_ROOT, szExt, KEY_READ); - if (dwErr == ERROR_SUCCESS) - { - ULONG nChars=0; - dwErr = rkContentType.QueryStringValue(_T("Content Type"), NULL, &nChars); - if (dwErr == ERROR_SUCCESS) - { - LPTSTR szBuf = strContentType.GetBuffer(nChars); - dwErr = rkContentType.QueryStringValue(_T("Content Type"), szBuf, &nChars); - strContentType.ReleaseBuffer(nChars); - } - } - } - - if (dwErr != ERROR_SUCCESS) - { - // default to application/octet-stream - strContentType.SetString(_T("application/octet-stream"), sizeof("application/octet-stream")-1); - } - } - _ATLCATCHALL() - { - dwErr = ERROR_OUTOFMEMORY; - } - - return dwErr; -} - -// CMimeBodyPart is an abstract base class for the body parts -// CMimeAttachment, CMimeText, CMimeHeader. -class CMimeBodyPart -{ -public: - - virtual ~CMimeBodyPart() = 0 {} - - // WriteData - pure virtual method to dump the data for a body part. - virtual BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary, DWORD dwFlags = 0) = 0; - - // GetContentType - pure virtual method to get the content of a body part - virtual LPCSTR GetContentType() = 0; - - // GetCharset - virtual method to get the character set of a body part - // (defaults to ATLSMTP_DEFAULT_CSET). - virtual LPCSTR GetCharset() - { - return ATLSMTP_DEFAULT_CSET; - } - - virtual CMimeBodyPart* Copy() = 0; - -protected: - - // MakeMimeHeader - pure virutal method to create a MIME header for a - // body part. - virtual BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary) = 0; -}; // class CMimeBodyPart - - -// This enum is used with the X-Priority part of the message header -enum ATL_MIME_PRIORITY -{ - ATL_MIME_HIGH_PRIORITY = 1, - ATL_MIME_NORMAL_PRIORITY = 3, - ATL_MIME_LOW_PRIORITY = 5, - ATL_MIME_PRIORITY_ERROR = 0 -}; - - -// CMimeHeader describes the basic RFC 822 message header. -// It also serves as the base class for the CMimeMessage object. -class CMimeHeader : public CMimeBodyPart -{ -protected: - - // Pointer to MLANG's IMultiLanguage interface. - // This is used in doing conversion from code pages - // to MIME-compatible character sets. - CComPtr m_spMultiLanguage; - - //Basic Header Parts - CStringA m_strFrom; - CStringA m_strTo; - CStringA m_strCc; - CStringA m_strBcc; - CStringA m_strSubject; - - //Extended Header Parts - ATL_MIME_PRIORITY m_nPriority; - CStringA m_XHeader; - - //Display Names - CStringA m_strSenderName; - - //MIME Character Sets - char m_szSubjectCharset[ATL_MAX_ENC_CHARSET_LENGTH]; - char m_szSenderCharset[ATL_MAX_ENC_CHARSET_LENGTH]; - - //Recipient and CC charsets are encoded in the Add methods - -public: - - CMimeHeader() throw() - :m_nPriority(ATL_MIME_NORMAL_PRIORITY) - { - m_szSubjectCharset[0] = '\0'; - m_szSenderCharset[0] = '\0'; - } - - ~CMimeHeader() throw() - { - } - - // Initialize MLang for multilanguage support - inline BOOL Initialize(IMultiLanguage* pMultiLanguage = NULL) throw() - { - if (pMultiLanguage != NULL) - { - m_spMultiLanguage = pMultiLanguage; - } - else - { - HRESULT hr = m_spMultiLanguage.CoCreateInstance(__uuidof(CMultiLanguage), NULL, CLSCTX_INPROC_SERVER); - if (hr != S_OK) - return FALSE; - } - return TRUE; - } - - // Get the content type - virtual inline LPCSTR GetContentType() throw() - { - return "text/plain"; - } - - // Get the character set - virtual inline LPCSTR GetCharset() throw() - { - return "iso-8859-1"; - } - - virtual ATL_NOINLINE CMimeBodyPart* Copy() throw( ... ) - { - CAutoPtr pNewHeader; - ATLTRY(pNewHeader.Attach(new CMimeHeader)); - if (pNewHeader) - *pNewHeader = *this; - - return pNewHeader.Detach(); - } - - const CMimeHeader& operator=(const CMimeHeader& that) throw( ... ) - { - if (this != &that) - { - m_spMultiLanguage = that.m_spMultiLanguage; - m_strFrom = that.m_strFrom; - m_strTo = that.m_strTo; - m_strCc = that.m_strCc; - m_strSubject = that.m_strSubject; - - m_nPriority = that.m_nPriority; - m_XHeader = that.m_XHeader; - - m_strSenderName = that.m_strSenderName; - - Checked::strcpy_s(m_szSubjectCharset, ATL_MAX_ENC_CHARSET_LENGTH, that.m_szSubjectCharset); - Checked::strcpy_s(m_szSenderCharset, ATL_MAX_ENC_CHARSET_LENGTH, that.m_szSenderCharset); - } - - return *this; - } - - // Set the priority of the message - inline BOOL SetPriority(ATL_MIME_PRIORITY nPriority) throw() - { - if (nPriority < 0) - return FALSE; - m_nPriority = nPriority; - return TRUE; - } - - // Get the priority of the message - inline ATL_MIME_PRIORITY GetPriority() throw() - { - return m_nPriority; - } - - // Set the display (friendly) name for the header - inline BOOL SetSenderName(LPCTSTR szName, UINT uiCodePage = 0) throw() - { - if (szName == NULL) - return FALSE; - - CHeapPtr szNamePtr; - UINT nLen(0); - - BOOL bRet = AtlMimeConvertString(m_spMultiLanguage, uiCodePage, szName, &szNamePtr, &nLen); - if (bRet) - { - _ATLTRY - { - m_strSenderName.Empty(); - m_strSenderName.Append(szNamePtr, (int) nLen); - } - _ATLCATCHALL() - { - return FALSE; - } - bRet = AtlMimeCharsetFromCodePage(m_szSenderCharset, uiCodePage, m_spMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH); - } - - return bRet; - } - - // Get the display (friendly) name for the sender - inline LPCSTR GetSenderName() throw() - { - return m_strSenderName; - } - - // Append a user defined header (should not contain CRLF) - inline BOOL AppendUserDefinedHeader(LPCTSTR szHeaderName, LPCTSTR szHeader, UINT uiCodePage = 0) throw() - { - if ((szHeader == NULL) || (szHeaderName == NULL)) - return FALSE; - - _ATLTRY - { - CHeapPtr szName; - UINT nLen(0); - - BOOL bRet = AtlMimeConvertString(m_spMultiLanguage, uiCodePage, szHeader, &szName, &nLen); - if (bRet) - { - // get the charset - char szCharset[ATL_MAX_ENC_CHARSET_LENGTH]; - bRet = AtlMimeCharsetFromCodePage(szCharset, uiCodePage, m_spMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH); - - if (bRet) - { - CStringA str; - str.Append(szName, (int)nLen); - - // encode the string - CHeapPtr szBuf; - DWORD dwReqLen = QEncodeGetRequiredLength(str.GetLength(), - ATL_MAX_ENC_CHARSET_LENGTH); - - if (szBuf.Allocate(dwReqLen) == false) - { - return FALSE; - } - - DWORD dwLength(0); - BOOL bEncoded = FALSE; - if (!GetEncodedString(str, szCharset, szBuf, dwReqLen, dwLength, bEncoded)) - { - return FALSE; - } - - // add to m_XHeader - m_XHeader += CT2CA(szHeaderName); - m_XHeader.Append(": ", 2); - m_XHeader.Append(szBuf, dwLength); - m_XHeader.Append("\r\n", 2); - } - } - - return bRet; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Add a recipient ("To:" line) - inline BOOL AddRecipient(LPCTSTR szAddress, LPCTSTR szName = NULL, UINT uiCodePage = 0) throw() - { - return AddRecipientHelper(m_strTo, szAddress, szName, uiCodePage); - } - - // Get the recipients string ("To:" line) - inline LPCSTR GetRecipients() throw() - { - return m_strTo; - } - - // Clear all recipients ("To:" line) - inline BOOL ClearRecipients() throw() - { - m_strTo.Empty(); - return TRUE; - } - - // Add a recipient ("CC:" line) - inline BOOL AddCc(LPCTSTR szAddress, LPCTSTR szName = NULL, UINT uiCodePage = 0) throw() - { - return AddRecipientHelper(m_strCc, szAddress, szName, uiCodePage); - } - - // Get the recipients string ("CC:" line) - inline LPCSTR GetCc() throw() - { - return m_strCc; - } - - // Clear the recipients string ("CC:" line) - inline BOOL ClearCc() throw() - { - m_strCc.Empty(); - return TRUE; - } - - // Add a Bcc recipient (not output as part of message) - inline BOOL AddBcc(LPCTSTR szAddress) throw() - { - if (szAddress == NULL) - { - return FALSE; - } - - _ATLTRY - { - CStringA str = m_strBcc; - - if (m_strBcc.GetLength() > 0) - str.Append(",", 1); - - str += CT2CA(szAddress); - - m_strBcc = str; - - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Get the recipients string (Bcc part) - inline LPCSTR GetBcc() throw() - { - return m_strBcc; - } - - // Clear the recipients string (Bcc part) - inline BOOL ClearBcc() throw() - { - m_strBcc.Empty(); - return TRUE; - } - - - inline DWORD GetRequiredRecipientsStringLength() throw() - { - DWORD dwRet = m_strTo.GetLength(); - if (m_strCc.GetLength()) - { - dwRet += dwRet ? 1 : 0; - dwRet += m_strCc.GetLength(); - } - if (m_strBcc.GetLength()) - { - dwRet += dwRet ? 1 : 0; - dwRet += m_strBcc.GetLength(); - } - dwRet++; - return dwRet; - } - - // returns the recipients string to be (addresses only, in comma separated format) - ATL_NOINLINE BOOL GetRecipientsString(__out_ecount_part_z(*pdwLen, *pdwLen) LPSTR szRecip, __inout LPDWORD pdwLen) throw() - { - if ( (szRecip == NULL) || (pdwLen == NULL) ) - { - return FALSE; - } - - if ( *pdwLen < GetRequiredRecipientsStringLength()) - { - *pdwLen = GetRequiredRecipientsStringLength(); - return FALSE; - } - - DWORD dwMaxLen = *pdwLen; - *pdwLen = 0; - - DWORD dwLen = 0; - DWORD dwTotalLen = 0; - if (m_strTo.GetLength() > 0) - { - dwLen = *pdwLen - dwTotalLen; - if (AtlMimeMakeRecipientsString(m_strTo, szRecip, &dwLen) != TRUE) - { - return FALSE; - } - szRecip+= dwLen; - dwTotalLen = dwLen; - } - - if (m_strCc.GetLength() > 0) - { - if (dwTotalLen) - { - *szRecip++ = ','; - dwTotalLen++; - } - dwLen = *pdwLen - dwTotalLen; - if (AtlMimeMakeRecipientsString(m_strCc, szRecip, &dwLen) != TRUE) - { - return FALSE; - } - szRecip+= dwLen; - dwTotalLen+= dwLen; - } - - if (m_strBcc.GetLength() > 0) - { - dwLen = m_strBcc.GetLength(); - if (dwTotalLen) - { - *szRecip++ = ','; - dwTotalLen++; - } - dwLen = *pdwLen - dwTotalLen; - Checked::memcpy_s(szRecip, dwMaxLen-dwTotalLen, m_strBcc, dwLen); - szRecip+= dwLen; - dwTotalLen+= dwLen; - } - - *szRecip = '\0'; - *pdwLen = dwTotalLen; - - return TRUE; - } - - - // Get the sender - inline LPCSTR GetSender() throw() - { - return m_strFrom; - } - - // Set the sender - inline BOOL SetSender(LPCTSTR szSender) throw() - { - if (szSender == NULL) - return FALSE; - - _ATLTRY - { - m_strFrom = CT2CA(szSender); - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Set the subject - inline BOOL SetSubject(LPCTSTR szSubject, UINT uiCodePage = 0) throw() - { - if (szSubject == NULL) - return FALSE; - - _ATLTRY - { - CHeapPtr szName; - UINT nLen(0); - - BOOL bRet = AtlMimeConvertString(m_spMultiLanguage, uiCodePage, szSubject, &szName, &nLen); - if (bRet) - { - m_strSubject.Empty(); - m_strSubject.Append(szName, (int)nLen); - bRet = AtlMimeCharsetFromCodePage(m_szSubjectCharset, uiCodePage, m_spMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH); - } - - return bRet; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Get the subject - inline LPCSTR GetSubject() throw() - { - return (LPCSTR)m_strSubject; - } - - // Dump the header to hFile - virtual inline BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR /*szBoundary*/, DWORD dwFlags = 0) throw() - { - if (pOverlapped == NULL) - { - return FALSE; - } - - int nMaxSendLen = GetRequiredBufferSize(ATLSMTP_MAX_LINE_LENGTH-4); - CHeapPtr spSendBuffer; - if (!spSendBuffer.Allocate(nMaxSendLen)) - return FALSE; - - // choose QEncode here, because the max QEncodeGetRequiredLength will always - // return a value greater than BEncodeGetRequiredLength - int nBufLen = __max(QEncodeGetRequiredLength(m_strSubject.GetLength(), - ATL_MAX_ENC_CHARSET_LENGTH), - QEncodeGetRequiredLength(m_strSenderName.GetLength(), - ATL_MAX_ENC_CHARSET_LENGTH)+m_strFrom.GetLength()+2); - - CHeapPtr spBuf; - if (!spBuf.Allocate(nBufLen)) - return FALSE; - - int nMaxLen = nBufLen; - DWORD dwOffset = 0; - - char szDate[ATL_MIME_DATE_LEN]; - - SetRfc822Time(szDate, ATL_MIME_DATE_LEN); - char *pSendBuffer = spSendBuffer; - - DWORD dwLength = (DWORD) strlen(szDate); - - if(dwLength > ATLSMTP_MAX_LINE_LENGTH -2 -dwOffset ) - return FALSE; - - Checked::memcpy_s(pSendBuffer+dwOffset, nMaxSendLen-dwOffset, szDate, dwLength); - dwOffset += dwLength; - *(pSendBuffer+dwOffset++) = '\r'; - *(pSendBuffer+dwOffset++) = '\n'; - - int dwHeaderPartLength = 0; - *spBuf = '\0'; - - // Get the sender name - BOOL bRet = TRUE; - BOOL bEncoded = FALSE; - if (m_strSenderName.GetLength() > 0) - { - bRet = GetEncodedString(m_strSenderName, m_szSenderCharset, spBuf, nBufLen, dwLength, bEncoded); - dwHeaderPartLength += dwLength; - } - - // Get the sender email address - if (bRet && m_strFrom.GetLength() > 0) - { - - if (dwHeaderPartLength != 0) - { - if(dwHeaderPartLength + 1 > nBufLen) - return FALSE; - - *(spBuf+dwHeaderPartLength++) = ' '; - } - - if(dwHeaderPartLength + m_strFrom.GetLength() + 2 > nBufLen) - return FALSE; - - *(spBuf+dwHeaderPartLength++) = '<'; - if (dwHeaderPartLength < 0 || dwHeaderPartLength > nMaxLen) - { - return FALSE; - } - Checked::memcpy_s(spBuf+dwHeaderPartLength, nMaxLen-dwHeaderPartLength, (LPCSTR)m_strFrom, m_strFrom.GetLength()); - dwHeaderPartLength+= m_strFrom.GetLength(); - *(spBuf+dwHeaderPartLength++) = '>'; - } - - // Output the "From: " line - if (bRet && dwHeaderPartLength != 0) - { - const char szFrom[] = "From: "; - if(sizeof(szFrom)/sizeof(szFrom[0])-1 > ATLSMTP_MAX_LINE_LENGTH -2 -dwOffset ) - return FALSE; - if (dwOffset > static_cast(nMaxSendLen)) - { - return FALSE; - } - Checked::memcpy_s(pSendBuffer+dwOffset, nMaxSendLen-dwOffset, szFrom, _countof(szFrom)-1); - dwOffset+= (sizeof(szFrom)/sizeof(szFrom[0])-1) ; - DWORD dwWritten = ATLSMTP_MAX_LINE_LENGTH - 2 - dwOffset; - bRet = FormatField((LPBYTE)(char*)spBuf, dwHeaderPartLength, (LPBYTE)(pSendBuffer+dwOffset), &dwWritten, dwFlags); - dwOffset += dwWritten; - *(pSendBuffer+dwOffset++) = '\r'; - *(pSendBuffer+dwOffset++) = '\n'; - } - - // Output the subject - if (bRet && m_strSubject.GetLength() > 0) - { - dwLength = 0; - bRet = GetEncodedString(m_strSubject, m_szSubjectCharset, spBuf, nBufLen, dwLength, bEncoded); - if (bRet && dwLength != 0) - { - const char szSubject[] = "Subject: "; - if(sizeof(szSubject)/sizeof(szSubject[0])-1 > ATLSMTP_MAX_LINE_LENGTH -2 -dwOffset ) - return FALSE; - if (dwOffset > static_cast(nMaxSendLen)) - { - return FALSE; - } - Checked::memcpy_s(pSendBuffer+dwOffset, nMaxSendLen-dwOffset, szSubject, _countof(szSubject)-1); - dwOffset+= (sizeof(szSubject)/sizeof(szSubject[0])-1); - DWORD dwWritten = ATLSMTP_MAX_LINE_LENGTH - 2 - dwOffset; - bRet = FormatField((LPBYTE)(char*)spBuf, dwLength, (LPBYTE)(pSendBuffer+dwOffset), &dwWritten, dwFlags); - dwOffset += dwWritten; - *(pSendBuffer+dwOffset++) = '\r'; - *(pSendBuffer+dwOffset++) = '\n'; - } - } - - // Output the "To:" line - if (bRet && m_strTo.GetLength() > 0) - { - const char szTo[] = "To: "; - if(sizeof(szTo)/sizeof(szTo[0])-1 > ATLSMTP_MAX_LINE_LENGTH -2 -dwOffset ) - return FALSE; - if (dwOffset > static_cast(nMaxSendLen)) - { - return FALSE; - } - Checked::memcpy_s(pSendBuffer+dwOffset, nMaxSendLen-dwOffset, szTo, _countof(szTo)-1); - dwOffset+= (sizeof(szTo)/sizeof(szTo[0]) -1); - DWORD dwWritten = ATLSMTP_MAX_LINE_LENGTH - 2 - dwOffset; - bRet = FormatRecipients((LPBYTE)((LPCSTR)m_strTo), m_strTo.GetLength(), (LPBYTE)(pSendBuffer+dwOffset), &dwWritten); - dwOffset+= dwWritten; - *(pSendBuffer+dwOffset++) = '\r'; - *(pSendBuffer+dwOffset++) = '\n'; - } - - // Output the "CC:" line - if (bRet && m_strCc.GetLength() > 0) - { - const char szCC[] = "CC: "; - if(sizeof(szCC)/sizeof(szCC[0])-1 > ATLSMTP_MAX_LINE_LENGTH -2 -dwOffset ) - return FALSE; - if (dwOffset > static_cast(nMaxSendLen)) - { - return FALSE; - } - Checked::memcpy_s(pSendBuffer+dwOffset, nMaxSendLen-dwOffset, szCC, _countof(szCC)-1); - dwOffset+= (sizeof(szCC)/sizeof(szCC[0]) -1); - DWORD dwWritten = ATLSMTP_MAX_LINE_LENGTH - 2 - dwOffset; - bRet = FormatRecipients((LPBYTE)((LPCSTR)m_strCc), m_strCc.GetLength(), (LPBYTE)(pSendBuffer+dwOffset), &dwWritten); - dwOffset+= dwWritten; - *(pSendBuffer+dwOffset++) = '\r'; - *(pSendBuffer+dwOffset++) = '\n'; - } - - // Send the header - if (bRet && dwOffset) - bRet = AtlSmtpSendAndWait(hFile, pSendBuffer, dwOffset, pOverlapped); - - return bRet; - } - -protected: - - // Make the mime header - virtual inline BOOL MakeMimeHeader(CStringA& /*header*/, LPCSTR /*szBoundary*/) throw() - { - // The message header does not have its own MIME header - ATLASSERT(FALSE); - return TRUE; - } - - // Get an encoded string for a header field - inline BOOL GetEncodedString(__in CStringA& headerString, __in LPCSTR szCharset, __out_ecount_part_z(nBufLen, dwLength) LPSTR szBuf, __in int nBufLen, __out DWORD& dwLength, __out BOOL& bEncoded) throw() - { -// BOOL bEncoded = FALSE; - bEncoded = FALSE; - if (m_spMultiLanguage.p) - { - // only encode if there are 8bit characters - int nExtendedChars = GetExtendedChars(headerString, headerString.GetLength()); - if (nExtendedChars) - { - // choose smallest encoding - if (((nExtendedChars*100)/headerString.GetLength()) < 17) - { - int nEncCnt = 0; - if (!QEncode((LPBYTE)((LPCSTR)headerString), headerString.GetLength(), szBuf, &nBufLen, szCharset, &nEncCnt)) - { - return FALSE; - } - - //if no unsafe characters were encountered, just output it - if (nEncCnt != 0) - { - bEncoded = TRUE; - } - } - else - { - if (!BEncode((LPBYTE)((LPCSTR)headerString), headerString.GetLength(), szBuf, &nBufLen, szCharset)) - { - return FALSE; - } - - bEncoded = TRUE; - } - } - } - - if (!bEncoded) - { - // there was no encoding - dwLength = (DWORD) headerString.GetLength(); - if(dwLength > DWORD(nBufLen)) - return FALSE; - Checked::memcpy_s(szBuf, nBufLen, headerString, dwLength); - } - else - { - dwLength = nBufLen; - } - return TRUE; - } - - - // Helper function for adding recipients - inline BOOL AddRecipientHelper(CStringA& str, LPCTSTR szAddress, LPCTSTR szName = NULL, UINT uiCodePage = 0) throw() - { - if ((szAddress == NULL) && (szName == NULL)) - { - return FALSE; - } - - _ATLTRY - { - if (szName) - { - CHeapPtr szNamePtr; - UINT nLen(0); - - BOOL bRet = AtlMimeConvertString(m_spMultiLanguage, uiCodePage, szName, &szNamePtr, &nLen); - if (bRet) - { - CStringA Name(szNamePtr, (int)nLen); - - char szCharset[ATL_MAX_ENC_CHARSET_LENGTH]; - - if (!AtlMimeCharsetFromCodePage(szCharset, uiCodePage, m_spMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH)) - { - return FALSE; - } - - CFixedStringT strBuf; - - int nBufLen = QEncodeGetRequiredLength(Name.GetLength(), - ATL_MAX_ENC_CHARSET_LENGTH)+1; - - char * szBuf = strBuf.GetBuffer(nBufLen); - if (szBuf == NULL) - { - return FALSE; - } - - DWORD dwLength = 0; - BOOL bEncoded = FALSE; - if (!GetEncodedString(Name, szCharset, szBuf, nBufLen, dwLength, bEncoded)) - { - strBuf.ReleaseBuffer(); - return FALSE; - } - - strBuf.ReleaseBuffer(dwLength); - - // append comma if there are existing recipients - if (str.GetLength() != 0) - { - str.Append(", ", 2); - } - - if (bEncoded == FALSE) - { - // need to escape the string if no encoding - strBuf.Replace("\\", "\\\\"); - strBuf.Replace("\"", "\\\""); - - // wrap the unescaped name in quotes - str.Append("\"", 1); - } - str += strBuf; - if (bEncoded == FALSE) - { - // close quote - str.Append("\"", 1); - } - } - else - { - return bRet; - } - } - - if (szAddress) - { - if (szName) - { - str.Append(" ", 1); - } - else - { - // append comma if there are existing recipients - if (str.GetLength() != 0) - { - str.Append(", ", 2); - } - } - str.Append("<", 1); - str += CT2CA(szAddress); - str.Append(">", 1); - } - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Get the formatted header information - inline BOOL FormatField(LPBYTE pbSrcData, int nSrcLen, LPBYTE pbDest, - DWORD* pnBufLen, DWORD dwFlags = 0) throw() - { - if(pnBufLen == NULL) - return FALSE; - - int nRead = 0; - - // 9 is the length of the maximum field name : "Subject :" - // we set that here for simplicity - int nLineLen = 9; - DWORD nWritten = 0; - - //subtract 2 from these because it's easier for when we have - //to break lines with a CRLF (and tab if necessary) - int nMaxLineLength = ATLSMTP_MAX_LINE_LENGTH-3; - while (nRead < nSrcLen) - { - //if we're at the end of the line, break it - if (nLineLen == nMaxLineLength) - { - if( nWritten + 2 > *pnBufLen) - return FALSE; - - *pbDest++ = '\r'; - *pbDest++ = '\n'; - nWritten+= 2; - nLineLen = -1; - - if ((dwFlags & ATLSMTP_FORMAT_SMTP)) - { - if(nWritten + 1 > *pnBufLen) - return FALSE; - - *pbDest++ = '\t'; - nWritten++; - nLineLen++; - } - } - - //if we hit a CRLF, reset nLineLen - if (*pbSrcData == '\n' && nRead > 0 && *(pbSrcData-1) == '\r') - { - nLineLen = -1; - } - - if(nWritten + 1 > *pnBufLen) - return FALSE; - - *pbDest++ = *pbSrcData++; - nRead++; - nWritten++; - nLineLen++; - } - - *pnBufLen = (DWORD)nWritten; - - return TRUE; - } - - - // Get the formatted recipient information - inline BOOL FormatRecipients(LPBYTE pbSrcData, int nSrcLen, LPBYTE pbDest, - DWORD* pnBufLen) throw() - { - - if(pnBufLen == NULL) - return FALSE; - - int nRead = 0; - DWORD nWritten = 0; - - while (nRead < nSrcLen) - { - if (*pbSrcData == ',') - { - if(nWritten + 4 > *pnBufLen) - return FALSE; - - *pbDest++ = *pbSrcData++; - nRead++; - if (nRead+1 <= nSrcLen && *pbSrcData == ' ') - { - pbSrcData++; - nRead++; - } - *pbDest++ = '\r'; - *pbDest++ = '\n'; - *pbDest++ = '\t'; - nWritten+= 4; - - continue; - } - - if(nWritten + 1 > *pnBufLen) - return FALSE; - - *pbDest++ = *pbSrcData++; - nRead++; - nWritten++; - } - - *pnBufLen = nWritten; - - return TRUE; - } - - // Get the required buffer size for the header - inline int GetRequiredBufferSize(int nMaxLineLength) throw() - { - const static DWORD DATELINE = 27; - const static DWORD FROMLINE = 10; - const static DWORD TOLINE = 6; - const static DWORD CCLINE = 6; - const static DWORD SUBJECTLINE = 11; - - //data lengths (QEncoding potentially takes up more space than BEncoding, - //so default to it) - int nRequiredLength = QEncodeGetRequiredLength(m_strSenderName.GetLength(), ATL_MAX_ENC_CHARSET_LENGTH) - +QEncodeGetRequiredLength(m_strSubject.GetLength(), ATL_MAX_ENC_CHARSET_LENGTH); - nRequiredLength += m_strFrom.GetLength()+m_strTo.GetLength()+m_strCc.GetLength(); - - //Add space for date - nRequiredLength += DATELINE; - - //Add space for From: line - nRequiredLength += FROMLINE; - - //Add space for To: line - nRequiredLength += TOLINE; - - //Add space for Cc: line - nRequiredLength += CCLINE; - - //Add space for Subject: line - nRequiredLength += SUBJECTLINE; - - //Add space for line breaks and tabs - nRequiredLength += 3*(nRequiredLength/nMaxLineLength); - - //Trailing CRLF - nRequiredLength += 2; - - return nRequiredLength; - } - -}; // class CMimeHeader - - -// CMimeAttachment is an abstract base class for MIME message attachments. -// It serves as a base class for CMimeFileAttachment and CMimeRawAttachment -class CMimeAttachment : public CMimeBodyPart -{ -protected: - - // the encoding scheme (ATLSMTP_BASE64_ENCODE, ATLSMTP_UUENCODE, ATLSMTP_QP_ENCODE) - int m_nEncodingScheme; - - // the content type of the attachment - CStringA m_ContentType; - - // the character set - char m_szCharset[ATL_MAX_ENC_CHARSET_LENGTH]; - - // the encode string ("base64", "quoted-printable", "uuencode") - char *m_pszEncodeString; - - // the display name of the attachment - TCHAR m_szDisplayName[_MAX_FNAME]; - -public: - CMimeAttachment() throw() - :m_nEncodingScheme(ATLSMTP_BASE64_ENCODE), m_pszEncodeString(NULL) - { - m_szCharset[0] = 0; - m_szDisplayName[0] = 0; - } - - virtual ~CMimeAttachment() throw() - { - } - - // CMimeFileAttachment and CMimeRawAttachment have to handle their own dumping - virtual inline BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary, DWORD dwFlags = 0) = 0; - - // Set the encoding scheme of the attachment - inline BOOL SetEncodingScheme(int nScheme) throw() - { - if (nScheme != ATLSMTP_BASE64_ENCODE && nScheme != ATLSMTP_UUENCODE && nScheme != ATLSMTP_QP_ENCODE) - { - return FALSE; - } - - m_nEncodingScheme = nScheme; - return TRUE; - } - - // Set the Content-Type of the attachment - inline BOOL SetContentType(LPCTSTR szContent) throw() - { - _ATLTRY - { - m_ContentType = CT2CA(szContent); - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Get the content type of the attachment - virtual inline LPCSTR GetContentType() throw() - { - return m_ContentType; - } - - // Get the character set of the attachment - virtual inline LPCSTR GetCharset() throw() - { - return m_szCharset; - } - - virtual ATL_NOINLINE CMimeBodyPart* Copy() = 0; - - const CMimeAttachment& operator=(const CMimeAttachment& that) throw( ... ) - { - if (this != &that) - { - m_nEncodingScheme = that.m_nEncodingScheme; - m_ContentType = that.m_ContentType; - Checked::strcpy_s(m_szCharset, ATL_MAX_ENC_CHARSET_LENGTH, that.m_szCharset); - m_pszEncodeString = that.m_pszEncodeString; - Checked::tcscpy_s(m_szDisplayName, _countof(m_szDisplayName), that.m_szDisplayName); - } - - return *this; - } - -protected: - - // Make the MIME header for the attachment - virtual inline BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary) throw() - { - // if no display name is specified, default to "rawdata" - return MakeMimeHeader(header, szBoundary, _T("rawdata")); - } - - // Make the MIME header with the specified filename - virtual inline BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary, LPCTSTR szFileName) - { - ATLENSURE(szBoundary != NULL); - ATLASSERT(szFileName != NULL); - ATLASSUME(m_pszEncodeString != NULL); - - char szBegin[256]; - if (*szBoundary) - { - // this is not the only body part - Checked::memcpy_s(szBegin, 256, ATLMIME_SEPARATOR, sizeof(ATLMIME_SEPARATOR)); - Checked::memcpy_s(szBegin+6, 250, szBoundary, ATL_MIME_BOUNDARYLEN); - *(szBegin+(ATL_MIME_BOUNDARYLEN+6)) = '\0'; - } - else - { - // this is the only body part, so output the MIME header - Checked::memcpy_s(szBegin, 256, ATLMIME_VERSION, sizeof(ATLMIME_VERSION)); - } - - // Get file name with the path stripped out - TCHAR szFile[MAX_PATH+1]; - TCHAR szExt[_MAX_EXT+1]; - Checked::tsplitpath_s(szFileName, NULL, 0, NULL, 0, szFile, _countof(szFile), szExt, _countof(szExt)); - Checked::tcscat_s(szFile, _countof(szFile), szExt); - - _ATLTRY - { - CT2CAEX szFileNameA(szFile); - - CStringA szDisplayName(szFile); - if (m_szDisplayName[0] != '\0') - { - szDisplayName = CT2CAEX<_MAX_FNAME+1>(m_szDisplayName); - } - - header.Format("%s\r\nContent-Type: %s;\r\n\tcharset=\"%s\"\r\n\tname=\"%s\"\r\n" - "Content-Transfer-Encoding: %s\r\nContent-Disposition: attachment;\r\n\tfilename=\"%s\"\r\n\r\n", - szBegin, (LPCSTR) m_ContentType, m_szCharset, (LPCSTR) szDisplayName, m_pszEncodeString, (LPCSTR) szFileNameA); - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Get encoding information - inline BOOL GetEncodingInformation(int* pnRequiredLength, int* pnLineLength) - { - ATLENSURE(pnRequiredLength != NULL); - ATLENSURE(pnLineLength != NULL); - - switch(m_nEncodingScheme) - { - case ATLSMTP_BASE64_ENCODE: - m_pszEncodeString = "base64"; - *pnLineLength = ATLSMTP_MAX_BASE64_LINE_LENGTH; - *pnRequiredLength = Base64EncodeGetRequiredLength(ATLSMTP_MAX_BASE64_LINE_LENGTH); - break; - case ATLSMTP_UUENCODE: - m_pszEncodeString ="uuencode"; - *pnLineLength = ATLSMTP_MAX_UUENCODE_LINE_LENGTH; - *pnRequiredLength = UUEncodeGetRequiredLength(ATLSMTP_MAX_UUENCODE_LINE_LENGTH); - break; - case ATLSMTP_QP_ENCODE: - m_pszEncodeString = "quoted-printable"; - *pnLineLength = ATLSMTP_MAX_QP_LINE_LENGTH; - *pnRequiredLength = QPEncodeGetRequiredLength(ATLSMTP_MAX_QP_LINE_LENGTH); - break; - default: - return FALSE; - } - return TRUE; - } - -}; // class CMimeAttachment - - -// CMimeFileAttachment represents a MIME file attachment body part -class CMimeFileAttachment : public CMimeAttachment -{ - -protected: - // The filename - TCHAR m_szFileName[MAX_PATH+1]; - -public: - CMimeFileAttachment() throw() - { - m_szFileName[0] = 0; - } - - virtual ATL_NOINLINE CMimeBodyPart* Copy() throw( ... ) - { - CAutoPtr pNewAttachment; - ATLTRY(pNewAttachment.Attach(new CMimeFileAttachment)); - if (pNewAttachment) - *pNewAttachment = *this; - - return pNewAttachment.Detach(); - } - - const CMimeFileAttachment& operator=(const CMimeFileAttachment& that) throw( ... ) - { - if (this != &that) - { - CMimeAttachment::operator=(that); - Checked::tcscpy_s(m_szFileName, _countof(m_szFileName), that.m_szFileName); - } - - return *this; - } - - - // Initialize the file attachment - // szFileName - the actual file name - // szDisplayName - the display name for the file (optional) - // pMultiLanguage - the IMulitLanguage pointer for codepage to charset conversion (optional) - // uiCodePage - the code page (optional) - inline BOOL Initialize(LPCTSTR szFileName, LPCTSTR szDisplayName = NULL, IMultiLanguage* pMultiLanguage = NULL, UINT uiCodePage = 0) throw() - { - if (!AtlMimeCharsetFromCodePage(m_szCharset, uiCodePage, pMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH)) - return FALSE; - - if( _tcslen(szFileName) > MAX_PATH ) - { - return FALSE; - } - Checked::tcscpy_s(m_szFileName, _countof(m_szFileName), szFileName); - - if (szDisplayName) - { - // use the user-specified display name - size_t nLen = _tcslen(szDisplayName)+1; - if (nLen <= _countof(m_szDisplayName)) - { - Checked::tcscpy_s(m_szDisplayName, _countof(m_szDisplayName), szDisplayName); - } - else - { - Checked::tcsncpy_s(m_szDisplayName, _countof(m_szDisplayName), szDisplayName, _countof(m_szDisplayName) - 4); - Checked::tcscpy_s(m_szDisplayName + _countof(m_szDisplayName) - 4, 4, _T("...")); - } - } - else - { - // otherwise there is no display name - *m_szDisplayName = '\0'; - } - return TRUE; - } - - // Dump the data for the file attachment - virtual inline BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary, DWORD dwFlags = 0) throw() - { - if ((pOverlapped == NULL) || (szBoundary == NULL)) - { - return FALSE; - } - - int nLineLength = 0; - int nRequiredLength = 0; - - if (!GetEncodingInformation(&nRequiredLength, &nLineLength)) - return FALSE; - - //Try to open the file that is being attached - CAtlFile readFile; - if (FAILED(readFile.Create(m_szFileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING))) - return FALSE; - - //Make the mime header - CStringA header; - if (!MakeMimeHeader(header, szBoundary, m_szFileName)) - { - return FALSE; - } - - //Try to send the mime header - if (!AtlSmtpSendAndWait(hFile, ((LPCSTR)header), header.GetLength(), pOverlapped)) - { - return FALSE; - } - - int nGetLines = ATLSMTP_GET_LINES; - - nRequiredLength *= nGetLines; - - //dwToGet is the total number of characters to attempt to get - DWORD dwToGet = (DWORD)nGetLines*nLineLength; - - //allocate the data array - CHeapPtr spData; - if (!spData.Allocate(dwToGet+1)) - return FALSE; - -// if double buffering is defined, create two buffers -#ifdef ATLSMTP_DOUBLE_BUFFERED - CHeapPtr buffer1; - if (!buffer1.Allocate(nRequiredLength+3)) - return FALSE; - - CHeapPtr buffer2; - if (!buffer2.Allocate(nRequiredLength+3)) - return FALSE; - - char* currBuffer = buffer1; - char* prevBuffer = NULL; - int nCurrBuffer = 0; - DWORD dwPrevLength = 0; -#else - CHeapPtr currBuffer; - if (!currBuffer.Allocate(nRequiredLength+3)) - return FALSE; - -#endif // ATLSMTP_DOUBLE_BUFFERED - - int nEncodedLength = nRequiredLength; - BOOL bRet = FALSE; - DWORD dwRead = 0; - DWORD dwTotalRead = 0; - DWORD dwCurrRead = 0; - - do - { - do - { - //Read a chunk of data from the file increment buffer offsets and amount to read - //based on what's already been read in this iteration of the loop - HRESULT hr = readFile.Read(((LPBYTE)spData)+dwCurrRead, dwToGet-dwCurrRead, dwRead); - if (FAILED(hr)) - { - if (hr != AtlHresultFromWin32(ERROR_MORE_DATA)) - { - return FALSE; - } - } - dwCurrRead += dwRead; - - } while (dwRead != 0 && dwCurrRead < dwToGet); - - //reset nEncodedLength - nEncodedLength = nRequiredLength; - switch (m_nEncodingScheme) - { - case ATLSMTP_BASE64_ENCODE: - //if we are at the end of input (dwCurrRead < dwToGet), output the trailing padding if necessary - //(ATL_FLAG_NONE) - bRet = Base64Encode(spData, dwCurrRead, currBuffer, &nEncodedLength, - (dwCurrRead < dwToGet ? ATL_BASE64_FLAG_NONE: ATL_BASE64_FLAG_NOPAD)); - //Base64Encoding needs explicit CRLF added - if (dwCurrRead < dwToGet) - { - currBuffer[nEncodedLength++] = '\r'; - currBuffer[nEncodedLength++] = '\n'; - } - break; - case ATLSMTP_UUENCODE: - //if we are at the beginning of the input, output the header (ATL_UUENCODE_HEADER) - //if we are the end of input (dwCurrRead < dwToGet), output the 'end' - //we are encoding for purposes of sending mail, so stuff dots (ATL_UUENCODE_DOT) - bRet = UUEncode(spData, dwCurrRead, currBuffer, &nEncodedLength, m_szFileName, - (dwTotalRead > 0 ? 0 : ATLSMTP_UUENCODE_HEADER) | - (dwCurrRead < dwToGet ? ATLSMTP_UUENCODE_END : 0) | - ((dwFlags & ATLSMTP_FORMAT_SMTP) ? ATLSMTP_UUENCODE_DOT : 0)); - break; - case ATLSMTP_QP_ENCODE: - //we are encoding for purposes of sending mail, so stuff dots - bRet = QPEncode(spData, dwCurrRead, currBuffer, &nEncodedLength, - ((dwFlags & ATLSMTP_FORMAT_SMTP) ? ATLSMTP_QPENCODE_DOT : 0) | - (dwCurrRead < dwToGet ? 0 : ATLSMTP_QPENCODE_TRAILING_SOFT)); - break; - } - //try to send the encoded data -#ifdef ATLSMTP_DOUBLE_BUFFERED - if (bRet) - { - bRet = AtlSmtpSendOverlapped(hFile, currBuffer, nEncodedLength, - prevBuffer, dwPrevLength, pOverlapped); - } - - //swap the buffers - dwPrevLength = nEncodedLength; - prevBuffer = currBuffer; - currBuffer = (nCurrBuffer == 0 ? buffer2 : buffer1); - nCurrBuffer = (nCurrBuffer == 0 ? 1 : 0); -#else - if (bRet) - { - bRet = AtlSmtpSendAndWait(hFile, currBuffer, nEncodedLength, pOverlapped); - } -#endif // ATLSMTP_DOUBLE_BUFFERED - - dwTotalRead += dwCurrRead; - if (dwRead != 0) - dwCurrRead = 0; - - nEncodedLength = nRequiredLength; - - } while (dwRead != 0 && bRet); - - //ensure that the last Send sent all the data -#ifdef ATLSMTP_DOUBLE_BUFFERED - DWORD dwWritten = 0, dwErr = 0; - if (!GetOverlappedResult(hFile, pOverlapped, &dwWritten, TRUE)) - { - if ((dwErr = GetLastError()) != ERROR_IO_PENDING && dwErr != ERROR_IO_INCOMPLETE) - { - bRet = FALSE; - } - else if (dwWritten < dwPrevLength) - { - bRet = AtlSmtpSendAndWait(hFile, prevBuffer+dwWritten, - dwPrevLength-dwWritten, pOverlapped); - } - } -#endif // ATLSMTP_DOUBLE_BUFFERED - - //for uuencoding, if the last chunk read was of size dwToGet, but it was also the end of the file, - //the "end" keyword will not get encoded, so a check is necessary - if (m_nEncodingScheme == ATLSMTP_UUENCODE && dwCurrRead == dwToGet) - { - bRet = UUEncode(spData, 0, currBuffer, &nEncodedLength, m_szFileName, - (dwFlags & ATLSMTP_FORMAT_SMTP ? ATLSMTP_UUENCODE_DOT : 0) | - ATLSMTP_UUENCODE_END); - if (bRet) - { - bRet = AtlSmtpSendAndWait(hFile, currBuffer, nEncodedLength, pOverlapped); - } - } - - return bRet; - } -}; // class CMimeFileAttachment - -// CMimeRawAttachment represents a file attachment MIME body part. -// The data provided is not a file, but a blob of raw data. -class CMimeRawAttachment : public CMimeAttachment -{ -protected: - - //the raw data - void* m_pvRaw; - - //the length - DWORD m_dwLength; - - //whether or not we own it - bool m_bShared; - -public: - CMimeRawAttachment() throw() - :m_dwLength(0), m_bShared(false), m_pvRaw(NULL) - { - } - - ~CMimeRawAttachment() throw() - { - //If we own the raw data, free it - if (!m_bShared && m_pvRaw) - free(m_pvRaw); - } - - virtual ATL_NOINLINE CMimeBodyPart* Copy() throw( ... ) - { - CAutoPtr pNewAttachment; - ATLTRY(pNewAttachment.Attach(new CMimeRawAttachment)); - if (pNewAttachment) - *pNewAttachment = *this; - - return pNewAttachment.Detach(); - } - - const CMimeRawAttachment& operator=(const CMimeRawAttachment& that) throw( ... ) - { - if (this != &that) - { - CMimeAttachment::operator=(that); - if (!m_bShared && m_pvRaw) - free(m_pvRaw); - - m_bShared = that.m_bShared; - m_dwLength = that.m_dwLength; - - if (m_bShared) - { - m_pvRaw = that.m_pvRaw; - } - else - { - m_pvRaw = malloc(m_dwLength); - if (m_pvRaw) - { - Checked::memcpy_s(m_pvRaw, m_dwLength, that.m_pvRaw, m_dwLength); - } - } - } - - return *this; - } - - // Initialize the attachment - // pData - the data - // nDataLength - the size of pData in BYTEs - // bCopyData - flag specifying whether CMimeRawAttachment should make a copy of the data (optional) - // pMultiLanguage - the IMultiLanguage pointer for codepage to character set conversion (optional) - // uiCodePage - the codepage (optional) - inline BOOL Initialize(void* pData, DWORD nDataLength, BOOL bCopyData = TRUE, LPCTSTR szDisplayName = NULL, - IMultiLanguage* pMultiLanguage = NULL, UINT uiCodePage = 0) throw() - { - // if we're already attached to some data, and it's not shared, free it - if (m_pvRaw && !m_bShared) - free(m_pvRaw); - m_pvRaw = NULL; - - m_dwLength = nDataLength; - if (bCopyData) - { - m_pvRaw = calloc(sizeof(BYTE),m_dwLength); - if (!m_pvRaw) - { - return FALSE; - } - Checked::memcpy_s(m_pvRaw, m_dwLength, pData, m_dwLength); - m_bShared = false; - } - else - { - m_pvRaw = pData; - m_bShared = true; - } - - if (!AtlMimeCharsetFromCodePage(m_szCharset, uiCodePage, pMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH)) - return FALSE; - - if (szDisplayName) - { - // use the user-specified display name - Checked::tcscpy_s(m_szDisplayName, _countof(m_szDisplayName), szDisplayName); - m_szDisplayName[_countof(m_szDisplayName)-1] = 0; - } - else - { - // no display name - *m_szDisplayName = '\0'; - } - return TRUE; - } - - // Output the data--similar to CFileAttachment::WriteData - // See CFileAttachment::WriteData for comments - virtual inline BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary, DWORD dwFlags = 0) throw() - { - if ((pOverlapped == NULL) || (szBoundary == NULL)) - { - return FALSE; - } - - if (!m_pvRaw) - return FALSE; - - int nLineLength = 0, nRequiredLength = 0; - if (!GetEncodingInformation(&nRequiredLength, &nLineLength)) - return FALSE; - - CStringA header; - - if (!MakeMimeHeader(header, szBoundary)) - { - return FALSE; - } - - if (!AtlSmtpSendAndWait(hFile, ((LPCSTR)header), header.GetLength(), pOverlapped)) - { - return FALSE; - } - - int nGetLines = ATLSMTP_GET_LINES; - DWORD dwCurrChunk = 0; - nRequiredLength *= nGetLines; - DWORD dwToGet = (DWORD)nGetLines*nLineLength; - int nDestLen = nRequiredLength; - BOOL bRet = FALSE; - DWORD dwRead = 0; -#ifdef ATLSMTP_DOUBLE_BUFFERED - CHeapPtr buffer1; - if (!buffer1.Allocate(nRequiredLength+3)) - return FALSE; - - CHeapPtr buffer2; - if (!buffer2.Allocate(nRequiredLength+3)) - return FALSE; - - char* currBuffer = buffer1; - char* prevBuffer = NULL; - int nCurrBuffer = 0; - DWORD dwPrevLength = 0; -#else - CHeapPtr currBuffer; - if (!currBuffer.Allocate(nRequiredLength+3)) - return FALSE; -#endif // ATLSMTP_DOUBLE_BUFFERED - - do - { - if ((m_dwLength-dwRead) <= dwToGet) - dwCurrChunk = m_dwLength-dwRead; - else - dwCurrChunk = dwToGet; - switch(m_nEncodingScheme) - { - case ATLSMTP_BASE64_ENCODE: - bRet = Base64Encode(((LPBYTE)(m_pvRaw))+dwRead, dwCurrChunk, currBuffer, &nDestLen, - (dwRead < m_dwLength) ? ATL_BASE64_FLAG_NONE : ATL_BASE64_FLAG_NOPAD); - if (dwRead+dwCurrChunk == m_dwLength) - { - currBuffer[nDestLen++] = '\r'; - currBuffer[nDestLen++] = '\n'; - } - break; - case ATLSMTP_UUENCODE: - bRet = UUEncode(((LPBYTE)(m_pvRaw))+dwRead, dwCurrChunk, currBuffer, &nDestLen, _T("rawdata"), - (dwRead > 0 ? 0 : ATLSMTP_UUENCODE_HEADER) | - (dwRead+dwCurrChunk == m_dwLength ? ATLSMTP_UUENCODE_END : 0) | - ((dwFlags & ATLSMTP_FORMAT_SMTP) ? ATLSMTP_UUENCODE_DOT : 0)); - break; - case ATLSMTP_QP_ENCODE: - bRet = QPEncode(((LPBYTE)(m_pvRaw))+dwRead, dwCurrChunk, currBuffer, &nDestLen, - ((dwFlags & ATLSMTP_FORMAT_SMTP) ? ATLSMTP_QPENCODE_DOT : 0) | - (dwRead+dwCurrChunk == m_dwLength ? 0 : ATLSMTP_QPENCODE_TRAILING_SOFT)); - break; - } - if (!bRet) - break; -#ifdef ATLSMTP_DOUBLE_BUFFERED - bRet = AtlSmtpSendOverlapped(hFile, currBuffer, nDestLen, prevBuffer, dwPrevLength, pOverlapped); - dwPrevLength = (DWORD)nDestLen; - prevBuffer = currBuffer; - currBuffer = (nCurrBuffer == 0 ? buffer2 : buffer1); - nCurrBuffer = (nCurrBuffer == 0 ? 1 : 0); -#else - bRet = AtlSmtpSendAndWait(hFile, currBuffer, nDestLen, pOverlapped); -#endif // ATLSMTP_DOUBLE_BUFFERED - - nDestLen = nRequiredLength; - dwRead += dwCurrChunk; - } while (bRet && (dwRead < m_dwLength)); - - //ensure all data is sent from prevBuffer -#ifdef ATLSMTP_DOUBLE_BUFFERED - DWORD dwWritten = 0, dwErr = 0; - if (!GetOverlappedResult(hFile, pOverlapped, &dwWritten, TRUE)) - { - if ((dwErr = GetLastError()) != ERROR_IO_PENDING && dwErr != ERROR_IO_INCOMPLETE) - bRet = FALSE; - else if (dwWritten < dwPrevLength) - bRet = AtlSmtpSendAndWait(hFile, prevBuffer+dwWritten, dwPrevLength-dwWritten, pOverlapped); - } -#endif // ATLSMTP_DOUBLE_BUFFERED - - return bRet; - } -}; // class CMimeRawAttachment - - -// CMimeText - represents a text body part in MIME body -class CMimeText : public CMimeBodyPart -{ -protected: - - // the text - CHeapPtr m_szText; - - // the character set - char m_szCharset[ATL_MAX_ENC_CHARSET_LENGTH]; - - // the text length - int m_nTextLen; - -public: - CMimeText() throw() - :m_nTextLen(0) - { - Checked::strcpy_s(m_szCharset, ATL_MAX_ENC_CHARSET_LENGTH, ATLSMTP_DEFAULT_CSET); - } - - virtual ~CMimeText() throw() - { - } - - // Get the content type - virtual inline LPCSTR GetContentType() throw() - { - return "text/plain"; - } - - // Get the character set - virtual inline LPCSTR GetCharset() throw() - { - return m_szCharset; - } - - virtual ATL_NOINLINE CMimeBodyPart* Copy() throw( ... ) - { - CAutoPtr pNewText; - ATLTRY(pNewText.Attach(new CMimeText)); - if (pNewText) - *pNewText = *this; - - return pNewText.Detach(); - } - - const CMimeText& operator=(const CMimeText& that) throw( ... ) - { - if (this != &that) - { - m_nTextLen = that.m_nTextLen; - Checked::strcpy_s(m_szCharset, ATL_MAX_ENC_CHARSET_LENGTH, that.m_szCharset); - m_szText.Free(); - if (m_szText.AllocateBytes(m_nTextLen) != false) - { - Checked::memcpy_s((char *)m_szText, m_nTextLen, (char *)that.m_szText, m_nTextLen); - } - } - - return *this; - } - - // Initialize the body part - // szText - the text (required) - // nTextLen - the text length in bytes (optional--if not specified a _tcslen will be done) - // pMultiLanguage - the IMultiLanguagte pointer for converting codepages to MIME character sets (optional) - // uiCodePage - the codepage - inline BOOL Initialize(LPCTSTR szText, int nTextLen = -1, IMultiLanguage* pMultiLanguage = NULL, UINT uiCodePage = 0) throw() - { - BOOL bRet = TRUE; - - // if IMultiLanguage is there, respect the codepage - if (pMultiLanguage) - { - CHeapPtr szTextPtr; - UINT nLen(0); - - bRet = AtlMimeConvertString(pMultiLanguage, uiCodePage, szText, &szTextPtr, &nLen); - if (bRet) - { - m_szText.Free(); - m_szText.Attach(szTextPtr.Detach()); - m_nTextLen = nLen; - } - } - else // no multilanguage support - { - if (nTextLen < 0) - { - nTextLen = (int) _tcslen(szText); - nTextLen*= sizeof(TCHAR); - } - - m_szText.Free(); - if (m_szText.AllocateBytes(nTextLen) != false) - { - Checked::memcpy_s((char *)m_szText, nTextLen, szText, nTextLen); - m_nTextLen = nTextLen; - } - } - - if (bRet) - { - bRet = AtlMimeCharsetFromCodePage(m_szCharset, uiCodePage, pMultiLanguage, ATL_MAX_ENC_CHARSET_LENGTH); - } - - return bRet; - } - - // Dump the data to hFile - virtual inline BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary, DWORD dwFlags = 0) throw() - { - if ((pOverlapped == NULL) || (szBoundary == NULL)) - { - return FALSE; - } - - CStringA strHeader; - char sendBuffer[ATLSMTP_READBUFFER_SIZE]; - LPSTR pSendBuffer = sendBuffer; - LPSTR szText = m_szText; - - if (!MakeMimeHeader(strHeader, szBoundary)) - { - return FALSE; - } - - //copy the header into the sendbuffer - int nWritten = strHeader.GetLength(); - if(nWritten > ATLSMTP_READBUFFER_SIZE) - return FALSE; - - Checked::memcpy_s(pSendBuffer, ATLSMTP_READBUFFER_SIZE, (LPCSTR)strHeader, nWritten); - pSendBuffer+= nWritten; - int nRead = 0; - int nLineLen = 0; - - //subtract 2 from these because it's easier for when we have - //to break lines with a CRLF - int nMaxLineLength = ATLSMTP_MAX_LINE_LENGTH-2; - int nMaxBufferSize = ATLSMTP_READBUFFER_SIZE-2; - while (nRead <= m_nTextLen) - { - //if the buffer is full or we've reached the end of the text, - //send it - if (nWritten >= nMaxBufferSize || nRead == m_nTextLen) - { - if (!AtlSmtpSendAndWait(hFile, sendBuffer, nWritten, pOverlapped)) - return FALSE; - nWritten = 0; - pSendBuffer = sendBuffer; - if (nRead == m_nTextLen) - { - break; // job done, no need to run the code below - } - } - - //if we're at the end of the line, break it - if (nLineLen == nMaxLineLength) - { - if(nWritten + 2 > ATLSMTP_READBUFFER_SIZE) - return FALSE; - *pSendBuffer++ = '\r'; - *pSendBuffer++ = '\n'; - nWritten+= 2; - nLineLen = -1; - continue; - } - - //stuff dots at the start of the line - if (nLineLen == 0 && (dwFlags & ATLSMTP_FORMAT_SMTP) && *szText == '.') - { - if(nWritten + 1 > ATLSMTP_READBUFFER_SIZE) - return FALSE; - *pSendBuffer++ = '.'; - nWritten++; - nLineLen++; - continue; - } - - //if we hit a CRLF, reset nLineLen - if (*szText == '\n' && nRead > 0 && *(szText-1) == '\r') - nLineLen = -1; - - if(nWritten + 1 > ATLSMTP_READBUFFER_SIZE) - return FALSE; - *pSendBuffer++ = (*szText++); - nRead++; - nWritten++; - nLineLen++; - } - - return TRUE; - } - -protected: - - // Make the MIME header - virtual inline BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary) throw() - { - char szBegin[256]; - if (*szBoundary) - { - // this is not the only body part - Checked::memcpy_s(szBegin, sizeof(szBegin), ATLMIME_SEPARATOR, sizeof(ATLMIME_SEPARATOR)); - Checked::memcpy_s(szBegin+6, sizeof(szBegin)-6, szBoundary, ATL_MIME_BOUNDARYLEN); - *(szBegin+(ATL_MIME_BOUNDARYLEN+6)) = '\0'; - } - else - { - // this is the only body part, so output the full MIME header - Checked::memcpy_s(szBegin, sizeof(szBegin), ATLMIME_VERSION, sizeof(ATLMIME_VERSION)); - } - - _ATLTRY - { - header.Format("%s\r\nContent-Type: text/plain;\r\n\tcharset=\"%s\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n", - szBegin, m_szCharset); - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } -}; // class CMimeText - - -// CMimeMessage - the MIME message class. Represents a full MIME message -class CMimeMessage : public CMimeHeader -{ -protected: - - // The list of the MIME body parts - CAutoPtrList m_BodyParts; - - // The display name of the message - char m_szDisplayName[MAX_PATH+1]; - -public: - CMimeMessage(IMultiLanguage *pMultiLanguage = NULL) throw() - { - Initialize(pMultiLanguage); - Checked::memcpy_s(m_szDisplayName, MAX_PATH+1, ATLMIME_EMAIL, sizeof(ATLMIME_EMAIL)); - } - - virtual ~CMimeMessage() throw() - { - RemoveParts(); - } - - void RemoveParts() throw() - { - m_BodyParts.RemoveAll(); - } - - - virtual ATL_NOINLINE CMimeBodyPart* Copy() throw( ... ) - { - CAutoPtr pNewMessage; - ATLTRY(pNewMessage.Attach(new CMimeMessage)); - if (pNewMessage) - *pNewMessage = *this; - - return pNewMessage.Detach(); - } - - - const CMimeMessage& operator=(const CMimeMessage& that) throw( ... ) - { - if (this != &that) - { - CMimeHeader::operator=(that); - Checked::strcpy_s(m_szDisplayName, MAX_PATH+1, that.m_szDisplayName); - - RemoveParts(); - POSITION pos = that.m_BodyParts.GetHeadPosition(); - while (pos != NULL) - { - CAutoPtr pCopy(that.m_BodyParts.GetNext(pos)->Copy()); - if (pCopy) - { - m_BodyParts.AddTail(pCopy); - } - } - } - - return *this; - } - - // Set the display name of the message - inline BOOL SetDisplayName(LPCTSTR szDisplayName) throw() - { - if (szDisplayName == NULL) - { - return FALSE; - } - - _ATLTRY - { - CT2CA szDisplayNameA(szDisplayName); - if (szDisplayNameA == NULL || strlen(szDisplayNameA) > MAX_PATH) - return FALSE; - Checked::strcpy_s(m_szDisplayName, MAX_PATH+1, szDisplayNameA); - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Add some text to the message at position nPos in the body parts list - // szText - the text - // nTextLen - the size of the text in bytes (optional - if not specified a _tcslen will be done) - // nPos - the position in the message at which to insert the text (optional) - // uiCodePage - the codepage (optional) - inline BOOL AddText(LPCTSTR szText, int nTextLen = -1, int nPos = 1, UINT uiCodePage = 0) throw() - { - if (szText == NULL) - return FALSE; - - if (nPos < 1) - { - nPos = 1; - } - - CAutoPtr spNewText; - CMimeText *pNewText = NULL; - ATLTRY(spNewText.Attach(pNewText = new CMimeText())); - if (!spNewText || !pNewText) - return FALSE; - - BOOL bRet = pNewText->Initialize(szText, nTextLen, m_spMultiLanguage, uiCodePage); - if (bRet) - { - _ATLTRY - { - POSITION currPos = m_BodyParts.FindIndex(nPos-1); - - if (!currPos) - { - if (!m_BodyParts.AddTail(spNewText)) - bRet = FALSE; - } - else - { - if (!m_BodyParts.InsertBefore(currPos, spNewText)) - bRet = FALSE; - } - - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - - return bRet; - } - - // Dump the data - virtual BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary=NULL, DWORD dwFlags = 0) throw() - { - if (pOverlapped == NULL) - { - return FALSE; - } - - // Make the MIME boundary for this message - char szBoundaryBuf[ATL_MIME_BOUNDARYLEN+1]; - if(MakeBoundary(szBoundaryBuf,ATL_MIME_BOUNDARYLEN+1) == FALSE) - return FALSE; - - // if the passed boundary is valid, this is an attached message - if (szBoundary && *szBoundary != '\0') - { - _ATLTRY - { - // output the MIME header for a message attachment - CStringA strHeader; - strHeader.Format("\r\n\r\n--%s\r\nContent-Type: message/rfc822\r\n\tname=\"%s\"\r\nContent-Transfer-Encoding: 8bit\r\n" - "Content-Disposition: attachment;\r\n\tfilename=\"%s\"\r\n\r\n", - szBoundary, m_szDisplayName, m_szDisplayName); - - if (!AtlSmtpSendAndWait(hFile, ((LPCSTR)strHeader), strHeader.GetLength(), pOverlapped)) - { - return FALSE; - } - } - _ATLCATCHALL() - { - return FALSE; - } - } - - if (!CMimeHeader::WriteData(hFile, pOverlapped, szBoundaryBuf, dwFlags)) - return FALSE; - - // Create and output the header - CStringA strHeader; - - if (!MakeMimeHeader(strHeader, szBoundaryBuf)) - { - return FALSE; - } - - if (!AtlSmtpSendAndWait(hFile, ((LPCSTR)strHeader), strHeader.GetLength(), pOverlapped)) - { - return FALSE; - } - - CMimeBodyPart* pCurrPart; - POSITION currPos = m_BodyParts.GetHeadPosition(); - - //Dump the body parts - while (currPos != NULL) - { - pCurrPart = m_BodyParts.GetAt(currPos); - if (!pCurrPart->WriteData(hFile, pOverlapped, szBoundaryBuf, dwFlags)) - { - return FALSE; - } - m_BodyParts.GetNext(currPos); - } - - char szBuf[ATL_MIME_BOUNDARYLEN+(sizeof("\r\n\r\n--%s--\r\n"))]; - //output a trailing boundary - if (*szBoundaryBuf) - { - int nBufLen = sprintf_s(szBuf, ATL_MIME_BOUNDARYLEN+(sizeof("\r\n\r\n--%s--\r\n")), - "\r\n\r\n--%s--\r\n", szBoundaryBuf); - if ((nBufLen < 0) || (!AtlSmtpSendAndWait(hFile, szBuf, nBufLen, pOverlapped))) - { - return FALSE; - } - } - - return TRUE; - } - - // Attach a file. - // szFileName - the filename - // szDisplayName - the display name (optional) - // szContentType - the content type (optional - defaults to NULL -- lookup will be attempted, otherwise default to application/octet-stream) - // nEncodingScheme - the encoding scheme to use for the attachment (optional - defaults to base64 - // uiCodePage - the codepage (optional) - inline BOOL AttachFile(LPCTSTR szFileName, LPCTSTR szDisplayName = NULL, LPCTSTR szContentType = NULL, - int nEncodingScheme = ATLSMTP_BASE64_ENCODE, UINT uiCodepage = 0) - { - if (szFileName == NULL) - return FALSE; - - CAutoPtr spFileAttach; - CMimeFileAttachment* pFileAttach = NULL; - ATLTRY(spFileAttach.Attach(pFileAttach = new CMimeFileAttachment())); - if (!spFileAttach || !pFileAttach) - return FALSE; - - BOOL bRet = pFileAttach->Initialize(szFileName, szDisplayName, m_spMultiLanguage, uiCodepage); - - if (bRet) - bRet = pFileAttach->SetEncodingScheme(nEncodingScheme); - - CString strContentType; - if (bRet && (szContentType == NULL)) - { - if (GetContentTypeFromFileName(szFileName, strContentType) != ERROR_OUTOFMEMORY) - { - szContentType = strContentType; - } - else - { - bRet = FALSE; - } - } - - _ATLTRY - { - if (bRet) - { - bRet = pFileAttach->SetContentType(szContentType); - if (bRet) - { - if (!m_BodyParts.AddTail(spFileAttach)) - { - bRet = FALSE; - } - } - } - } - _ATLCATCHALL() - { - bRet = FALSE; - } - - return bRet; - } - - // Attach some raw data - // pRawData - the data - // nDataLength - the size of the data in bytes - // nEncodingScheme - the encoding scheme to use for the attachment (optional - defaults to base64 - // uiCodePage - the codepage (optional) - inline BOOL AttachRaw(void* pRawData, DWORD dwDataLength, int nEncodingScheme = ATLSMTP_BASE64_ENCODE, BOOL bCopyData = TRUE, - LPCTSTR szDisplayName = NULL, LPCTSTR szContentType = _T("application/octet-stream"), UINT uiCodepage = 0) - { - if (!pRawData) - return FALSE; - - CAutoPtr spRawAttach; - CMimeRawAttachment* pRawAttach; - ATLTRY(spRawAttach.Attach(pRawAttach = new CMimeRawAttachment())); - if (!spRawAttach) - { - return FALSE; - } - - BOOL bRet = pRawAttach->Initialize(pRawData, dwDataLength, bCopyData, szDisplayName, m_spMultiLanguage, uiCodepage); - - if (bRet) - bRet = pRawAttach->SetEncodingScheme(nEncodingScheme); - if (bRet) - bRet = pRawAttach->SetContentType(szContentType); - - _ATLTRY - { - if (bRet) - if(!m_BodyParts.AddTail(spRawAttach)) - bRet = FALSE; - } - _ATLCATCHALL() - { - bRet = FALSE; - } - - return bRet; - } - - // Attach a CMimeMessage - // pMsg - pointer to the Msg object - inline BOOL AttachMessage(CMimeMessage* pMsg) throw( ... ) - { - if (!pMsg) - return FALSE; - - _ATLTRY - { - CAutoPtr spMsg(pMsg->Copy()); - if (!m_BodyParts.AddTail(spMsg)) - return FALSE; - } - _ATLCATCHALL() - { - return FALSE; - } - - return TRUE; - } - -protected: - // Make the MIME header - virtual inline BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary) throw() - { - _ATLTRY - { - if (!*szBoundary) - { - header.Format("X-Priority: %d\r\n%s", m_nPriority, (LPCSTR) m_XHeader); - } - else if (m_BodyParts.GetCount() > 1) - { - header.Format("X-Priority: %d\r\n%sMIME-Version: 1.0\r\nContent-Type: multipart/mixed;\r\n\tboundary=\"%s\"\r\n", - m_nPriority, (LPCSTR) m_XHeader, szBoundary); - } - return TRUE; - } - _ATLCATCHALL() - { - return FALSE; - } - } - - // Make the MIME boundary - inline BOOL MakeBoundary(__out_ecount_z(nBufLen) LPSTR szBoundary, __in int nBufLen) - { - ATLENSURE(szBoundary != NULL); - - if(nBufLen < 1) - { - return FALSE; - } - - if (m_BodyParts.GetCount() < 2) - { - *szBoundary = '\0'; - } - else - { - int ret = sprintf_s(szBoundary, nBufLen, "------=_Next_Part_%.10u.%.3u", GetTickCount(), rand()%1000); - if (ret == -1 || ret >= nBufLen) - return FALSE; - } - return TRUE; - } - -}; // class CMimeMessage - -} // namespace ATL -#pragma pack(pop) - -#ifndef _CPPUNWIND -#pragma warning (pop) -#endif //_CPPUNWIND - -#pragma warning(pop) - -#endif // __ATLMIME_H__ diff --git a/include/atl/atlperf.h b/include/atl/atlperf.h deleted file mode 100644 index a1e8d9ea4..000000000 --- a/include/atl/atlperf.h +++ /dev/null @@ -1,663 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLPERF_H__ -#define __ATLPERF_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _ATL_PERF_NOXML -#include -#include -#include - -/* xmldsodid and mshtmdid both have the same identifiers defined, with differing values. So we are renaming the XML ones since there are less identifiers dependent on those. */ -#ifdef DISPID_XOBJ_MIN -/* in case the HTM one was included first, we'll undef these first */ -#define _ATL_MSHTMDID_INCLUDED_ALREADY -#undef DISPID_XOBJ_MIN -#undef DISPID_XOBJ_MAX -#undef DISPID_XOBJ_BASE -#endif - -#include -#include - -/* re-undef the clashing names, and their direct dependents */ -#undef DISPID_XOBJ_MIN -#undef DISPID_XOBJ_MAX -#undef DISPID_XOBJ_BASE -#undef DISPID_XMLDSO -#undef DISPID_XMLELEMENTCOLLECTION - -/* re-def the clashing names, and their direct dependents, with un-clashed values */ -#define DISPID_XMLDSO_XOBJ_MIN 0x00010000 -#define DISPID_XMLDSO_XOBJ_MAX 0x0001FFFF -#define DISPID_XMLDSO_XOBJ_BASE DISPID_XMLDSO_XOBJ_MIN -#define DISPID_XMLDSO DISPID_XMLDSO_XOBJ_BASE -#define DISPID_XMLELEMENTCOLLECTION DISPID_XMLDSO_XOBJ_BASE -#ifdef _ATL_MSHTMDID_INCLUDED_ALREADY - -/* redef the clashing names to the HTM values */ -#define DISPID_XOBJ_MIN 0x80010000 -#define DISPID_XOBJ_MAX 0x8001FFFF -#define DISPID_XOBJ_BASE DISPID_XOBJ_MIN -#endif -#include -#endif - -#pragma warning(push) -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible - - -#pragma pack(push,_ATL_PACKING) -namespace ATL -{ - -const DWORD ATLPERF_SIZE_MASK = 0x00000300; -const DWORD ATLPERF_TYPE_MASK = 0x00000C00; -const DWORD ATLPERF_TEXT_MASK = 0x00010000; - -#ifndef ATLPERF_DEFAULT_MAXINSTNAMELENGTH -#define ATLPERF_DEFAULT_MAXINSTNAMELENGTH 64 -#endif - -// base class for user-defined perf objects -struct CPerfObject -{ - // implementation - - ULONG m_nAllocSize; - DWORD m_dwCategoryId; - DWORD m_dwInstance; - ULONG m_nRefCount; - ULONG m_nInstanceNameOffset; // byte offset from beginning of PerfObject to LPWSTR szInstanceName -}; - -class CPerfMon -{ -public: - virtual ~CPerfMon() throw(); - -#ifdef _ATL_PERF_REGISTER - // registration - HRESULT Register( - LPCTSTR szOpenFunc, - LPCTSTR szCollectFunc, - LPCTSTR szCloseFunc, - HINSTANCE hDllInstance = _AtlBaseModule.GetModuleInstance()) throw(); - HRESULT RegisterStrings( - LANGID wLanguage = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), - HINSTANCE hResInstance = _AtlBaseModule.GetResourceInstance()) throw(); - HRESULT RegisterAllStrings(HINSTANCE hResInstance = NULL) throw(); - HRESULT Unregister() throw(); -#endif - - HRESULT Initialize() throw(); - void UnInitialize() throw(); - HRESULT CreateInstance( - DWORD dwCategoryId, - DWORD dwInstance, - LPCWSTR szInstanceName, - CPerfObject** ppInstance) throw(); - HRESULT CreateInstanceByName( - DWORD dwCategoryId, - LPCWSTR szInstanceName, - CPerfObject** ppInstance) throw(); - - template - HRESULT CreateInstance( - DWORD dwInstance, - LPCWSTR szInstanceName, - T** ppInstance) throw() - { - // Ensure T derives from CPerfObject - static_cast(*ppInstance); - - return CreateInstance( - T::kCategoryId, - dwInstance, - szInstanceName, - reinterpret_cast(ppInstance) - ); - } - - template - HRESULT CreateInstanceByName( - LPCWSTR szInstanceName, - T** ppInstance) throw() - { - // Ensure T derives from CPerfObject - static_cast(*ppInstance); - - return CreateInstanceByName( - T::kCategoryId, - szInstanceName, - reinterpret_cast(ppInstance) - ); - } - - HRESULT ReleaseInstance(CPerfObject* pInstance) throw(); - HRESULT LockPerf(DWORD dwTimeout = INFINITE) throw(); - void UnlockPerf() throw(); - -#ifndef _ATL_PERF_NOXML - HRESULT PersistToXML(IStream *pStream, BOOL bFirst=TRUE, BOOL bLast=TRUE) throw(...); - HRESULT LoadFromXML(IStream *pStream) throw(...); -#endif - - // implementation - -public: - // PerfMon entry point helpers - DWORD Open(LPWSTR lpDeviceNames) throw(); - DWORD Collect(__in_z LPWSTR lpwszValue, __deref_inout_bcount(*pcbBytes) LPVOID* lppData, __inout LPDWORD lpcbBytes, __inout LPDWORD lpcObjectTypes) throw(); - DWORD Close() throw(); - - // map building routines - HRESULT AddCategoryDefinition( - DWORD dwCategoryId, - LPCTSTR szCategoryName, - LPCTSTR szHelpString, - DWORD dwDetailLevel, - INT nDefaultCounter, - BOOL bInstanceLess, - UINT nStructSize, - UINT nMaxInstanceNameLen = ATLPERF_DEFAULT_MAXINSTNAMELENGTH) throw(); - HRESULT AddCounterDefinition( - DWORD dwCounterId, - LPCTSTR szCounterName, - LPCTSTR szHelpString, - DWORD dwDetailLevel, - DWORD dwCounterType, - ULONG nMaxCounterSize, - UINT nOffset, - INT nDefaultScale) throw(); - - // macro helpers - HRESULT RegisterCategory( - WORD wLanguage, - HINSTANCE hResInstance, - UINT* pSampleRes, - DWORD dwCategoryId, - UINT nNameString, - UINT nHelpString, - DWORD dwDetail, - BOOL bInstanceless, - UINT nStructSize, - UINT nMaxInstanceNameLen, - INT nDefaultCounter) throw(); - HRESULT RegisterCategory( - WORD wLanguage, - HINSTANCE hResInstance, - UINT* pSampleRes, - DWORD dwCategoryId, - LPCTSTR szNameString, - LPCTSTR szHelpString, - DWORD dwDetail, - BOOL bInstanceless, - UINT nStructSize, - UINT nMaxInstanceNameLen, - INT nDefaultCounter) throw(); - HRESULT RegisterCounter( - WORD wLanguage, - HINSTANCE hResInstance, - DWORD dwCounterId, - UINT nNameString, - UINT nHelpString, - DWORD dwDetail, - DWORD dwCounterType, - ULONG nMaxCounterSize, - UINT nOffset, - INT nDefaultScale) throw(); - HRESULT RegisterCounter( - WORD wLanguage, - HINSTANCE hResInstance, - DWORD dwCounterId, - LPCTSTR szNameString, - LPCTSTR szHelpString, - DWORD dwDetail, - DWORD dwCounterType, - ULONG nMaxCounterSize, - UINT nOffset, - INT nDefaultScale) throw(); - -protected: - void ClearMap() throw(); - - virtual LPCTSTR GetAppName() const throw() = 0; - virtual HRESULT CreateMap(WORD wLanguage, HINSTANCE hResInstance, UINT* pSampleRes = NULL) throw(); - virtual void OnBlockAlloc(CAtlFileMappingBase* /*pNewBlock*/) { } -#ifdef _ATL_PERF_REGISTER - static BOOL CALLBACK EnumResLangProc(HINSTANCE hModule, LPCTSTR szType, LPCTSTR szName, LANGID wIDLanguage, LPARAM lParam); -#endif - - // implementation helpers - struct CounterInfo - { - CounterInfo() : m_dwCounterId(0), m_dwDetailLevel(0), m_nNameId(0), - m_nHelpId(0), m_dwCounterType(0), m_nDefaultScale(0), - m_nMaxCounterSize(0), m_nDataOffset(0) - { - ZeroMemory (&m_cache, sizeof(m_cache)); - } - // implementation - - DWORD m_dwCounterId; - CString m_strName; - CString m_strHelp; - DWORD m_dwDetailLevel; - - // the ids that correspond to the name and help strings stored in the registry - UINT m_nNameId; - UINT m_nHelpId; - - // counter data - - DWORD m_dwCounterType; - LONG m_nDefaultScale; - - // the maximum size of the string counter data in characters, including the null terminator - // ignored if not a string counter - ULONG m_nMaxCounterSize; - - ULONG m_nDataOffset; - - // cached data to be copied into request - PERF_COUNTER_DEFINITION m_cache; - }; - - struct CategoryInfo - { - // implementation - - DWORD m_dwCategoryId; - CString m_strName; - CString m_strHelp; - DWORD m_dwDetailLevel; - - // the ids that correspond to the name and help strings stored in the registry - UINT m_nNameId; - UINT m_nHelpId; - - // category data - - LONG m_nDefaultCounter; - LONG m_nInstanceLess; // PERF_NO_INSTANCES if instanceless - - // the size of the struct not counting the name and string counters - ULONG m_nStructSize; - - // in characters including the null terminator - ULONG m_nMaxInstanceNameLen; - - ULONG m_nAllocSize; - - // cached data to be copied into request - PERF_OBJECT_TYPE m_cache; - ULONG m_nCounterBlockSize; - - // counters - UINT _GetNumCounters() throw(); - CounterInfo* _GetCounterInfo(UINT nIndex) throw(); - - CAtlArray m_counters; - }; - - LPBYTE _AllocData(LPBYTE& pData, ULONG nBytesAvail, ULONG* pnBytesUsed, size_t nBytesNeeded) throw(); - template T* _AllocStruct(LPBYTE& pData, ULONG nBytesAvail, ULONG* pnBytesUsed, T*) throw() - { - return reinterpret_cast(_AllocData(pData, nBytesAvail, pnBytesUsed, sizeof(T))); - } - - UINT _GetNumCategoriesAndCounters() throw(); - CategoryInfo* _GetCategoryInfo(UINT nIndex) throw(); - UINT _GetNumCategories() throw(); - CPerfObject* _GetFirstInstance(CAtlFileMappingBase* pBlock) throw(); - CPerfObject* _GetNextInstance(CPerfObject* pInstance) throw(); - CAtlFileMappingBase* _GetNextBlock(CAtlFileMappingBase* pBlock) throw(); - CAtlFileMappingBase* _OpenNextBlock(CAtlFileMappingBase* pPrev) throw(); - CAtlFileMappingBase* _AllocNewBlock(CAtlFileMappingBase* pPrev, BOOL* pbExisted = NULL) throw(); - HRESULT _OpenAllBlocks() throw(); - DWORD& _GetBlockId(CAtlFileMappingBase* pBlock) throw(...); - DWORD* _GetBlockId_NoThrow(CAtlFileMappingBase* pBlock) throw(); - CategoryInfo* _FindCategoryInfo(DWORD dwCategoryId) throw(); - CounterInfo* _FindCounterInfo(CategoryInfo* pCategoryInfo, DWORD dwCounterId) throw(); - CounterInfo* _FindCounterInfo(DWORD dwCategoryId, DWORD dwCounterId) throw(); - BOOL _WantCategoryType(__in_z LPWSTR lpwszValue, __in DWORD dwPerfId) throw(...); - void _FillCategoryType(CategoryInfo* pCategoryInfo) throw(); - void _FillCounterDef(CounterInfo* pCounterInfo, ULONG* pnCounterBlockSize) throw(); - HRESULT CPerfMon::_CollectInstance( - CategoryInfo* pCategoryInfo, - LPBYTE& pData, - ULONG nBytesAvail, - ULONG* pnBytesUsed, - CPerfObject* pInstance, - PERF_OBJECT_TYPE* pObjectType, - PERF_COUNTER_DEFINITION* pCounterDefs - ) throw(); - HRESULT _CollectInstance( - CategoryInfo* pCategoryInfo, - LPBYTE& pData, - ULONG nBytesAvail, - ULONG* pnBytesUsed, - PERF_OBJECT_TYPE* pObjectType, - PERF_COUNTER_DEFINITION* pCounterDefs - ) throw(); - HRESULT _CollectCategoryType( - CategoryInfo* pCategoryInfo, - LPBYTE pData, - ULONG nBytesAvail, - ULONG* pnBytesUsed) throw(); - HRESULT _LoadMap(DWORD* pData) throw(); - HRESULT _SaveMap() throw(); - HRESULT _GetAttribute( - IXMLDOMNode *pNode, - LPCWSTR szAttrName, - BSTR *pbstrVal) throw(); - HRESULT CPerfMon::_CreateInstance( - DWORD dwCategoryId, - DWORD dwInstance, - LPCWSTR szInstanceName, - CPerfObject** ppInstance, - bool bByName) throw(); - -#ifdef _ATL_PERF_REGISTER - void _AppendStrings( - LPTSTR& pszNew, - CAtlArray& astrStrings, - ULONG iFirstIndex - ) throw(); - HRESULT _AppendRegStrings( - CRegKey& rkLang, - LPCTSTR szValue, - CAtlArray& astrStrings, - ULONG nNewStringSize, - ULONG iFirstIndex, - ULONG iLastIndex) throw(); - HRESULT _RemoveRegStrings( - CRegKey& rkLang, - LPCTSTR szValue, - ULONG iFirstIndex, - ULONG iLastIndex) throw(); - HRESULT _ReserveStringRange(DWORD& dwFirstCounter, DWORD& dwFirstHelp) throw(); - HRESULT _UnregisterStrings() throw(); - HRESULT _RegisterAllStrings(UINT nRes, HINSTANCE hResInstance) throw(); -#endif -private: - CAtlArray m_categories; - CAutoPtrArray m_aMem; - CMutex m_lock; - ULONG m_nAllocSize; - ULONG m_nHeaderSize; - ULONG m_nSchemaSize; - CSecurityDesc m_sd; -}; - -class CPerfLock -{ -public: - CPerfLock(CPerfMon* pPerfMon, DWORD dwTimeout = INFINITE) - { - ATLENSURE(pPerfMon != NULL); - m_pPerfMon = pPerfMon; - m_hrStatus = m_pPerfMon->LockPerf(dwTimeout); - } - - ~CPerfLock() throw() - { - if (SUCCEEDED(m_hrStatus)) - m_pPerfMon->UnlockPerf(); - } - - HRESULT GetStatus() const throw() - { - return m_hrStatus; - } - -private: - CPerfMon* m_pPerfMon; - HRESULT m_hrStatus; -}; - -//////////////////////////////////////////////////////////////////////// -// map macros - -// empty definition just for ease of use with code wizards, etc. -#define BEGIN_PERFREG_MAP() - -// empty definition just for ease of use with code wizards, etc. -#define END_PERFREG_MAP() - -#if !defined(_ATL_PERF_REGISTER) | defined(_ATL_PERF_NOEXPORT) -#define PERFREG_ENTRY(className) -#endif - -#ifdef _ATL_PERF_REGISTER -#define BEGIN_PERF_MAP(AppName) \ - private: \ - LPCTSTR GetAppName() const throw() { return AppName; } \ - HRESULT CreateMap(WORD wLanguage, HINSTANCE hResInstance, UINT* pSampleRes = NULL) throw() \ - { \ - if (pSampleRes) \ - *pSampleRes = 0; \ - ClearMap(); - -#define BEGIN_COUNTER_MAP(categoryclass) \ - public: \ - typedef categoryclass _PerfCounterClass; \ - static HRESULT CreateMap(CPerfMon* pPerf, WORD wLanguage, HINSTANCE hResInstance, UINT* pSampleRes) throw() \ - { \ - HRESULT hr = RegisterCategory(pPerf, wLanguage, hResInstance, pSampleRes); \ - if (FAILED(hr)) \ - return hr; - -#define DECLARE_PERF_CATEGORY_EX(dwCategoryId, namestring, helpstring, detail, instanceless, structsize, maxinstnamelen, defcounter) \ - static HRESULT RegisterCategory(CPerfMon* pPerf, WORD wLanguage, HINSTANCE hResInstance, UINT* pSampleRes) throw() \ - { \ - return pPerf->RegisterCategory(wLanguage, hResInstance, pSampleRes, dwCategoryId, namestring, helpstring, detail, instanceless, structsize, maxinstnamelen, defcounter); \ - } \ - /* NOTE: put a semicolon after your call to DECLARE_PERF_CATEGORY*(...) */ \ - /* this is needed for the code wizards to parse things properly */ \ - static const DWORD kCategoryId = dwCategoryId - -#define CHAIN_PERF_CATEGORY(categoryclass) \ - if (FAILED(categoryclass::CreateMap(this, wLanguage, hResInstance, pSampleRes))) \ - return E_FAIL; - -// CAssertValidField ensures that the member variable that's being passed to -// DEFINE_COUNTER[_EX] is the proper type. only 32-bit integral types can be used with -// PERF_SIZE_DWORD and only 64-bit integral types can be used with PERF_SIZE_LARGE -template< DWORD t_dwSize > -class CAssertValidField -{ -}; - -template<> -class CAssertValidField< PERF_SIZE_DWORD > -{ -public: - template< class C > static void AssertValidFieldType( ULONG C::* ) throw() { } - template< class C > static void AssertValidFieldType( LONG C::* ) throw() { } -}; - -template<> -class CAssertValidField< PERF_SIZE_LARGE > -{ -public: - template< class C > static void AssertValidFieldType( ULONGLONG C::* ) throw() { } - template< class C > static void AssertValidFieldType( LONGLONG C::* ) throw() { } -}; - -#define DEFINE_COUNTER_EX(member, dwCounterId, namestring, helpstring, detail, countertype, maxcountersize, defscale) \ - CAssertValidField< (countertype) & ATLPERF_SIZE_MASK >::AssertValidFieldType( &_PerfCounterClass::member ); \ - hr = pPerf->RegisterCounter(wLanguage, hResInstance, dwCounterId, namestring, helpstring, detail, countertype, maxcountersize, (ULONG) offsetof(_PerfCounterClass, member), defscale); \ - if (FAILED(hr)) \ - return hr; - -#define END_PERF_MAP() \ - return S_OK; \ - } - -#define END_COUNTER_MAP() \ - return S_OK; \ - } - -#else // _ATL_PERF_REGISTER - -#define BEGIN_PERF_MAP(AppName) \ - private: \ - LPCTSTR GetAppName() const throw() { return AppName; } - -#define BEGIN_COUNTER_MAP(objectclass) - -#define DECLARE_PERF_CATEGORY_EX(dwCategoryId, namestring, helpstring, detail, instanceless, structsize, maxinstnamelen, defcounter) \ - /* NOTE: put a semicolon after your call to DECLARE_PERF_CATEGORY*(...) */ \ - /* this is needed for the code wizards to parse things properly */ \ - static const DWORD kCategoryId = dwCategoryId - -#define CHAIN_PERF_CATEGORY(objectclass) -#define DEFINE_COUNTER_EX(member, dwCounterId, namestring, helpstring, detail, countertype, maxcountersize, defscale) - -#define END_PERF_MAP() -#define END_COUNTER_MAP() - -#endif // _ATL_PERF_REGISTER - -#define DECLARE_PERF_CATEGORY(objectclass, dwCategoryId, namestring, helpstring, defcounter) \ - DECLARE_PERF_CATEGORY_EX(dwCategoryId, namestring, helpstring, PERF_DETAIL_NOVICE, 0, sizeof(objectclass), ATLPERF_DEFAULT_MAXINSTNAMELENGTH, defcounter) -#define DECLARE_PERF_CATEGORY_NO_INSTANCES(objectclass, dwCategoryId, namestring, helpstring, defcounter) \ - DECLARE_PERF_CATEGORY_EX(dwCategoryId, namestring, helpstring, PERF_DETAIL_NOVICE, PERF_NO_INSTANCES, sizeof(objectclass), 0, defcounter) - -#define DEFINE_COUNTER(member, namestring, helpstring, countertype, defscale) \ - DEFINE_COUNTER_EX(member, 0, namestring, helpstring, PERF_DETAIL_NOVICE, countertype, 0, defscale) - -#pragma deprecated( DECLARE_PERF_OBJECT_EX ) -#pragma deprecated( DECLARE_PERF_OBJECT ) -#pragma deprecated( DECLARE_PERF_OBJECT_NO_INSTANCES ) -#pragma deprecated( CHAIN_PERF_OBJECT ) -#define DECLARE_PERF_OBJECT_EX DECLARE_PERF_CATEGORY_EX -#define DECLARE_PERF_OBJECT DECLARE_PERF_CATEGORY -#define DECLARE_PERF_OBJECT_NO_INSTANCES DECLARE_PERF_CATEGORY_NO_INSTANCES -#define CHAIN_PERF_OBJECT CHAIN_PERF_CATEGORY - -//////////////////////////////////////////////////////////////////////// -// automagic registration stuff - -#if defined(_ATL_PERF_REGISTER) & !defined(_ATL_PERF_NOEXPORT) - -// define _ATL_PERF_NOEXPORT if you don't want to use the PERFREG map and don't want these -// functions exported from your DLL - -// Perf register map stuff -// this is for ease of integration with the module attribute and for the -// perfmon wizard - -#pragma section("ATLP$A", read, shared) -#pragma section("ATLP$Z", read, shared) -#pragma section("ATLP$C", read, shared) -extern "C" -{ -__declspec(selectany) __declspec(allocate("ATLP$A")) CPerfMon * __pperfA = NULL; -__declspec(selectany) __declspec(allocate("ATLP$Z")) CPerfMon * __pperfZ = NULL; -} - -#if !defined(_M_IA64) -#pragma comment(linker, "/merge:ATLP=.rdata") -#endif - -#if defined(_M_IA64) || defined(_M_AMD64) - #define ATLPERF_FUNCID_OPEN "OpenPerfMon" - #define ATLPERF_FUNCID_COLLECT "CollectPerfMon" - #define ATLPERF_FUNCID_CLOSE "ClosePerfMon" -#elif defined(_M_IX86) - #define ATLPERF_FUNCID_OPEN "_OpenPerfMon@4" - #define ATLPERF_FUNCID_COLLECT "_CollectPerfMon@16" - #define ATLPERF_FUNCID_CLOSE "_ClosePerfMon@0" -#else -#if !defined(ATLPERF_FUNCID_OPEN) || !defined(ATLPERF_FUNCID_COLLECT) || !defined (ATLPERF_FUNCID_CLOSE) -#error "Unknown platform. Define ATLPERF_FUNCID_OPEN, ATLPERF_FUNCID_COLLECT, ATLPERF_FUNCID_CLOSE" -#endif -#endif - -HRESULT RegisterPerfMon(HINSTANCE hDllInstance = _AtlBaseModule.GetModuleInstance()) throw(); -HRESULT UnregisterPerfMon() throw(); - -extern "C" DWORD __declspec(dllexport) WINAPI OpenPerfMon(LPWSTR lpDeviceNames) throw(); -extern "C" DWORD __declspec(dllexport) WINAPI CollectPerfMon(LPWSTR lpwszValue, LPVOID* lppData, - LPDWORD lpcbBytes, LPDWORD lpcObjectTypes) throw(); -extern "C" DWORD __declspec(dllexport) WINAPI ClosePerfMon() throw(); - -// this class handles integrating the registration with CComModule -class _CAtlPerfSetFuncPtr -{ -public: - _CAtlPerfSetFuncPtr() - { - _pPerfRegFunc = RegisterPerfMon; - _pPerfUnRegFunc = UnregisterPerfMon; - } -}; - -extern "C" { __declspec(selectany) _CAtlPerfSetFuncPtr g_atlperfinit; } - -#if defined(_M_IX86) -#pragma comment(linker, "/INCLUDE:_g_atlperfinit") -#elif defined(_M_IA64) || defined(_M_AMD64) -#pragma comment(linker, "/INCLUDE:g_atlperfinit") -#else -#pragma message("Unknown platform. Make sure the linker includes g_atlperfinit") -#endif - -#ifndef PERF_ENTRY_PRAGMA - -#if defined(_M_IX86) -#define PERF_ENTRY_PRAGMA(class) __pragma(comment(linker, "/include:___pperf_" #class)); -#elif defined(_M_IA64) -#define PERF_ENTRY_PRAGMA(class) __pragma(comment(linker, "/include:__pperf_" #class)); -#elif defined(_M_AMD64) -#define PERF_ENTRY_PRAGMA(class) __pragma(comment(linker, "/include:__pperf_" #class)); -#else -#error Unknown Platform. define PERF_ENTRY_PRAGMA -#endif - -#endif // PERF_ENTRY_PRAGMA - -#define PERFREG_ENTRY(className) \ - __declspec(selectany) className __perf_##className; \ - extern "C" __declspec(allocate("ATLP$C")) __declspec(selectany) CPerfMon * const __pperf_##className = \ - static_cast(&__perf_##className); \ - PERF_ENTRY_PRAGMA(className) - -#endif // _ATL_PERF_NOEXPORT - -} // namespace ATL - - -#include - -#pragma pack(pop) -#pragma warning(pop) - -#endif // __ATLPERF_H__ diff --git a/include/atl/atlperf.inl b/include/atl/atlperf.inl deleted file mode 100644 index 398fd1b0a..000000000 --- a/include/atl/atlperf.inl +++ /dev/null @@ -1,2894 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLPERF_INL__ -#define __ATLPERF_INL__ - -#pragma once - -#ifndef __ATLPERF_H__ - #error atlperf.inl requires atlperf.h to be included first -#endif - -#pragma warning(push) - -#ifndef _CPPUNWIND -#pragma warning(disable: 4702) // unreachable code -#endif - -namespace ATL -{ - -extern __declspec(selectany) const TCHAR * const c_szAtlPerfCounter = _T("Counter"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfFirstCounter = _T("First Counter"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfLastCounter = _T("Last Counter"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfHelp = _T("Help"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfFirstHelp = _T("First Help"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfLastHelp = _T("Last Help"); - -extern __declspec(selectany) const WCHAR * const c_szAtlPerfGlobal = L"Global"; -extern __declspec(selectany) const TCHAR * const c_szAtlPerfLibrary = _T("Library"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfOpen = _T("Open"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfCollect = _T("Collect"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfClose = _T("Close"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfLanguages = _T("Languages"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfMap = _T("Map"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfPerformance = _T("Performance"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfServicesKey = _T("SYSTEM\\CurrentControlSet\\Services\\%s"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfPerformanceKey = _T("SYSTEM\\CurrentControlSet\\Services\\%s\\Performance"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfPerfLibKey = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"); -extern __declspec(selectany) const TCHAR * const c_szAtlPerfPerfLibLangKey = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\%3.3x"); - -inline CPerfMon::CounterInfo* CPerfMon::CategoryInfo::_GetCounterInfo(UINT nIndex) throw() -{ - ATLASSERT(nIndex < _GetNumCounters()); - return &m_counters[nIndex]; -} - -inline UINT CPerfMon::CategoryInfo::_GetNumCounters() throw() -{ - return (UINT) m_counters.GetCount(); -} - -inline CPerfMon::~CPerfMon() throw() -{ - UnInitialize(); -} - -inline HRESULT CPerfMon::CreateMap(LANGID language, HINSTANCE hResInstance, UINT* pSampleRes) throw() -{ - (language); // unused - (hResInstance); // unused - (pSampleRes); // unused - return S_OK; -} - -inline UINT CPerfMon::_GetNumCategoriesAndCounters() throw() -{ - UINT nResult = _GetNumCategories(); - for (UINT i=0; i<_GetNumCategories(); i++) - { - nResult += _GetCategoryInfo(i)->_GetNumCounters(); - } - - return nResult; -} - -inline CPerfMon::CategoryInfo* CPerfMon::_GetCategoryInfo(UINT nIndex) throw() -{ - ATLASSERT(nIndex < _GetNumCategories()); - return &m_categories[nIndex]; -} - -inline UINT CPerfMon::_GetNumCategories() throw() -{ - return (UINT) m_categories.GetCount(); -} - -inline CPerfObject* CPerfMon::_GetFirstInstance(CAtlFileMappingBase* pBlock) -{ - ATLENSURE(pBlock != NULL); - - // should never happen if Initialize succeeded - // are you checking return codes? - ATLASSERT(pBlock->GetData() != NULL); - - return reinterpret_cast(LPBYTE(pBlock->GetData()) + m_nHeaderSize); -} - -inline CPerfObject* CPerfMon::_GetNextInstance(CPerfObject* pInstance) -{ - ATLENSURE_RETURN_VAL(pInstance != NULL, NULL); - ATLENSURE_RETURN_VAL(pInstance->m_nAllocSize != (ULONG)-1, NULL); - ATLASSERT(pInstance->m_nAllocSize != (ULONG)0); - - return reinterpret_cast(LPBYTE(pInstance) + pInstance->m_nAllocSize); -} - -inline CAtlFileMappingBase* CPerfMon::_GetNextBlock(CAtlFileMappingBase* pBlock) throw() -{ - // calling _GetNextBlock(NULL) will return the first block - DWORD dwNextBlockIndex = 0; - DWORD* pDw= _GetBlockId_NoThrow(pBlock); - if (pDw) - { - dwNextBlockIndex = *pDw +1; - } - if (m_aMem.GetCount() == dwNextBlockIndex) - return NULL; - return m_aMem[dwNextBlockIndex]; -} - -inline CAtlFileMappingBase* CPerfMon::_OpenNextBlock(CAtlFileMappingBase* pPrev) throw() -{ - CAutoPtr spMem; - CAtlFileMappingBase* pMem = NULL; - ATLTRY(spMem.Attach(new CAtlFileMappingBase)); - if (spMem == NULL) - return NULL; - - // create a unique name for the shared mem segment based on the index - DWORD dwNextBlockIndex; - DWORD* pDw= _GetBlockId_NoThrow(pPrev); - if (pDw) - { - dwNextBlockIndex = *pDw +1; - } - else - { - // use the system allocation granularity (65536 currently. may be different in the future) - SYSTEM_INFO si; - GetSystemInfo(&si); - m_nAllocSize = si.dwAllocationGranularity; - - dwNextBlockIndex = 0; - } - - _ATLTRY - { - CString strName; - strName.Format(_T("Global\\ATLPERF_%s_%3.3d"), GetAppName(), dwNextBlockIndex); - - HRESULT hr = spMem->OpenMapping(strName, m_nAllocSize, 0, FILE_MAP_READ); - if (FAILED(hr)) - return NULL; - - pMem = spMem; - m_aMem.Add(spMem); - } - _ATLCATCHALL() - { - return NULL; - } - - return pMem; -} - -inline CAtlFileMappingBase* CPerfMon::_AllocNewBlock(CAtlFileMappingBase* pPrev, BOOL* pbExisted /* == NULL */) throw() -{ - CAtlFileMappingBase* pMem = NULL; - _ATLTRY - { - CSecurityAttributes sa; - sa.Set(m_sd); - - CAutoPtr spMem; - spMem.Attach(new CAtlFileMappingBase); - if (spMem == NULL) - { - return NULL; - } - - // create a unique name for the shared mem segment based on the index - DWORD dwNextBlockIndex; - if (pPrev != NULL) - { - dwNextBlockIndex = _GetBlockId(pPrev) +1; - } - else - { - // use the system allocation granularity (65536 currently. may be different in the future) - SYSTEM_INFO si; - GetSystemInfo(&si); - m_nAllocSize = si.dwAllocationGranularity; - - dwNextBlockIndex = 0; - } - - BOOL bExisted = FALSE; - CString strName; - strName.Format(_T("Global\\ATLPERF_%s_%3.3d"), GetAppName(), dwNextBlockIndex); - - HRESULT hr = spMem->MapSharedMem(m_nAllocSize, strName, &bExisted, &sa); - if (FAILED(hr)) - { - return NULL; - } - - if(!bExisted) - { - memset(spMem->GetData(), 0, m_nAllocSize); - // save the index of this block - // don't for first block since we don't know m_nSchemaSize yet - if (dwNextBlockIndex) - { - _GetBlockId(spMem) = dwNextBlockIndex; - } - } - else - { - CSid owner; - CDacl dacl; - - m_sd.GetOwner(&owner); - m_sd.GetDacl(&dacl); - - // prevent us from using an object someone else has opened - if (::SetSecurityInfo(spMem->GetHandle(), SE_KERNEL_OBJECT, - DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION, - const_cast(owner.GetPSID()), - NULL, - const_cast(dacl.GetPACL()), - NULL) != ERROR_SUCCESS) - { - return NULL; - } - } - - if (pbExisted) - { - *pbExisted = bExisted; - } - - pMem = spMem; - m_aMem.Add(spMem); - - OnBlockAlloc(pMem); - } - _ATLCATCHALL() - { - return NULL; - } - - return pMem; -} - -inline HRESULT CPerfMon::_OpenAllBlocks() throw() -{ - HRESULT hr; - - // if we haven't opened any yet, initialize - if (m_aMem.GetCount() == 0) - { - CAtlFileMappingBase* pMem = _OpenNextBlock(NULL); - if (pMem == NULL) - return S_OK; - - hr = _LoadMap(LPDWORD(pMem->GetData())); - if (FAILED(hr)) - { - m_aMem.RemoveAll(); - return hr; - } - - m_nSchemaSize = *LPDWORD(pMem->GetData()); - m_nHeaderSize = m_nSchemaSize + sizeof(DWORD); - m_nHeaderSize = AtlAlignUp(m_nHeaderSize,16); - } - - // open any new blocks - CAtlFileMappingBase* pMem = m_aMem[m_aMem.GetCount()-1]; - while (pMem) - pMem = _OpenNextBlock(pMem); - - return S_OK; -} - -inline HRESULT CPerfMon::_LoadMap(DWORD* pData) throw() -{ - _ATLTRY - { - HRESULT hr; - - ClearMap(); - - DWORD dwDataSize = *pData++; // blob size - DWORD dwNumItems = *pData++; // number of items - - // see if we have name data - DWORD* pNameData = NULL; - if (dwDataSize > (2+dwNumItems*9) * sizeof(DWORD)) - pNameData = pData + dwNumItems*9; // blob size and item count already skipped. skip item data - - for (DWORD i=0; im_nNameId = dwNameId; - pCategoryInfo->m_nHelpId = dwHelpId; - } - else - { - DWORD dwCounterType = *pData++; - DWORD dwMaxCounterSize = *pData++; - DWORD dwDataOffset = *pData++; - DWORD dwDefaultScale = *pData++; - - hr = AddCounterDefinition( - dwPerfId, - strName, - NULL, - dwDetailLevel, - dwCounterType, - dwMaxCounterSize, - dwDataOffset, - dwDefaultScale); - if (FAILED(hr)) - { - ClearMap(); - return hr; - } - - DWORD dwNameId = *pData++; - DWORD dwHelpId = *pData++; - CategoryInfo* pCategoryInfo = _GetCategoryInfo(_GetNumCategories()-1); - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(pCategoryInfo->_GetNumCounters()-1); - pCounterInfo->m_nNameId = dwNameId; - pCounterInfo->m_nHelpId = dwHelpId; - } - } - - // fill in cache data - ULONG* pnCounterBlockSize = NULL; // pointer to the object's counter block size - for (DWORD i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - // align at 8 bytes per Q262335 - pCategoryInfo->m_nCounterBlockSize = (ULONG) AtlAlignUp(sizeof(PERF_COUNTER_BLOCK), 8); - pnCounterBlockSize = &pCategoryInfo->m_nCounterBlockSize; - _FillCategoryType(pCategoryInfo); - for (DWORD j=0; j_GetNumCounters(); j++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - _FillCounterDef(pCounterInfo, pnCounterBlockSize); - } - // align at 8 bytes per Q262335 - pCategoryInfo->m_nCounterBlockSize = (ULONG) AtlAlignUp(pCategoryInfo->m_nCounterBlockSize, 8); - } - - return S_OK; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } -} - -inline HRESULT CPerfMon::_SaveMap() throw() -{ - _ATLTRY - { - // figure out how much memory we need - size_t nSize = (2 + 9*_GetNumCategoriesAndCounters()) * sizeof(DWORD); - for (UINT i=0; i<_GetNumCategories(); i++) - { - // if any of the entries have names, they'd better all have names - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - if (!pCategoryInfo->m_strName.IsEmpty()) - { - nSize += sizeof(DWORD) + AtlAlignUp(sizeof(WCHAR) * pCategoryInfo->m_strName.GetLength(), sizeof(DWORD)); - for (UINT j=0; j_GetNumCounters(); j++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - nSize += sizeof(DWORD) + AtlAlignUp(sizeof(WCHAR) * pCounterInfo->m_strName.GetLength(), sizeof(DWORD)); - } - } - } - - CHeapPtr blob; - if (!blob.Allocate(nSize)) - return E_OUTOFMEMORY; - - // start with blob size and number of items in the blob - DWORD* pCurrent = reinterpret_cast(blob.m_pData); - memset(pCurrent, 0, nSize); - *pCurrent++ = (DWORD) nSize; // blob size - *pCurrent++ = _GetNumCategoriesAndCounters(); // number of items - size_t nSizeLast = nSize; - nSize -= 2 * sizeof(DWORD); - if(nSize > nSizeLast) return E_FAIL; - - for (UINT i=0; i<_GetNumCategories(); i++) - { - // add all the relevant runtime info to the blob for each item - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - - *pCurrent++ = TRUE; // is object - *pCurrent++ = pCategoryInfo->m_dwCategoryId; - *pCurrent++ = pCategoryInfo->m_dwDetailLevel; - *pCurrent++ = pCategoryInfo->m_nDefaultCounter; - *pCurrent++ = pCategoryInfo->m_nInstanceLess; - *pCurrent++ = pCategoryInfo->m_nStructSize; - *pCurrent++ = pCategoryInfo->m_nMaxInstanceNameLen; - *pCurrent++ = pCategoryInfo->m_nNameId; - *pCurrent++ = pCategoryInfo->m_nHelpId; - nSizeLast = nSize; - nSize -= 9 * sizeof(DWORD); - if(nSize > nSizeLast) return E_FAIL; - - for (UINT j=0; j_GetNumCounters(); j++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - - *pCurrent++ = FALSE; // is object - *pCurrent++ = pCounterInfo->m_dwCounterId; - *pCurrent++ = pCounterInfo->m_dwDetailLevel; - *pCurrent++ = pCounterInfo->m_dwCounterType; - *pCurrent++ = pCounterInfo->m_nMaxCounterSize; - *pCurrent++ = pCounterInfo->m_nDataOffset; - *pCurrent++ = pCounterInfo->m_nDefaultScale; - *pCurrent++ = pCounterInfo->m_nNameId; - *pCurrent++ = pCounterInfo->m_nHelpId; - nSizeLast = nSize; - nSize -= 9 * sizeof(DWORD); - if(nSize > nSizeLast) return E_FAIL; - } - } - - // add names to the blob - for (UINT i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - // copy the len of the string (in characters) then the wide-char version of the string - // pad the string to a dword boundary - int nLen = pCategoryInfo->m_strName.GetLength(); - *pCurrent++ = nLen; - nSizeLast = nSize; - nSize -= sizeof(DWORD); - if(nSize > nSizeLast) return E_FAIL; - - Checked::memcpy_s(pCurrent, nSize, CT2CW(pCategoryInfo->m_strName), sizeof(WCHAR)*nLen); - pCurrent += AtlAlignUp(sizeof(WCHAR) * nLen, sizeof(DWORD))/sizeof(DWORD); - nSizeLast = nSize; - nSize -= sizeof(WCHAR)*nLen; - if(nSize > nSizeLast) return E_FAIL; - - for (UINT j=0; j_GetNumCounters(); j++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - // copy the len of the string (in characters) then the wide-char version of the string - // pad the string to a dword boundary - int nCounterLen = pCounterInfo->m_strName.GetLength(); - *pCurrent++ = nCounterLen; - nSizeLast = nSize; - nSize -= sizeof(DWORD); - if(nSize > nSizeLast) return E_FAIL; - - Checked::memcpy_s(pCurrent, nSize, CT2CW(pCounterInfo->m_strName), sizeof(WCHAR)*nCounterLen); - pCurrent += AtlAlignUp(sizeof(WCHAR) * nCounterLen, sizeof(DWORD))/sizeof(DWORD); - nSizeLast = nSize; - nSize -= sizeof(WCHAR)*nCounterLen; - if(nSize > nSizeLast) return E_FAIL; - } - } - - CRegKey rkApp; - CString str; - DWORD dwErr; - - str.Format(c_szAtlPerfPerformanceKey, GetAppName()); - dwErr = rkApp.Open(HKEY_LOCAL_MACHINE, str); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - rkApp.SetBinaryValue(c_szAtlPerfMap, blob, *LPDWORD(blob.m_pData)); - - return S_OK; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } -} - -inline CPerfMon::CategoryInfo* CPerfMon::_FindCategoryInfo(DWORD dwCategoryId) throw() -{ - for (UINT i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - if (pCategoryInfo->m_dwCategoryId == dwCategoryId) - return pCategoryInfo; - } - - return NULL; -} - -inline CPerfMon::CounterInfo* CPerfMon::_FindCounterInfo(CategoryInfo* pCategoryInfo, DWORD dwCounterId) -{ - ATLENSURE_RETURN_VAL(pCategoryInfo != NULL, NULL); - - for (DWORD i=0; i_GetNumCounters(); i++) - { - CounterInfo* pCounter = pCategoryInfo->_GetCounterInfo(i); - if (pCounter->m_dwCounterId == dwCounterId) - return pCounter; - } - - return NULL; -} - -inline CPerfMon::CounterInfo* CPerfMon::_FindCounterInfo(DWORD dwCategoryId, DWORD dwCounterId) throw() -{ - CategoryInfo* pCategoryInfo = _FindCategoryInfo(dwCategoryId); - if (pCategoryInfo != NULL) - return _FindCounterInfo(pCategoryInfo, dwCounterId); - - return NULL; -} - -inline BOOL CPerfMon::_WantCategoryType(__in_z LPWSTR szValue, __in DWORD dwCategoryId) throw(...) -{ - ATLASSERT(szValue != NULL); - - if (lstrcmpiW(c_szAtlPerfGlobal, szValue) == 0) - return TRUE; - - CString strList(szValue); - int nStart = 0; - - CString strNum = strList.Tokenize(_T(" "), nStart); - while (!strNum.IsEmpty()) - { - if (_ttoi(strNum) == int(dwCategoryId)) - return TRUE; - - strNum = strList.Tokenize(_T(" "), nStart); - } - - return FALSE; -} - -inline LPBYTE CPerfMon::_AllocData(LPBYTE& pData, ULONG nBytesAvail, ULONG* pnBytesUsed, size_t nBytesNeeded) -{ - ATLENSURE_RETURN_VAL(pnBytesUsed != NULL, NULL); - ULONG newSize = *pnBytesUsed+static_cast(nBytesNeeded); - - if ((newSize < *pnBytesUsed) || (newSize < (ULONG) nBytesNeeded) || (nBytesAvail < newSize)) - return NULL; - - LPBYTE p = pData; - pData += nBytesNeeded; - *pnBytesUsed += (ULONG) nBytesNeeded; - - return p; -} - -inline DWORD& CPerfMon::_GetBlockId(CAtlFileMappingBase* pBlock) -{ - DWORD* pDw = _GetBlockId_NoThrow(pBlock); - ATLENSURE(pDw); - return *pDw; -} - -inline DWORD* CPerfMon::_GetBlockId_NoThrow(CAtlFileMappingBase* pBlock) -{ - if (pBlock == NULL) - return NULL; - - return LPDWORD(LPBYTE(pBlock->GetData()) + m_nSchemaSize); -} - -inline void CPerfMon::_FillCategoryType(CategoryInfo* pCategoryInfo) throw() -{ - PERF_OBJECT_TYPE& type = pCategoryInfo->m_cache; - type.DefinitionLength = sizeof(PERF_OBJECT_TYPE) + sizeof(PERF_COUNTER_DEFINITION) * pCategoryInfo->_GetNumCounters(); - type.TotalByteLength = type.DefinitionLength; // we will add the instance definitions/counter blocks as we go - type.HeaderLength = sizeof(PERF_OBJECT_TYPE); - type.ObjectNameTitleIndex = pCategoryInfo->m_nNameId; - type.ObjectNameTitle = NULL; - type.ObjectHelpTitleIndex = pCategoryInfo->m_nHelpId; - type.ObjectHelpTitle = NULL; - type.DetailLevel = pCategoryInfo->m_dwDetailLevel; - type.NumCounters = pCategoryInfo->_GetNumCounters(); - type.DefaultCounter = pCategoryInfo->m_nDefaultCounter; - if (pCategoryInfo->m_nInstanceLess == PERF_NO_INSTANCES) - type.NumInstances = PERF_NO_INSTANCES; - else - type.NumInstances = 0; // this will be calculated as objects are processed - type.CodePage = 0; - type.PerfTime.QuadPart = 0; - QueryPerformanceFrequency (&(type.PerfFreq)); -} - -inline void CPerfMon::_FillCounterDef(CounterInfo* pCounterInfo, ULONG* pnCounterBlockSize) throw() -{ - PERF_COUNTER_DEFINITION& def = pCounterInfo->m_cache; - - def.ByteLength = sizeof(PERF_COUNTER_DEFINITION); - def.CounterNameTitleIndex = pCounterInfo->m_nNameId; - def.CounterNameTitle = NULL; - def.CounterHelpTitleIndex = pCounterInfo->m_nHelpId; - def.CounterHelpTitle = NULL; - def.DefaultScale = pCounterInfo->m_nDefaultScale; - def.DetailLevel = pCounterInfo->m_dwDetailLevel; - def.CounterType = pCounterInfo->m_dwCounterType; - DWORD dwAlignOfCounter=0; - switch (pCounterInfo->m_dwCounterType & ATLPERF_SIZE_MASK) - { - case PERF_SIZE_DWORD: - def.CounterSize = sizeof(DWORD); - dwAlignOfCounter = sizeof(DWORD); - break; - case PERF_SIZE_LARGE: - def.CounterSize = sizeof(__int64); - dwAlignOfCounter = sizeof(__int64); - break; - case PERF_SIZE_ZERO: - def.CounterSize = 0; - dwAlignOfCounter = 0; - break; - case PERF_SIZE_VARIABLE_LEN: - ATLASSERT((pCounterInfo->m_dwCounterType & ATLPERF_TYPE_MASK) == PERF_TYPE_TEXT); - if ((pCounterInfo->m_dwCounterType & ATLPERF_TEXT_MASK) == PERF_TEXT_UNICODE) - { - def.CounterSize = (DWORD) AtlAlignUp(pCounterInfo->m_nMaxCounterSize * sizeof(WCHAR), sizeof(DWORD)); - } - else - { - def.CounterSize = (DWORD) AtlAlignUp(pCounterInfo->m_nMaxCounterSize * sizeof(char), sizeof(DWORD)); - } - break; - } - *pnCounterBlockSize = AtlAlignUp(*pnCounterBlockSize, dwAlignOfCounter); - def.CounterOffset = *pnCounterBlockSize; - *pnCounterBlockSize += def.CounterSize; -} - -inline HRESULT CPerfMon::_CollectInstance( - CategoryInfo* pCategoryInfo, - LPBYTE& pData, - ULONG nBytesAvail, - ULONG* pnBytesUsed, - CPerfObject* _pInstance, - PERF_OBJECT_TYPE* pObjectType, - PERF_COUNTER_DEFINITION* pCounterDefs - ) throw() -{ - DWORD dwInstance = _pInstance->m_dwInstance; - - // grab a snapshot of the object - USES_ATL_SAFE_ALLOCA; - CPerfObject* pInstance = (CPerfObject*) _ATL_SAFE_ALLOCA(_pInstance->m_nAllocSize, _ATL_SAFE_ALLOCA_DEF_THRESHOLD); - if (pInstance == NULL) - { - return E_OUTOFMEMORY; - } - Checked::memcpy_s(pInstance, _pInstance->m_nAllocSize, _pInstance, _pInstance->m_nAllocSize); - - // if it was changed or deleted between when we first saw it and when we copied - // it, then forget about whatever happens to be there for this collection period - if (pInstance->m_dwCategoryId != pCategoryInfo->m_dwCategoryId || - dwInstance != pInstance->m_dwInstance || - pInstance->m_nRefCount == 0) - return S_OK; - - // we have a copy of something that claims to be the object type we're expecting - // put it into the data blob - PERF_INSTANCE_DEFINITION* pInstanceDef = NULL; - - if (pCategoryInfo->m_nInstanceLess == PERF_NO_INSTANCES) - pObjectType->NumInstances = PERF_NO_INSTANCES; - else - { - pObjectType->NumInstances++; - - // create an instance definition - pInstanceDef = _AllocStruct(pData, nBytesAvail, pnBytesUsed, (PERF_INSTANCE_DEFINITION*) NULL); - if (pInstanceDef == NULL) - return E_OUTOFMEMORY; - - pInstanceDef->ParentObjectTitleIndex = 0; - pInstanceDef->ParentObjectInstance = 0; - pInstanceDef->UniqueID = PERF_NO_UNIQUE_ID; - - // handle the instance name - LPCWSTR szInstNameSrc = LPCWSTR(LPBYTE(pInstance)+pInstance->m_nInstanceNameOffset); - pInstanceDef->NameLength = (ULONG)(wcslen(szInstNameSrc)+1)*sizeof(WCHAR); - // align at 8 bytes per Q262335 - ULONG nNameAlloc = (ULONG) AtlAlignUp(pInstanceDef->NameLength, 8); - LPWSTR szInstNameDest = (LPWSTR) _AllocData(pData, nBytesAvail, pnBytesUsed, nNameAlloc); - if (szInstNameDest == NULL) - return E_OUTOFMEMORY; - - Checked::memcpy_s(szInstNameDest, nNameAlloc, szInstNameSrc, pInstanceDef->NameLength); - pInstanceDef->NameOffset = ULONG(LPBYTE(szInstNameDest) - LPBYTE(pInstanceDef)); - - pInstanceDef->ByteLength = DWORD(sizeof(PERF_INSTANCE_DEFINITION) + nNameAlloc); - } - - // create the counter block + data - LPBYTE pCounterData = _AllocData(pData, nBytesAvail, pnBytesUsed, pCategoryInfo->m_nCounterBlockSize); - if (pCounterData == NULL) - return E_OUTOFMEMORY; - - // fill in the counter block header for the data - PERF_COUNTER_BLOCK* pCounterBlock = (PERF_COUNTER_BLOCK*) pCounterData; - pCounterBlock->ByteLength = pCategoryInfo->m_nCounterBlockSize; - - // fill in the data - for (ULONG i=0; iNumCounters; i++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(i); - PERF_COUNTER_DEFINITION& def = pCounterDefs[i]; - LPBYTE pSrc = LPBYTE(pInstance)+pCounterInfo->m_nDataOffset; - LPBYTE pDest = pCounterData+def.CounterOffset; - switch (pCounterInfo->m_dwCounterType & ATLPERF_SIZE_MASK) - { - case PERF_SIZE_DWORD: - *LPDWORD(pDest) = *LPDWORD(pSrc); - break; - case PERF_SIZE_LARGE: - *(ULONGLONG*)(pDest) = *(ULONGLONG*)(pSrc); - break; - case PERF_SIZE_VARIABLE_LEN: - if ((pCounterInfo->m_dwCounterType & ATLPERF_TEXT_MASK) == PERF_TEXT_UNICODE) - { - LPCWSTR szSrc = reinterpret_cast(pSrc); - LPWSTR szDest = reinterpret_cast(pDest); - size_t nLen = __min(wcslen(szSrc), pCounterInfo->m_nMaxCounterSize-1); - Checked::wcsncpy_s(szDest, pCounterInfo->m_nMaxCounterSize-1, szSrc, nLen); - szDest[nLen] = 0; - } - else - { - LPCSTR szSrc = reinterpret_cast(pSrc); - LPSTR szDest = reinterpret_cast(pDest); - size_t nLen = __min(strlen(szSrc), pCounterInfo->m_nMaxCounterSize-1); - Checked::strncpy_s(szDest, pCounterInfo->m_nMaxCounterSize-1, szSrc, nLen); - szDest[nLen] = 0; - } - break; - } - } - - if (pInstanceDef != NULL) - pObjectType->TotalByteLength += pInstanceDef->ByteLength; - pObjectType->TotalByteLength += pCounterBlock->ByteLength; - - return S_OK; -} - -inline HRESULT CPerfMon::_CollectInstance( - CategoryInfo* pCategoryInfo, - LPBYTE& pData, - ULONG nBytesAvail, - ULONG* pnBytesUsed, - PERF_OBJECT_TYPE* pObjectType, - PERF_COUNTER_DEFINITION* pCounterDefs - ) throw() -{ - // specialization to collect an instanceless object with no instance data - ATLASSERT(pCategoryInfo->m_nInstanceLess == PERF_NO_INSTANCES); - pObjectType->NumInstances = PERF_NO_INSTANCES; - - // create the counter block + data - LPBYTE pCounterData = _AllocData(pData, nBytesAvail, pnBytesUsed, pCategoryInfo->m_nCounterBlockSize); - if (pCounterData == NULL) - return E_OUTOFMEMORY; - - // fill in the counter block header for the data - PERF_COUNTER_BLOCK* pCounterBlock = (PERF_COUNTER_BLOCK*) pCounterData; - pCounterBlock->ByteLength = pCategoryInfo->m_nCounterBlockSize; - - // fill in the data - for (ULONG i=0; iNumCounters; i++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(i); - PERF_COUNTER_DEFINITION& def = pCounterDefs[i]; - LPBYTE pDest = pCounterData+def.CounterOffset; - switch (pCounterInfo->m_dwCounterType & ATLPERF_SIZE_MASK) - { - case PERF_SIZE_DWORD: - *LPDWORD(pDest) = 0; - break; - case PERF_SIZE_LARGE: - *PULONGLONG(pDest) = 0; - break; - case PERF_SIZE_VARIABLE_LEN: - if ((pCounterInfo->m_dwCounterType & ATLPERF_TEXT_MASK) == PERF_TEXT_UNICODE) - memset(pDest, 0, pCounterInfo->m_nMaxCounterSize*sizeof(WCHAR)); - else - memset(pDest, 0, pCounterInfo->m_nMaxCounterSize*sizeof(CHAR)); - break; - } - } - - pObjectType->TotalByteLength += pCounterBlock->ByteLength; - - return S_OK; -} - -inline HRESULT CPerfMon::_CollectCategoryType( - CategoryInfo* pCategoryInfo, - LPBYTE pData, - ULONG nBytesAvail, - ULONG* pnBytesUsed - ) throw() -{ - ATLENSURE_RETURN(pCategoryInfo != NULL); - ATLASSERT(pnBytesUsed != NULL); - - // write the object definition out - PERF_OBJECT_TYPE* pObjectType = _AllocStruct(pData, nBytesAvail, pnBytesUsed, (PERF_OBJECT_TYPE*) NULL); - if (pObjectType == NULL) - return E_OUTOFMEMORY; - - Checked::memcpy_s(pObjectType, sizeof(PERF_OBJECT_TYPE), &pCategoryInfo->m_cache, sizeof(PERF_OBJECT_TYPE)); - - // save a pointer to the first counter entry and counter definition. - // we'll need them when we create the PERF_COUNTER_BLOCK data - PERF_COUNTER_DEFINITION* pCounterDefs = reinterpret_cast(pData); - - // write the counter definitions out - for (DWORD i=0; i_GetNumCounters(); i++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(i); - - PERF_COUNTER_DEFINITION* pCounterDef = _AllocStruct(pData, nBytesAvail, pnBytesUsed, (PERF_COUNTER_DEFINITION*) NULL); - if (pCounterDef == NULL) - return E_OUTOFMEMORY; - - Checked::memcpy_s(pCounterDef, sizeof(PERF_COUNTER_DEFINITION), &pCounterInfo->m_cache, sizeof(PERF_COUNTER_DEFINITION)); - - // set PerfTime and PerfFreq for PERF_ELAPSED_TIME counter. - if(pCounterDef->CounterType == PERF_ELAPSED_TIME) - { - LARGE_INTEGER currTime; - if (FALSE != QueryPerformanceCounter(&currTime)) - pObjectType->PerfTime = currTime; - else - pObjectType->PerfTime.QuadPart = 0; - QueryPerformanceFrequency (&(pObjectType->PerfFreq)); - } - } - - // search for objects of the appropriate type and write out their instance/counter data - bool bGotInstance = false; - - CAtlFileMappingBase* pCurrentBlock = _GetNextBlock(NULL); - if (pCurrentBlock != NULL) - { - CPerfObject* pInstance = _GetFirstInstance(pCurrentBlock); - while (pInstance && pInstance->m_nAllocSize != 0) - { - if (pInstance->m_dwCategoryId == pCategoryInfo->m_dwCategoryId) - { - bGotInstance = true; - HRESULT hr = _CollectInstance(pCategoryInfo, pData, nBytesAvail, - pnBytesUsed, pInstance, pObjectType, pCounterDefs); - if (FAILED(hr)) - return hr; - } - - pInstance = _GetNextInstance(pInstance); - ATLENSURE_RETURN(pInstance!= NULL); - - if (pInstance->m_nAllocSize == (ULONG) -1) - { - pCurrentBlock = _GetNextBlock(pCurrentBlock); - if (pCurrentBlock == NULL) - pInstance = NULL; - else - pInstance = _GetFirstInstance(pCurrentBlock); - } - } - } - - if (pCategoryInfo->m_nInstanceLess == PERF_NO_INSTANCES && !bGotInstance) - { - // we have an instanceless (singleton) object with no data. send zeroed data - HRESULT hr = _CollectInstance(pCategoryInfo, pData, nBytesAvail, - pnBytesUsed, pObjectType, pCounterDefs); - if (FAILED(hr)) - return hr; - } - - return S_OK; -} - -inline DWORD CPerfMon::Open(LPWSTR szDeviceNames) throw() -{ - (szDeviceNames); // unused - - return 0; -} - -inline DWORD CPerfMon::Collect( - __in_z LPWSTR szValue, - __deref_inout_bcount(*pcbBytes) LPVOID* ppData, - __inout LPDWORD pcbBytes, - __inout LPDWORD pcObjectTypes - ) throw() -{ - - - - - - _ATLTRY - { - if (FAILED(_OpenAllBlocks())) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - - LPBYTE pData = LPBYTE(*ppData); - ULONG nBytesLeft = *pcbBytes; - *pcbBytes = 0; - - if (_GetNumCategories() == 0) - { - // nothing is providing data. we need to load the map directly - // from the registry in order to provide category/counter data - CRegKey rkApp; - DWORD dwErr; - CString strAppKey; - - strAppKey.Format(c_szAtlPerfPerformanceKey, GetAppName()); - - dwErr = rkApp.Open(HKEY_LOCAL_MACHINE, strAppKey, KEY_READ); - if (dwErr != ERROR_SUCCESS) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - - ULONG nBytes = 0; - dwErr = rkApp.QueryBinaryValue(c_szAtlPerfMap, NULL, &nBytes); - if (dwErr != ERROR_SUCCESS) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - - CHeapPtr buf; - if (!buf.Allocate((nBytes+3)/4)) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - - dwErr = rkApp.QueryBinaryValue(c_szAtlPerfMap, buf, &nBytes); - if (dwErr != ERROR_SUCCESS) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - - if (FAILED(_LoadMap(buf))) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - } - - for (UINT i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - if (_WantCategoryType(szValue, pCategoryInfo->m_nNameId)) - { - ULONG nBytesUsed = 0; - HRESULT hr = _CollectCategoryType(pCategoryInfo, pData, nBytesLeft, &nBytesUsed); - if (hr == E_OUTOFMEMORY) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_MORE_DATA; - } - else if (FAILED(hr)) - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } - - (*pcObjectTypes)++; - (*pcbBytes) += nBytesUsed; - nBytesLeft -= nBytesUsed; - pData += nBytesUsed; - } - } - - *ppData = pData; - return ERROR_SUCCESS; - } - _ATLCATCHALL() - { - *pcbBytes = 0; - *pcObjectTypes = 0; - return ERROR_SUCCESS; - } -} - -inline DWORD CPerfMon::Close() throw() -{ - UnInitialize(); - return ERROR_SUCCESS; -} - -#ifdef _ATL_PERF_REGISTER -#pragma warning (push) -#pragma warning(disable : 4996) - -inline void CPerfMon::_AppendStrings( - LPTSTR& pszNew, - CAtlArray& astrStrings, - ULONG iFirstIndex - ) throw() -{ - for (UINT iString = 0; iString < astrStrings.GetCount(); iString++) - { - INT nFormatChars = _stprintf(pszNew, _T("%d"), iFirstIndex+2*iString); - pszNew += nFormatChars + 1; - _tcscpy(pszNew, astrStrings[iString]); - pszNew += astrStrings[iString].GetLength() + 1; - } -} - -#pragma warning (pop) - -inline HRESULT CPerfMon::_AppendRegStrings( - CRegKey& rkLang, - LPCTSTR szValue, - CAtlArray& astrStrings, - ULONG nNewStringSize, - ULONG iFirstIndex, - ULONG iLastIndex - ) throw() -{ - _ATLTRY - { - // load the existing strings, add the new data, and resave the strings - ULONG nCharsOrig = 0; - ULONG nCharsNew; - DWORD dwErr; - - dwErr = rkLang.QueryMultiStringValue(szValue, NULL, &nCharsOrig); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - nCharsNew = nCharsOrig + nNewStringSize; - - CString strOrig; - dwErr = rkLang.QueryMultiStringValue(szValue, CStrBuf(strOrig, nCharsOrig, CStrBuf::SET_LENGTH), &nCharsOrig); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - LPCTSTR pszOrig = strOrig; - - CString strNew; - CStrBuf szNew(strNew, nCharsNew, CStrBuf::SET_LENGTH); - LPTSTR pszNew = szNew; - - bool bNewStringsAdded = false; - - while (*pszOrig != '\0') - { - ULONG iIndex = _ttoi(pszOrig); - int nLen = (int) _tcslen(pszOrig) + 1; // get the length of the index and null - nLen += (int) _tcslen(pszOrig+nLen) + 1; // add the length of the description and null - - if (!bNewStringsAdded && iIndex >= iFirstIndex) - { - LPTSTR pszOld =pszNew; - _AppendStrings(pszNew, astrStrings, iFirstIndex); - bNewStringsAdded = true; - ULONG nCharsNewLast = nCharsNew; - nCharsNew -= ULONG(pszNew-pszOld); - if(nCharsNew > nCharsNewLast) - { - return E_FAIL; - } - } - - if (iIndex < iFirstIndex || iIndex > iLastIndex) - { - Checked::memmove_s(pszNew, nCharsNew, pszOrig, nLen*sizeof(TCHAR)); - pszNew += nLen; - } - pszOrig += nLen; - } - if (!bNewStringsAdded) - _AppendStrings(pszNew, astrStrings, iFirstIndex); - - *pszNew++ = '\0'; // must have 2 null terminators at end of multi_sz - - dwErr = rkLang.SetMultiStringValue(szValue, strNew); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - return S_OK; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } -} - -inline HRESULT CPerfMon::_RemoveRegStrings( - CRegKey& rkLang, - LPCTSTR szValue, - ULONG iFirstIndex, - ULONG iLastIndex - ) throw() -{ - _ATLTRY - { - // load the existing strings, remove the data, and resave the strings - DWORD nChars = 0; - DWORD dwErr; - - dwErr = rkLang.QueryMultiStringValue(szValue, NULL, &nChars); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - CString str; - CStrBuf szBuf(str, nChars, CStrBuf::SET_LENGTH); - DWORD nMaxLen = nChars*sizeof(TCHAR); - - dwErr = rkLang.QueryMultiStringValue(szValue, szBuf, &nChars); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - LPCTSTR pszRead = szBuf; - LPTSTR pszWrite = szBuf; - while (*pszRead != '\0') - { - ULONG iIndex = _ttoi(pszRead); - int nLen = (int) _tcslen(pszRead) + 1; // get the length of the index and null - nLen += (int) _tcslen(pszRead+nLen) + 1; // add the length of the description and null - if (iIndex < iFirstIndex || iIndex > iLastIndex) - { - Checked::memmove_s(pszWrite, nMaxLen , pszRead, nLen*sizeof(TCHAR)); - UINT nMaxLenLast = nMaxLen; - nMaxLen -= nLen*sizeof(TCHAR); - if(nMaxLen > nMaxLenLast) return E_FAIL; - pszWrite += nLen; - } - pszRead += nLen; - } - *pszWrite++ = '\0'; // must have 2 null terminators at end of multi_sz - - dwErr = rkLang.SetMultiStringValue(szValue, szBuf); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - return S_OK; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } -} - -inline HRESULT CPerfMon::_ReserveStringRange(DWORD& dwFirstCounter, DWORD& dwFirstHelp) throw() -{ - CRegKey rkApp; - CString strAppKey; - DWORD dwErr; - - _ATLTRY - { - strAppKey.Format(c_szAtlPerfPerformanceKey, GetAppName()); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - DWORD nNumStrings = _GetNumCategoriesAndCounters(); - - dwErr = rkApp.Open(HKEY_LOCAL_MACHINE, strAppKey); - if (dwErr == ERROR_SUCCESS) - { - // see if we already have a sufficient range reserved - DWORD dwFirstAppCounter; - DWORD dwFirstAppHelp; - DWORD dwLastAppCounter; - DWORD dwLastAppHelp; - - if (rkApp.QueryDWORDValue(c_szAtlPerfFirstCounter, dwFirstAppCounter) == ERROR_SUCCESS && - rkApp.QueryDWORDValue(c_szAtlPerfFirstHelp, dwFirstAppHelp) == ERROR_SUCCESS && - rkApp.QueryDWORDValue(c_szAtlPerfLastCounter, dwLastAppCounter) == ERROR_SUCCESS && - rkApp.QueryDWORDValue(c_szAtlPerfLastHelp, dwLastAppHelp) == ERROR_SUCCESS && - dwLastAppCounter-dwFirstAppCounter+2 >= 2*nNumStrings && - dwLastAppHelp-dwFirstAppHelp+2 >= 2*nNumStrings) - { - dwFirstCounter = dwFirstAppCounter; - dwFirstHelp = dwFirstAppHelp; - return S_OK; - } - } - - CRegKey rkPerfLib; - - dwErr = rkPerfLib.Open(HKEY_LOCAL_MACHINE, c_szAtlPerfPerfLibKey); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - if (!rkApp) - { - dwErr = rkApp.Create(HKEY_LOCAL_MACHINE, strAppKey); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - } - - // figure out the counter range - DWORD dwLastCounter; - DWORD dwLastHelp; - - dwErr = rkPerfLib.QueryDWORDValue(c_szAtlPerfLastCounter, dwLastCounter); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkPerfLib.QueryDWORDValue(c_szAtlPerfLastHelp, dwLastHelp); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwFirstCounter = dwLastCounter + 2; - dwFirstHelp = dwLastHelp + 2; - dwLastCounter += 2*nNumStrings; - dwLastHelp += 2*nNumStrings; - - dwErr = rkPerfLib.SetDWORDValue(c_szAtlPerfLastCounter, dwLastCounter); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkPerfLib.SetDWORDValue(c_szAtlPerfLastHelp, dwLastHelp); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - // register the used counter range - dwErr = rkApp.SetDWORDValue(c_szAtlPerfFirstCounter, dwFirstCounter); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetDWORDValue(c_szAtlPerfLastCounter, dwLastCounter); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetDWORDValue(c_szAtlPerfFirstHelp, dwFirstHelp); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetDWORDValue(c_szAtlPerfLastHelp, dwLastHelp); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - return S_OK; -} - -inline HRESULT CPerfMon::Register( - LPCTSTR szOpenFunc, - LPCTSTR szCollectFunc, - LPCTSTR szCloseFunc, - HINSTANCE hDllInstance /* == _AtlBaseModule.GetModuleInstance() */ - ) throw() -{ - ATLASSERT(szOpenFunc != NULL); - ATLASSERT(szCollectFunc != NULL); - ATLASSERT(szCloseFunc != NULL); - - CString str; - DWORD dwErr; - HRESULT hr; - hr = CreateMap(LANGIDFROMLCID(GetThreadLocale()), hDllInstance); - if (FAILED(hr)){ - hr = CreateMap(LANGIDFROMLCID(1033), hDllInstance); - if (FAILED(hr)) - return hr; - } - - CString strAppKey; - _ATLTRY - { - strAppKey.Format(c_szAtlPerfPerformanceKey, GetAppName()); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - // if we're already registered, unregister so we can redo registration - _UnregisterStrings(); - - // reserve a range for our counter and help strings - DWORD dwFirstCounter = 0; - DWORD dwFirstHelp = 0; - hr = _ReserveStringRange(dwFirstCounter, dwFirstHelp); - if (FAILED(hr)) - return hr; - - DWORD dwCurrentName = dwFirstCounter; - DWORD dwCurrentHelp = dwFirstHelp; - for (UINT i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - - pCategoryInfo->m_nNameId = dwCurrentName; - dwCurrentName += 2; - pCategoryInfo->m_nHelpId = dwCurrentHelp; - dwCurrentHelp += 2; - - for (UINT j=0; j_GetNumCounters(); j++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - - pCounterInfo->m_nNameId = dwCurrentName; - dwCurrentName += 2; - pCounterInfo->m_nHelpId = dwCurrentHelp; - dwCurrentHelp += 2; - } - } - - // register the app entry points - CRegKey rkApp; - - dwErr = rkApp.Create(HKEY_LOCAL_MACHINE, strAppKey); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - _ATLTRY - { - DWORD dwFLen = GetModuleFileName(hDllInstance, CStrBuf(str, MAX_PATH), MAX_PATH); - if( dwFLen == 0 ) - return AtlHresultFromLastError(); - else if( dwFLen == MAX_PATH ) - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - dwErr = rkApp.SetStringValue(c_szAtlPerfLibrary, str); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetStringValue(c_szAtlPerfOpen, szOpenFunc); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetStringValue(c_szAtlPerfCollect, szCollectFunc); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetStringValue(c_szAtlPerfClose, szCloseFunc); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - dwErr = rkApp.SetStringValue(c_szAtlPerfLanguages, _T("")); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - hr = _SaveMap(); - if (FAILED(hr)) - return hr; - - // if the dll is disabled, reenable it since we just reregistered it - rkApp.DeleteValue(_T("Disable Performance Counters")); - - return S_OK; -} - -inline HRESULT CPerfMon::RegisterStrings( - LANGID language /* = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) */, - HINSTANCE hResInstance /* = _AtlBaseModule.GetResourceInstance() */ - ) throw() -{ - _ATLTRY - { - CString str; - DWORD dwErr; - HRESULT hr; - CRegKey rkLang; - CRegKey rkApp; - - LANGID wPrimaryLanguage = (LANGID) PRIMARYLANGID(language); - - if (language == MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)) - { - //First try current thread locale - language = LANGIDFROMLCID(GetThreadLocale()); - wPrimaryLanguage = (LANGID) PRIMARYLANGID(language); - } - str.Format(c_szAtlPerfPerfLibLangKey, wPrimaryLanguage); - dwErr = rkLang.Open(HKEY_LOCAL_MACHINE, str); - if (dwErr == ERROR_FILE_NOT_FOUND) - { - // failed using current thread, so try default system lcid - language = GetSystemDefaultLangID(); - wPrimaryLanguage = (LANGID) PRIMARYLANGID(language); - str.Format(c_szAtlPerfPerfLibLangKey, wPrimaryLanguage); - dwErr = rkLang.Open(HKEY_LOCAL_MACHINE, str); - } - if (dwErr == ERROR_FILE_NOT_FOUND) - return S_FALSE; // the language isn't installed on the system - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - hr = CreateMap(language, hResInstance); - if (FAILED(hr)) - return hr; - - // load list of language strings already registered - str.Format(c_szAtlPerfPerformanceKey, GetAppName()); - dwErr = rkApp.Open(HKEY_LOCAL_MACHINE, str); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - DWORD dwLangsLen = 0; - CString strLangs; - - dwErr = rkApp.QueryStringValue(c_szAtlPerfLanguages, NULL, &dwLangsLen); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - - ULONG nLangsBuffSize = dwLangsLen+4; - CStrBuf szLangs(strLangs, nLangsBuffSize, CStrBuf::SET_LENGTH); // reserve room for adding new language - dwErr = rkApp.QueryStringValue(c_szAtlPerfLanguages, szLangs, &dwLangsLen); - if (dwErr != ERROR_SUCCESS) - return AtlHresultFromWin32(dwErr); - dwLangsLen--; // don't count '\0' - - // see if this language has already been registered and if so, return - TCHAR szNewLang[5]; - _sntprintf_s(szNewLang, _countof(szNewLang), _countof(szNewLang)-1, _T("%3.3x "), wPrimaryLanguage); - if (strLangs.Find(szNewLang) != -1) - return S_OK; - - // load the strings we want to append and figure out how much extra space is needed for them - // (including up to 5-digit index values and 2 null separators) - CAtlArray astrCounters; - CAtlArray astrHelp; - ULONG nNewCounterSize = 0; - ULONG nNewHelpSize = 0; - - for (UINT i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - - astrCounters.Add(pCategoryInfo->m_strName); - astrHelp.Add(pCategoryInfo->m_strHelp); - - for (UINT j=0; j_GetNumCounters(); j++) - { - CounterInfo* pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - - astrCounters.Add(pCounterInfo->m_strName); - astrHelp.Add(pCounterInfo->m_strHelp); - } - } - - for (size_t i=0; i* pLangs = reinterpret_cast*>(lParam); - _ATLTRY - { - pLangs->Add(wIDLanguage); - } - _ATLCATCHALL() - { - return FALSE; - } - - return TRUE; -} - -inline HRESULT CPerfMon::RegisterAllStrings( - HINSTANCE hResInstance /* = NULL */ - ) throw() -{ - HRESULT hrReturn = S_FALSE; - HRESULT hr; - - UINT nRes; - hr = CreateMap(0, hResInstance, &nRes); - if (FAILED(hr)) - return hr; - - if (nRes == 0) - return RegisterStrings(0, hResInstance); - - if (hResInstance != NULL) - return _RegisterAllStrings(nRes, hResInstance); - - for (int i = 0; hResInstance = _AtlBaseModule.GetHInstanceAt(i), hResInstance != NULL; i++) - { - hr = _RegisterAllStrings(nRes, hResInstance); - if (FAILED(hr)) - return hr; - if (hr == S_OK) - hrReturn = S_OK; - } - - return hrReturn; -} - -inline HRESULT CPerfMon::_RegisterAllStrings( - UINT nRes, - HINSTANCE hResInstance - ) throw() -{ - HRESULT hrReturn = S_FALSE; - HRESULT hr; - - CAtlArray langs; - if (!EnumResourceLanguages(hResInstance, RT_STRING, MAKEINTRESOURCE((nRes>>4)+1), EnumResLangProc, reinterpret_cast(&langs))) - return AtlHresultFromLastError(); - - for (UINT i=0; i(self.GetPSID()), - NULL, - const_cast(dacl.GetPACL()), - NULL) != ERROR_SUCCESS) - return E_FAIL; - } - - // now set up the dacl for creating shared memory segments and store it - dacl.AddAllowedAce(Sids::Interactive(), GENERIC_READ); - m_sd.SetDacl(dacl); - - // create a shared memory area to share data between the app being measured and the client doing the measuring - { - CMutexLock lock(tempLock); - - BOOL bExisted = FALSE; - - CAtlFileMappingBase* pMem; - pMem = _AllocNewBlock(NULL, &bExisted); - if (pMem == NULL) - return E_OUTOFMEMORY; - - if (!bExisted) - { - // copy the map from the registry to the shared memory - CRegKey rkApp; - DWORD dwErr; - CString strAppKey; - - strAppKey.Format(c_szAtlPerfPerformanceKey, GetAppName()); - - dwErr = rkApp.Open(HKEY_LOCAL_MACHINE, strAppKey, KEY_READ); - if (dwErr != ERROR_SUCCESS) - { - m_aMem.RemoveAll(); - return AtlHresultFromWin32(dwErr); - } - - ULONG nBytes = m_nAllocSize; - dwErr = rkApp.QueryBinaryValue(c_szAtlPerfMap, pMem->GetData(), &nBytes); - if (dwErr != ERROR_SUCCESS) - { - m_aMem.RemoveAll(); - return AtlHresultFromWin32(dwErr); - } - } - - hr = _LoadMap(LPDWORD(pMem->GetData())); - if (FAILED(hr)) - { - m_aMem.RemoveAll(); - return hr; - } - - m_nSchemaSize = *LPDWORD(pMem->GetData()); - m_nHeaderSize = m_nSchemaSize + sizeof(DWORD); - m_nHeaderSize = AtlAlignUp(m_nHeaderSize,16); - } - - m_lock.Attach(tempLock.Detach()); - } - _ATLCATCHALL() - { - m_aMem.RemoveAll(); - return E_OUTOFMEMORY; - } - - return S_OK; -} - -inline void CPerfMon::UnInitialize() throw() -{ - if (m_lock.m_h != NULL) - m_lock.Close(); - m_aMem.RemoveAll(); - ClearMap(); -} - -inline HRESULT CPerfMon::_CreateInstance( - DWORD dwCategoryId, - DWORD dwInstance, - LPCWSTR szInstanceName, - CPerfObject** ppInstance, - bool bByName - ) throw() -{ - CPerfObject* pEmptyBlock = NULL; - - if (ppInstance == NULL) - return E_POINTER; - - CAtlFileMappingBase* pCurrentBlock = _GetNextBlock(NULL); - if (pCurrentBlock == NULL || pCurrentBlock->GetData() == NULL || m_lock.m_h == NULL) - return E_UNEXPECTED; // Initialize must succeed before calling CreateInstance - - *ppInstance = NULL; - - CategoryInfo* pCategoryInfo = _FindCategoryInfo(dwCategoryId); - if (pCategoryInfo == NULL) - return E_INVALIDARG; - if (szInstanceName == NULL && bByName) - return E_INVALIDARG; - if (pCategoryInfo->m_nInstanceLess == PERF_NO_INSTANCES && - (dwInstance != 0 || szInstanceName != NULL)) - return E_INVALIDARG; - - CPerfLock lock(this); - if (FAILED(lock.GetStatus())) - return lock.GetStatus(); - - CPerfObject* pInstance = _GetFirstInstance(pCurrentBlock); - ULONG nMaxInstance = 0; - ULONG nUsedSpace = 0; - - // walk all of the existing objects trying to find one that matches the request - while (pInstance->m_nAllocSize != 0) - { - nUsedSpace += pInstance->m_nAllocSize; - - if (pInstance->m_dwCategoryId == dwCategoryId) - { - nMaxInstance = __max(nMaxInstance, pInstance->m_dwInstance); - - // check to see if we've found the one the caller wants - if (!bByName && pInstance->m_dwInstance == dwInstance && - (pCategoryInfo->m_nInstanceLess == PERF_NO_INSTANCES || dwInstance != 0)) - { - *ppInstance = pInstance; - pInstance->m_nRefCount++; - return S_OK; - } - if (bByName) - { - LPWSTR szInstName = (LPWSTR(LPBYTE(pInstance)+pInstance->m_nInstanceNameOffset)); - if (wcsncmp(szInstName, szInstanceName, pCategoryInfo->m_nMaxInstanceNameLen-1) == 0) - { - *ppInstance = pInstance; - pInstance->m_nRefCount++; - return S_OK; - } - } - } - - if (pInstance->m_nAllocSize == pCategoryInfo->m_nAllocSize && pInstance->m_nRefCount == 0) - pEmptyBlock = pInstance; - - pInstance = _GetNextInstance(pInstance); - ATLENSURE_RETURN(pInstance!= NULL); - - if (pInstance->m_nAllocSize == 0 && - m_nHeaderSize + nUsedSpace + pCategoryInfo->m_nAllocSize + sizeof(CPerfObject) > m_nAllocSize) - { - // we've reached the end of the block and have no room to allocate an object of this - // type. cap the block with a sentinel - pInstance->m_nAllocSize = (ULONG) -1; - } - - // check for an end-of-shared-mem sentinel - if (pInstance->m_nAllocSize == (ULONG) -1) - { - nUsedSpace = 0; - CAtlFileMappingBase* pNextBlock = _GetNextBlock(pCurrentBlock); - if (pNextBlock == NULL) - { - // we've reached the last block of shared mem. - // the instance hasn't been found, so either use a - // previously freed instance block (pEmptyBlock) or allocate a new - // shared mem block to hold the new instance - if (pEmptyBlock == NULL) - { - pNextBlock = _AllocNewBlock(pCurrentBlock); - if (pNextBlock == NULL) - return E_OUTOFMEMORY; - } - else - break; - } - pCurrentBlock = pNextBlock; - pInstance = _GetFirstInstance(pCurrentBlock); - } - } - - // allocate a new object - if (pEmptyBlock != NULL) - pInstance = pEmptyBlock; - else - pInstance->m_nAllocSize = pCategoryInfo->m_nAllocSize; - - if (dwInstance == 0 && pCategoryInfo->m_nInstanceLess != PERF_NO_INSTANCES) - pInstance->m_dwInstance = nMaxInstance + 1; - else - pInstance->m_dwInstance = dwInstance; - - pInstance->m_nRefCount = 1; - - // copy the instance name, truncate if necessary - if (pCategoryInfo->m_nInstanceLess != PERF_NO_INSTANCES) - { - ULONG nNameLen = (ULONG)__min(wcslen(szInstanceName), pCategoryInfo->m_nMaxInstanceNameLen-1); - ULONG nNameBytes = (nNameLen+1) * sizeof(WCHAR); - pInstance->m_nInstanceNameOffset = pInstance->m_nAllocSize-nNameBytes; - Checked::memcpy_s(LPBYTE(pInstance)+pInstance->m_nInstanceNameOffset, pInstance->m_nAllocSize-pInstance->m_nInstanceNameOffset, szInstanceName, nNameBytes); - LPWSTR(LPBYTE(pInstance)+pInstance->m_nInstanceNameOffset)[nNameLen] = 0; - } - - // copy the CategoryId last: it won't be collected until this is set - pInstance->m_dwCategoryId = pCategoryInfo->m_dwCategoryId; - - *ppInstance = pInstance; - - return S_OK; -} - -inline HRESULT CPerfMon::CreateInstance( - DWORD dwCategoryId, - DWORD dwInstance, - LPCWSTR szInstanceName, - CPerfObject** ppInstance - ) throw() -{ - return _CreateInstance(dwCategoryId, dwInstance, szInstanceName, ppInstance, false); -} - -inline HRESULT CPerfMon::CreateInstanceByName( - DWORD dwCategoryId, - LPCWSTR szInstanceName, - CPerfObject** ppInstance - ) throw() -{ - return _CreateInstance(dwCategoryId, 0, szInstanceName, ppInstance, true); -} - -inline HRESULT CPerfMon::ReleaseInstance(CPerfObject* pInstance) throw() -{ - ATLASSERT(pInstance != NULL); - if (pInstance == NULL) - return E_INVALIDARG; - - CPerfLock lock(this); - if (FAILED(lock.GetStatus())) - return lock.GetStatus(); - - if (--pInstance->m_nRefCount == 0) - { - pInstance->m_dwInstance = 0; - pInstance->m_dwCategoryId = 0; - } - - return S_OK; -} - -inline HRESULT CPerfMon::LockPerf(DWORD dwTimeout /* == INFINITE */) throw() -{ - if (m_lock.m_h == NULL) - return E_UNEXPECTED; - - DWORD dwRes = WaitForSingleObject(m_lock.m_h, dwTimeout); - if (dwRes == WAIT_ABANDONED || dwRes == WAIT_OBJECT_0) - return S_OK; - if (dwRes == WAIT_TIMEOUT) - return HRESULT_FROM_WIN32(ERROR_TIMEOUT); - return AtlHresultFromLastError(); -} - -inline void CPerfMon::UnlockPerf() throw() -{ - m_lock.Release(); -} - -// map building routines -inline HRESULT CPerfMon::AddCategoryDefinition( - DWORD dwCategoryId, - LPCTSTR szCategoryName, - LPCTSTR szHelpString, - DWORD dwDetailLevel, - INT nDefaultCounter, - BOOL bInstanceLess, - UINT nStructSize, - UINT nMaxInstanceNameLen) throw() -{ - // must have one and only one of these - ATLASSERT(!bInstanceLess ^ !nMaxInstanceNameLen); - - // get the things that can fail out of the way first - CString strName; - CString strHelp; - _ATLTRY - { - strName = szCategoryName; - strHelp = szHelpString; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - if (!m_categories.SetCount(m_categories.GetCount()+1)) - { - return E_OUTOFMEMORY; - } - - // category has been added, set the data - CategoryInfo* pCategoryInfo = _GetCategoryInfo(_GetNumCategories()-1); - - pCategoryInfo->m_dwCategoryId = dwCategoryId; - pCategoryInfo->m_dwDetailLevel = dwDetailLevel; - pCategoryInfo->m_nDefaultCounter = nDefaultCounter; - pCategoryInfo->m_nInstanceLess = bInstanceLess ? PERF_NO_INSTANCES : 0; - pCategoryInfo->m_nStructSize = nStructSize; - pCategoryInfo->m_nMaxInstanceNameLen = nMaxInstanceNameLen; - pCategoryInfo->m_nAllocSize = nStructSize + nMaxInstanceNameLen*sizeof(WCHAR); - pCategoryInfo->m_strName = strName; - pCategoryInfo->m_strHelp = strHelp; - pCategoryInfo->m_nNameId = 0; - pCategoryInfo->m_nHelpId = 0; - - return S_OK; -} - -inline HRESULT CPerfMon::AddCounterDefinition( - DWORD dwCounterId, - LPCTSTR szCounterName, - LPCTSTR szHelpString, - DWORD dwDetailLevel, - DWORD dwCounterType, - ULONG nMaxCounterSize, - UINT nOffset, - INT nDefaultScale) throw() -{ - // must add category BEFORE adding counter! - ATLASSERT(_GetNumCategories() > 0); - - CounterInfo counter; - - counter.m_dwCounterId = dwCounterId; - _ATLTRY - { - counter.m_strName = szCounterName; - counter.m_strHelp = szHelpString; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - counter.m_dwDetailLevel = dwDetailLevel; - counter.m_dwCounterType = dwCounterType; - counter.m_nDefaultScale = nDefaultScale; - counter.m_nMaxCounterSize = nMaxCounterSize; - counter.m_nDataOffset = nOffset; - - counter.m_nNameId = 0; - counter.m_nHelpId = 0; - - // add the counter to the category - CategoryInfo* pCategoryInfo = _GetCategoryInfo(_GetNumCategories()-1); - _ATLTRY - { - pCategoryInfo->m_counters.Add(counter); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - if (counter.m_nMaxCounterSize > 0) - { - ATLASSERT(counter.m_dwCounterType & PERF_TYPE_TEXT); - pCategoryInfo->m_nAllocSize += counter.m_nMaxCounterSize * sizeof(WCHAR); - } - - return S_OK; -} - -inline HRESULT CPerfMon::RegisterCategory( - WORD wLanguage, - HINSTANCE hResInstance, - UINT* pSampleRes, - DWORD dwCategoryId, - UINT nNameString, - UINT nHelpString, - DWORD dwDetail, - BOOL bInstanceless, - UINT nStructSize, - UINT nMaxInstanceNameLen, - INT nDefaultCounter) throw() -{ - if (pSampleRes) - *pSampleRes = nNameString; - - CString strName; - CString strHelp; - - _ATLTRY - { - - if (!strName.LoadString(hResInstance, nNameString, wLanguage) || - !strHelp.LoadString(hResInstance, nHelpString, wLanguage)) - { - return E_FAIL; - } - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return RegisterCategory( - wLanguage, - hResInstance, - pSampleRes, - dwCategoryId, - strName, - strHelp, - dwDetail, - bInstanceless, - nStructSize, - nMaxInstanceNameLen, - nDefaultCounter); -} - -inline HRESULT CPerfMon::RegisterCategory( - WORD /* wLanguage */, - HINSTANCE /* hResInstance */, - UINT* /* pSampleRes */, - DWORD dwCategoryId, - LPCTSTR szNameString, - LPCTSTR szHelpString, - DWORD dwDetail, - BOOL bInstanceless, - UINT nStructSize, - UINT nMaxInstanceNameLen, - INT nDefaultCounter) throw() -{ - return AddCategoryDefinition( - dwCategoryId, - szNameString, - szHelpString, - dwDetail, - nDefaultCounter, - bInstanceless, - nStructSize, - nMaxInstanceNameLen); -} - -inline HRESULT CPerfMon::RegisterCounter( - WORD wLanguage, - HINSTANCE hResInstance, - DWORD dwCounterId, - UINT nNameString, - UINT nHelpString, - DWORD dwDetail, - DWORD dwCounterType, - ULONG nMaxCounterSize, - UINT nOffset, - INT nDefaultScale) throw() -{ - CString strName; - CString strHelp; - - _ATLTRY - { - - if (!strName.LoadString(hResInstance, nNameString, wLanguage) || - !strHelp.LoadString(hResInstance, nHelpString, wLanguage)) - { - return E_FAIL; - } - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return RegisterCounter( - wLanguage, - hResInstance, - dwCounterId, - strName, - strHelp, - dwDetail, - dwCounterType, - nMaxCounterSize, - nOffset, - nDefaultScale); -} - -inline HRESULT CPerfMon::RegisterCounter( - WORD /* wLanguage */, - HINSTANCE /* hResInstance */, - DWORD dwCounterId, - LPCTSTR szNameString, - LPCTSTR szHelpString, - DWORD dwDetail, - DWORD dwCounterType, - ULONG nMaxCounterSize, - UINT nOffset, - INT nDefaultScale) throw() -{ - return AddCounterDefinition( - dwCounterId, - szNameString, - szHelpString, - dwDetail, - dwCounterType, - nMaxCounterSize, - nOffset, - nDefaultScale); -} - -inline void CPerfMon::ClearMap() throw() -{ - m_categories.RemoveAll(); -} - -#ifndef _ATL_PERF_NOXML - -ATL_NOINLINE inline HRESULT CPerfMon::PersistToXML(IStream *pStream, BOOL bFirst/*=TRUE*/, BOOL bLast/*=TRUE*/) throw(...) -{ - ATLASSERT(pStream != NULL); - if (pStream == NULL) - return E_INVALIDARG; - - CPerfLock lock(this); - if (FAILED(lock.GetStatus())) - return ERROR_SUCCESS; - - CStringA strXML; - HRESULT hr = S_OK; - ULONG nLen = 0; - - if (bFirst) - { - strXML = "\r\n\r\n"; - hr = pStream->Write(strXML, strXML.GetLength(), &nLen); - if (hr != S_OK) - return hr; - } - - strXML.Format("\t\r\n", CT2CA(GetAppName())); - hr = pStream->Write(strXML, strXML.GetLength(), &nLen); - - for (UINT i=0; i<_GetNumCategories(); i++) - { - CategoryInfo* pCategoryInfo = _GetCategoryInfo(i); - - CAtlFileMappingBase *pCurrentBlock = _GetNextBlock(NULL); - CPerfObject *pInstance = _GetFirstInstance(pCurrentBlock); - - strXML.Format("\t\t\r\n", - pCategoryInfo->m_dwCategoryId, pCategoryInfo->m_nNameId, pCategoryInfo->m_nHelpId); - - hr = pStream->Write(strXML, strXML.GetLength(), &nLen); - if (hr != S_OK) - return E_FAIL; - - while (pInstance && pInstance->m_nAllocSize) - { - if (pInstance->m_dwCategoryId == pCategoryInfo->m_dwCategoryId) - { - if (pCategoryInfo->m_nInstanceLess != PERF_NO_INSTANCES) - { - // handle the instance name - LPCWSTR wszInstNameSrc = LPCWSTR(LPBYTE(pInstance)+pInstance->m_nInstanceNameOffset); - int nInstLen = (int) wcslen(wszInstNameSrc); - - // convert to UTF8 - int nLength = AtlUnicodeToUTF8(wszInstNameSrc, nInstLen, NULL, 0); - CHeapPtr szUTF8; - if ((nLength < 0) || (nLength+1\r\n", szUTF8, pInstance->m_dwInstance); - hr = pStream->Write(strXML, strXML.GetLength(), &nLen); - if (hr != S_OK) - return hr; - } - - for (UINT j=0; j_GetNumCounters(); j++) - { - CounterInfo *pCounterInfo = pCategoryInfo->_GetCounterInfo(j); - switch (pCounterInfo->m_dwCounterType & ATLPERF_SIZE_MASK) - { - case PERF_SIZE_DWORD: - { - strXML.Format("\t\t\t\t\r\n", - *LPDWORD(LPBYTE(pInstance)+pCounterInfo->m_nDataOffset), - pCounterInfo->m_nDataOffset); - break; - } - case PERF_SIZE_LARGE: - { - strXML.Format("\t\t\t\t\r\n", - *PULONGLONG(LPBYTE(pInstance)+pCounterInfo->m_nDataOffset), - pCounterInfo->m_nDataOffset); - break; - } - case PERF_SIZE_VARIABLE_LEN: - { - CHeapPtr szUTF8; - LPBYTE pSrc = LPBYTE(pInstance)+pCounterInfo->m_nDataOffset; - if ((pCounterInfo->m_dwCounterType & ATLPERF_TEXT_MASK) == PERF_TEXT_UNICODE) - { - ULONG nTextLen = (ULONG)wcslen(LPCWSTR(pSrc)); - // convert to UTF8 - nLen = AtlUnicodeToUTF8(LPCWSTR(pSrc), nTextLen, NULL, 0); - if (!szUTF8.Allocate(nLen+1)) - return E_OUTOFMEMORY; - - nLen = AtlUnicodeToUTF8(LPCWSTR(pSrc), nTextLen, szUTF8, nLen); - szUTF8[nLen] = '\0'; - strXML.Format("\t\t\t\t\r\n", - szUTF8, - pCounterInfo->m_nDataOffset); - } - else - { - ULONG nTextLen = (ULONG)strlen(LPCSTR(pSrc)); - if (!szUTF8.Allocate(nTextLen+1)) - return E_OUTOFMEMORY; - Checked::strcpy_s(szUTF8, nTextLen+1, LPCSTR(pSrc)); - strXML.Format("\t\t\t\t\r\n", - szUTF8, - pCounterInfo->m_nDataOffset); - } - break; - } - default: - // error: - return E_FAIL; - } - hr = pStream->Write(strXML, strXML.GetLength(), &nLen); - if (hr != S_OK) - return hr; - } - - if (pCategoryInfo->m_nInstanceLess != PERF_NO_INSTANCES) - { - hr = pStream->Write("\t\t\t\r\n", sizeof("\t\t\t\r\n")-1, &nLen); - if (hr != S_OK) - return hr; - } - } - - pInstance = _GetNextInstance(pInstance); - ATLENSURE_RETURN(pInstance!= NULL); - - if (pInstance->m_nAllocSize == (ULONG)-1) - { - pCurrentBlock = _GetNextBlock(pCurrentBlock); - if (pCurrentBlock == NULL) - pInstance = NULL; - else - pInstance = _GetFirstInstance(pCurrentBlock); - } - } - - hr = pStream->Write("\t\t\r\n", sizeof("\t\t\r\n")-1, &nLen); - if (hr != S_OK) - return hr; - } - - hr = pStream->Write("\t\r\n", sizeof("\t\r\n")-1, &nLen); - if (hr != S_OK) - return hr; - - if (hr == S_OK && bLast) - hr = pStream->Write("", sizeof("")-1, &nLen); - - return hr; -} - -// This function is very lenient with inappropriate XML -ATL_NOINLINE inline HRESULT CPerfMon::LoadFromXML(IStream *pStream) throw(...) -{ - ATLASSERT(pStream != NULL); - if (pStream == NULL) - return E_INVALIDARG; - - // Get a lock - CPerfLock lock(this); - if (FAILED(lock.GetStatus())) - return ERROR_SUCCESS; - - CComPtr spdoc; - - // load the xml - HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_INPROC, __uuidof(IXMLDOMDocument), (void **) &spdoc); - if (FAILED(hr)) - { - return hr; - } - - spdoc->put_async(VARIANT_FALSE); - - CComPtr spSI; - hr = spdoc->QueryInterface(&spSI); - if (hr != S_OK) - return hr; - hr = spSI->Load(pStream); - if (hr != S_OK) - return hr; - - // validate that it is a perfPersist stream - CComPtr spRoot; - - hr = spdoc->get_documentElement(&spRoot); - if (hr != S_OK) - return hr; - - CComBSTR bstrName; - hr = spRoot->get_baseName(&bstrName); - if (wcscmp(bstrName, L"perfPersist")) - return S_FALSE; - - // find the appropriate perfmon node - CComPtr spChild; - hr = spRoot->get_firstChild(&spChild); - while (hr == S_OK) - { - bstrName.Empty(); - hr = spChild->get_baseName(&bstrName); - if (hr == S_OK) - { - if (!wcscmp(bstrName, L"perfmon")) - { - bstrName.Empty(); - hr = _GetAttribute(spChild, L"name", &bstrName); - if (hr == S_OK) - { - if (!_tcscmp(CW2CT(bstrName), GetAppName())) - break; - } - } - } - - CComPtr spNext; - hr = spChild->get_nextSibling(&spNext); - spChild.Attach(spNext.Detach()); - } - - // there is no perfmon node in the XML for the current CPerfMon class - if (hr != S_OK) - return S_FALSE; - - CComPtr spPerfRoot; - spPerfRoot.Attach(spChild.Detach()); - - // iterate over the objects in the perfmon subtree - // this is the loop that does the real work - hr = spPerfRoot->get_firstChild(&spChild); - while (hr == S_OK) - { - // see if it's a perfObject - bstrName.Empty(); - hr = spChild->get_baseName(&bstrName); - if (hr != S_OK || wcscmp(bstrName, L"perfObject")) - return S_FALSE; - - // get the perfid - bstrName.Empty(); - hr = _GetAttribute(spChild, L"perfid", &bstrName); - DWORD dwPerfId = _wtoi(bstrName); - - // iterate over children - CComPtr spInstChild; - hr = spChild->get_firstChild(&spInstChild); - while (hr == S_OK) - { - // see if it's a instance - bstrName.Empty(); - hr = spInstChild->get_baseName(&bstrName); - if (hr != S_OK || wcscmp(bstrName, L"instance")) - return S_FALSE; - - // get the instance name - bstrName.Empty(); - hr = _GetAttribute(spInstChild, L"name", &bstrName); - if (hr != S_OK) - return S_FALSE; - - // get the instance id - bstrName.Empty(); - hr = _GetAttribute(spChild, L"id", &bstrName); - if (hr != S_OK) - return S_FALSE; - DWORD dwInstance = _wtoi(bstrName); - - // create the instance - CPerfObject *pInstance = NULL; - hr = CreateInstance(dwPerfId, dwInstance++, bstrName, &pInstance); - if (hr != S_OK) - return S_FALSE; - - // iterate over the counters and set the data - CComPtr spCntrChild; - hr = spInstChild->get_firstChild(&spCntrChild); - while (hr == S_OK) - { - // get the base name - bstrName.Empty(); - hr = spCntrChild->get_baseName(&bstrName); - if (hr != S_OK || wcscmp(bstrName, L"counter")) - return S_FALSE; - - // get the type - bstrName.Empty(); - hr = _GetAttribute(spCntrChild, L"type", &bstrName); - if (hr != S_OK) - return S_FALSE; - - DWORD dwType; - if (!wcscmp(bstrName, L"perf_size_dword")) - dwType = PERF_SIZE_DWORD; - else if (!wcscmp(bstrName, L"perf_size_large")) - dwType = PERF_SIZE_LARGE; - else if (!wcscmp(bstrName, L"perf_size_variable_len_ansi")) - dwType = PERF_SIZE_VARIABLE_LEN; - else if (!wcscmp(bstrName, L"perf_size_variable_len_unicode")) - dwType = PERF_SIZE_VARIABLE_LEN | PERF_TEXT_UNICODE; - else - return S_FALSE; - - // get the value - bstrName.Empty(); - hr = _GetAttribute(spCntrChild, L"value", &bstrName); - if (hr != S_OK) - return S_FALSE; - - CComBSTR bstrOffset; - hr = _GetAttribute(spCntrChild, L"offset", &bstrOffset); - if (hr != S_OK) - return S_FALSE; - - WCHAR *pStop = NULL; - DWORD dwOffset = wcstoul(bstrOffset, &pStop, 10); - - if (dwType == PERF_SIZE_DWORD) // add it as a DWORD - { - DWORD dwVal = wcstoul(bstrName, &pStop, 10); - *LPDWORD(LPBYTE(pInstance)+dwOffset) = dwVal; - } - else if (dwType == PERF_SIZE_LARGE) // add it is a ULONGLONG - { - ULONGLONG qwVal = _wcstoui64(bstrName, &pStop, 10); - *PULONGLONG(LPBYTE(pInstance)+dwOffset) = qwVal; - } - else if (dwType == PERF_SIZE_VARIABLE_LEN) // add it as an ansi string - { - AtlW2AHelper(LPSTR(LPBYTE(pInstance)+dwOffset), bstrName, bstrName.Length(), ATL::_AtlGetConversionACP()); - } - else // add it as a unicode string - { - Checked::memcpy_s(LPBYTE(pInstance)+dwOffset, pInstance->m_nAllocSize-dwOffset, bstrName, bstrName.Length()*sizeof(WCHAR)); - } - - CComPtr spCntrNext; - hr = spCntrChild->get_nextSibling(&spCntrNext); - spCntrChild.Attach(spCntrNext.Detach()); - } - - CComPtr spInstNext; - hr = spInstChild->get_nextSibling(&spInstNext); - spInstChild.Attach(spInstNext.Detach()); - } - - CComPtr spNext; - hr = spChild->get_nextSibling(&spNext); - spChild.Attach(spNext.Detach()); - } - - return S_OK; -} - -// a little utility function to retrieve a named attribute from a node -ATL_NOINLINE inline HRESULT CPerfMon::_GetAttribute(IXMLDOMNode *pNode, LPCWSTR szAttrName, BSTR *pbstrVal) throw() -{ - ATLENSURE_RETURN(pNode != NULL); - ATLASSERT(szAttrName != NULL); - ATLENSURE_RETURN(pbstrVal != NULL); - - *pbstrVal = NULL; - CComPtr spAttrs; - - HRESULT hr = pNode->get_attributes(&spAttrs); - if (hr != S_OK) - return hr; - - CComPtr spAttr; - - hr = spAttrs->getNamedItem((BSTR) szAttrName, &spAttr); - if (hr != S_OK) - return hr; - - CComVariant varVal; - hr = spAttr->get_nodeValue(&varVal); - if (hr != S_OK) - return hr; - - hr = varVal.ChangeType(VT_BSTR); - if (hr != S_OK) - return hr; - - *pbstrVal = varVal.bstrVal; - varVal.vt = VT_EMPTY; - - return S_OK; -} - -#endif // _ATL_PERF_NOXML - -#if defined(_ATL_PERF_REGISTER) & !defined(_ATL_PERF_NOEXPORT) - -ATL_NOINLINE inline HRESULT RegisterPerfMon(HINSTANCE hDllInstance /* = _AtlBaseModule.GetModuleInstance() */) throw() -{ - CPerfMon **ppPerf = &__pperfA; - HRESULT hr = S_OK; - while (ppPerf != &__pperfZ) - { - if (*ppPerf != NULL) - { - hr = (*ppPerf)->Register(_T( ATLPERF_FUNCID_OPEN ), _T( ATLPERF_FUNCID_COLLECT ), _T( ATLPERF_FUNCID_CLOSE ), hDllInstance); - if (FAILED(hr)) - return hr; - hr = (*ppPerf)->RegisterAllStrings(hDllInstance); - if (FAILED(hr)) - return hr; - } - ppPerf++; - } - return S_OK; -} - -ATL_NOINLINE inline HRESULT UnregisterPerfMon() throw() -{ - CPerfMon **ppPerf = &__pperfA; - HRESULT hr = S_OK; - while (ppPerf != &__pperfZ) - { - if (*ppPerf != NULL) - { - hr = (*ppPerf)->Unregister(); - if (FAILED(hr)) - return hr; - } - ppPerf++; - } - return S_OK; -} - -extern "C" ATL_NOINLINE inline DWORD __declspec(dllexport) WINAPI OpenPerfMon(LPWSTR lpDeviceNames) throw() -{ - CPerfMon **ppPerf = &__pperfA; - DWORD dwErr = 0; - while (ppPerf != &__pperfZ) - { - if (*ppPerf != NULL) - { - dwErr = (*ppPerf)->Open(lpDeviceNames); - if (dwErr != 0) - return dwErr; - } - ppPerf++; - } - return 0; -} - -extern "C" ATL_NOINLINE inline DWORD __declspec(dllexport) WINAPI CollectPerfMon(LPWSTR lpwszValue, LPVOID* lppData, - LPDWORD lpcbBytes, LPDWORD lpcObjectTypes) throw() -{ - DWORD dwOrigBytes = *lpcbBytes; - DWORD dwBytesRemaining = *lpcbBytes; - CPerfMon **ppPerf = &__pperfA; - DWORD dwErr = 0; - while (ppPerf != &__pperfZ) - { - if (*ppPerf != NULL) - { - dwErr = (*ppPerf)->Collect(lpwszValue, lppData, lpcbBytes, lpcObjectTypes); - if (dwErr != 0) - return dwErr; - dwBytesRemaining -= *lpcbBytes; - *lpcbBytes = dwBytesRemaining; - } - ppPerf++; - } - *lpcbBytes = dwOrigBytes - dwBytesRemaining; - return 0; -} - -extern "C" ATL_NOINLINE inline DWORD __declspec(dllexport) WINAPI ClosePerfMon() throw() -{ - CPerfMon **ppPerf = &__pperfA; - while (ppPerf != &__pperfZ) - { - if (*ppPerf != NULL) - { - (*ppPerf)->Close(); - } - ppPerf++; - } - return 0; -} - -#endif // defined(_ATL_PERF_REGISTER) & !defined(_ATL_PERF_NOEXPORT) - -} // namespace ATL - -#pragma warning(pop) - -#endif // __ATLPERF_INL__ diff --git a/include/atl/atlrx.h b/include/atl/atlrx.h deleted file mode 100644 index 1f2b07a1f..000000000 --- a/include/atl/atlrx.h +++ /dev/null @@ -1,2013 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLRX_H__ -#define __ATLRX_H__ - -#pragma once - -#include -#include -#include - -#ifndef ATL_REGEXP_MIN_STACK -#define ATL_REGEXP_MIN_STACK 256 -#endif - -/* - Regular Expression Grammar - - R - top level grammar rule - RE - regular expression - AltE - Alternative expression - E - expression - SE - simple expression - - R -> RE - '^'RE (matches begining of string) - - RE -> AltE RE - AltE - - - AltE -> E - E '|' AltE - E -> SE (RepeatOp '?'?)? - SE -> Arg - Group - CharClass - '\'Abbrev (see below) - '\'EscapedChar (any character including reserved symbols) - '\'Digit+ (Arg back reference) - '!' (not) - '.' (any char) - '$' (end of input) - Symbol (any non-reserved character) - Arg -> '{'RE'}' - Group -> '('RE')' - CharClass -> '[' '^'? CharSet ']' - CharSet -> CharItem+ - CharItem -> Char('-'Char)? - RepeatOp -> '*' - '+' - '?' - Abbrev -> Abbreviation defined in CAtlRECharTraits - Abbrev Expansion Meaning - a ([a-zA-Z0-9]) alpha numeric - b ([ \\t]) white space (blank) - c ([a-zA-Z]) alpha - d ([0-9]) digit - h ([0-9a-fA-F]) hex digit - n (\r|(\r?\n)) newline - q (\"[^\"]*\")|(\'[^\']*\') quoted string - w ([a-zA-Z]+) simple word - z ([0-9]+) integer -*/ - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -//Convertion utility classes used to convert char* to RECHAR. -//Used by rx debugging printing. -template -class CAToREChar -{ -public: - CAToREChar(const char* psz) throw() - : m_psz(psz) - { - } - operator const RECHARTYPE*() const throw() { return m_psz; } - const char* m_psz; -}; - -template<> -class CAToREChar -{ -public: - CAToREChar(const char* psz) throw() - : m_a2w(psz) - { - } - operator const wchar_t*() const throw() { return (wchar_t*)m_a2w; } - -private: - CA2W m_a2w; -}; - -class CAtlRECharTraitsA -{ -public: - typedef char RECHARTYPE; - - static size_t GetBitFieldForRangeArrayIndex(const RECHARTYPE *sz) throw() - { -#ifndef ATL_NO_CHECK_BIT_FIELD - ATLASSERT(UseBitFieldForRange()); -#endif - return static_cast(static_cast(*sz)); - } - static RECHARTYPE *Next(const RECHARTYPE *sz) throw() - { - return (RECHARTYPE *) (sz+1); - } - - static int Strncmp(const RECHARTYPE *szLeft, const RECHARTYPE *szRight, size_t nCount) throw() - { - return strncmp(szLeft, szRight, nCount); - } - - static int Strnicmp(const RECHARTYPE *szLeft, const RECHARTYPE *szRight, size_t nCount) throw() - { - return _strnicmp(szLeft, szRight, nCount); - } - - _ATL_INSECURE_DEPRECATE("CAtlRECharTraitsA::Strlwr must be passed a buffer size.") - static RECHARTYPE *Strlwr(RECHARTYPE *sz) throw() - { - #pragma warning (push) - #pragma warning(disable : 4996) - return _strlwr(sz); - #pragma warning (pop) - } - - static RECHARTYPE *Strlwr(RECHARTYPE *sz, int nSize) throw() - { - Checked::strlwr_s(sz, nSize); - return sz; - } - - static long Strtol(const RECHARTYPE *sz, RECHARTYPE **szEnd, int nBase) throw() - { - return strtol(sz, szEnd, nBase); - } - - static int Isdigit(RECHARTYPE ch) throw() - { - return isdigit(static_cast(ch)); - } - - static const RECHARTYPE** GetAbbrevs() - { - static const RECHARTYPE *s_szAbbrevs[] = - { - "a([a-zA-Z0-9])", // alpha numeric - "b([ \\t])", // white space (blank) - "c([a-zA-Z])", // alpha - "d([0-9])", // digit - "h([0-9a-fA-F])", // hex digit - "n(\r|(\r?\n))", // newline - "q(\"[^\"]*\")|(\'[^\']*\')", // quoted string - "w([a-zA-Z]+)", // simple word - "z([0-9]+)", // integer - NULL - }; - - return s_szAbbrevs; - } - - static BOOL UseBitFieldForRange() throw() - { - return TRUE; - } - - static int ByteLen(const RECHARTYPE *sz) throw() - { - return int(strlen(sz)); - } -}; - -class CAtlRECharTraitsW -{ -public: - typedef WCHAR RECHARTYPE; - - static size_t GetBitFieldForRangeArrayIndex(const RECHARTYPE *sz) throw() - { -#ifndef ATL_NO_CHECK_BIT_FIELD - ATLASSERT(UseBitFieldForRange()); -#endif - return static_cast(*sz); - } - static RECHARTYPE *Next(const RECHARTYPE *sz) throw() - { - return (RECHARTYPE *) (sz+1); - } - - static int Strncmp(const RECHARTYPE *szLeft, const RECHARTYPE *szRight, size_t nCount) throw() - { - return wcsncmp(szLeft, szRight, nCount); - } - - static int Strnicmp(const RECHARTYPE *szLeft, const RECHARTYPE *szRight, size_t nCount) throw() - { - return _wcsnicmp(szLeft, szRight, nCount); - } - - _ATL_INSECURE_DEPRECATE("CAtlRECharTraitsW::Strlwr must be passed a buffer size.") - static RECHARTYPE *Strlwr(RECHARTYPE *sz) throw() - { - #pragma warning (push) - #pragma warning(disable : 4996) - return _wcslwr(sz); - #pragma warning (pop) - } - - static RECHARTYPE *Strlwr(RECHARTYPE *sz, int nSize) throw() - { - Checked::wcslwr_s(sz, nSize); - return sz; - } - - static long Strtol(const RECHARTYPE *sz, RECHARTYPE **szEnd, int nBase) throw() - { - return wcstol(sz, szEnd, nBase); - } - - static int Isdigit(RECHARTYPE ch) throw() - { - return iswdigit(ch); - } - - static const RECHARTYPE** GetAbbrevs() - { - static const RECHARTYPE *s_szAbbrevs[] = - { - L"a([a-zA-Z0-9])", // alpha numeric - L"b([ \\t])", // white space (blank) - L"c([a-zA-Z])", // alpha - L"d([0-9])", // digit - L"h([0-9a-fA-F])", // hex digit - L"n(\r|(\r?\n))", // newline - L"q(\"[^\"]*\")|(\'[^\']*\')", // quoted string - L"w([a-zA-Z]+)", // simple word - L"z([0-9]+)", // integer - NULL - }; - - return s_szAbbrevs; - } - - static BOOL UseBitFieldForRange() throw() - { - return FALSE; - } - - static int ByteLen(const RECHARTYPE *sz) throw() - { - return int(wcslen(sz)*sizeof(WCHAR)); - } -}; - -class CAtlRECharTraitsMB -{ -public: - typedef unsigned char RECHARTYPE; - - static size_t GetBitFieldForRangeArrayIndex(const RECHARTYPE *sz) throw() - { -#ifndef ATL_NO_CHECK_BIT_FIELD - ATLASSERT(UseBitFieldForRange()); -#endif - - return static_cast(*sz); - } - - static RECHARTYPE *Next(const RECHARTYPE *sz) throw() - { - return _mbsinc(sz); - } - - static int Strncmp(const RECHARTYPE *szLeft, const RECHARTYPE *szRight, size_t nCount) throw() - { - return _mbsncmp(szLeft, szRight, nCount); - } - - static int Strnicmp(const RECHARTYPE *szLeft, const RECHARTYPE *szRight, size_t nCount) throw() - { - return _mbsnicmp(szLeft, szRight, nCount); - } - - _ATL_INSECURE_DEPRECATE("CAtlRECharTraitsMB::Strlwr must be passed a buffer size.") - static RECHARTYPE *Strlwr(RECHARTYPE *sz) throw() - { - #pragma warning (push) - #pragma warning(disable : 4996) - return _mbslwr(sz); - #pragma warning (pop) - } - - static RECHARTYPE *Strlwr(RECHARTYPE *sz, int nSize) throw() - { - Checked::mbslwr_s(sz, nSize); - return sz; - } - - static long Strtol(const RECHARTYPE *sz, RECHARTYPE **szEnd, int nBase) throw() - { - return strtol((const char *) sz, (char **) szEnd, nBase); - } - - static int Isdigit(RECHARTYPE ch) throw() - { - return _ismbcdigit((unsigned int) ch); - } - - static const RECHARTYPE** GetAbbrevs() - { - return reinterpret_cast(CAtlRECharTraitsA::GetAbbrevs()); - } - - static BOOL UseBitFieldForRange() throw() - { - return FALSE; - } - - static int ByteLen(const RECHARTYPE *sz) throw() - { - return (int)strlen((const char *) sz); - } -}; - -#ifndef _UNICODE -typedef CAtlRECharTraitsA CAtlRECharTraits; -#else // _UNICODE -typedef CAtlRECharTraitsW CAtlRECharTraits; -#endif // !_UNICODE -// Note: If you want to use CAtlRECharTraitsMB you must pass it in -// as a template argument - -template -class CAtlRegExp; // forward declaration - -template -class CAtlREMatchContext -{ -public: - friend CAtlRegExp; - typedef typename CharTraits::RECHARTYPE RECHAR; - - struct MatchGroup - { - const RECHAR *szStart; - const RECHAR *szEnd; - }; - - UINT m_uNumGroups; - - MatchGroup m_Match; - - void GetMatch(UINT nIndex, const RECHAR **szStart, const RECHAR **szEnd) - { - ATLENSURE(szStart != NULL); - ATLENSURE(szEnd != NULL); - ATLENSURE(nIndex >=0 && nIndex < m_uNumGroups); - *szStart = m_Matches[nIndex].szStart; - *szEnd = m_Matches[nIndex].szEnd; - } - - void GetMatch(UINT nIndex, MatchGroup *pGroup) - { - - ATLENSURE(pGroup != NULL); - ATLENSURE(nIndex >=0&&(static_cast(nIndex))< m_uNumGroups); - pGroup->szStart = m_Matches[nIndex].szStart; - pGroup->szEnd = m_Matches[nIndex].szEnd; - } - -protected: - CAutoVectorPtr m_Mem; - CAutoVectorPtr m_Matches; - CAtlArray m_stack; - size_t m_nTos; - -public: - CAtlREMatchContext(size_t nInitStackSize=ATL_REGEXP_MIN_STACK) - { - m_uNumGroups = 0; - m_nTos = 0; - m_stack.SetCount(nInitStackSize); - m_Match.szStart = NULL; - m_Match.szEnd = NULL; - } - -protected: - BOOL Initialize(UINT uRequiredMem, UINT uNumGroups) throw() - { - m_nTos = 0; - - m_uNumGroups = 0; - m_Matches.Free(); - - if (!m_Matches.Allocate(uNumGroups)) - return FALSE; - - m_uNumGroups = uNumGroups; - - m_Mem.Free(); - - if (!m_Mem.Allocate(uRequiredMem)) - return FALSE; - - memset(m_Mem.m_p, 0x00, uRequiredMem*sizeof(void *)); - - memset(m_Matches, 0x00, m_uNumGroups * sizeof(MatchGroup)); - return TRUE; - } - - BOOL Push(void *p) - { - m_nTos++; - if (m_stack.GetCount() <= (UINT) m_nTos) - { - if (!m_stack.SetCount((m_nTos+1)*2)) - { - m_nTos--; - return FALSE; - } - } - m_stack[m_nTos] = p; - return TRUE; - } - - BOOL Push(size_t n) - { - return Push((void *) n); - } - - void *Pop() throw() - { - if (m_nTos==0) - { - // stack underflow - // this should never happen at match time. - // (the parsing succeeded when it shouldn't have) - ATLASSERT(FALSE); - return NULL; - } - void *p = m_stack[m_nTos]; - m_nTos--; - return p; - } -}; - -enum REParseError { - REPARSE_ERROR_OK = 0, // No error occurred - REPARSE_ERROR_OUTOFMEMORY, // Out of memory - REPARSE_ERROR_BRACE_EXPECTED, // A closing brace was expected - REPARSE_ERROR_PAREN_EXPECTED, // A closing parenthesis was expected - REPARSE_ERROR_BRACKET_EXPECTED, // A closing bracket was expected - REPARSE_ERROR_UNEXPECTED, // An unspecified fatal error occurred - REPARSE_ERROR_EMPTY_RANGE, // A range expression was empty - REPARSE_ERROR_INVALID_GROUP, // A backreference was made to a group - // that did not exist - REPARSE_ERROR_INVALID_RANGE, // An invalid range was specified - REPARSE_ERROR_EMPTY_REPEATOP, // A possibly empty * or + was detected - REPARSE_ERROR_INVALID_INPUT, // The input string was invalid -}; - -template -class CAtlRegExp -{ -public: - CAtlRegExp() throw() - { - m_uNumGroups = 0; - m_uRequiredMem = 0; - m_bCaseSensitive = TRUE; - m_LastError = REPARSE_ERROR_OK; - } - - typedef typename CharTraits::RECHARTYPE RECHAR; - - // CAtlRegExp::Parse - // Parses the regular expression - // returns REPARSE_ERROR_OK if successful, an REParseError otherwise - REParseError Parse(const RECHAR *szRE, BOOL bCaseSensitive=TRUE) - { - ATLASSERT(szRE); - if (!szRE) - return REPARSE_ERROR_INVALID_INPUT; - - Reset(); - - m_bCaseSensitive = bCaseSensitive; - - const RECHAR *szInput = szRE; - - if (!bCaseSensitive) - { - // copy the string - int nSize = CharTraits::ByteLen(szRE)+sizeof(RECHAR); - szInput = (const RECHAR *) malloc(nSize); - if (!szInput) - return REPARSE_ERROR_OUTOFMEMORY; - - Checked::memcpy_s((char *) szInput, nSize, szRE, nSize); - - CharTraits::Strlwr(const_cast(szInput), nSize/sizeof(RECHAR)); - } - const RECHAR *sz = szInput; - - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return REPARSE_ERROR_OUTOFMEMORY; - - if (*sz == '^') - { - if (AddInstruction(RE_FAIL) < 0) - return REPARSE_ERROR_OUTOFMEMORY; - sz++; - } - else - { - if (AddInstruction(RE_ADVANCE) < 0) - return REPARSE_ERROR_OUTOFMEMORY; - } - - bool bEmpty = true; - ParseRE(&sz, bEmpty); - if (!GetLastParseError()) - { - GetInstruction(nCall).call.nTarget = 2; - - if (AddInstruction(RE_MATCH) < 0) - return REPARSE_ERROR_OUTOFMEMORY; - } - - if (szInput != szRE) - free((void *) szInput); - - return GetLastParseError(); - } - - BOOL Match(const RECHAR *szIn, CAtlREMatchContext *pContext, const RECHAR **ppszEnd=NULL) - { - ATLASSERT(szIn); - ATLASSERT(pContext); - - if (!szIn || !pContext) - return FALSE; - - if (ppszEnd) - *ppszEnd = NULL; - - const RECHAR *szInput = szIn; - - if (!m_bCaseSensitive) - { - int nSize = CharTraits::ByteLen(szIn)+sizeof(RECHAR); - szInput = (const RECHAR *) malloc(nSize); - if (!szInput) - return FALSE; - - Checked::memcpy_s((char *) szInput, nSize, szIn, nSize); - CharTraits::Strlwr(const_cast(szInput), nSize/sizeof(RECHAR)); - } - - if (!pContext->Initialize(m_uRequiredMem, m_uNumGroups)) - { - if (szInput != szIn) - free((void *) szInput); - return FALSE; - } - - size_t ip = 0; - - const RECHAR *sz = szInput; - const RECHAR *szCurrInput = szInput; - -#pragma warning(push) -#pragma warning(disable:4127) // conditional expression is constant - - while (1) - { -#ifdef ATLRX_DEBUG - OnDebugEvent(ip, szInput, sz, pContext); -#endif - if (ip == 0) - pContext->m_Match.szStart = sz; - - switch (GetInstruction(ip).type) - { - case RE_NOP: - ip++; - break; - - case RE_SYMBOL: - if (GetInstruction(ip).symbol.nSymbol == static_cast(static_cast<_TUCHAR>(*sz))) - { - sz = CharTraits::Next(sz); - ip++; - } - else - { - ip = (size_t) pContext->Pop(); - } - break; - - case RE_ANY: - if (*sz) - { - sz = CharTraits::Next(sz); - ip++; - } - else - { - ip = (size_t) pContext->Pop(); - } - break; - - case RE_GROUP_START: - pContext->m_Matches[GetInstruction(ip).group.nGroup].szStart = sz; - ip++; - break; - - case RE_GROUP_END: - pContext->m_Matches[GetInstruction(ip).group.nGroup].szEnd = sz; - ip++; - break; - - case RE_PUSH_CHARPOS: - pContext->Push((void *) sz); - ip++; - break; - - case RE_POP_CHARPOS: - sz = (RECHAR *) pContext->Pop(); - ip++; - break; - - case RE_CALL: - pContext->Push(ip+1); - ip = GetInstruction(ip).call.nTarget; - break; - - case RE_JMP: - ip = GetInstruction(ip).jmp.nTarget; - break; - - case RE_RETURN: - ip = (size_t) pContext->Pop(); - break; - - case RE_PUSH_MEMORY: - pContext->Push((void *) (pContext->m_Mem[GetInstruction(ip).memory.nIndex])); - ip++; - break; - - case RE_POP_MEMORY: - pContext->m_Mem[GetInstruction(ip).memory.nIndex] = pContext->Pop(); - ip++; - break; - - case RE_STORE_CHARPOS: - pContext->m_Mem[GetInstruction(ip).memory.nIndex] = (void *) sz; - ip++; - break; - - case RE_GET_CHARPOS: - sz = (RECHAR *) pContext->m_Mem[GetInstruction(ip).memory.nIndex]; - ip++; - break; - - case RE_STORE_STACKPOS: - pContext->m_Mem[GetInstruction(ip).memory.nIndex] = (void *) pContext->m_nTos; - ip++; - break; - - case RE_GET_STACKPOS: - pContext->m_nTos = (size_t) pContext->m_Mem[GetInstruction(ip).memory.nIndex]; - ip++; - break; - - case RE_RET_NOMATCH: - if (sz == (RECHAR *) pContext->m_Mem[GetInstruction(ip).memory.nIndex]) - { - // do a return - ip = (size_t) pContext->Pop(); - } - else - ip++; - break; - - case RE_ADVANCE: - sz = CharTraits::Next(szCurrInput); - szCurrInput = sz; - if (*sz == '\0') - goto Error; - ip = 0; - pContext->m_nTos = 0; - break; - - case RE_FAIL: - goto Error; - - case RE_RANGE: - { - if (*sz == '\0') - { - ip = (size_t) pContext->Pop(); - break; - } - - RECHAR *pBits = reinterpret_cast((&m_Instructions[ip]+1)); - size_t u = CharTraits::GetBitFieldForRangeArrayIndex(sz); - if (pBits[u >> 3] & 1 << (u & 0x7)) - { - ip += InstructionsPerRangeBitField(); - ip++; - sz = CharTraits::Next(sz); - } - else - { - ip = (size_t) pContext->Pop(); - } - } - break; - - case RE_NOTRANGE: - { - if (*sz == '\0') - { - ip = (size_t) pContext->Pop(); - break; - } - - RECHAR *pBits = reinterpret_cast((&m_Instructions[ip]+1)); - size_t u = static_cast(static_cast<_TUCHAR>(* ((RECHAR *) sz))); - if (pBits[u >> 3] & 1 << (u & 0x7)) - { - ip = (size_t) pContext->Pop(); - } - else - { - ip += InstructionsPerRangeBitField(); - ip++; - sz = CharTraits::Next(sz); - } - } - break; - - case RE_RANGE_EX: - { - if (*sz == '\0') - { - ip = (size_t) pContext->Pop(); - break; - } - - BOOL bMatch = FALSE; - size_t inEnd = GetInstruction(ip).range.nTarget; - ip++; - - while (ip < inEnd) - { - if (static_cast(static_cast<_TUCHAR>(*sz)) >= GetInstruction(ip).memory.nIndex && - static_cast(static_cast<_TUCHAR>(*sz)) <= GetInstruction(ip+1).memory.nIndex) - { - // if we match, we jump to the end - sz = CharTraits::Next(sz); - ip = inEnd; - bMatch = TRUE; - } - else - { - ip += 2; - } - } - if (!bMatch) - { - ip = (size_t) pContext->Pop(); - } - } - break; - - case RE_NOTRANGE_EX: - { - if (*sz == '\0') - { - ip = (size_t) pContext->Pop(); - break; - } - - BOOL bMatch = TRUE; - size_t inEnd = GetInstruction(ip).range.nTarget; - ip++; - - while (ip < inEnd) - { - if (static_cast(static_cast<_TUCHAR>(*sz)) >= GetInstruction(ip).memory.nIndex && - static_cast(static_cast<_TUCHAR>(*sz)) <= GetInstruction(ip+1).memory.nIndex) - { - ip = (size_t) pContext->Pop(); - bMatch = FALSE; - break; - } - else - { - // if we match, we jump to the end - ip += 2; - } - } - if (bMatch) - sz = CharTraits::Next(sz); - } - break; - - case RE_PREVIOUS: - { - BOOL bMatch = FALSE; - if (m_bCaseSensitive) - { - bMatch = !CharTraits::Strncmp(sz, pContext->m_Matches[GetInstruction(ip).prev.nGroup].szStart, - pContext->m_Matches[GetInstruction(ip).prev.nGroup].szEnd-pContext->m_Matches[GetInstruction(ip).prev.nGroup].szStart); - } - else - { - bMatch = !CharTraits::Strnicmp(sz, pContext->m_Matches[GetInstruction(ip).prev.nGroup].szStart, - pContext->m_Matches[GetInstruction(ip).prev.nGroup].szEnd-pContext->m_Matches[GetInstruction(ip).prev.nGroup].szStart); - } - if (bMatch) - { - sz += pContext->m_Matches[GetInstruction(ip).prev.nGroup].szEnd-pContext->m_Matches[GetInstruction(ip).prev.nGroup].szStart; - ip++; - break; - } - ip = (size_t) pContext->Pop(); - } - break; - - case RE_MATCH: - pContext->m_Match.szEnd = sz; - if (!m_bCaseSensitive) - FixupMatchContext(pContext, szIn, szInput); - if (ppszEnd) - *ppszEnd = szIn + (sz - szInput); - if (szInput != szIn) - free((void *) szInput); - return TRUE; - break; - - case RE_PUSH_GROUP: - pContext->Push((void *) pContext->m_Matches[GetInstruction(ip).group.nGroup].szStart); - pContext->Push((void *) pContext->m_Matches[GetInstruction(ip).group.nGroup].szEnd); - ip++; - break; - - case RE_POP_GROUP: - pContext->m_Matches[GetInstruction(ip).group.nGroup].szEnd = (const RECHAR *) pContext->Pop(); - pContext->m_Matches[GetInstruction(ip).group.nGroup].szStart = (const RECHAR *) pContext->Pop(); - ip++; - break; - - default: - ATLASSERT(FALSE); - break; - } - } - -#pragma warning(pop) // 4127 - - ATLASSERT(FALSE); -Error: - pContext->m_Match.szEnd = sz; - if (!m_bCaseSensitive) - FixupMatchContext(pContext, szIn, szInput); - if (ppszEnd) - *ppszEnd = szIn + (sz - szInput); - if (szInput != szIn) - free((void *) szInput); - return FALSE; - } - -protected: - REParseError m_LastError; - - REParseError GetLastParseError() throw() - { - return m_LastError; - } - - void SetLastParseError(REParseError Error) throw() - { - m_LastError = Error; - } - // CAtlRegExp::Reset - // Removes all instructions to allow reparsing into the same instance - void Reset() throw() - { - m_Instructions.RemoveAll(); - m_uRequiredMem = 0; - m_bCaseSensitive = TRUE; - m_uNumGroups = 0; - SetLastParseError(REPARSE_ERROR_OK); - } - - - enum REInstructionType { - RE_NOP, - RE_GROUP_START, - RE_GROUP_END, - RE_SYMBOL, - RE_ANY, - RE_RANGE, - RE_NOTRANGE, - RE_RANGE_EX, - RE_NOTRANGE_EX, - RE_PLUS, - RE_NG_PLUS, - RE_QUESTION, - RE_NG_QUESTION, - RE_JMP, - RE_PUSH_CHARPOS, - RE_POP_CHARPOS, - RE_CALL, - RE_RETURN, - RE_STAR_BEGIN, - RE_NG_STAR_BEGIN, - RE_PUSH_MEMORY, - RE_POP_MEMORY, - RE_STORE_CHARPOS, - RE_STORE_STACKPOS, - RE_GET_CHARPOS, - RE_GET_STACKPOS, - RE_RET_NOMATCH, - RE_PREVIOUS, - RE_FAIL, - RE_ADVANCE, - RE_MATCH, - RE_PUSH_GROUP, - RE_POP_GROUP, - }; - - struct INSTRUCTION_SYMBOL - { - size_t nSymbol; - }; - - struct INSTRUCTION_JMP - { - size_t nTarget; - }; - - struct INSTRUCTION_GROUP - { - size_t nGroup; - }; - - struct INSTRUCTION_CALL - { - size_t nTarget; - }; - - struct INSTRUCTION_MEMORY - { - size_t nIndex; - }; - - struct INSTRUCTION_PREVIOUS - { - size_t nGroup; - }; - - struct INSTRUCTION_RANGE_EX - { - size_t nTarget; - }; - - struct INSTRUCTION - { - REInstructionType type; - union - { - INSTRUCTION_SYMBOL symbol; - INSTRUCTION_JMP jmp; - INSTRUCTION_GROUP group; - INSTRUCTION_CALL call; - INSTRUCTION_MEMORY memory; - INSTRUCTION_PREVIOUS prev; - INSTRUCTION_RANGE_EX range; - }; - }; - - inline int InstructionsPerRangeBitField() throw() - { - return (256/8) / sizeof(INSTRUCTION) + (((256/8) % sizeof(INSTRUCTION)) ? 1 : 0); - } - - CAtlArray m_Instructions; - - UINT m_uNumGroups; - UINT m_uRequiredMem; - BOOL m_bCaseSensitive; - - - // class used internally to restore - // parsing state when unwinding - class CParseState - { - public: - int m_nNumInstructions; - UINT m_uNumGroups; - UINT m_uRequiredMem; - - CParseState(CAtlRegExp *pRegExp) throw() - { - m_nNumInstructions = (int) pRegExp->m_Instructions.GetCount(); - m_uNumGroups = pRegExp->m_uNumGroups; - m_uRequiredMem = pRegExp->m_uRequiredMem; - } - - void Restore(CAtlRegExp *pRegExp) - { - pRegExp->m_Instructions.SetCount(m_nNumInstructions); - pRegExp->m_uNumGroups = m_uNumGroups; - pRegExp->m_uRequiredMem = m_uRequiredMem; - } - }; - - int AddInstruction(REInstructionType type) - { - if (!m_Instructions.SetCount(m_Instructions.GetCount()+1)) - { - SetLastParseError(REPARSE_ERROR_OUTOFMEMORY); - return -1; - } - - m_Instructions[m_Instructions.GetCount()-1].type = type; - return (int) m_Instructions.GetCount()-1; - } - - BOOL PeekToken(const RECHAR **ppszRE, int ch) throw() - { - if (**ppszRE != ch) - return FALSE; - return TRUE; - } - - BOOL MatchToken(const RECHAR **ppszRE, int ch) throw() - { - if (!PeekToken(ppszRE, ch)) - return FALSE; - *ppszRE = CharTraits::Next(*ppszRE); - return TRUE; - } - - INSTRUCTION &GetInstruction(size_t nIndex) throw() - { - return m_Instructions[nIndex]; - } - - // ParseArg: parse grammar rule Arg - int ParseArg(const RECHAR **ppszRE, bool &bEmpty) - { - int nPushGroup = AddInstruction(RE_PUSH_GROUP); - if (nPushGroup < 0) - return -1; - - GetInstruction(nPushGroup).group.nGroup = m_uNumGroups; - - int p = AddInstruction(RE_GROUP_START); - if (p < 0) - return -1; - GetInstruction(p).group.nGroup = m_uNumGroups++; - - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return -1; - - int nPopGroup = AddInstruction(RE_POP_GROUP); - if (nPopGroup < 0) - return -1; - GetInstruction(nPopGroup).group.nGroup = GetInstruction(nPushGroup).group.nGroup; - - if (AddInstruction(RE_RETURN) < 0) - return -1; - - int nAlt = ParseRE(ppszRE, bEmpty); - if (nAlt < 0) - { - if (GetLastParseError()) - return -1; - - if (!PeekToken(ppszRE, '}')) - { - SetLastParseError(REPARSE_ERROR_BRACE_EXPECTED); - return -1; - } - - // in the case of an empty group, we add a nop - nAlt = AddInstruction(RE_NOP); - if (nAlt < 0) - return -1; - } - - GetInstruction(nCall).call.nTarget = nAlt; - - if (!MatchToken(ppszRE, '}')) - { - SetLastParseError(REPARSE_ERROR_BRACE_EXPECTED); - return -1; - } - - int nEnd = AddInstruction(RE_GROUP_END); - if (nEnd < 0) - return -1; - GetInstruction(nEnd).group.nGroup = GetInstruction(p).group.nGroup; - return nPushGroup; - } - - // ParseGroup: parse grammar rule Group - int ParseGroup(const RECHAR **ppszRE, bool &bEmpty) - { - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return -1; - - if (AddInstruction(RE_RETURN) < 0) - return -1; - - int nAlt = ParseRE(ppszRE, bEmpty); - if (nAlt < 0) - { - if (GetLastParseError()) - return -1; - - if (!PeekToken(ppszRE, ')')) - { - SetLastParseError(REPARSE_ERROR_PAREN_EXPECTED); - return -1; - } - - // in the case of an empty group, we add a nop - nAlt = AddInstruction(RE_NOP); - if (nAlt < 0) - return -1; - } - - GetInstruction(nCall).call.nTarget = nAlt; - - if (!MatchToken(ppszRE, ')')) - { - SetLastParseError(REPARSE_ERROR_PAREN_EXPECTED); - return -1; - } - - return nCall; - } - - RECHAR GetEscapedChar(RECHAR ch) throw() - { - if (ch == 't') - return '\t'; - return ch; - } - - // ParseCharItem: parse grammar rule CharItem - int ParseCharItem(const RECHAR **ppszRE, RECHAR *pchStartChar, RECHAR *pchEndChar) throw() - { - if (**ppszRE == '\\') - { - *ppszRE = CharTraits::Next(*ppszRE); - *pchStartChar = GetEscapedChar(**ppszRE); - } - else - *pchStartChar = **ppszRE; - *ppszRE = CharTraits::Next(*ppszRE); - - if (!MatchToken(ppszRE, '-')) - { - *pchEndChar = *pchStartChar; - return 0; - } - - // check for unterminated range - if (!**ppszRE || PeekToken(ppszRE, ']')) - { - SetLastParseError(REPARSE_ERROR_BRACKET_EXPECTED); - return -1; - } - - *pchEndChar = **ppszRE; - *ppszRE = CharTraits::Next(*ppszRE); - - if (*pchEndChar < *pchStartChar) - { - SetLastParseError(REPARSE_ERROR_INVALID_RANGE); - return -1; - } - return 0; - } - - int AddInstructions(int nNumInstructions) - { - size_t nCurr = m_Instructions.GetCount(); - if (!m_Instructions.SetCount(nCurr+nNumInstructions)) - { - SetLastParseError(REPARSE_ERROR_OUTOFMEMORY); - return -1; - } - return (int) nCurr; - } - - // ParseCharSet: parse grammar rule CharSet - int ParseCharSet(const RECHAR **ppszRE, BOOL bNot) - { - int p = -1; - - unsigned char *pBits = NULL; - - if (CharTraits::UseBitFieldForRange()) - { - // we use a bit field to represent the characters - // a 1 bit means match against the character - // the last 5 bits are used as an index into - // the byte array, and the first 3 bits - // are used to index into the selected byte - - p = AddInstruction(bNot ? RE_NOTRANGE : RE_RANGE); - if (p < 0) - return -1; - - // add the required space to hold the character - // set. We use one bit per character for ansi - if (AddInstructions(InstructionsPerRangeBitField()) < 0) - return -1; - - pBits = (unsigned char *) (&m_Instructions[p+1]); - memset(pBits, 0x00, 256/8); - } - else - { - p = AddInstruction(bNot ? RE_NOTRANGE_EX : RE_RANGE_EX); - if (p < 0) - return -1; - } - - RECHAR chStart; - RECHAR chEnd; - - while (**ppszRE && **ppszRE != ']') - { - if (ParseCharItem(ppszRE, &chStart, &chEnd)) - return -1; - - if (CharTraits::UseBitFieldForRange()) - { - for (int i=chStart; i<=chEnd; i++) - pBits[i >> 3] |= 1 << (i & 0x7); - } - else - { - int nStart = AddInstruction(RE_NOP); - if (nStart < 0) - return -1; - - int nEnd = AddInstruction(RE_NOP); - if (nEnd < 0) - return -1; - - GetInstruction(nStart).memory.nIndex = (int) chStart; - GetInstruction(nEnd).memory.nIndex = (int) chEnd; - } - } - - if (!CharTraits::UseBitFieldForRange()) - GetInstruction(p).range.nTarget = m_Instructions.GetCount(); - - return p; - } - - // ParseCharClass: parse grammar rule CharClass - int ParseCharClass(const RECHAR **ppszRE, bool &bEmpty) - { - bEmpty = false; - if (MatchToken(ppszRE, ']')) - { - SetLastParseError(REPARSE_ERROR_EMPTY_RANGE); - return -1; - } - - BOOL bNot = FALSE; - if (MatchToken(ppszRE, '^')) - bNot = TRUE; - - if (MatchToken(ppszRE, ']')) - { - SetLastParseError(REPARSE_ERROR_EMPTY_RANGE); - return -1; - } - - int p = ParseCharSet(ppszRE, bNot); - if (p < 0) - return p; - if (!MatchToken(ppszRE, ']')) - { - SetLastParseError(REPARSE_ERROR_BRACKET_EXPECTED); - return -1; - } - - return p; - } - - int AddMemInstruction(REInstructionType type) - { - int p = AddInstruction(type); - if (p < 0) - return p; - GetInstruction(p).memory.nIndex = m_uRequiredMem++; - return p; - } - - // helper for parsing !SE - int ParseNot(const RECHAR **ppszRE, bool &bEmpty) - { - int nStoreCP = AddMemInstruction(RE_STORE_CHARPOS); - int nStoreSP = AddMemInstruction(RE_STORE_STACKPOS); - - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return -1; - - int nGetCP = AddInstruction(RE_GET_CHARPOS); - if (nGetCP < 0) - return -1; - GetInstruction(nGetCP).memory.nIndex = GetInstruction(nStoreCP).memory.nIndex; - - int nGetSP = AddInstruction(RE_GET_STACKPOS); - if (nGetSP < 0) - return -1; - GetInstruction(nGetSP).memory.nIndex = GetInstruction(nStoreSP).memory.nIndex; - - int nJmp = AddInstruction(RE_JMP); - if (nJmp < 0) - return -1; - - int nSE = ParseSE(ppszRE, bEmpty); - if (nSE < 0) - return nSE; - - // patch the call - GetInstruction(nCall).call.nTarget = nSE; - - int nGetCP1 = AddInstruction(RE_GET_CHARPOS); - if (nGetCP1 < 0) - return -1; - GetInstruction(nGetCP1).memory.nIndex = GetInstruction(nStoreCP).memory.nIndex; - - int nGetSP1 = AddInstruction(RE_GET_STACKPOS); - if (nGetSP1 < 0) - return -1; - GetInstruction(nGetSP1).memory.nIndex = GetInstruction(nStoreSP).memory.nIndex; - - int nRet = AddInstruction(RE_RETURN); - if (nRet < 0) - return -1; - - GetInstruction(nJmp).jmp.nTarget = nRet+1; - - return nStoreCP; - } - - // ParseAbbrev: parse grammar rule Abbrev - int ParseAbbrev(const RECHAR **ppszRE, bool &bEmpty) - { - const RECHAR **szAbbrevs = CharTraits::GetAbbrevs(); - - while (*szAbbrevs) - { - if (**ppszRE == **szAbbrevs) - { - const RECHAR *szAbbrev = (*szAbbrevs)+1; - int p = ParseE(&szAbbrev, bEmpty); - if (p < 0) - { - SetLastParseError(REPARSE_ERROR_UNEXPECTED); - return p; - } - *ppszRE = CharTraits::Next(*ppszRE); - return p; - } - szAbbrevs++; - } - return -1; - } - - // ParseSE: parse grammar rule SE (simple expression) - int ParseSE(const RECHAR **ppszRE, bool &bEmpty) - { - - if (MatchToken(ppszRE, '{')) - return ParseArg(ppszRE, bEmpty); - if (MatchToken(ppszRE, '(')) - return ParseGroup(ppszRE, bEmpty); - if (MatchToken(ppszRE, '[')) - return ParseCharClass(ppszRE, bEmpty); - - if (MatchToken(ppszRE, '\\')) - { - if (!CharTraits::Isdigit(**ppszRE)) - { - // check for abbreviations - int p; - p = ParseAbbrev(ppszRE, bEmpty); - if (p >= 0) - return p; - - if (GetLastParseError()) - return -1; - - // escaped char - p = AddInstruction(RE_SYMBOL); - if (p < 0) - return -1; - GetInstruction(p).symbol.nSymbol = (int) **ppszRE; - *ppszRE = CharTraits::Next(*ppszRE); - return p; - } - // previous match - bEmpty = false; - int nPrev = AddInstruction(RE_PREVIOUS); - if (nPrev < 0) - return -1; - - UINT uValue = (UINT) CharTraits::Strtol(*ppszRE, (RECHAR **) ppszRE, 10); - if (uValue >= m_uNumGroups) - { - SetLastParseError(REPARSE_ERROR_INVALID_GROUP); - return -1; - } - GetInstruction(nPrev).prev.nGroup = (size_t) uValue; - return nPrev; - } - - if (MatchToken(ppszRE, '!')) - return ParseNot(ppszRE, bEmpty); - - if (**ppszRE == '}' || **ppszRE == ']' || **ppszRE == ')') - { - return -1; - } - - if (**ppszRE == '\0') - { - return -1; - } - - int p; - if (**ppszRE == '.') - { - p = AddInstruction(RE_ANY); - if (p < 0) - return -1; - bEmpty = false; - } - else if (**ppszRE == '$' && (*ppszRE)[1] == '\0') - { - p = AddInstruction(RE_SYMBOL); - if (p < 0) - return -1; - GetInstruction(p).symbol.nSymbol = 0; - bEmpty = false; - } - else - { - p = AddInstruction(RE_SYMBOL); - if (p < 0) - return -1; - GetInstruction(p).symbol.nSymbol = (int) **ppszRE; - bEmpty = false; - } - *ppszRE = CharTraits::Next(*ppszRE); - return p; - } - - // ParseE: parse grammar rule E (expression) - int ParseE(const RECHAR **ppszRE, bool &bEmpty) - { - CParseState ParseState(this); - const RECHAR *sz = *ppszRE; - - int nSE; - - int nFirst = ParseSE(ppszRE, bEmpty); - if (nFirst < 0) - return nFirst; - - REInstructionType type = RE_MATCH; - - if (MatchToken(ppszRE, '*')) - if(MatchToken(ppszRE, '?')) - type = RE_NG_STAR_BEGIN; - else - type = RE_STAR_BEGIN; - - - else if (MatchToken(ppszRE, '+')) - if(MatchToken(ppszRE, '?')) - type = RE_NG_PLUS; - else - type = RE_PLUS; - - else if (MatchToken(ppszRE, '?')) - if(MatchToken(ppszRE, '?')) - type = RE_NG_QUESTION; - else - type = RE_QUESTION; - - - if (type == RE_MATCH) - return nFirst; - - if (type == RE_STAR_BEGIN || type == RE_QUESTION|| type == RE_NG_STAR_BEGIN || type == RE_NG_QUESTION) - { - ParseState.Restore(this); - } - else - { - m_uNumGroups = ParseState.m_uNumGroups; - } - *ppszRE = sz; - - int nE; - - if (type == RE_NG_STAR_BEGIN || type == RE_NG_PLUS || type == RE_NG_QUESTION) // Non-Greedy - { - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return -1; - - bEmpty = false; - - nSE = ParseSE(ppszRE, bEmpty); - if (nSE < 0) - return nSE; - - if (bEmpty && (type == RE_NG_STAR_BEGIN || type == RE_NG_PLUS)) - { - SetLastParseError(REPARSE_ERROR_EMPTY_REPEATOP); - return -1; - } - bEmpty = true; - - *ppszRE = CharTraits::Next(*ppszRE); - *ppszRE = CharTraits::Next(*ppszRE); - - if (type == RE_NG_STAR_BEGIN || type == RE_NG_PLUS) - { - int nJmp = AddInstruction(RE_JMP); - if (nJmp < 0) - return -1; - GetInstruction(nCall).call.nTarget = nJmp+1; - GetInstruction(nJmp).jmp.nTarget = nCall; - } - else - GetInstruction(nCall).call.nTarget = nSE+1; - - if (type == RE_NG_PLUS) - nE = nFirst; - else - nE = nCall; - } - else // Greedy - { - - int nPushMem = AddInstruction(RE_PUSH_MEMORY); - if (nPushMem < 0) - return -1; - - int nStore = AddInstruction(RE_STORE_CHARPOS); - if (nStore < 0) - return -1; - - if (AddInstruction(RE_PUSH_CHARPOS) < 0) - return -1; - - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return -1; - - if (AddInstruction(RE_POP_CHARPOS) < 0) - return -1; - - int nPopMem = AddInstruction(RE_POP_MEMORY); - if (nPopMem < 0) - return -1; - - int nJmp = AddInstruction(RE_JMP); - if (nJmp < 0) - return -1; - - GetInstruction(nPushMem).memory.nIndex = m_uRequiredMem++; - GetInstruction(nStore).memory.nIndex = GetInstruction(nPushMem).memory.nIndex; - GetInstruction(nCall).call.nTarget = nJmp+1; - GetInstruction(nPopMem).memory.nIndex = GetInstruction(nPushMem).memory.nIndex; - - bEmpty = false; - - nSE = ParseSE(ppszRE, bEmpty); - if (nSE < 0) - return nSE; - - if (bEmpty && (type == RE_STAR_BEGIN || type == RE_PLUS)) - { - SetLastParseError(REPARSE_ERROR_EMPTY_REPEATOP); - return -1; - } - - if (type != RE_PLUS && type != RE_NG_PLUS) - bEmpty = true; - - *ppszRE = CharTraits::Next(*ppszRE); - - - int nRetNoMatch = AddInstruction(RE_RET_NOMATCH); - if (nRetNoMatch < 0) - return -1; - - int nStore1 = AddInstruction(RE_STORE_CHARPOS); - if (nStore1 < 0) - return -1; - - GetInstruction(nRetNoMatch).memory.nIndex = GetInstruction(nPushMem).memory.nIndex; - GetInstruction(nStore1).memory.nIndex = GetInstruction(nPushMem).memory.nIndex; - - if (type != RE_QUESTION) - { - int nJmp1 = AddInstruction(RE_JMP); - if (nJmp1 < 0) - return -1; - GetInstruction(nJmp1).jmp.nTarget = nPushMem; - } - - GetInstruction(nJmp).jmp.nTarget = m_Instructions.GetCount(); - if (type == RE_PLUS) - nE = nFirst; - else - nE = nPushMem; - } - - return nE; - } - - - // ParseAltE: parse grammar rule AltE - int ParseAltE(const RECHAR **ppszRE, bool &bEmpty) - { - const RECHAR *sz = *ppszRE; - CParseState ParseState(this); - - int nPush = AddInstruction(RE_PUSH_CHARPOS); - if (nPush < 0) - return -1; - - int nCall = AddInstruction(RE_CALL); - if (nCall < 0) - return -1; - - GetInstruction(nCall).call.nTarget = nPush+4; - if (AddInstruction(RE_POP_CHARPOS) < 0) - return -1; - - int nJmpNext = AddInstruction(RE_JMP); - if (nJmpNext < 0) - return -1; - - int nE = ParseE(ppszRE, bEmpty); - if (nE < 0) - { - if (GetLastParseError()) - return -1; - ParseState.Restore(this); - return nE; - } - - int nJmpEnd = AddInstruction(RE_JMP); - if (nJmpEnd < 0) - return -1; - - GetInstruction(nJmpNext).jmp.nTarget = nJmpEnd+1; - - if (!MatchToken(ppszRE, '|')) - { - ParseState.Restore(this); - *ppszRE = sz; - - return ParseE(ppszRE, bEmpty); - } - - bool bEmptyAltE; - int nAltE = ParseAltE(ppszRE, bEmptyAltE); - GetInstruction(nJmpEnd).jmp.nTarget = m_Instructions.GetCount(); - GetInstruction(nJmpNext).jmp.nTarget = nAltE; - if (nAltE < 0) - { - if (GetLastParseError()) - return -1; - ParseState.Restore(this); - return nAltE; - } - bEmpty = bEmpty | bEmptyAltE; - return nPush; - } - - // ParseRE: parse grammar rule RE (regular expression) - int ParseRE(const RECHAR **ppszRE, bool &bEmpty) - { - if (**ppszRE == '\0') - return -1; - - int p = ParseAltE(ppszRE, bEmpty); - if (p < 0) - return p; - - bool bEmptyRE = true; - ParseRE(ppszRE, bEmptyRE); - if (GetLastParseError()) - return -1; - bEmpty = bEmpty && bEmptyRE; - return p; - } - - //pointers to the matched string and matched groups, currently point into an internal allocated - //buffer that hold a copy of the input string. - //This function fix these pointers to point into the original, user supplied buffer (first param to Match method). - //Example: If a ptr (szStart) currently point to +3, it is fixed to +3 - void FixupMatchContext(CAtlREMatchContext *pContext, const RECHAR *szOrig, const RECHAR *szNew) - { - ATLENSURE(pContext); - ATLASSERT(szOrig); - ATLASSERT(szNew); - - pContext->m_Match.szStart = szOrig + (pContext->m_Match.szStart - szNew); - pContext->m_Match.szEnd = szOrig + (pContext->m_Match.szEnd - szNew); - for (UINT i=0; im_uNumGroups; i++) - { - if (pContext->m_Matches[i].szStart==NULL || pContext->m_Matches[i].szEnd==NULL) - { - continue; //Do not fix unmatched groups. - } - pContext->m_Matches[i].szStart = szOrig + (pContext->m_Matches[i].szStart - szNew); - pContext->m_Matches[i].szEnd = szOrig + (pContext->m_Matches[i].szEnd - szNew); - } - } - // implementation - // helpers for dumping and debugging the rx engine -public: -#ifdef ATL_REGEXP_DUMP - size_t DumpInstruction(size_t ip) - { - printf("%08x ", ip); - switch (GetInstruction(ip).type) - { - case RE_NOP: - printf("NOP\n"); - ip++; - break; - - case RE_SYMBOL: - AtlprintfT(CAToREChar("Symbol %c\n"),GetInstruction(ip).symbol.nSymbol); - ip++; - break; - - case RE_ANY: - printf("Any\n"); - ip++; - break; - - case RE_RANGE: - printf("Range\n"); - ip++; - ip += InstructionsPerRangeBitField(); - break; - - case RE_NOTRANGE: - printf("NOT Range\n"); - ip++; - ip += InstructionsPerRangeBitField(); - break; - - case RE_RANGE_EX: - printf("RangeEx %08x\n", GetInstruction(ip).range.nTarget); - ip++; - break; - - case RE_NOTRANGE_EX: - printf("NotRangeEx %08x\n", GetInstruction(ip).range.nTarget); - ip++; - break; - - case RE_GROUP_START: - printf("Start group %d\n", GetInstruction(ip).group.nGroup); - ip++; - break; - - case RE_GROUP_END: - printf("Group end %d\n", GetInstruction(ip).group.nGroup); - ip++; - break; - - case RE_PUSH_CHARPOS: - printf("Push char pos\n"); - ip++; - break; - - case RE_POP_CHARPOS: - printf("Pop char pos\n"); - ip++; - break; - - case RE_STORE_CHARPOS: - printf("Store char pos %d\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_GET_CHARPOS: - printf("Get char pos %d\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_STORE_STACKPOS: - printf("Store stack pos %d\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_GET_STACKPOS: - printf("Get stack pos %d\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_CALL: - printf("Call %08x\n", GetInstruction(ip).call.nTarget); - ip++; - break; - - case RE_JMP: - printf("Jump %08x\n", GetInstruction(ip).jmp.nTarget); - ip++; - break; - - case RE_RETURN: - printf("return\n"); - ip++; - break; - - case RE_PUSH_MEMORY: - printf("Push memory %08x\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_POP_MEMORY: - printf("Pop memory %08x\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_RET_NOMATCH: - printf("Return no match %08x\n", GetInstruction(ip).memory.nIndex); - ip++; - break; - - case RE_MATCH: - printf("END\n"); - ip++; - break; - - case RE_ADVANCE: - printf("ADVANCE\n"); - ip++; - break; - - case RE_FAIL: - printf("FAIL\n"); - ip++; - break; - - case RE_PREVIOUS: - printf("Prev %d\n", GetInstruction(ip).prev.nGroup); - ip++; - break; - - case RE_PUSH_GROUP: - printf("Push group %d\n", GetInstruction(ip).group.nGroup); - ip++; - break; - - case RE_POP_GROUP: - printf("Pop group %d\n", GetInstruction(ip).group.nGroup); - ip++; - break; - - - default: - printf("????\n"); - ip++; - break; - } - return ip; - } - - void Dump(size_t ipCurrent = 0) - { - size_t ip = 0; - - while (ip < m_Instructions.GetCount()) - { - if (ip == ipCurrent) - printf("->"); - ip = DumpInstruction(ip); - } - } -#endif - -#ifdef ATLRX_DEBUG - void cls( HANDLE hConsole ) - { - COORD coordScreen = { 0, 0 }; /* here's where we'll home the - cursor */ - BOOL bSuccess; - DWORD cCharsWritten; - CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */ - DWORD dwConSize; /* number of character cells in - the current buffer */ - - /* get the number of character cells in the current buffer */ - - bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi ); - dwConSize = csbi.dwSize.X * csbi.dwSize.Y; - - /* fill the entire screen with blanks */ - - bSuccess = FillConsoleOutputCharacter( hConsole, (TCHAR) ' ', - dwConSize, coordScreen, &cCharsWritten ); - - /* get the current text attribute */ - - bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi ); - - /* now set the buffer's attributes accordingly */ - - bSuccess = FillConsoleOutputAttribute( hConsole, csbi.wAttributes, - dwConSize, coordScreen, &cCharsWritten ); - - /* put the cursor at (0, 0) */ - - bSuccess = SetConsoleCursorPosition( hConsole, coordScreen ); - return; - } - - void DumpStack(CAtlREMatchContext *pContext) - { - for (size_t i=pContext->m_nTos; i>0; i--) - { - if (pContext->m_stack[i] < (void *) m_Instructions.GetCount()) - printf("0x%p\n", pContext->m_stack[i]); - else - { - // assume a pointer into the input - AtlprintfT(CAToREChar("%s\n"), pContext->m_stack[i]); - } - } - } - - void DumpMemory(CAtlREMatchContext *pContext) - { - for (UINT i=0; i(CAToREChar("%d: %s\n"), i, pContext->m_Mem.m_p[i]); - } - } - - virtual void OnDebugEvent(size_t ip, const RECHAR *szIn, const RECHAR *sz, CAtlREMatchContext *pContext) - { - cls(GetStdHandle(STD_OUTPUT_HANDLE)); - printf("----------Code---------\n"); - Dump(ip); - printf("----------Input---------\n"); - AtlprintfT(CAToREChar("%s\n"), szIn); - for (int s=0; szIn+s < sz; s++) - { - printf(" "); - } - printf("^\n"); - printf("----------Memory---------\n"); - DumpMemory(pContext); - printf("----------Stack---------\n"); - DumpStack(pContext); - getchar(); - } -#endif - -}; - -} // namespace ATL -#pragma pack(pop) - -#endif // __ATLRX_H__ diff --git a/include/atl/atlserr.h b/include/atl/atlserr.h deleted file mode 100644 index 1e90016fb..000000000 --- a/include/atl/atlserr.h +++ /dev/null @@ -1,174 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSERR_H__ -#define __ATLSERR_H__ - -#pragma once -#pragma pack(push,_ATL_PACKING) -namespace ATL{ - -#define VALIDATION_S_OK 0x00000000 -#define VALIDATION_S_EMPTY 0x00000001 -#define VALIDATION_E_PARAMNOTFOUND 0x00000002 -#define VALIDATION_E_LENGTHMIN 0x80000083 -#define VALIDATION_E_LENGTHMAX 0x80000084 -#define VALIDATION_E_INVALIDLENGTH 0x80000080 -#define VALIDATION_E_INVALIDPARAM 0x80000005 -#define VALIDATION_E_FAIL 0x80000006 - -#define VALIDATION_SUCCEEDED(x) (((x == VALIDATION_S_OK) || (x == VALIDATION_S_EMPTY ))) - -typedef DWORD HTTP_CODE; - -#define HTTP_ERROR(err, sub) ((HTTP_CODE)(DWORD_PTR)MAKELONG((WORD)err, (WORD)sub)) -#define HTTP_ERROR_CODE(err) ((DWORD)LOWORD(err)) -#define HTTP_SUBERROR_CODE(err) ((DWORD)HIWORD(err)) -#define HTTP_SUCCESS HTTP_ERROR(0, 0) - -#define SUBERR_NONE 0 -#define ISE_SUBERR_BADSRF 1 -#define ISE_SUBERR_HNDLFAIL 2 -#define ISE_SUBERR_SYSOBJFAIL 3 -#define ISE_SUBERR_READFILEFAIL 4 -#define ISE_SUBERR_LOADFILEFAIL 6 -#define ISE_SUBERR_LOADLIB 7 -#define ISE_SUBERR_HANDLERIF 8 -#define ISE_SUBERR_OUTOFMEM 9 -#define ISE_SUBERR_UNEXPECTED 10 -#define ISE_SUBERR_STENCIL_INVALIDFUNCOFFSET 11 -#define ISE_SUBERR_STENCIL_MISMATCHWHILE 12 -#define ISE_SUBERR_STENCIL_MISMATCHIF 13 -#define ISE_SUBERR_STENCIL_UNEXPECTEDTYPE 14 -#define ISE_SUBERR_STENCIL_INVALIDINDEX 15 -#define ISE_SUBERR_STENCIL_INDEXOUTOFRANGE 16 -#define ISE_SUBERR_STENCIL_PARSE_FAIL 17 -#define ISE_SUBERR_STENCIL_LOAD_FAIL 18 -#define ISE_SUBERR_HANDLER_NOT_FOUND 19 -#define ISE_SUBERR_BAD_HANDLER_TAG 20 -#define ISE_SUBERR_NO_HANDLER_TAG 21 -#define ISE_SUBERR_LONGMETHODNAME 22 -#define ISE_SUBERR_LONGHANDLERNAME 23 -#define ISE_SUBERR_IMPERSONATIONFAILED 24 -#define ISE_SUBERR_ISAPISTARTUPFAILED 25 -#define ISE_SUBERR_SOAPNOSOAPACTION 26 -#define SUBERR_NO_PROCESS 27 -#define SUBERR_S_FALSE 28 -#define SUBERR_ASYNC 29 -#define SUBERR_ASYNC_DONE 30 -#define SUBERR_ASYNC_NOFLUSH 31 -#define SUBERR_ASYNC_NOFLUSH_DONE 32 -#define SUBERR_NO_CACHE 33 -#define DBG_SUBERR_ALREADY_DEBUGGING 34 -#define DBG_SUBERR_NOT_DEBUGGING 35 -#define DBG_SUBERR_INVALID_SESSION 36 -#define DBG_SUBERR_BAD_ID 37 -#define DBG_SUBERR_COCREATE 38 -#define DBG_SUBERR_ATTACH 39 - - -#define HTTP_FAIL HTTP_ERROR(500, SUBERR_NONE) -#define HTTP_SUCCESS_NO_PROCESS HTTP_ERROR(200, SUBERR_NO_PROCESS) -#define HTTP_S_FALSE HTTP_ERROR(HTTP_ERROR_CODE(HTTP_SUCCESS), SUBERR_S_FALSE) -#define HTTP_SUCCESS_ASYNC HTTP_ERROR(200, SUBERR_ASYNC) -#define HTTP_SUCCESS_ASYNC_DONE HTTP_ERROR(200, SUBERR_ASYNC_DONE) -#define HTTP_SUCCESS_ASYNC_NOFLUSH HTTP_ERROR(200, SUBERR_ASYNC_NOFLUSH) -#define HTTP_SUCCESS_ASYNC_NOFLUSH_DONE HTTP_ERROR(200, SUBERR_ASYNC_NOFLUSH_DONE) -#define HTTP_SUCCESS_NO_CACHE HTTP_ERROR(200, SUBERR_NO_CACHE) -#define HTTP_OK HTTP_ERROR(200, SUBERR_NONE) -#define HTTP_CONTINUE HTTP_ERROR(100, SUBERR_NONE) - -#define HTTP_CREATED HTTP_ERROR(201, SUBERR_NONE) -#define HTTP_ACCEPTED HTTP_ERROR(202, SUBERR_NONE) -#define HTTP_NON_AUTHORITATIVE HTTP_ERROR(203, SUBERR_NONE) -#define HTTP_NO_CONTENT HTTP_ERROR(204, SUBERR_NONE) -#define HTTP_RESET_CONTENT HTTP_ERROR(205, SUBERR_NONE) -#define HTTP_PARTIAL_CONTENT HTTP_ERROR(206, SUBERR_NONE) - -#define HTTP_MULTIPLE_CHOICES HTTP_ERROR(300, SUBERR_NONE) -#define HTTP_MOVED_PERMANENTLY HTTP_ERROR(301, SUBERR_NONE) -#define HTTP_FOUND HTTP_ERROR(302, SUBERR_NONE) -#define HTTP_SEE_OTHER HTTP_ERROR(303, SUBERR_NONE) -#define HTTP_NOT_MODIFIED HTTP_ERROR(304, SUBERR_NONE) -#define HTTP_USE_PROXY HTTP_ERROR(305, SUBERR_NONE) -#define HTTP_TEMPORARY_REDIRECT HTTP_ERROR(307, SUBERR_NONE) - -#define HTTP_BAD_REQUEST HTTP_ERROR(400, SUBERR_NONE) -#define HTTP_UNAUTHORIZED HTTP_ERROR(401, SUBERR_NONE) -#define HTTP_PAYMENT_REQUIRED HTTP_ERROR(402, SUBERR_NONE) -#define HTTP_FORBIDDEN HTTP_ERROR(403, SUBERR_NONE) -#define HTTP_NOT_FOUND HTTP_ERROR(404, SUBERR_NONE) -#define HTTP_METHOD_NOT_ALLOWED HTTP_ERROR(405, SUBERR_NONE) -#define HTTP_NOT_ACCEPTABLE HTTP_ERROR(406, SUBERR_NONE) -#define HTTP_PROXY_AUTHENTICATION_REQUIRED HTTP_ERROR(407, SUBERR_NONE) -#define HTTP_REQUEST_TIMEOUT HTTP_ERROR(408, SUBERR_NONE) -#define HTTP_CONFLICT HTTP_ERROR(409, SUBERR_NONE) -#define HTTP_GONE HTTP_ERROR(410, SUBERR_NONE) -#define HTTP_LENGTH_REQUIRED HTTP_ERROR(411, SUBERR_NONE) -#define HTTP_PRECONDITION_FAILED HTTP_ERROR(412, SUBERR_NONE) -#define HTTP_REQUEST_ENTITY_TOO_LONG HTTP_ERROR(413, SUBERR_NONE) -#define HTTP_REQUEST_URI_TOO_LONG HTTP_ERROR(414, SUBERR_NONE) -#define HTTP_UNSUPPORTED_MEDIA_TYPE HTTP_ERROR(415, SUBERR_NONE) -#define HTTP_RANGE_NOT_SATISFIABLE HTTP_ERROR(416, SUBERR_NONE) -#define HTTP_EXPECTATION_FAILED HTTP_ERROR(417, SUBERR_NONE) - -#define HTTP_INTERNAL_SERVER_ERROR HTTP_ERROR(500, SUBERR_NONE) -#define HTTP_NOT_IMPLEMENTED HTTP_ERROR(501, SUBERR_NONE) -#define HTTP_BAD_GATEWAY HTTP_ERROR(502, SUBERR_NONE) -#define HTTP_SERVICE_UNAVAILABLE HTTP_ERROR(503, SUBERR_NONE) -#define HTTP_GATEWAY_TIMEOUT HTTP_ERROR(504, SUBERR_NONE) -#define HTTP_VERSION_NOT_SUPPORTED HTTP_ERROR(505, SUBERR_NONE) - -inline bool IsAsyncStatus(HTTP_CODE hcStatus) -{ - return - hcStatus == HTTP_SUCCESS_ASYNC || - hcStatus == HTTP_SUCCESS_ASYNC_DONE || - hcStatus == HTTP_SUCCESS_ASYNC_NOFLUSH || - hcStatus == HTTP_SUCCESS_ASYNC_NOFLUSH_DONE; -} - -inline bool IsAsyncContinueStatus(HTTP_CODE hcStatus) -{ - return - hcStatus == HTTP_SUCCESS_ASYNC || - hcStatus == HTTP_SUCCESS_ASYNC_NOFLUSH; -} - -inline bool IsAsyncDoneStatus(HTTP_CODE hcStatus) -{ - return - hcStatus == HTTP_SUCCESS_ASYNC_DONE || - hcStatus == HTTP_SUCCESS_ASYNC_NOFLUSH_DONE; -} - -inline bool IsAsyncFlushStatus(HTTP_CODE hcStatus) -{ - return - hcStatus == HTTP_SUCCESS_ASYNC || - hcStatus == HTTP_SUCCESS_ASYNC_DONE; -} - -inline bool IsAsyncNoFlushStatus(HTTP_CODE hcStatus) -{ - return - hcStatus == HTTP_SUCCESS_ASYNC_NOFLUSH || - hcStatus == HTTP_SUCCESS_ASYNC_NOFLUSH_DONE; -} - -ATL_NOINLINE inline HTTP_CODE AtlsHttpError(WORD wStatus, WORD wSubErr) throw() -{ - return HTTP_ERROR(wStatus, wSubErr); -} - -}; // namespace ATL -#pragma pack(pop) - -#endif // __ATLSERR_H__ diff --git a/include/atl/atlsession.h b/include/atl/atlsession.h deleted file mode 100644 index 808748b21..000000000 --- a/include/atl/atlsession.h +++ /dev/null @@ -1,2490 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSESSION_H__ -#define __ATLSESSION_H__ - -#pragma once -#pragma warning(push) -#pragma warning(disable: 4702) // unreachable code - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible - -#ifndef MAX_SESSION_KEY_LEN - #define MAX_SESSION_KEY_LEN 128 -#endif - -#ifndef MAX_VARIABLE_NAME_LENGTH - #define MAX_VARIABLE_NAME_LENGTH 50 -#endif - -#ifndef MAX_VARIABLE_VALUE_LENGTH - #define MAX_VARIABLE_VALUE_LENGTH 1024 -#endif - -#ifndef MAX_CONNECTION_STRING_LEN - #define MAX_CONNECTION_STRING_LEN 2048 -#endif - -#ifndef SESSION_COOKIE_NAME - #define SESSION_COOKIE_NAME "SESSIONID" -#endif - -#ifndef ATL_SESSION_TIMEOUT - #define ATL_SESSION_TIMEOUT 600000 //10 min -#endif - -#ifndef ATL_SESSION_SWEEPER_TIMEOUT - #define ATL_SESSION_SWEEPER_TIMEOUT 1000 // 1sec -#endif - -#define INVALID_DB_SESSION_POS 0x0 -#define ATL_DBSESSION_ID _T("__ATL_SESSION_DB_CONNECTION") - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -// CSessionNameGenerator -// This is a helper class that generates random data for session key -// names. This class tries to use the CryptoApi to generate random -// bytes for the session key name. If the CryptoApi isn't available -// then the CRT rand() is used to generate the random bytes. This -// class's GetNewSessionName member function is used to actually -// generate the session name. -class CSessionNameGenerator : - public CCryptProv -{ -public: - bool m_bCryptNotAvailable; - enum {MIN_SESSION_KEY_LEN=5}; - - CSessionNameGenerator() throw() : - m_bCryptNotAvailable(false) - { - // Note that the crypto api is being - // initialized with no private key - // information - HRESULT hr = InitVerifyContext(); - m_bCryptNotAvailable = FAILED(hr) ? true : false; - } - - // This function creates a new session name and base64 encodes it. - // The base64 encoding algorithm used needs at least MIN_SESSION_KEY_LEN - // bytes to work correctly. Since we stack allocate the temporary - // buffer that holds the key name, the buffer must be less than or equal to - // the MAX_SESSION_KEY_LEN in size. - HRESULT GetNewSessionName(__out_ecount_part_z(*pdwSize, *pdwSize) LPSTR szNewID, __inout DWORD *pdwSize) throw() - { - HRESULT hr = E_FAIL; - - if (!pdwSize) - return E_POINTER; - - if (*pdwSize < MIN_SESSION_KEY_LEN || - *pdwSize > MAX_SESSION_KEY_LEN) - return E_INVALIDARG; - - if (!szNewID) - return E_POINTER; - - BYTE key[MAX_SESSION_KEY_LEN] = {0x0}; - - - // calculate the number of bytes that will fit in the - // buffer we've been passed - DWORD dwDataSize = CalcMaxInputSize(*pdwSize); - - if (dwDataSize && *pdwSize >= (DWORD)(Base64EncodeGetRequiredLength(dwDataSize, - ATL_BASE64_FLAG_NOCRLF))) - { - int dwKeySize = *pdwSize; - hr = GenerateRandomName(key, dwDataSize); - if (SUCCEEDED(hr)) - { - if( Base64Encode(key, - dwDataSize, - szNewID, - &dwKeySize, - ATL_BASE64_FLAG_NOCRLF) ) - { - //null terminate - szNewID[dwKeySize]=0; - *pdwSize = dwKeySize+1; - } - else - hr = E_FAIL; - } - else - { - *pdwSize = (DWORD)(Base64EncodeGetRequiredLength(dwDataSize, - ATL_BASE64_FLAG_NOCRLF)); - return E_OUTOFMEMORY; - } - } - return hr; - } - - DWORD CalcMaxInputSize(DWORD nOutputSize) throw() - { - if (nOutputSize < (DWORD)MIN_SESSION_KEY_LEN) - return 0; - // subtract one from the output size to make room - // for the NULL terminator in the output then - // calculate the biggest number of input bytes that - // when base64 encoded will fit in a buffer of size - // nOutputSize (including base64 padding) - int nInputSize = ((nOutputSize-1)*3)/4; - int factor = ((nInputSize*4)/3)%4; - if (factor) - nInputSize -= factor; - return nInputSize; - } - - - HRESULT GenerateRandomName(BYTE *pBuff, DWORD dwBuffSize) throw() - { - if (!pBuff) - return E_POINTER; - - if (!dwBuffSize) - return E_UNEXPECTED; - - if (!m_bCryptNotAvailable && GetHandle()) - { - // Use the crypto api to generate random data. - return GenRandom(dwBuffSize, pBuff); - } - - // CryptoApi isn't available so we generate - // random data using rand. We seed the random - // number generator with a seed that is a combination - // of bytes from an arbitrary number and the system - // time which changes every millisecond so it will - // be different for every call to this function. - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - static DWORD dwVal = 0x21; - DWORD dwSeed = (dwVal++ << 0x18) | (ft.dwLowDateTime & 0x00ffff00) | dwVal++ & 0x000000ff; - srand(dwSeed); - BYTE *pCurr = pBuff; - // fill buffer with random bytes - for (int i=0; i < (int)dwBuffSize; i++) - { - *pCurr = (BYTE) (rand() & 0x000000ff); - pCurr++; - } - return S_OK; - } -}; - - -// -// CDefaultQueryClass -// returns Query strings for use in SQL queries used -// by the database persisted session service. -class CDefaultQueryClass -{ -public: - LPCTSTR GetSessionRefDelete() throw() - { - return _T("DELETE FROM SessionReferences ") - _T("WHERE SessionID=? AND RefCount <= 0 ") - _T("AND DATEDIFF(millisecond, LastAccess, getdate()) > TimeoutMs"); - } - - LPCTSTR GetSessionRefIsExpired() throw() - { - return _T("SELECT SessionID FROM SessionReferences ") - _T("WHERE (SessionID=?) AND (DATEDIFF(millisecond, LastAccess, getdate()) > TimeoutMs)"); - } - - LPCTSTR GetSessionRefDeleteFinal() throw() - { - return _T("DELETE FROM SessionReferences ") - _T("WHERE SessionID=?"); - } - - LPCTSTR GetSessionRefCreate() throw() - { - return _T("INSERT INTO SessionReferences ") - _T("(SessionID, LastAccess, RefCount, TimeoutMs) ") - _T("VALUES (?, getdate(), 1, ?)"); - } - - LPCTSTR GetSessionRefUpdateTimeout() throw() - { - return _T("UPDATE SessionReferences ") - _T("SET TimeoutMs=? WHERE SessionID=?"); - } - - LPCTSTR GetSessionRefAddRef() throw() - { - return _T("UPDATE SessionReferences ") - _T("SET RefCount=RefCount+1, ") - _T("LastAccess=getdate() ") - _T("WHERE SessionID=?"); - } - - LPCTSTR GetSessionRefRemoveRef() throw() - { - return _T("UPDATE SessionReferences ") - _T("SET RefCount=RefCount-1, ") - _T("LastAccess=getdate() ") - _T("WHERE SessionID=?"); - } - - LPCTSTR GetSessionRefAccess() throw() - { - return _T("UPDATE SessionReferences ") - _T("SET LastAccess=getdate() ") - _T("WHERE SessionID=?"); - } - - LPCTSTR GetSessionRefSelect() throw() - { - return _T("SELECT * FROM SessionReferences ") - _T("WHERE SessionID=?"); - } - - LPCTSTR GetSessionRefGetCount() throw() - { - return _T("SELECT COUNT(*) FROM SessionReferences"); - } - - - LPCTSTR GetSessionVarCount() throw() - { - return _T("SELECT COUNT(*) FROM SessionVariables WHERE SessionID=?"); - } - - LPCTSTR GetSessionVarInsert() throw() - { - return _T("INSERT INTO SessionVariables ") - _T("(VariableValue, SessionID, VariableName) ") - _T("VALUES (?, ?, ?)"); - } - - LPCTSTR GetSessionVarUpdate() throw() - { - return _T("UPDATE SessionVariables ") - _T("SET VariableValue=? ") - _T("WHERE SessionID=? AND VariableName=?"); - } - - LPCTSTR GetSessionVarDeleteVar() throw() - { - return _T("DELETE FROM SessionVariables ") - _T("WHERE SessionID=? AND VariableName=?"); - } - - LPCTSTR GetSessionVarDeleteAllVars() throw() - { - return _T("DELETE FROM SessionVariables WHERE (SessionID=?)"); - } - - LPCTSTR GetSessionVarSelectVar()throw() - { - return _T("SELECT SessionID, VariableName, VariableValue ") - _T("FROM SessionVariables ") - _T("WHERE SessionID=? AND VariableName=?"); - } - - LPCTSTR GetSessionVarSelectAllVars() throw() - { - return _T("SELECT SessionID, VariableName, VariableValue ") - _T("FROM SessionVariables ") - _T("WHERE SessionID=?"); - } - - LPCTSTR GetSessionReferencesSet() throw() - { - return _T("UPDATE SessionReferences SET TimeoutMs=?"); - } -}; - - -// Contains the data for the session variable accessors -class CSessionDataBase -{ -public: - TCHAR m_szSessionID[MAX_SESSION_KEY_LEN]; - TCHAR m_VariableName[MAX_VARIABLE_NAME_LENGTH]; - BYTE m_VariableValue[MAX_VARIABLE_VALUE_LENGTH]; - DBLENGTH m_VariableLen; - CSessionDataBase() throw() - { - m_szSessionID[0] = '\0'; - m_VariableName[0] = '\0'; - m_VariableValue[0] = '\0'; - m_VariableLen = 0; - } - HRESULT Assign(LPCTSTR szSessionID, LPCTSTR szVarName, VARIANT *pVal) throw() - { - HRESULT hr = S_OK; - CVariantStream stream; - if ( szSessionID ) - { - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN)< MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_szSessionID, _countof(m_szSessionID), szSessionID); - else - hr = E_OUTOFMEMORY; - } - else - return E_INVALIDARG; - - if (hr == S_OK && szVarName) - if (Checked::tcsnlen(szVarName, MAX_VARIABLE_NAME_LENGTH) < MAX_VARIABLE_NAME_LENGTH) - Checked::tcscpy_s(m_VariableName, _countof(m_VariableName), szVarName); - else - hr = E_OUTOFMEMORY; - - if (hr == S_OK && pVal) - { - hr = stream.InsertVariant(pVal); - if (hr == S_OK) - { - BYTE *pBytes = stream.m_stream; - size_t size = stream.GetVariantSize(); - if (pBytes && size && size < MAX_VARIABLE_VALUE_LENGTH) - { - Checked::memcpy_s(m_VariableValue, MAX_VARIABLE_VALUE_LENGTH, pBytes, size); - m_VariableLen = static_cast(size); - } - else - hr = E_INVALIDARG; - } - } - - return hr; - } -}; - -// Use to select a session variable given the name -// of a session and the name of a variable. -class CSessionDataSelector : public CSessionDataBase -{ -public: - BEGIN_COLUMN_MAP(CSessionDataSelector) - COLUMN_ENTRY(1, m_szSessionID) - COLUMN_ENTRY(2, m_VariableName) - COLUMN_ENTRY_LENGTH(3, m_VariableValue, m_VariableLen) - END_COLUMN_MAP() - BEGIN_PARAM_MAP(CSessionDataSelector) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_szSessionID) - COLUMN_ENTRY(2, m_VariableName) - END_PARAM_MAP() -}; - -// Use to select all session variables given the name of -// of a session. -class CAllSessionDataSelector : public CSessionDataBase -{ -public: - BEGIN_COLUMN_MAP(CAllSessionDataSelector) - COLUMN_ENTRY(1, m_szSessionID) - COLUMN_ENTRY(2, m_VariableName) - COLUMN_ENTRY_LENGTH(3, m_VariableValue, m_VariableLen) - END_COLUMN_MAP() - BEGIN_PARAM_MAP(CAllSessionDataSelector) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_szSessionID) - END_PARAM_MAP() -}; - -// Use to update the value of a session variable -class CSessionDataUpdator : public CSessionDataBase -{ -public: - BEGIN_PARAM_MAP(CSessionDataUpdator) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY_LENGTH(1, m_VariableValue, m_VariableLen) - COLUMN_ENTRY(2, m_szSessionID) - COLUMN_ENTRY(3, m_VariableName) - END_PARAM_MAP() -}; - -// Use to delete a session variable given the -// session name and the name of the variable -class CSessionDataDeletor -{ -public: - CSessionDataDeletor() - { - m_szSessionID[0] = '\0'; - m_VariableName[0] = '\0'; - } - - TCHAR m_szSessionID[MAX_SESSION_KEY_LEN]; - TCHAR m_VariableName[MAX_VARIABLE_NAME_LENGTH]; - HRESULT Assign(LPCTSTR szSessionID, LPCTSTR szVarName) throw() - { - if (szSessionID) - { - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_szSessionID, _countof(m_szSessionID), szSessionID); - else - return E_OUTOFMEMORY; - } - - if (szVarName) - { - if(Checked::tcsnlen(szVarName, MAX_VARIABLE_NAME_LENGTH) < MAX_VARIABLE_NAME_LENGTH) - Checked::tcscpy_s(m_VariableName, _countof(m_VariableName), szVarName); - else - return E_OUTOFMEMORY; - } - return S_OK; - } - - BEGIN_PARAM_MAP(CSessionDataDeletor) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_szSessionID) - COLUMN_ENTRY(2, m_VariableName) - END_PARAM_MAP() -}; - -class CSessionDataDeleteAll -{ -public: - TCHAR m_szSessionID[MAX_SESSION_KEY_LEN]; - HRESULT Assign(LPCTSTR szSessionID) throw() - { - if (!szSessionID) - return E_INVALIDARG; - - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_szSessionID, _countof(m_szSessionID), szSessionID); - else - return E_OUTOFMEMORY; - - return S_OK; - } - - BEGIN_PARAM_MAP(CSessionDataDeleteAll) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_szSessionID) - END_PARAM_MAP() -}; - -// Used for retrieving the count of session variables for -// a given session ID. -class CCountAccessor -{ -public: - LONG m_nCount; - TCHAR m_szSessionID[MAX_SESSION_KEY_LEN]; - CCountAccessor() throw() - { - m_szSessionID[0] = '\0'; - m_nCount = 0; - } - - HRESULT Assign(LPCTSTR szSessionID) throw() - { - if (!szSessionID) - return E_INVALIDARG; - - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_szSessionID, _countof(m_szSessionID), szSessionID); - else - return E_OUTOFMEMORY; - - return S_OK; - } - - BEGIN_COLUMN_MAP(CCountAccessor) - COLUMN_ENTRY(1, m_nCount) - END_COLUMN_MAP() - BEGIN_PARAM_MAP(CCountAccessor) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_szSessionID) - END_PARAM_MAP() -}; - - -// Used for updating entries in the session -// references table, given a session ID -class CSessionRefUpdator -{ -public: - TCHAR m_SessionID[MAX_SESSION_KEY_LEN]; - HRESULT Assign(LPCTSTR szSessionID) throw() - { - if (!szSessionID) - return E_INVALIDARG; - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_SessionID, _countof(m_SessionID), szSessionID); - else - return E_OUTOFMEMORY; - return S_OK; - } - BEGIN_PARAM_MAP(CSessionRefUpdator) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_SessionID) - END_PARAM_MAP() -}; - -class CSessionRefIsExpired -{ -public: - TCHAR m_SessionID[MAX_SESSION_KEY_LEN]; - TCHAR m_SessionIDOut[MAX_SESSION_KEY_LEN]; - HRESULT Assign(LPCTSTR szSessionID) throw() - { - m_SessionIDOut[0]=0; - if (!szSessionID) - return E_INVALIDARG; - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_SessionID, _countof(m_SessionID), szSessionID); - else - return E_OUTOFMEMORY; - return S_OK; - } - BEGIN_COLUMN_MAP(CSessionRefIsExpired) - COLUMN_ENTRY(1, m_SessionIDOut) - END_COLUMN_MAP() - BEGIN_PARAM_MAP(CSessionRefIsExpired) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_SessionID) - END_PARAM_MAP() -}; - -class CSetAllTimeouts -{ -public: - unsigned __int64 m_dwNewTimeout; - HRESULT Assign(unsigned __int64 dwNewValue) - { - m_dwNewTimeout = dwNewValue; - return S_OK; - } - BEGIN_PARAM_MAP(CSetAllTimeouts) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_dwNewTimeout) - END_PARAM_MAP() -}; - -class CSessionRefUpdateTimeout -{ -public: - TCHAR m_SessionID[MAX_SESSION_KEY_LEN]; - unsigned __int64 m_nNewTimeout; - HRESULT Assign(LPCTSTR szSessionID, unsigned __int64 nNewTimeout) throw() - { - if (!szSessionID) - return E_INVALIDARG; - - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_SessionID, _countof(m_SessionID), szSessionID); - else - return E_OUTOFMEMORY; - - m_nNewTimeout = nNewTimeout; - - return S_OK; - } - - BEGIN_PARAM_MAP(CSessionRefUpdateTimeout) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_nNewTimeout) - COLUMN_ENTRY(2, m_SessionID) - END_PARAM_MAP() -}; - -class CSessionRefSelector -{ -public: - TCHAR m_SessionID[MAX_SESSION_KEY_LEN]; - int m_RefCount; - HRESULT Assign(LPCTSTR szSessionID) throw() - { - if (!szSessionID) - return E_INVALIDARG; - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_SessionID, _countof(m_SessionID), szSessionID); - else - return E_OUTOFMEMORY; - return S_OK; - } - BEGIN_COLUMN_MAP(CSessionRefSelector) - COLUMN_ENTRY(1, m_SessionID) - COLUMN_ENTRY(3, m_RefCount) - END_COLUMN_MAP() - BEGIN_PARAM_MAP(CSessionRefSelector) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_SessionID) - END_PARAM_MAP() -}; - -class CSessionRefCount -{ -public: - LONG m_nCount; - BEGIN_COLUMN_MAP(CSessionRefCount) - COLUMN_ENTRY(1, m_nCount) - END_COLUMN_MAP() -}; - -// Used for creating new entries in the session -// references table. -class CSessionRefCreator -{ -public: - TCHAR m_SessionID[MAX_SESSION_KEY_LEN]; - unsigned __int64 m_TimeoutMs; - HRESULT Assign(LPCTSTR szSessionID, unsigned __int64 timeout) throw() - { - if (!szSessionID) - return E_INVALIDARG; - if (Checked::tcsnlen(szSessionID, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - { - Checked::tcscpy_s(m_SessionID, _countof(m_SessionID), szSessionID); - m_TimeoutMs = timeout; - } - else - return E_OUTOFMEMORY; - return S_OK; - } - BEGIN_PARAM_MAP(CSessionRefCreator) - SET_PARAM_TYPE(DBPARAMIO_INPUT) - COLUMN_ENTRY(1, m_SessionID) - COLUMN_ENTRY(2, m_TimeoutMs) - END_PARAM_MAP() -}; - - -// CDBSession -// This session persistance class persists session variables to -// an OLEDB datasource. The following table gives a general description -// of the table schema for the tables this class uses. -// -// TableName: SessionVariables -// Column Name Type Description -// 1 SessionID char[MAX_SESSION_KEY_LEN] Session Key name -// 2 VariableName char[MAX_VARIABLE_NAME_LENGTH] Variable Name -// 3 VariableValue varbinary[MAX_VARIABLE_VALUE_LENGTH] Variable Value - -// -// TableName: SessionReferences -// Column Name Type Description -// 1 SessionID char[MAX_SESSION_KEY_LEN] Session Key Name. -// 2 LastAccess datetime Date and time of last access to this session. -// 3 RefCount int Current references on this session. -// 4 TimeoutMS int Timeout value for the session in milli seconds - -typedef bool (*PFN_GETPROVIDERINFO)(DWORD_PTR, wchar_t **); - -template -class CDBSession: - public ISession, - public CComObjectRootEx - -{ - typedef CCommand > iterator_accessor; -public: - typedef QueryClass DBQUERYCLASS_TYPE; - BEGIN_COM_MAP(CDBSession) - COM_INTERFACE_ENTRY(ISession) - END_COM_MAP() - - CDBSession() throw(): - m_dwTimeout(ATL_SESSION_TIMEOUT) - { - m_szSessionName[0] = '\0'; - } - - ~CDBSession() throw() - { - } - - void FinalRelease()throw() - { - SessionUnlock(); - } - - STDMETHOD(SetVariable)(LPCSTR szName, VARIANT Val) throw() - { - HRESULT hr = E_FAIL; - if (!szName) - return E_INVALIDARG; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // Update the last access time for this session - hr = Access(); - if (hr != S_OK) - return hr; - - // Allocate an updator command and fill out it's input parameters. - CCommand > command; - _ATLTRY - { - CA2CT name(szName); - hr = command.Assign(m_szSessionName, name, &Val); - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - if (hr != S_OK) - return hr; - - // Try an update. Update will fail if the variable is not already there. - DBROWCOUNT nRows = 0; - - hr = command.Open(dataconn, - m_QueryObj.GetSessionVarUpdate(), - NULL, &nRows, DBGUID_DEFAULT, false); - if (hr == S_OK && nRows <= 0) - hr = E_UNEXPECTED; - if (hr != S_OK) - { - // Try an insert - hr = command.Open(dataconn, m_QueryObj.GetSessionVarInsert(), NULL, &nRows, DBGUID_DEFAULT, false); - if (hr == S_OK && nRows <=0) - hr = E_UNEXPECTED; - } - - return hr; - } - - // Warning: For string data types, depending on the configuration of - // your database, strings might be returned with trailing white space. - STDMETHOD(GetVariable)(LPCSTR szName, VARIANT *pVal) throw() - { - HRESULT hr = E_FAIL; - if (!szName) - return E_INVALIDARG; - if (pVal) - VariantInit(pVal); - else - return E_POINTER; - - // Get the data connection for this thread - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // Update the last access time for this session - hr = Access(); - if (hr != S_OK) - return hr; - - // Allocate a command a fill out it's input parameters. - CCommand > command; - _ATLTRY - { - CA2CT name(szName); - hr = command.Assign(m_szSessionName, name, NULL); - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - - if (hr == S_OK) - { - hr = command.Open(dataconn, m_QueryObj.GetSessionVarSelectVar()); - if (SUCCEEDED(hr)) - { - if ( S_OK == (hr = command.MoveFirst())) - { - CStreamOnByteArray stream(command.m_VariableValue); - CComVariant vOut; - hr = vOut.ReadFromStream(static_cast(&stream)); - if (hr == S_OK) - hr = vOut.Detach(pVal); - } - } - } - return hr; - } - - STDMETHOD(RemoveVariable)(LPCSTR szName) throw() - { - HRESULT hr = E_FAIL; - if (!szName) - return E_INVALIDARG; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // update the last access time for this session - hr = Access(); - if (hr != S_OK) - return hr; - - // allocate a command and set it's input parameters - CCommand > command; - _ATLTRY - { - CA2CT name(szName); - hr = command.Assign(m_szSessionName, name); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - // execute the command - DBROWCOUNT nRows = 0; - if (hr == S_OK) - hr = command.Open(dataconn, m_QueryObj.GetSessionVarDeleteVar(), - NULL, &nRows, DBGUID_DEFAULT, false); - if (hr == S_OK && nRows <= 0) - hr = E_FAIL; - return hr; - } - - // Gives the count of rows in the table for this session ID. - STDMETHOD(GetCount)(long *pnCount) throw() - { - HRESULT hr = S_OK; - if (pnCount) - *pnCount = 0; - else - return E_POINTER; - - // Get the database connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - hr = Access(); - if (hr != S_OK) - return hr; - CCommand > command; - - hr = command.Assign(m_szSessionName); - if (hr == S_OK) - { - hr = command.Open(dataconn, m_QueryObj.GetSessionVarCount()); - if (hr == S_OK) - { - if (S_OK == (hr = command.MoveFirst())) - { - *pnCount = command.m_nCount; - hr = S_OK; - } - } - } - return hr; - } - - STDMETHOD(RemoveAllVariables)() throw() - { - HRESULT hr = E_UNEXPECTED; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - CCommand > command; - hr = command.Assign(m_szSessionName); - if (hr != S_OK) - return hr; - - // delete all session variables - hr = command.Open(dataconn, m_QueryObj.GetSessionVarDeleteAllVars(), NULL, NULL, DBGUID_DEFAULT, false); - return hr; - } - - // Iteration of variables works by taking a snapshot - // of the sessions at the point in time BeginVariableEnum - // is called, and then keeping an index variable that you use to - // move through the snapshot rowset. It is important to know - // that the handle returned in phEnum is not thread safe. It - // should only be used by the calling thread. - STDMETHOD(BeginVariableEnum)(POSITION *pPOS, HSESSIONENUM *phEnum) throw() - { - HRESULT hr = E_FAIL; - if (!pPOS) - return E_POINTER; - - if (phEnum) - *phEnum = NULL; - else - return E_POINTER; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // Update the last access time for this session. - hr = Access(); - if (hr != S_OK) - return hr; - - // Allocate a new iterator accessor and initialize it's input parameters. - iterator_accessor *pIteratorAccessor = NULL; - ATLTRYALLOC(pIteratorAccessor = new iterator_accessor); - if (!pIteratorAccessor) - return E_OUTOFMEMORY; - - hr = pIteratorAccessor->Assign(m_szSessionName, NULL, NULL); - if (hr == S_OK) - { - // execute the command and move to the first row of the recordset. - hr = pIteratorAccessor->Open(dataconn, - m_QueryObj.GetSessionVarSelectAllVars()); - if (hr == S_OK) - { - hr = pIteratorAccessor->MoveFirst(); - if (hr == S_OK) - { - *pPOS = (POSITION) INVALID_DB_SESSION_POS + 1; - *phEnum = reinterpret_cast(pIteratorAccessor); - } - } - - if (hr != S_OK) - { - *pPOS = INVALID_DB_SESSION_POS; - *phEnum = NULL; - delete pIteratorAccessor; - } - } - return hr; - } - - // The values for hEnum and pPos must have been initialized in a previous - // call to BeginVariableEnum. On success, the out variant will hold the next - // variable - STDMETHOD(GetNextVariable)(POSITION *pPOS, VARIANT *pVal, HSESSIONENUM hEnum, LPSTR szName=NULL, DWORD dwLen=0) throw() - { - if (!pPOS) - return E_INVALIDARG; - - if (pVal) - VariantInit(pVal); - else - return E_POINTER; - - if (!hEnum) - return E_UNEXPECTED; - - if (*pPOS <= INVALID_DB_SESSION_POS) - return E_UNEXPECTED; - - iterator_accessor *pIteratorAccessor = reinterpret_cast(hEnum); - - // update the last access time. - HRESULT hr = Access(); - - POSITION posCurrent = *pPOS; - - if (szName) - { - // caller wants entry name - _ATLTRY - { - CT2CA szVarName(pIteratorAccessor->m_VariableName); - if (szVarName != NULL && dwLen > Checked::strnlen(szVarName, dwLen)) - { - Checked::strcpy_s(szName, dwLen, szVarName); - } - else - hr = E_OUTOFMEMORY; // buffer not big enough - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - - } - - if (hr == S_OK) - { - CStreamOnByteArray stream(pIteratorAccessor->m_VariableValue); - CComVariant vOut; - hr = vOut.ReadFromStream(static_cast(&stream)); - if (hr == S_OK) - vOut.Detach(pVal); - else - return hr; - } - else - return hr; - - hr = pIteratorAccessor->MoveNext(); - *pPOS = ++posCurrent; - - if (hr == DB_S_ENDOFROWSET) - { - // We're done iterating, reset everything - *pPOS = INVALID_DB_SESSION_POS; - hr = S_OK; - } - - if (hr != S_OK) - { - VariantClear(pVal); - } - return hr; - } - - // CloseEnum frees up any resources allocated by the iterator - STDMETHOD(CloseEnum)(HSESSIONENUM hEnum) throw() - { - iterator_accessor *pIteratorAccessor = reinterpret_cast(hEnum); - if (!pIteratorAccessor) - return E_INVALIDARG; - pIteratorAccessor->Close(); - delete pIteratorAccessor; - return S_OK; - } - - // - // Returns S_FALSE if it's not expired - // S_OK if it is expired and an error HRESULT - // if an error occurred. - STDMETHOD(IsExpired)() throw() - { - HRESULT hrRet = S_FALSE; - HRESULT hr = E_UNEXPECTED; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - CCommand > command; - hr = command.Assign(m_szSessionName); - if (hr != S_OK) - return hr; - - hr = command.Open(dataconn, m_QueryObj.GetSessionRefIsExpired(), - NULL, NULL, DBGUID_DEFAULT, true); - if (hr == S_OK) - { - if (S_OK == command.MoveFirst()) - { - if (!_tcscmp(command.m_SessionIDOut, m_szSessionName)) - hrRet = S_OK; - } - } - - if (hr == S_OK) - return hrRet; - return hr; - } - - STDMETHOD(SetTimeout)(unsigned __int64 dwNewTimeout) throw() - { - HRESULT hr = E_UNEXPECTED; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // allocate a command and set it's input parameters - CCommand > command; - hr = command.Assign(m_szSessionName, dwNewTimeout); - if (hr != S_OK) - return hr; - - hr = command.Open(dataconn, m_QueryObj.GetSessionRefUpdateTimeout(), - NULL, NULL, DBGUID_DEFAULT, false); - - return hr; - } - - // SessionLock increments the session reference count for this session. - // If there is not a session by this name in the session references table, - // a new session entry is created in the the table. - HRESULT SessionLock() throw() - { - HRESULT hr = E_UNEXPECTED; - if (!m_szSessionName || m_szSessionName[0]==0) - return hr; // no session to lock. - - // retrieve the data connection for this thread - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // first try to update a session with this name - DBROWCOUNT nRows = 0; - CCommand > updator; - if (S_OK == updator.Assign(m_szSessionName)) - { - if (S_OK != (hr = updator.Open(dataconn, m_QueryObj.GetSessionRefAddRef(), - NULL, &nRows, DBGUID_DEFAULT, false)) || - nRows == 0) - { - // No session to update. Use the creator accessor - // to create a new session reference. - CCommand > creator; - hr = creator.Assign(m_szSessionName, m_dwTimeout); - if (hr == S_OK) - hr = creator.Open(dataconn, m_QueryObj.GetSessionRefCreate(), - NULL, &nRows, DBGUID_DEFAULT, false); - } - } - - // We should have been able to create or update a session. - ATLASSERT(nRows > 0); - if (hr == S_OK && nRows <= 0) - hr = E_UNEXPECTED; - - return hr; - } - - // SessionUnlock decrements the session RefCount for this session. - // Sessions cannot be removed from the database unless the session - // refcount is 0 - HRESULT SessionUnlock() throw() - { - HRESULT hr = E_UNEXPECTED; - if (!m_szSessionName || - m_szSessionName[0]==0) - return hr; - - // get the data connection for this thread - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // The session must exist at this point in order to unlock it - // so we can just use the session updator here. - DBROWCOUNT nRows = 0; - CCommand > updator; - hr = updator.Assign(m_szSessionName); - if (hr == S_OK) - { - hr = updator.Open( dataconn, - m_QueryObj.GetSessionRefRemoveRef(), - NULL, - &nRows, - DBGUID_DEFAULT, - false); - } - if (hr != S_OK) - return hr; - - // delete the session from the database if - // nobody else is using it and it's expired. - hr = FreeSession(); - return hr; - } - - // Access updates the last access time for the session. The access - // time for sessions is updated using the SQL GETDATE function on the - // database server so that all clients will be using the same clock - // to compare access times against. - HRESULT Access() throw() - { - HRESULT hr = E_UNEXPECTED; - - if (!m_szSessionName || - m_szSessionName[0]==0) - return hr; // no session to access - - // get the data connection for this thread - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // The session reference entry in the references table must - // be created prior to calling this function so we can just - // use an updator to update the current entry. - CCommand > updator; - - DBROWCOUNT nRows = 0; - hr = updator.Assign(m_szSessionName); - if (hr == S_OK) - { - hr = updator.Open( dataconn, - m_QueryObj.GetSessionRefAccess(), - NULL, - &nRows, - DBGUID_DEFAULT, - false); - } - - ATLASSERT(nRows > 0); - if (hr == S_OK && nRows <= 0) - hr = E_UNEXPECTED; - return hr; - } - - // If the session is expired and it's reference is 0, - // it can be deleted. SessionUnlock calls this function to - // unlock the session and delete it after we release a session - // lock. Note that our SQL command will only delete the session - // if it is expired and it's refcount is <= 0 - HRESULT FreeSession() throw() - { - HRESULT hr = E_UNEXPECTED; - if (!m_szSessionName || - m_szSessionName[0]==0) - return hr; - - // Get the data connection for this thread. - CDataConnection dataconn; - hr = GetSessionConnection(&dataconn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - CCommand > updator; - - // The SQL for this command only deletes the - // session reference from the references table if it's access - // count is 0 and it has expired. - return updator.Open(dataconn, - m_QueryObj.GetSessionRefDelete(), - NULL, - NULL, - DBGUID_DEFAULT, - false); - } - - // Initialize is called each time a new session is created. - HRESULT Initialize( LPCSTR szSessionName, - IServiceProvider *pServiceProvider, - DWORD_PTR dwCookie, - PFN_GETPROVIDERINFO pfnInfo) throw() - { - if (!szSessionName) - return E_INVALIDARG; - - if (!pServiceProvider) - return E_INVALIDARG; - - if (!pfnInfo) - return E_INVALIDARG; - - m_pfnInfo = pfnInfo; - m_dwProvCookie = dwCookie; - m_spServiceProvider = pServiceProvider; - - _ATLTRY - { - CA2CT tcsSessionName(szSessionName); - if (Checked::tcsnlen(tcsSessionName, MAX_SESSION_KEY_LEN) < MAX_SESSION_KEY_LEN) - Checked::tcscpy_s(m_szSessionName, _countof(m_szSessionName), tcsSessionName); - else - return E_OUTOFMEMORY; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - return SessionLock(); - } - - HRESULT GetSessionConnection(CDataConnection *pConn, - IServiceProvider *pProv) throw() - { - if (!pProv) - return E_INVALIDARG; - - if (!m_pfnInfo || - !m_dwProvCookie) - return E_UNEXPECTED; - - wchar_t *wszProv = NULL; - if (m_pfnInfo(m_dwProvCookie, &wszProv) && wszProv!=NULL) - { - return GetDataSource(pProv, - ATL_DBSESSION_ID, - wszProv, - pConn); - } - return E_FAIL; - } - - -protected: - TCHAR m_szSessionName[MAX_SESSION_KEY_LEN]; - unsigned __int64 m_dwTimeout; - CComPtr m_spServiceProvider; - DWORD_PTR m_dwProvCookie; - PFN_GETPROVIDERINFO m_pfnInfo; - DBQUERYCLASS_TYPE m_QueryObj; -}; // CDBSession - - -template > -class CDBSessionServiceImplT -{ - wchar_t m_szConnectionString[MAX_CONNECTION_STRING_LEN]; - CComPtr m_spServiceProvider; - typename TDBSession::DBQUERYCLASS_TYPE m_QueryObj; -public: - typedef const wchar_t* SERVICEIMPL_INITPARAM_TYPE; - CDBSessionServiceImplT() throw() - { - m_dwTimeout = ATL_SESSION_TIMEOUT; - m_szConnectionString[0] = '\0'; - } - - static bool GetProviderInfo(DWORD_PTR dwProvCookie, wchar_t **ppszProvInfo) throw() - { - if (dwProvCookie && - ppszProvInfo) - { - CDBSessionServiceImplT *pSvc = - reinterpret_cast*>(dwProvCookie); - *ppszProvInfo = pSvc->m_szConnectionString; - return true; - } - return false; - } - - HRESULT GetSessionConnection(CDataConnection *pConn, - IServiceProvider *pProv) throw() - { - if (!pProv) - return E_INVALIDARG; - - if(!m_szConnectionString[0]) - return E_UNEXPECTED; - - return GetDataSource(pProv, - ATL_DBSESSION_ID, - m_szConnectionString, - pConn); - } - - HRESULT Initialize(SERVICEIMPL_INITPARAM_TYPE pData, - IServiceProvider *pProvider, - unsigned __int64 dwInitialTimeout) throw() - { - if (!pData || !pProvider) - return E_INVALIDARG; - - if (Checked::wcsnlen(pData, MAX_CONNECTION_STRING_LEN) < MAX_CONNECTION_STRING_LEN) - { - Checked::wcscpy_s(m_szConnectionString, _countof(m_szConnectionString), pData); - } - else - return E_OUTOFMEMORY; - - m_dwTimeout = dwInitialTimeout; - m_spServiceProvider = pProvider; - return S_OK; - } - - HRESULT CreateNewSession(__out_ecount_part_z(*pdwSize, *pdwSize) LPSTR szNewID, __inout DWORD *pdwSize, __deref_out ISession** ppSession) throw() - { - HRESULT hr = E_FAIL; - CComObject *pNewSession = NULL; - - if (!pdwSize) - return E_POINTER; - - if (ppSession) - *ppSession = NULL; - else - return E_POINTER; - - if (szNewID) - *szNewID = NULL; - else - return E_INVALIDARG; - - - // Create new session - CComObject::CreateInstance(&pNewSession); - if (pNewSession == NULL) - return E_OUTOFMEMORY; - - // Create a session name and initialize the object - hr = m_SessionNameGenerator.GetNewSessionName(szNewID, pdwSize); - if (hr == S_OK) - { - hr = pNewSession->Initialize(szNewID, - m_spServiceProvider, - reinterpret_cast(this), - GetProviderInfo); - if (hr == S_OK) - { - // we don't hold a reference to the object - hr = pNewSession->QueryInterface(ppSession); - } - } - - if (hr != S_OK) - delete pNewSession; - return hr; - } - - HRESULT CreateNewSessionByName(__in_z LPSTR szNewID, __deref_out ISession** ppSession) throw() - { - HRESULT hr = E_FAIL; - CComObject *pNewSession = NULL; - - if (!szNewID || *szNewID == 0) - return E_INVALIDARG; - - if (ppSession) - *ppSession = NULL; - else - return E_POINTER; - - // Create new session - CComObject::CreateInstance(&pNewSession); - if (pNewSession == NULL) - return E_OUTOFMEMORY; - - hr = pNewSession->Initialize(szNewID, - m_spServiceProvider, - reinterpret_cast(this), - GetProviderInfo); - if (hr == S_OK) - { - // we don't hold a reference to the object - hr = pNewSession->QueryInterface(ppSession); - } - - - if (hr != S_OK) - delete pNewSession; - return hr; - } - - - HRESULT GetSession(LPCSTR szID, ISession **ppSession) throw() - { - HRESULT hr = E_FAIL; - if (!szID) - return E_INVALIDARG; - - if (ppSession) - *ppSession = NULL; - else - return E_POINTER; - - CComObject *pNewSession = NULL; - - // Check the DB to see if the session ID is a valid session - _ATLTRY - { - CA2CT session(szID); - hr = IsValidSession(session); - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - if (hr == S_OK) - { - // Create new session object to represent this session - CComObject::CreateInstance(&pNewSession); - if (pNewSession == NULL) - return E_OUTOFMEMORY; - - hr = pNewSession->Initialize(szID, - m_spServiceProvider, - reinterpret_cast(this), - GetProviderInfo); - if (hr == S_OK) - { - // we don't hold a reference to the object - hr = pNewSession->QueryInterface(ppSession); - } - } - - if (hr != S_OK && pNewSession) - delete pNewSession; - return hr; - } - - HRESULT CloseSession(LPCSTR szID) throw() - { - if (!szID) - return E_INVALIDARG; - - CDataConnection conn; - HRESULT hr = GetSessionConnection(&conn, - m_spServiceProvider); - if (hr != S_OK) - return hr; - - // set up accessors - CCommand > updator; - CCommand > command; - _ATLTRY - { - CA2CT session(szID); - hr = updator.Assign(session); - if (hr == S_OK) - hr = command.Assign(session); - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - - if (hr == S_OK) - { - // delete all session variables (may not be any!) - hr = command.Open(conn, - m_QueryObj.GetSessionVarDeleteAllVars(), - NULL, - NULL, - DBGUID_DEFAULT, - false); - if (hr == S_OK) - { - DBROWCOUNT nRows = 0; - nRows = 0; - // delete references in the session references table - hr = updator.Open(conn, - m_QueryObj.GetSessionRefDeleteFinal(), - NULL, - &nRows, - DBGUID_DEFAULT, - false); - if (nRows == 0) - hr = E_UNEXPECTED; - } - } - return hr; - } - - HRESULT SetSessionTimeout(unsigned __int64 nTimeout) throw() - { - // Get the data connection for this thread - CDataConnection conn; - - HRESULT hr = GetSessionConnection(&conn, m_spServiceProvider); - if (hr != S_OK) - return hr; - - // all sessions get the same timeout - CCommand > command; - hr = command.Assign(nTimeout); - if (hr == S_OK) - { - hr = command.Open(conn, m_QueryObj.GetSessionReferencesSet(), - NULL, - NULL, - DBGUID_DEFAULT, - false); - if (hr == S_OK) - { - m_dwTimeout = nTimeout; - } - } - return hr; - } - - - HRESULT GetSessionTimeout(unsigned __int64* pnTimeout) throw() - { - if (pnTimeout) - *pnTimeout = m_dwTimeout; - else - return E_INVALIDARG; - - return S_OK; - } - - HRESULT GetSessionCount(DWORD *pnCount) throw() - { - if (pnCount) - *pnCount = 0; - else - return E_POINTER; - - CCommand > command; - CDataConnection conn; - HRESULT hr = GetSessionConnection(&conn, - m_spServiceProvider); - if (hr != S_OK) - return hr; - - hr = command.Open(conn, - m_QueryObj.GetSessionRefGetCount()); - if (hr == S_OK) - { - hr = command.MoveFirst(); - if (hr == S_OK) - { - *pnCount = (DWORD)command.m_nCount; - } - } - - return hr; - } - - void ReleaseAllSessions() throw() - { - // nothing to do - } - - void SweepSessions() throw() - { - // nothing to do - } - - - // Helpers - HRESULT IsValidSession(LPCTSTR szID) throw() - { - if (!szID) - return E_INVALIDARG; - // Look in the sessionreferences table to see if there is an entry - // for this session. - if (m_szConnectionString[0] == 0) - return E_UNEXPECTED; - - CDataConnection conn; - HRESULT hr = GetSessionConnection(&conn, - m_spServiceProvider); - if (hr != S_OK) - return hr; - - // Check the session references table to see if - // this is a valid session - CCommand > selector; - hr = selector.Assign(szID); - if (hr != S_OK) - return hr; - - hr = selector.Open(conn, - m_QueryObj.GetSessionRefSelect(), - NULL, - NULL, - DBGUID_DEFAULT, - true); - if (hr == S_OK) - return selector.MoveFirst(); - return hr; - } - - CSessionNameGenerator m_SessionNameGenerator; // Object for generating session names - unsigned __int64 m_dwTimeout; -}; // CDBSessionServiceImplT - -typedef CDBSessionServiceImplT<> CDBSessionServiceImpl; - - - - - -////////////////////////////////////////////////////////////////// -// -// In-memory persisted session -// -////////////////////////////////////////////////////////////////// - -// In-memory persisted session service keeps a pointer -// to the session obejct around in memory. The pointer is -// contained in a CComPtr, which is stored in a CAtlMap, so -// we have to have a CElementTraits class for that. -typedef CComPtr SESSIONPTRTYPE; - -template<> -class CElementTraits : - public CElementTraitsBase -{ -public: - static ULONG Hash( INARGTYPE obj ) throw() - { - return( (ULONG)(ULONG_PTR)obj.p); - } - - static BOOL CompareElements( OUTARGTYPE element1, OUTARGTYPE element2 ) throw() - { - return element1.IsEqualObject(element2.p) ? TRUE : FALSE; - } - - static int CompareElementsOrdered( INARGTYPE , INARGTYPE ) throw() - { - ATLASSERT(0); // NOT IMPLEMENTED - return 0; - } -}; - - -// CMemSession -// This session persistance class persists session variables in memory. -// Note that this type of persistance should only be used on single server -// web sites. -class CMemSession : - public ISession, - public CComObjectRootEx -{ -public: - BEGIN_COM_MAP(CMemSession) - COM_INTERFACE_ENTRY(ISession) - END_COM_MAP() - - CMemSession() throw(...) - { - } - virtual ~CMemSession() - { - } - - STDMETHOD(GetVariable)(LPCSTR szName, VARIANT *pVal) throw() - { - if (!szName) - return E_INVALIDARG; - - if (pVal) - VariantInit(pVal); - else - return E_POINTER; - - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - hr = E_FAIL; - _ATLTRY - { - CComVariant val; - if (m_Variables.Lookup(szName, val)) - { - hr = VariantCopy(pVal, &val); - } - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - } - return hr; - } - - STDMETHOD(SetVariable)(LPCSTR szName, VARIANT vNewVal) throw() - { - if (!szName) - return E_INVALIDARG; - - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - _ATLTRY - { - hr = m_Variables.SetAt(szName, vNewVal) ? S_OK : E_FAIL; - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - } - return hr; - } - - STDMETHOD(RemoveVariable)(LPCSTR szName) throw() - { - if (!szName) - return E_INVALIDARG; - - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - _ATLTRY - { - hr = m_Variables.RemoveKey(szName) ? S_OK : E_FAIL; - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - } - return hr; - } - - STDMETHOD(GetCount)(long *pnCount) throw() - { - if (pnCount) - *pnCount = 0; - else - return E_POINTER; - - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - *pnCount = (long) m_Variables.GetCount(); - } - return hr; - } - - STDMETHOD(RemoveAllVariables)() throw() - { - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - m_Variables.RemoveAll(); - } - - return hr; - } - - STDMETHOD(BeginVariableEnum)(POSITION *pPOS, HSESSIONENUM *phEnumHandle=NULL) throw() - { - if (phEnumHandle) - *phEnumHandle = NULL; - - if (pPOS) - *pPOS = NULL; - else - return E_POINTER; - - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - *pPOS = m_Variables.GetStartPosition(); - } - return hr; - } - - STDMETHOD(GetNextVariable)(POSITION *pPOS, VARIANT *pVal, - HSESSIONENUM hEnum=NULL, - LPSTR szName=NULL, - DWORD dwLen=0 ) throw() - { - (hEnum); // Unused! - if (pVal) - VariantInit(pVal); - else - return E_POINTER; - - if (!pPOS) - return E_POINTER; - - CComVariant val; - POSITION pos = *pPOS; - HRESULT hr = Access(); - if (hr == S_OK) - { - CSLockType lock(m_cs, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - hr = E_FAIL; - _ATLTRY - { - if (szName) - { - CStringA strName = m_Variables.GetKeyAt(pos); - if (strName.GetLength()) - { - if (dwLen > (DWORD)strName.GetLength()) - { - Checked::strcpy_s(szName, dwLen, strName); - hr = S_OK; - } - else - hr = E_OUTOFMEMORY; - } - } - else - hr = S_OK; - - if (hr == S_OK) - { - val = m_Variables.GetNextValue(pos); - hr = VariantCopy(pVal, &val); - if (hr == S_OK) - *pPOS = pos; - } - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - } - return hr; - } - - STDMETHOD(CloseEnum)(HSESSIONENUM /*hEnumHandle*/) throw() - { - return S_OK; - } - - STDMETHOD(IsExpired)() throw() - { - CTime tmNow = CTime::GetCurrentTime(); - CTimeSpan span = tmNow-m_tLastAccess; - if ((unsigned __int64)((span.GetTotalSeconds()*1000)) > m_dwTimeout) - return S_OK; - return S_FALSE; - } - - HRESULT Access() throw() - { - // We lock here to protect against multiple threads - // updating the same member concurrently. - CSLockType lock(m_cs, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - return hr; - m_tLastAccess = CTime::GetCurrentTime(); - return S_OK; - } - - STDMETHOD(SetTimeout)(unsigned __int64 dwNewTimeout) throw() - { - // We lock here to protect against multiple threads - // updating the same member concurrently - CSLockType lock(m_cs, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - return hr; - m_dwTimeout = dwNewTimeout; - return S_OK; - } - - HRESULT SessionLock() throw() - { - Access(); - return S_OK; - } - - HRESULT SessionUnlock() throw() - { - return S_OK; - } - -protected: - typedef CAtlMap > VarMapType; - unsigned __int64 m_dwTimeout; - CTime m_tLastAccess; - VarMapType m_Variables; - CComAutoCriticalSection m_cs; - typedef CComCritSecLock CSLockType; -}; // CMemSession - - -// -// CMemSessionServiceImpl -// Implements the service part of in-memory persisted session services. -// -class CMemSessionServiceImpl -{ -public: - typedef void* SERVICEIMPL_INITPARAM_TYPE; - CMemSessionServiceImpl() throw() - { - m_dwTimeout = ATL_SESSION_TIMEOUT; - } - - ~CMemSessionServiceImpl() throw() - { - m_CritSec.Term(); - } - - HRESULT CreateNewSession(__out_ecount_part_z(*pdwSize, *pdwSize) LPSTR szNewID, __inout DWORD *pdwSize, __deref_out_opt ISession** ppSession) throw() - { - HRESULT hr = E_FAIL; - CComObject *pNewSession = NULL; - - if (!szNewID) - return E_INVALIDARG; - - if (!pdwSize) - return E_POINTER; - - if (ppSession) - *ppSession = NULL; - else - return E_POINTER; - - _ATLTRY - { - // Create new session - CComObject::CreateInstance(&pNewSession); - if (pNewSession == NULL) - return E_OUTOFMEMORY; - - // Initialize and add to list of CSessionData - hr = m_SessionNameGenerator.GetNewSessionName(szNewID, pdwSize); - - if (SUCCEEDED(hr)) - { - CComPtr spSession; - hr = pNewSession->QueryInterface(&spSession); - if (SUCCEEDED(hr)) - { - pNewSession->SetTimeout(m_dwTimeout); - pNewSession->Access(); - CSLockType lock(m_CritSec, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - hr = m_Sessions.SetAt(szNewID, spSession) != NULL ? S_OK : E_FAIL; - if (hr == S_OK) - *ppSession = spSession.Detach(); - } - } - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - - return hr; - - } - - HRESULT CreateNewSessionByName(__in_z LPSTR szNewID, __deref_out_opt ISession** ppSession) throw() - { - HRESULT hr = E_FAIL; - CComObject *pNewSession = NULL; - - if (!szNewID || *szNewID == 0) - return E_INVALIDARG; - - if (ppSession) - *ppSession = NULL; - else - return E_POINTER; - - CComPtr spSession; - // If the session already exists, you get a pointer to the - // existing session. You can't have multiple entries with the - // same name in CAtlMap - hr = GetSession(szNewID, &spSession); - if (hr == S_OK) - { - *ppSession = spSession.Detach(); - return hr; - } - - _ATLTRY - { - // Create new session - CComObject::CreateInstance(&pNewSession); - if (pNewSession == NULL) - return E_OUTOFMEMORY; - - - hr = pNewSession->QueryInterface(&spSession); - if (SUCCEEDED(hr)) - { - pNewSession->SetTimeout(m_dwTimeout); - pNewSession->Access(); - CSLockType lock(m_CritSec, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - hr = m_Sessions.SetAt(szNewID, spSession) != NULL ? S_OK : E_FAIL; - - if (hr == S_OK) - *ppSession = spSession.Detach(); - } - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - - return hr; - - } - - HRESULT GetSession(LPCSTR szID, ISession **ppSession) throw() - { - HRESULT hr = E_FAIL; - SessMapType::CPair *pPair = NULL; - - if (ppSession) - *ppSession = NULL; - else - return E_POINTER; - - if (!szID) - return E_INVALIDARG; - - CSLockType lock(m_CritSec, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - hr = E_FAIL; - _ATLTRY - { - pPair = m_Sessions.Lookup(szID); - if (pPair) // the session exists and is in our local map of sessions - { - hr = pPair->m_value.QueryInterface(ppSession); - } - } - _ATLCATCHALL() - { - return E_UNEXPECTED; - } - - return hr; - } - - HRESULT CloseSession(LPCSTR szID) throw() - { - if (!szID) - return E_INVALIDARG; - - HRESULT hr = E_FAIL; - CSLockType lock(m_CritSec, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - _ATLTRY - { - hr = m_Sessions.RemoveKey(szID) ? S_OK : E_UNEXPECTED; - } - _ATLCATCHALL() - { - hr = E_UNEXPECTED; - } - return hr; - } - - void SweepSessions() throw() - { - POSITION posRemove = NULL; - const SessMapType::CPair *pPair = NULL; - POSITION pos = NULL; - - CSLockType lock(m_CritSec, false); - if (FAILED(lock.Lock())) - return; - pos = m_Sessions.GetStartPosition(); - while (pos) - { - posRemove = pos; - pPair = m_Sessions.GetNext(pos); - if (pPair) - { - if (pPair->m_value.p && - S_OK == pPair->m_value->IsExpired()) - { - // remove our reference on the session - m_Sessions.RemoveAtPos(posRemove); - } - } - } - } - - HRESULT SetSessionTimeout(unsigned __int64 nTimeout) throw() - { - HRESULT hr = S_OK; - CComPtr spSession; - m_dwTimeout = nTimeout; - - CSLockType lock(m_CritSec, false); - hr = lock.Lock(); - if (FAILED(hr)) - return hr; - - POSITION pos = m_Sessions.GetStartPosition(); - if (!pos) - return S_OK; // no sessions to set the timeout on - - - while (pos) - { - SessMapType::CPair *pPair = const_cast(m_Sessions.GetNext(pos)); - if (pPair) - { - spSession = pPair->m_value; - if (spSession) - { - // if we fail on any of the sets we will return the - // error code immediately - hr = spSession->SetTimeout(nTimeout); - spSession.Release(); - if (hr != S_OK) - break; - } - else - { - hr = E_UNEXPECTED; - break; - } - } - else - { - hr = E_UNEXPECTED; - break; - } - } - - return hr; - } - - HRESULT GetSessionTimeout(unsigned __int64* pnTimeout) throw() - { - if (pnTimeout) - *pnTimeout = m_dwTimeout; - else - return E_POINTER; - - return S_OK; - } - - HRESULT GetSessionCount(DWORD *pnCount) throw() - { - if (pnCount) - *pnCount = 0; - else - return E_POINTER; - - CSLockType lock(m_CritSec, false); - HRESULT hr = lock.Lock(); - if (FAILED(hr)) - return hr; - *pnCount = (DWORD)m_Sessions.GetCount(); - - return S_OK; - } - - void ReleaseAllSessions() throw() - { - CSLockType lock(m_CritSec, false); - if (FAILED(lock.Lock())) - return; - m_Sessions.RemoveAll(); - } - - HRESULT Initialize(SERVICEIMPL_INITPARAM_TYPE, - IServiceProvider*, - unsigned __int64 dwNewTimeout) throw() - { - m_dwTimeout = dwNewTimeout; - return m_CritSec.Init(); - } - - typedef CAtlMap, - CElementTraitsBase > SessMapType; - - SessMapType m_Sessions; // map for holding sessions in memory - CComCriticalSection m_CritSec; // for synchronizing access to map - typedef CComCritSecLock CSLockType; - CSessionNameGenerator m_SessionNameGenerator; // Object for generating session names - unsigned __int64 m_dwTimeout; -}; // CMemSessionServiceImpl - - - -// -// CSessionStateService -// This class implements the session state service which can be -// exposed to request handlers. -// -// Template Parameters: -// MonitorClass: Provides periodic sweeping services for the session service class. -// TServiceImplClass: The class that actually implements the methods of the -// ISessionStateService and ISessionStateControl interfaces. -template -class CSessionStateService : - public ISessionStateService, - public ISessionStateControl, - public IWorkerThreadClient, - public CComObjectRootEx -{ -protected: - MonitorClass m_Monitor; - HANDLE m_hTimer; - CComPtr m_spServiceProvider; - TServiceImplClass m_SessionServiceImpl; -public: - // Construction/Initialization - CSessionStateService() throw() : - m_hTimer(NULL) - { - - } - ~CSessionStateService() throw() - { - ATLASSUME(m_hTimer == NULL); - } - BEGIN_COM_MAP(CSessionStateService) - COM_INTERFACE_ENTRY(ISessionStateService) - COM_INTERFACE_ENTRY(ISessionStateControl) - END_COM_MAP() - -// ISessionStateServie methods - STDMETHOD(CreateNewSession)(LPSTR szNewID, DWORD *pdwSize, ISession** ppSession) throw() - { - return m_SessionServiceImpl.CreateNewSession(szNewID, pdwSize, ppSession); - } - - STDMETHOD(CreateNewSessionByName)(LPSTR szNewID, ISession** ppSession) throw() - { - return m_SessionServiceImpl.CreateNewSessionByName(szNewID, ppSession); - } - - STDMETHOD(GetSession)(LPCSTR szID, ISession **ppSession) throw() - { - return m_SessionServiceImpl.GetSession(szID, ppSession); - } - - STDMETHOD(CloseSession)(LPCSTR szSessionID) throw() - { - return m_SessionServiceImpl.CloseSession(szSessionID); - } - - STDMETHOD(SetSessionTimeout)(unsigned __int64 nTimeout) throw() - { - return m_SessionServiceImpl.SetSessionTimeout(nTimeout); - } - - STDMETHOD(GetSessionTimeout)(unsigned __int64 *pnTimeout) throw() - { - return m_SessionServiceImpl.GetSessionTimeout(pnTimeout); - } - - STDMETHOD(GetSessionCount)(DWORD *pnSessionCount) throw() - { - return m_SessionServiceImpl.GetSessionCount(pnSessionCount); - } - - void SweepSessions() throw() - { - m_SessionServiceImpl.SweepSessions(); - } - - void ReleaseAllSessions() throw() - { - m_SessionServiceImpl.ReleaseAllSessions(); - } - - HRESULT Initialize( - IServiceProvider *pServiceProvider = NULL, - typename TServiceImplClass::SERVICEIMPL_INITPARAM_TYPE pInitData = NULL, - unsigned __int64 dwTimeout = ATL_SESSION_TIMEOUT) throw() - { - HRESULT hr = S_OK; - if (pServiceProvider) - m_spServiceProvider = pServiceProvider; - - hr = m_SessionServiceImpl.Initialize(pInitData, pServiceProvider, dwTimeout); - - return hr; - } - - - template - HRESULT Initialize( - CWorkerThread *pWorker, - IServiceProvider *pServiceProvider = NULL, - typename TServiceImplClass::SERVICEIMPL_INITPARAM_TYPE pInitData = NULL, - unsigned __int64 dwTimeout = ATL_SESSION_TIMEOUT) throw() - { - if (!pWorker) - return E_INVALIDARG; - - HRESULT hr = Initialize(pServiceProvider, pInitData, dwTimeout); - if (hr == S_OK) - { - hr = m_Monitor.Initialize(pWorker); - if (hr == S_OK) - { - //sweep every 500ms - hr = m_Monitor.AddTimer(ATL_SESSION_SWEEPER_TIMEOUT, this, 0, &m_hTimer); - } - } - return hr; - } - - void Shutdown() throw() - { - if (m_hTimer) - { - if(FAILED(m_Monitor.RemoveHandle(m_hTimer))) - { - /* can't report from here */ - ATLASSERT(FALSE); - } - m_hTimer = NULL; - } - ReleaseAllSessions(); - } -// Implementation - HRESULT Execute(DWORD_PTR /*dwParam*/, HANDLE /*hObject*/) throw() - { - SweepSessions(); - return S_OK; - } - - HRESULT CloseHandle(HANDLE hHandle) throw() - { - ::CloseHandle(hHandle); - m_hTimer = NULL; - return S_OK; - } - -}; // CSessionStateService - -} // namespace ATL -#pragma pack(pop) - -#pragma warning(pop) -#endif // __ATLSESSION_H__ diff --git a/include/atl/atlsharedsvc.h b/include/atl/atlsharedsvc.h deleted file mode 100644 index b309f12c6..000000000 --- a/include/atl/atlsharedsvc.h +++ /dev/null @@ -1,202 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSHAREDSVC_H__ -#define __ATLSHAREDSVC_H__ - -#pragma once - -#include -#include -#pragma pack(push,_ATL_PACKING) -namespace ATL{ - -#ifndef ATL_SHAREDBLOBCACHE_TIMEOUT - #define ATL_SHAREDBLOBCACHE_TIMEOUT 36000000000 // in 100 nano second intervals - // each entry will be free'd if - // no access in 1 hour. -#endif - -// Interface used by to access the shared blob cache. -[ uuid("AB4AF9CD-8DB1-4974-A617-CF0449578FB9"), object ] -__interface ISharedBlobCache -{ - [id(0)] STDMETHOD(AddItem)([in] BSTR szItemName, [in] BSTR szData); - [id(1)] STDMETHOD(GetItem)([in] BSTR szItemName, [out,retval] BSTR *szData); -}; - -class CSharedCache: - public CBlobCache, CStdStatClass >, - public IMemoryCacheClient, - public ISharedBlobCache -{ - typedef CBlobCache, CStdStatClass > basecache; -public: - - // IMemoryCacheClient method, frees data in the memory cache. - STDMETHOD( Free )(const void *pvData) - { - if (pvData) - { - ::SysFreeString((BSTR)pvData); - } - return S_OK; - } - - - STDMETHODIMP AddItem(BSTR szItemName, BSTR szData) - { - - HRESULT hr = E_UNEXPECTED; - - // We make a copy of the BSTR and stick it in the cache. - // The BSTR will be freed in our IMemoryCacheClient::Free - // implementation above. - BSTR szEntry = SysAllocString(szData); - if(szEntry) - { - USES_CONVERSION_EX; - // create a time span and for the entry - CFileTime tm = CFileTime::GetCurrentTime(); - CFileTimeSpan span; - span.SetTimeSpan(ATL_SHAREDBLOBCACHE_TIMEOUT); - tm += span; - HCACHEITEM h; - hr = basecache::Add(OLE2A_EX(szItemName, _ATL_SAFE_ALLOCA_DEF_THRESHOLD), szEntry, sizeof(BSTR), - &tm, _AtlBaseModule.m_hInst, &h, static_cast(this)); - - if (hr == S_OK) - { - // On successful add, we have to release our - // reference on the entry. - basecache::ReleaseEntry(h); - } - } - return hr; - } - - STDMETHODIMP GetItem(BSTR szItemName, BSTR *szData) - { - USES_CONVERSION_EX; - HRESULT hr = E_UNEXPECTED; - HCACHEITEM hEntry = NULL; - - if (!szItemName || !szData) - return hr; - - hr = basecache::LookupEntry(OLE2A_EX(szItemName, _ATL_SAFE_ALLOCA_DEF_THRESHOLD), &hEntry); - if (hr == S_OK) - { - void *pData = NULL; - DWORD dwSize = 0; - hr = basecache::GetData(hEntry, &pData, &dwSize); - if (hr == S_OK) - { - // make a copy of the string - *szData = ::SysAllocString((BSTR)pData); - } - basecache::ReleaseEntry(hEntry); - } - return hr; - } - - - STDMETHODIMP QueryInterface(REFIID riid, void **ppv) - { - HRESULT hr = E_NOINTERFACE; - if (InlineIsEqualGUID(__uuidof(IMemoryCacheClient), riid)|| - InlineIsEqualGUID(__uuidof(IUnknown), riid)) - { - *ppv = static_cast(static_cast(this)); - hr = S_OK; - } - else if( InlineIsEqualGUID(__uuidof(ISharedBlobCache), riid)) - { - *ppv = static_cast(static_cast(this)); - hr = S_OK; - } - return hr; - } - ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - ULONG STDMETHODCALLTYPE Release() - { - return 1; - } -}; - - -// This class implements the SOAP interface for the shared blob cache. -[ - soap_handler( - name="SharedBlobCache", - namespace="http://www.microsoft.com/vc/atlserver/soap/SharedBlobCache", - protocol="soap" - ), - request_handler( - name="SharedBlobCache", - sdl="GenSharedBlobCacheWSDL" - ) -] -class CSharedCacheHandler: - public ISharedBlobCache -{ -public: - [soap_method] - STDMETHOD(AddItem)(BSTR szItemName, BSTR szData) - { - if (!m_spMemCache) - return E_UNEXPECTED; - return m_spMemCache->AddItem(szItemName, szData); - } - - [soap_method] - STDMETHOD(GetItem)(BSTR szItemName, BSTR *szData) - { - if (!m_spMemCache) - return E_UNEXPECTED; - return m_spMemCache->GetItem(szItemName, szData); - } - - HTTP_CODE Initialize(IServiceProvider *pProvider) - { - ATLASSERT(pProvider); // should never be NULL - if (!pProvider) - return HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - - if (m_spMemCache) - return HTTP_SUCCESS; // already initialized - - pProvider->QueryService(__uuidof(ISharedBlobCache), &m_spMemCache); - return m_spMemCache ? HTTP_SUCCESS : HTTP_ERROR(500, ISE_SUBERR_UNEXPECTED); - } - - // override HandleRequest to Initialize our m_spServiceProvider - // and to handle authorizing the client. - HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider) - { - HTTP_CODE dwErr = Initialize(pProvider); - if (dwErr != HTTP_SUCCESS) - return dwErr; - - dwErr = CSoapHandler::HandleRequest(pRequestInfo, - pProvider); - return dwErr; - } - CComPtr m_spMemCache; -}; - -} //ATL - -#pragma pack(pop) - -#endif // __ATLSHAREDSVC_H__ diff --git a/include/atl/atlsiface.h b/include/atl/atlsiface.h deleted file mode 100644 index 08480225a..000000000 --- a/include/atl/atlsiface.h +++ /dev/null @@ -1,802 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSIFACE_H__ -#define __ATLSIFACE_H__ - -#pragma once -#include -#include -#include -#include -#include -#include - -#pragma pack(push,_ATL_PACKING) -namespace ATL{ - -// Forward declarations of custom data types used in -// interfaces declared in this file. -struct AtlServerRequest; -class CIsapiWorker; -__interface IAtlMemMgr; -class CCookie; - -// Forward declarations of all interfaces declared in this file. -__interface IWriteStream; -__interface IHttpFile; -__interface IHttpServerContext; -__interface IHttpRequestLookup; -__interface IRequestHandler; -__interface ITagReplacer; -__interface IIsapiExtension; -__interface IPageCacheControl; -__interface IRequestStats; -__interface IBrowserCaps; -__interface IBrowserCapsSvc; - - -// ATLS Interface declarations. - -// IWriteStream -// Interface for writing to a stream. -__interface IWriteStream -{ - HRESULT WriteStream(LPCSTR szOut, int nLen, DWORD *pdwWritten); - HRESULT FlushStream(); -}; - -// IHttpFile -// This is an interface that provides for basic accessor -// functionality for files (see CHttpRequestFile). -__interface IHttpFile -{ - LPCSTR GetParamName(); - LPCSTR GetFileName(); - LPCSTR GetFullFileName(); - LPCSTR GetContentType(); - LPCSTR GetTempFileName(); - ULONGLONG GetFileSize(); - void Free(); -}; - -// IHttpServerContext -// This interface encapsulates the capabilities of the web server and provides information about -// the current request being handled. See CServerContext for implementation. -__interface ATL_NO_VTABLE __declspec(uuid("813F3F00-3881-11d3-977B-00C04F8EE25E")) - IHttpServerContext : public IUnknown -{ - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv); - ULONG STDMETHODCALLTYPE AddRef(); - ULONG STDMETHODCALLTYPE Release(); - - LPCSTR GetRequestMethod(); - LPCSTR GetQueryString(); - LPCSTR GetPathInfo(); - LPCSTR GetPathTranslated(); - LPCSTR GetScriptPathTranslated(); - DWORD GetTotalBytes(); - DWORD GetAvailableBytes(); - BYTE *GetAvailableData(); - LPCSTR GetContentType(); - BOOL GetServerVariable(__in_z LPCSTR pszVariableName, - __out_ecount_part_opt(*pdwSize, *pdwSize) LPSTR pvBuffer, __inout DWORD *pdwSize); - BOOL GetImpersonationToken(HANDLE * pToken); - BOOL WriteClient(void *pvBuffer, DWORD *pdwBytes); - BOOL AsyncWriteClient(void *pvBuffer, DWORD *pdwBytes); - BOOL ReadClient(void *pvBuffer, DWORD *pdwSize); - BOOL AsyncReadClient(void *pvBuffer, DWORD *pdwSize); - BOOL SendRedirectResponse(LPCSTR pszRedirectUrl); - BOOL SendResponseHeader(LPCSTR pszHeader, LPCSTR pszStatusCode, - BOOL fKeepConn); - BOOL DoneWithSession(DWORD dwHttpStatusCode); - BOOL RequestIOCompletion(PFN_HSE_IO_COMPLETION pfn, DWORD *pdwContext); - BOOL TransmitFile(HANDLE hFile, PFN_HSE_IO_COMPLETION pfn, void *pContext, - LPCSTR szStatusCode, DWORD dwBytesToWrite, DWORD dwOffset, - void *pvHead, DWORD dwHeadLen, void *pvTail, - DWORD dwTailLen, DWORD dwFlags); - BOOL AppendToLog(LPCSTR szMessage, DWORD* pdwLen); - BOOL MapUrlToPathEx(LPCSTR szLogicalPath, DWORD dwLen, HSE_URL_MAPEX_INFO *pumInfo); -}; - -// IHttpRequestLookup -// This interface is designed to allow one map to chain to another map. -// The interface is implemented by the CHttpThunkMap and CHttpRequest classes. -// Pointers to this interface are passed around by CRequestHandlerT and CHtmlTagReplacer. -// dwType - the type of item being requested -__interface ATL_NO_VTABLE __declspec(uuid("A5990B44-FF74-4bfe-B66D-F9E7E9F42D42")) - IHttpRequestLookup : public IUnknown -{ - POSITION GetFirstQueryParam(LPCSTR *ppszName, LPCSTR *ppszValue); - POSITION GetNextQueryParam(POSITION pos, LPCSTR *ppszName, LPCSTR *ppszValue); - - POSITION GetFirstFormVar(LPCSTR *ppszName, LPCSTR *ppszValue); - POSITION GetNextFormVar(POSITION pos, LPCSTR *ppszName, LPCSTR *ppszValue); - - POSITION GetFirstFile(LPCSTR *ppszName, IHttpFile **ppFile); - POSITION GetNextFile(POSITION pos, LPCSTR *ppszName, IHttpFile **ppFile); - - HRESULT GetServerContext(IHttpServerContext **ppOut); -}; - - -// IRequestHandler -// This interface is impelemented by clients who want to be request handlers in an -// atl server application. Server default implementations are provided in ATL, including -// IRequestHandlerImpl (atlisapi.h) and CRequestHandlerT (atlstencil.h) -__interface ATL_NO_VTABLE __declspec(uuid("D57F8D0C-751A-4223-92BC-0B29F65D2453")) -IRequestHandler : public IUnknown -{ - HTTP_CODE GetFlags(DWORD *pdwStatus); - HTTP_CODE InitializeHandler(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider); - HTTP_CODE InitializeChild(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider, IHttpRequestLookup *pLookup); - HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider); - void UninitializeHandler(); -}; - -// ITagReplacer -// This interface defines the methods necessary for server response file processing. -__interface ATL_NO_VTABLE __declspec(uuid("8FF5E90C-8CE0-43aa-96C4-3BF930837512")) - ITagReplacer : public IUnknown -{ - HTTP_CODE FindReplacementOffset(LPCSTR szMethodName, DWORD *pdwMethodOffset, - LPCSTR szObjectName, DWORD *pdwObjOffset, DWORD *pdwMap, void **ppvParam, IAtlMemMgr *pMemMgr); - HTTP_CODE RenderReplacement(DWORD dwFnOffset, DWORD dwObjOffset, DWORD dwMap, void *pvParam); - HRESULT GetContext(REFIID riid, void** ppv); - IWriteStream *SetStream(IWriteStream *pStream); -}; - - -struct CStencilState; - -// IIsapiExtension -// Tnis is the interface to the ISAPI extension of a running ATL Server web -// application. Provides request handler clients with access to functions of the -// ISAPI server. -__interface __declspec(uuid("79DD4A27-D820-4fa6-954D-E1DFC2C05978")) - IIsapiExtension : public IUnknown -{ - BOOL DispatchStencilCall(AtlServerRequest *pRequestInfo); - void RequestComplete(AtlServerRequest *pRequestInfo, DWORD hStatus, DWORD dwSubStatus); - BOOL OnThreadAttach(); - void OnThreadTerminate(); - BOOL QueueRequest(AtlServerRequest *pRequestInfo); - CIsapiWorker *GetThreadWorker(); - BOOL SetThreadWorker(CIsapiWorker *pWorker); - HTTP_CODE LoadRequestHandler(LPCSTR szDllPath, LPCSTR szHandlerName, IHttpServerContext *pServerContext, - HINSTANCE *phInstance, IRequestHandler **ppHandler); - HRESULT AddService(REFGUID guidService, REFIID riid, IUnknown *punk, HINSTANCE hInstance); - HRESULT RemoveService(REFGUID guidService, REFIID riid); - HTTP_CODE LoadDispatchFile(LPCSTR szFileName, AtlServerRequest *pRequestInfo); - - AtlServerRequest* CreateRequest(); - void FreeRequest(AtlServerRequest* pRequest); - HTTP_CODE TransferRequest( - AtlServerRequest *pRequest, - IServiceProvider *pServiceProvider, - IWriteStream *pWriteStream, - IHttpRequestLookup *pLookup, - LPCSTR szNewUrl, - WORD nCodePage, - bool bContinueAfterProcess, - CStencilState *pState); -}; - -// IPageCacheControl -// This interface controls the cacheability of the current page -__interface ATL_NO_VTABLE __declspec(uuid("9868BFC0-D44D-4154-931C-D186EC0C45D5")) - IPageCacheControl : public IUnknown -{ - HRESULT GetExpiration(FILETIME *pftExpiration); - HRESULT SetExpiration(FILETIME ftExpiration); - BOOL IsCached(); - BOOL Cache(BOOL bCache); -}; - -// IRequestStats -// Used to query request statistics from a running ATL server ISAPI application. -__interface ATL_NO_VTABLE __declspec(uuid("2B75C68D-0DDF-48d6-B58A-CC7C2387A6F2")) - IRequestStats : public IUnknown -{ - long GetTotalRequests(); - long GetFailedRequests(); - long GetAvgResponseTime(); - long GetCurrWaiting(); - long GetMaxWaiting(); - long GetActiveThreads(); -}; - -// IBrowserCaps -// Interface that provides information about a particular web brorwser. -// See atlutil.h and the ATL Browser Capabilities service for information -// about this interface's implementation -__interface __declspec(uuid("3339FCE2-99BC-4985-A702-4ABC8304A995")) - IBrowserCaps : public IUnknown -{ - HRESULT GetPropertyString(BSTR bstrProperty, BSTR * pbstrOut); - HRESULT GetBooleanPropertyValue(BSTR bstrProperty, BOOL* pbOut); - HRESULT GetBrowserName(BSTR * pbstrName); - HRESULT GetPlatform(BSTR * pbstrPlatform); - HRESULT GetVersion(BSTR * pbstrVersion); - HRESULT GetMajorVer(BSTR * pbstrMajorVer); - HRESULT GetMinorVer(BSTR * pbstrMinorVer); - HRESULT SupportsFrames(BOOL* pbFrames); - HRESULT SupportsTables(BOOL* pbTables); - HRESULT SupportsCookies(BOOL* pbCookies); - HRESULT SupportsBackgroundSounds(BOOL* pbBackgroundSounds); - HRESULT SupportsVBScript(BOOL* pbVBScript); - HRESULT SupportsJavaScript(BOOL* pbJavaScript); - HRESULT SupportsJavaApplets(BOOL* pbJavaApplets); - HRESULT SupportsActiveXControls(BOOL* pbActiveXControls); - HRESULT SupportsCDF(BOOL* pbCDF); - HRESULT SupportsAuthenticodeUpdate(BOOL* pbAuthenticodeUpdate); - HRESULT IsBeta(BOOL* pbIsBeta); - HRESULT IsCrawler(BOOL* pbIsCrawler); - HRESULT IsAOL(BOOL* pbIsAOL); - HRESULT IsWin16(BOOL* pbIsWin16); - HRESULT IsAK(BOOL* pbIsAK); - HRESULT IsSK(BOOL* pbIsSK); - HRESULT IsUpdate(BOOL* pbIsUpdate); -}; - -// IBrowserCapsSvc. -// Interface on the browser caps service. Used by clients to query a running -// instance of the browser capabilities service for information about a user's web -// browser. See atlutil.h for implementation of the browser capabilities services. -__interface __declspec(uuid("391E7418-863B-430e-81BB-1312ED2FF3E9")) - IBrowserCapsSvc : public IUnknown -{ - HRESULT GetCaps(IHttpServerContext * pContext, IBrowserCaps ** ppOut); - HRESULT GetCapsUserAgent(BSTR bstrAgent, IBrowserCaps ** ppOut); -}; - -class CBrowserCapsSvc : public IBrowserCapsSvc, - public CComObjectRootEx -{ -public: - virtual ~CBrowserCapsSvc() - { - } - - BEGIN_COM_MAP(CBrowserCapsSvc) - COM_INTERFACE_ENTRY(IBrowserCapsSvc) - END_COM_MAP() - - __success(SUCCEEDED(return)) __checkReturn HRESULT GetCaps(__in IHttpServerContext * pContext, __deref_out_opt IBrowserCaps ** ppOut) - { - if (!pContext) - return E_POINTER; - - if (!ppOut) - return E_POINTER; - - *ppOut = NULL; - - char szUserAgent[256]; - DWORD dwSize = sizeof(szUserAgent); - if (!pContext->GetServerVariable("HTTP_USER_AGENT", szUserAgent, &dwSize)) - return E_FAIL; - - return GetCapsUserAgent(CComBSTR(szUserAgent), ppOut); - } - - __success(SUCCEEDED(return)) __checkReturn HRESULT GetCapsUserAgent(__in BSTR bstrAgent, __deref_out IBrowserCaps ** ppOut) - { - if (::SysStringLen(bstrAgent) == 0 || ppOut == NULL) - { - return E_POINTER; - } - - *ppOut = NULL; - - BrowserCaps* pCaps = NULL; - - _ATLTRY - { - CW2CT szUserAgent(bstrAgent); - - if (!m_mapAgent.Lookup(szUserAgent, pCaps)) - { - pCaps = NULL; - for (size_t i=0; i *pRet = NULL; - - ATLTRY(pRet = new CComObjectNoLock); - - if (!pRet) - return E_OUTOFMEMORY; - pRet->AddRef(); - - HRESULT hr = pRet->Initialize(pCaps); - if (FAILED(hr)) - { - pRet->Release(); - return hr; - } - - *ppOut = pRet; - return S_OK; - } -#pragma warning(pop) - - return E_FAIL; - } - - __checkReturn HRESULT Initialize(__in HINSTANCE hInstance) throw() - { - // tries loading browscap.ini from the same directory as the module - if (hInstance != NULL) - { - _ATLTRY - { - CPath strBrowscapPath; - - LPTSTR sz = strBrowscapPath.m_strPath.GetBuffer(MAX_PATH); - UINT nChars = ::GetModuleFileName(hInstance, sz, MAX_PATH); - strBrowscapPath.m_strPath.ReleaseBuffer(nChars); - if (nChars != 0 && - nChars != MAX_PATH && - strBrowscapPath.RemoveFileSpec()) - { - strBrowscapPath += _T("\\browscap.ini"); - if (SUCCEEDED(Load(strBrowscapPath))) - return S_OK; - } - } - _ATLCATCHALL() - { - return E_FAIL; - } - } - - // falls back to the system browscap.ini if previous Load failed - return Load(); - } - - HRESULT Uninitialize() - { - Clear(); - return S_OK; - } - -private: - static bool IsEqualAgentString(__in LPCTSTR szPattern, __in LPCTSTR szInput) - { - while (*szPattern && *szInput && (*szPattern == *szInput || *szPattern == '?')) - { - szPattern++; - szInput++; - } - - if (*szPattern == *szInput) - { - return true; - } - - if (*szPattern == '*') - { - szPattern++; - if (!*szPattern) - { - return true; - } - while(*szInput) - { - if (IsEqualAgentString(szPattern, szInput)) - { - return true; - } - - szInput++; - } - } - - return false; - } - - __checkReturn HRESULT Load(__in_opt LPCTSTR szPath = NULL) - { - _ATLTRY - { - Clear(); - - CString strBrowscapPath(szPath); - - // use default load path if a path isn't specified - if (strBrowscapPath.IsEmpty()) - { - LPTSTR sz = strBrowscapPath.GetBuffer(MAX_PATH); - UINT nChars = ::GetSystemDirectory(sz, MAX_PATH); - strBrowscapPath.ReleaseBuffer(nChars); - if (nChars == 0 || nChars == MAX_PATH) - return E_FAIL; - - strBrowscapPath += _T("\\inetsrv\\browscap.ini"); - } - - size_t nCurrent = 16384; - CHeapPtr data; - - if (!data.Allocate(nCurrent)) - return E_OUTOFMEMORY; - - // load the list of all the user agents - bool bRetrieved = false; - - do - { - DWORD dwRetrieved = ::GetPrivateProfileSectionNames(data, (DWORD) nCurrent, strBrowscapPath); - if (dwRetrieved == 0) - { - return AtlHresultFromWin32(ERROR_FILE_NOT_FOUND); - } - else if (dwRetrieved < nCurrent-2) - { - bRetrieved = true; - } - else if(SIZE_MAX/2, CStringElementTraits > m_props; - }; - - // map from UserAgent string to caps - // used for non-wildcard lookup and parent lookup - CAtlMap > m_mapAgent; - - // all of the caps - CAtlArray m_caps; - - class CBrowserCaps : public IBrowserCaps, public CComObjectRootEx - { - public: - - BEGIN_COM_MAP(CBrowserCaps) - COM_INTERFACE_ENTRY(IBrowserCaps) - END_COM_MAP() - - CBrowserCaps() - { - } - - HRESULT Initialize(__in CBrowserCapsSvc::BrowserCaps * pCaps) - { - m_pCaps = pCaps; - return S_OK; - } - - __checkReturn HRESULT GetPropertyString(__in BSTR bstrProperty, __out BSTR * pbstrOut) - { - _ATLTRY - { - ATLASSUME(m_pCaps); - if (!m_pCaps) - return E_UNEXPECTED; - - if (!pbstrOut) - return E_POINTER; - - *pbstrOut = NULL; - - CString strName(bstrProperty); - CString strVal; - - CBrowserCapsSvc::BrowserCaps * pCaps = m_pCaps; - while (pCaps) - { - if (pCaps->m_props.Lookup(strName, strVal)) - { - CComBSTR bstrVal(strVal); - *pbstrOut = bstrVal.Detach(); - return S_OK; - } - - pCaps = pCaps->m_pParent; - } - - return S_FALSE; - } - _ATLCATCHALL() - { - return E_FAIL; - } - } - - __checkReturn HRESULT GetBooleanPropertyValue(__in BSTR bstrProperty, __out BOOL* pbOut) - { - if (!pbOut) - return E_POINTER; - - CComBSTR bstrOut; - HRESULT hr = GetPropertyString(bstrProperty, &bstrOut); - if (FAILED(hr) || S_FALSE == hr) - return hr; - - if (_wcsicmp(bstrOut, L"true") == 0) - *pbOut = TRUE; - else - *pbOut = FALSE; - - return S_OK; - } - - __checkReturn HRESULT GetBrowserName(__out BSTR * pbstrName) - { - return GetPropertyString(CComBSTR(L"browser"), pbstrName); - } - - __checkReturn HRESULT GetPlatform(__out BSTR * pbstrPlatform) - { - return GetPropertyString(CComBSTR(L"platform"), pbstrPlatform); - } - - __checkReturn HRESULT GetVersion(__out BSTR * pbstrVersion) - { - return GetPropertyString(CComBSTR(L"version"), pbstrVersion); - } - - __checkReturn HRESULT GetMajorVer(__out BSTR * pbstrMajorVer) - { - return GetPropertyString(CComBSTR(L"majorver"), pbstrMajorVer); - } - - __checkReturn HRESULT GetMinorVer(__out BSTR * pbstrMinorVer) - { - return GetPropertyString(CComBSTR(L"minorver"), pbstrMinorVer); - } - - __checkReturn HRESULT SupportsFrames(__out BOOL* pbFrames) - { - return GetBooleanPropertyValue(CComBSTR(L"frames"), pbFrames); - } - - __checkReturn HRESULT SupportsTables(__out BOOL* pbTables) - { - return GetBooleanPropertyValue(CComBSTR(L"tables"), pbTables); - } - __checkReturn HRESULT SupportsCookies(__out BOOL* pbCookies) - { - return GetBooleanPropertyValue(CComBSTR(L"cookies"), pbCookies); - } - __checkReturn HRESULT SupportsBackgroundSounds(__out BOOL* pbBackgroundSounds) - { - return GetBooleanPropertyValue(CComBSTR(L"backgroundsounds"), pbBackgroundSounds); - } - __checkReturn HRESULT SupportsVBScript(__out BOOL* pbVBScript) - { - return GetBooleanPropertyValue(CComBSTR(L"vbscript"), pbVBScript); - } - __checkReturn HRESULT SupportsJavaScript(__out BOOL* pbJavaScript) - { - return GetBooleanPropertyValue(CComBSTR(L"javascript"), pbJavaScript); - } - __checkReturn HRESULT SupportsJavaApplets(__out BOOL* pbJavaApplets) - { - return GetBooleanPropertyValue(CComBSTR(L"javaapplets"), pbJavaApplets); - } - __checkReturn HRESULT SupportsActiveXControls(__out BOOL* pbActiveXControls) - { - return GetBooleanPropertyValue(CComBSTR(L"ActiveXControls"), pbActiveXControls); - } - __checkReturn HRESULT SupportsCDF(__out BOOL* pbCDF) - { - return GetBooleanPropertyValue(CComBSTR(L"CDF"), pbCDF); - } - __checkReturn HRESULT SupportsAuthenticodeUpdate(__out BOOL* pbAuthenticodeUpdate) - { - return GetBooleanPropertyValue(CComBSTR(L"AuthenticodeUpdate"), pbAuthenticodeUpdate); - } - __checkReturn HRESULT IsBeta(__out BOOL* pbIsBeta) - { - return GetBooleanPropertyValue(CComBSTR(L"beta"), pbIsBeta); - } - __checkReturn HRESULT IsCrawler(__out BOOL* pbIsCrawler) - { - return GetBooleanPropertyValue(CComBSTR(L"Crawler"), pbIsCrawler); - } - __checkReturn HRESULT IsAOL(__out BOOL* pbIsAOL) - { - return GetBooleanPropertyValue(CComBSTR(L"AOL"), pbIsAOL); - } - __checkReturn HRESULT IsWin16(__out BOOL* pbIsWin16) - { - return GetBooleanPropertyValue(CComBSTR(L"Win16"), pbIsWin16); - } - __checkReturn HRESULT IsAK(__out BOOL* pbIsAK) - { - return GetBooleanPropertyValue(CComBSTR(L"AK"), pbIsAK); - } - __checkReturn HRESULT IsSK(__out BOOL* pbIsSK) - { - return GetBooleanPropertyValue(CComBSTR(L"SK"), pbIsSK); - } - __checkReturn HRESULT IsUpdate(__out BOOL* pbIsUpdate) - { - return GetBooleanPropertyValue(CComBSTR(L"Update"), pbIsUpdate); - } - - private: - CBrowserCapsSvc::BrowserCaps * m_pCaps; - }; -}; - -typedef DWORD_PTR HSESSIONENUM; - -// ISession -// Interface on a single client session. Used to access variables in the client -// session in the session state services. See atlsession.h for implementation of -// this interface. -__interface __declspec(uuid("DEB69BE3-7AC9-4a13-9519-266C1EA3AB39")) - ISession : public IUnknown -{ - STDMETHOD(SetVariable)(LPCSTR szName, VARIANT NewVal); - STDMETHOD(GetVariable)(LPCSTR szName, VARIANT *pVal); - STDMETHOD(GetCount)(long *pnCount); - STDMETHOD(RemoveVariable)(LPCSTR szName); - STDMETHOD(RemoveAllVariables)(); - STDMETHOD(BeginVariableEnum)(POSITION *pPOS, HSESSIONENUM *phEnumHandle); - STDMETHOD(GetNextVariable)(POSITION *pPOS, VARIANT *pVal, HSESSIONENUM hEnum, LPSTR szName, DWORD dwLen); - STDMETHOD(CloseEnum)(HSESSIONENUM hEnumHandle); - STDMETHOD(IsExpired)(); - STDMETHOD(SetTimeout)(unsigned __int64 dwNewTimeout); -}; //ISession - - -// ISessionStateService -// Interface on the session state service for an ISAPI application. Request -// handler objects will use this interface to access user sessions. See -// atlsession.h for implementation of this interface. -__interface __declspec(uuid("C5740C4F-0C6D-4b43-92C4-2AF778F35DDE")) - ISessionStateService : public IUnknown -{ - STDMETHOD(CreateNewSession)(LPSTR szNewID, DWORD *pdwSize, ISession** ppSession); - STDMETHOD(CreateNewSessionByName)(LPSTR szNewID, ISession** ppSession); - STDMETHOD(GetSession)(LPCSTR szID, ISession **ppSession); - STDMETHOD(CloseSession)(LPCSTR szID); -}; - -// ISessionStateControl -// Interface used by session state service to get information about the service. -// Currently you can get the count of active sessions and the current default -// timeout for a session. -__interface __declspec(uuid("6C7F5F56-6CBD-49ee-9797-4C837D4C527A")) - ISessionStateControl : public IUnknown -{ - STDMETHOD(SetSessionTimeout)(unsigned __int64 nTimeout); - STDMETHOD(GetSessionTimeout)(unsigned __int64 *pnTimeout); - STDMETHOD(GetSessionCount)(DWORD *pnSessionCount); -}; - -}; // namespace ATL -#pragma pack(pop) - -#endif // __ATLSIFACE_H__ diff --git a/include/atl/atlsmtpconnection.h b/include/atl/atlsmtpconnection.h deleted file mode 100644 index 5cda41d1d..000000000 --- a/include/atl/atlsmtpconnection.h +++ /dev/null @@ -1,926 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSMTPCONNECTION_H__ -#define __ATLSMTPCONNECTION_H__ - -#pragma once - -#ifndef _ATL_NO_DEFAULT_LIBS -#pragma comment(lib, "ws2_32.lib") -#endif // !_ATL_NO_DEFAULT_LIBS - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// SMTP Return Codes -#define ATLSMTP_MAIL_SUCCESS 250 -#define ATLSMTP_RCPT_SUCCESS 250 -#define ATLSMTP_RCPT_NOT_LOCAL 251 -#define ATLSMTP_DATA_INTERMEDIATE 354 - -#define ATLSMTP_CONN_SUCC "220" -#define ATLSMTP_HELO_SUCC "250" -#define ATLSMTP_MAIL_SUCC "250" -#define ATLSMTP_RCPT_SUCC "250" -#define ATLSMTP_RCPT_NLOC "251" -#define ATLSMTP_DATA_INTM "354" -#define ATLSMTP_DATA_SUCC "250" -#define ATLSMTP_RSET_SUCC "250" - -// SMTP flags -#define ATLSMTP_DUMP_SENDER 1 -#define ATLSMTP_DUMP_RECIPS 2 -#define ATLSMTP_FOR_SEND 4 - - -struct CSMTPWSAStartup -{ -private: - bool m_bInit; - -public: - CSMTPWSAStartup() throw() - :m_bInit(false) - { - Init(); - } - - ~CSMTPWSAStartup() throw() - { - Uninit(); - } - - bool Init() throw() - { - if (m_bInit) - return true; - - WSADATA wsadata; - if (WSAStartup(ATLSMTP_WSA_VERSION, &wsadata)) - return false; - m_bInit = true; - ATLASSERT(wsadata.wHighVersion >= 2); - return true; - } - - bool Uninit() throw() - { - if (m_bInit) - if (WSACleanup()) - return false; - m_bInit = false; - return true; - } -}; - -__declspec(selectany) CSMTPWSAStartup _g_smtp_init; - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -class CSMTPConnection -{ -protected: - - // the socket - SOCKET m_hSocket; - - // the OVERLAPPED struct - OVERLAPPED m_Overlapped; - -public: - - CSMTPConnection() throw() - :m_hSocket(INVALID_SOCKET) - { - // initialize the OVERLAPPED struct - memset(&m_Overlapped, 0, sizeof(OVERLAPPED)); - } - - ~CSMTPConnection() throw() - { - Disconnect(); - } - - // Attempt to connect to the socket - // lpszHostName - the host name to connect to - BOOL Connect(LPCTSTR lpszHostName, DWORD dwTimeout = 10000) throw() - { - ATLASSERT(lpszHostName != NULL); - - // If we're already connected - if (Connected()) - { - return FALSE; - } - - if (!_g_smtp_init.Init()) - { - return FALSE; - } - - CSocketAddr address; - if (address.FindAddr(lpszHostName, IPPORT_SMTP, 0, PF_UNSPEC, SOCK_STREAM, 0)) - { - return FALSE; - } - - ADDRINFOT *pAI; - - BOOL bRet = FALSE; - int nIndex = 0; - while ((pAI = address.GetAddrInfo(nIndex++)) != NULL) - { - // create the socket - m_hSocket = WSASocket(pAI->ai_family, pAI->ai_socktype, pAI->ai_protocol, NULL, 0, WSA_FLAG_OVERLAPPED); - - if (m_hSocket == INVALID_SOCKET) - { - return FALSE; - } - - bRet = FALSE; - WSAEVENT hEventConnect = WSACreateEvent(); - if (hEventConnect != NULL) - { - if (SOCKET_ERROR != WSAEventSelect(m_hSocket, hEventConnect, FD_CONNECT)) - { - if (WSAConnect(m_hSocket, pAI->ai_addr, (int)pAI->ai_addrlen, - NULL, NULL, NULL, NULL)) - { - if (WSAGetLastError() == WSAEWOULDBLOCK) - { - DWORD dwWait = WaitForSingleObject((HANDLE) hEventConnect, dwTimeout); - if (dwWait == WAIT_OBJECT_0) - { - // make sure there were no connection errors. - WSANETWORKEVENTS wse; - ZeroMemory(&wse, sizeof(wse)); - WSAEnumNetworkEvents(m_hSocket, NULL, &wse); - if (wse.iErrorCode[FD_CONNECT_BIT]==0) - { - bRet = TRUE; - } - } - } - } - } - - // we're done with the event - WSACloseEvent(hEventConnect); - } - if (bRet) - { - break; - } - - shutdown(m_hSocket, SD_BOTH); - closesocket(m_hSocket); - m_hSocket = INVALID_SOCKET; - } - - - // Create an event for asynchronous I/O - if (bRet) - { - ATLASSUME(m_Overlapped.hEvent == NULL); - m_Overlapped.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - if (m_Overlapped.hEvent == NULL) - { - bRet = FALSE; - } - } - - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - int nBufLen = ATLSMTP_MAX_LINE_LENGTH; - if (bRet) - { - // See if the connect returns success - bRet = AtlSmtpReadData((HANDLE)m_hSocket, szBuf, &nBufLen, &m_Overlapped); - if (bRet) - { - if (strncmp(szBuf, ATLSMTP_CONN_SUCC, ATLSMTP_RETCODE_LEN)) - { - bRet = FALSE; - } - } - } - - char szLocalHost[ATLSMTP_MAX_SERVER_NAME_LENGTH+1]; - - // gethostname should return 0 on success - if (bRet && gethostname(szLocalHost, ATLSMTP_MAX_SERVER_NAME_LENGTH)) - { - bRet = FALSE; - } - - // Send HELO command and get reply - if (bRet) - { - nBufLen = sprintf_s(szBuf, ATLSMTP_MAX_LINE_LENGTH+1, "HELO %s\r\n", szLocalHost); - if (nBufLen > 0) - { - bRet = AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, szBuf, &nBufLen, - ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_HELO_SUCC, &m_Overlapped); - } - else - { - bRet = FALSE; - } - } - - if (!bRet) - { - if (m_Overlapped.hEvent != NULL) - CloseHandle(m_Overlapped.hEvent); - shutdown(m_hSocket, SD_BOTH); - closesocket(m_hSocket); - m_hSocket = INVALID_SOCKET; - } - - return bRet; - } - - // Disconnect the socket - inline BOOL Disconnect() throw() - { - if (!Connected()) - { - return FALSE; - } - - // shutdown should return 0 on success - if (shutdown(m_hSocket, SD_BOTH)) - { - return FALSE; - } - - // closesocket should return 0 on success - if (closesocket(m_hSocket)) - { - return FALSE; - } - - // close the handle to the overlapped event - CloseHandle(m_Overlapped.hEvent); - m_hSocket = INVALID_SOCKET; - memset((void*)&m_Overlapped, 0, sizeof(OVERLAPPED)); - return TRUE; - } - - // Are we connected? - inline BOOL Connected() throw() - { - return (m_hSocket != INVALID_SOCKET ? TRUE : FALSE); - } - - // Send a message from a file - // lpszFileName - the file containing the message - // lpszRecipients - the recipients to send to (optional - if not specified, the recipients specified - // in the file will be used - // lpszSender - the sender (optional - if not specified, the recipients specified in the file - // will be used - BOOL SendMessage(LPCTSTR lpszFileName, LPCTSTR lpszRecipients = NULL, LPCTSTR lpszSender = NULL) throw() - { - if (!Connected()) - { - return FALSE; - } - - //Try to open the file - CAtlFile readFile; - if (FAILED(readFile.Create(lpszFileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL))) - { - return FALSE; - } - - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - int nBufLen = ATLSMTP_MAX_LINE_LENGTH; - BOOL bDumpedSender = FALSE; - - //If the caller specifies the sender, rather than having an existing one in the file... - if (lpszSender) - { - nBufLen = sprintf_s(szBuf, ATLSMTP_MAX_LINE_LENGTH+1, - "MAIL FROM:<%s>\r\n", (LPCSTR) CT2CA(lpszSender)); - if ((nBufLen < 0) || - (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, - ATLSMTP_MAIL_SUCC, &m_Overlapped))) - { - return FALSE; - } - bDumpedSender = TRUE; - } - nBufLen = ATLSMTP_MAX_LINE_LENGTH; - -#ifdef ATLSMTP_DOUBLE_BUFFERED - char buffer1[ATLSMTP_READBUFFER_SIZE]; - char buffer2[ATLSMTP_READBUFFER_SIZE]; - char* currBuffer = buffer1; - char* prevBuffer = NULL; - - int nCurrBuffer = 0; - DWORD dwPrevLength = 0; - DWORD dwWritten = 0; -#else - char bakBuffer[ATLSMTP_READBUFFER_SIZE]; - char* currBuffer = bakBuffer; - -#endif // ATLSMTP_DOUBLE_BUFFERED - DWORD dwRead = 0; - DWORD dwBytesInBuffer = 0; - DWORD dwBufPos = 0; - - //first handle the MAIL FROM and RCPT TO commands - BOOL bDumpedRecipients = FALSE; - BOOL bRet = TRUE; - while (bRet) - { - int nRetCode = 0; - - //if we have dumped the sender, and we have extra recipients to send, - //and we haven't alredy done so, do it - if (lpszRecipients && !bDumpedRecipients && bDumpedSender) - { - bRet = DumpRecipients((HANDLE)m_hSocket, CT2A(lpszRecipients), &m_Overlapped, ATLSMTP_FOR_SEND); - } - - if (bRet) - { - dwRead = 0; - BOOL bFullLine = FALSE; - bRet = ReadLine(readFile, currBuffer, szBuf, &dwBytesInBuffer, &dwBufPos, - ATLSMTP_READBUFFER_SIZE, ATLSMTP_MAX_LINE_LENGTH, &dwRead, &bFullLine); - if (dwRead == 0 || bFullLine == FALSE) - bRet = FALSE; - } - - if (bRet) - { - bRet = AtlSmtpSendAndWait((HANDLE)m_hSocket, szBuf, (int)(dwRead), &m_Overlapped); - } - - if (bRet) - { - nBufLen = ATLSMTP_MAX_LINE_LENGTH; - bRet = AtlSmtpReadData((HANDLE)m_hSocket, szBuf, &nBufLen, &m_Overlapped); - } - - if (bRet) - { - nRetCode = atoi(szBuf); - //if the command is equal to ATLSMTP_MAIL_SUCC (or RCPT_SUCC: they are equivalent) - if (nRetCode == ATLSMTP_MAIL_SUCCESS || nRetCode == ATLSMTP_RCPT_NOT_LOCAL || nRetCode == ATLSMTP_RCPT_SUCCESS) - { - bDumpedSender = TRUE; - continue; - } - - //If the command is equal to the data intermediate success code, - //break out of the loop - if (nRetCode == ATLSMTP_DATA_INTERMEDIATE) - break; - } - - //otherwise, we got an error code - CancelMessage(); - return FALSE; - } - - dwRead = dwBytesInBuffer; - currBuffer+= dwBufPos; - DWORD dwErr = 0; - do - { - dwErr = 0; - - //Try to send the data -#ifdef ATLSMTP_DOUBLE_BUFFERED - if (!AtlSmtpSendOverlapped((HANDLE)m_hSocket, currBuffer, dwRead, prevBuffer, dwPrevLength, &m_Overlapped)) - { - bRet = FALSE; - break; - } -#else - if (!AtlSmtpSendAndWait((HANDLE)m_hSocket, currBuffer, dwRead, &m_Overlapped)) - { - bRet = FALSE; - break; - } -#endif // ATLSMTP_DOUBLE_BUFFERED - - //swap the current and previous buffer -#ifdef ATLSMTP_DOUBLE_BUFFERED - prevBuffer = currBuffer; - currBuffer = (nCurrBuffer == 0 ? buffer2 : buffer1); - nCurrBuffer = (nCurrBuffer == 0 ? 1 : 0); - dwPrevLength = dwBytesInBuffer; -#else - currBuffer = bakBuffer; -#endif // ATLSMTP_DOUBLE_BUFFERED - - if (FAILED(readFile.Read(currBuffer, ATLSMTP_READBUFFER_SIZE, dwRead))) - { - bRet = FALSE; - break; - } - } while (dwRead != 0); - - //ensure that the last of the data is sent -#ifdef ATLSMTP_DOUBLE_BUFFERED - if (!GetOverlappedResult((HANDLE)m_hSocket, &m_Overlapped, &dwWritten, TRUE)) - { - if ((dwErr = GetLastError()) != ERROR_IO_PENDING && dwErr != ERROR_IO_INCOMPLETE) - bRet = FALSE; - else if (dwWritten < dwPrevLength) - bRet = AtlSmtpSendAndWait((HANDLE)m_hSocket, prevBuffer+dwWritten, dwPrevLength-dwWritten, &m_Overlapped); - } -#endif // ATLSMTP_DOUBLE_BUFFERED - - - if (bRet) - { - // End the message with a CRLF.CRLF - nBufLen = sprintf_s(szBuf, _countof(szBuf), "\r\n.\r\n"); - if (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_DATA_SUCC, &m_Overlapped)) - { - bRet = FALSE; - } - } - - return bRet; - } - - // Send the message - // msg - the CMimeMessage to send - // lpszSender - the sender - inline BOOL SendMessage(CMimeMessage& msg, LPCTSTR lpszRecipients = NULL, LPCTSTR lpszSender = NULL) throw() - { - if (!Connected()) - { - return FALSE; - } - - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - - //Send MAIL FROM command and get reply - int nBufLen = sprintf_s(szBuf, ATLSMTP_MAX_LINE_LENGTH+1, "MAIL FROM:<%s>\r\n", - (lpszSender ? (LPCSTR) CT2CA(lpszSender) : msg.GetSender())); - if ((nBufLen < 0) || - (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_MAIL_SUCC, &m_Overlapped))) - { - return FALSE; - } - - BOOL bRet = TRUE; - if (!lpszRecipients) - { - LPSTR lpszRecipientsA = NULL; - DWORD dwLen = msg.GetRequiredRecipientsStringLength(); - lpszRecipientsA = static_cast(calloc(sizeof(char),dwLen)); - if (!lpszRecipientsA || msg.GetRecipientsString(lpszRecipientsA, &dwLen) == FALSE) - { - bRet = FALSE; - } - if (bRet) - bRet = DumpRecipients((HANDLE)m_hSocket, lpszRecipientsA, &m_Overlapped, ATLSMTP_FOR_SEND); - free(lpszRecipientsA); - } - else - { - bRet = DumpRecipients((HANDLE)m_hSocket, CT2CA(lpszRecipients), - &m_Overlapped, ATLSMTP_FOR_SEND); - } - - //Begin the data output - if (bRet) - { - nBufLen = sprintf_s(szBuf, _countof(szBuf), "DATA\r\n"); - bRet = AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_DATA_INTM, &m_Overlapped); - } - - if (!bRet) - CancelMessage(); - - //Attempt to write the data to the socket - if (bRet) - { - bRet = msg.WriteData((HANDLE)m_hSocket, &m_Overlapped, NULL, ATLSMTP_FORMAT_SMTP); - } - - if (bRet) - { - //End the message with a . - nBufLen = sprintf_s(szBuf, _countof(szBuf), "\r\n.\r\n"); - if (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_DATA_SUCC, &m_Overlapped)) - { - return FALSE; - } - } - - return bRet; - } - - // Send a chunk of raw data - inline BOOL SendRaw(LPCTSTR lpszRawData, DWORD dwLen, LPCTSTR lpszRecipients, LPCTSTR lpszSender) throw() - { - ATLASSERT(lpszRawData != NULL); - ATLASSERT(lpszRecipients != NULL); - ATLASSERT(lpszSender != NULL); - - if (!Connected()) - return FALSE; - - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - - //Send MAIL FROM command and get reply - int nBufLen = sprintf_s(szBuf, ATLSMTP_MAX_LINE_LENGTH+1, - "MAIL FROM:<%s>\r\n", (LPCSTR) CT2CA(lpszSender)); - if ((nBufLen < 0) || - (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_MAIL_SUCC, &m_Overlapped))) - { - return FALSE; - } - - BOOL bRet = DumpRecipients((HANDLE)m_hSocket, CT2CA(lpszRecipients), - &m_Overlapped, ATLSMTP_FOR_SEND); - - // Begin the data output - if (bRet) - { - nBufLen = sprintf_s(szBuf, _countof(szBuf), "DATA\r\n"); - bRet = AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_DATA_INTM, &m_Overlapped); - } - - if (!bRet) - CancelMessage(); - - if (bRet) - { - bRet = AtlSmtpSendAndWait((HANDLE)m_hSocket, (LPSTR)(lpszRawData), dwLen, &m_Overlapped); - } - - if (bRet) - { - //End the message with a . - nBufLen = sprintf_s(szBuf, _countof(szBuf), "\r\n.\r\n"); - if (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, - szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, ATLSMTP_DATA_SUCC, &m_Overlapped)) - { - return FALSE; - } - } - - return bRet; - } - - inline BOOL SendSimple(LPCTSTR lpszRecipients, LPCTSTR lpszSender, LPCTSTR lpszSubject, LPCTSTR lpszBody, int nTextLen = -1) throw() - { - CMimeMessage msg; - BOOL bRet = msg.SetSubject(lpszSubject); - if (bRet) - bRet = msg.AddText(lpszBody, nTextLen); - - CFixedStringT strRecip; - LPCTSTR szTmp = lpszRecipients; - LPCTSTR szTmp2 = lpszRecipients; - while (*szTmp && bRet) - { - if (AtlSmtpIsRecipientDelimiter((char) *szTmp2)) - { - _ATLTRY - { - strRecip.SetString(szTmp, (int)(szTmp2-szTmp)); - bRet = msg.AddRecipient((LPCTSTR) strRecip); - - if (*szTmp2) - { - while (*szTmp2 && AtlSmtpIsRecipientDelimiter((char) *szTmp2)) - { - szTmp2++; - } - } - szTmp = szTmp2; - } - _ATLCATCHALL() - { - bRet = FALSE; - } - } - else - { - szTmp2++; - } - } - - if (bRet) - bRet = SendMessage(msg, lpszRecipients, lpszSender); - - return bRet; - } - - // Save a MIME message to a file - // lpszFileName - the file name - // lpszRecipients - the recipients string (optional) - // lpszSender - the sender (optional) - // dwFlags - the flags (optional) - inline BOOL WriteToFile(LPCTSTR lpszFileName, CMimeMessage& msg, LPCTSTR lpszRecipients = NULL, - LPCTSTR lpszSender = NULL, DWORD dwFlags = 0) throw() - { - //Try to create/open the file - HANDLE hFile = CreateFile(lpszFileName, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); - - if (hFile == INVALID_HANDLE_VALUE) - { - return FALSE; - } - - // Use CHandle to close the file handle - // (CAtlFile does not allow for overlapped I/O) - CHandle hdlFile(hFile); - - //Create and initialize the OVERLAPPED struct - OVERLAPPED writeOverlapped; - memset((void*)&writeOverlapped, 0, sizeof(OVERLAPPED)); - writeOverlapped.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - if (writeOverlapped.hEvent == NULL) - { - return FALSE; - } - - // Use CHandle to close the event handle - CHandle hdlEvent(writeOverlapped.hEvent); - - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - BOOL bRet = TRUE; - - int nBufLen = 0; - - //if writing to file for purposes of sending, write out the - //commands as well - if (lpszSender || (dwFlags & ATLSMTP_DUMP_SENDER)) - { - nBufLen = sprintf_s(szBuf, ATLSMTP_MAX_LINE_LENGTH+1, "MAIL FROM:<%s>\r\n", - (lpszSender ? (LPCSTR) CT2CA(lpszSender) : msg.GetSender())); - if (nBufLen > 0) - { - bRet = AtlSmtpSendAndWait(hFile, szBuf, nBufLen, &writeOverlapped); - } - else - { - bRet = FALSE; - } - } - - if (bRet && (lpszRecipients || (dwFlags & ATLSMTP_DUMP_RECIPS))) - { - if (!lpszRecipients) - { - LPSTR lpszRecipientsA = NULL; - DWORD dwLen = msg.GetRequiredRecipientsStringLength(); - lpszRecipientsA = static_cast(calloc(sizeof(char),dwLen)); - if (!lpszRecipientsA || msg.GetRecipientsString(lpszRecipientsA, &dwLen) == FALSE) - { - bRet = FALSE; - } - if (bRet) - bRet = DumpRecipients(hFile, lpszRecipientsA, &writeOverlapped); - free(lpszRecipientsA); - } - else - { - bRet = DumpRecipients(hFile, CT2CA(lpszRecipients), &writeOverlapped); - } - } - - if (bRet) - { - nBufLen = sprintf_s(szBuf, _countof(szBuf), "DATA\r\n"); - bRet = AtlSmtpSendAndWait(hFile, szBuf, nBufLen, &writeOverlapped); - } - - if (bRet) - { - bRet = msg.WriteData(hFile, &writeOverlapped, NULL, ATLSMTP_FORMAT_SMTP); - } - - return bRet; - } - -protected: - - // disallow copy construction - CSMTPConnection(const CSMTPConnection&) throw() - { - ATLASSERT(FALSE); - } - - // disallow assignment - const CSMTPConnection& operator=(const CSMTPConnection&) throw() - { - ATLASSERT(FALSE); - return *this; - } - - // Tell the server we are aborting the message - inline BOOL CancelMessage() throw() - { - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - int nBufLen = 0; - nBufLen = sprintf_s(szBuf, _countof(szBuf), "RSET\r\n"); - if (!AtlSmtpSendAndCheck((HANDLE)m_hSocket, szBuf, nBufLen, szBuf, &nBufLen, ATLSMTP_MAX_LINE_LENGTH, - ATLSMTP_RSET_SUCC, &m_Overlapped)) - { - Disconnect(); - return FALSE; - } - return TRUE; - } - - // Dump the recipients to hFile - // lpszRecipients - the recipients string - // pOverlapped - the OVERALAPPED struct - // dwFlags - the flags - inline BOOL DumpRecipients(HANDLE hFile, LPCSTR lpszRecipients, LPOVERLAPPED pOverlapped, DWORD dwFlags = 0) - { - ATLENSURE(lpszRecipients != NULL); - ATLASSERT(pOverlapped != NULL); - - char rcptBuf[ATLSMTP_MAX_LINE_LENGTH-12+1]; - char szBuf[ATLSMTP_MAX_LINE_LENGTH+1]; - LPSTR tmpBuf = rcptBuf; - char ch; - BOOL bRet = TRUE; - int nMaxLength = ATLSMTP_MAX_LINE_LENGTH; - int nRetCode = 0; - size_t nCnt = 0; - do - { - ch = *lpszRecipients; - if (ch) - lpszRecipients++; - if (AtlSmtpIsRecipientDelimiter(ch)) - { - *tmpBuf = 0; - int nBufLen = sprintf_s(szBuf, ATLSMTP_MAX_LINE_LENGTH, - "RCPT TO:<%s>\r\n", rcptBuf); - if (nBufLen > 0) - { - bRet = AtlSmtpSendAndWait(hFile, szBuf, nBufLen, pOverlapped); - } - else - { - bRet = FALSE; - } - - if (bRet && (dwFlags & ATLSMTP_FOR_SEND)) - { - bRet = AtlSmtpReadData(hFile, szBuf, &nMaxLength, pOverlapped); - nRetCode = atoi(szBuf); - if (!bRet || (nRetCode != ATLSMTP_RCPT_SUCCESS && nRetCode != ATLSMTP_RCPT_NOT_LOCAL)) - { - bRet = FALSE; - break; - } - } - tmpBuf = rcptBuf; - nCnt = 0; - nMaxLength = ATLSMTP_MAX_LINE_LENGTH; - while (isspace(static_cast(*lpszRecipients))) - lpszRecipients++; - continue; - } - - if (nCnt >= sizeof(rcptBuf)-1) - { - // recipient string too long - bRet = FALSE; - break; - } - - *tmpBuf++ = ch; - nCnt++; - } while (ch != '\0'); - - return bRet; - } - - // Implementation - used from ReadLine - // fills pBuf with up to dwMaxLen bytes - BOOL FillBuffer(__in HANDLE hFile, __out_ecount_part(dwMaxLen, *pdwLen) LPSTR pBuf, __in DWORD dwMaxLen, __out LPDWORD pdwLen) throw() - { - ATLASSERT(hFile != INVALID_HANDLE_VALUE); - ATLASSERT(pdwLen != NULL); - - DWORD dwRead = 0; - DWORD dwTotalRead = 0; - int nRet = 0; - - do - { - nRet = ReadFile(hFile, pBuf, dwMaxLen-dwTotalRead, &dwRead, NULL); - if (!nRet && GetLastError() != ERROR_HANDLE_EOF) - { - return FALSE; - } - - if (dwRead == 0) - break; - - dwTotalRead+= dwRead; - } while (dwTotalRead < dwMaxLen); - - *pdwLen = dwTotalRead; - - return TRUE; - } - - // Implementation - // Read a line (terminated by LF) from hFile - BOOL ReadLine(__in HANDLE hFile, __out_ecount_part_z(dwMaxSrcLen, *pdwSrcLen) LPSTR pSrc, __out_ecount_part_z(dwMaxDestLen, *pdwRead) LPSTR pDest, __inout LPDWORD pdwSrcLen, __inout LPDWORD pdwBufPos, __in DWORD dwMaxSrcLen, - __in DWORD dwMaxDestLen, __out_opt LPDWORD pdwRead=NULL, __out_opt LPBOOL pbFullLine=NULL) - { - ATLENSURE(hFile != INVALID_HANDLE_VALUE); - ATLENSURE(pSrc != NULL); - ATLENSURE(pDest != NULL); - ATLENSURE(pdwSrcLen != NULL); - ATLENSURE(pdwBufPos != NULL); - - BOOL bRet = TRUE; - DWORD dwLen = 0; - DWORD dwBufPos = 0; - DWORD dwSrcLen = *pdwSrcLen; - LPSTR pSrcCurrent = pSrc + *pdwBufPos; - - while (bRet && dwLen < dwMaxDestLen) - { - if (dwSrcLen == 0) - { - if (!FillBuffer(hFile, pSrc, dwMaxSrcLen, pdwSrcLen) || *pdwSrcLen == 0) - break; - - dwBufPos = 0; - *pdwBufPos = 0; - dwSrcLen = *pdwSrcLen; - pSrcCurrent = pSrc; - } - - --dwSrcLen; - *pDest = *pSrcCurrent++; - dwLen++; - dwBufPos++; - if (*pDest == '\n') - { - break; - } - pDest++; - } - - *pdwSrcLen = dwSrcLen; - - if (pbFullLine) - { - if (*pDest != '\n') - *pbFullLine = FALSE; - else - *pbFullLine = TRUE; - } - - if (pdwRead) - *pdwRead = dwLen; - - *pdwBufPos += dwBufPos; - - return bRet; - } - -}; // class CSMTPConnection - -} // namespace ATL -#pragma pack(pop) - -#endif // __ATLSMTPCONNECTION_H__ diff --git a/include/atl/atlsmtputil.h b/include/atl/atlsmtputil.h deleted file mode 100644 index 6ce443861..000000000 --- a/include/atl/atlsmtputil.h +++ /dev/null @@ -1,220 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSMTPUTIL_H__ -#define __ATLSMTPUTIL_H__ - -#pragma once - -#if (defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)) -#error requires -- include before you include or -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//defines for SMTPMail module -//======================================================================= - -//If overlapped I/O is desired, need 2.0 or greater -#define ATLSMTP_WSA_VERSION ATL_WINSOCK_VER - -//The maximum number of characters on a SMTP line -#define ATLSMTP_MAX_LINE_LENGTH 1000 - -#define ATLSMTP_MAX_SERVER_NAME_LENGTH 256 - -//Encoding schemes -#define ATLSMTP_BASE64_ENCODE 0 -#define ATLSMTP_UUENCODE 1 -#define ATLSMTP_QP_ENCODE 2 - -//I/O Defines -#define ATLSMTP_READBUFFER_SIZE 4096 -#define ATLSMTP_GET_LINES 100 - - -//Miscellaneous defines -#define ATLSMTP_SEND_FILE 1 -#define ATLSMTP_FORMAT_SMTP 8 - -#define ATLSMTP_RETCODE_LEN 3 - - -#pragma pack(push,_ATL_PACKING) -namespace ATL -{ - -//======================================================================= -// Miscellaneous Utility Functions -//======================================================================= -//A list of recipients in a string must by separated by one -//of the following characters -inline BOOL AtlSmtpIsRecipientDelimiter(char ch) throw() -{ - return (ch == ',' || ch == ';' || ch == ' ' || ch == '\0'); -} - -//Send data to hFile and wait for it to finish sending -inline BOOL AtlSmtpSendAndWait(HANDLE hFile, LPCSTR lpData, int nDataLength, LPOVERLAPPED pOverlapped) throw() -{ - ATLASSERT(lpData != NULL); - ATLENSURE_RETURN_VAL(pOverlapped != NULL, FALSE); - - DWORD dwWritten = 0, dwErr = 0; - int nRet = 0, nBufPos = 0; - - //write all the data - do - { - //Write a chunk of data, offsetting the buffer and amount to write by what's already - //been written - nRet = WriteFile(hFile, (void*)(lpData+nBufPos), nDataLength-nBufPos, &dwWritten, pOverlapped); - if (!nRet && (dwErr = GetLastError()) != ERROR_IO_INCOMPLETE && dwErr != ERROR_IO_PENDING) - return FALSE; - - //Get the result of the write operation (wait for it) - nRet = GetOverlappedResult(hFile, pOverlapped, &dwWritten, TRUE); - if (!nRet) - return FALSE; - - //Need to update offsets when writing to a file - pOverlapped->Offset += dwWritten; - nBufPos += dwWritten; - - } while (nBufPos < nDataLength); - return TRUE; -} - - -//Read up to nDestLen bytes from hFile, keep reading while there's more data and there's -//room in the buffer -inline BOOL AtlSmtpReadData(__in HANDLE hFile, __out_ecount_part_z(*pnDestLen, *pnDestLen) LPSTR lpData, __inout int* pnDestLen, __in LPOVERLAPPED pOverlapped) -{ - ATLASSERT(lpData != NULL); - ATLASSERT(pnDestLen != NULL); - ATLENSURE(pOverlapped != NULL); - - DWORD dwRead = 0, dwErr = 0; - int nBufPos = 0; - do - { - //REad a chunk of data, offsetting the buffer and amount to read by what's already been read - int nRet = ReadFile(hFile, (void*)(lpData+nBufPos), (*pnDestLen)-nBufPos, &dwRead, pOverlapped); - if (!nRet && (dwErr = GetLastError()) != ERROR_MORE_DATA && dwErr != ERROR_IO_PENDING && dwErr != ERROR_IO_INCOMPLETE) - return FALSE; - - //Get the result of the read operation (wait for it) - nRet = GetOverlappedResult(hFile, pOverlapped, &dwRead, TRUE); - if (!nRet) - return FALSE; - - //Handle offsets when reading from a file - pOverlapped->Offset += dwRead; - nBufPos += dwRead; - } while (nBufPos < *pnDestLen && dwErr == ERROR_MORE_DATA); - *pnDestLen = nBufPos; - return TRUE; -} - - -//Used in sending encoded data -//lpData is the data to be sent now -//lpPrev is a pointer to the buffer that the previous call was made on -//This allows the new buffer (lpData) to be filled while lpPrev is being sent -//If all the data in lpPrev had not finished sending, we complete the send and wait -inline BOOL AtlSmtpSendOverlapped(HANDLE hFile, LPCSTR lpData, int nDataLength, LPCSTR lpPrev, DWORD dwPrevLength, LPOVERLAPPED pOverlapped) -{ - ATLASSERT(lpData != NULL); - ATLENSURE(pOverlapped != NULL); - - DWORD dwWritten = 0, dwErr = 0, dwBufPos = 0; - int nRet = 0; - - //Get the results of the previous call (if any) - if (lpPrev && (!GetOverlappedResult(hFile, pOverlapped, &dwWritten, FALSE) || dwWritten < dwPrevLength)) - { - //If any error but IO_INCOMPLETE, return failure - if ((dwErr = GetLastError()) != ERROR_SUCCESS && dwErr != ERROR_IO_INCOMPLETE && dwErr != ERROR_IO_PENDING) - { - return FALSE; - } - //Finish writing lpPrev if we need to - while (dwBufPos < dwPrevLength) - { - //Get the result of the previous write (wait for it) - nRet = GetOverlappedResult(hFile, pOverlapped, &dwWritten, TRUE); - if (!nRet || (dwBufPos += dwWritten) == dwPrevLength) - { - if ((dwErr = GetLastError()) != ERROR_IO_INCOMPLETE && dwErr != ERROR_IO_PENDING) - break; - } - - //If we are writing to a file, we need to update the offsets - pOverlapped->Offset += dwWritten; - if(dwBufPos>dwPrevLength) - { - /* shouldn't happen */ - ATLASSERT(false); - break; - } - nRet = WriteFile(hFile, (void*)(lpPrev+dwBufPos), dwPrevLength-dwBufPos, &dwWritten, pOverlapped); - - //If any error but IO_PENDING and IO_INCOMPLETE, break - if (!nRet && (dwErr = GetLastError()) != ERROR_IO_PENDING && dwErr != ERROR_IO_INCOMPLETE) - break; - } - if (dwBufPos < dwPrevLength) - return FALSE; - } - - //Now that all the previous data has been sent, start sending the current data - nRet = WriteFile(hFile, (void*)lpData, nDataLength, &dwWritten, pOverlapped); - GetOverlappedResult(hFile, pOverlapped, &dwWritten, FALSE); - - pOverlapped->Offset += dwWritten; - - //If any error but IO_PENDING - if (!nRet && (dwErr = GetLastError()) != ERROR_IO_PENDING && dwErr != ERROR_IO_INCOMPLETE) - return FALSE; - return TRUE; -} - - -//Send a SMTP command and read the response -//return TRUE if it matches szResponse, FALSE otherwise -inline BOOL AtlSmtpSendAndCheck(__in HANDLE hFile, __in LPCSTR lpData, __in int nDataLength, __out_ecount_part(nMaxResponseLength, *pnResponseLength) LPSTR lpResponse, __out int* pnResponseLength, __in int nMaxResponseLength, - __in_z LPCSTR szResponse, __in LPOVERLAPPED pOverlapped) throw() -{ - ATLASSERT(lpData != NULL); - ATLASSERT(lpResponse != NULL); - ATLASSERT(pnResponseLength != NULL); - - BOOL bRet = AtlSmtpSendAndWait(hFile, lpData, nDataLength, pOverlapped); - if (bRet) - { - *pnResponseLength = nMaxResponseLength; - bRet = AtlSmtpReadData(hFile, lpResponse, pnResponseLength, pOverlapped); - } - if (!bRet || strncmp((char*)lpResponse, szResponse, ATLSMTP_RETCODE_LEN)) - return FALSE; - return TRUE; -} - -} // namespace ATL -#pragma pack(pop) - -#endif // __ATLSMTPUTIL_H__ diff --git a/include/atl/atlsoap.h b/include/atl/atlsoap.h deleted file mode 100644 index b286e7c61..000000000 --- a/include/atl/atlsoap.h +++ /dev/null @@ -1,8174 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSOAP_H__ -#define __ATLSOAP_H__ - -#pragma once - -#if (defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)) - #error require winsock2.h -- include before you include -#endif - -#if ((_WIN32_WINNT < 0x0400) && (_WIN32_WINDOWS <= 0x0400)) - #error require _WIN32_WINNT >= 0x0400 or _WIN32_WINDOWS > 0x0400 -#endif - -#ifndef ATLSOAP_TRACE - #ifdef _ATLSOAP_TRACE_XML - #define ATLSOAP_TRACE(__data, __len) AtlSoapTraceXML(__data, __len) - #else - #define ATLSOAP_TRACE(__data, __len) __noop - #endif -#endif // ATLSOAP_TRACE - -// override this macro to ATL_BASE64_FLAG_NOCRLF if you do -// not want Base64-encoded binary data to contain CRLFs -#ifndef ATLSOAP_BASE64_FLAGS - #define ATLSOAP_BASE64_FLAGS ATL_BASE64_FLAG_NONE -#endif // ATLSOAP_BASE64_FLAGS - -[ emitidl(restricted) ]; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma warning(push) -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible -#pragma warning(disable: 4061) // enumerate 'enum value' in switch of enum 'enum type' is not explicitly handled by a case label - -#ifndef _CPPUNWIND -#pragma warning(disable: 4702) // unreachable code -#endif // _CPPUNWIND - -#ifndef ATLSOAP_NOWININET - #include - #ifndef ATLSOAPINET_CLIENT - #define ATLSOAPINET_CLIENT _T("VCSoapClient") - #endif -#endif - -#ifndef _ATL_NO_DEFAULT_LIBS -#pragma comment(lib, "msxml2.lib") - #ifndef ATLSOAP_NOWININET - #pragma comment(lib, "wininet.lib") - #endif -#endif - -#define _ATLSOAP_MAKEWIDESTR( str ) L ## str -#define ATLSOAP_MAKEWIDESTR( str ) _ATLSOAP_MAKEWIDESTR( str ) - - -#pragma pack(push,_ATL_PACKING) -namespace ATL -{ - -ATL_NOINLINE inline void AtlSoapTraceXML(LPBYTE pdwData, DWORD dwLen) -{ - HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); - if (hStdOut != INVALID_HANDLE_VALUE) - { - DWORD dwWritten; - WriteFile(hStdOut, - "\n-----------------------------------------------------------------\n", - sizeof("\n-----------------------------------------------------------------\n")-1, - &dwWritten, NULL); - - WriteFile(hStdOut, pdwData, dwLen, &dwWritten, NULL); - - WriteFile(hStdOut, - "\n-----------------------------------------------------------------\n", - sizeof("\n-----------------------------------------------------------------\n")-1, - &dwWritten, NULL); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -// IStreamImpl - stub IStream implementation class -// -//////////////////////////////////////////////////////////////////////////////// - -class IStreamImpl : public IStream -{ -public: - - HRESULT __stdcall Read(void * /*pDest*/, ULONG /*nMaxLen*/, ULONG * /*pnRead*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall Write(const void * /*pv*/, ULONG /*cb*/, ULONG * /*pcbWritten*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall Seek(LARGE_INTEGER /*dlibMove*/, DWORD /*dwOrigin*/, - ULARGE_INTEGER * /*pLibNewPosition*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall SetSize(ULARGE_INTEGER /*libNewSize*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall CopyTo(IStream * /*pStream*/, ULARGE_INTEGER /*cb*/, - ULARGE_INTEGER * /*pcbRead*/, ULARGE_INTEGER * /*pcbWritten*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall Commit(DWORD /*grfCommitFlags*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall Revert() - { - return E_NOTIMPL; - } - - HRESULT __stdcall LockRegion(ULARGE_INTEGER /*libOffset*/, ULARGE_INTEGER /*cb*/, DWORD /*dwLockType*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall UnlockRegion(ULARGE_INTEGER /*libOffset*/, ULARGE_INTEGER /*cb*/, DWORD /*dwLockType*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall Stat(STATSTG * /*pstatstg*/, DWORD /*grfStatFlag*/) - { - return E_NOTIMPL; - } - - HRESULT __stdcall Clone(IStream ** /*ppstm*/) - { - return E_NOTIMPL; - } -}; // class IStreamImpl - -//////////////////////////////////////////////////////////////////////////////// -// -// CStreamOnServerContext -// -//////////////////////////////////////////////////////////////////////////////// - -class CStreamOnServerContext : public IStreamImpl -{ -public: - - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - - *ppv = NULL; - - if (InlineIsEqualGUID(riid, IID_IUnknown) || - InlineIsEqualGUID(riid, IID_IStream) || - InlineIsEqualGUID(riid, IID_ISequentialStream)) - { - *ppv = static_cast(this); - return S_OK; - } - - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - -private: - - IHttpServerContext * m_pServerContext; - DWORD m_dwBytesRead; - -public: - - CStreamOnServerContext(IHttpServerContext *pServerContext = NULL) - : m_pServerContext(pServerContext), m_dwBytesRead(0) - { - } - - void SetServerContext(IHttpServerContext *pServerContext) - { - ATLASSUME( m_pServerContext == NULL ); - - m_pServerContext = pServerContext; - } - - HRESULT __stdcall Read(void *pDest, ULONG nMaxLen, ULONG *pnRead) - { - ATLENSURE( pDest != NULL ); - ATLASSUME( m_pServerContext != NULL ); - - DWORD dwToRead = __min(m_pServerContext->GetTotalBytes()-m_dwBytesRead, nMaxLen); - if (ReadClientData(m_pServerContext, (LPSTR) pDest, &dwToRead, m_dwBytesRead) != FALSE) - { - m_dwBytesRead+= dwToRead; - - if (pnRead != NULL) - { - *pnRead = dwToRead; - } - - return S_OK; - } - - ATLTRACE( _T("ATLSOAP: CStreamOnServerContext::Read -- ReadClientData failed.\r\n") ); - - return E_FAIL; - } -}; // class CStreamOnServerContext - -//////////////////////////////////////////////////////////////////////////////// -// -// CReadStreamOnSocket -// -//////////////////////////////////////////////////////////////////////////////// - -template -class CReadStreamOnSocket : public IStreamImpl -{ -public: - - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - - *ppv = NULL; - - if (InlineIsEqualGUID(riid, IID_IUnknown) || - InlineIsEqualGUID(riid, IID_IStream) || - InlineIsEqualGUID(riid, IID_ISequentialStream)) - { - *ppv = static_cast(this); - return S_OK; - } - - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - -private: - - CAtlHttpClientT * m_pSocket; - LPCSTR m_szBuffer; - LPCSTR m_szCurr; - long m_nBodyLen; - -public: - - CReadStreamOnSocket() - : m_pSocket(NULL), m_szBuffer(NULL), m_szCurr(NULL), m_nBodyLen(0) - { - } - - BOOL Init(CAtlHttpClientT *pSocket) - { - ATLENSURE( pSocket != NULL ); - - m_pSocket = pSocket; - m_szBuffer = (LPCSTR) pSocket->GetBody(); - - ATLSOAP_TRACE( (LPBYTE) pSocket->GetBody(), pSocket->GetBodyLength() ); - - if (m_szBuffer != NULL) - { - m_szCurr = m_szBuffer; - m_nBodyLen = pSocket->GetBodyLength(); - if (m_nBodyLen != 0) - { - return TRUE; - } - } - - ATLTRACE( _T("ATLSOAP: CReadStreamOnSocket::Init failed.\r\n") ); - - return FALSE; - } - - HRESULT __stdcall Read(void *pDest, ULONG nMaxLen, ULONG *pnRead) - { - ATLASSERT( pDest != NULL ); - ATLASSUME( m_pSocket != NULL ); - ATLASSUME( m_szBuffer != NULL ); - - if (pnRead != NULL) - { - *pnRead = 0; - } - - long nRead = (int) (m_szCurr-m_szBuffer); - if (nRead < m_nBodyLen) - { - long nLength = __min((int)(m_nBodyLen-nRead), (LONG) nMaxLen); - Checked::memcpy_s(pDest, nMaxLen, m_szCurr, nLength); - m_szCurr+= nLength; - - if (pnRead != NULL) - { - *pnRead = (ULONG) nLength; - } - } - - return S_OK; - } -}; // class CReadStreamOnSocket - -//////////////////////////////////////////////////////////////////////////////// -// -// CWriteStreamOnCString -// -//////////////////////////////////////////////////////////////////////////////// - -class CWriteStreamOnCString : public IWriteStream -{ - -public: - CStringA m_str; - - virtual ~CWriteStreamOnCString() - { - } - - HRESULT WriteStream(LPCSTR szOut, int nLen, LPDWORD pdwWritten) - { - ATLENSURE_RETURN( szOut != NULL ); - - if (nLen < 0) - { - nLen = (int) strlen(szOut); - } - - _ATLTRY - { - m_str.Append(szOut, nLen); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - if (pdwWritten != NULL) - { - *pdwWritten = (DWORD) nLen; - } - - return S_OK; - } - - HRESULT FlushStream() - { - return S_OK; - } - - void Cleanup() - { - m_str.Empty(); - } -}; // class CWriteStreamOnCString - -//////////////////////////////////////////////////////////////////////////////// -// -// Namespaces -// -//////////////////////////////////////////////////////////////////////////////// - -#define SOAPENV_NAMESPACEA "http://schemas.xmlsoap.org/soap/envelope/" -#define SOAPENV_NAMESPACEW ATLSOAP_MAKEWIDESTR( SOAPENV_NAMESPACEA ) - -#define SOAPENC_NAMESPACEA "http://schemas.xmlsoap.org/soap/encoding/" -#define SOAPENC_NAMESPACEW ATLSOAP_MAKEWIDESTR( SOAPENC_NAMESPACEA ) - -#define XSI_NAMESPACEA "http://www.w3.org/2001/XMLSchema-instance" -#define XSI_NAMESPACEW ATLSOAP_MAKEWIDESTR( XSI_NAMESPACEA ) - -#define XSD_NAMESPACEA "http://www.w3.org/2001/XMLSchema" -#define XSD_NAMESPACEW ATLSOAP_MAKEWIDESTR( XSD_NAMESPACEA ) - -#ifndef ATLSOAP_GENERIC_NAMESPACE -#define ATLSOAP_GENERIC_NAMESPACE L"http://www.tempuri.org" -#endif - -//////////////////////////////////////////////////////////////////////////////// -// -// Helpers -// -//////////////////////////////////////////////////////////////////////////////// - -inline HRESULT GetAttribute( - __in ISAXAttributes *pAttributes, - __in_ecount(cchName) const wchar_t *wszAttrName, __in int cchName, - __out_ecount_part(*pcchValue, *pcchValue) const wchar_t **pwszValue, __inout int *pcchValue, - __in_ecount_opt(cchNamespace) wchar_t *wszNamespace = NULL, __in int cchNamespace = 0) -{ - if (!pAttributes || !wszAttrName || !pwszValue || !pcchValue) - { - return E_INVALIDARG; - } - - *pwszValue = NULL; - *pcchValue = 0; - if (!wszNamespace) - { - return (pAttributes->getValueFromQName(wszAttrName, cchName, pwszValue, pcchValue) == S_OK ? S_OK : E_FAIL); - } - return (pAttributes->getValueFromName(wszNamespace, cchNamespace, - wszAttrName, cchName, pwszValue, pcchValue) == S_OK ? S_OK : E_FAIL); -} - -inline HRESULT GetAttribute( - __in ISAXAttributes *pAttributes, - __in_ecount(cchName) const wchar_t *wszAttrName, __in int cchName, - __inout CStringW &strValue, - __in_ecount_opt(cchNamespace) wchar_t *wszNamespace = NULL, __in int cchNamespace = 0) -{ - const wchar_t *wszValue = NULL; - int cchValue = 0; - - if (!pAttributes || !wszAttrName) - { - return E_INVALIDARG; - } - - HRESULT hr; - if (!wszNamespace) - { - hr = (pAttributes->getValueFromQName(wszAttrName, cchName, &wszValue, &cchValue) == S_OK ? S_OK : E_FAIL); - } - else - { - hr = (pAttributes->getValueFromName(wszNamespace, cchNamespace, - wszAttrName, cchName, &wszValue, &cchValue) == S_OK ? S_OK : E_FAIL); - } - - if (hr == S_OK) - { - _ATLTRY - { - strValue.SetString(wszValue, cchValue); - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: GetAttribute -- out of memory.\r\n") ); - - hr = E_OUTOFMEMORY; - } - } - - return hr; -} - -inline const wchar_t *SkipWhitespace(const wchar_t *wsz) -{ - while (*wsz && iswspace(*wsz)) - ++wsz; - return wsz; -} - -} // namespace ATL -#pragma pack(pop) - -//////////////////////////////////////////////////////////////////////////////// -// -// BLOB data type - use this struct when you want to send BLOB data -// the attribute provider and proxy generator will only properly special -// case blob data when using this struct. -// -//////////////////////////////////////////////////////////////////////////////// - -[ export ] -typedef struct _tagATLSOAP_BLOB -{ - unsigned long size; - unsigned char *data; -} ATLSOAP_BLOB; - -#ifndef _ATL_SOAP_NO_PARAMETER_VALIDATIONS -#define _ATL_VALIDATE_PARAMETER_END(p)\ - do \ - { \ - if(*(p) !='\0') \ - return E_FAIL; \ - } while(0) -#else -#define _ATL_VALIDATE_PARAMETER_END(p) -#endif - -// All non-integral types have specializations which -// will be called. The following function will be called -// only for integral types - -#pragma push_macro("max") -#pragma push_macro("min") -#undef max -#undef min -template -inline HRESULT AtlGetSAXValue(T * pVal , const wchar_t * wsz , int cch ) -{ - __int64 nVal = *pVal; - if (FAILED(AtlGetSAXValue(&nVal, wsz, cch))) - return E_FAIL; - -#ifndef _ATL_SOAP_NO_PARAMETER_VALIDATIONS - if(nVal < std::numeric_limits::min() || nVal > std::numeric_limits::max()) - return E_FAIL; -#endif - - *pVal = T(nVal); - return S_OK; - - -} -#pragma pop_macro("max") -#pragma pop_macro("min") - -//////////////////////////////////////////////////////////////////////////////// -// -// AtlGetXMLValue (for IXMLDOMDocument) - get the real type from the XML data -// -/////////////////////////////////////////////////////////////////////////////// - -// -// generic IXMLDOMNode template function -// delegates to AtlGetSAXValue -// -template -inline HRESULT AtlGetXMLValue(IXMLDOMNode *pParam, T *pVal) -{ - CComBSTR bstrVal; - HRESULT hr = AtlGetXMLValue(pParam, &bstrVal); - if (SUCCEEDED(hr)) - { - hr = AtlGetSAXValue(pVal, bstrVal, bstrVal.Length()); - } - - return hr; -} - -// specialization for BSTR -template <> -inline HRESULT AtlGetXMLValue(IXMLDOMNode *pParam, BSTR *pbstrVal) -{ - if (pParam == NULL) - { - return E_INVALIDARG; - } - if (pbstrVal == NULL) - { - return E_POINTER; - } - - CComPtr spChild; - if (pParam->get_firstChild(&spChild) == S_OK) - { - CComPtr spXmlChild; - if (spChild->get_firstChild(&spXmlChild) == S_OK) - { - return (pParam->get_xml(pbstrVal) == S_OK ? S_OK : E_FAIL); - } - } - - return (pParam->get_text(pbstrVal) == S_OK) ? S_OK : E_FAIL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// AtlGetSAXValue - (for SAX or generic) get the real type from the XML data -// -//////////////////////////////////////////////////////////////////////////////// - -template <> -inline HRESULT AtlGetSAXValue(bool *pVal, __in_z const wchar_t *wsz, int cch) -{ - ATLENSURE( wsz != NULL ); - - if (!pVal) - { - return E_POINTER; - } - - *pVal = false; - - HRESULT hr = E_FAIL; - switch (wsz[0]) - { - case L'1': - { - if (cch==1) - { - *pVal = true; - hr = S_OK; - } - break; - } - case L'0': - { - if (cch==1) - { - *pVal = false; - hr = S_OK; - } - break; - } - case L't': - { - if (cch==sizeof("true")-1 && !wcsncmp(wsz, L"true", cch)) - { - *pVal = true; - hr = S_OK; - } - break; - } - case L'f': - { - if (cch==sizeof("false")-1 && !wcsncmp(wsz, L"false", cch)) - { - *pVal = false; - hr = S_OK; - } - break; - } - } - - return hr; -} - -template <> -inline HRESULT AtlGetSAXValue<__int64>(__int64 *pVal, __in_z const wchar_t *wsz, int cch) -{ - ATLENSURE_RETURN( wsz != NULL ); - - if (!pVal) - { - return E_POINTER; - } - - _ATLTRY - { - CFixedStringT wstr(wsz, cch); - const wchar_t *pStart = ATL::SkipWhitespace(static_cast(wstr)); - const wchar_t *pEnd; - - __int64 i = 0; - errno_t errnoValue = AtlStrToNum(&i, pStart, const_cast(&pEnd), 10); - if (errnoValue == ERANGE) - { - return E_FAIL;//overflow or underflow case - } - pEnd = ATL::SkipWhitespace(pEnd); - _ATL_VALIDATE_PARAMETER_END(pEnd); - *pVal = i; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return S_OK; -} - -template <> -inline HRESULT AtlGetSAXValue(unsigned __int64 *pVal, __in_z const wchar_t *wsz, int cch) -{ - ATLENSURE_RETURN( wsz != NULL ); - - if (!pVal) - { - return E_POINTER; - } - - _ATLTRY - { - CFixedStringT wstr(wsz, cch); - const wchar_t *pStart = ATL::SkipWhitespace(static_cast(wstr)); - const wchar_t *pEnd; - - unsigned __int64 i = 0; - errno_t errnoValue = AtlStrToNum(&i, pStart, const_cast(&pEnd), 10); - if (errnoValue == ERANGE) - { - return E_FAIL;//overflow or underflow case - } - pEnd = ATL::SkipWhitespace(pEnd); - _ATL_VALIDATE_PARAMETER_END(pEnd); - *pVal = i; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return S_OK; -} -template <> -inline HRESULT AtlGetSAXValue(double *pVal, __in_z const wchar_t *wsz, int cch) -{ - ATLENSURE_RETURN( wsz != NULL ); - - if (!pVal) - { - return E_POINTER; - } - - if ((cch == 3) && (wsz[0]==L'I') && (!wcsncmp(wsz, L"INF", cch))) - { - *(((int *) pVal)+0) = 0x0000000; - *(((int *) pVal)+1) = 0x7FF00000; - } - else if ((cch == 3) && (wsz[0]==L'N') && (!wcsncmp(wsz, L"NaN", cch))) - { - *(((int *) pVal)+0) = 0x0000000; - *(((int *) pVal)+1) = 0xFFF80000; - } - else if ((cch == 4) && (wsz[1]==L'I') && (!wcsncmp(wsz, L"-INF", cch))) - { - *(((int *) pVal)+0) = 0x0000000; - *(((int *) pVal)+1) = 0xFFF00000; - } - else - { - errno_t errnoValue = 0; - - _ATLTRY - { - CFixedStringT wstr(wsz, cch); - const wchar_t *pStart = ATL::SkipWhitespace(static_cast(wstr)); - const wchar_t *pEnd; - double d = 0.0; - errnoValue = AtlStrToNum(&d, pStart, const_cast(&pEnd)); - pEnd = ATL::SkipWhitespace(pEnd); - _ATL_VALIDATE_PARAMETER_END(pEnd); - *pVal = d; - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - if ((*pVal == -HUGE_VAL) || (*pVal == HUGE_VAL) || (errnoValue == ERANGE)) - { - return E_FAIL; - } - } - - return S_OK; -} - -template <> -inline HRESULT AtlGetSAXValue(float *pVal, __in_z const wchar_t *wsz, int cch) -{ - ATLASSERT( wsz != NULL ); - - if (!pVal) - { - return E_POINTER; - } - - double d = *pVal; - if (SUCCEEDED(AtlGetSAXValue(&d, wsz, cch))) - { -#ifdef _ATL_SOAP_PARAMETER_VALIDATIONS - if(d > FLT_MAX || d < -FLT_MAX) - return E_FAIL; -#endif - *pVal = (float) d; - return S_OK; - } - - return E_FAIL; -} - -template <> -inline HRESULT AtlGetSAXValue(BSTR *pVal, __in_z const wchar_t *wsz, int cch) -{ - ATLASSERT( wsz != NULL ); - - if (pVal == NULL) - { - return E_POINTER; - } - - *pVal = SysAllocStringLen(wsz, cch); - - return ((*pVal != NULL) ? S_OK : E_OUTOFMEMORY); -} - -inline HRESULT AtlGetSAXBlobValue( - ATLSOAP_BLOB *pVal, - const wchar_t *wsz, - int cch, - IAtlMemMgr *pMemMgr, - bool bHex = false) -{ - ATLENSURE_RETURN( wsz != NULL ); - ATLENSURE_RETURN( pMemMgr != NULL ); - - if (pVal == NULL) - { - return E_POINTER; - } - - if (pVal->data != NULL) - { - return E_INVALIDARG; - } - - pVal->data = NULL; - pVal->size = 0; - - int nLength = AtlUnicodeToUTF8(wsz, cch, NULL, 0); - - if (nLength != 0) - { - char * pSrc = (char *) pMemMgr->Allocate(nLength); - if (pSrc != NULL) - { - nLength = AtlUnicodeToUTF8(wsz, cch, pSrc, nLength); - if (nLength != 0) - { - pVal->data = (unsigned char *) pMemMgr->Allocate(nLength); - if (pVal->data != NULL) - { - BOOL bRet; - int nDataLength = nLength; - if (!bHex) - { - bRet = Base64Decode(pSrc, nLength, pVal->data, &nDataLength); - } - else - { - bRet = AtlHexDecode(pSrc, nLength, pVal->data, &nDataLength); - } - if (bRet) - { - pVal->size = nDataLength; - } - } - } - - pMemMgr->Free(pSrc); - } - } - - if (pVal->size == 0) - { - if (pVal->data != NULL) - { - pMemMgr->Free(pVal->data); - pVal->data = NULL; - } - } - - return S_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// AtlGenXMLValue template and specializations -// -//////////////////////////////////////////////////////////////////////////////// - -template -inline HRESULT AtlGenXMLValue(__in IWriteStream *pStream, __in T *pVal) -{ - if ((pStream == NULL) || (pVal == NULL)) - { - return E_INVALIDARG; - } - - // - // delegate to CWriteStreamHelper - // - CWriteStreamHelper s(pStream); - - return (s.Write(*pVal) == TRUE ? S_OK : E_FAIL); -} - -#ifdef _NATIVE_WCHAR_T_DEFINED -template <> -inline HRESULT AtlGenXMLValue(__in IWriteStream *pStream, __in wchar_t *pVal) -{ - return AtlGenXMLValue(pStream, (unsigned short *)pVal); -} -#endif - -template <> -inline HRESULT AtlGenXMLValue(__in IWriteStream *pStream, __deref_inout_z wchar_t **pVal) -{ - if ((pStream == NULL) || (*pVal == NULL)) - { - return E_INVALIDARG; - } - - wchar_t *wszWrite = *pVal; - int nSrcLen = (int)wcslen(*pVal); - int nCnt = EscapeXML(*pVal, nSrcLen, NULL, 0); - if (nCnt > nSrcLen) - { - nCnt++; - wszWrite = (wchar_t *)calloc((nCnt),sizeof(wchar_t)); - if (wszWrite == NULL) - { - return E_OUTOFMEMORY; - } - - nCnt = EscapeXML(*pVal, nSrcLen, wszWrite, nCnt); - if (nCnt == 0) - { - free(wszWrite); - return E_FAIL; - } - wszWrite[nCnt] = L'\0'; - nSrcLen = nCnt; - } - - nCnt = AtlUnicodeToUTF8(wszWrite, nSrcLen, NULL, 0); - HRESULT hr = E_FAIL; - if ((nCnt == 0) || (nCnt == nSrcLen)) - { - CWriteStreamHelper s(pStream); - - hr = (s.Write(wszWrite) == TRUE ? S_OK : E_FAIL); - } - else - { - nCnt++; - CHeapPtr szWrite; - szWrite.AllocateBytes((size_t)(nCnt)); - if (szWrite != NULL) - { - nCnt = AtlUnicodeToUTF8(wszWrite, nSrcLen, szWrite, nCnt); - if (nCnt != 0) - { - hr = pStream->WriteStream(szWrite, nCnt, NULL); - } - } - else - { - ATLTRACE( _T("ATLSOAP: AtlGenXMLValue -- out of memory.\r\n") ); - - hr = E_OUTOFMEMORY; - } - } - - if (wszWrite != *pVal) - { - free(wszWrite); - } - - return hr; -} - -template <> -inline HRESULT AtlGenXMLValue(IWriteStream *pStream, double *pVal) -{ - if ((pStream == NULL) || (pVal == NULL)) - { - return E_INVALIDARG; - } - - HRESULT hr; - switch (_fpclass(*pVal)) - { - case _FPCLASS_SNAN: - case _FPCLASS_QNAN: - { - hr = pStream->WriteStream("NaN", 3, NULL); - break; - } - case _FPCLASS_NINF: - { - hr = pStream->WriteStream("-INF", 4, NULL); - break; - } - case _FPCLASS_PINF: - { - hr = pStream->WriteStream("INF", 3, NULL); - break; - } - case _FPCLASS_NZ: - { - hr = pStream->WriteStream("-0", 2, NULL); - break; - } - default: - { - /*** - * 2 = sign + decimal point - * ndec = decimal digits - * 5 = exponent letter (e or E), exponent sign, three digits exponent - * 1 = extra space for rounding - * 1 = string terminator '\0' - ***/ - const int ndec = 512; - CHAR szBuf[ndec+9]; - szBuf[0] = '\0'; - Checked::gcvt_s(szBuf, _countof(szBuf), *pVal, ndec); - size_t nLen = strlen(szBuf); - if (nLen && szBuf[nLen-1] == '.') - { - szBuf[--nLen] = '\0'; - } - - hr = pStream->WriteStream(szBuf, (int)nLen, NULL); - break; - } - } - - return hr; -} - -template <> -inline HRESULT AtlGenXMLValue(IWriteStream *pStream, float *pVal) -{ - if ((pStream == NULL) || (pVal == NULL)) - { - return E_INVALIDARG; - } - - double d = *pVal; - - return AtlGenXMLValue(pStream, &d); -} - -template <> -inline HRESULT AtlGenXMLValue(IWriteStream *pStream, bool *pVal) -{ - if ((pStream == NULL) || (pVal == NULL)) - { - return E_INVALIDARG; - } - - if (*pVal == true) - { - return pStream->WriteStream("true", sizeof("true")-1, NULL); - } - - return pStream->WriteStream("false", sizeof("false")-1, NULL); -} - -inline HRESULT AtlGenXMLBlobValue( - IWriteStream *pStream, - ATLSOAP_BLOB *pVal, - IAtlMemMgr *pMemMgr, - bool bHex = false) -{ - if ((pStream == NULL) || (pVal == NULL) || (pMemMgr == NULL)) - { - return E_INVALIDARG; - } - - HRESULT hr = E_FAIL; - int nLength; - if (!bHex) - { - nLength = Base64EncodeGetRequiredLength(pVal->size, ATLSOAP_BASE64_FLAGS); - } - else - { - nLength = AtlHexEncodeGetRequiredLength(pVal->size); - } - - char *pEnc = (char *) pMemMgr->Allocate(nLength); - if (pEnc != NULL) - { - BOOL bRet; - if (!bHex) - { - bRet = Base64Encode(pVal->data, pVal->size, pEnc, &nLength, ATLSOAP_BASE64_FLAGS); - } - else - { - bRet = AtlHexEncode(pVal->data, pVal->size, pEnc, &nLength); - } - if (bRet) - { - hr = pStream->WriteStream(pEnc, nLength, NULL); - } - - pMemMgr->Free(pEnc); - } - - return hr; -} - -template -inline HRESULT AtlCleanupValue(T * /*pVal*/) -{ - return S_OK; -} - -inline HRESULT AtlCleanupBlobValue(ATLSOAP_BLOB *pVal, IAtlMemMgr *pMemMgr) -{ - if ((pVal == NULL) || (pMemMgr == NULL)) - { - return E_INVALIDARG; - } - - if (pVal->data != NULL) - { - pMemMgr->Free(pVal->data); - pVal->data = NULL; - pVal->size = 0; - } - - return S_OK; -} - -template <> -inline HRESULT AtlCleanupValue(ATLSOAP_BLOB *pVal) -{ - ATLTRACE( _T("Warning: AtlCleanupValue was called -- assuming CRT allocator.\r\n") ); - - if (pVal == NULL) - { - return E_INVALIDARG; - } - - if (pVal->data != NULL) - { - free(pVal->data); - pVal->data = NULL; - pVal->size = 0; - } - - return S_OK; -} - -template <> -inline HRESULT AtlCleanupValue(BSTR *pVal) -{ - if (pVal == NULL) - { - // should never happen - ATLASSERT( FALSE ); - return E_INVALIDARG; - } - - if ((*pVal) != NULL) - { - // null strings are okay - SysFreeString(*pVal); - *pVal = NULL; - } - - return S_OK; -} - -template -inline HRESULT AtlCleanupValueEx(T *pVal, IAtlMemMgr *pMemMgr) -{ - pMemMgr; - - return AtlCleanupValue(pVal); -} - -template <> -inline HRESULT AtlCleanupValueEx(ATLSOAP_BLOB *pVal, IAtlMemMgr *pMemMgr) -{ - return AtlCleanupBlobValue(pVal, pMemMgr); -} - -// single dimensional arrays -template -inline HRESULT AtlCleanupArray(T *pArray, int nCnt) -{ - if (pArray == NULL) - { - return E_INVALIDARG; - } - - for (int i=0; i -inline HRESULT AtlCleanupArrayEx(T *pArray, int nCnt, IAtlMemMgr *pMemMgr) -{ - if (pArray == NULL) - { - return E_INVALIDARG; - } - - for (int i=0; i -inline HRESULT AtlCleanupArrayMD(T *pArray, const int *pDims) -{ - if ((pArray == NULL) || (pDims == NULL)) - { - return E_INVALIDARG; - } - - // calculate size - int nCnt = 1; - for (int i=1; i<=pDims[0]; i++) - { - nCnt*= pDims[i]; - } - - return AtlCleanupArray(pArray, nCnt); -} - -template -inline HRESULT AtlCleanupArrayMDEx(T *pArray, const int *pDims, IAtlMemMgr *pMemMgr) -{ - if ((pArray == NULL) || (pDims == NULL)) - { - return E_INVALIDARG; - } - - // calculate size - int nCnt = 1; - for (int i=1; i<=pDims[0]; i++) - { - nCnt*= pDims[i]; - } - - return AtlCleanupArrayEx(pArray, nCnt, pMemMgr); -} - - -#pragma pack(push,_ATL_PACKING) -namespace ATL -{ - -//////////////////////////////////////////////////////////////////////////////// -// -// CSAXSoapErrorHandler -// -//////////////////////////////////////////////////////////////////////////////// - -class CSAXSoapErrorHandler : public ISAXErrorHandler -{ -private: - - CFixedStringT m_strParseError; - -public: - virtual ~CSAXSoapErrorHandler() - { - } - - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (!ppv) - { - return E_POINTER; - } - - if (InlineIsEqualGUID(riid, __uuidof(ISAXErrorHandler)) || - InlineIsEqualGUID(riid, __uuidof(IUnknown))) - { - *ppv = static_cast(this); - return S_OK; - } - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - - const CStringW& GetParseError() - { - return m_strParseError; - } - - HRESULT __stdcall error( - ISAXLocator *pLocator, - const wchar_t *wszErrorMessage, - HRESULT hrErrorCode) - { - (pLocator); - (wszErrorMessage); - (hrErrorCode); - - ATLTRACE( _T("ATLSOAP: parse error: %ws\r\n"), wszErrorMessage ); - - _ATLTRY - { - m_strParseError = wszErrorMessage; - } - _ATLCATCHALL() - { - return E_FAIL; - } - - return hrErrorCode; - } - - HRESULT __stdcall fatalError( - ISAXLocator *pLocator, - const wchar_t *wszErrorMessage, - HRESULT hrErrorCode) - { - (pLocator); - (wszErrorMessage); - (hrErrorCode); - - ATLTRACE( _T("ATLSOAP: fatal parse error: %ws\r\n"), wszErrorMessage ); - - _ATLTRY - { - m_strParseError = wszErrorMessage; - } - _ATLCATCHALL() - { - return E_FAIL; - } - - return hrErrorCode; - } - - HRESULT __stdcall ignorableWarning( - ISAXLocator *pLocator, - const wchar_t *wszErrorMessage, - HRESULT hrErrorCode) - { - (pLocator); - (wszErrorMessage); - (hrErrorCode); - - ATLTRACE( _T("ATLSOAP: ignorable warning: %ws\r\n"), wszErrorMessage ); - - return hrErrorCode; - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// ISAXContentHandlerImpl -// -//////////////////////////////////////////////////////////////////////////////// - -class ISAXContentHandlerImpl : - public ISAXContentHandler -{ -public: - - // - // ISAXContentHandler interface - // - - HRESULT __stdcall putDocumentLocator(ISAXLocator * /*pLocator*/) - { - return S_OK; - } - - HRESULT __stdcall startDocument() - { - return S_OK; - } - - HRESULT __stdcall endDocument() - { - return S_OK; - } - - HRESULT __stdcall startPrefixMapping( - const wchar_t * /*wszPrefix*/, - int /*cchPrefix*/, - const wchar_t * /*wszUri*/, - int /*cchUri*/) - { - return S_OK; - } - - HRESULT __stdcall endPrefixMapping( - const wchar_t * /*wszPrefix*/, - int /*cchPrefix*/) - { - return S_OK; - } - - HRESULT __stdcall startElement( - const wchar_t * /*wszNamespaceUri*/, - int /*cchNamespaceUri*/, - const wchar_t * /*wszLocalName*/, - int /*cchLocalName*/, - const wchar_t * /*wszQName*/, - int /*cchQName*/, - ISAXAttributes * /*pAttributes*/) - { - return S_OK; - } - - HRESULT __stdcall endElement( - const wchar_t * /*wszNamespaceUri*/, - int /*cchNamespaceUri*/, - const wchar_t * /*wszLocalName*/, - int /*cchLocalName*/, - const wchar_t * /*wszQName*/, - int /*cchQName*/) - { - return S_OK; - } - - HRESULT __stdcall characters( - const wchar_t * /*wszChars*/, - int /*cchChars*/) - { - return S_OK; - } - - HRESULT __stdcall ignorableWhitespace( - const wchar_t * /*wszChars*/, - int /*cchChars*/) - { - return S_OK; - } - - HRESULT __stdcall processingInstruction( - const wchar_t * /*wszTarget*/, - int /*cchTarget*/, - const wchar_t * /*wszData*/, - int /*cchData*/) - { - return S_OK; - } - - HRESULT __stdcall skippedEntity( - const wchar_t * /*wszName*/, - int /*cchName*/) - { - return S_OK; - } -}; // class ISAXContentHandlerImpl - -//////////////////////////////////////////////////////////////////////////////// -// -// SAX skip element handler utility class -// (skip an element and all its child elements) -// -//////////////////////////////////////////////////////////////////////////////// - -class CSkipHandler : public ISAXContentHandlerImpl -{ -public: - virtual ~CSkipHandler() - { - } - - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - - *ppv = NULL; - - if (InlineIsEqualGUID(riid, IID_IUnknown) || - InlineIsEqualGUID(riid, IID_ISAXContentHandler)) - { - *ppv = static_cast(this); - return S_OK; - } - - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - -private: - - DWORD m_dwReset; - CComPtr m_spReader; - CComPtr m_spParent; - - DWORD DisableReset(DWORD dwCnt = 1) - { - m_dwReset += dwCnt; - - return m_dwReset; - } - - DWORD EnableReset() - { - if (m_dwReset > 0) - { - --m_dwReset; - } - - return m_dwReset; - } - -public: - - CSkipHandler(ISAXContentHandler *pParent = NULL, ISAXXMLReader *pReader = NULL) - : m_spParent(pParent), m_spReader(pReader), m_dwReset(1) - { - } - - void SetParent(ISAXContentHandler *pParent) - { - m_spParent = pParent; - } - void DetachParent() - { - m_spParent.Detach(); - } - - void SetReader(ISAXXMLReader *pReader) - { - m_spReader = pReader; - } - - HRESULT __stdcall startElement( - const wchar_t * /*wszNamespaceUri*/, - int /*cchNamespaceUri*/, - const wchar_t * /*wszLocalName*/, - int /*cchLocalName*/, - const wchar_t * /*wszQName*/, - int /*cchQName*/, - ISAXAttributes * /*pAttributes*/) - { - DisableReset(); - return S_OK; - } - - HRESULT __stdcall endElement( - const wchar_t * /*wszNamespaceUri*/, - int /*cchNamespaceUri*/, - const wchar_t * /*wszLocalName*/, - int /*cchLocalName*/, - const wchar_t * /*wszQName*/, - int /*cchQName*/) - { - if (EnableReset() == 0) - { - m_spReader->putContentHandler(m_spParent); - } - - return S_OK; - } -}; // class CSkipHandler - - -//////////////////////////////////////////////////////////////////////////////// -// -// SAX string builder class -// -//////////////////////////////////////////////////////////////////////////////// - -class CSAXStringBuilder : public ISAXContentHandlerImpl -{ -public: - - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - - *ppv = NULL; - - if (InlineIsEqualGUID(riid, IID_IUnknown) || - InlineIsEqualGUID(riid, IID_ISAXContentHandler)) - { - *ppv = static_cast(this); - return S_OK; - } - - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - -private: - - ISAXContentHandler * m_pParent; - ISAXXMLReader * m_pReader; - DWORD m_dwReset; - CFixedStringT m_str; - - DWORD DisableReset(DWORD dwReset = 1) - { - m_dwReset+= dwReset; - - return m_dwReset; - } - - DWORD EnableReset() - { - if (m_dwReset > 0) - { - --m_dwReset; - } - - return m_dwReset; - } - -public: - - CSAXStringBuilder(ISAXXMLReader *pReader = NULL, ISAXContentHandler *pParent = NULL) - :m_pReader(pReader), m_pParent(pParent), m_dwReset(0) - { - } - - virtual ~CSAXStringBuilder() - { - } - - void SetReader(ISAXXMLReader *pReader) - { - m_pReader = pReader; - } - - void SetParent(ISAXContentHandler *pParent) - { - m_pParent = pParent; - } - - const CStringW& GetString() - { - return m_str; - } - - void Clear() - { - m_str.Empty(); - m_dwReset = 0; - } - - HRESULT __stdcall startElement( - const wchar_t * /*wszNamespaceUri*/, - int /*cchNamespaceUri*/, - const wchar_t * /*wszLocalName*/, - int /*cchLocalName*/, - const wchar_t *wszQName, - int cchQName, - ISAXAttributes *pAttributes) - { - if (m_dwReset == 0) - { - // if there is unescaped, nested XML, must disable - // an additional time for the first element - DisableReset(); - } - DisableReset(); - - int nAttrs = 0; - HRESULT hr = pAttributes->getLength(&nAttrs); - - _ATLTRY - { - if (SUCCEEDED(hr)) - { - m_str.Append(L"<", 1); - m_str.Append(wszQName, cchQName); - - const wchar_t *wszAttrNamespaceUri = NULL; - const wchar_t *wszAttrLocalName = NULL; - const wchar_t *wszAttrQName = NULL; - const wchar_t *wszAttrValue = NULL; - int cchAttrUri = 0; - int cchAttrLocalName = 0; - int cchAttrQName = 0; - int cchAttrValue = 0; - - for (int i=0; igetName(i, &wszAttrNamespaceUri, &cchAttrUri, - &wszAttrLocalName, &cchAttrLocalName, &wszAttrQName, &cchAttrQName); - - if (FAILED(hr)) - { - ATLTRACE( _T("ATLSOAP: CSAXStringBuilder::startElement -- MSXML error.\r\n") ); - - break; - } - - m_str.Append(L" ", 1); - m_str.Append(wszAttrQName, cchAttrQName); - - hr = pAttributes->getValue(i, &wszAttrValue, &cchAttrValue); - - if (FAILED(hr)) - { - ATLTRACE( _T("ATLSOAP: CSAXStringBuilder::startElement -- MSXML error.\r\n") ); - - break; - } - - m_str.Append(L"=\"", sizeof("=\"")-1); - if (cchAttrValue != 0) - { - m_str.Append(wszAttrValue, cchAttrValue); - } - m_str.Append(L"\"", 1); - } - - if (SUCCEEDED(hr)) - { - m_str.Append(L">", 1); - } - } - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSAXStringBuilder::startElement -- out of memory.\r\n") ); - - hr = E_OUTOFMEMORY; - } - - return hr; - } - - HRESULT __stdcall endElement( - const wchar_t * wszNamespaceUri, - int cchNamespaceUri, - const wchar_t * wszLocalName, - int cchLocalName, - const wchar_t *wszQName, - int cchQName) - { - HRESULT hr = S_OK; - _ATLTRY - { - if (EnableReset() == 0) - { - hr = m_pParent->characters((LPCWSTR) m_str, m_str.GetLength()); - if (SUCCEEDED(hr)) - { - hr = m_pParent->endElement(wszNamespaceUri, cchNamespaceUri, - wszLocalName, cchLocalName, wszQName, cchQName); - } - - m_pReader->putContentHandler(m_pParent); - } - - if (m_dwReset > 0) - { - m_str.Append(L"", 1); - } - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSAXStringBuilder::endElement -- out of memory.\r\n") ); - - hr = E_OUTOFMEMORY; - } - - return hr; - } - - HRESULT __stdcall characters( - const wchar_t *wszChars, - int cchChars) - { - _ATLTRY - { - m_str.Append(wszChars, cchChars); - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSAXStringBuilder::characters -- out of memory.\r\n") ); - - return E_OUTOFMEMORY; - } - - return S_OK; - } - - HRESULT __stdcall ignorableWhitespace( - const wchar_t *wszChars, - int cchChars) - { - _ATLTRY - { - m_str.Append(wszChars, cchChars); - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSAXStringBuilder::ignorableWhitespace -- out of memory.\r\n") ); - - return E_OUTOFMEMORY; - } - - return S_OK; - } -}; // class CSAXStringBuilder - -} // namespace ATL -#pragma pack(pop) - -//////////////////////////////////////////////////////////////////////////////// -// -// SOAP data structure definitions -// -//////////////////////////////////////////////////////////////////////////////// - -// -// ***************************** WARNING ***************************** -// THESE STRUCTURES ARE INTERNAL ONLY, FOR USE WITH THE ATL SERVER SOAP -// ATTRIBUTES. USERS SHOULD NOT USE THESE TYPES DIRECTLY. ABSOLUTELY NO -// GUARANTEES ARE MADE ABOUT BACKWARD COMPATIBILITY FOR DIRECT USE OF -// THESE TYPES. -// - -//////////////////////////////////////////////////////////////////////////////// -// -// BEGIN PRIVATE DEFINITIONS -// -//////////////////////////////////////////////////////////////////////////////// - -inline HRESULT AtlSoapGetArraySize(ISAXAttributes *pAttributes, size_t *pnSize, - const wchar_t **pwszTypeStart = NULL, const wchar_t **pwszTypeEnd = NULL) -{ - if (pnSize == NULL) - { - return E_POINTER; - } - - if (pAttributes == NULL) - { - return E_INVALIDARG; - } - - *pnSize = 0; - - HRESULT hr = S_OK; - - _ATLTRY - { - const wchar_t *wszTmp; - int cch; - - hr = GetAttribute(pAttributes, L"arrayType", sizeof("arrayType")-1, - &wszTmp, &cch, SOAPENC_NAMESPACEW, sizeof(SOAPENC_NAMESPACEA)-1); - - if ((SUCCEEDED(hr)) && (wszTmp != NULL)) - { - hr = E_FAIL; - - CFixedStringT wstrArrayType(wszTmp, cch); - const wchar_t *wsz = static_cast(wstrArrayType); - - const wchar_t *wszTypeStart = NULL; - const wchar_t *wszTypeEnd = NULL; - - // skip spaces - while (iswspace(*wsz) != 0) - { - wsz++; - } - - // no need to walk the string if the caller is not interested - if ((pwszTypeStart != NULL) && (pwszTypeEnd != NULL)) - { - wszTypeStart = wsz; - wszTypeEnd = wcschr(wszTypeStart, L':'); - if (wszTypeEnd != NULL) - { - wszTypeStart = wszTypeEnd+1; - } - } - - // SOAP Section 5 encodings are of the form: - // :arrayType="[dim1(,dim_i)*] - // for example: SOAP-ENC:arrayType="xsd:string[2,4]" - - wsz = wcschr(wsz, L'['); - if (wsz != NULL) - { - wszTypeEnd = wsz-1; - if (wsz[1] == ']') - { - return S_FALSE; - } - - *pnSize = 1; - - // get the size of each dimension - while (wsz != NULL) - { - wsz++; - int nDim = _wtoi(wsz); - if (nDim < 0) - { - hr = E_FAIL; - break; - } - *pnSize *= (size_t) nDim; - if (!nDim) - { - break; - } - - wsz = wcschr(wsz, L','); - } - - if ((pwszTypeStart != NULL) && (pwszTypeEnd != NULL)) - { - *pwszTypeStart = wszTypeStart; - *pwszTypeEnd = wszTypeEnd; - } - - hr = S_OK; - } - } - else - { - // not a section-5 encoding - hr = S_FALSE; - } - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - - return hr; -} - -inline size_t AtlSoapGetArrayDims(const int *pDims) -{ - if (pDims == NULL) - { - return 0; - } - - size_t nRet = 1; - for (int i=1; i<=pDims[0]; i++) - { - nRet *= pDims[i]; - } - - return nRet; -} - -enum SOAPFLAGS -{ - SOAPFLAG_NONE = 0x00000000, - SOAPFLAG_IN = 0x00000001, - SOAPFLAG_OUT = 0x00000002, - SOAPFLAG_RETVAL = 0x00000004, - SOAPFLAG_DYNARR = 0x00000008, - SOAPFLAG_FIXEDARR = 0x00000010, - SOAPFLAG_MUSTUNDERSTAND = 0x00000020, - SOAPFLAG_UNKSIZE = 0x00000040, - SOAPFLAG_READYSTATE = 0x00000080, - SOAPFLAG_FIELD = 0x00000100, - SOAPFLAG_NOMARSHAL = 0x00000200, - SOAPFLAG_NULLABLE = 0x00000400, - SOAPFLAG_DOCUMENT = 0x00000800, - SOAPFLAG_RPC = 0x00001000, - SOAPFLAG_LITERAL = 0x00002000, - SOAPFLAG_ENCODED = 0x00004000, - SOAPFLAG_PID = 0x00008000, - SOAPFLAG_PAD = 0x00010000, - SOAPFLAG_CHAIN = 0x00020000, - SOAPFLAG_SIZEIS = 0x00040000, - SOAPFLAG_DYNARRWRAPPER = 0x00080000 -}; - -enum SOAPMAPTYPE -{ - SOAPMAP_ERR = 0, - SOAPMAP_ENUM, - SOAPMAP_FUNC, - SOAPMAP_STRUCT, - SOAPMAP_UNION, - SOAPMAP_HEADER, - SOAPMAP_PARAM -}; - -struct _soapmap; - -struct _soapmapentry -{ - ULONG nHash; - const char * szField; - const WCHAR * wszField; - int cchField; - int nVal; - DWORD dwFlags; - - size_t nOffset; - const int * pDims; - - const _soapmap * pChain; - - int nSizeIs; - - ULONG nNamespaceHash; - const char *szNamespace; - const wchar_t *wszNamespace; - int cchNamespace; -}; - -struct _soapmap -{ - ULONG nHash; - const char * szName; - const wchar_t * wszName; - int cchName; - int cchWName; - SOAPMAPTYPE mapType; - const _soapmapentry * pEntries; - size_t nElementSize; - size_t nElements; - int nRetvalIndex; - - DWORD dwCallFlags; - - ULONG nNamespaceHash; - const char *szNamespace; - const wchar_t *wszNamespace; - int cchNamespace; -}; - -enum SOAPTYPES -{ - SOAPTYPE_ERR = -2, - SOAPTYPE_UNK = -1, - SOAPTYPE_STRING = 0, - SOAPTYPE_BOOLEAN, - SOAPTYPE_FLOAT, - SOAPTYPE_DOUBLE, - SOAPTYPE_DECIMAL, - SOAPTYPE_DURATION, - SOAPTYPE_HEXBINARY, - SOAPTYPE_BASE64BINARY, - SOAPTYPE_ANYURI, - SOAPTYPE_ID, - SOAPTYPE_IDREF, - SOAPTYPE_ENTITY, - SOAPTYPE_NOTATION, - SOAPTYPE_QNAME, - SOAPTYPE_NORMALIZEDSTRING, - SOAPTYPE_TOKEN, - SOAPTYPE_LANGUAGE, - SOAPTYPE_IDREFS, - SOAPTYPE_ENTITIES, - SOAPTYPE_NMTOKEN, - SOAPTYPE_NMTOKENS, - SOAPTYPE_NAME, - SOAPTYPE_NCNAME, - SOAPTYPE_INTEGER, - SOAPTYPE_NONPOSITIVEINTEGER, - SOAPTYPE_NEGATIVEINTEGER, - SOAPTYPE_LONG, - SOAPTYPE_INT, - SOAPTYPE_SHORT, - SOAPTYPE_BYTE, - SOAPTYPE_NONNEGATIVEINTEGER, - SOAPTYPE_UNSIGNEDLONG, - SOAPTYPE_UNSIGNEDINT, - SOAPTYPE_UNSIGNEDSHORT, - SOAPTYPE_UNSIGNEDBYTE, - SOAPTYPE_POSITIVEINTEGER, - SOAPTYPE_DATETIME, - SOAPTYPE_TIME, - SOAPTYPE_DATE, - SOAPTYPE_GMONTH, - SOAPTYPE_GYEARMONTH, - SOAPTYPE_GYEAR, - SOAPTYPE_GMONTHDAY, - SOAPTYPE_GDAY, - - SOAPTYPE_USERBASE = 0x00001000 -}; - -inline ULONG AtlSoapHashStr(const char * sz) -{ - ULONG nHash = 0; - while (*sz != 0) - { - nHash = (nHash<<5)+nHash+(*sz); - sz++; - } - - return nHash; -} - -inline ULONG AtlSoapHashStr(const wchar_t * sz) -{ - ULONG nHash = 0; - while (*sz != 0) - { - nHash = (nHash<<5)+nHash+(*sz); - sz++; - } - - return nHash; -} - -inline ULONG AtlSoapHashStr(const char * sz, int cch) -{ - ULONG nHash = 0; - for (int i=0; i m_spReader; - CSAXStringBuilder m_stringBuilder; - CSkipHandler m_skipHandler; - - const wchar_t *m_wszSoapPrefix; - int m_cchSoapPrefix; - -public: - virtual ~CSoapFaultParser() - { - m_skipHandler.DetachParent(); - } - - // IUnknown interface - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - - *ppv = NULL; - - if (InlineIsEqualGUID(riid, IID_IUnknown) || - InlineIsEqualGUID(riid, IID_ISAXContentHandler)) - { - *ppv = static_cast(this); - return S_OK; - } - - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - - // constructor - - CSoapFaultParser(CSoapFault *pFault, ISAXXMLReader *pReader) - :m_pFault(pFault), m_dwState(STATE_ERROR), m_spReader(pReader) - { - ATLASSERT( pFault != NULL ); - ATLASSERT( pReader != NULL ); - } - - // ISAXContentHandler interface - HRESULT __stdcall startElement( - const wchar_t * wszNamespaceUri, - int cchNamespaceUri, - const wchar_t * wszLocalName, - int cchLocalName, - const wchar_t * /*wszQName*/, - int /*cchQName*/, - ISAXAttributes * /*pAttributes*/) - { - struct _faultmap - { - const wchar_t *wszTag; - int cchTag; - DWORD dwState; - }; - - const static _faultmap s_faultParseMap[] = - { - { L"Envelope", sizeof("Envelope")-1, CSoapFaultParser::STATE_ENVELOPE }, - { L"Body", sizeof("Body")-1, CSoapFaultParser::STATE_BODY }, - { L"Header", sizeof("Header")-1, CSoapFaultParser::STATE_BODY }, - { L"Fault", sizeof("Fault")-1, CSoapFaultParser::STATE_START }, - { L"faultcode", sizeof("faultcode")-1, CSoapFaultParser::STATE_FAULTCODE }, - { L"faultstring", sizeof("faultstring")-1, CSoapFaultParser::STATE_FAULTSTRING }, - { L"faultactor", sizeof("faultactor")-1, CSoapFaultParser::STATE_FAULTACTOR }, - { L"detail", sizeof("detail")-1, CSoapFaultParser::STATE_DETAIL } - }; - - if (m_spReader.p == NULL) - { - ATLTRACE( _T("ATLSOAP: CSoapFaultParser::startElement -- ISAXXMLReader is NULL.\r\n" ) ); - - return E_INVALIDARG; - } - - m_dwState &= ~STATE_RESET; - for (int i=0; i<(sizeof(s_faultParseMap)/sizeof(s_faultParseMap[0])); i++) - { - if ((cchLocalName == s_faultParseMap[i].cchTag) && - (!wcsncmp(wszLocalName, s_faultParseMap[i].wszTag, cchLocalName))) - { - DWORD dwState = s_faultParseMap[i].dwState; - if ((dwState & (STATE_START | STATE_ENVELOPE | STATE_BODY)) == 0) - { - m_stringBuilder.SetReader(m_spReader); - m_stringBuilder.SetParent(this); - - m_stringBuilder.Clear(); - m_spReader->putContentHandler( &m_stringBuilder ); - } - else - { - if ((dwState <= m_dwState) || - (cchNamespaceUri != sizeof(SOAPENV_NAMESPACEA)-1) || - (wcsncmp(wszNamespaceUri, SOAPENV_NAMESPACEW, cchNamespaceUri))) - { - ATLTRACE( _T("ATLSOAP: CSoapFaultParser::startElement -- malformed SOAP fault.\r\n" ) ); - - return E_FAIL; - } - } - - m_dwState = dwState; - return S_OK; - } - } - if (m_dwState > STATE_START) - { - m_dwState = STATE_SKIP; - m_skipHandler.SetReader(m_spReader); - m_skipHandler.SetParent(this); - - m_spReader->putContentHandler( &m_skipHandler ); - return S_OK; - } - - ATLTRACE( _T("ATLSOAP: CSoapFaultParser::startElement -- malformed SOAP fault.\r\n" ) ); - - return E_FAIL; - } - - HRESULT __stdcall startPrefixMapping( - const wchar_t * wszPrefix, - int cchPrefix, - const wchar_t * wszUri, - int cchUri) - { - if ((cchUri == sizeof(SOAPENV_NAMESPACEA)-1) && - (!wcsncmp(wszUri, SOAPENV_NAMESPACEW, cchUri))) - { - m_wszSoapPrefix = wszPrefix; - m_cchSoapPrefix = cchPrefix; - } - - return S_OK; - } - - HRESULT __stdcall characters( - const wchar_t * wszChars, - int cchChars); -}; - -extern __declspec(selectany) const int ATLS_SOAPFAULT_CNT = 4; - -class CSoapFault -{ -private: - - struct _faultcode - { - const wchar_t *wsz; - int cch; - const wchar_t *wszFaultString; - int cchFaultString; - SOAP_ERROR_CODE errCode; - }; - - static const _faultcode s_faultCodes[]; - -public: - - // members - SOAP_ERROR_CODE m_soapErrCode; - CStringW m_strFaultCode; - CStringW m_strFaultString; - CStringW m_strFaultActor; - CStringW m_strDetail; - - CSoapFault() - : m_soapErrCode(SOAP_E_UNK) - { - } - - HRESULT SetErrorCode( - const wchar_t *wsz, - const wchar_t *wszSoapPrefix, - int cch = -1, - int cchSoapPrefix = -1, - bool bSetFaultString = true) - { - if ((wsz == NULL) || (wszSoapPrefix == NULL)) - { - return E_INVALIDARG; - } - - if (cch == -1) - { - cch = (int) wcslen(wsz); - } - - while (*wsz && iswspace(*wsz)) - { - ++wsz; - --cch; - } - - if (cchSoapPrefix == -1) - { - cchSoapPrefix = (int) wcslen(wszSoapPrefix); - } - - const wchar_t *wszLocalName = wcschr(wsz, L':'); - if (wszLocalName == NULL) - { - // faultCode must be QName - - ATLTRACE( _T("ATLSOAP: CSoapFault::SetErrorCode -- faultCode is not a QName.\r\n" ) ); - - return E_FAIL; - } - - // make sure the namespace of the fault is the - // SOAPENV namespace - if ((cchSoapPrefix != (int)(wszLocalName-wsz)) || - (wcsncmp(wsz, wszSoapPrefix, cchSoapPrefix))) - { - ATLTRACE( _T("ATLSOAP: CSoapFault::SetErrorCode -- fault namespace is incorrect.\r\n" ) ); - - return E_FAIL; - } - - wszLocalName++; - cch -= (int) (wszLocalName-wsz); - - _ATLTRY - { - for (int i=0; i spReader; - if (pReader != NULL) - { - spReader = pReader; - } - else - { - if (FAILED(spReader.CoCreateInstance(ATLS_SAXXMLREADER_CLSID, NULL, CLSCTX_INPROC_SERVER))) - { - ATLTRACE( _T("ATLSOAP: CSoapFault::ParseFault -- CoCreateInstance of SAXXMLReader failed.\r\n" ) ); - - return E_FAIL; - } - } - - Clear(); - CSoapFaultParser parser(const_cast(this), spReader); - spReader->putContentHandler(&parser); - - CComVariant varStream; - varStream = static_cast(pStream); - - HRESULT hr = spReader->parse(varStream); - spReader->putContentHandler(NULL); - return hr; - } - - HRESULT GenerateFault(IWriteStream *pWriteStream) - { - if ((pWriteStream == NULL) || (m_soapErrCode == SOAP_E_UNK)) - { - return E_INVALIDARG; - } - - ATLASSERT( (m_soapErrCode == SOAP_E_UNK) || - (m_soapErrCode == SOAP_E_VERSION_MISMATCH) || - (m_soapErrCode == SOAP_E_MUST_UNDERSTAND) || - (m_soapErrCode == SOAP_E_CLIENT) || - (m_soapErrCode == SOAP_E_SERVER) ); - - HRESULT hr = S_OK; - _ATLTRY - { - const wchar_t *wszFaultCode = NULL; - if (m_strFaultCode.GetLength() == 0) - { - for (int i=0; i<4; i++) - { - if (s_faultCodes[i].errCode == m_soapErrCode) - { - if (m_strFaultString.GetLength() == 0) - { - m_strFaultString.SetString(s_faultCodes[i].wszFaultString, - s_faultCodes[i].cchFaultString); - } - - wszFaultCode = s_faultCodes[i].wsz; - break; - } - } - } - - if (wszFaultCode == NULL) - { - if (m_strFaultCode.GetLength() != 0) - { - wszFaultCode = m_strFaultCode; - } - else - { - ATLTRACE( _T("CSoapFault::GenerateFault -- missing/invalid fault code.\r\n") ); - return E_FAIL; - } - } - - const LPCSTR s_szErrorFormat = - "" - "" - "" - "SOAP:%ws" - "%ws" - "%s%ws%s" - "%ws" - "" - "" - ""; - - CStringA strFault; - strFault.Format(s_szErrorFormat, wszFaultCode, m_strFaultString, - m_strFaultActor.GetLength() ? "" : "", m_strFaultActor, - m_strFaultActor.GetLength() ? "" : "", - m_strDetail); - - hr = pWriteStream->WriteStream(strFault, strFault.GetLength(), NULL); - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSoapFault::GenerateFault -- out of memory.\r\n" ) ); - hr = E_OUTOFMEMORY; - } - - return hr; - } - - void Clear() - { - m_soapErrCode = SOAP_E_UNK; - m_strFaultCode.Empty(); - m_strFaultString.Empty(); - m_strFaultActor.Empty(); - m_strDetail.Empty(); - } -}; // class CSoapFault - -#define DECLARE_SOAP_FAULT(__name, __faultstring, __errcode) \ - { L ## __name, sizeof(__name)-1, L ## __faultstring, sizeof(__faultstring), __errcode }, - -__declspec(selectany) const CSoapFault::_faultcode CSoapFault::s_faultCodes[] = -{ - DECLARE_SOAP_FAULT("VersionMismatch", "SOAP Version Mismatch Error", SOAP_E_VERSION_MISMATCH) - DECLARE_SOAP_FAULT("MustUnderstand", "SOAP Must Understand Error", SOAP_E_MUST_UNDERSTAND) - DECLARE_SOAP_FAULT("Client", "SOAP Invalid Request", SOAP_E_CLIENT) - DECLARE_SOAP_FAULT("Server", "SOAP Server Application Faulted", SOAP_E_SERVER) -}; - -ATL_NOINLINE inline HRESULT __stdcall CSoapFaultParser::characters( - const wchar_t * wszChars, - int cchChars) -{ - if (m_pFault == NULL) - { - return E_INVALIDARG; - } - - if (m_dwState & STATE_RESET) - { - return S_OK; - } - - HRESULT hr = E_FAIL; - _ATLTRY - { - switch (m_dwState) - { - case STATE_FAULTCODE: - if (m_pFault->m_soapErrCode == SOAP_E_UNK) - { - hr = m_pFault->SetErrorCode(wszChars, m_wszSoapPrefix, - cchChars, m_cchSoapPrefix, false); - } - break; - case STATE_FAULTSTRING: - if (m_pFault->m_strFaultString.GetLength() == 0) - { - m_pFault->m_strFaultString.SetString(wszChars, cchChars); - hr = S_OK; - } - break; - case STATE_FAULTACTOR: - if (m_pFault->m_strFaultActor.GetLength() == 0) - { - m_pFault->m_strFaultActor.SetString(wszChars, cchChars); - hr = S_OK; - } - break; - case STATE_DETAIL: - if (m_pFault->m_strDetail.GetLength() == 0) - { - m_pFault->m_strDetail.SetString(wszChars, cchChars); - hr = S_OK; - } - break; - case STATE_START: case STATE_ENVELOPE : case STATE_BODY : case STATE_SKIP: - hr = S_OK; - break; - default: - // should never get here - ATLASSERT( FALSE ); - break; - } - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSoapFaultParser::characters -- out of memory.\r\n" ) ); - - hr = E_OUTOFMEMORY; - } - - m_dwState |= STATE_RESET; - - return hr; -} - -//////////////////////////////////////////////////////////////////////////////// -// -// CSoapRootHandler - the class that does most of the work -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef ATLSOAP_STACKSIZE - // 16 will be plenty for the 99% case - #define ATLSOAP_STACKSIZE 16 -#endif - -#ifndef ATLSOAP_GROWARRAY - #define ATLSOAP_GROWARRAY 10 -#endif - -class CSoapRootHandler : public ISAXContentHandlerImpl -{ -private: - - friend class _CSDLGenerator; - - // - // state constants - // - const static DWORD SOAP_START = 0; - const static DWORD SOAP_ENVELOPE = 1; - const static DWORD SOAP_HEADERS = 2; - const static DWORD SOAP_BODY = 3; - const static DWORD SOAP_PARAMS = 4; - const static DWORD SOAP_CALLED = 5; - const static DWORD SOAP_RESPONSE = 6; - const static DWORD SOAP_HEADERS_DONE = 7; - - // - // hash values for SOAP namespaces and elements - // - const static ULONG SOAP_ENV = 0x5D3574E2; - const static ULONG SOAP_ENC = 0xBD62724B; - const static ULONG ENVELOPE = 0xDBE6009E; - const static ULONG HEADER = 0xAF4DFFC9; - const static ULONG BODY = 0x0026168E; - - // - // XSD Names - // - struct XSDEntry - { - wchar_t * wszName; - char * szName; - int cchName; - }; - - const static XSDEntry s_xsdNames[]; - - // - // CBitVector - a dynamically sized bit vector class - // - class CBitVector - { - private: - - // 64 bits will handle the 99% case - unsigned __int64 m_nBits; - - // when we need to grow - unsigned __int64 * m_pBits; - - size_t m_nSize; - - bool Grow(size_t nIndex) - { - // Think carefully - // In our current implementation, CHAR_BIT==8, and sizeof(m_nBits)==8. Easy to confuse the two. - - // We do math in bits, so this is our max size - ATLENSURE(nIndex= m_nSize) - { - return false; - } - - size_t i = nIndex/(sizeof(m_nBits)*CHAR_BIT); - size_t nBits = nIndex-i*(sizeof(m_nBits)*CHAR_BIT); - return ((m_pBits[i] >> nBits) & 0x01); - } - - bool SetBit(size_t nIndex) - { - if (nIndex >= m_nSize) - { - if (!Grow(nIndex)) - { - return false; - } - } - - size_t i = nIndex/(sizeof(m_nBits)*CHAR_BIT); - size_t nBits = nIndex-i*(sizeof(m_nBits)*CHAR_BIT); - m_pBits[i] |= (((unsigned __int64) 1) << nBits); - - return true; - } - - void Clear() - { - if (m_pBits == &m_nBits) - { - m_nBits = 0; - } - else - { - memset(m_pBits, 0x00, (m_nSize/CHAR_BIT)); - } - } - - ~CBitVector() - { - if (m_pBits != &m_nBits) - { - free(m_pBits); - } - - m_pBits = &m_nBits; - m_nSize = sizeof(m_nBits)*CHAR_BIT; - } - - void RelocateFixup() - { - if (m_nSize <= sizeof(m_nBits)*CHAR_BIT) - { - m_pBits = &m_nBits; - } - } - }; // class CBitVector - - // - // Parsing State - // - struct ParseState - { - void *pvElement; - DWORD dwFlags; - size_t nAllocSize; - size_t nExpectedElements; - size_t nElement; - const _soapmap *pMap; - const _soapmapentry *pEntry; - - // mark when we get an item - CBitVector vec; - - size_t nDepth; - - ParseState(void *pvElement_ = NULL, DWORD dwFlags_ = 0, - size_t nAllocSize_ = 0, size_t nExpectedElements_ = 0, - size_t nElement_ = 0, const _soapmap *pMap_ = NULL, - const _soapmapentry *pEntry_ = NULL) - : pvElement(pvElement_), dwFlags(dwFlags_), nAllocSize(nAllocSize_), - nExpectedElements(nExpectedElements_), nElement(nElement_), pMap(pMap_), - pEntry(pEntry_), nDepth(0) - { - vec.Clear(); - } - - ParseState(const ParseState& that) - { - pvElement = that.pvElement; - dwFlags = that.dwFlags; - nAllocSize = that.nAllocSize; - nExpectedElements = that.nExpectedElements; - nElement = that.nElement; - pMap = that.pMap; - pEntry = that.pEntry; - nDepth = that.nDepth; - vec.Clear(); - } - - ~ParseState() - { - pvElement = NULL; - dwFlags = 0; - nAllocSize = 0; - nExpectedElements = 0; - nElement = 0; - pMap = NULL; - pEntry = NULL; - nDepth = 0; - vec.Clear(); - } - - void RelocateFixup() - { - vec.RelocateFixup(); - } - }; // struct ParseState - - class CParseStateElementTraits : public CDefaultElementTraits - { - public: - // CBitVector relocate fixup - static void RelocateElements( ParseState* pDest, ParseState* pSrc, size_t nElements ) - { - CDefaultElementTraits::RelocateElements(pDest, pSrc, nElements); - - // fixup CBitVector - for (size_t i=0; iWriteStream("", - - sizeof("")-1, - - NULL); - } - - HRESULT StartHeaders(IWriteStream *pStream, const _soapmap *pMap) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - HRESULT hr = pStream->WriteStream("dwCallFlags & (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) != - (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) - { - // qualify document/literal by default - // For this version, ATL Server will not respect - // the elementForm* attributes in an XSD schema - - hr = pStream->WriteStream(" xmlns=\"", sizeof(" xmlns=\"")-1, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(pMap->szNamespace, pMap->cchNamespace, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream("\">", sizeof("\">")-1, NULL); - } - } - } - else - { - // rpc/encoded - hr = pStream->WriteStream(">", sizeof(">")-1, NULL); - } - } - return hr; - } - - HRESULT EndHeaders(IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - - return pStream->WriteStream("", sizeof("")-1, NULL); - } - - virtual HRESULT StartBody(IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - - return pStream->WriteStream( - "", sizeof("")-1, NULL); - } - - HRESULT EndBody(IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - - return pStream->WriteStream("", sizeof("")-1, NULL); - } - - HRESULT EndEnvelope(IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - - return pStream->WriteStream("", sizeof("")-1, NULL); - } - - virtual HRESULT StartMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient) = 0; - virtual HRESULT EndMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient) = 0; - - virtual HRESULT StartEntry(IWriteStream *pStream, const _soapmap *pMap, const _soapmapentry *pEntry) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pEntry != NULL ); - - // output name - HRESULT hr = pStream->WriteStream("<", 1, NULL); - if (SUCCEEDED(hr)) - { - const char *szHeaderNamespace = NULL; - int cchHeaderNamespace = 0; - - if ((pMap != NULL) && (pMap->mapType == SOAPMAP_HEADER) && - ((pEntry->pChain != NULL) && - (pEntry->pChain->szNamespace !=NULL)) || - (pEntry->szNamespace != NULL)) - { - hr = pStream->WriteStream("snp:", sizeof("snp:")-1, NULL); - if (SUCCEEDED(hr)) - { - szHeaderNamespace = pEntry->pChain ? - pEntry->pChain->szNamespace : pEntry->szNamespace; - - cchHeaderNamespace = pEntry->pChain ? - pEntry->pChain->cchNamespace : pEntry->cchNamespace; - } - } - - if (SUCCEEDED(hr)) - { - if ((pEntry->dwFlags & SOAPFLAG_RETVAL)==0) - { - hr = pStream->WriteStream(pEntry->szField, pEntry->cchField, NULL); - } - else - { - hr = pStream->WriteStream("return", sizeof("return")-1, NULL); - } - if (SUCCEEDED(hr)) - { - if (szHeaderNamespace != NULL) - { - ATLASSERT( cchHeaderNamespace != 0 ); - - hr = pStream->WriteStream(" xmlns:snp=\"", sizeof(" xmlns:snp=\"")-1, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(szHeaderNamespace, cchHeaderNamespace, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream("\"", sizeof("\"")-1, NULL); - } - } - } - } - } - } - if (SUCCEEDED(hr)) - { - if (pEntry->dwFlags & SOAPFLAG_MUSTUNDERSTAND) - { - // output mustUnderstand - hr = pStream->WriteStream(" soap:mustUnderstand=\"1\"", sizeof(" soap:mustUnderstand=\"1\"")-1, NULL); - } - } - return hr; - } - - HRESULT EndEntry(IWriteStream *pStream, const _soapmap *pMap, const _soapmapentry *pEntry) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pEntry != NULL ); - - HRESULT hr = pStream->WriteStream("mapType == SOAPMAP_HEADER) && - ((pEntry->pChain != NULL) && - (pEntry->pChain->szNamespace !=NULL)) || - (pEntry->szNamespace != NULL)) - { - hr = pStream->WriteStream("snp:", sizeof("snp:")-1, NULL); - } - if ((pEntry->dwFlags & SOAPFLAG_RETVAL)==0) - { - hr = pStream->WriteStream(pEntry->szField, pEntry->cchField, NULL); - } - else - { - hr = pStream->WriteStream("return", sizeof("return")-1, NULL); - } - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(">", 1, NULL); - } - } - return hr; - } - }; // class CResponseGenerator - - class CDocLiteralGenerator : public CResponseGenerator - { - public: - - HRESULT StartMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - HRESULT hr = S_OK; - // output type name - hr = pStream->WriteStream("<", 1, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(pMap->szName, pMap->cchName, NULL); - if (SUCCEEDED(hr)) - { - if ((pMap->mapType == SOAPMAP_FUNC) && - (bClient == false) && - (pMap->dwCallFlags & SOAPFLAG_PID)) - { - hr = pStream->WriteStream("Response", sizeof("Response")-1, NULL); - if (FAILED(hr)) - { - return hr; - } - } - - if (pMap->mapType == SOAPMAP_FUNC) - { - hr = pStream->WriteStream(" xmlns=\"", sizeof(" xmlns=\"")-1, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(pMap->szNamespace, pMap->cchNamespace, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream("\">", sizeof("\">")-1, NULL); - } - } - } - else - { - hr = pStream->WriteStream(">", 1, NULL); - } - } - } - return hr; - } - - HRESULT EndMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - HRESULT hr = pStream->WriteStream("WriteStream(pMap->szName, pMap->cchName, NULL); - if (SUCCEEDED(hr)) - { - if ((pMap->mapType == SOAPMAP_FUNC) && - (bClient == false) && - (pMap->dwCallFlags & SOAPFLAG_PID)) - { - hr = pStream->WriteStream("Response", sizeof("Response")-1, NULL); - if (FAILED(hr)) - { - return hr; - } - } - hr = pStream->WriteStream(">", 1, NULL); - } - } - - return hr; - } - - }; // class CDocLiteralGenerator - - class CPIDGenerator : public CDocLiteralGenerator - { - }; - - class CPADGenerator : public CDocLiteralGenerator - { - public: - - virtual HRESULT StartEntry(IWriteStream *pStream, const _soapmap *pMap, const _soapmapentry *pEntry) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pEntry != NULL ); - - HRESULT hr = __super::StartEntry(pStream, pMap, pEntry); - if (SUCCEEDED(hr) && (pMap->dwCallFlags & SOAPFLAG_PAD)) - { - hr = pStream->WriteStream(" xmlns=\"", sizeof(" xmlns=\"")-1, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(pMap->szNamespace, pMap->cchNamespace, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream("\"", sizeof("\"")-1, NULL); - } - } - } - - return hr; - } - }; // class CPADGenerator - - class CRpcEncodedGenerator : public CResponseGenerator - { - public: - - HRESULT StartBody(IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - - return pStream->WriteStream( - "", - sizeof("")-1, NULL); - } - - HRESULT StartMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - (bClient); // unused for rpc/encoded - - HRESULT hr = pStream->WriteStream("WriteStream(pMap->szName, pMap->cchName, NULL); - if (SUCCEEDED(hr)) - { - if (pMap->mapType == SOAPMAP_FUNC) - { - hr = pStream->WriteStream(" xmlns:snp=\"", sizeof(" xmlns:snp=\"")-1, NULL); - if (SUCCEEDED(hr)) - { - ATLASSERT( pMap->szNamespace != NULL ); - hr = pStream->WriteStream(pMap->szNamespace, pMap->cchNamespace, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream("\">", sizeof("\">")-1, NULL); - } - } - } - else - { - hr = pStream->WriteStream(">", 1, NULL); - } - } - } - return hr; - } - - HRESULT EndMap(IWriteStream *pStream, const _soapmap *pMap, bool bClient) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - (bClient); // unused for rpc/encoded - - HRESULT hr = pStream->WriteStream("WriteStream(pMap->szName, pMap->cchName, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(">", 1, NULL); - } - } - - return hr; - } - }; // class CRpcEncodedGenerator - - // - // members - // - CAtlArray m_stateStack; - size_t m_nState; - - DWORD m_dwState; - - CComPtr m_spReader; - - CSAXStringBuilder m_stringBuilder; - CSkipHandler m_skipHandler; - - IAtlMemMgr * m_pMemMgr; - - static CCRTHeap m_crtHeap; - - bool m_bClient; - - void *m_pvParam; - - bool m_bNullCheck; - bool m_bChildCheck; - bool m_bCharacters; - size_t m_nDepth; - - typedef CFixedStringT REFSTRING; - - // used for rpc/encoded messages with href's - typedef CAtlMap > REFMAP; - REFMAP m_refMap; - - // - // Implementation helpers - // - - HRESULT PushState(void *pvElement = NULL, const _soapmap *pMap = NULL, - const _soapmapentry *pEntry = NULL, DWORD dwFlags = 0, size_t nAllocSize = 0, - size_t nExpectedElements = 0, size_t nElement = 0) - { - if (m_stateStack.IsEmpty()) - { - // 16 will be plenty for the 99% case - if (!m_stateStack.SetCount(0, 16)) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::PushState -- out of memory.\r\n" ) ); - - return E_OUTOFMEMORY; - } - } - - size_t nCnt = m_stateStack.GetCount(); - m_nState = m_stateStack.Add(); - if (m_stateStack.GetCount() <= nCnt) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::PushState -- out of memory.\r\n" ) ); - - return E_OUTOFMEMORY; - } - - ParseState &state = m_stateStack[m_nState]; - - state.pvElement = pvElement; - state.dwFlags = dwFlags; - state.nAllocSize = nAllocSize; - state.nExpectedElements = nExpectedElements; - state.nElement = nElement; - state.pMap = pMap; - state.pEntry = pEntry; - state.nDepth = m_nDepth; - - return S_OK; - } - - ParseState& GetState() - { - return m_stateStack[m_nState]; - } - - void PopState(bool bForce = false) - { - if ((m_nState != 0) || (bForce != false)) - { - m_stateStack.RemoveAt(m_nState); - --m_nState; - } - } - - BOOL IsEqualElement(int cchLocalNameCheck, const wchar_t *wszLocalNameCheck, - int cchNamespaceUriCheck, const wchar_t *wszNamespaceUriCheck, - int cchLocalName, const wchar_t *wszLocalName, - int cchNamespaceUri, const wchar_t *wszNamespaceUri) - { - ATLENSURE(wszLocalName); - ATLENSURE(wszLocalNameCheck); - ATLENSURE(wszNamespaceUri); - ATLENSURE(wszNamespaceUriCheck); - - if (cchLocalName == cchLocalNameCheck && - cchNamespaceUri == cchNamespaceUriCheck && - !wcsncmp(wszLocalName, wszLocalNameCheck, cchLocalName) && - !wcsncmp(wszNamespaceUri, wszNamespaceUriCheck, cchNamespaceUri)) - { - return TRUE; - } - - return FALSE; - } - - ATL_FORCEINLINE BOOL IsEqualString(const wchar_t *wszStr1, int cchStr1, const wchar_t *wszStr2, int cchStr2) - { - ATLENSURE( wszStr1 != NULL ); - ATLENSURE( wszStr2 != NULL ); - ATLENSURE( cchStr1 >= 0 ); - ATLENSURE( cchStr2 >= 0 ); - - if (cchStr1 == cchStr2) - { - return !wcsncmp(wszStr1, wszStr2, cchStr2); - } - return FALSE; - } - - ATL_FORCEINLINE BOOL IsEqualStringHash(const wchar_t *wszStr1, int cchStr1, ULONG nHash1, - const wchar_t *wszStr2, int cchStr2, ULONG nHash2) - { - ATLENSURE( wszStr1 != NULL ); - ATLENSURE( wszStr2 != NULL ); - ATLENSURE( cchStr1 >= 0 ); - ATLENSURE( cchStr2 >= 0 ); - - if (nHash1 == nHash2) - { - return IsEqualString(wszStr1, cchStr1, wszStr2, cchStr2); - } - - return FALSE; - } - - BOOL IsEqualElement(int cchLocalNameCheck, const wchar_t *wszLocalNameCheck, - int cchLocalName, const wchar_t *wszLocalName) - { - if (cchLocalName == cchLocalNameCheck && - !wcsncmp(wszLocalName, wszLocalNameCheck, cchLocalName)) - { - return TRUE; - } - - return FALSE; - } - - void SetOffsetValue(void *pBase, void *pSrc, size_t nOffset) - { - void **ppDest = (void **)(((unsigned char *)pBase)+nOffset); - *ppDest = pSrc; - } - - bool IsRpcEncoded() - { - if ((m_stateStack[0].pMap->dwCallFlags & (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) == - (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) - { - return true; - } - return false; - } - - - HRESULT ValidateArrayEntry( - ParseState& state, - const wchar_t *wszLocalName, - int cchLocalName) - { - (cchLocalName); - (wszLocalName); - - ATLASSERT( state.pEntry != NULL ); - - // SOAP Section 5.4.2 - - // check number of elements - if (state.nElement == state.nExpectedElements) - { - // too many elements - if ((state.dwFlags & SOAPFLAG_UNKSIZE)==0) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::ValidateArrayEntry -- too many elements.\r\n" ) ); - return E_FAIL; - } - - ATLASSERT( IsRpcEncoded() == false ); - - // see if we need to allocate more - if (state.nElement == state.nAllocSize) - { - unsigned char **ppArr = (unsigned char **)state.pvElement; - size_t nNewElement=0; - HRESULT hr=E_FAIL; - if(FAILED(hr=::ATL::AtlMultiply(&nNewElement, state.nElement, static_cast(2)))) - { - return hr; - } - hr = AllocateArray(state.pEntry, (void **)ppArr, __max(nNewElement, ATLSOAP_GROWARRAY), state.nElement); - - if (SUCCEEDED(hr)) - { - state.nAllocSize = __max((state.nElement)*2, ATLSOAP_GROWARRAY); - } - - return hr; - } - } - - return S_OK; - } - - HRESULT CheckID( - const wchar_t *wszNamespaceUri, - const wchar_t *wszLocalName, - int cchLocalName, - ISAXAttributes *pAttributes) - { - (cchLocalName); - (wszLocalName); - (wszNamespaceUri); - ATLASSERT( pAttributes != NULL ); - - const wchar_t *wsz = NULL; - int cch = 0; - - HRESULT hr = GetAttribute(pAttributes, L"id", sizeof("id")-1, &wsz, &cch); - if ((hr == S_OK) && (wsz != NULL)) - { - const REFMAP::CPair *p = NULL; - _ATLTRY - { - REFSTRING strRef(wsz, cch); - p = m_refMap.Lookup(strRef); - if (p == NULL) - { - return S_FALSE; - } - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckID -- out of memory.\r\n" ) ); - - return E_OUTOFMEMORY; - } - - ATLASSERT( IsRpcEncoded() == true ); - - const ParseState& state = p->m_value; - - // disallow href-chaining - hr = CheckHref(state.pEntry, state.pvElement, pAttributes); - if (hr != S_FALSE) - { - return E_FAIL; - } - - hr = S_OK; - - // do array stuff - if (state.dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) - { - hr = GetSection5Info(state, state.pEntry, pAttributes); - } - else - { - // only structs and arrays are allowed for hrefs - ATLASSERT( state.pEntry->pChain != NULL ); - ATLASSERT( state.pEntry->pChain->mapType == SOAPMAP_STRUCT ); - - // structs must have child entries - m_bChildCheck = state.pEntry->pChain->nElements != 0; - - if (S_OK != PushState(state.pvElement, state.pEntry->pChain, state.pEntry, - state.dwFlags, 0, state.pEntry->pChain->nElements)) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckID -- out of memory.\n" ) ); - hr = E_OUTOFMEMORY; - } - } - - m_refMap.DisableAutoRehash(); - m_refMap.RemoveAtPos(const_cast(p)); - m_refMap.EnableAutoRehash(); - - return hr; - } - - return S_FALSE; - } - - HRESULT GetElementEntry( - ParseState& state, - const wchar_t *wszNamespaceUri, - const wchar_t *wszLocalName, - int cchLocalName, - ISAXAttributes *pAttributes, - const _soapmapentry **ppEntry) - { - ATLENSURE_RETURN( state.pMap != NULL ); - ATLENSURE_RETURN( ppEntry != NULL ); - - *ppEntry = NULL; - const _soapmapentry *pEntries = state.pMap->pEntries; - DWORD dwIncludeFlags; - DWORD dwExcludeFlags; - - HRESULT hr = CheckID(wszNamespaceUri, wszLocalName, cchLocalName, pAttributes); - if (hr != S_FALSE) - { - if (hr == S_OK) - { - hr = S_FALSE; - } - return hr; - } - - if (m_bClient != false) - { - dwIncludeFlags = SOAPFLAG_OUT; - dwExcludeFlags = SOAPFLAG_IN; - } - else - { - dwIncludeFlags = SOAPFLAG_IN; - dwExcludeFlags = SOAPFLAG_OUT; - } - - ULONG nHash = AtlSoapHashStr(wszLocalName, cchLocalName); - - for (size_t i=0; pEntries[i].nHash != 0; i++) - { - if (nHash == pEntries[i].nHash && - ((pEntries[i].dwFlags & dwIncludeFlags) || - ((pEntries[i].dwFlags & dwExcludeFlags) == 0)) && - IsEqualElement(pEntries[i].cchField, pEntries[i].wszField, - cchLocalName, wszLocalName)/* && - !wcscmp(wszNamespaceUri, wszNamespace)*/) - { - // check bit vector - - if (state.vec.GetBit(i) == false) - { - if (state.vec.SetBit(i) == false) - { - return E_OUTOFMEMORY; - } - } - else - { - // already received this element - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::GetElementEntry -- duplicate element was sent.\r\n" ) ); - - return E_FAIL; - } - - state.nElement++; - *ppEntry = &pEntries[i]; - - return S_OK; - } - } - - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::GetElementEntry -- element not found: %.*ws.\r\n" ), cchLocalName, wszLocalName ); - - return E_FAIL; - } - - HRESULT CheckMustUnderstandHeader(ISAXAttributes *pAttributes) - { - ATLASSERT( pAttributes != NULL ); - - const wchar_t* wszMustUnderstand; - int cchMustUnderstand; - bool bMustUnderstand= false; - - if (SUCCEEDED(GetAttribute(pAttributes, L"mustUnderstand", sizeof("mustUnderstand")-1, - &wszMustUnderstand, &cchMustUnderstand, - SOAPENV_NAMESPACEW, sizeof(SOAPENV_NAMESPACEA)-1)) && - (wszMustUnderstand != NULL)) - { - if (FAILED(AtlGetSAXValue(&bMustUnderstand, wszMustUnderstand, cchMustUnderstand))) - { - bMustUnderstand = true; - } - } - - if (bMustUnderstand == false) - { - ATLASSERT( GetReader() != NULL ); - - m_skipHandler.SetReader(GetReader()); - m_skipHandler.SetParent(this); - - return GetReader()->putContentHandler( &m_skipHandler ); - } - else - { - SoapFault(SOAP_E_MUST_UNDERSTAND, NULL, 0); - } - - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckMustUnderstandHeader -- unknown \"mustUnderstand\" SOAP Header was received.\r\n" ) ); - - return E_FAIL; - } - - HRESULT AllocateArray( - const _soapmapentry *pEntry, - void **ppArr, size_t nElements, - size_t nCurrElements = 0) - { - ATLENSURE_RETURN( ppArr != NULL ); - ATLENSURE_RETURN( pEntry != NULL ); - - size_t nElementSize; - if (pEntry->nVal != SOAPTYPE_UNK) - { - nElementSize = AtlSoapGetElementSize((SOAPTYPES) pEntry->nVal); - } - else // UDT - { - ATLENSURE_RETURN( pEntry->pChain != NULL ); - nElementSize = pEntry->pChain->nElementSize; - } - if (nElementSize != 0) - { - if (*ppArr == NULL) - { - ATLASSERT( nCurrElements == 0 ); - size_t nBytes=0; - HRESULT hr=S_OK; - if( FAILED(hr=::ATL::AtlMultiply(&nBytes, nElementSize, nElements))) - { - return hr; - } - *ppArr = m_pMemMgr->Allocate(nBytes); - } - else // *ppArr != NULL - { - ATLASSERT( nCurrElements != 0 ); - size_t nBytes=0; - HRESULT hr=S_OK; - if( FAILED(hr=::ATL::AtlAdd(&nBytes, nElements, nCurrElements)) || - FAILED(hr=::ATL::AtlMultiply(&nBytes, nElementSize, nBytes))) - { - return hr; - } - *ppArr = m_pMemMgr->Reallocate(*ppArr, nBytes); - } - } - else - { - // internal error - ATLASSERT( FALSE ); - return E_FAIL; - } - - if (*ppArr == NULL) - { - return E_OUTOFMEMORY; - } - - memset(((unsigned char *)(*ppArr))+(nCurrElements*nElementSize), 0x00, nElements*nElementSize); - - return S_OK; - } - - HRESULT GetSection5Info( - const ParseState& state, - const _soapmapentry *pEntry, - ISAXAttributes *pAttributes) - { - ATLENSURE_RETURN( pEntry != NULL ); - ATLENSURE_RETURN( pAttributes != NULL ); - - HRESULT hr; - if (IsRpcEncoded() != false) - { - // check for href - // we ONLY do this for rpc/encoded (required for interop) - // NOTE: ATL Server does not support object graphs, so - // only single-reference elements are allowed - hr = CheckHref(pEntry, state.pvElement, pAttributes, - pEntry->dwFlags, SOAPFLAG_READYSTATE); - if (hr != S_FALSE) - { - return hr; - } - } - - size_t nElements; - DWORD dwFlags = 0; - hr = AtlSoapGetArraySize(pAttributes, &nElements); - if (FAILED(hr)) - { - return hr; - } - - size_t nAllocSize = 0; - size_t nElementsPush = 0; - - if (pEntry->dwFlags & SOAPFLAG_DYNARR) - { - // set size_is value - ATLENSURE_RETURN( state.pMap != NULL ); - int *pnSizeIs = (int *)(((unsigned char *)state.pvElement)+ - (state.pMap->pEntries[pEntry->nSizeIs].nOffset)); - - if (hr != S_OK) - { - if (IsRpcEncoded()) - { - // rpc/encoded requires soapenc:arrayType attribute - return E_FAIL; - } - - nElements = ATLSOAP_GROWARRAY; - nAllocSize = ATLSOAP_GROWARRAY; - dwFlags |= SOAPFLAG_UNKSIZE; - *pnSizeIs = 0; - } - else - { - *pnSizeIs = (int)nElements; - if (nElements == 0) - { - // soapenc:arrayType="type[0]" - // treat as null array - - m_bNullCheck = true; - - // push an emtpy state - return PushState(); - } - - nElementsPush = nElements; - } - void *p = NULL; - hr = AllocateArray(pEntry, &p, nElements); - if (hr != S_OK) - { - return hr; - } - - SetOffsetValue(state.pvElement, p, pEntry->nOffset); - } - else - { - // for fixed-size arrays, we know the number of elements - ATLASSERT( pEntry->dwFlags & SOAPFLAG_FIXEDARR ); - if (hr == S_OK) - { - if (nElements != AtlSoapGetArrayDims(pEntry->pDims)) - { - return E_FAIL; - } - } - else - { - hr = S_OK; - nElements = AtlSoapGetArrayDims(pEntry->pDims); - } - nElementsPush = nElements; - } - - dwFlags |= pEntry->dwFlags; - - // push element with array flag - - if (S_OK != PushState(((unsigned char *)state.pvElement)+pEntry->nOffset, - state.pMap, pEntry, dwFlags & ~SOAPFLAG_READYSTATE, nAllocSize, nElementsPush)) - { - return E_OUTOFMEMORY; - } - - m_bChildCheck = true; - - return S_OK; - } - - void * UpdateArray(ParseState& state, const _soapmapentry *pEntry) - { - ATLENSURE(pEntry); - - size_t nSize; - void *pVal = NULL; - - if (pEntry->nVal != SOAPTYPE_UNK) - { - nSize = AtlSoapGetElementSize((SOAPTYPES) pEntry->nVal); - } - else - { - ATLENSURE( pEntry->pChain != NULL ); - - nSize = pEntry->pChain->nElementSize; - } - - if (state.dwFlags & SOAPFLAG_FIXEDARR) - { - unsigned char *ppArr = (unsigned char *)state.pvElement; - pVal = ppArr+(state.nElement*nSize); - } - else - { - ATLASSERT( state.dwFlags & SOAPFLAG_DYNARR ); - - unsigned char **ppArr = (unsigned char **)state.pvElement; - pVal = (*ppArr)+(state.nElement*nSize); - if (state.dwFlags & SOAPFLAG_UNKSIZE) - { - ATLASSERT( IsRpcEncoded() == false ); - - // need to use the previous state's pvElement to update the size_is value - ATLASSUME( m_nState > 0 ); - int *pnSizeIs = (int *)(((unsigned char *)m_stateStack[m_nState-1].pvElement)+ - (state.pMap->pEntries[pEntry->nSizeIs].nOffset)); - - // update size_is parameter - *pnSizeIs = (int)(state.nElement+1); - state.nExpectedElements++; - } - } - state.nElement++; - - return pVal; - } - - HRESULT ProcessString(const _soapmapentry *pEntry, void *pVal) - { - ATLENSURE_RETURN( pEntry != NULL ); - - // set to the string builder class - - ATLASSERT( GetReader() != NULL ); - - m_stringBuilder.SetReader(GetReader()); - m_stringBuilder.SetParent(this); - - m_stringBuilder.Clear(); - GetReader()->putContentHandler( &m_stringBuilder ); - - if (S_OK != PushState(pVal, NULL, pEntry, SOAPFLAG_READYSTATE | pEntry->dwFlags)) - { - return E_OUTOFMEMORY; - } - - return S_OK; - } - - - HRESULT CheckHref( - const _soapmapentry *pEntry, - void *pVal, - ISAXAttributes *pAttributes, - DWORD dwIncludeFlags = 0, - DWORD dwExcludeFlags = 0) - { - ATLASSERT( pEntry != NULL ); - ATLASSERT( pVal != NULL ); - ATLASSERT( pAttributes != NULL ); - - const wchar_t *wsz = NULL; - int cch = 0; - - HRESULT hr = GetAttribute(pAttributes, L"href", sizeof("href")-1, &wsz, &cch); - if ((hr == S_OK) && (wsz != NULL)) - { - // only allow hrefs on structs and arrays - if (((pEntry->dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR))==0) && - (pEntry->pChain == NULL || pEntry->pChain->mapType != SOAPMAP_STRUCT)) - { - ATLTRACE( _T("ATL Server only allows href's on arrays and structs.\r\n") ); - - return E_FAIL; - } - - ATLASSERT( IsRpcEncoded() == true ); - - _ATLTRY - { - if (*wsz == L'#') - { - wsz++; - cch--; - } - - REFSTRING strRef(wsz, cch); - if (m_refMap.Lookup(strRef) != NULL) - { - // ATL Server does not support multi-reference objects - ATLASSERT( FALSE ); - return E_FAIL; - } - - ParseState& currState = GetState(); - if ((currState.pEntry != NULL) && (currState.pEntry->dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR))) - { - // it is an array item - ATLASSERT( currState.nElement != 0 ); - - // exclude array flags for href'd array elements - dwExcludeFlags |= SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR; - } - - ParseState state; - state.pvElement = pVal; - state.dwFlags = (pEntry->dwFlags | dwIncludeFlags) & ~dwExcludeFlags; - state.nExpectedElements = 0; - - state.nElement = 0; - state.pMap = GetState().pMap; - state.pEntry = pEntry; - - if (!m_refMap.SetAt(strRef, state)) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckHref -- out of memory.\r\n" ) ); - - return E_OUTOFMEMORY; - } - - // make sure there are no child elements - m_bNullCheck = true; - - // push an emtpy state - return PushState(); - } - _ATLCATCHALL() - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckHref -- out of memory.\r\n" ) ); - - return E_OUTOFMEMORY; - } - } - - return S_FALSE; - } - - HRESULT ProcessUDT( - const _soapmapentry *pEntry, - void *pVal) - { - ATLENSURE_RETURN( pEntry != NULL ); - ATLENSURE_RETURN( pVal != NULL ); - ATLENSURE_RETURN( pEntry->nVal != SOAPTYPE_ERR ); - ATLENSURE_RETURN( pEntry->nVal != SOAPTYPE_USERBASE ); - - // if it is a complex type, get the chain entry - // and push the new state on the stack - - DWORD dwFlags = pEntry->dwFlags; - if (pEntry->pChain->mapType != SOAPMAP_ENUM) - { - // struct - dwFlags &= ~(SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR); - m_bChildCheck = pEntry->pChain->nElements != 0; - } - else - { - // enum - dwFlags |= SOAPFLAG_READYSTATE; - - // enums must not have child elements - m_bNullCheck = true; - - // enums must be specified - m_bCharacters = true; - } - - if (S_OK != PushState(pVal, pEntry->pChain, pEntry, dwFlags, 0, pEntry->pChain->nElements)) - { - return E_OUTOFMEMORY; - } - - return S_OK; - } - - HRESULT ChainEntry( - const ParseState& state, - const wchar_t *wszNamespaceUri, - int cchNamespaceUri, - const wchar_t *wszLocalName, - int cchLocalName, - ISAXAttributes *pAttributes) - { - ATLENSURE_RETURN( state.pMap != NULL ); - - // PAD is only supported on the client - const _soapmap *pMap = state.pMap; - if ((pMap->dwCallFlags & SOAPFLAG_CHAIN)==0) - { - return S_FALSE; - } - - ATLENSURE_RETURN( pMap->dwCallFlags & SOAPFLAG_PAD ); - ATLASSUME( m_bClient == true ); - ATLENSURE_RETURN( pMap->nElements == 1 ); - const _soapmapentry *pEntries = pMap->pEntries; - ATLENSURE_RETURN( pEntries != NULL ); - - int nIndex; - if (pEntries[0].dwFlags & SOAPFLAG_OUT) - { - nIndex = 0; - } - else - { - nIndex = 1; - } - - const _soapmapentry *pEntry = &pEntries[nIndex]; - ATLENSURE_RETURN( pEntry->nHash != 0 ); - ATLENSURE_RETURN( pEntry->pChain != NULL ); - - if (S_OK != PushState(state.pvElement, pEntry->pChain, pEntry, pEntry->dwFlags, 0, pEntry->pChain->nElements)) - { - return E_OUTOFMEMORY; - } - - return ProcessParams(wszNamespaceUri, cchNamespaceUri, wszLocalName, cchLocalName, pAttributes); - } - - HRESULT IsNullEntry(const _soapmapentry *pEntry, ISAXAttributes *pAttributes) - { - ATLASSERT( pEntry != NULL ); - ATLASSERT( pAttributes != NULL ); - - HRESULT hr = E_FAIL; - bool bNull = false; - const wchar_t *wszNull = NULL; - int cchNull = 0; - hr = GetAttribute(pAttributes, L"nil", sizeof("nil")-1, &wszNull, &cchNull, - XSI_NAMESPACEW, sizeof(XSI_NAMESPACEA)-1); - if ((hr == S_OK) && (wszNull != NULL)) - { - hr = AtlGetSAXValue(&bNull, wszNull, cchNull); - if (hr == S_OK) - { - if (bNull != false) - { - if (pEntry->dwFlags & SOAPFLAG_NULLABLE) - { - m_bNullCheck = true; - - // push an emtpy state - return PushState(); - } - - // non-nullable element - return E_FAIL; - } - } - } - - return S_FALSE; - } - - HRESULT ProcessParams( - const wchar_t *wszNamespaceUri, - int cchNamespaceUri, - const wchar_t *wszLocalName, - int cchLocalName, - ISAXAttributes *pAttributes) - { - (wszNamespaceUri); - (cchNamespaceUri); - - if (m_stateStack.IsEmpty()) - { - if (m_dwState == SOAP_HEADERS) - { - return CheckMustUnderstandHeader(pAttributes); - } - - return E_FAIL; - } - - ParseState &state = GetState(); - - ATLASSERT( state.pvElement != NULL ); - HRESULT hr = E_FAIL; - const _soapmapentry *pEntry = NULL; - - // if array element - if (state.dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) - { - hr = ValidateArrayEntry(state, wszLocalName, cchLocalName); - - if (SUCCEEDED(hr)) - { - pEntry = state.pEntry; - } - else - { - return hr; - } - } - else // not an array element - { - // special-case for PAD with type= - hr = ChainEntry(state, wszNamespaceUri, cchNamespaceUri, - wszLocalName, cchLocalName, pAttributes); - - if (hr == S_FALSE) - { - hr = GetElementEntry(state, wszNamespaceUri, wszLocalName, cchLocalName, pAttributes, &pEntry); - if (hr != S_OK) - { - if (hr == S_FALSE) - { - hr = S_OK; - } - else if (m_dwState == SOAP_HEADERS) - { - hr = CheckMustUnderstandHeader(pAttributes); - } - return hr; - } - - ATLASSERT( pEntry != NULL ); - } - else - { - return hr; - } - } - - hr = IsNullEntry(pEntry, pAttributes); - if (hr != S_FALSE) - { - return hr; - } - hr = S_OK; - ATLENSURE_RETURN(pEntry); - // if is array - if (((pEntry->pDims != NULL) || (pEntry->dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR))) && - ((state.dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) == 0)) - { - // get SOAP section-5 info (if it is there) - return GetSection5Info(state, pEntry, pAttributes); - } - else - { - // if it is a simple type, push a new (ready) state on the stack - void *pVal; - if (state.dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) - { - pVal = UpdateArray(state, pEntry); - ATLASSERT( pVal != NULL ); - } - else - { - pVal = (((unsigned char *)state.pvElement)+pEntry->nOffset); - } - - if (IsRpcEncoded() != false) - { - // check for href - // we ONLY do this for rpc/encoded (required for interop) - // NOTE: ATL Server does not support object graphs, so - // only single-reference elements are allowed - hr = CheckHref(pEntry, pVal, pAttributes); - if (hr != S_FALSE) - { - return hr; - } - hr = S_OK; - } - - if (pEntry->nVal != SOAPTYPE_UNK) - { - // simple types should not have child elements - m_bNullCheck = true; - - // if it is a string - if ((pEntry->nVal == SOAPTYPE_STRING) || (pEntry->nVal == SOAPTYPE_BASE64BINARY)) - { - hr = ProcessString(pEntry, pVal); - } - else - { - // expect characters for all non-string simple types - m_bCharacters = true; - - // basic simple type - if (S_OK != PushState(pVal, NULL, pEntry, SOAPFLAG_READYSTATE | pEntry->dwFlags)) - { - hr = E_OUTOFMEMORY; - } - } - } - else - { - hr = ProcessUDT(pEntry, pVal); - if (pEntry->dwFlags & (SOAPFLAG_DYNARRWRAPPER)) - { - // We're moving to the **first** entry in the dynamic array wrapper. - // We know it is the first entry because the dynamic array wrapper is created - // by sproxy and it guarantees this layouts. - ++m_nDepth; - ProcessParams (wszNamespaceUri, cchNamespaceUri, pEntry->pChain->pEntries[0].wszField, - pEntry->pChain->pEntries[0].cchField, pAttributes); - } - } - } - - return hr; - } - - size_t GetSizeIsValue(void *pvParam, const _soapmap *pMap, const _soapmapentry *pEntry) - { - ATLENSURE( pvParam != NULL ); - ATLENSURE( pMap != NULL ); - ATLENSURE( pEntry != NULL ); - - int nSizeIs = pEntry->nSizeIs; - size_t nOffset = pMap->pEntries[nSizeIs].nOffset; - void *pVal = ((unsigned char *)pvParam)+nOffset; - - __int64 nVal = 0; - switch(pMap->pEntries[nSizeIs].nVal) - { - case SOAPTYPE_INTEGER: - case SOAPTYPE_NONPOSITIVEINTEGER: - case SOAPTYPE_NEGATIVEINTEGER: - case SOAPTYPE_LONG: - nVal = *((__int64 *)pVal); - break; - case SOAPTYPE_INT: - nVal = *((int *)pVal); - break; - case SOAPTYPE_SHORT: - nVal = *((short *)pVal); - break; - case SOAPTYPE_BYTE: - nVal = *((char *)pVal); - break; - case SOAPTYPE_POSITIVEINTEGER: - case SOAPTYPE_NONNEGATIVEINTEGER: - case SOAPTYPE_UNSIGNEDLONG: - unsigned __int64 n; - n = *((unsigned __int64 *)pVal); - if (n > _I64_MAX) - { - // come on ... - nVal = 0; - } - else - { - nVal = (__int64)n; - } - break; - case SOAPTYPE_UNSIGNEDINT: - nVal = *((unsigned int *)pVal); - break; - case SOAPTYPE_UNSIGNEDSHORT: - nVal = *((unsigned short *)pVal); - break; - case SOAPTYPE_UNSIGNEDBYTE: - nVal = *((unsigned char *)pVal); - break; - default: - nVal = 0; - } - - if (nVal < 0) - { - nVal = 0; - } - - return (size_t) nVal; - } - - HRESULT GenerateArrayInfo(const _soapmapentry *pEntry, const int *pDims, IWriteStream *pStream) - { - ATLENSURE_RETURN( pEntry != NULL ); - ATLENSURE_RETURN( pStream != NULL ); - - HRESULT hr = S_OK; - if (pEntry->nVal != SOAPTYPE_UNK) - { - // xsd type - hr = pStream->WriteStream(" soapenc:arrayType=\"xsd:", - sizeof(" soapenc:arrayType=\"xsd:")-1, NULL); - } - else - { - ATLENSURE_RETURN( pEntry->pChain != NULL ); - - hr = pStream->WriteStream(" xmlns:q1=\"", sizeof(" xmlns:q1=\"")-1, NULL); - if (SUCCEEDED(hr)) - { - if (pEntry->pChain->szNamespace != NULL) - { - hr = pStream->WriteStream(pEntry->pChain->szNamespace, pEntry->pChain->cchNamespace, NULL); - } - else - { - hr = pStream->WriteStream(GetNamespaceUriA(), -1, NULL); - } - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream("\"", 1, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(" soapenc:arrayType=\"q1:", - sizeof(" soapenc:arrayType=\"q1:")-1, NULL); - } - } - } - } - - if (FAILED(hr)) - { - return hr; - } - - if (pEntry->nVal != SOAPTYPE_UNK) - { - hr = pStream->WriteStream(s_xsdNames[pEntry->nVal].szName , - s_xsdNames[pEntry->nVal].cchName, NULL); - } - else - { - ATLASSERT( pEntry->pChain != NULL ); - - hr = pStream->WriteStream(pEntry->pChain->szName, pEntry->pChain->cchName, NULL); - } - - if (FAILED(hr)) - { - return hr; - } - - hr = pStream->WriteStream("[", 1, NULL); - if (FAILED(hr)) - { - return hr; - } - - CWriteStreamHelper s( pStream ); - for (int i=1; i<=pDims[0]; i++) - { - if (!s.Write(pDims[i]) || - ((i < pDims[0]) && (S_OK != pStream->WriteStream(", ", 2, NULL)))) - { - return E_FAIL; - } - } - - hr = pStream->WriteStream("]\"", 2, NULL); - if (FAILED(hr)) - { - return hr; - } - - return S_OK; - } - - HRESULT GenerateXSDWrapper(bool bStart, int nVal, bool bNull, IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - - HRESULT hr = pStream->WriteStream((bStart != false) ? "<" : "WriteStream(s_xsdNames[nVal].szName, - s_xsdNames[nVal].cchName, NULL); - if ((bNull != false) && (SUCCEEDED(hr))) - { - hr = pStream->WriteStream(" xsi:nil=\"1\"", sizeof(" xsi:nil=\"1\"")-1, NULL); - } - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(">", 1, NULL); - } - } - - return hr; - } - - HRESULT GenerateGenericWrapper(bool bStart, const _soapmap *pMap, IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - HRESULT hr = pStream->WriteStream((bStart != false) ? "<" : "WriteStream(pMap->szName, pMap->cchName, NULL); - if (SUCCEEDED(hr)) - { - hr = pStream->WriteStream(">", 1, NULL); - } - } - - return hr; - } - - HRESULT GetArrayInformation( - IWriteStream *pStream, - const _soapmap *pMap, - const _soapmapentry *pEntry, - void *pvParam, - size_t &nCnt, - size_t &nElementSize) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - ATLENSURE_RETURN( pEntry != NULL ); - ATLENSURE_RETURN( pvParam != NULL ); - - const int *pDims = NULL; - int arrDims[2] = { 0 }; - - if (pEntry->dwFlags & SOAPFLAG_FIXEDARR) - { - pDims = pEntry->pDims; - } - else - { - ATLASSERT( pEntry->dwFlags & SOAPFLAG_DYNARR ); - nCnt = GetSizeIsValue(pvParam, pMap, pEntry); - - if (nCnt == 0) - { - // array size should only be zero if array is NULL - // did you forget to set the array size? - ATLASSERT( FALSE ); - return E_FAIL; - } - - arrDims[0] = 1; - arrDims[1] = (int) nCnt; - - pDims = arrDims; - } - - // output array information - HRESULT hr = GenerateArrayInfo(pEntry, pDims, pStream); - if (FAILED(hr)) - { - return hr; - } - if (SUCCEEDED(hr)) - { - nCnt = AtlSoapGetArrayDims(pDims); - - // did you forget to set the size_is value? - ATLASSERT( nCnt != 0 ); - - if (pEntry->nVal != SOAPTYPE_UNK) - { - nElementSize = AtlSoapGetElementSize((SOAPTYPES) pEntry->nVal); - } - else - { - ATLENSURE_RETURN( pEntry->pChain != NULL ); - - nElementSize = pEntry->pChain->nElementSize; - } - } - - return hr; - } - - HRESULT GenerateEnum(IWriteStream *pStream, void *pVal, const _soapmapentry *pEntry, bool bArray) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pVal != NULL ); - ATLENSURE_RETURN( pEntry != NULL ); - - int nVal = *((int *)pVal); - const _soapmapentry *pEnumEntries = pEntry->pChain->pEntries; - - ATLENSURE_RETURN( pEnumEntries != NULL ); - size_t j; - HRESULT hr = E_FAIL; - for (j=0; pEnumEntries[j].nHash != 0; j++) - { - if (nVal == pEnumEntries[j].nVal) - { - hr = pStream->WriteStream(pEnumEntries[j].szField, pEnumEntries[j].cchField, NULL); - if ((bArray != false) && (SUCCEEDED(hr))) - { - hr = GenerateGenericWrapper(false, pEntry->pChain, pStream); - } - break; - } - } - - return hr; - } - - HRESULT GenerateHeaders(CResponseGenerator *pGenerator, const _soapmap *pMap, IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - - ATLENSURE_RETURN( pGenerator != NULL ); - - DWORD dwIncludeFlags = SOAPFLAG_OUT; - if (m_bClient != false) - { - dwIncludeFlags = SOAPFLAG_IN; - } - - size_t nCnt = 0; - for (size_t i=0; pMap->pEntries[i].nHash != 0; i++) - { - if (pMap->pEntries[i].dwFlags & dwIncludeFlags) - { - nCnt++; - } - } - - // no headers to be sent - if (nCnt == 0) - { - return S_OK; - } - - HRESULT hr = pGenerator->StartHeaders(pStream, pMap); - if (SUCCEEDED(hr)) - { - hr = GenerateResponseHelper(pGenerator, pMap, GetHeaderValue(), pStream); - if (SUCCEEDED(hr)) - { - hr = pGenerator->EndHeaders(pStream); - } - } - - return hr; - } - - bool IsNullElement(const _soapmapentry *pEntry, void *pVal, DWORD dwExcludeFlags=0) - { - ATLENSURE( pEntry != NULL ); - ATLENSURE( pVal != NULL ); - - bool bNull = false; - - DWORD dwFlags = pEntry->dwFlags & ~dwExcludeFlags; - - if (dwFlags & SOAPFLAG_DYNARR) - { - unsigned char **ppArr = (unsigned char **)pVal; - if (*ppArr == NULL) - { - bNull = true; - } - } - else if (pEntry->nVal == SOAPTYPE_STRING) - { - BSTR *pBSTR = (BSTR *)pVal; - if (*pBSTR == NULL) - { - bNull = true; - } - } - else if ((pEntry->nVal == SOAPTYPE_BASE64BINARY) || (pEntry->nVal == SOAPTYPE_HEXBINARY)) - { - if (((ATLSOAP_BLOB *)pVal)->data == NULL) - { - bNull = true; - } - } - - return bNull; - } - - HRESULT GenerateNull(IWriteStream *pStream) - { - ATLENSURE_RETURN( pStream != NULL ); - return pStream->WriteStream(" xsi:nil=\"1\"/>", sizeof(" xsi:nil=\"1\"/>")-1, NULL); - } - - HRESULT GenerateResponseHelper(CResponseGenerator *pGenerator, const _soapmap *pMap, void *pvParam, IWriteStream *pStream, - bool bArrayElement = false) - { - ATLENSURE_RETURN( pGenerator != NULL ); - ATLENSURE_RETURN( pMap != NULL ); - ATLENSURE_RETURN( pStream != NULL ); - - HRESULT hr = S_OK; - - if ((bArrayElement != false) && - ((pMap->dwCallFlags & SOAPFLAG_PAD)==0)) - { - hr = pGenerator->StartMap(pStream, pMap, m_bClient); - if (FAILED(hr)) - { - return hr; - } - } - - ATLENSURE_RETURN( pMap->pEntries != NULL ); - - const _soapmapentry *pEntries = pMap->pEntries; - size_t i; - - DWORD dwIncludeFlags; - DWORD dwExcludeFlags; - if (m_bClient != false) - { - dwIncludeFlags = SOAPFLAG_IN; - dwExcludeFlags = SOAPFLAG_OUT; - } - else - { - dwIncludeFlags = SOAPFLAG_OUT; - dwExcludeFlags = SOAPFLAG_IN; - } - - for (i=0; pEntries[i].nHash != 0; i++) - { - if (((pEntries[i].dwFlags & dwIncludeFlags) || - ((pEntries[i].dwFlags & dwExcludeFlags)==0)) && - ((pEntries[i].dwFlags & SOAPFLAG_NOMARSHAL)==0)) - { - hr = pGenerator->StartEntry(pStream, pMap, &pEntries[i]); - if (FAILED(hr)) - { - return hr; - } - - size_t nElementSize = 0; - size_t nCnt = 1; - - ATLASSERT( pvParam != NULL ); - - void *pvCurrent = ((unsigned char *)pvParam)+pEntries[i].nOffset; - - if (IsNullElement(&pEntries[i], pvCurrent)) - { - hr = GenerateNull(pStream); - if (SUCCEEDED(hr)) - { - continue; - } - return hr; - } - - bool bArray = (pEntries[i].dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) != 0; - if (bArray != false) - { - hr = GetArrayInformation(pStream, pMap, &pEntries[i], pvParam, nCnt, nElementSize); - } - - hr = pStream->WriteStream(">", 1, NULL); - if (FAILED(hr)) - { - return hr; - } - - for (size_t nElement=0; nElementmapType != SOAPMAP_ENUM) - { - // struct - hr = GenerateResponseHelper(pGenerator, pEntries[i].pChain, pVal, pStream, bArray); - } - else - { - if (bArray != false) - { - hr = GenerateGenericWrapper(true, pEntries[i].pChain, pStream); - if (FAILED(hr)) - { - return hr; - } - } - - hr = GenerateEnum(pStream, pVal, &pEntries[i], bArray); - } - } - } - - // output element close - if (SUCCEEDED(hr)) - { - hr = pGenerator->EndEntry(pStream, pMap, &pEntries[i]); - } - } - - if (FAILED(hr)) - { - return hr; - } - } - - if ((bArrayElement != false) && - ((pMap->dwCallFlags & SOAPFLAG_PAD)==0)) - { - // output type name - hr = pGenerator->EndMap(pStream, pMap, m_bClient); - } - - return hr; - } - - void CleanupHelper(const _soapmap *pMap, void *pvParam) - { - ATLENSURE( pMap != NULL ); - ATLENSURE( pMap->pEntries != NULL ); - - if (pvParam == NULL) - { - return; - } - - const _soapmapentry *pEntries = pMap->pEntries; - size_t i; - - for (i=0; pEntries[i].nHash != 0; i++) - { - if ((m_bClient != false) && ((pEntries[i].dwFlags & SOAPFLAG_OUT)==0)) - { - // skip in-only headers on the client - continue; - } - - void *pvCheck = ((unsigned char *)pvParam)+pEntries[i].nOffset; - if (IsNullElement(&pEntries[i], pvCheck)) - { - continue; - } - - size_t nElementSize = 0; - size_t nCnt = 1; - - const int *pDims = NULL; - int arrDims[2] = { 0 }; - - bool bArray = (pEntries[i].dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) != 0; - - if (bArray != false) - { - if (pEntries[i].dwFlags & SOAPFLAG_FIXEDARR) - { - pDims = pEntries[i].pDims; - } - else - { - ATLASSERT( pEntries[i].dwFlags & SOAPFLAG_DYNARR ); - nCnt = GetSizeIsValue(pvParam, pMap, &pEntries[i]); - - arrDims[0] = 1; - arrDims[1] = (int) nCnt; - - pDims = arrDims; - } - - nCnt = AtlSoapGetArrayDims(pDims); - - if (pEntries[i].nVal != SOAPTYPE_UNK) - { - nElementSize = AtlSoapGetElementSize((SOAPTYPES) pEntries[i].nVal); - } - else - { - ATLENSURE( pEntries[i].pChain != NULL ); - - nElementSize = pEntries[i].pChain->nElementSize; - } - } - - void *pvCurrent = ((unsigned char *)pvParam)+pEntries[i].nOffset; - - for (size_t nElement=0; nElementmapType != SOAPMAP_ENUM) - { - CleanupHelper(pEntries[i].pChain, pVal); - } - } - } - - if (pEntries[i].dwFlags & SOAPFLAG_DYNARR) - { - // free it - unsigned char **ppArr = (unsigned char **)pvCurrent; - - ATLENSURE( ppArr != NULL ); - - if (*ppArr != NULL) - { - m_pMemMgr->Free(*ppArr); - *ppArr = NULL; - } - } - } - } - - const _soapmap * GetSoapMapFromName( - const wchar_t * wszName, - int cchName = -1, - const wchar_t * wszNamespaceUri = NULL, - int cchNamespaceUri = -1, - int *pnVal = NULL, - bool bHeader = false) - { - (cchNamespaceUri); - - const _soapmap ** pEntry = NULL; - - if (bHeader == false) - { - pEntry = GetFunctionMap(); - } - else - { - pEntry = GetHeaderMap(); - } - - if (pEntry == NULL) - { - return NULL; - } - - if (cchName < 0) - { - cchName = (int)wcslen(wszName); - } - if ((cchNamespaceUri < 0) && (wszNamespaceUri != NULL)) - { - cchNamespaceUri = (int)wcslen(wszNamespaceUri); - } - - ULONG nFunctionHash = AtlSoapHashStr(wszName, cchName); - ULONG nNamespaceHash = wszNamespaceUri ? AtlSoapHashStr(wszNamespaceUri, cchNamespaceUri) : 0; - - int i; - for (i=0; pEntry[i] != NULL; i++) - { - if ((IsEqualStringHash(wszName, cchName, nFunctionHash, - pEntry[i]->wszName, pEntry[i]->cchWName, pEntry[i]->nHash) != FALSE) && - (!wszNamespaceUri || - IsEqualStringHash(wszNamespaceUri, cchNamespaceUri, nNamespaceHash, - pEntry[i]->wszNamespace, pEntry[i]->cchNamespace, pEntry[i]->nNamespaceHash) != FALSE)) - { - break; - } - } - - if (pnVal != NULL) - { - *pnVal = i; - } - return pEntry[i]; - } - - HRESULT CheckEndElement(const ParseState& state) - { - // check for all elements - if (state.nElement == state.nExpectedElements) - { - return S_OK; - } - - // error check for fixed arrays - if (state.dwFlags & SOAPFLAG_FIXEDARR) - { - return E_FAIL; - } - - // check for dynamic arrays - if (state.dwFlags & SOAPFLAG_DYNARR) - { - // check for dynamic arrays with known size - // (from soap:arrayType attribute) - if ((state.dwFlags & SOAPFLAG_UNKSIZE)==0) - { - return E_FAIL; - } - } - - DWORD dwIncludeFlags; - DWORD dwExcludeFlags; - - if (m_bClient != false) - { - dwIncludeFlags = SOAPFLAG_OUT; - dwExcludeFlags = SOAPFLAG_IN; - } - else - { - dwIncludeFlags = SOAPFLAG_IN; - dwExcludeFlags = SOAPFLAG_OUT; - } - - if (state.pMap != NULL) - { - // ensure all omitted elements were nullable elements or nomarshal elements - const _soapmapentry *pEntries = state.pMap->pEntries; - for (size_t i=0; pEntries[i].nHash != 0; i++) - { - if ((pEntries[i].dwFlags & dwIncludeFlags) || - ((pEntries[i].dwFlags & dwExcludeFlags)==0)) - { - if (state.vec.GetBit(i) == false) - { - if (((pEntries[i].dwFlags & (SOAPFLAG_NULLABLE | SOAPFLAG_NOMARSHAL))==0) && (pEntries[i].nVal != SOAPTYPE_UNK)) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckEndElement -- invalid number of elements for parameter/field\r\n") ); - return E_FAIL; - } - } - } - } - } - - return S_OK; - } - - HRESULT CheckSoapHeaders(const ParseState &state) - { - DWORD dwIncludeFlags; - DWORD dwExcludeFlags; - - if (m_bClient != false) - { - dwIncludeFlags = SOAPFLAG_OUT; - dwExcludeFlags = SOAPFLAG_IN; - } - else - { - dwIncludeFlags = SOAPFLAG_IN; - dwExcludeFlags = SOAPFLAG_OUT; - } - - if (state.pMap != NULL) - { - ATLASSERT( state.pMap->mapType == SOAPMAP_HEADER ); - - // ensure all omitted elements were nullable elements, nomarshal elements, or non-required elements - const _soapmapentry *pEntries = state.pMap->pEntries; - for (size_t i=0; pEntries[i].nHash != 0; i++) - { - if ((pEntries[i].dwFlags & dwIncludeFlags) || - ((pEntries[i].dwFlags & dwExcludeFlags)==0)) - { - if (state.vec.GetBit(i) == false) - { - bool bNoOmit = (pEntries[i].dwFlags & (SOAPFLAG_NULLABLE | SOAPFLAG_NOMARSHAL))==0; - - if ((bNoOmit != false) || - ((bNoOmit != false) && (pEntries[i].dwFlags & SOAPFLAG_MUSTUNDERSTAND))) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::CheckSoapHeaders -- missing header\r\n") ); - return E_FAIL; - } - } - } - } - } - - return S_OK; - } - - HRESULT CheckEndHeaders( - const wchar_t * wszNamespaceUri, - int cchNamespaceUri, - const wchar_t * wszLocalName, - int cchLocalName) - { - if (IsEqualElement(sizeof(SOAP_HEADERA)-1, SOAP_HEADERW, - sizeof(SOAPENV_NAMESPACEA)-1, SOAPENV_NAMESPACEW, - cchLocalName, wszLocalName, - cchNamespaceUri, wszNamespaceUri)) - { - m_dwState = SOAP_HEADERS_DONE; - return S_OK; - } - - // some sort of error - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::endElement -- invalid SOAP message format while processing headers.\r\n" ) ); - - return E_FAIL; - } - -protected: - - ISAXXMLReader * SetReader(ISAXXMLReader *pReader) - { - ISAXXMLReader *pPrevRdr = m_spReader; - m_spReader = pReader; - - return pPrevRdr; - } - - ISAXXMLReader * GetReader() - { - return m_spReader; - } - - HRESULT SetSoapMapFromName( - const wchar_t * wszName, - int cchName = -1, - const wchar_t * wszNamespaceUri = NULL, - int cchNamespaceUri = -1, - bool bHeader = false) - { - ATLENSURE_RETURN( wszName != NULL ); - - int nVal; - const _soapmap *pMap = NULL; - if (m_stateStack.GetCount() != 0) - { - ATLASSUME( m_stateStack[0].pMap != NULL ); - nVal = (int) m_stateStack[0].nAllocSize; - ATLASSERT( GetFunctionMap() != NULL ); - pMap = GetFunctionMap()[nVal]; - } - else - { - pMap = GetSoapMapFromName(wszName, cchName, - wszNamespaceUri, cchNamespaceUri, &nVal, bHeader); - } - - if (pMap == NULL) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::SetSoapMapFromName -- _soapmap not found for: %.*ws, with namespace %.*ws\r\n"), - (int)wcslen(wszName), wszName, wszNamespaceUri ? (int)wcslen(wszNamespaceUri) : 0, wszNamespaceUri ? wszNamespaceUri : L""); - - return E_FAIL; - } - - HRESULT hr = E_OUTOFMEMORY; - - // allocate the parameter struct - - void *pvParam = NULL; - if (bHeader != false) - { - pvParam = GetHeaderValue(); - } - else - { - if (m_bClient == false) - { - m_pvParam = m_pMemMgr->Allocate(pMap->nElementSize); - } - pvParam = m_pvParam; - } - - if (pvParam != NULL) - { - if (bHeader == false) - { - memset(pvParam, 0x00, pMap->nElementSize); - } - - // push initial state - - if (m_stateStack.GetCount() != 0) - { - m_stateStack.RemoveAll(); - } - - hr = PushState(pvParam, pMap, NULL, 0, nVal, pMap->nElements); - - if (FAILED(hr)) - { - if ((m_bClient == false) && (bHeader == false)) - { - m_pMemMgr->Free(pvParam); - } - } - } - -#ifdef _DEBUG - if (hr == E_OUTOFMEMORY) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::SetSoapMapFromName -- out of memory.\r\n" ) ); - } -#endif // _DEBUG - - return hr; - } - - // implementation - virtual const _soapmap ** GetFunctionMap() = 0; - virtual const _soapmap ** GetHeaderMap() = 0; - virtual const wchar_t * GetNamespaceUri() = 0; - virtual const char * GetServiceName() = 0; - virtual const char * GetNamespaceUriA() = 0; - virtual HRESULT CallFunction( - void *pvParam, - const wchar_t *wszLocalName, int cchLocalName, - size_t nItem) = 0; - virtual void * GetHeaderValue() = 0; - -public: - - CSoapRootHandler(ISAXXMLReader *pReader = NULL) - : m_pMemMgr(&m_crtHeap), m_spReader(pReader), m_bClient(false), - m_nState(0), m_pvParam(NULL), m_nDepth(0) - { - InitHandlerState(); - } - virtual ~CSoapRootHandler() - { - m_skipHandler.DetachParent(); - } - - IAtlMemMgr * SetMemMgr(IAtlMemMgr *pMemMgr) - { - IAtlMemMgr *pPrevMgr = m_pMemMgr; - m_pMemMgr = pMemMgr; - - return pPrevMgr; - } - - IAtlMemMgr * GetMemMgr() - { - return m_pMemMgr; - } - - // override this function to do SOAP Fault handling - virtual HRESULT SoapFault( - SOAP_ERROR_CODE /*errCode*/, - const wchar_t * /*wszDetail*/, - int /*cchDetail*/) - { - if (m_bClient != false) - { - return S_OK; - } - - // SOAP servers must implement this function - ATLASSERT( FALSE ); - return E_FAIL; - } - - // - // implementation - // - - void InitHandlerState() - { - m_bNullCheck = false; - m_bCharacters = false; - m_bChildCheck = false; - m_dwState = SOAP_START; - } - HRESULT __stdcall startDocument() - { - InitHandlerState(); - return S_OK; - } - - HRESULT __stdcall startElement( - const wchar_t *wszNamespaceUri, - int cchNamespaceUri, - const wchar_t *wszLocalName, - int cchLocalName, - const wchar_t * wszQName, - int cchQName, - ISAXAttributes *pAttributes) - { - if (m_bNullCheck || m_bCharacters) - { - // make sure elements that aren't supposed to have child elements - // do not have child elements, and where we were expecting - // characters, we got them - return E_FAIL; - } - - m_bChildCheck = false; - ++m_nDepth; - - HRESULT hr = S_OK; - switch (m_dwState) - { - case SOAP_PARAMS: case SOAP_HEADERS: - { - hr = ProcessParams(wszNamespaceUri, cchNamespaceUri, wszLocalName, - cchLocalName, pAttributes); - - break; - } - case SOAP_START: case SOAP_ENVELOPE: case SOAP_HEADERS_DONE: - { - ULONG nNamespaceHash = AtlSoapHashStr(wszNamespaceUri, - cchNamespaceUri); - if (nNamespaceHash != SOAP_ENV) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::startElement -- incorrect SOAP-ENV namespace.\r\n" ) ); - - return E_FAIL; - } - - ULONG nElementHash = AtlSoapHashStr(wszLocalName, cchLocalName); - - if (nElementHash == ENVELOPE && - IsEqualElement( - sizeof(SOAP_ENVELOPEA)-1, SOAP_ENVELOPEW, - sizeof(SOAPENV_NAMESPACEA)-1, SOAPENV_NAMESPACEW, - cchLocalName, wszLocalName, - cchNamespaceUri, wszNamespaceUri)) - { - // Envelope must be first element in package - - if (m_dwState != SOAP_START) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::startElement -- invalid SOAP message format: \"Envelope\" in unexpected location.\r\n" ) ); - - hr = E_FAIL; - } - m_dwState = SOAP_ENVELOPE; - } - else if (nElementHash == HEADER && - IsEqualElement(sizeof(SOAP_HEADERA)-1, SOAP_HEADERW, - sizeof(SOAPENV_NAMESPACEA)-1, SOAPENV_NAMESPACEW, - cchLocalName, wszLocalName, - cchNamespaceUri, wszNamespaceUri)) - { - if (m_dwState != SOAP_ENVELOPE) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::startElement -- invalid SOAP message format: \"Headers\" in unexpected location.\r\n" ) ); - - hr = E_FAIL; - } - - m_dwState = SOAP_HEADERS; - } - else if (nElementHash == BODY && - IsEqualElement(sizeof(SOAP_BODYA)-1, SOAP_BODYW, - sizeof(SOAPENV_NAMESPACEA)-1, SOAPENV_NAMESPACEW, - cchLocalName, wszLocalName, - cchNamespaceUri, wszNamespaceUri)) - { - if (m_dwState == SOAP_START) - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::startElement -- invalid SOAP message format: \"Body\" in unexpected location.\r\n" ) ); - - hr = E_FAIL; - } - m_dwState = SOAP_BODY; - } - - break; - } - case SOAP_BODY: - { - hr = DispatchSoapCall(wszNamespaceUri, cchNamespaceUri, - wszLocalName, cchLocalName); - - m_dwState = SOAP_PARAMS; - - if (SUCCEEDED(hr)) - { - if (GetState().pMap->dwCallFlags & SOAPFLAG_PAD) - { - hr = startElement(wszNamespaceUri, cchNamespaceUri, - wszLocalName, cchLocalName, wszQName, cchQName, - pAttributes); - } - } - - break; - } - -#ifdef _DEBUG - - default: - { - // should never get here -- internal error - ATLASSERT( FALSE ); - } - -#endif // _DEBUG - } - - return hr; - } - - HRESULT __stdcall characters( - const wchar_t *wszChars, - int cchChars) - { - m_bCharacters = false; - - // if it is a ready state, get the value - if (m_stateStack.IsEmpty() == false) - { - ParseState& state = GetState(); - if ((state.dwFlags & SOAPFLAG_READYSTATE) && - ((state.dwFlags & SOAPFLAG_SIZEIS)==0)) // don't marshal struct size_is elements -- should be filled in by array marshaling code - { - if ((state.pMap == NULL) || (state.pMap->mapType != SOAPMAP_ENUM)) - { - return AtlSoapGetElementValue(wszChars, cchChars, - state.pvElement, (SOAPTYPES)state.pEntry->nVal, GetMemMgr()); - } - else - { - // enum - - ATLASSERT( state.pMap != NULL ); - ATLASSERT( state.pMap->pEntries != NULL ); - - ULONG nHash = AtlSoapHashStr(wszChars, cchChars); - const _soapmapentry *pEntries = state.pMap->pEntries; - - size_t i; - for (i=0; pEntries[i].nHash != 0; i++) - { - if ((nHash == pEntries[i].nHash) && - (cchChars == pEntries[i].cchField) && - (!wcsncmp(wszChars, pEntries[i].wszField, cchChars))) - { - break; - } - } - - if (pEntries[i].nHash != 0) - { - *((int *)state.pvElement) = pEntries[i].nVal; - state.nElement++; - return S_OK; - } - - // no matching enum entry found - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::characters -- no matching enum entry found for: %.*ws.\r\n" ), cchChars, wszChars ); - - return E_FAIL; - } - } - } - - // otherwise, ignore - - return S_OK; - } - - HRESULT __stdcall endElement( - const wchar_t * wszNamespaceUri, - int cchNamespaceUri, - const wchar_t * wszLocalName, - int cchLocalName, - const wchar_t * /*wszQName*/, - int /*cchQName*/) - { - static bool bDynArrWrapper = false; - if (m_bCharacters) - { - return E_FAIL; - } - - m_bNullCheck = false; - - if (m_stateStack.IsEmpty() != false) - { - return S_OK; - } - - if (!bDynArrWrapper && (m_nState > 1)) - { - ParseState prevState = m_stateStack.GetAt(m_nState - 1); - ParseState curState = m_stateStack.GetAt(m_nState); - if (prevState.dwFlags & SOAPFLAG_DYNARRWRAPPER) - { - bDynArrWrapper = true; - endElement (wszNamespaceUri, cchNamespaceUri, curState.pEntry->wszField, - curState.pEntry->cchField, NULL, 0); - } - } - else - { - bDynArrWrapper = false; - } - - --m_nDepth; - - const ParseState& state = GetState(); - - if ((m_dwState == SOAP_HEADERS) && (m_stateStack.GetCount() == 1)) - { - return CheckEndHeaders(wszNamespaceUri, cchNamespaceUri, wszLocalName, cchLocalName); - } - - if (state.dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) - { - if (state.dwFlags & SOAPFLAG_READYSTATE) - { - PopState(); - } - - const ParseState& currstate = GetState(); - ATLENSURE_RETURN( currstate.pEntry != NULL ); - - if (m_nDepth == (currstate.nDepth-1)) - { - if (S_OK != CheckEndElement(currstate)) - { - // invalid number of elements - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::endElement -- invalid number of array elements for array parameter %.*ws.\r\n"), - currstate.pEntry->cchField, currstate.pEntry->wszField ); - - return E_FAIL; - } - - PopState(); - } - } - else - { - if (S_OK != CheckEndElement(state)) - { - return E_FAIL; - } - - PopState(); - } - - return S_OK; - } - - HRESULT SetClientStruct(void *pvParam, int nMapIndex) - { - ATLENSURE_RETURN( pvParam != NULL ); - ATLENSURE_RETURN( nMapIndex >= 0 ); - - // this is the params struct - // store for later use - m_pvParam = pvParam; - - const _soapmap ** pEntries = GetHeaderMap(); - ATLENSURE_RETURN( pEntries != NULL ); - - // push header value - return PushState(GetHeaderValue(), pEntries[nMapIndex], NULL, 0, nMapIndex, pEntries[nMapIndex]->nElements); - } - - void ResetClientState(bool bFull = false) - { - m_stateStack.RemoveAll(); - m_nState = 0; - if (bFull != false) - { - m_dwState = SOAP_START; - m_pvParam = NULL; - } - } - - HRESULT CreateReader() - { - return m_spReader.CoCreateInstance(ATLS_SAXXMLREADER_CLSID, NULL, CLSCTX_INPROC_SERVER); - } - - HRESULT InitializeSOAP(IServiceProvider *pProvider) - { - HRESULT hr = S_OK; - - if (m_spReader.p == NULL) - { - hr = E_FAIL; - if (pProvider != NULL) - { - IAtlMemMgr *pMemMgr = NULL; - hr = pProvider->QueryService(__uuidof(IAtlMemMgr), - __uuidof(IAtlMemMgr), (void **)&pMemMgr); - if ((SUCCEEDED(hr)) && (pMemMgr != NULL)) - { - SetMemMgr(pMemMgr); - } - - hr = pProvider->QueryService(__uuidof(ISAXXMLReader), - __uuidof(ISAXXMLReader), (void **)&m_spReader); - } - - if (FAILED(hr)) - { - hr = CreateReader(); - } - } - - if (SUCCEEDED(hr)) - { - hr = m_spReader->putContentHandler(this); - } - -#ifdef _DEBUG - else - { - ATLTRACE( _T("ATLSOAP: CSoapRootHandler::InitializeSOAP -- failed to get SAXXMLReader.\r\n" ) ); - } -#endif // _DEBUG - - return hr; - } - - void UninitializeSOAP() - { - if (m_spReader.p != NULL) - { - m_spReader->putContentHandler(NULL); - m_spReader.Release(); - } - } - - virtual HRESULT DispatchSoapCall(const wchar_t *wszNamespaceUri, - int cchNamespaceUri, const wchar_t *wszLocalName, - int cchLocalName) - { - HRESULT hr = S_OK; - - if (m_stateStack.IsEmpty() == false) - { - ATLASSUME( m_stateStack[0].pMap != NULL ); - - // check to see if all required and non-nullable SOAP headers were sent - if (m_stateStack[0].pMap->mapType == SOAPMAP_HEADER) - { - hr = CheckSoapHeaders(m_stateStack[0]); - } - if (SUCCEEDED(hr)) - { - hr = SetSoapMapFromName(wszLocalName, cchLocalName, - wszNamespaceUri, cchNamespaceUri); - } - } - else - { - // get the appropriate function map - hr = SetSoapMapFromName(wszLocalName, cchLocalName, - wszNamespaceUri, cchNamespaceUri); - - if (SUCCEEDED(hr)) - { - // set the SOAP Header map for the function - ATLASSUME( m_stateStack.IsEmpty() == false ); - - const _soapmap **ppHeaderMap = GetHeaderMap(); - ATLENSURE_RETURN( ppHeaderMap != NULL ); - - // create a temporary parse state for checking headers - ParseState state; - state.pMap = ppHeaderMap[m_stateStack[0].nAllocSize]; - ATLENSURE_RETURN( state.pMap != NULL ); - - // check to see if all required and non-nullable SOAP headers were sent - hr = CheckSoapHeaders(state); - } - } - - return hr; - } - - virtual HRESULT BeginParse(IStream *pStream) - { - ATLASSERT( pStream != NULL ); - - CComVariant varStream; - varStream = static_cast(pStream); - - HRESULT hr = m_spReader->parse(varStream); - if (SUCCEEDED(hr)) - { - if (m_refMap.GetCount() != 0) - { - hr = E_FAIL; - } - } - return hr; - } - - HRESULT CallFunctionInternal() - { - HRESULT hr = E_FAIL; - const ParseState& state = m_stateStack[0]; - hr = CallFunction( - state.pvElement, - state.pMap->wszName, - state.pMap->cchWName, - state.nAllocSize); - - return hr; - } - - virtual HRESULT GenerateResponse(IWriteStream *pStream) - { - ATLASSUME( m_stateStack.IsEmpty() == false ); - ATLASSUME( m_stateStack[0].pMap != NULL ); - ATLASSUME( m_stateStack[0].pvElement != NULL ); - - const ParseState& state = m_stateStack[0]; - - const _soapmap *pHeaderMap = NULL; - if (m_bClient == false) - { - const _soapmap **ppHeaderMap = GetHeaderMap(); - if (ppHeaderMap != NULL) - { - pHeaderMap = ppHeaderMap[state.nAllocSize]; - } - } - else - { - pHeaderMap = state.pMap; - } - - const _soapmap *pFuncMap = NULL; - if (m_bClient == false) - { - pFuncMap = state.pMap; - } - else - { - const _soapmap **ppFuncMap = GetFunctionMap(); - ATLENSURE_RETURN( ppFuncMap != NULL ); - pFuncMap = ppFuncMap[state.nAllocSize]; - } - - ATLENSURE_RETURN( pFuncMap != NULL ); - - CRpcEncodedGenerator rpcGen; - CPADGenerator padGen; - CPIDGenerator pidGen; - - CResponseGenerator *pGenerator = NULL; - - if ((pFuncMap->dwCallFlags & (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) == (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) - { - pGenerator = &rpcGen; - } - else if (pFuncMap->dwCallFlags & SOAPFLAG_PID) - { - ATLASSERT( (pFuncMap->dwCallFlags & (SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL)) == (SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL) ); - pGenerator = &pidGen; - } - else - { - ATLASSERT( (pFuncMap->dwCallFlags & (SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL)) == (SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL) ); - ATLASSERT( pFuncMap->dwCallFlags & SOAPFLAG_PAD ); - pGenerator = &padGen; - } - - HRESULT hr = pGenerator->StartEnvelope(pStream); - if (SUCCEEDED(hr)) - { - // generate headers if necessary - hr = GenerateHeaders(pGenerator, pHeaderMap, pStream); - if (SUCCEEDED(hr)) - { - hr = pGenerator->StartBody(pStream); - if (SUCCEEDED(hr)) - { - hr = GenerateResponseHelper(pGenerator, pFuncMap, m_pvParam, pStream, true); - if (SUCCEEDED(hr)) - { - hr = pGenerator->EndBody(pStream); - if (SUCCEEDED(hr)) - { - hr = pGenerator->EndEnvelope(pStream); - } - } - } - } - } - - return hr; - } - - virtual void Cleanup() - { - // cleanup headers - CleanupHeaders(); - - if ((m_stateStack.IsEmpty() == false) && (m_pvParam != NULL)) - { - const _soapmap **ppFuncMap = GetFunctionMap(); - ATLENSURE( ppFuncMap != NULL ); - - const _soapmap *pFuncMap = ppFuncMap[m_stateStack[0].nAllocSize]; - ATLENSURE( pFuncMap != NULL ); - - CleanupHelper(pFuncMap, m_pvParam); - if (m_bClient == false) - { - m_pMemMgr->Free(m_pvParam); - m_stateStack.RemoveAll(); - } - } - } - - virtual void CleanupHeaders() - { - if (m_stateStack.IsEmpty() == false) - { - const _soapmap **ppHeaderMap = GetHeaderMap(); - ATLENSURE( ppHeaderMap != NULL ); - - const _soapmap *pHeaderMap = ppHeaderMap[m_stateStack[0].nAllocSize]; - ATLENSURE( pHeaderMap != NULL ); - - CleanupHelper(pHeaderMap, GetHeaderValue()); - } - } - - void SetClient(bool bClient) - { - m_bClient = bClient; - } - -}; // class CSoapRootHandler - -#define DECLARE_XSD_ENTRY( __name ) \ - { L ## __name, __name, sizeof(__name)-1 }, - -__declspec(selectany) const CSoapRootHandler::XSDEntry CSoapRootHandler::s_xsdNames[] = -{ - DECLARE_XSD_ENTRY("string") - DECLARE_XSD_ENTRY("boolean") - DECLARE_XSD_ENTRY("float") - DECLARE_XSD_ENTRY("double") - DECLARE_XSD_ENTRY("decimal") - DECLARE_XSD_ENTRY("duration") - DECLARE_XSD_ENTRY("hexBinary") - DECLARE_XSD_ENTRY("base64Binary") - DECLARE_XSD_ENTRY("anyURI") - DECLARE_XSD_ENTRY("ID") - DECLARE_XSD_ENTRY("IDREF") - DECLARE_XSD_ENTRY("ENTITY") - DECLARE_XSD_ENTRY("NOTATION") - DECLARE_XSD_ENTRY("QName") - DECLARE_XSD_ENTRY("normalizedString") - DECLARE_XSD_ENTRY("token") - DECLARE_XSD_ENTRY("language") - DECLARE_XSD_ENTRY("IDREFS") - DECLARE_XSD_ENTRY("ENTITIES") - DECLARE_XSD_ENTRY("NMTOKEN") - DECLARE_XSD_ENTRY("NMTOKENS") - DECLARE_XSD_ENTRY("Name") - DECLARE_XSD_ENTRY("NCName") - DECLARE_XSD_ENTRY("integer") - DECLARE_XSD_ENTRY("nonPositiveInteger") - DECLARE_XSD_ENTRY("negativeInteger") - DECLARE_XSD_ENTRY("long") - DECLARE_XSD_ENTRY("int") - DECLARE_XSD_ENTRY("short") - DECLARE_XSD_ENTRY("byte") - DECLARE_XSD_ENTRY("nonNegativeInteger") - DECLARE_XSD_ENTRY("unsignedLong") - DECLARE_XSD_ENTRY("unsignedInt") - DECLARE_XSD_ENTRY("unsignedShort") - DECLARE_XSD_ENTRY("unsignedByte") - DECLARE_XSD_ENTRY("positiveInteger") - DECLARE_XSD_ENTRY("dateTime") - DECLARE_XSD_ENTRY("time") - DECLARE_XSD_ENTRY("date") - DECLARE_XSD_ENTRY("gMonth") - DECLARE_XSD_ENTRY("gYearMonth") - DECLARE_XSD_ENTRY("gYear") - DECLARE_XSD_ENTRY("gMonthDay") - DECLARE_XSD_ENTRY("gDay") -}; - -__declspec(selectany) CCRTHeap CSoapRootHandler::m_crtHeap; - -template -class CSoapHandler : - public CSoapRootHandler, - public CComObjectRootEx, - public IRequestHandlerImpl -{ -protected: - - HTTP_CODE m_hcErr; - CHttpResponse *m_pHttpResponse; - - // heap for SOAP requests - CWin32Heap m_heap; - - // default heap is COM heap (SOAP Servers can double as COM objects) - CComHeap m_comHeap; - -public: - - BEGIN_COM_MAP(CSoapHandler) - COM_INTERFACE_ENTRY(ISAXContentHandler) - COM_INTERFACE_ENTRY(IRequestHandler) - END_COM_MAP() - - CSoapHandler() - :m_pHttpResponse(NULL), m_hcErr(HTTP_SUCCESS) - { - SetMemMgr(&m_comHeap); - } - - void SetHttpError(HTTP_CODE hcErr) - { - m_hcErr = hcErr; - } - - HRESULT SoapFault( - SOAP_ERROR_CODE errCode, - const wchar_t *wszDetail, - int cchDetail) - { - ATLASSUME( m_pHttpResponse != NULL ); - - SetHttpError(AtlsHttpError(500, SUBERR_NO_PROCESS)); - - m_pHttpResponse->ClearHeaders(); - m_pHttpResponse->ClearContent(); - m_pHttpResponse->SetContentType("text/xml"); - m_pHttpResponse->SetStatusCode(500); - - CSoapFault fault; - if (wszDetail != NULL) - { - if (cchDetail < 0) - { - cchDetail = (int) wcslen(wszDetail); - } - - _ATLTRY - { - fault.m_strDetail.SetString(wszDetail, cchDetail); - } - _ATLCATCHALL() - { - ATLTRACE( _T("CSoapHandler::SoapFault -- out of memory.\r\n" ) ); - - return E_OUTOFMEMORY; - } - } - - fault.m_soapErrCode = errCode; - fault.GenerateFault(m_pHttpResponse); - return S_OK; - } - - HTTP_CODE InitializeHandler(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider) - { - m_hcErr = IRequestHandlerImpl::InitializeHandler(pRequestInfo, pProvider); - if (m_hcErr == HTTP_SUCCESS) - { - HRESULT hr = InitializeSOAP(m_spServiceProvider); - if (SUCCEEDED(hr)) - { - // try to use the per-thread heap - CIsapiWorker *pWorker = pRequestInfo->pExtension->GetThreadWorker(); - if (pWorker != NULL) - { - m_heap.Attach(pWorker->m_hHeap, false); - SetMemMgr(&m_heap); - } - - return m_hcErr; - } - } - - // some initialization failure - CHttpResponse HttpResponse(pRequestInfo->pServerContext); - m_pHttpResponse = &HttpResponse; - - SoapFault(SOAP_E_SERVER, NULL, 0); - - m_pHttpResponse = NULL; - - return m_hcErr; - } - - HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider * /*pProvider*/) - { - // SOAPACTION header is required per the SOAP 1.1 - // mainly so firewalls can filter on it. - char szBuf[ATL_URL_MAX_URL_LENGTH+1]; - szBuf[0] = '\0'; - DWORD dwLen = ATL_URL_MAX_URL_LENGTH; - if ( m_spServerContext->GetServerVariable("HTTP_SOAPACTION", szBuf, &dwLen) != FALSE ) - { - if ( dwLen >= 2 ) - { - // drop the last " - szBuf[dwLen-2] = '\0'; - char *szMethod = strrchr(szBuf, '#'); - if (szMethod != NULL) - { - _ATLTRY - { - // ignore return code here - SetSoapMapFromName(CA2W( szMethod+1 ), -1, GetNamespaceUri(), -1, true); - } - _ATLCATCHALL() - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - } - } - } - else - { - // SOAP requestion that use the HTTP transport - // must have a SOAPACTION header. - return HTTP_ERROR(500, ISE_SUBERR_SOAPNOSOAPACTION); - } - - // set the header map - CHttpResponse HttpResponse(pRequestInfo->pServerContext); - m_pHttpResponse = &HttpResponse; - - CStreamOnServerContext s(pRequestInfo->pServerContext); - -#ifdef _DEBUG - - CSAXSoapErrorHandler err; - GetReader()->putErrorHandler(&err); - -#endif // _DEBUG - - HRESULT hr = BeginParse(&s); - -#ifdef _DEBUG - // release the error handler - GetReader()->putErrorHandler(NULL); -#endif // _DEBUG - - if (FAILED(hr)) - { - Cleanup(); - if (m_hcErr == HTTP_SUCCESS) - { - SoapFault(SOAP_E_CLIENT, NULL, NULL); - } - - return m_hcErr; - } - - _ATLTRY - { - hr = CallFunctionInternal(); - } - _ATLCATCHALL() - { - // cleanup before propagating user exception - Cleanup(); - HttpResponse.Detach(); - _ATLRETHROW; - } - - if (FAILED(hr)) - { - Cleanup(); - HttpResponse.ClearHeaders(); - HttpResponse.ClearContent(); - if (m_hcErr != HTTP_SUCCESS) - { - HttpResponse.SetStatusCode(HTTP_ERROR_CODE(m_hcErr)); - return HTTP_SUCCESS_NO_PROCESS; - } - HttpResponse.SetStatusCode(500); - GenerateAppError(&HttpResponse, hr); - return AtlsHttpError(500, SUBERR_NO_PROCESS); - } - - HttpResponse.SetContentType("text/xml"); - hr = GenerateResponse(&HttpResponse); - Cleanup(); - if (FAILED(hr)) - { - SoapFault(SOAP_E_SERVER, NULL, 0); - return m_hcErr; - } - - return HTTP_SUCCESS; - } - - virtual ATL_NOINLINE HRESULT GenerateAppError(IWriteStream *pStream, HRESULT hr) - { - if (pStream == NULL) - { - return E_INVALIDARG; - } - - LPWSTR pwszMessage = NULL; - DWORD dwLen = ::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL, hr, 0, (LPWSTR) &pwszMessage, 0, NULL); - - if (dwLen == 0) - { - pwszMessage = L"Application Error"; - } - - hr = SoapFault(SOAP_E_SERVER, pwszMessage, dwLen ? dwLen : -1); - if (dwLen != 0) - { - ::LocalFree(pwszMessage); - } - - return hr; - } - - void UninitializeHandler() - { - UninitializeSOAP(); - } -}; - - -// client error states -enum SOAPCLIENT_ERROR -{ - SOAPCLIENT_SUCCESS=0, // everything succeeded - SOAPCLIENT_INITIALIZE_ERROR, // initialization failed -- most likely an MSXML installation problem - SOAPCLIENT_OUTOFMEMORY, // out of memory - SOAPCLIENT_GENERATE_ERROR, // failed in generating the response - SOAPCLIENT_CONNECT_ERROR, // failed connecting to server - SOAPCLIENT_SEND_ERROR, // failed in sending message - SOAPCLIENT_SERVER_ERROR, // server error - SOAPCLIENT_SOAPFAULT, // a SOAP Fault was returned by the server - SOAPCLIENT_PARSEFAULT_ERROR, // failed in parsing SOAP fault - SOAPCLIENT_READ_ERROR, // failed in reading response - SOAPCLIENT_PARSE_ERROR // failed in parsing response -}; - -template -class CSoapSocketClientT -{ -private: - - CUrl m_url; - CWriteStreamOnCString m_writeStream; - CReadStreamOnSocket m_readStream; - DWORD m_dwTimeout; - - SOAPCLIENT_ERROR m_errorState; - -protected: - - virtual HRESULT GetClientReader(ISAXXMLReader **pReader) - { - if (pReader == NULL) - { - return E_POINTER; - } - *pReader = NULL; - - CComPtr spReader; - HRESULT hr = spReader.CoCreateInstance(ATLS_SAXXMLREADER_CLSID, NULL, CLSCTX_INPROC_SERVER); - if (SUCCEEDED(hr)) - { - *pReader = spReader.Detach(); - } - return hr; - } - -public: - - // note : not shared across stock client implementations - CAtlHttpClientT m_socket; - - CSoapFault m_fault; - - // constructor - CSoapSocketClientT(LPCTSTR szUrl) - : m_dwTimeout(0), m_errorState(SOAPCLIENT_SUCCESS) - { - TCHAR szTmp[ATL_URL_MAX_URL_LENGTH]; - if(AtlEscapeUrl(szUrl,szTmp,0,ATL_URL_MAX_URL_LENGTH-1,ATL_URL_BROWSER_MODE)) - m_url.CrackUrl(szTmp); - } - - CSoapSocketClientT(LPCTSTR szServer, LPCTSTR szUri, ATL_URL_PORT nPort=80) - : m_dwTimeout(0), m_errorState(SOAPCLIENT_SUCCESS) - { - ATLASSERT( szServer != NULL ); - ATLASSERT( szUri != NULL ); - - m_url.SetUrlPath(szUri); - m_url.SetHostName(szServer); - m_url.SetPortNumber(nPort); - } - - ~CSoapSocketClientT() - { - CleanupClient(); - } - - SOAPCLIENT_ERROR GetClientError() - { - return m_errorState; - } - - void SetClientError(SOAPCLIENT_ERROR errorState) - { - m_errorState = errorState; - } - - IWriteStream * GetWriteStream() - { - return &m_writeStream; - } - - HRESULT GetReadStream(IStream **ppStream) - { - if (ppStream == NULL) - { - return E_POINTER; - } - - *ppStream = &m_readStream; - return S_OK; - } - - void CleanupClient() - { - m_writeStream.Cleanup(); - m_fault.Clear(); - SetClientError(SOAPCLIENT_SUCCESS); - } - - HRESULT SendRequest(LPCTSTR szAction) - { - HRESULT hr = E_FAIL; - _ATLTRY - { - // create extra headers to send with request - CFixedStringT strExtraHeaders(szAction); - strExtraHeaders.Append(_T("Accept: text/xml\r\n"), sizeof("Accept: text/xml\r\n")-1); - CAtlNavigateData navData; - navData.SetMethod(ATL_HTTP_METHOD_POST); - navData.SetPort(m_url.GetPortNumber()); - navData.SetExtraHeaders(strExtraHeaders); - navData.SetPostData((LPBYTE)(LPCSTR) m_writeStream.m_str, m_writeStream.m_str.GetLength(), _T("text/xml; charset=utf-8")); - - ATLSOAP_TRACE( (LPBYTE)(LPCSTR)m_writeStream.m_str, m_writeStream.m_str.GetLength() ); - - if (m_dwTimeout != 0) - { - navData.SetSocketTimeout(m_dwTimeout); - } - - if (m_socket.Navigate(&m_url, &navData) != false) - { - if (GetStatusCode() == 200) - { - hr = (m_readStream.Init(&m_socket) != FALSE ? S_OK : E_FAIL); - if (hr != S_OK) - { - SetClientError(SOAPCLIENT_READ_ERROR); - } - } - else if (GetStatusCode() == 202) - { - // for one-way methods - hr = S_OK; - } - else - { - SetClientError(SOAPCLIENT_SERVER_ERROR); - } - } - else if (GetStatusCode() == 500) - { - SetClientError(SOAPCLIENT_SOAPFAULT); - - // if returned 500, get the SOAP fault - if (m_readStream.Init(&m_socket) != FALSE) - { - CComPtr spReader; - if (SUCCEEDED(GetClientReader(&spReader))) - { - CComPtr spReadStream; - if (SUCCEEDED(GetReadStream(&spReadStream))) - { - if (FAILED(m_fault.ParseFault(spReadStream, spReader))) - { - SetClientError(SOAPCLIENT_PARSEFAULT_ERROR); - } - } - } - } - } - else - { - SetClientError(SOAPCLIENT_SEND_ERROR); - } - } - _ATLCATCHALL() - { - hr = E_FAIL; - } - - return hr; - } - - HRESULT SetUrl(LPCTSTR szUrl) - { - TCHAR szTmp[ATL_URL_MAX_URL_LENGTH]; - if(!AtlEscapeUrl(szUrl,szTmp,0,ATL_URL_MAX_URL_LENGTH-1,ATL_URL_BROWSER_MODE)) - { - return E_FAIL; - } - - return (m_url.CrackUrl(szTmp) != FALSE) ? S_OK : E_FAIL; - } - - HRESULT GetUrl(__out_ecount_part_z(*pdwLen, *pdwLen) LPTSTR szUrl, __inout LPDWORD pdwLen) - { - if ((szUrl == NULL) || (pdwLen == NULL)) - { - return E_INVALIDARG; - } - - return (m_url.CreateUrl(szUrl, pdwLen) != FALSE) ? S_OK : E_FAIL; - } - - HRESULT SetProxy(LPCTSTR szProxy = NULL, short nProxyPort = 80) - { - BOOL bRet = m_socket.SetProxy(szProxy, nProxyPort); - return (bRet != FALSE) ? S_OK : E_FAIL; - } - - void SetTimeout(DWORD dwTimeout) - { - m_dwTimeout = dwTimeout; - } - - int GetStatusCode() - { - return m_socket.GetStatus(); - } - -}; // CSoapSocketClientT - -#ifndef ATLSOAP_NOWININET - -class CReadStreamOnInet : public IStreamImpl -{ -public: - - HRESULT __stdcall QueryInterface(REFIID riid, void **ppv) - { - if (ppv == NULL) - { - return E_POINTER; - } - - *ppv = NULL; - - if (InlineIsEqualGUID(riid, IID_IUnknown) || - InlineIsEqualGUID(riid, IID_IStream) || - InlineIsEqualGUID(riid, IID_ISequentialStream)) - { - *ppv = static_cast(this); - return S_OK; - } - - return E_NOINTERFACE; - } - - ULONG __stdcall AddRef() - { - return 1; - } - - ULONG __stdcall Release() - { - return 1; - } - -private: - - HINTERNET m_hFile; - -public: - - CReadStreamOnInet() - :m_hFile(NULL) - { - } - - void Init(HINTERNET hFile) - { - m_hFile = hFile; - } - - HRESULT STDMETHODCALLTYPE Read(void *pDest, ULONG dwMaxLen, ULONG *pdwRead) - { - BOOL bRet = InternetReadFile(m_hFile, pDest, dwMaxLen, pdwRead); - return (bRet != FALSE) ? S_OK : E_FAIL; - } - -}; // CStreamOnInet - -class CSoapWininetClient -{ -private: - - CUrl m_url; - CWriteStreamOnCString m_writeStream; - CReadStreamOnInet m_readStream; - CString m_strProxy; - DWORD m_dwTimeout; - CFixedStringT m_strUrl; - SOAPCLIENT_ERROR m_errorState; - - void CloseAll() - { - if (m_hRequest != NULL) - { - InternetCloseHandle(m_hRequest); - m_hRequest = NULL; - } - if (m_hConnection != NULL) - { - InternetCloseHandle(m_hConnection); - m_hConnection = NULL; - } - if (m_hInternet != NULL) - { - InternetCloseHandle(m_hInternet); - m_hInternet = NULL; - } - } - - HRESULT ConnectToServer() - { - if (m_hConnection != NULL) - { - return S_OK; - } - - m_hInternet = InternetOpen( - ATLSOAPINET_CLIENT, - m_strProxy.GetLength() ? (INTERNET_OPEN_TYPE_PRECONFIG | INTERNET_OPEN_TYPE_PROXY) : INTERNET_OPEN_TYPE_PRECONFIG, - m_strProxy.GetLength() ? (LPCTSTR) m_strProxy : NULL, - NULL, 0); - - if (m_hInternet != NULL) - { - if (m_dwTimeout != 0) - { - InternetSetOption(m_hInternet, INTERNET_OPTION_CONNECT_TIMEOUT, - &m_dwTimeout, sizeof(m_dwTimeout)); - InternetSetOption(m_hInternet, INTERNET_OPTION_RECEIVE_TIMEOUT, - &m_dwTimeout, sizeof(m_dwTimeout)); - InternetSetOption(m_hInternet, INTERNET_OPTION_SEND_TIMEOUT, - &m_dwTimeout, sizeof(m_dwTimeout)); - } - m_hConnection = InternetConnect(m_hInternet, m_url.GetHostName(), - (INTERNET_PORT) m_url.GetPortNumber(), NULL, NULL, - INTERNET_SERVICE_HTTP, 0, NULL); - - if (m_hConnection != NULL) - { - return S_OK; - } - } - CloseAll(); - return E_FAIL; - } - -protected: - - virtual HRESULT GetClientReader(ISAXXMLReader **pReader) - { - if (pReader == NULL) - { - return E_POINTER; - } - *pReader = NULL; - - CComPtr spReader; - HRESULT hr = spReader.CoCreateInstance(ATLS_SAXXMLREADER_CLSID, NULL, CLSCTX_INPROC_SERVER); - if (SUCCEEDED(hr)) - { - *pReader = spReader.Detach(); - } - return hr; - } - -public: - - // note : not shared across stock client implementations - HINTERNET m_hInternet; - HINTERNET m_hConnection; - HINTERNET m_hRequest; - - CSoapFault m_fault; - - CSoapWininetClient(LPCTSTR szUrl) - :m_hInternet(NULL), m_hConnection(NULL), m_hRequest(NULL), m_dwTimeout(0), m_errorState(SOAPCLIENT_SUCCESS) - { - TCHAR szTmp[ATL_URL_MAX_URL_LENGTH]; - if(AtlEscapeUrl(szUrl,szTmp,0,ATL_URL_MAX_URL_LENGTH-1,ATL_URL_BROWSER_MODE)) - { - if (m_url.CrackUrl(szTmp) != FALSE) - { - SetProxy(); - _ATLTRY - { - m_strUrl.SetString(m_url.GetUrlPath(), m_url.GetUrlPathLength()); - m_strUrl.Append(m_url.GetExtraInfo(), m_url.GetExtraInfoLength()); - } - _ATLCATCHALL() - { - } - } - } - } - - CSoapWininetClient(LPCTSTR szServer, LPCTSTR szUri, short nPort=80) - :m_hInternet(NULL), m_hConnection(NULL), m_hRequest(NULL), m_dwTimeout(0), m_errorState(SOAPCLIENT_SUCCESS) - { - if (m_url.SetHostName(szServer) != FALSE) - { - if (m_url.SetUrlPath(szUri) != FALSE) - { - if (m_url.SetPortNumber((ATL_URL_PORT) nPort) != FALSE) - { - _ATLTRY - { - m_strUrl.SetString(m_url.GetUrlPath(), m_url.GetUrlPathLength()); - m_strUrl.Append(m_url.GetExtraInfo(), m_url.GetExtraInfoLength()); - } - _ATLCATCHALL() - { - } - } - } - } - } - - virtual ~CSoapWininetClient() - { - CleanupClient(); - CloseAll(); - } - - SOAPCLIENT_ERROR GetClientError() - { - return m_errorState; - } - - void SetClientError(SOAPCLIENT_ERROR errorState) - { - m_errorState = errorState; - } - - IWriteStream * GetWriteStream() - { - return &m_writeStream; - } - - HRESULT GetReadStream(IStream **ppStream) - { - if (ppStream == NULL) - { - return E_POINTER; - } - - *ppStream = &m_readStream; - return S_OK; - } - - void CleanupClient() - { - m_writeStream.Cleanup(); - if (m_hRequest != NULL) - { - InternetCloseHandle(m_hRequest); - m_hRequest = NULL; - } - m_fault.Clear(); - SetClientError(SOAPCLIENT_SUCCESS); - } - - HRESULT SendRequest(LPCTSTR szAction) - { - if (ConnectToServer() != S_OK) - { - SetClientError(SOAPCLIENT_CONNECT_ERROR); - return E_FAIL; - } - - CString strHeaders; - _ATLTRY - { - strHeaders.Append(szAction); - strHeaders.Append(_T("Content-Type: text/xml; charset=utf-8\r\n")); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - static LPCTSTR s_szAcceptTypes[] = { _T("text/*"), NULL }; - m_hRequest = HttpOpenRequest(m_hConnection, _T("POST"), - m_strUrl, _T("HTTP/1.0"), NULL, - s_szAcceptTypes, - INTERNET_FLAG_NO_UI | INTERNET_FLAG_KEEP_CONNECTION | ((m_url.GetScheme() == ATL_URL_SCHEME_HTTPS) ? INTERNET_FLAG_SECURE : 0) - , NULL); - - if (m_hRequest != NULL) - { - if (FALSE != HttpSendRequest(m_hRequest, strHeaders, (DWORD) strHeaders.GetLength(), - (void *)(LPCSTR)m_writeStream.m_str, m_writeStream.m_str.GetLength())) - { - m_readStream.Init(m_hRequest); - if (GetStatusCode() != HTTP_STATUS_SERVER_ERROR) - { - return S_OK; - } - else - { - SetClientError(SOAPCLIENT_SOAPFAULT); - - CComPtr spReader; - if (SUCCEEDED(GetClientReader(&spReader))) - { - CComPtr spReadStream; - if (SUCCEEDED(GetReadStream(&spReadStream))) - { - if (FAILED(m_fault.ParseFault(spReadStream, spReader))) - { - SetClientError(SOAPCLIENT_PARSEFAULT_ERROR); - } - } - } - } - } - } - else - { - SetClientError(SOAPCLIENT_SEND_ERROR); - } - - return E_FAIL; - } - - HRESULT SetUrl(LPCTSTR szUrl) - { - CloseAll(); - TCHAR szTmp[ATL_URL_MAX_URL_LENGTH]; - if(!AtlEscapeUrl(szUrl,szTmp,0,ATL_URL_MAX_URL_LENGTH-1,ATL_URL_BROWSER_MODE)) - { - return E_FAIL; - } - - if (m_url.CrackUrl(szTmp) != FALSE) - { - _ATLTRY - { - m_strUrl.SetString(m_url.GetUrlPath(), m_url.GetUrlPathLength()); - m_strUrl.Append(m_url.GetExtraInfo(), m_url.GetExtraInfoLength()); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - return S_OK; - } - return E_FAIL; - } - - HRESULT GetUrl(LPTSTR szUrl, LPDWORD pdwLen) - { - if ((szUrl == NULL) || (pdwLen == NULL)) - { - return E_INVALIDARG; - } - - return (m_url.CreateUrl(szUrl, pdwLen) != FALSE) ? S_OK : E_FAIL; - } - - HRESULT SetProxy(LPCTSTR szProxy = NULL, short nProxyPort = 80) - { - _ATLTRY - { - if (szProxy && szProxy[0]) - { - m_strProxy.Format(_T("http=http://%s:%d https=http://%s:%d"), szProxy, nProxyPort, szProxy, nProxyPort); - } - else - { - m_strProxy.Empty(); - } - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - - return S_OK; - } - - void SetTimeout(DWORD dwTimeout) - { - m_dwTimeout = dwTimeout; - } - - int GetStatusCode() - { - DWORD dwLen = 255; - TCHAR szBuf[256]; - if (HttpQueryInfo(m_hRequest, HTTP_QUERY_STATUS_CODE, szBuf, &dwLen, NULL)) - { - szBuf[dwLen] = '\0'; - return _ttoi(szBuf); - } - return 0; - } -}; // CSoapWininetClient -#endif - -#ifndef ATLSOAP_NOMSXML_INET -class CSoapMSXMLInetClient -{ -private: - - CUrl m_url; - CWriteStreamOnCString m_writeStream; - DWORD m_dwTimeout; - SOAPCLIENT_ERROR m_errorState; - - HRESULT ConnectToServer() - { - TCHAR szURL[ATL_URL_MAX_URL_LENGTH]; - DWORD dwLen = ATL_URL_MAX_URL_LENGTH; - HRESULT hr = E_FAIL; - - if (m_spHttpRequest) - return S_OK; - - if (!m_url.CreateUrl(szURL, &dwLen)) - return E_FAIL; - - - hr = m_spHttpRequest.CoCreateInstance(__uuidof(ServerXMLHTTP30)); - if (hr != S_OK) - return hr; - - CComVariant vEmpty; - hr = m_spHttpRequest->open( CComBSTR(L"POST"), - CComBSTR(szURL), - CComVariant(VARIANT_BOOL(VARIANT_FALSE)), - vEmpty, - vEmpty ); - if (hr != S_OK) - { - m_spHttpRequest.Release(); - return hr; - } - - return S_OK; - } - -protected: - - virtual HRESULT GetClientReader(ISAXXMLReader **pReader) - { - if (pReader == NULL) - { - return E_POINTER; - } - *pReader = NULL; - - CComPtr spReader; - HRESULT hr = spReader.CoCreateInstance(ATLS_SAXXMLREADER_CLSID, NULL, CLSCTX_INPROC_SERVER); - if (SUCCEEDED(hr)) - { - *pReader = spReader.Detach(); - } - return hr; - } - -public: - - // note : not shared across stock client implementations - CComPtr m_spHttpRequest; - - CSoapFault m_fault; - - CSoapMSXMLInetClient(LPCTSTR szUrl) - :m_dwTimeout(0), m_errorState(SOAPCLIENT_SUCCESS) - { - m_url.CrackUrl(szUrl); - } - - CSoapMSXMLInetClient(LPCTSTR szServer, LPCTSTR szUri, short nPort=80) - : m_dwTimeout(0), m_errorState(SOAPCLIENT_SUCCESS) - { - m_url.SetHostName(szServer); - m_url.SetUrlPath(szUri); - m_url.SetPortNumber((ATL_URL_PORT) nPort); - } - - virtual ~CSoapMSXMLInetClient() - { - CleanupClient(); - } - - SOAPCLIENT_ERROR GetClientError() - { - return m_errorState; - } - - void SetClientError(SOAPCLIENT_ERROR errorState) - { - m_errorState = errorState; - } - - IWriteStream * GetWriteStream() - { - return &m_writeStream; - } - - HRESULT GetReadStream(IStream **ppStream) - { - if (ppStream == NULL) - { - return E_POINTER; - } - - *ppStream = NULL; - HRESULT hr = E_FAIL; - - if (m_spHttpRequest) - { - VARIANT vResponseStream; - VariantInit(&vResponseStream); - hr = m_spHttpRequest->get_responseStream(&vResponseStream); - if (S_OK == hr) - { - hr = E_FAIL; - if ((vResponseStream.vt == VT_UNKNOWN) && (vResponseStream.punkVal != NULL)) - { - // we return the refcount with the pointer! - hr = vResponseStream.punkVal->QueryInterface(__uuidof(IStream), (void **)ppStream); - } - else - { - SetClientError(SOAPCLIENT_READ_ERROR); - } - } - VariantClear(&vResponseStream); - } - return hr; - } - - void CleanupClient() - { - m_writeStream.Cleanup(); - m_spHttpRequest.Release(); - m_fault.Clear(); - SetClientError(SOAPCLIENT_SUCCESS); - } - - HRESULT SendRequest(LPCTSTR szAction) - { - if (ConnectToServer() != S_OK) - { - SetClientError(SOAPCLIENT_CONNECT_ERROR); - return E_FAIL; - } - - // set the action header - LPCTSTR szColon = _tcschr(szAction, _T(':')); - if (szColon != NULL) - { - do - { - szColon++; - } while (_istspace(static_cast(*szColon))); - - if (FAILED(m_spHttpRequest->setRequestHeader( - CComBSTR( L"SOAPAction" ), CComBSTR( szColon )))) - { - SetClientError(SOAPCLIENT_SEND_ERROR); - return E_FAIL; - } - } // if SOAPAction header not properly formed, attempt to send anyway - - if (FAILED(m_spHttpRequest->setRequestHeader(CComBSTR( L"Content-Type" ), CComBSTR(L"text/xml; charset=utf-8")))) - { - SetClientError(SOAPCLIENT_SEND_ERROR); - return E_FAIL; - } - - // set timeout - if (m_dwTimeout != 0) - { - long nTimeout = (long) m_dwTimeout; - m_spHttpRequest->setTimeouts(nTimeout, nTimeout, nTimeout, nTimeout); - // reset timeout - m_dwTimeout = 0; - } - - CComVariant vBody(m_writeStream.m_str); - HRESULT hr = m_spHttpRequest->send(vBody); - if ((SUCCEEDED(hr)) && (GetStatusCode() == 500)) - { - hr = E_FAIL; - CComPtr spReader; - if (SUCCEEDED(GetClientReader(&spReader))) - { - SetClientError(SOAPCLIENT_SOAPFAULT); - - CComPtr spReadStream; - if (SUCCEEDED(GetReadStream(&spReadStream))) - { - if (FAILED(m_fault.ParseFault(spReadStream, spReader))) - { - SetClientError(SOAPCLIENT_PARSEFAULT_ERROR); - } - } - } - } - else if (FAILED(hr)) - { - SetClientError(SOAPCLIENT_SEND_ERROR); - } - - return hr; - } - - HRESULT SetUrl(LPCTSTR szUrl) - { - CleanupClient(); - return (m_url.CrackUrl(szUrl) != FALSE ? S_OK : E_FAIL); - } - - HRESULT GetUrl(LPTSTR szUrl, LPDWORD pdwLen) - { - if ((szUrl == NULL) || (pdwLen == NULL)) - { - return E_INVALIDARG; - } - - return (m_url.CreateUrl(szUrl, pdwLen) != FALSE) ? S_OK : E_FAIL; - } - - void SetTimeout(DWORD dwTimeout) - { - m_dwTimeout = dwTimeout; - } - - int GetStatusCode() - { - long lStatus; - if (m_spHttpRequest->get_status(&lStatus) == S_OK) - { - return (int) lStatus; - } - return 0; - } - - HRESULT SetProxy(LPCTSTR szProxy = NULL, short nProxyPort = 80) - { - (szProxy); - (nProxyPort); - - ATLTRACE( _T("CSoapMSXMLInetClient does not support SetProxy") ); - - return S_OK; - } -}; // CSoapMSXMLInetClient -#endif - - -class _CSDLGenerator : public ITagReplacerImpl<_CSDLGenerator> -{ -private: - - typedef CAtlMap > WSDLMAP; - typedef CAtlMap > HEADERMAP; - - HRESULT GenerateWSDLHelper(const _soapmap *pMap, WSDLMAP& structMap, WSDLMAP& enumMap) - { - ATLENSURE_RETURN( pMap != NULL ); - - const _soapmapentry *pEntries = pMap->pEntries; - ATLENSURE_RETURN( pEntries != NULL ); - - HRESULT hr = S_OK; - - for (int i=0; pEntries[i].nHash != 0; i++) - { - if (pEntries[i].nVal == SOAPTYPE_UNK) - { - ATLENSURE_RETURN( pEntries[i].pChain != NULL ); - - _ATLTRY - { - POSITION pos = NULL; - CStringA strName(pEntries[i].pChain->szName, pEntries[i].pChain->cchName); - if (pEntries[i].pChain->mapType == SOAPMAP_STRUCT) - { - pos = structMap.SetAt(strName, pEntries[i].pChain); - } - else if (pEntries[i].pChain->mapType == SOAPMAP_ENUM) - { - pos = enumMap.SetAt(strName, pEntries[i].pChain); - } - if (pos == NULL) - { - hr = E_OUTOFMEMORY; - break; - } - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - break; - } - - hr = GenerateWSDLHelper(pEntries[i].pChain, structMap, enumMap); - if (FAILED(hr)) - { - break; - } - } - } - - return hr; - } - - HTTP_CODE IsUDT(const _soapmapentry *pEntry) - { - ATLENSURE( pEntry != NULL ); - return (pEntry->nVal != SOAPTYPE_UNK) ? HTTP_S_FALSE : HTTP_SUCCESS; - } - - HTTP_CODE GetSoapDims(const _soapmapentry *pEntry) - { - ATLENSURE( pEntry != NULL ); - if (pEntry->pDims[0] != 0) - { - if (SUCCEEDED(m_pWriteStream->WriteStream("[", 1, NULL))) - { - for (int i=1; i<=pEntry->pDims[0]; i++) - { - if (m_writeHelper.Write(pEntry->pDims[i]) != FALSE) - { - if (i < pEntry->pDims[0]) - { - if (FAILED(m_pWriteStream->WriteStream(", ", 2, NULL))) - { - return HTTP_FAIL; - } - } - } - } - if (SUCCEEDED(m_pWriteStream->WriteStream("]", 1, NULL))) - { - return HTTP_SUCCESS; - } - } - } - return HTTP_FAIL; - } - - const _soapmap **m_pFuncs; - const _soapmap **m_pHeaders; - int m_nFunc; - int m_nParam; - int m_nHeader; - WSDLMAP m_structMap; - WSDLMAP m_enumMap; - POSITION m_currUDTPos; - int m_nCurrUDTField; - - HEADERMAP m_headerMap; - POSITION m_currHeaderPos; - - CWriteStreamHelper m_writeHelper; - - CStringA m_strServiceName; - CStringA m_strNamespaceUri; - - IWriteStream *m_pWriteStream; - - CComPtr m_spHttpServerContext; - - DWORD m_dwCallFlags; - -protected: - - void SetWriteStream(IWriteStream *pStream) - { - m_pWriteStream = pStream; - m_writeHelper.Attach(m_pWriteStream); - } - - void SetHttpServerContext(IHttpServerContext *pServerContext) - { - m_spHttpServerContext = pServerContext; - } - - static HTTP_CODE GetSoapType(int nVal, IWriteStream *pStream) - { - return (pStream->WriteStream(CSoapRootHandler::s_xsdNames[nVal].szName, - CSoapRootHandler::s_xsdNames[nVal].cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - - HRESULT InitializeSDL(CSoapRootHandler *pHdlr) - { - m_pFuncs = pHdlr->GetFunctionMap(); - - if (m_pFuncs == NULL) - { - return E_FAIL; - } - - ATLASSUME( m_pFuncs[0] != NULL ); - - m_dwCallFlags = m_pFuncs[0]->dwCallFlags; - - size_t i; - for (i=0; m_pFuncs[i] != NULL; i++) - { - const _soapmap *pMap = m_pFuncs[i]; - HRESULT hr = GenerateWSDLHelper(pMap, m_structMap, m_enumMap); - if (FAILED(hr)) - { - return hr; - } - } - - m_pHeaders = pHdlr->GetHeaderMap(); - if (m_pHeaders != NULL) - { - for (i=0; m_pHeaders[i] != NULL; i++) - { - const _soapmap *pMap = m_pHeaders[i]; - HRESULT hr = GenerateWSDLHelper(pMap, m_structMap, m_enumMap); - if (FAILED(hr)) - { - return hr; - } - } - - for (i=0; m_pHeaders[i] != NULL; i++) - { - const _soapmap *pMap = m_pHeaders[i]; - for (size_t j=0; pMap->pEntries[j].nHash != 0; j++) - { - HRESULT hr = S_OK; - _ATLTRY - { - if (m_headerMap.SetAt(pMap->pEntries[j].szField, &pMap->pEntries[j]) == NULL) - { - hr = E_OUTOFMEMORY; - } - } - _ATLCATCHALL() - { - hr = E_OUTOFMEMORY; - } - if (FAILED(hr)) - { - return hr; - } - } - } - } - - _ATLTRY - { - m_strServiceName = pHdlr->GetServiceName(); - m_strNamespaceUri = pHdlr->GetNamespaceUriA(); - } - _ATLCATCHALL() - { - return E_OUTOFMEMORY; - } - return S_OK; - } - - virtual const char * GetHandlerName() = 0; - -public: - - _CSDLGenerator() - :m_pFuncs(NULL), m_nFunc(-1), m_nParam(-1), - m_currUDTPos(NULL), m_nCurrUDTField(-1), - m_pWriteStream(NULL), m_nHeader(-1), m_currHeaderPos(NULL) - { - } - virtual ~_CSDLGenerator() - { - } - - HTTP_CODE OnGetURL() - { - char szURL[ATL_URL_MAX_URL_LENGTH]; - DWORD dwUrlSize = sizeof(szURL); - char szServer[ATL_URL_MAX_HOST_NAME_LENGTH]; - DWORD dwServerSize = sizeof(szServer); - char szHttps[16]; - DWORD dwHttpsLen = sizeof(szHttps); - char szPort[ATL_URL_MAX_PORT_NUMBER_LENGTH+1]; - DWORD dwPortLen = sizeof(szPort); - - if (m_spHttpServerContext->GetServerVariable("URL", szURL, &dwUrlSize) != FALSE) - { - if (m_spHttpServerContext->GetServerVariable("SERVER_NAME", szServer, &dwServerSize) != FALSE) - { - bool bHttps = false; - if ((m_spHttpServerContext->GetServerVariable("HTTPS", szHttps, &dwHttpsLen) != FALSE) && - (!_stricmp(szHttps, "ON"))) - { - bHttps = true; - } - - if (m_spHttpServerContext->GetServerVariable("SERVER_PORT", szPort, &dwPortLen) != FALSE) - { - _ATLTRY - { - CStringA strUrl; - strUrl.Format("http%s://%s:%s%s?Handler=%s", bHttps ? "s" : "", szServer, szPort, szURL, GetHandlerName()); - - CA2W wszUrl(strUrl); - wchar_t *pwszUrl = wszUrl; - HRESULT hr = AtlGenXMLValue(m_pWriteStream, &pwszUrl); - return SUCCEEDED(hr) ? HTTP_SUCCESS : HTTP_FAIL; - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - } - } - } - return HTTP_FAIL; - } - - HTTP_CODE OnGetNamespace() - { - return (m_pWriteStream->WriteStream(m_strNamespaceUri, - m_strNamespaceUri.GetLength(), NULL) == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - HTTP_CODE OnGetNextFunction() - { - m_nFunc++; - if (m_pFuncs[m_nFunc] == NULL) - { - m_nFunc = -1; - return HTTP_S_FALSE; - } - return HTTP_SUCCESS; - } - - HTTP_CODE OnGetFunctionName() - { - return (m_pWriteStream->WriteStream(m_pFuncs[m_nFunc]->szName, - m_pFuncs[m_nFunc]->cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetNextParameter() - { - ++m_nParam; - if (m_pFuncs[m_nFunc]->pEntries[m_nParam].nHash != 0) - { - if (m_pFuncs[m_nFunc]->pEntries[m_nParam].dwFlags & SOAPFLAG_NOMARSHAL) - { - return OnGetNextParameter(); - } - return HTTP_SUCCESS; - } - m_nParam = -1; - return HTTP_S_FALSE; - } - - HTTP_CODE OnIsInParameter() - { - return (m_pFuncs[m_nFunc]->pEntries[m_nParam].dwFlags & SOAPFLAG_IN) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetParameterName() - { - HRESULT hr = S_OK; - if (m_pFuncs[m_nFunc]->pEntries[m_nParam].dwFlags & SOAPFLAG_RETVAL) - { - hr = m_pWriteStream->WriteStream("return", sizeof("return")-1, NULL); - } - else - { - hr = m_pWriteStream->WriteStream(m_pFuncs[m_nFunc]->pEntries[m_nParam].szField, - m_pFuncs[m_nFunc]->pEntries[m_nParam].cchField, NULL); - } - - return (hr == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - HTTP_CODE OnNotIsArrayParameter() - { - return (m_pFuncs[m_nFunc]->pEntries[m_nParam].dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) - ? HTTP_S_FALSE: HTTP_SUCCESS; - } - - HTTP_CODE OnIsParameterUDT() - { - return IsUDT(&m_pFuncs[m_nFunc]->pEntries[m_nParam]); - } - - HTTP_CODE OnGetParameterSoapType() - { - if (m_pFuncs[m_nFunc]->pEntries[m_nParam].nVal != SOAPTYPE_UNK) - { - return GetSoapType(m_pFuncs[m_nFunc]->pEntries[m_nParam].nVal, m_pWriteStream); - } - ATLASSUME( m_pFuncs[m_nFunc]->pEntries[m_nParam].pChain != NULL ); - return (m_pWriteStream->WriteStream(m_pFuncs[m_nFunc]->pEntries[m_nParam].pChain->szName, - m_pFuncs[m_nFunc]->pEntries[m_nParam].pChain->cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsParameterDynamicArray() - { - return (m_pFuncs[m_nFunc]->pEntries[m_nParam].dwFlags & SOAPFLAG_DYNARR) ? HTTP_SUCCESS: HTTP_S_FALSE; - } - - HTTP_CODE OnIsArrayParameter() - { - return (OnNotIsArrayParameter() != HTTP_SUCCESS) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsParameterOneDimensional() - { - return (m_pFuncs[m_nFunc]->pEntries[m_nParam].pDims[0] == 1) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetParameterArraySize() - { - return (m_writeHelper.Write(m_pFuncs[m_nFunc]->pEntries[m_nParam].pDims[1]) != FALSE) - ? HTTP_SUCCESS : HTTP_FAIL; - } - - HTTP_CODE OnGetParameterArraySoapDims() - { - return GetSoapDims(&m_pFuncs[m_nFunc]->pEntries[m_nParam]); - } - - HTTP_CODE OnIsOutParameter() - { - return (m_pFuncs[m_nFunc]->pEntries[m_nParam].dwFlags & SOAPFLAG_OUT) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetNextEnum() - { - if (m_currUDTPos == NULL) - { - m_currUDTPos = m_enumMap.GetStartPosition(); - } - else - { - m_enumMap.GetNext(m_currUDTPos); - } - - return (m_currUDTPos != NULL) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetEnumName() - { - const _soapmap *pMap = m_enumMap.GetValueAt(m_currUDTPos); - return (m_pWriteStream->WriteStream(pMap->szName, pMap->cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetNextEnumElement() - { - const _soapmap *pMap = m_enumMap.GetValueAt(m_currUDTPos); - ++m_nCurrUDTField; - if (pMap->pEntries[m_nCurrUDTField].nHash != 0) - { - return HTTP_SUCCESS; - } - m_nCurrUDTField = -1; - return HTTP_S_FALSE; - } - - HTTP_CODE OnGetEnumElementName() - { - const _soapmap *pMap = m_enumMap.GetValueAt(m_currUDTPos); - return (m_pWriteStream->WriteStream(pMap->pEntries[m_nCurrUDTField].szField, - pMap->pEntries[m_nCurrUDTField].cchField, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetNextStruct() - { - if (m_currUDTPos == NULL) - { - m_currUDTPos = m_structMap.GetStartPosition(); - } - else - { - m_structMap.GetNext(m_currUDTPos); - } - - return (m_currUDTPos != NULL) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetStructName() - { - const _soapmap *pMap = m_enumMap.GetValueAt(m_currUDTPos); - return (m_pWriteStream->WriteStream(pMap->szName, pMap->cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetNextStructField() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - ++m_nCurrUDTField; - if (pMap->pEntries[m_nCurrUDTField].nHash != 0) - { - return HTTP_SUCCESS; - } - m_nCurrUDTField = -1; - return HTTP_S_FALSE; - } - - HTTP_CODE OnGetStructFieldName() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return (m_pWriteStream->WriteStream(pMap->pEntries[m_nCurrUDTField].szField, - pMap->pEntries[m_nCurrUDTField].cchField, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnNotIsArrayField() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return (pMap->pEntries[m_nCurrUDTField].dwFlags & (SOAPFLAG_FIXEDARR | SOAPFLAG_DYNARR)) ? HTTP_S_FALSE : HTTP_SUCCESS; - } - - HTTP_CODE OnIsFieldUDT() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return IsUDT(&pMap->pEntries[m_nCurrUDTField]); - } - - HTTP_CODE OnGetStructFieldSoapType() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - if (pMap->pEntries[m_nCurrUDTField].nVal != SOAPTYPE_UNK) - { - return GetSoapType(pMap->pEntries[m_nCurrUDTField].nVal, m_pWriteStream); - } - ATLASSERT( pMap->pEntries[m_nCurrUDTField].pChain != NULL ); - return (m_pWriteStream->WriteStream(pMap->pEntries[m_nCurrUDTField].pChain->szName, - pMap->pEntries[m_nCurrUDTField].pChain->cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsArrayField() - { - return (OnNotIsArrayField() != HTTP_SUCCESS) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsFieldDynamicArray() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return (pMap->pEntries[m_nCurrUDTField].dwFlags & SOAPFLAG_DYNARR) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetFieldSizeIsName() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - int nIndex = pMap->pEntries[m_nCurrUDTField].nSizeIs; - ATLASSERT( nIndex >= 0 ); - return (m_pStream->WriteStream(pMap->pEntries[nIndex].szField, - pMap->pEntries[nIndex].cchField, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsFieldOneDimensional() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return (pMap->pEntries[m_nCurrUDTField].pDims[0] == 1) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetFieldArraySize() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return (m_writeHelper.Write(pMap->pEntries[m_nCurrUDTField].pDims[1]) != FALSE) ? - HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetFieldArraySoapDims() - { - const _soapmap *pMap = m_structMap.GetValueAt(m_currUDTPos); - return GetSoapDims(&pMap->pEntries[m_nCurrUDTField]); - } - - HTTP_CODE OnGetServiceName() - { - return (m_pWriteStream->WriteStream(m_strServiceName, - m_strServiceName.GetLength(), NULL) == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - HTTP_CODE OnGetNextHeader() - { - if (m_currHeaderPos == NULL) - { - m_currHeaderPos = m_headerMap.GetStartPosition(); - } - else - { - m_headerMap.GetNext(m_currHeaderPos); - } - - return (m_currHeaderPos != NULL) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsInHeader() - { - return (m_pHeaders[m_nFunc]->pEntries[m_nHeader].dwFlags & SOAPFLAG_IN) - ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsOutHeader() - { - return (m_pHeaders[m_nFunc]->pEntries[m_nHeader].dwFlags & SOAPFLAG_OUT) - ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsRequiredHeader() - { - return (m_pHeaders[m_nFunc]->pEntries[m_nHeader].dwFlags & SOAPFLAG_MUSTUNDERSTAND) - ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetHeaderName() - { - const _soapmapentry *pEntry = m_headerMap.GetValueAt(m_currHeaderPos); - return (m_pWriteStream->WriteStream(pEntry->szField, - pEntry->cchField, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - HTTP_CODE OnNotIsArrayHeader() - { - const _soapmapentry *pEntry = m_headerMap.GetValueAt(m_currHeaderPos); - return (pEntry->dwFlags & SOAPFLAG_FIXEDARR) ? HTTP_S_FALSE : HTTP_SUCCESS; - } - - HTTP_CODE OnIsHeaderUDT() - { - return IsUDT(m_headerMap.GetValueAt(m_currHeaderPos)); - } - - HTTP_CODE OnGetHeaderSoapType() - { - const _soapmapentry *pEntry = m_headerMap.GetValueAt(m_currHeaderPos); - if (pEntry->nVal != SOAPTYPE_UNK) - { - return GetSoapType(pEntry->nVal, m_pWriteStream); - } - ATLENSURE( pEntry->pChain != NULL ); - return (m_pWriteStream->WriteStream(pEntry->pChain->szName, - pEntry->pChain->cchName, NULL) == S_OK) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnIsHeaderOneDimensional() - { - const _soapmapentry *pEntry = m_headerMap.GetValueAt(m_currHeaderPos); - return (pEntry->pDims[0] == 1) ? HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetHeaderArraySize() - { - const _soapmapentry *pEntry = m_headerMap.GetValueAt(m_currHeaderPos); - return (m_writeHelper.Write(pEntry->pDims[1]) != FALSE) ? - HTTP_SUCCESS : HTTP_S_FALSE; - } - - HTTP_CODE OnGetHeaderArraySoapDims() - { - return GetSoapDims(m_headerMap.GetValueAt(m_currHeaderPos)); - } - - HTTP_CODE OnGetNextFunctionHeader() - { - ++m_nHeader; - if (m_pHeaders[m_nFunc]->pEntries[m_nHeader].nHash != 0) - { - if (m_pHeaders[m_nFunc]->pEntries[m_nHeader].dwFlags & SOAPFLAG_NOMARSHAL) - { - return OnGetNextHeader(); - } - return HTTP_SUCCESS; - } - m_nHeader = -1; - return HTTP_S_FALSE; - } - - HTTP_CODE OnGetFunctionHeaderName() - { - return (m_pWriteStream->WriteStream( - m_pHeaders[m_nFunc]->pEntries[m_nHeader].szField, - m_pHeaders[m_nFunc]->pEntries[m_nHeader].cchField, - NULL) == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - HTTP_CODE OnIsArrayHeader() - { - return (OnNotIsArrayHeader() == HTTP_SUCCESS) ? HTTP_S_FALSE : HTTP_SUCCESS; - } - - HTTP_CODE OnIsDocumentLiteral() - { - if ((m_dwCallFlags & (SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL)) == - (SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL)) - { - return HTTP_SUCCESS; - } - return HTTP_S_FALSE; - } - - HTTP_CODE OnIsRpcEncoded() - { - if ((m_dwCallFlags & (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) == - (SOAPFLAG_RPC | SOAPFLAG_ENCODED)) - { - return HTTP_SUCCESS; - } - return HTTP_S_FALSE; - } - -#pragma warning (push) -#pragma warning (disable : 4640) // construction of local static object is not thread-safe - - BEGIN_REPLACEMENT_METHOD_MAP(_CSDLGenerator) - REPLACEMENT_METHOD_ENTRY("GetNamespace", OnGetNamespace) - REPLACEMENT_METHOD_ENTRY("GetNextFunction", OnGetNextFunction) - REPLACEMENT_METHOD_ENTRY("GetFunctionName", OnGetFunctionName) - REPLACEMENT_METHOD_ENTRY("GetNextParameter", OnGetNextParameter) - REPLACEMENT_METHOD_ENTRY("IsInParameter", OnIsInParameter) - REPLACEMENT_METHOD_ENTRY("GetParameterName", OnGetParameterName) - REPLACEMENT_METHOD_ENTRY("NotIsArrayParameter", OnNotIsArrayParameter) - REPLACEMENT_METHOD_ENTRY("IsParameterUDT", OnIsParameterUDT) - REPLACEMENT_METHOD_ENTRY("GetParameterSoapType", OnGetParameterSoapType) - REPLACEMENT_METHOD_ENTRY("IsParameterDynamicArray", OnIsParameterDynamicArray) - REPLACEMENT_METHOD_ENTRY("IsArrayParameter", OnIsArrayParameter) - REPLACEMENT_METHOD_ENTRY("IsParameterOneDimensional", OnIsParameterOneDimensional) - REPLACEMENT_METHOD_ENTRY("GetParameterArraySize", OnGetParameterArraySize) - REPLACEMENT_METHOD_ENTRY("GetParameterArraySoapDims", OnGetParameterArraySoapDims) - REPLACEMENT_METHOD_ENTRY("IsOutParameter", OnIsOutParameter) - REPLACEMENT_METHOD_ENTRY("GetNextEnum", OnGetNextEnum) - REPLACEMENT_METHOD_ENTRY("GetEnumName", OnGetEnumName) - REPLACEMENT_METHOD_ENTRY("GetNextEnumElement", OnGetNextEnumElement) - REPLACEMENT_METHOD_ENTRY("GetEnumElementName", OnGetEnumElementName) - REPLACEMENT_METHOD_ENTRY("GetNextStruct", OnGetNextStruct) - REPLACEMENT_METHOD_ENTRY("GetStructName", OnGetStructName) - REPLACEMENT_METHOD_ENTRY("GetNextStructField", OnGetNextStructField) - REPLACEMENT_METHOD_ENTRY("GetStructFieldName", OnGetStructFieldName) - REPLACEMENT_METHOD_ENTRY("NotIsArrayField", OnNotIsArrayField) - REPLACEMENT_METHOD_ENTRY("IsFieldUDT", OnIsFieldUDT) - REPLACEMENT_METHOD_ENTRY("GetStructFieldSoapType", OnGetStructFieldSoapType) - REPLACEMENT_METHOD_ENTRY("IsArrayField", OnIsArrayField) - REPLACEMENT_METHOD_ENTRY("IsFieldOneDimensional", OnIsFieldOneDimensional) - REPLACEMENT_METHOD_ENTRY("GetFieldArraySize", OnGetFieldArraySize) - REPLACEMENT_METHOD_ENTRY("GetFieldArraySoapDims", OnGetFieldArraySoapDims) - REPLACEMENT_METHOD_ENTRY("GetServiceName", OnGetServiceName) - REPLACEMENT_METHOD_ENTRY("GetURL", OnGetURL) - - REPLACEMENT_METHOD_ENTRY("GetNextHeader", OnGetNextHeader) - REPLACEMENT_METHOD_ENTRY("GetHeaderName", OnGetHeaderName) - REPLACEMENT_METHOD_ENTRY("NotIsArrayHeader", OnNotIsArrayHeader) - REPLACEMENT_METHOD_ENTRY("IsArrayHeader", OnIsArrayHeader) - REPLACEMENT_METHOD_ENTRY("IsHeaderUDT", OnIsHeaderUDT) - REPLACEMENT_METHOD_ENTRY("GetHeaderSoapType", OnGetHeaderSoapType) - REPLACEMENT_METHOD_ENTRY("IsHeaderOneDimensional", OnIsHeaderOneDimensional) - REPLACEMENT_METHOD_ENTRY("GetHeaderArraySize", OnGetHeaderArraySize) - REPLACEMENT_METHOD_ENTRY("GetHeaderArraySoapDims", OnGetHeaderArraySoapDims) - REPLACEMENT_METHOD_ENTRY("GetNextFunctionHeader", OnGetNextFunctionHeader) - REPLACEMENT_METHOD_ENTRY("GetFunctionHeaderName", OnGetFunctionHeaderName) - REPLACEMENT_METHOD_ENTRY("IsInHeader", OnIsInHeader) - REPLACEMENT_METHOD_ENTRY("IsOutHeader", OnIsOutHeader) - REPLACEMENT_METHOD_ENTRY("IsRequiredHeader", OnIsRequiredHeader) - - REPLACEMENT_METHOD_ENTRY("IsDocumentLiteral", OnIsDocumentLiteral) - REPLACEMENT_METHOD_ENTRY("IsRpcEncoded", OnIsRpcEncoded) - REPLACEMENT_METHOD_ENTRY("IsFieldDynamicArray", OnIsFieldDynamicArray) - REPLACEMENT_METHOD_ENTRY("GetFieldSizeIsName", OnGetFieldSizeIsName) - END_REPLACEMENT_METHOD_MAP() - -#pragma warning (pop) - -}; // class _CSDLGenerator - -template -class CSDLGenerator : - public _CSDLGenerator, - public IRequestHandlerImpl< CSDLGenerator >, - public CComObjectRootEx -{ -private: - -public: - typedef CSDLGenerator _sdlGenerator; - - BEGIN_COM_MAP(_sdlGenerator) - COM_INTERFACE_ENTRY(IRequestHandler) - COM_INTERFACE_ENTRY(ITagReplacer) - END_COM_MAP() - - HTTP_CODE InitializeHandler(AtlServerRequest *pRequestInfo, IServiceProvider *pServiceProvider) - { - IRequestHandlerImpl::InitializeHandler(pRequestInfo, pServiceProvider); - - CComObjectStack handler; - if (FAILED(InitializeSDL(&handler))) - { - return HTTP_FAIL; - } - - CStencil s; - HTTP_CODE hcErr = s.LoadFromString(s_szAtlsWSDLSrf, (DWORD) strlen(s_szAtlsWSDLSrf)); - if (hcErr == HTTP_SUCCESS) - { - hcErr = HTTP_FAIL; - CHttpResponse HttpResponse(pRequestInfo->pServerContext); - HttpResponse.SetContentType("text/xml"); - if (s.ParseReplacements(this) != false) - { - s.FinishParseReplacements(); - - SetStream(&HttpResponse); - SetWriteStream(&HttpResponse); - SetHttpServerContext(m_spServerContext); - - ATLASSERT( s.ParseSuccessful() != false ); - - hcErr = s.Render(this, &HttpResponse); - } - } - - return hcErr; - } - - const char * GetHandlerName() - { - return szHandlerName; - } -}; // class CSDLGenerator - -} // namespace ATL -#pragma pack(pop) - -#pragma warning(pop) - -#endif // __ATLSOAP_H__ diff --git a/include/atl/atlspriv.h b/include/atl/atlspriv.h deleted file mode 100644 index f278e4761..000000000 --- a/include/atl/atlspriv.h +++ /dev/null @@ -1,1017 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSPRIV_H__ -#define __ATLSPRIV_H__ - -#pragma once -#include - -#ifndef _WINSOCK2API_ -#error Winsock2.h has to be included before including windows.h or use atlbase.h instead of windows.h -#endif - -#ifndef _ATL_NO_DEFAULT_LIBS -#pragma comment(lib, "ws2_32.lib") -#endif // !_ATL_NO_DEFAULT_LIBS - -#include -#include -#include -#include - -// ATL_SOCK_TIMEOUT defines the amount of time -// this socket will block the calling thread waiting -// for the socket before the call times out. -#ifndef ATL_SOCK_TIMEOUT - #define ATL_SOCK_TIMEOUT 10000 -#endif - -#define ATL_WINSOCK_VER MAKELONG(2,0) - -// This file contains unsupported code used in ATL implementation files. Most of -// this code is support code for various ATL Server functions. -#pragma pack(push,_ATL_PACKING) -namespace ATL{ - - // One of these objects can be created globally to turn -// on the socket stuff at CRT startup and shut it down -// on CRT term. -class _AtlWSAInit -{ -public: - _AtlWSAInit() throw() - { - m_dwErr = WSAEFAULT; - } - - bool Init() - { - if (!IsStarted()) - m_dwErr = WSAStartup(ATL_WINSOCK_VER, &m_stData); - - return m_dwErr == 0; - } - - bool IsStarted(){ return m_dwErr == 0; } - - ~_AtlWSAInit() throw() - { - if (!m_dwErr) - WSACleanup(); - } - - WSADATA m_stData; - DWORD m_dwErr; -}; - -#ifndef _ATL_NO_GLOBAL_SOCKET_STARTUP - __declspec(selectany)_AtlWSAInit g_HttpInit; -#endif - - -class ZEvtSyncSocket -{ -public: - ZEvtSyncSocket() throw(); - ~ZEvtSyncSocket() throw(); - operator SOCKET() throw(); - void Close() throw(); - void Term() throw(); - bool Create(const ADDRINFOT* pAI, WORD wFlags=0) throw(); - bool Create(int af, int st, int proto, WORD wFlags=0) throw(); - bool Connect(LPCTSTR szAddr, unsigned short nPort) throw(); - bool Connect(const SOCKADDR* psa, int len) throw(); - bool Connect(const ADDRINFOT *pAI) throw(); - bool Write(WSABUF *pBuffers, int nCount, DWORD *pdwSize) throw(); - bool Write(const unsigned char *pBuffIn, DWORD *pdwSize) throw(); - bool Read(const unsigned char *pBuff, DWORD *pdwSize) throw(); - bool Init(SOCKET hSocket, void * /*pData=NULL*/) throw(); - DWORD GetSocketTimeout() throw(); - DWORD SetSocketTimeout(DWORD dwNewTimeout) throw(); - bool SupportsScheme(ATL_URL_SCHEME scheme) throw(); - -protected: - DWORD m_dwCreateFlags; - WSAEVENT m_hEventRead; - WSAEVENT m_hEventWrite; - WSAEVENT m_hEventConnect; - - CComAutoCriticalSection m_csRead; - CComAutoCriticalSection m_csWrite; - SOCKET m_socket; - bool m_bConnected; - DWORD m_dwLastError; - DWORD m_dwSocketTimeout; -}; -inline bool _AtlIsHttpSpace(TCHAR c) -{ - return (c == 0x09 || - c == 0x0A || - c == 0x0D || - c == 0x20); -} - -// MIME helper functions - -extern __declspec(selectany) const DWORD ATL_MIME_DEFAULT_CP = 28591; - -// This function is used to create an CSMTPConnection-compatible recipient string -// from a recipient string that is in a CMimeMessage object. -inline BOOL AtlMimeMakeRecipientsString(_In_ LPCSTR szNames, _Out_z_cap_post_count_(*pdwLen, *pdwLen) LPSTR szRecipients, _Inout_ LPDWORD pdwLen) -{ - ATLENSURE(szNames != NULL); - ATLENSURE(szRecipients != NULL); - ATLENSURE(pdwLen != NULL); - - char ch; - DWORD dwLen = 0; - while ((ch = *szNames++) != '\0') - { - // Skip everything that is in double quotes - if (ch == '"') - { - while (*szNames && *szNames++ != '"'); - } - if (ch == '<') - { - // Extract the address from within the <> - while (*szNames && *szNames != '>') - { - if( dwLen >= *pdwLen ) - { - return FALSE; - } - *szRecipients++ = *szNames++; - dwLen++; - } - if( dwLen >= *pdwLen ) - { - return FALSE; - } - // End it with a comma - *szRecipients++ = ','; - dwLen++; - } - if (ch == '=') - { - // Skip any BEncoded or QEncoded parts - while (*szNames) - { - if (*szNames == '?' && *(szNames+1) == '=') - { - szNames+=2; - break; - } - szNames++; - } - } - szNames++; - } - if (dwLen != 0) - { - szRecipients--; - dwLen--; - } - *szRecipients = '\0'; - *pdwLen = dwLen; - - return TRUE; -} - -// AtlMimeCharsetFromCodePage, AtlMimeConvertString -// are MIME multilanguage support functions. - -// Get the MIME character set of the of the code page. The character set is copied -// into szCharset. - -#ifndef ATLSMTP_DEFAULT_CSET - #define ATLSMTP_DEFAULT_CSET "iso-8859-1" -#endif - -inline BOOL AtlMimeCharsetFromCodePage(_Out_z_cap_(cch) LPSTR szCharset, _In_ UINT uiCodePage, _In_opt_ IMultiLanguage* pMultiLanguage, _In_ size_t cch) throw() -{ - ATLASSERT(szCharset != NULL); - - if (!pMultiLanguage) - { - if ((uiCodePage == 0) || (uiCodePage == ATL_MIME_DEFAULT_CP)) - { - ATLASSERT(_countof(ATLSMTP_DEFAULT_CSET) <= cch); - Checked::strcpy_s(szCharset, cch, ATLSMTP_DEFAULT_CSET); - } - else - { - return FALSE; - } - } - else - { - if (uiCodePage == 0) - uiCodePage = GetACP(); - - HRESULT hr; - MIMECPINFO cpInfo; - memset(&cpInfo, 0x00, sizeof(cpInfo)); - -#ifdef __IMultiLanguage2_INTERFACE_DEFINED__ - - // if IMultiLanguage2 is available, use it - CComPtr spMultiLanguage2; - hr = pMultiLanguage->QueryInterface(__uuidof(IMultiLanguage2), (void **)&spMultiLanguage2); - if (FAILED(hr) || !spMultiLanguage2.p) - hr = pMultiLanguage->GetCodePageInfo(uiCodePage, &cpInfo); - else - hr = spMultiLanguage2->GetCodePageInfo(uiCodePage, - LANGIDFROMLCID(GetThreadLocale()), &cpInfo); - -#else // __IMultiLanguage2_INTERFACE_DEFINED__ - - hr = pMultiLanguage->GetCodePageInfo(uiCodePage, &cpInfo); - -#endif // __IMultiLanguage2_INTERFACE_DEFINED__ - - if (hr != S_OK) - return FALSE; - _ATLTRY - { - CW2A charSet(cpInfo.wszWebCharset); - if (strlen(charSet) >= cch) - return FALSE; - Checked::strcpy_s(szCharset, cch, charSet); - } - _ATLCATCHALL() - { - return FALSE; - } - } - - return TRUE; -} - -inline BOOL AtlMimeConvertStringW( - _In_ IMultiLanguage *pMultiLanguage, - _In_ UINT uiCodePage, - _In_ LPCWSTR wszIn, - _Out_z_cap_post_count_(*pnLen, *pnLen) LPSTR *ppszOut, - _Inout_ UINT *pnLen) throw() -{ - ATLENSURE_RETURN_VAL( pMultiLanguage != NULL, FALSE ); - ATLENSURE_RETURN_VAL( wszIn != NULL, FALSE ); - ATLENSURE_RETURN_VAL( ppszOut != NULL, FALSE ); - ATLENSURE_RETURN_VAL( pnLen != NULL, FALSE ); - - *ppszOut = NULL; - *pnLen = 0; - - if (uiCodePage == 0) - { - uiCodePage = GetACP(); - } - - DWORD dwMode = 0; - CHeapPtr pszOut; - - // get the length - HRESULT hr = pMultiLanguage->ConvertStringFromUnicode(&dwMode, uiCodePage, const_cast(wszIn), NULL, NULL, pnLen); - if (SUCCEEDED(hr)) - { - // allocate the buffer - if (pszOut.Allocate(*pnLen)) - { - dwMode = 0; - // do the conversion - hr = pMultiLanguage->ConvertStringFromUnicode(&dwMode, uiCodePage, const_cast(wszIn), NULL, pszOut, pnLen); - if (SUCCEEDED(hr)) - { - *ppszOut = pszOut.Detach(); - return TRUE; - } - } - } - - return FALSE; -} - -inline BOOL AtlMimeConvertStringA( - _In_ IMultiLanguage *pMultiLanguage, - _In_ UINT uiCodePage, - _In_ LPCSTR szIn, - _Out_z_cap_post_count_(*pnLen, *pnLen) LPSTR *ppszOut, - _Inout_ UINT *pnLen) throw() -{ - _ATLTRY - { - return AtlMimeConvertStringW(pMultiLanguage, uiCodePage, CA2W(szIn), ppszOut, pnLen); - } - _ATLCATCHALL() - { - return FALSE; - } -} - -#ifdef _UNICODE - #define AtlMimeConvertString AtlMimeConvertStringW -#else - #define AtlMimeConvertString AtlMimeConvertStringA -#endif - -class CStreamOnSequentialStream : - public IStream -{ - CComPtr m_spStream; -public: - CStreamOnSequentialStream(ISequentialStream *pStream) throw() - { - ATLASSERT(pStream); - m_spStream = pStream; - } - virtual ~CStreamOnSequentialStream() - { - } - - STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead) throw() - { - if (!m_spStream) - return E_UNEXPECTED; - return m_spStream->Read(pv, cb, pcbRead); - } - - STDMETHOD(Write)(const void *pv, ULONG cb, ULONG *pcbWritten) throw() - { - if (!m_spStream) - return E_UNEXPECTED; - return m_spStream->Write(pv, cb, pcbWritten); - } - - STDMETHOD(Seek)(LARGE_INTEGER , DWORD , ULARGE_INTEGER *) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(SetSize)(ULARGE_INTEGER ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(CopyTo)(IStream *, ULARGE_INTEGER , ULARGE_INTEGER *, - ULARGE_INTEGER *) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Commit)(DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Revert)( void) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(LockRegion)(ULARGE_INTEGER , ULARGE_INTEGER , DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(UnlockRegion)(ULARGE_INTEGER , ULARGE_INTEGER , - DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Stat)(STATSTG *, DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Clone)(IStream **) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(QueryInterface)(REFIID iid, void **ppUnk) throw() - { - *ppUnk = NULL; - if (::InlineIsEqualGUID(iid, IID_IUnknown) || - ::InlineIsEqualGUID(iid, IID_ISequentialStream) || - ::InlineIsEqualGUID(iid, IID_IStream)) - { - *ppUnk = (void*)(IStream*)this; - AddRef(); - return S_OK; - } - return E_NOINTERFACE; - } - - ULONG STDMETHODCALLTYPE AddRef( void) throw() - { - return (ULONG)1; - } - - ULONG STDMETHODCALLTYPE Release( void) throw() - { - return (ULONG)1; - } -}; - -class CStreamOnByteArray : - public IStream -{ -public: - BYTE *m_pArray; - DWORD m_dwRead; - - CStreamOnByteArray(BYTE *pBytes) throw() - { - ATLASSERT(pBytes); - m_pArray = pBytes; - m_dwRead = 0; - } - - STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead) throw() - { - if (!pv) - return E_INVALIDARG; - - if (cb == 0) - return S_OK; - - if (!m_pArray) - return E_UNEXPECTED; - - BYTE *pCurr = m_pArray; - pCurr += m_dwRead; - Checked::memcpy_s(pv, cb, pCurr, cb); - if (pcbRead) - *pcbRead = cb; - m_dwRead += cb; - return S_OK; - } - - STDMETHOD(Write)(const void* , ULONG , ULONG* ) throw() - { - return E_UNEXPECTED; - } - - STDMETHOD(Seek)(LARGE_INTEGER , DWORD , ULARGE_INTEGER *) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(SetSize)(ULARGE_INTEGER ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(CopyTo)(IStream *, ULARGE_INTEGER , ULARGE_INTEGER *, - ULARGE_INTEGER *) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Commit)(DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Revert)( void) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(LockRegion)(ULARGE_INTEGER , ULARGE_INTEGER , DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(UnlockRegion)(ULARGE_INTEGER , ULARGE_INTEGER , - DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Stat)(STATSTG *, DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Clone)(IStream **) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(QueryInterface)(REFIID iid, void **ppUnk) throw() - { - *ppUnk = NULL; - if (::InlineIsEqualGUID(iid, IID_IUnknown) || - ::InlineIsEqualGUID(iid, IID_ISequentialStream) || - ::InlineIsEqualGUID(iid, IID_IStream)) - { - *ppUnk = (void*)(IStream*)this; - AddRef(); - return S_OK; - } - return E_NOINTERFACE; - } - - ULONG STDMETHODCALLTYPE AddRef( void) throw() - { - return (ULONG)1; - } - - ULONG STDMETHODCALLTYPE Release( void) throw() - { - return (ULONG)1; - } -}; - -class CVariantStream : - public IStream -{ -public: - CVariantStream() throw() - { - m_nCurrRead = 0; - m_nVariantSize = 0; - m_nRef = 1; - } - virtual ~CVariantStream() - { - } - - // input variant is put into contained BYTE array. - HRESULT InsertVariant(const VARIANT *pVarIn) throw() - { - CComVariant vIn; - HRESULT hr = E_FAIL; - m_nCurrRead = 0; - m_nVariantSize = 0; - hr = vIn.Attach(const_cast(pVarIn)); - if (hr == S_OK) - { - hr = vIn.WriteToStream(static_cast(this)); - vIn.Detach(const_cast(pVarIn)); - } - return hr; - } - - // variant is read from contained byte array into - // out variant. - HRESULT RetrieveVariant(VARIANT *pVarOut) throw() - { - CComVariant vOut; - HRESULT hr = vOut.ReadFromStream(static_cast(this)); - if (hr == S_OK) - hr = vOut.Detach(pVarOut); - - m_nCurrRead = 0; - return hr; - } - - HRESULT LoadFromStream(ISequentialStream *stream) throw() - { - m_nCurrRead = 0; - CStreamOnSequentialStream stm(stream); - CComVariant v; - HRESULT hr = v.ReadFromStream(&stm); - if (hr == S_OK) - hr = v.WriteToStream(static_cast(this)); - return hr; - } - - ISequentialStream* GetStream() throw() - { - return static_cast(this); - } - - size_t GetVariantSize() throw() - { - return m_nVariantSize; - } - -// Implementation - // IStream implementation; - STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead) throw() - { - if (!pv) - return E_INVALIDARG; - - if (cb == 0) - return S_OK; - - if (pcbRead) - *pcbRead = 0; - - if (!m_nVariantSize) - return S_OK; // nothing to do. - - size_t nLeft = m_nVariantSize - m_nCurrRead; - if (nLeft > 0) - { - size_t nRead = __min(nLeft, cb); - BYTE *pCurr = m_stream; - pCurr += m_nCurrRead; - Checked::memcpy_s(pv, cb, pCurr, nRead); - m_nCurrRead += nRead; - if (pcbRead) - *pcbRead = (ULONG)nRead; - } - - return S_OK; - } - - STDMETHOD(Write)(const void *pv, ULONG cb, ULONG *pcbWritten) throw() - { - HRESULT hr = E_OUTOFMEMORY; - if (!pv) - return E_INVALIDARG; - - if (cb == 0) - return S_OK; - - if (pcbWritten) - *pcbWritten = 0; - - ULONG newsz = cb + (ULONG)m_nVariantSize; - if (newsz < cb || newsz < m_nVariantSize) - { - return E_OUTOFMEMORY; - } - BYTE *pBytes = NULL; - ATLTRY(pBytes = m_stream.Reallocate(newsz)); - if (pBytes) - { - pBytes += m_nVariantSize; - Checked::memcpy_s(pBytes, cb, pv, cb); - if (pcbWritten) - *pcbWritten = cb; - m_nVariantSize += cb; - hr = S_OK; - } - return hr; - } - - STDMETHOD(Seek)(LARGE_INTEGER , DWORD , ULARGE_INTEGER *) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(SetSize)(ULARGE_INTEGER ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(CopyTo)(IStream *, ULARGE_INTEGER , ULARGE_INTEGER *, - ULARGE_INTEGER *) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Commit)(DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Revert)( void) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(LockRegion)(ULARGE_INTEGER , ULARGE_INTEGER , DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(UnlockRegion)(ULARGE_INTEGER , ULARGE_INTEGER , - DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Stat)(STATSTG *, DWORD ) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(Clone)(IStream **) throw() - { - return E_NOTIMPL; - } - - STDMETHOD(QueryInterface)(REFIID iid, void **ppUnk) throw() - { - *ppUnk = NULL; - if (::InlineIsEqualGUID(iid, IID_IUnknown)) - { - *ppUnk = (void*)(IUnknown*)this; - } - else if (::InlineIsEqualGUID(iid, IID_ISequentialStream)) - { - *ppUnk = (void*)(ISequentialStream*)this; - } - else if (::InlineIsEqualGUID(iid, IID_IStream)) - { - *ppUnk = (void*)(IStream*)this; - } - - if (*ppUnk) - { - AddRef(); - return S_OK; - } - return E_NOINTERFACE; - } - - ULONG STDMETHODCALLTYPE AddRef( void) throw() - { - return (ULONG)1; - } - - ULONG STDMETHODCALLTYPE Release( void) throw() - { - return (ULONG)1; - } - - CTempBuffer m_stream; - size_t m_nVariantSize; - size_t m_nCurrRead; - long m_nRef; -}; - -// given a nCurrent and a pointer to a value representing the -// maximum value that has been seen in nCurrent, -// will update pnMax if nCurrent is greater -inline void AtlInterlockedUpdateMax(long nCurrent, long* pnMax) -{ - ATLENSURE(pnMax != NULL); - - long nMax; - long nOrigMax; - - do - { - nMax = *pnMax; - nOrigMax = 0; - if (nCurrent > nMax) - nOrigMax = InterlockedCompareExchange(pnMax, nCurrent, nMax); - } - while (nOrigMax != 0 && nOrigMax != nMax); -} - -// wrapper around InterlockedExchangeAdd -inline LONG AtlInterlockedExchangeAdd(_Inout_ long volatile* pAddend, _In_ long nValue) -{ -#if defined(_WIN64) && defined(_M_CEE) - - // We use System::Threading::Interlocked::Add because InterlockedExchangeAdd is an intrisinc not supported in managed code with 64bits compilers. - // System::Threading::Interlocked::Add returns the value after the addition, but we maintain the same semantics as InterlockedExchangeAdd. - _STATIC_ASSERT(sizeof(int) == sizeof(long)); - return (System::Threading::Interlocked::Add(*((int*)pAddend), nValue) - nValue); - -#else - - return InterlockedExchangeAdd(pAddend, nValue); - -#endif -} - -// SOAP helpers -#define _ATLSOAP_DECLARE_WSDL_SRF() \ -__if_not_exists(s_szAtlsWSDLSrf) \ -{ \ -extern __declspec(selectany) const char * const s_szAtlsWSDLSrf = \ -"\r\n" \ -"\r\n" \ -"\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{if IsRpcEncoded}}\r\n" \ -"{{while GetNextFunction}}\r\n" \ -"{{while GetNextParameter}}\r\n" \ -"{{if IsArrayParameter}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -"{{endwhile}}\r\n" \ -"{{endif}}\r\n" \ -"{{while GetNextHeader}}\r\n" \ -"{{if IsHeaderUDT}}\r\n" \ -"{{else}}\r\n" \ -"{{if IsArrayHeader}}\r\n" \ -"{{else}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endif}}\r\n" \ -"{{if IsRpcEncoded}}\r\n" \ -"{{if IsArrayHeader}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -"{{if IsDocumentLiteral}}\r\n" \ -"{{while GetNextFunction}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextParameter}}\r\n" \ -"{{if IsInParameter}}\r\n" \ -" \r\n" \ -"{{if IsArrayParameter}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextParameter}}\r\n" \ -"{{if IsOutParameter}}\r\n" \ -" \r\n" \ -"{{if IsArrayParameter}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -"{{endif}}\r\n" \ -"{{while GetNextEnum}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextEnumElement}}\r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -"{{while GetNextStruct}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextStructField}}\r\n" \ -" \r\n" \ -"{{if IsArrayField}}\r\n" \ -" \r\n" \ -"{{if IsRpcEncoded}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{else}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -"{{if IsDocumentLiteral}}\r\n" \ -"{{while GetNextHeader}}\r\n" \ -" \r\n" \ -"{{if IsArrayHeader}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -"{{endif}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextFunction}}\r\n" \ -" \r\n" \ -"{{if IsDocumentLiteral}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{if IsRpcEncoded}}\r\n" \ -"{{while GetNextParameter}}\r\n" \ -"{{if IsInParameter}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -"{{endif}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{if IsDocumentLiteral}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{if IsRpcEncoded}}\r\n" \ -"{{while GetNextParameter}}\r\n" \ -"{{if IsOutParameter}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -"{{endif}}\r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -"{{while GetNextHeader}}\r\n" \ -" \r\n" \ -"{{if IsDocumentLiteral}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{if IsRpcEncoded}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -"{{while GetNextFunction}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextFunction}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextFunctionHeader}}\r\n" \ -"{{if IsInHeader}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -"{{while GetNextFunctionHeader}}\r\n" \ -"{{if IsOutHeader}}\r\n" \ -" \r\n" \ -"{{endif}}\r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -"{{endwhile}}\r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -" \r\n" \ -""; \ -} - -#include -}; // namespace ATL -#pragma pack(pop) - -#endif // __ATLSPRIV_H__ diff --git a/include/atl/atlspriv.inl b/include/atl/atlspriv.inl deleted file mode 100644 index 9693d33d5..000000000 --- a/include/atl/atlspriv.inl +++ /dev/null @@ -1,361 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -///////////////////////////////////////////////////////////////////////////////// -// -// ZEvtSyncSocket -// ************ This is an implementation only class ************ -// Class ZEvtSyncSocket is a non-supported, implementation only -// class used by the ATL HTTP client class CAtlHttpClient. Do not -// use this class in your code. Use of this class is not supported by Microsoft. -// -///////////////////////////////////////////////////////////////////////////////// - -#ifndef __ATLSPRIV_INL__ -#define __ATLSPRIV_INL__ - -#pragma once - -#pragma warning(push) -#pragma warning(disable:4312) - -inline ZEvtSyncSocket::ZEvtSyncSocket() -{ - m_dwCreateFlags = WSA_FLAG_OVERLAPPED; - m_hEventRead = m_hEventWrite = m_hEventConnect = NULL; - m_socket = INVALID_SOCKET; - m_bConnected = false; - m_dwLastError = 0; - m_dwSocketTimeout = ATL_SOCK_TIMEOUT; - g_HttpInit.Init(); -} - -inline ZEvtSyncSocket::~ZEvtSyncSocket() -{ - Close(); -} - -inline ZEvtSyncSocket::operator SOCKET() -{ - return m_socket; -} - -inline void ZEvtSyncSocket::Close() -{ - if (m_socket != INVALID_SOCKET) - { - m_bConnected = false; - closesocket(m_socket); - m_socket = INVALID_SOCKET; - Term(); - } -} - -inline void ZEvtSyncSocket::Term() -{ - if (m_hEventRead) - { - WSACloseEvent(m_hEventRead); - m_hEventRead = NULL; - } - if (m_hEventWrite) - { - WSACloseEvent(m_hEventWrite); - m_hEventWrite = NULL; - } - if (m_hEventConnect) - { - WSACloseEvent(m_hEventConnect); - m_hEventConnect = NULL; - } - m_socket = INVALID_SOCKET; -} - -inline bool ZEvtSyncSocket::Create(const ADDRINFOT* pAI, WORD wFlags) -{ - return Create(pAI->ai_family, pAI->ai_socktype, pAI->ai_protocol, wFlags); -} - -inline bool ZEvtSyncSocket::Create(int af, int st, int proto, WORD wFlags) -{ - bool bRet = true; - if (m_socket != INVALID_SOCKET) - { - m_dwLastError = WSAEALREADY; - return false; // Must close this socket first - } - - m_socket = WSASocket(af, st, proto, NULL, 0, - wFlags | m_dwCreateFlags); - if (m_socket == INVALID_SOCKET) - { - m_dwLastError = ::WSAGetLastError(); - bRet = false; - } - else - bRet = Init(m_socket, NULL); - return bRet; -} - -inline bool ZEvtSyncSocket::Connect(LPCTSTR szAddr, unsigned short nPort) throw() -{ - if (m_bConnected) - return true; - - bool bRet = true; - CSocketAddr address; - // Find address information - if ((m_dwLastError = address.FindAddr(szAddr, nPort, 0, PF_UNSPEC, SOCK_STREAM, 0)) != ERROR_SUCCESS) - { - bRet = false; - } - else - { - bRet = Connect(address.GetAddrInfo()); - } - return bRet; -} - -inline bool ZEvtSyncSocket::Connect(const ADDRINFOT *pAI) -{ - if (m_socket == INVALID_SOCKET && !Create(pAI)) - return false; - - return Connect((SOCKADDR*)pAI->ai_addr, (int)pAI->ai_addrlen); -} - -inline bool ZEvtSyncSocket::Connect(const SOCKADDR* psa, int len) -{ - if (m_bConnected) - return true; // already connected - - DWORD dwLastError; - bool bRet = true; - - // if you try to connect the socket without - // creating it first it's reasonable to automatically - // try the create for you. - if (m_socket == INVALID_SOCKET) - return false; - - if (WSAConnect(m_socket, - psa, len, - NULL, NULL, NULL, NULL)) - { - dwLastError = WSAGetLastError(); - if (dwLastError != WSAEWOULDBLOCK) - { - m_dwLastError = dwLastError; - bRet = false; - } - else - { - dwLastError = WaitForSingleObject((HANDLE)m_hEventConnect, m_dwSocketTimeout); - if (dwLastError == WAIT_OBJECT_0) - { - // make sure there were no connection errors. - WSANETWORKEVENTS wse; - ZeroMemory(&wse, sizeof(wse)); - WSAEnumNetworkEvents(m_socket, NULL, &wse); - if (wse.iErrorCode[FD_CONNECT_BIT]!=0) - { - m_dwLastError = (DWORD)(wse.iErrorCode[FD_CONNECT_BIT]); - bRet = false; - } - } - else - bRet = false; - } - - } - - m_bConnected = bRet; - return bRet; -} - -inline bool ZEvtSyncSocket::Write(WSABUF *pBuffers, int nCount, DWORD *pdwSize) -{ - // if we aren't already connected we'll wait to see if the connect - // event happens - if (WAIT_OBJECT_0 != WaitForSingleObject((HANDLE)m_hEventConnect , m_dwSocketTimeout)) - { - m_dwLastError = WSAENOTCONN; - return false; // not connected - } - - // make sure we aren't already writing - if (WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_hEventWrite, 0)) - { - m_dwLastError = WSAEINPROGRESS; - return false; // another write on is blocking this socket - } - - bool bRet = true; - *pdwSize = 0; - WSAOVERLAPPED o; - m_csWrite.Lock(); - o.hEvent = m_hEventWrite; - WSAResetEvent(o.hEvent); - if (WSASend(m_socket, pBuffers, nCount, pdwSize, 0, &o, 0)) - { - DWORD dwLastError = WSAGetLastError(); - if (dwLastError != WSA_IO_PENDING) - { - m_dwLastError = dwLastError; - bRet = false; - } - } - - // wait for write to complete - if (bRet) - { - if (WaitForSingleObject((HANDLE)m_hEventWrite, m_dwSocketTimeout) == WAIT_OBJECT_0) - { - DWORD dwFlags = 0; - if (WSAGetOverlappedResult(m_socket, &o, pdwSize, FALSE, &dwFlags)) - bRet = true; - else - { - m_dwLastError = ::GetLastError(); - bRet = false; - } - } - else - bRet = false; - } - - m_csWrite.Unlock(); - return bRet; -} - -inline bool ZEvtSyncSocket::Write(const unsigned char *pBuffIn, DWORD *pdwSize) -{ - WSABUF buff; - buff.buf = (char*)pBuffIn; - buff.len = *pdwSize; - return Write(&buff, 1, pdwSize); -} - -inline bool ZEvtSyncSocket::Read(const unsigned char *pBuff, DWORD *pdwSize) -{ - // if we aren't already connected we'll wait to see if the connect - // event happens - if (WAIT_OBJECT_0 != WaitForSingleObject((HANDLE)m_hEventConnect , m_dwSocketTimeout)) - { - m_dwLastError = WSAENOTCONN; - return false; // not connected - } - - if (WAIT_ABANDONED == WaitForSingleObject((HANDLE)m_hEventRead, 0)) - { - m_dwLastError = WSAEINPROGRESS; - return false; // another write on is blocking this socket - } - - bool bRet = true; - WSABUF buff; - buff.buf = (char*)pBuff; - buff.len = *pdwSize; - *pdwSize = 0; - DWORD dwFlags = 0; - WSAOVERLAPPED o; - ZeroMemory(&o, sizeof(o)); - - // protect against re-entrency - m_csRead.Lock(); - o.hEvent = m_hEventRead; - WSAResetEvent(o.hEvent); - if (WSARecv(m_socket, &buff, 1, pdwSize, &dwFlags, &o, 0)) - { - DWORD dwLastError = WSAGetLastError(); - if (dwLastError != WSA_IO_PENDING) - { - m_dwLastError = dwLastError; - bRet = false; - } - } - - // wait for the read to complete - if (bRet) - { - if (WAIT_OBJECT_0 == WaitForSingleObject((HANDLE)o.hEvent, m_dwSocketTimeout)) - { - dwFlags = 0; - if (WSAGetOverlappedResult(m_socket, &o, pdwSize, FALSE, &dwFlags)) - bRet = true; - else - { - m_dwLastError = ::GetLastError(); - bRet = false; - } - } - else - bRet = false; - } - - m_csRead.Unlock(); - return bRet; -} - -inline bool ZEvtSyncSocket::Init(SOCKET hSocket, void * /*pData=NULL*/) -{ - ATLASSERT(hSocket != INVALID_SOCKET); - - if (hSocket == INVALID_SOCKET) - { - m_dwLastError = WSAENOTSOCK; - return false; - } - - m_socket = hSocket; - - // Allocate Events. On error, any open event handles will be closed - // in the destructor - if (NULL != (m_hEventRead = WSACreateEvent())) - if (NULL != (m_hEventWrite = WSACreateEvent())) - if (NULL != (m_hEventConnect = WSACreateEvent())) - { - if (!WSASetEvent(m_hEventWrite) || !WSASetEvent(m_hEventRead)) - { - m_dwLastError = ::GetLastError(); - return false; - } - - if (SOCKET_ERROR != WSAEventSelect(m_socket, m_hEventRead, FD_READ)) - if (SOCKET_ERROR != WSAEventSelect(m_socket, m_hEventWrite, FD_WRITE)) - if (SOCKET_ERROR != WSAEventSelect(m_socket, m_hEventConnect, FD_CONNECT)) - return true; - } - m_dwLastError = ::GetLastError(); - return false; -} - -inline DWORD ZEvtSyncSocket::GetSocketTimeout() throw() -{ - return m_dwSocketTimeout; -} - -inline DWORD ZEvtSyncSocket::SetSocketTimeout(DWORD dwNewTimeout) throw() -{ - DWORD dwOldTimeout = m_dwSocketTimeout; - m_dwSocketTimeout = dwNewTimeout; - return dwOldTimeout; -} - -inline bool ZEvtSyncSocket::SupportsScheme(ATL_URL_SCHEME scheme) throw() -{ - // default only supports HTTP - return scheme == ATL_URL_SCHEME_HTTP ? true : false; -} - - -#pragma warning(pop) - -#endif // __ATLSPRIV_INL__ diff --git a/include/atl/atlsrv.rc b/include/atl/atlsrv.rc deleted file mode 100644 index a9d6b93a0..000000000 --- a/include/atl/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "Bad RequestBad Request" - IDS_ATLSRV_AUTH_REQUIRED - "Authorization RequiredAuthorization is required" - IDS_ATLSRV_FORBIDDEN "ForbiddenForbidden" - IDS_ATLSRV_NOT_FOUND "Not FoundNot Found" - IDS_ATLSRV_SERVER_ERROR "Server ErrorServer Error" - IDS_ATLSRV_NOT_IMPLEMENTED - "Not ImplementedNot Implemented" - IDS_ATLSRV_BAD_GATEWAY "Bad GatewayBad Gateway" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "Service Not AvailableService Not Available" - IDS_ATLSRV_SERVER_ERROR_BADSRF "Server Error

Server Error

SRF file could not be loaded." - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "Server Error

Server Error

The requested SRF file was loaded but could not be successfully processed." - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "Server Error

Server Error

A Windows system object could not be created." - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "Server Error

Server Error

A File read operation failed." - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "Server Error

Server Error

The specified file could not be opened." - IDS_ATLSRV_SERVER_ERROR_LOADLIB "Server Error

Server Error

LoadLibrary failed." - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "Server Error

Server Error

Failed to retrieve the request handler interface." - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "Server Error

Server Error

Server is out of memory." - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "Server Error

Server Error

The server encountered an unexpected error." - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "Server Error

Server Error

The server encountered an unexpected error while trying to parse the requested stencil." - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "Server Error

Server Error

The server failed to load the requested stencil. The stencil file may be damaged or missing on this web server." - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "Server Error

Server Error

One of the handlers named in a handler tag for the requested stencil could not be found in the specified handler .dll." - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "Server Error

Server Error

This stencil contains a handler tag that could not be properly parsed by the stencil processor or does not contain a handler tag at all. Check the requested stencil for proper stencil syntax." - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "Server Error

Server Error

The requested stencil does not contain a handler tag." - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "Server Error

Server Error

A replacement tag was encountered in the requested stencil that had a replacement name that was too long. The maximum length of the replacment name must be less than or equal to the ATL_MAX_METHOD_NAME constant defined in atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "Server Error

Server Error

A replacement tag that uses the id.tagname syntax was encountered in the requested stencil that had a handler name that was too long. The maximum length of the handler name must be less than or equal to the ATL_MAX_METHOD_NAME constant defined in atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "Server Error

Server Error

An attempt to impersonate the client making the request failed." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "Server Error

Server Error

The ISAPI extension used to service this request failed to load correctly due to an unknown error." - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "Request heap creation failed" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "Worker Thread initialization failed" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "Critical section initialization failed" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "Thread pool initialization failed" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "DLL cache initialization failed" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "Page cache initialization failed" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "Stencil cache initialization failed" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "Session state service initialization failed" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Blob cache initialization failed" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "File cache initialization failed" - - IDS_PERFMON_CACHE "ATL Server:Cache" - IDS_PERFMON_CACHE_HELP "Information about the ATL Server cache" - IDS_PERFMON_HITCOUNT "Cache Hit Count" - IDS_PERFMON_HITCOUNT_HELP "Number of cache hits" - IDS_PERFMON_MISSCOUNT "Cache Miss Count" - IDS_PERFMON_MISSCOUNT_HELP "Number of cache misses" - IDS_PERFMON_CURRENTALLOCATIONS "Cache Current Allocations" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "Current Memory allocated for cache" - IDS_PERFMON_MAXALLOCATIONS "Cache Max Allocations" - IDS_PERFMON_MAXALLOCATIONS_HELP "Maximum memory allocated for cache" - IDS_PERFMON_CURRENTENTRIES "Cache Current Entries" - IDS_PERFMON_CURRENTENTRIES_HELP "Current number of cache entries" - IDS_PERFMON_MAXENTRIES "Cache Max Entries" - IDS_PERFMON_MAXENTRIES_HELP "Maximum number of cache entries" - IDS_PERFMON_HITCOUNTRATE "Cache Hit Count Rate" - IDS_PERFMON_HITCOUNTRATE_HELP "Number of hit counts per second" - IDS_PERFMON_REQUEST "ATL Server:Request" - IDS_PERFMON_REQUEST_HELP "Statistics about the requests coming into the server" - IDS_PERFMON_REQUEST_TOTAL "Server Total Requests" - IDS_PERFMON_REQUEST_TOTAL_HELP "The total number of requests" - IDS_PERFMON_REQUEST_FAILED "Server Failed Requests" - IDS_PERFMON_REQUEST_FAILED_HELP "The number of failed requests" - IDS_PERFMON_REQUEST_RATE "Server Requests /sec" - IDS_PERFMON_REQUEST_RATE_HELP "Number of requests per second" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "Average Response Time" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "Average time spent handling a request" - IDS_PERFMON_REQUEST_CURR_WAITING "Current Queued Requests" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "Current number of requests waiting to be handled" - IDS_PERFMON_REQUEST_MAX_WAITING "Maximum Queued Requests" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "Maximum number of requests waiting to be handled" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "Active Threads" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "The number of threads actively handling requests" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

While trying to parse a stencil file, the following errors occurred:

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
Error type{{GetErrorText}}
Line number{{GetErrorLineNumber}}
Error text
{{GetErrorLine}}
\r\n{{endwhile}}
Stencil output follows:\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} without {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} without {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} without {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} without {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} without {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} without {{if}} or {{else}}" - - IDS_STENCIL_INVALID_HANDLER "Invalid handler tag" - IDS_STENCIL_NULLPARAM "NULL parameter to ParseReplacements" - IDS_STENCIL_INVALIDSTRING "Empty or negative string passed to ParseReplacements" - IDS_STENCIL_EMBEDDED_NULL "Embedded null character in stencil" - IDS_STENCIL_UNMATCHED_TAG_START "Unmatched {{" - IDS_STENCIL_MISMATCHED_TAG_START "Mismatched {{" - IDS_STENCIL_BAD_PARAMETER "Bad parameter" - IDS_STENCIL_METHODNAME_TOO_LONG "Method name too long" - IDS_STENCIL_HANDLERNAME_TOO_LONG "Handler name too long" - IDS_STENCIL_INVALID_SUBHANDLER "Invalid subhandler tag" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "Unresolved replacement : '%s'" - - IDS_STENCIL_INCLUDE_ERROR "Could not open included file" - IDS_STENCIL_INCLUDE_INVALID "Included file is not a disk file" - - IDS_STENCIL_MLANG_COCREATE "Couldn't create CMultiLanguage" - IDS_STENCIL_MLANG_LCID "Error getting lcid" - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo failed" - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo failed" - - IDS_STENCIL_OUTOFMEMORY "Out of memory" - IDS_STENCIL_UNEXPECTED "Unexpected error" -END - -#endif diff --git a/include/atl/atlsrvres.h b/include/atl/atlsrvres.h deleted file mode 100644 index ff2a1fc48..000000000 --- a/include/atl/atlsrvres.h +++ /dev/null @@ -1,150 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -// Used by atlsrv.rc -// -#ifndef ATLSRV_RESID_BASE -#define ATLSRV_RESID_BASE 0x6000 -#endif - -#ifndef PERFMON_RESID_BASE -#define PERFMON_RESID_BASE 0x6100 -#endif - -#ifndef STENCIL_RESID_BASE -#define STENCIL_RESID_BASE 0x6200 -#endif - -#define IDS_ATLSRV_BAD_REQUEST (ATLSRV_RESID_BASE+1) -#define IDS_ATLSRV_AUTH_REQUIRED (ATLSRV_RESID_BASE+2) -#define IDS_ATLSRV_FORBIDDEN (ATLSRV_RESID_BASE+3) -#define IDS_ATLSRV_NOT_FOUND (ATLSRV_RESID_BASE+4) -#define IDS_ATLSRV_SERVER_ERROR (ATLSRV_RESID_BASE+5) -#define IDS_ATLSRV_NOT_IMPLEMENTED (ATLSRV_RESID_BASE+6) -#define IDS_ATLSRV_BAD_GATEWAY (ATLSRV_RESID_BASE+7) -#define IDS_ATLSRV_SERVICE_NOT_AVAILABLE (ATLSRV_RESID_BASE+8) -#define IDS_ATLSRV_SERVER_ERROR_BADSRF (ATLSRV_RESID_BASE+9) -#define IDS_ATLSRV_SERVER_ERROR_HNDLFAIL (ATLSRV_RESID_BASE+10) -#define IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL (ATLSRV_RESID_BASE+11) -#define IDS_ATLSRV_SERVER_ERROR_READFILEFAIL (ATLSRV_RESID_BASE+12) -#define IDS_ATLSRV_SERVER_ERROR_LOADLIB (ATLSRV_RESID_BASE+13) -#define IDS_ATLSRV_SERVER_ERROR_HANDLERIF (ATLSRV_RESID_BASE+14) -#define IDS_ATLSRV_SERVER_ERROR_OUTOFMEM (ATLSRV_RESID_BASE+15) -#define IDS_ATLSRV_SERVER_ERROR_UNEXPECTED (ATLSRV_RESID_BASE+16) -#define IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL (ATLSRV_RESID_BASE+17) -#define IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL (ATLSRV_RESID_BASE+18) -#define IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND (ATLSRV_RESID_BASE+19) -#define IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG (ATLSRV_RESID_BASE+20) -#define IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG (ATLSRV_RESID_BASE+21) -#define IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME (ATLSRV_RESID_BASE+22) -#define IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME (ATLSRV_RESID_BASE+23) -#define IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED (ATLSRV_RESID_BASE+24) -#define IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED (ATLSRV_RESID_BASE+25) -#define IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL (ATLSRV_RESID_BASE+26) -#define IDS_ATLSRV_CRITICAL_LOGMESSAGE (ATLSRV_RESID_BASE+27) -#define IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED (ATLSRV_RESID_BASE+28) -#define IDS_ATLSRV_CRITICAL_WORKERINITFAILED (ATLSRV_RESID_BASE+29) -#define IDS_ATLSRV_CRITICAL_CRITSECINITFAILED (ATLSRV_RESID_BASE+30) -#define IDS_ATLSRV_CRITICAL_THREADPOOLFAILED (ATLSRV_RESID_BASE+31) -#define IDS_ATLSRV_CRITICAL_DLLCACHEFAILED (ATLSRV_RESID_BASE+32) -#define IDS_ATLSRV_CRITICAL_PAGECACHEFAILED (ATLSRV_RESID_BASE+33) -#define IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED (ATLSRV_RESID_BASE+34) -#define IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED (ATLSRV_RESID_BASE+35) -#define IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED (ATLSRV_RESID_BASE+36) -#define IDS_ATLSRV_CRITICAL_FILECACHEFAILED (ATLSRV_RESID_BASE+37) -#define IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION (ATLSRV_RESID_BASE+38) - -#define IDS_PERFMON_CACHE (PERFMON_RESID_BASE+1) -#define IDS_PERFMON_CACHE_HELP (PERFMON_RESID_BASE+2) -#define IDS_PERFMON_HITCOUNT (PERFMON_RESID_BASE+3) -#define IDS_PERFMON_HITCOUNT_HELP (PERFMON_RESID_BASE+4) -#define IDS_PERFMON_MISSCOUNT (PERFMON_RESID_BASE+5) -#define IDS_PERFMON_MISSCOUNT_HELP (PERFMON_RESID_BASE+6) -#define IDS_PERFMON_CURRENTALLOCATIONS (PERFMON_RESID_BASE+7) -#define IDS_PERFMON_CURRENTALLOCATIONS_HELP (PERFMON_RESID_BASE+8) -#define IDS_PERFMON_MAXALLOCATIONS (PERFMON_RESID_BASE+9) -#define IDS_PERFMON_MAXALLOCATIONS_HELP (PERFMON_RESID_BASE+10) -#define IDS_PERFMON_CURRENTENTRIES (PERFMON_RESID_BASE+11) -#define IDS_PERFMON_CURRENTENTRIES_HELP (PERFMON_RESID_BASE+12) -#define IDS_PERFMON_MAXENTRIES (PERFMON_RESID_BASE+13) -#define IDS_PERFMON_MAXENTRIES_HELP (PERFMON_RESID_BASE+14) -#define IDS_PERFMON_HITCOUNTRATE (PERFMON_RESID_BASE+15) -#define IDS_PERFMON_HITCOUNTRATE_HELP (PERFMON_RESID_BASE+16) - -#define IDS_PERFMON_REQUEST (PERFMON_RESID_BASE+17) -#define IDS_PERFMON_REQUEST_HELP (PERFMON_RESID_BASE+18) -#define IDS_PERFMON_REQUEST_TOTAL (PERFMON_RESID_BASE+19) -#define IDS_PERFMON_REQUEST_TOTAL_HELP (PERFMON_RESID_BASE+20) -#define IDS_PERFMON_REQUEST_FAILED (PERFMON_RESID_BASE+21) -#define IDS_PERFMON_REQUEST_FAILED_HELP (PERFMON_RESID_BASE+22) -#define IDS_PERFMON_REQUEST_RATE (PERFMON_RESID_BASE+23) -#define IDS_PERFMON_REQUEST_RATE_HELP (PERFMON_RESID_BASE+24) -#define IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME (PERFMON_RESID_BASE+25) -#define IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP (PERFMON_RESID_BASE+26) -#define IDS_PERFMON_REQUEST_CURR_WAITING (PERFMON_RESID_BASE+27) -#define IDS_PERFMON_REQUEST_CURR_WAITING_HELP (PERFMON_RESID_BASE+28) -#define IDS_PERFMON_REQUEST_MAX_WAITING (PERFMON_RESID_BASE+29) -#define IDS_PERFMON_REQUEST_MAX_WAITING_HELP (PERFMON_RESID_BASE+30) -#define IDS_PERFMON_REQUEST_ACTIVE_THREADS (PERFMON_RESID_BASE+31) -#define IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP (PERFMON_RESID_BASE+32) - - -// -// Stencil parse error support -// - -// the error stencil -#define IDS_STENCIL_ERROR_STENCIL (STENCIL_RESID_BASE+1) - -// parse errors -#define IDS_STENCIL_UNCLOSEDBLOCK_IF (STENCIL_RESID_BASE+2) -#define IDS_STENCIL_UNCLOSEDBLOCK_ELSE (STENCIL_RESID_BASE+3) -#define IDS_STENCIL_UNCLOSEDBLOCK_WHILE (STENCIL_RESID_BASE+4) -#define IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE (STENCIL_RESID_BASE+5) -#define IDS_STENCIL_UNOPENEDBLOCK_ELSE (STENCIL_RESID_BASE+6) -#define IDS_STENCIL_UNOPENEDBLOCK_ENDIF (STENCIL_RESID_BASE+7) - -#define IDS_STENCIL_INVALID_HANDLER (STENCIL_RESID_BASE+8) -#define IDS_STENCIL_NULLPARAM (STENCIL_RESID_BASE+9) -#define IDS_STENCIL_INVALIDSTRING (STENCIL_RESID_BASE+10) -#define IDS_STENCIL_EMBEDDED_NULL (STENCIL_RESID_BASE+11) -#define IDS_STENCIL_UNMATCHED_TAG_START (STENCIL_RESID_BASE+12) -#define IDS_STENCIL_MISMATCHED_TAG_START (STENCIL_RESID_BASE+13) -#define IDS_STENCIL_BAD_PARAMETER (STENCIL_RESID_BASE+14) -#define IDS_STENCIL_METHODNAME_TOO_LONG (STENCIL_RESID_BASE+15) -#define IDS_STENCIL_HANDLERNAME_TOO_LONG (STENCIL_RESID_BASE+16) -#define IDS_STENCIL_INCLUDE_ERROR (STENCIL_RESID_BASE+17) -#define IDS_STENCIL_INCLUDE_INVALID (STENCIL_RESID_BASE+18) -#define IDS_STENCIL_INVALID_SUBHANDLER (STENCIL_RESID_BASE+19) -#define IDS_STENCIL_UNRESOLVED_REPLACEMENT (STENCIL_RESID_BASE+20) - -// mlang errors -#define IDS_STENCIL_MLANG_COCREATE (STENCIL_RESID_BASE+21) -#define IDS_STENCIL_MLANG_LCID (STENCIL_RESID_BASE+22) -#define IDS_STENCIL_MLANG_GETLOCALE (STENCIL_RESID_BASE+23) -#define IDS_STENCIL_MLANG_GETCHARSET (STENCIL_RESID_BASE+24) - -// misceallaneous -#define IDS_STENCIL_OUTOFMEMORY (STENCIL_RESID_BASE+25) -#define IDS_STENCIL_UNEXPECTED (STENCIL_RESID_BASE+26) - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - diff --git a/include/atl/atlstencil.h b/include/atl/atlstencil.h deleted file mode 100644 index 8694a0f42..000000000 --- a/include/atl/atlstencil.h +++ /dev/null @@ -1,4152 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#ifndef __ATLSTENCIL_H__ -#define __ATLSTENCIL_H__ - -#pragma once - -#include -#include -#include -#include - -#ifdef ATL_DEBUG_STENCILS -#include - - #ifndef ATL_STENCIL_MAX_ERROR_LEN - #define ATL_STENCIL_MAX_ERROR_LEN 256 - #endif -#endif // ATL_DEBUG_STENCILS - -#ifndef ATL_NO_MLANG -#include -#endif - -#ifndef _ATL_NO_DEFAULT_LIBS -#pragma comment(lib, "shlwapi.lib") -#endif // !_ATL_NO_DEFAULT_LIBS - -#pragma warning( push ) -#pragma warning(disable: 4127) // conditional expression is constant -#pragma warning(disable: 4511) // copy constructor could not be generated -#pragma warning(disable: 4512) // assignment operator could not be generated -#pragma warning(disable: 4702) // assignment operator could not be generated -#pragma warning(disable: 4625) // copy constructor could not be generated because a base class copy constructor is inaccessible -#pragma warning(disable: 4626) // assignment operator could not be generated because a base class assignment operator is inaccessible -#pragma warning(disable: 4191) // unsafe conversion from 'functionptr1' to 'functionptr2' - - -#pragma pack(push,_ATL_PACKING) -namespace ATL { - -// Token types -// These tags are token tags for the standard tag replacer implementation -extern __declspec(selectany) const DWORD STENCIL_TEXTTAG = 0x00000000; -extern __declspec(selectany) const DWORD STENCIL_REPLACEMENT = 0x00000001; -extern __declspec(selectany) const DWORD STENCIL_ITERATORSTART = 0x00000002; -extern __declspec(selectany) const DWORD STENCIL_ITERATOREND = 0x00000003; -extern __declspec(selectany) const DWORD STENCIL_CONDITIONALSTART = 0x00000004; -extern __declspec(selectany) const DWORD STENCIL_CONDITIONALELSE = 0x00000005; -extern __declspec(selectany) const DWORD STENCIL_CONDITIONALEND = 0x00000006; -extern __declspec(selectany) const DWORD STENCIL_STENCILINCLUDE = 0x00000007; -extern __declspec(selectany) const DWORD STENCIL_STATICINCLUDE = 0x00000008; -extern __declspec(selectany) const DWORD STENCIL_LOCALE = 0x00000009; -extern __declspec(selectany) const DWORD STENCIL_CODEPAGE = 0x0000000a; - -// The base for user defined token types -extern __declspec(selectany) const DWORD STENCIL_USER_TOKEN_BASE = 0x00001000; - -// Symbols to use in error handling in the stencil processor -#define STENCIL_INVALIDINDEX 0xFFFFFFFF -#define STENCIL_INVALIDOFFSET 0xFFFFFFFF - -// error codes -#define STENCIL_SUCCESS HTTP_SUCCESS -#define STENCL_FAIL HTTP_FAIL - -#define STENCIL_BASIC_MAP 0 -#define STENCIL_ATTR_MAP 1 - -#ifndef ATL_MAX_METHOD_NAME_LEN - #define ATL_MAX_METHOD_NAME_LEN 64 -#endif - -#ifndef ATL_MAX_BLOCK_STACK - #define ATL_MAX_BLOCK_STACK 128 -#endif - -template -struct CTagReplacerMethodsEx -{ - typedef HTTP_CODE (TBase::*REPLACE_FUNC)(); - typedef HTTP_CODE (TBase::*REPLACE_FUNC_EX)(T*); - typedef HTTP_CODE (TBase::*PARSE_FUNC)(IAtlMemMgr *, LPCSTR, T**); - typedef HTTP_CODE (TBase::*REPLACE_FUNC_EX_V)(void *); - typedef HTTP_CODE (TBase::*PARSE_FUNC_V)(IAtlMemMgr *, LPCSTR, void**); - - static REPLACE_FUNC_EX_V CheckRepl(REPLACE_FUNC p) throw() - { - return (REPLACE_FUNC_EX_V) p; - } - - static REPLACE_FUNC_EX_V CheckReplEx(REPLACE_FUNC_EX p) throw() - { - return (REPLACE_FUNC_EX_V) p; - } - - static PARSE_FUNC_V CheckParse(PARSE_FUNC p) throw() - { - return (PARSE_FUNC_V) p; - } -}; - -template -struct CTagReplacerMethods -{ - union - { - HTTP_CODE (TBase::*pfnMethodEx)(void *); - HTTP_CODE (TBase::*pfnMethod)(); - }; - HTTP_CODE (TBase::*pfnParse)(IAtlMemMgr *pMemMgr, LPCSTR, void **); -}; - -#define REPLACEMENT_ENTRY_DEFAULT 0 -#define REPLACEMENT_ENTRY_ARGS 1 - -template -struct CTagReplacerMethodEntry -{ - int nType; // REPLACEMENT_ENTRY_* - LPCSTR szMethodName; - CTagReplacerMethods Methods; -}; - - -#define BEGIN_REPLACEMENT_METHOD_MAP(className)\ -public:\ - void GetReplacementMethodMap(const ATL::CTagReplacerMethodEntry ** ppOut) const\ - {\ - typedef className __className;\ - static const ATL::CTagReplacerMethodEntry methods[] = { - -#define REPLACEMENT_METHOD_ENTRY(methodName, methodFunc)\ - { 0, methodName, { ATL::CTagReplacerMethodsEx<__className, void>::CheckRepl(&__className::methodFunc), NULL } }, - -#define REPLACEMENT_METHOD_ENTRY_EX(methodName, methodFunc, paramType, parseFunc)\ - { 1, methodName, { ATL::CTagReplacerMethodsEx<__className, paramType>::CheckReplEx(&__className::methodFunc), ATL::CTagReplacerMethodsEx<__className, paramType>::CheckParse(&__className::parseFunc) } }, - -#define REPLACEMENT_METHOD_ENTRY_EX_STR(methodName, methodFunc) \ - { 1, methodName, { ATL::CTagReplacerMethodsEx<__className, char>::CheckReplEx(&__className::methodFunc), ATL::CTagReplacerMethodsEx<__className, char>::CheckParse(&__className::DefaultParseString) } }, - -#define END_REPLACEMENT_METHOD_MAP()\ - { 0, NULL, NULL } };\ - *ppOut = methods;\ - } - -#define BEGIN_ATTR_REPLACEMENT_METHOD_MAP(className)\ -public:\ - void GetAttrReplacementMethodMap(const CTagReplacerMethodEntry ** ppOut) const\ - {\ - typedef className __className;\ - static const ATL::CTagReplacerMethodEntry methods[] = { - -#define END_ATTR_REPLACEMENT_METHOD_MAP()\ - { NULL, NULL, NULL } };\ - *ppOut = methods;\ - } - -template -class ITagReplacerImpl : public ITagReplacer -{ -protected: - IWriteStream *m_pStream; - -public: - typedef HTTP_CODE (T::*REPLACEMENT_METHOD)(); - typedef HTTP_CODE (T::*REPLACEMENT_METHOD_EX)(void *pvParam); - - ITagReplacerImpl() throw() - :m_pStream(NULL) - { - } - - IWriteStream *SetStream(IWriteStream *pStream) - { - IWriteStream *pRetStream = m_pStream; - m_pStream = pStream; - return pRetStream; - } - - // Looks up the replacement method offset. Optionally, it will - // look up the replacement method and object offset of an alternate - // tag replacer. - HTTP_CODE FindReplacementOffset( - LPCSTR szMethodName, - DWORD *pdwMethodOffset, - LPCSTR szHandlerName, - DWORD *pdwHandlerOffset, - DWORD *pdwMap, void **ppvParam, IAtlMemMgr *pMemMgr) - { - ATLENSURE(szMethodName != NULL); - ATLENSURE(pdwMethodOffset != NULL); - ATLENSURE((szHandlerName == NULL && pdwHandlerOffset == NULL) || - (szHandlerName != NULL && pdwHandlerOffset != NULL)); - ATLENSURE(pdwMap != NULL); - ATLENSURE(ppvParam != NULL); - ATLENSURE(pMemMgr != NULL); - - // we at least have to be looking up a method offset - if (!pdwMethodOffset || !szMethodName) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - - *pdwMethodOffset = STENCIL_INVALIDOFFSET; - HTTP_CODE hcErr = HTTP_FAIL; - T *pT = static_cast(this); - - char szName[ATL_MAX_METHOD_NAME_LEN+1]; - - // if a handler name was supplied, we will try to - // find a different object to handle the method - if (szHandlerName && *szHandlerName) - { - if (!pdwHandlerOffset) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - - hcErr = pT->GetHandlerOffset(szHandlerName, pdwHandlerOffset); - // got the alternate handler, now look up the method offset on - // the handler. - if (!hcErr) - { - CComPtr spAltTagReplacer; - hcErr = pT->GetReplacementObject(*pdwHandlerOffset, &spAltTagReplacer); - if (!hcErr) - hcErr = spAltTagReplacer->FindReplacementOffset(szMethodName, pdwMethodOffset, - NULL, NULL, pdwMap, ppvParam, pMemMgr); - return hcErr; - } - else - return hcErr; - } - - if (!SafeStringCopy(szName, szMethodName)) - { - return AtlsHttpError(500, ISE_SUBERR_LONGMETHODNAME); - } - - // check for params - char *szLeftPar = strchr(szName, '('); - if (szLeftPar) - { - *szLeftPar = '\0'; - szLeftPar++; - - char *szRightPar = strchr(szLeftPar, ')'); - if (!szRightPar) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - - *szRightPar = '\0'; - - szMethodName = szName; - - } - - // No handler name is specified, so we look up the method name in - // T's replacement method map - const CTagReplacerMethodEntry *pEntry = NULL; - pT->GetReplacementMethodMap(&pEntry); - - hcErr = FindReplacementOffsetInMap(szMethodName, pdwMethodOffset, pEntry); - if (hcErr != HTTP_SUCCESS) - { - pT->GetAttrReplacementMethodMap(&pEntry); - hcErr = FindReplacementOffsetInMap(szMethodName, pdwMethodOffset, pEntry); - if (hcErr == HTTP_SUCCESS) - *pdwMap = STENCIL_ATTR_MAP; - } - else - { - *pdwMap = STENCIL_BASIC_MAP; - } - - // This assert will be triggered if arguments are passed to a replacement method that doesn't handle them - ATLASSERT( szLeftPar == NULL || (szLeftPar != NULL && (pEntry != NULL && pEntry[*pdwMethodOffset].Methods.pfnParse != NULL)) ); - - if (hcErr == HTTP_SUCCESS && pEntry && pEntry[*pdwMethodOffset].Methods.pfnParse) - hcErr = (pT->*pEntry[*pdwMethodOffset].Methods.pfnParse)(pMemMgr, szLeftPar, ppvParam); - return hcErr; - } - - HTTP_CODE FindReplacementOffsetInMap( - LPCSTR szMethodName, - LPDWORD pdwMethodOffset, - const CTagReplacerMethodEntry *pEntry) throw() - { - if (pEntry == NULL) - return HTTP_FAIL; - - const CTagReplacerMethodEntry *pEntryHead = pEntry; - - while (pEntry->szMethodName) - { - if (strcmp(pEntry->szMethodName, szMethodName) == 0) - { - if (pEntry->Methods.pfnMethod) - { - *pdwMethodOffset = (DWORD)(pEntry-pEntryHead); - return HTTP_SUCCESS; - } - } - pEntry++; - } - - return HTTP_FAIL; - } - - - // Used to render a single replacement tag into a stream. - // Looks up a pointer to a member function in user code by offseting into the users - // replacement map. Much faster than the other overload of this function since - // no string compares are performed. - HTTP_CODE RenderReplacement(DWORD dwFnOffset, DWORD dwObjOffset, DWORD dwMap, void *pvParam) - { - HTTP_CODE hcErr = HTTP_FAIL; - T *pT = static_cast(this); - - // if we were not passed an object offset, then we assume - // that the function at dwFnOffset is in T's replacement - // map - if (dwObjOffset == STENCIL_INVALIDOFFSET) - { - // call a function in T's replacement map - ATLASSERT(dwFnOffset != STENCIL_INVALIDOFFSET); - const CTagReplacerMethodEntry *pEntry = NULL; - if (dwMap == STENCIL_BASIC_MAP) - pT->GetReplacementMethodMap(&pEntry); - else - pT->GetAttrReplacementMethodMap(&pEntry); - if (pEntry) - { - if (pEntry[dwFnOffset].nType == REPLACEMENT_ENTRY_DEFAULT) - { - REPLACEMENT_METHOD pfn = NULL; - pfn = pEntry[dwFnOffset].Methods.pfnMethod; - ATLASSERT(pfn); - if (pfn) - { - hcErr = (pT->*pfn)(); - } - } - else if (pEntry[dwFnOffset].nType == REPLACEMENT_ENTRY_ARGS) - { - REPLACEMENT_METHOD_EX pfn = NULL; - pfn = pEntry[dwFnOffset].Methods.pfnMethodEx; - ATLASSERT(pfn); - if (pfn) - { - hcErr = (pT->*pfn)(pvParam); - } - } - else - { - // unknown entry type - ATLASSERT(FALSE); - } - } - } - else - { - // otherwise, we were passed an object offset. The object - // offset is a dword ID that T can use to look up the - // ITagReplacer* of a tag replacer that will render this - // replacement. - CComPtr spAltReplacer = NULL; - if (!pT->GetReplacementObject(dwObjOffset, &spAltReplacer)) - { - spAltReplacer->SetStream(m_pStream); - hcErr = spAltReplacer->RenderReplacement(dwFnOffset, STENCIL_INVALIDOFFSET, dwMap, pvParam); - } - } - return hcErr; - } - - // Default GetHandlerOffset, does nothing - HTTP_CODE GetHandlerOffset(LPCSTR /*szHandlerName*/, DWORD* pdwOffset) - { - if (pdwOffset) - *pdwOffset = 0; - return HTTP_FAIL; - } - - // Default GetReplacementObject, does nothing - HTTP_CODE GetReplacementObject(DWORD /*dwObjOffset*/, ITagReplacer **ppReplacer) - { - if (ppReplacer) - *ppReplacer = NULL; - return HTTP_FAIL; - } - - void GetReplacementMethodMap(const CTagReplacerMethodEntry ** ppOut) const - { - static const CTagReplacerMethodEntry methods[] = { { NULL, NULL } }; - *ppOut = methods; - } - - void GetAttrReplacementMethodMap(const CTagReplacerMethodEntry **ppOut) const - { - static const CTagReplacerMethodEntry methods[] = { { NULL, NULL } }; - *ppOut = methods; - } - - HRESULT GetContext(REFIID, void**) - { - return E_NOINTERFACE; - } - - virtual HINSTANCE GetResourceInstance() - { - return GetModuleHandle(NULL); - } - - HTTP_CODE DefaultParseString(IAtlMemMgr *pMemMgr, LPCSTR szParams, char **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - size_t nLen = strlen(szParams); - if (nLen) - { - nLen++; - *ppParam = (char *) pMemMgr->Allocate(nLen); - if (*ppParam) - Checked::memcpy_s(*ppParam, nLen, szParams, nLen); - else - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseUChar(IAtlMemMgr *pMemMgr, LPCSTR szParams, unsigned char **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (unsigned char *) pMemMgr->Allocate(sizeof(unsigned char)); - if (*ppParam) - { - char *szEnd; - **ppParam = (unsigned char) strtoul(szParams, &szEnd, 10); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseShort(IAtlMemMgr *pMemMgr, LPCSTR szParams, short **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (short *) pMemMgr->Allocate(sizeof(short)); - if (*ppParam) - { - **ppParam = (short)atoi(szParams); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseUShort(IAtlMemMgr *pMemMgr, LPCSTR szParams, unsigned short **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (unsigned short *) pMemMgr->Allocate(sizeof(short)); - if (*ppParam) - { - char *szEnd; - **ppParam = (unsigned short) strtoul(szParams, &szEnd, 10); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseInt(IAtlMemMgr *pMemMgr, LPCSTR szParams, int **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (int *) pMemMgr->Allocate(sizeof(int)); - if (*ppParam) - { - **ppParam = atoi(szParams); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseUInt(IAtlMemMgr *pMemMgr, LPCSTR szParams, unsigned int **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (unsigned int *) pMemMgr->Allocate(sizeof(unsigned int)); - if (*ppParam) - { - char *szEnd; - **ppParam = strtoul(szParams, &szEnd, 10); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseInt64(IAtlMemMgr *pMemMgr, LPCSTR szParams, __int64 **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (__int64 *) pMemMgr->Allocate(sizeof(__int64)); - if (*ppParam) - { - **ppParam = _atoi64(szParams); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseUInt64(IAtlMemMgr *pMemMgr, LPCSTR szParams, unsigned __int64 **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (unsigned __int64 *) pMemMgr->Allocate(sizeof(unsigned __int64)); - if (*ppParam) - { - char *szEnd; - **ppParam = _strtoui64(szParams, &szEnd, 10); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseBool(IAtlMemMgr *pMemMgr, LPCSTR szParams, bool **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (bool *) pMemMgr->Allocate(sizeof(bool)); - if (*ppParam) - { - if (!_strnicmp(szParams, "true", sizeof("true")-sizeof('\0'))) - **ppParam = true; - else - **ppParam = false; - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseDouble(IAtlMemMgr *pMemMgr, LPCSTR szParams, double **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - *ppParam = (double *) pMemMgr->Allocate(sizeof(double)); - if (*ppParam) - { - **ppParam = atof(szParams); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - return HTTP_SUCCESS; - } - - HTTP_CODE DefaultParseFloat(IAtlMemMgr *pMemMgr, LPCSTR szParams, float **ppParam) throw(...) - { - ATLENSURE( pMemMgr != NULL ); - ATLENSURE( szParams != NULL ); - ATLENSURE( ppParam != NULL ); - - errno_t errnoValue = 0; - *ppParam = (float *) pMemMgr->Allocate(sizeof(float)); - if (*ppParam) - { - errno_t saveErrno = Checked::get_errno(); - Checked::set_errno(0); - **ppParam = (float) atof(szParams); - errnoValue = Checked::get_errno(); - Checked::set_errno(saveErrno); - } - else - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - if ((**ppParam == -HUGE_VAL) || (**ppParam == HUGE_VAL) || (errnoValue == ERANGE)) - { - return HTTP_FAIL; - } - return HTTP_SUCCESS; - } -}; - -inline LPCSTR SkipSpace(LPCSTR sz, WORD nCodePage) throw() -{ - if (sz == NULL) - return NULL; - - while (isspace(static_cast(*sz))) - sz = CharNextExA(nCodePage, sz, 0); - return sz; -} - -inline LPCSTR RSkipSpace(LPCSTR pStart, LPCSTR sz, WORD nCodePage) throw() -{ - if (sz == NULL || pStart == NULL) - return NULL; - - while (isspace(static_cast(*sz)) && sz != pStart) - sz = CharPrevExA(nCodePage, pStart, sz, 0); - return sz; -} - -// -// StencilToken -// The stencil class will create an array of these tokens during the parse -// phase and use them during rendering to render the stencil -struct StencilToken -{ - LPCSTR pStart; // Start of fragment to be rendered - LPCSTR pEnd; // End of fragment to be rendered - DWORD type; // Type of token - DWORD dwFnOffset; // Offset into the replacement map for the handler function. - DWORD dwMap; - DWORD dwObjOffset; // An identifier for the caller to use in identifiying the - // object that will render this token. - CHAR szHandlerName[ATL_MAX_HANDLER_NAME_LEN + 1]; // Name of handler object. - CHAR szMethodName[ATL_MAX_METHOD_NAME_LEN + 1]; // Name of handler method. - DWORD dwLoopIndex; // Offset into array of StencilTokens of the other loop tag - DWORD_PTR dwData; - BOOL bDynamicAlloc; -}; - - -// -// Class CStencil -// The CStencil class is used to map in a stencil from a file or resource -// and parse the stencil into an array of StencilTokens. We then render -// the stencil from the array of tokens. This class's parse and render -// functions depend on an IReplacementHandlerLookup interface pointer to be -// passed so it can retrieve the IReplacementHandler interface pointer of the -// handler object that will be called to render replacement tags -class CStencil : - public IMemoryCacheClient -{ -private: - LPCSTR m_pBufferStart; // Beginning of CHAR buffer that holds the stencil. - // For mapped files this is the beginning of the mapping. - LPCSTR m_pBufferEnd; // End of CHAR buffer that holds the stencil. - CAtlArray m_arrTokens; //An array of tokens. - FILETIME m_ftLastModified; // Last modified time (0 for resource) - FILETIME m_ftLastChecked; // Last time we retrieved last modified time (0 for resource) - HCACHEITEM m_hCacheItem; - WORD m_nCodePage; - BOOL m_bUseLocaleACP; - char m_szDllPath[MAX_PATH]; - char m_szHandlerName[ATL_MAX_HANDLER_NAME_LEN+1]; // Room for the path, the handler - // the '/' and the '\0' -#ifdef ATL_DEBUG_STENCILS - struct ParseError - { - char m_szError[ATL_STENCIL_MAX_ERROR_LEN]; - LPCSTR m_szPosition; - LPCSTR m_szStartLine; - LPCSTR m_szEndLine; - int m_nLineNumber; - - bool operator==(const ParseError& that) const throw() - { - return (m_nLineNumber == that.m_nLineNumber); - } - }; - - CSimpleArray m_Errors; - HINSTANCE m_hResInst; - - class CParseErrorProvider : public ITagReplacerImpl, - public CComObjectRootEx - { - public: - BEGIN_COM_MAP(CParseErrorProvider) - COM_INTERFACE_ENTRY(ITagReplacer) - END_COM_MAP() - CSimpleArray *m_pErrors; - int m_nCurrentError; - - CParseErrorProvider() throw() : - m_pErrors(NULL), - m_nCurrentError(-1) - { - } - - void Initialize(CSimpleArray *pErrors) throw() - { - m_pErrors = pErrors; - } - - HTTP_CODE OnGetNextError() throw() - { - m_nCurrentError++; - if (m_nCurrentError >= m_pErrors->GetSize() || - m_nCurrentError < 0 ) - { - m_nCurrentError = -1; - return HTTP_S_FALSE; - } - else - return HTTP_SUCCESS; - } - - HTTP_CODE OnGetErrorLineNumber() throw(...) - { - if (m_pErrors->GetSize() == 0) - return HTTP_SUCCESS; - if (m_nCurrentError > m_pErrors->GetSize() || - m_nCurrentError < 0) - m_nCurrentError = 0; - - CWriteStreamHelper c(m_pStream); - if (!c.Write((*m_pErrors)[m_nCurrentError].m_nLineNumber)) - return HTTP_FAIL; - - return HTTP_SUCCESS; - } - - HTTP_CODE OnGetErrorText() throw(...) - { - if (m_pErrors->GetSize() == 0) - return HTTP_SUCCESS; - if (m_nCurrentError > m_pErrors->GetSize() || - m_nCurrentError < 0) - m_nCurrentError = 0; - - CWriteStreamHelper c(m_pStream); - - if (!c.Write(static_cast((*m_pErrors)[m_nCurrentError].m_szError))) - return HTTP_FAIL; - - return HTTP_SUCCESS; - } - - HTTP_CODE OnGetErrorLine() throw(...) - { - ATLASSUME(m_pStream != NULL); - - if (m_pErrors->GetSize() == 0) - return HTTP_SUCCESS; - if (m_nCurrentError > m_pErrors->GetSize() || - m_nCurrentError < 0) - m_nCurrentError = 0; - - m_pStream->WriteStream((*m_pErrors)[m_nCurrentError].m_szStartLine, - (int)((*m_pErrors)[m_nCurrentError].m_szEndLine - (*m_pErrors)[m_nCurrentError].m_szStartLine), NULL); - - return HTTP_SUCCESS; - } - - BEGIN_REPLACEMENT_METHOD_MAP(CParseErrorProvider) - REPLACEMENT_METHOD_ENTRY("GetNextError", OnGetNextError) - REPLACEMENT_METHOD_ENTRY("GetErrorText", OnGetErrorText) - REPLACEMENT_METHOD_ENTRY("GetErrorLine", OnGetErrorLine) - REPLACEMENT_METHOD_ENTRY("GetErrorLineNumber", OnGetErrorLineNumber) - END_REPLACEMENT_METHOD_MAP() - }; - -#else - bool m_bErrorsOccurred; -#endif - - class CSaveThreadLocale - { - LCID m_locale; - public: - CSaveThreadLocale() throw() - { - m_locale = GetThreadLocale(); - } - ~CSaveThreadLocale() throw() - { - SetThreadLocale(m_locale); - } - }; - - HTTP_CODE LoadFromResourceInternal(HINSTANCE hInstRes, HRSRC hRsrc) throw() - { - ATLASSERT( hRsrc != NULL ); - - HGLOBAL hgResource = NULL; - hgResource = LoadResource(hInstRes, hRsrc); - if (!hgResource) - { - return HTTP_FAIL; - } - - DWORD dwSize = SizeofResource(hInstRes, hRsrc); - if (dwSize != 0) - { - m_pBufferStart = (LPSTR)LockResource(hgResource); - if (m_pBufferStart != NULL) - { - m_pBufferEnd = m_pBufferStart+dwSize; - return HTTP_SUCCESS; - } - } - - // failed to load resource - return HTTP_FAIL; - } - -protected: - - ITagReplacer *m_pReplacer; - IAtlMemMgr *m_pMemMgr; - static CCRTHeap m_crtHeap; - - inline BOOL CheckTag(LPCSTR szTag, DWORD dwTagLen, LPCSTR szStart, DWORD dwLen) throw() - { - if (dwLen < dwTagLen) - return FALSE; - - if (memcmp(szStart, szTag, dwTagLen)) - return FALSE; - - if (isspace(static_cast(szStart[dwTagLen])) || szStart[dwTagLen] == '}') - return TRUE; - - return FALSE; - } - - inline void FindTagArgs(LPCSTR& szstart, LPCSTR& szend, int nKeywordChars) throw() - { - // this function should only be called after finding a valid tag - // the first two characters of szstart should be {{ - ATLASSERT(szstart[0] == '{' && szstart[1] == '{'); - - if (*szstart == '{') - szstart += 2; // move past {{ - szstart = SkipSpace(szstart, m_nCodePage); // move past whitespace - szstart += nKeywordChars; // move past keyword - szstart = SkipSpace(szstart, m_nCodePage); // move past whitespace after keyword - if (*szend == '}') - szend -=2; // chop off }} - szend = RSkipSpace(szstart, szend, m_nCodePage); // chop of trailing whitespace - } - - DWORD CheckTopAndPop(DWORD *pBlockStack, DWORD *pdwTop, DWORD dwToken) throw() - { - if (*pdwTop == 0) - return STENCIL_INVALIDINDEX; - if (m_arrTokens[pBlockStack[*pdwTop]].type == dwToken) - { - *pdwTop = (*pdwTop) - 1; - return pBlockStack[(*pdwTop)+1]; - } - return STENCIL_INVALIDINDEX; - } - - DWORD PushToken(DWORD *pBlockStack, DWORD *pdwTop, DWORD dwIndex) throw() - { - if (*pdwTop < (ATL_MAX_BLOCK_STACK-1)) - { - *pdwTop = (*pdwTop) + 1; - pBlockStack[*pdwTop] = dwIndex; - } - else - { - dwIndex = STENCIL_INVALIDINDEX; - } - - return dwIndex; - } - -public: - - enum PARSE_TOKEN_RESULT { INVALID_TOKEN, NORMAL_TOKEN, RESERVED_TOKEN }; - - CStencil(IAtlMemMgr *pMemMgr=NULL) throw() - { - m_pBufferStart = NULL; - m_pBufferEnd = NULL; - m_hCacheItem = NULL; - m_ftLastModified.dwLowDateTime = 0; - m_ftLastModified.dwHighDateTime = 0; - m_ftLastChecked.dwLowDateTime = 0; - m_ftLastChecked.dwHighDateTime = 0; - m_arrTokens.SetCount(0, 128); - m_nCodePage = CP_ACP; - m_bUseLocaleACP = TRUE; - m_szHandlerName[0] = '\0'; - m_szDllPath[0] = '\0'; - m_pMemMgr = pMemMgr; - if (!pMemMgr) - m_pMemMgr = &m_crtHeap; -#ifdef ATL_DEBUG_STENCILS - m_hResInst = NULL; -#else - m_bErrorsOccurred = false; -#endif - - } - - virtual ~CStencil() throw() - { - Uninitialize(); - } - -#ifdef ATL_DEBUG_STENCILS - - bool RenderErrors(IWriteStream *pStream) throw(...) - { - if (pStream == NULL) - { - return false; - } - - CComObjectStackEx Errors; - - Errors.Initialize(&m_Errors); - CStencil ErrorStencil; - - if (m_hResInst != NULL) - { - CFixedStringT strErrorStencil; - _ATLTRY - { - if (strErrorStencil.LoadString(m_hResInst, IDS_STENCIL_ERROR_STENCIL) == FALSE) - { - return false; - } - } - _ATLCATCHALL() - { - return false; - } - - HTTP_CODE hcRet = ErrorStencil.LoadFromString(strErrorStencil, strErrorStencil.GetLength()); - - if (hcRet == HTTP_SUCCESS) - { - if (ErrorStencil.ParseReplacements(static_cast(&Errors)) != false) - { - ErrorStencil.FinishParseReplacements(); - if (ErrorStencil.ParseSuccessful() != false) - { - hcRet = ErrorStencil.Render(static_cast(&Errors), pStream); - - if (HTTP_ERROR_CODE(hcRet) < 400) - { - return true; - } - } - } - } - } - - return false; - } - - void SetErrorResource(HINSTANCE hResInst) - { - m_hResInst = hResInst; - } - - bool ParseSuccessful() - { - return (m_Errors.GetSize() == 0); - } - - bool AddErrorInternal(LPCSTR szErrorText, LPCSTR szPosition) throw() - { - int nLineNum = 0; - LPCSTR szStartLine = NULL; - LPCSTR szPtr = m_pBufferStart; - while (szPtr < szPosition) - { - if (*szPtr == '\n') - { - szStartLine = szPtr + 1; - nLineNum++; - } - - LPSTR szNext = CharNextExA(m_nCodePage, szPtr, 0); - if (szNext == szPtr) - { - break; - } - szPtr = szNext; - } - LPCSTR szEndLine = szPtr; - while (*szPtr) - { - if (*szPtr == '\n') - break; - szEndLine = szPtr; - LPSTR szNext = CharNextExA(m_nCodePage, szPtr, 0); - if (szNext == szPtr) - { - break; - } - szPtr = szNext; - } - - ParseError p; - SafeStringCopy(p.m_szError, szErrorText); - p.m_szPosition = szPosition; - p.m_nLineNumber = nLineNum; - p.m_szStartLine = szStartLine; - p.m_szEndLine = szEndLine; - - return (m_Errors.Add(p) == TRUE); - } - - bool AddError(UINT uID, LPCSTR szPosition) throw() - { - if (m_hResInst != NULL) - { - _ATLTRY - { - CFixedStringT strRes; - if (strRes.LoadString(m_hResInst, uID) != FALSE) - { - return AddErrorInternal(strRes, szPosition); - } - } - _ATLCATCHALL() - { - } - } - return AddErrorInternal("Could not load resource for error string", szPosition); - } - - bool AddReplacementError(LPCSTR szReplacement, LPCSTR szPosition) throw() - { - if (m_hResInst != NULL) - { - _ATLTRY - { - CFixedStringT strRes; - if (strRes.LoadString(m_hResInst, IDS_STENCIL_UNRESOLVED_REPLACEMENT) != FALSE) - { - CFixedStringT strErrorText; - strErrorText.Format(strRes, szReplacement); - return AddErrorInternal(strErrorText, szPosition); - } - else - { - return AddErrorInternal("Could not load resource for error string", szPosition); - } - } - _ATLCATCHALL() - { - return false; - } - } - - return false; - } - -#else - - bool ParseSuccessful() - { - return !m_bErrorsOccurred; - } - - bool AddError(UINT /*uID*/, LPCSTR /*szPosition*/) throw() - { - m_bErrorsOccurred = true; - return true; - } - - bool AddReplacementError(LPCSTR /*szReplacement*/, LPCSTR /*szPosition*/) throw() - { - m_bErrorsOccurred = true; - return true; - } - - void SetErrorResource(HINSTANCE) throw() - { - } - -#endif - - // Call Uninitialize if you want to re-use an already initialized CStencil - void Uninitialize() throw() - { - int nSize = (int) m_arrTokens.GetCount(); - for (int nIndex = 0; nIndex < nSize; nIndex++) - { - if (m_arrTokens[nIndex].bDynamicAlloc) - delete [] m_arrTokens[nIndex].pStart; - if (m_arrTokens[nIndex].dwData != 0 && m_arrTokens[nIndex].type != STENCIL_LOCALE) - m_pMemMgr->Free((void *) m_arrTokens[nIndex].dwData); - } - - m_arrTokens.RemoveAll(); - if ((m_ftLastModified.dwLowDateTime || m_ftLastModified.dwHighDateTime) && m_pBufferStart) - { - delete [] m_pBufferStart; - } - m_pBufferStart = NULL; - m_pBufferEnd = NULL; - } - - void GetLastModified(FILETIME *pftLastModified) - { - ATLENSURE(pftLastModified); - *pftLastModified = m_ftLastModified; - } - - void GetLastChecked(FILETIME *pftLastChecked) - { - ATLENSURE(pftLastChecked); - *pftLastChecked = m_ftLastChecked; - } - - void SetLastChecked(FILETIME *pftLastChecked) - { - ATLENSURE(pftLastChecked); - m_ftLastChecked = *pftLastChecked; - } - - HCACHEITEM GetCacheItem() - { - return m_hCacheItem; - } - - void SetCacheItem(HCACHEITEM hCacheItem) - { - ATLASSUME(m_hCacheItem == NULL); - m_hCacheItem = hCacheItem; - } - - bool GetHandlerName(__out_ecount_z(nPathLen) LPSTR szDllPath, __in size_t nPathLen, __out_ecount_z(nHandlerNameLen) LPSTR szHandlerName, __in size_t nHandlerNameLen) throw() - { - if(strlen(m_szDllPath) >= nPathLen) - { - return false; - } - - if(strlen(m_szHandlerName) >= nHandlerNameLen) - { - return false; - } - - if(0 != strcpy_s(szDllPath, nPathLen, m_szDllPath)) - { - return false; - } - - if(0 != strcpy_s(szHandlerName, nHandlerNameLen, m_szHandlerName)) - { - return false; - } - - return true; - } - - // Adds a token to the token array, handler name, method name - // and handler function offset are optional - ATL_NOINLINE DWORD AddToken( - LPCSTR pStart, - LPCSTR pEnd, - DWORD dwType, - LPCSTR szHandlerName = NULL, - LPCSTR szMethodName = NULL, - DWORD dwFnOffset = STENCIL_INVALIDOFFSET, - DWORD dwObjOffset = STENCIL_INVALIDOFFSET, - DWORD_PTR dwData = 0, - DWORD dwMap = 0, - BOOL bDynamicAlloc = 0) throw() - { - StencilToken t; - - memset(&t, 0x00, sizeof(t)); - - t.pStart = pStart; - t.pEnd = pEnd; - t.type = dwType; - t.dwLoopIndex = STENCIL_INVALIDINDEX; - t.dwFnOffset = dwFnOffset; - t.dwObjOffset = dwObjOffset; - t.dwData = dwData; - t.dwMap = dwMap; - t.bDynamicAlloc = bDynamicAlloc; - - // this should never assert unless the user has overriden something incorrectly - if ((szHandlerName != NULL) && (*szHandlerName)) - { - ATLVERIFY( SafeStringCopy(t.szHandlerName, szHandlerName) ); - } - if ((szMethodName != NULL) && (*szMethodName)) - { - ATLVERIFY( SafeStringCopy(t.szMethodName, szMethodName) ); - } - - _ATLTRY - { - return (DWORD) m_arrTokens.Add(t); - } - _ATLCATCHALL() - { - return STENCIL_INVALIDINDEX; - } - } - - HTTP_CODE LoadFromFile(LPCSTR szFileName) throw() - { - HRESULT hr = E_FAIL; - ULONGLONG dwLen = 0; - CAtlFile file; - - _ATLTRY - { - hr = file.Create(CA2CTEX(szFileName), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING); - if (FAILED(hr) || GetFileType(file) != FILE_TYPE_DISK) - return AtlsHttpError(500, ISE_SUBERR_STENCIL_LOAD_FAIL); // couldn't load SRF! - - if (GetFileTime(file, NULL, NULL, &m_ftLastModified)) - { - if (SUCCEEDED(file.GetSize(dwLen))) - { - ATLASSERT(!m_pBufferStart); - - GetSystemTimeAsFileTime(&m_ftLastChecked); - - m_pBufferStart = NULL; - CAutoVectorPtr buffer; - if (!buffer.Allocate((size_t) dwLen)) - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); // out of memory - - DWORD dwRead = 0; - hr = file.Read(buffer, (DWORD) dwLen, dwRead); - if (FAILED(hr)) - return AtlsHttpError(500, ISE_SUBERR_READFILEFAIL); // ReadFile failed - - m_pBufferStart = buffer.Detach(); - m_pBufferEnd = m_pBufferStart + dwRead; - } - } - } - _ATLCATCHALL() - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - } - - return HTTP_SUCCESS; - } - - // loads a stencil from the specified resource. - HTTP_CODE LoadFromResource(HINSTANCE hInstRes, LPCSTR szID, LPCSTR szType = NULL) throw() - { - if (szType == NULL) - { - szType = (LPCSTR) RT_HTML; - } - - HRSRC hRsrc = FindResourceA(hInstRes, szID, szType); - if (hRsrc != NULL) - { - return LoadFromResourceInternal(hInstRes, hRsrc); - } - - return HTTP_FAIL; - } - - HTTP_CODE LoadFromResourceEx(HINSTANCE hInstRes, LPCSTR szID, WORD wLanguage, LPCSTR szType = NULL) throw() - { - if (szType == NULL) - { - szType = (LPCSTR) RT_HTML; - } - - HRSRC hRsrc = FindResourceExA(hInstRes, szType, szID, wLanguage); - if (hRsrc != NULL) - { - return LoadFromResourceInternal(hInstRes, hRsrc); - } - - return HTTP_FAIL; - } - - // loads a stencil from the specified resource - HTTP_CODE LoadFromResource(HINSTANCE hInstRes, UINT nId, LPCSTR szType = NULL) throw() - { - return LoadFromResource(hInstRes, MAKEINTRESOURCEA(nId), szType); - } - - HTTP_CODE LoadFromResourceEx(HINSTANCE hInstRes, UINT nId, WORD wLanguage, LPCSTR szType = NULL) throw() - { - return LoadFromResourceEx(hInstRes, MAKEINTRESOURCEA(nId), wLanguage, szType); - } - - // loads a stencil from a string - HTTP_CODE LoadFromString(LPCSTR szString, DWORD dwSize) throw() - { - m_pBufferStart = szString; - m_pBufferEnd = m_pBufferStart+dwSize; - return HTTP_SUCCESS; - } - - // Cracks the loaded stencil into an array of StencilTokens in preparation for - // rendering. LoadStencil must be called prior to calling this function. - virtual bool ParseReplacements(ITagReplacer* pReplacer) throw(...) - { - return ParseReplacementsFromBuffer(pReplacer, GetBufferStart(), GetBufferEnd()); - } - - virtual bool FinishParseReplacements() throw(...) - { - DWORD dwSize = (DWORD) m_arrTokens.GetCount(); - for (DWORD dwIndex = 0; dwIndex < dwSize; dwIndex++) - { - StencilToken& token = m_arrTokens[dwIndex]; - bool bUnclosedBlock = ((token.type == STENCIL_CONDITIONALSTART || - token.type == STENCIL_CONDITIONALELSE || - token.type == STENCIL_ITERATORSTART) && - token.dwLoopIndex == STENCIL_INVALIDINDEX); - if ((token.szMethodName[0] && token.dwFnOffset == STENCIL_INVALIDOFFSET) || bUnclosedBlock) - { - if (bUnclosedBlock || - m_pReplacer->FindReplacementOffset( - token.szMethodName, &token.dwFnOffset, - token.szHandlerName, &token.dwObjOffset, - &token.dwMap, (void **)(&token.dwData), m_pMemMgr) != HTTP_SUCCESS) - { - if (bUnclosedBlock && token.type == STENCIL_CONDITIONALSTART) - { - AddError(IDS_STENCIL_UNCLOSEDBLOCK_IF, token.pStart); - } - else if (bUnclosedBlock && token.type == STENCIL_CONDITIONALELSE) - { - AddError(IDS_STENCIL_UNCLOSEDBLOCK_ELSE, token.pStart); - } - else if (bUnclosedBlock && token.type == STENCIL_ITERATORSTART) - { - AddError(IDS_STENCIL_UNCLOSEDBLOCK_WHILE, token.pStart); - } - else - { - AddReplacementError(token.szMethodName, token.pStart); - } - - // unresolved replacement, convert it to a text token - token.type = STENCIL_TEXTTAG; - - // convert all linked tokens to text tokens as well - // this includes: endif, else, endwhile - DWORD dwLoopIndex = token.dwLoopIndex; - while (dwLoopIndex != dwIndex && dwLoopIndex != STENCIL_INVALIDINDEX) - { - m_arrTokens[dwLoopIndex].type = STENCIL_TEXTTAG; - dwLoopIndex = m_arrTokens[dwLoopIndex].dwLoopIndex; - } - } - } - } - - return ParseSuccessful(); - } - - virtual bool Parse(ITagReplacer *pReplacer) throw( ... ) - { - if (ParseReplacements(pReplacer)) - { - return FinishParseReplacements(); - } - return false; - } - - - DWORD ParseReplacement( LPCSTR szTokenStart, - LPCSTR szTokenEnd, - DWORD dwTokenType = STENCIL_REPLACEMENT, - DWORD dwKeywordLen = 0) throw() - { - // hold on to the start and end pointers (before removing curlies and whitespace) - // this is needed so that we can convert the token to a text token if the method - // is not resolved (in FinishParseReplacements) - LPCSTR szStart = szTokenStart; - LPCSTR szEnd = szTokenEnd; - - FindTagArgs(szTokenStart, szTokenEnd, dwKeywordLen); - - char szMethodName[ATL_MAX_METHOD_NAME_LEN+1]; - char szHandlerName[ATL_MAX_HANDLER_NAME_LEN+1]; - - DWORD dwIndex; - //look up the handler name, method name and handler interface - if (HTTP_SUCCESS == GetHandlerAndMethodNames(szTokenStart, szTokenEnd, - szMethodName, ATL_MAX_METHOD_NAME_LEN+1, - szHandlerName, ATL_MAX_HANDLER_NAME_LEN+1)) - dwIndex = AddToken(szStart, szEnd, dwTokenType, - szHandlerName, szMethodName, - STENCIL_INVALIDINDEX, STENCIL_INVALIDINDEX, - 0, STENCIL_BASIC_MAP); - else - dwIndex = STENCIL_INVALIDINDEX; - return dwIndex; - } - - DWORD ParseWhile(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) throw() - { - DWORD dwIndex = ParseReplacement(szTokenStart, szTokenEnd, STENCIL_ITERATORSTART, sizeof("while")-1); - if (dwIndex == STENCIL_INVALIDINDEX) - return dwIndex; - return PushToken(pBlockStack, pdwTop, dwIndex); - } - - DWORD ParseEndWhile(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) throw() - { - DWORD dwTopIndex = CheckTopAndPop(pBlockStack, pdwTop, STENCIL_ITERATORSTART); - if (dwTopIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE, szTokenStart); - return dwTopIndex; - } - - DWORD dwIndex = AddToken(szTokenStart, szTokenEnd, STENCIL_ITERATOREND); - if (dwIndex != STENCIL_INVALIDINDEX) - { - m_arrTokens[dwTopIndex].dwLoopIndex = dwIndex; - m_arrTokens[dwIndex].dwLoopIndex = dwTopIndex; - } - return dwIndex; - } - - DWORD ParseIf(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) throw() - { - DWORD dwIndex = ParseReplacement(szTokenStart, szTokenEnd, STENCIL_CONDITIONALSTART, sizeof("if")-1); - if (dwIndex == STENCIL_INVALIDINDEX) - return dwIndex; - return PushToken(pBlockStack, pdwTop, dwIndex); - } - - DWORD ParseElse(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) throw() - { - DWORD dwTopIndex = CheckTopAndPop(pBlockStack, pdwTop, STENCIL_CONDITIONALSTART); - if (dwTopIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_UNOPENEDBLOCK_ELSE, szTokenStart); - return dwTopIndex; - } - - DWORD dwIndex = AddToken(szTokenStart, szTokenEnd, STENCIL_CONDITIONALELSE); - if (dwIndex != STENCIL_INVALIDINDEX) - { - m_arrTokens[dwTopIndex].dwLoopIndex = dwIndex; - - return PushToken(pBlockStack, pdwTop, dwIndex); - } - return dwIndex; - } - - DWORD ParseEndIf(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) throw() - { - DWORD dwTopIndex = CheckTopAndPop(pBlockStack, pdwTop, STENCIL_CONDITIONALSTART); - if (dwTopIndex == STENCIL_INVALIDINDEX) - { - dwTopIndex = CheckTopAndPop(pBlockStack, pdwTop, STENCIL_CONDITIONALELSE); - if (dwTopIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_UNOPENEDBLOCK_ENDIF, szTokenStart); - return dwTopIndex; - } - } - DWORD dwIndex = AddToken(szTokenStart, szTokenEnd, STENCIL_CONDITIONALEND); - if (dwIndex != STENCIL_INVALIDINDEX) - { - m_arrTokens[dwTopIndex].dwLoopIndex = dwIndex; - } - return dwIndex; - } - - DWORD ParseLocale(LPCSTR szTokenStart, LPCSTR szTokenEnd) throw() - { - LPCSTR szstart = szTokenStart; - LPCSTR szend = szTokenEnd; - LCID locale = 0xFFFFFFFF; - FindTagArgs(szstart, szend, 6); -#ifndef ATL_NO_MLANG - if (isdigit(static_cast(szstart[0]))) - { - locale = (LCID) atoi(szstart); - } - else - { - HRESULT hr; - - CComPtr pML; - hr = pML.CoCreateInstance(__uuidof(CMultiLanguage), NULL, CLSCTX_INPROC_SERVER); - if (FAILED(hr)) - { - ATLTRACE(atlTraceStencil, 0, _T("Couldn't create CMultiLanguage object. check MLANG installation.")); - AddError(IDS_STENCIL_MLANG_COCREATE, szTokenStart); - } - else - { - CStringW str(szstart, (int)((szend-szstart)+1)); - -#ifdef __IMultiLanguage2_INTERFACE_DEFINED__ - - // use IMultiLanguage2 if possible - CComPtr spML2; - hr = pML.QueryInterface(&spML2); - if (FAILED(hr) || !spML2.p) - hr = pML->GetLcidFromRfc1766(&locale, CComBSTR(str)); - else - hr = spML2->GetLcidFromRfc1766(&locale, CComBSTR(str)); - -#else // __IMultiLanguage2_INTERFACE_DEFINED__ - - hr = pML->GetLcidFromRfc1766(&locale, CComBSTR(str)); - -#endif // __IMultiLanguage2_INTERFACE_DEFINED__ - - if (FAILED(hr)) - { - AddError(IDS_STENCIL_MLANG_LCID, szTokenStart); - } - } - if (FAILED(hr)) - locale = 0xFFFFFFFF; - } -#else - locale = (LCID) atoi(szstart); -#endif - - if (m_bUseLocaleACP) - { - TCHAR szACP[7]; - if (GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, szACP, 7) != 0) - { - m_nCodePage = (WORD) _ttoi(szACP); - } - else - { - AddError(IDS_STENCIL_MLANG_GETLOCALE, szTokenStart); - } - } - DWORD dwCurrentTokenIndex = STENCIL_INVALIDINDEX; - if (locale != 0xFFFFFFFF) - dwCurrentTokenIndex = AddToken(NULL, NULL, STENCIL_LOCALE, - NULL, NULL, STENCIL_INVALIDOFFSET, STENCIL_INVALIDOFFSET, locale); - else - return STENCIL_INVALIDINDEX; - return dwCurrentTokenIndex; - } - - DWORD ParseCodepage(LPCSTR szTokenStart, LPCSTR szTokenEnd) throw() - { - LPCSTR szstart = szTokenStart; - LPCSTR szend = szTokenEnd; - WORD nCodePage = 0xFFFF; - - FindTagArgs(szstart, szend, 8); -#ifndef ATL_NO_MLANG - if (isdigit(static_cast(szstart[0]))) - { - nCodePage = (WORD) atoi(szstart); - } - else - { - HRESULT hr; - - CComPtr pML; - hr = pML.CoCreateInstance(__uuidof(CMultiLanguage), NULL, CLSCTX_INPROC_SERVER); - if (FAILED(hr)) - { - ATLTRACE(atlTraceStencil, 0, _T("Couldn't create CMultiLanguage object. check MLANG installation.")); - AddError(IDS_STENCIL_MLANG_COCREATE, szTokenStart); - } - else - { - CStringW str(szstart, (int)((szend-szstart)+1)); - MIMECSETINFO info; - -#ifdef __IMultiLanguage2_INTERFACE_DEFINED__ - - // use IMultiLanguage2 if possible - CComPtr spML2; - hr = pML.QueryInterface(&spML2); - if (FAILED(hr) || !spML2.p) - hr = pML->GetCharsetInfo(CComBSTR(str), &info); - else - hr = spML2->GetCharsetInfo(CComBSTR(str), &info); - -#else // __IMultiLanguage2_INTERFACE_DEFINED__ - - hr = pML->GetCharsetInfo(CComBSTR(str), &info); - -#endif // __IMultiLanguage2_INTERFACE_DEFINED__ - - // for most character sets, uiCodePage and uiInternetEncoding - // are the same. UTF-8 is the exception that we're concerned about. - // for that character set, we want uiInternetEncoding (65001 - UTF-8) - // instead of uiCodePage (1200 - UCS-2) - if (SUCCEEDED(hr)) - { - nCodePage = (WORD) info.uiInternetEncoding; - } - else - { - AddError(IDS_STENCIL_MLANG_GETCHARSET, szTokenStart); - } - } - if (FAILED(hr)) - nCodePage = 0xFFFF; - } -#else - nCodePage = (WORD) atoi(szstart); -#endif - if (nCodePage != 0xFFFF) - m_nCodePage = nCodePage; - m_bUseLocaleACP = FALSE; - - return STENCIL_INVALIDINDEX; - } - - PARSE_TOKEN_RESULT ParseHandler(LPCSTR szTokenStart, LPCSTR szTokenEnd) throw() - { - LPCSTR szstart = szTokenStart; - LPCSTR szend = szTokenEnd; - - if (m_szHandlerName[0] && m_szDllPath[0]) - return RESERVED_TOKEN; // already found the handler and path dll names - - FindTagArgs(szstart, szend, 7); - size_t nlen = (szend-szstart)+1; - char szHandlerDllName[MAX_PATH + ATL_MAX_HANDLER_NAME_LEN + 1]; - if (nlen < MAX_PATH + ATL_MAX_HANDLER_NAME_LEN + 1) - { - Checked::memcpy_s(szHandlerDllName, MAX_PATH + ATL_MAX_HANDLER_NAME_LEN + 1, szstart, szend-szstart+1); - szHandlerDllName[szend-szstart+1] = '\0'; - - DWORD dwDllPathLen = MAX_PATH; - DWORD dwHandlerNameLen = ATL_MAX_HANDLER_NAME_LEN+1; - - if (!_AtlCrackHandler(szHandlerDllName, m_szDllPath, &dwDllPathLen, m_szHandlerName, &dwHandlerNameLen)) - { - AddError(IDS_STENCIL_INVALID_HANDLER, szTokenStart); - return INVALID_TOKEN; - } - } - - return RESERVED_TOKEN; - } - - virtual PARSE_TOKEN_RESULT ParseToken(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) - { - LPCSTR pStart = szTokenStart; - pStart += 2; //skip curlies - pStart = SkipSpace(pStart, m_nCodePage); - DWORD dwLen = (DWORD)(szTokenEnd - szTokenStart); - - DWORD dwIndex = STENCIL_INVALIDINDEX; - PARSE_TOKEN_RESULT ret = RESERVED_TOKEN; - - if (CheckTag("endwhile", 8, pStart, dwLen)) - dwIndex = ParseEndWhile(szTokenStart, szTokenEnd, pBlockStack, pdwTop); - else if (CheckTag("while", 5, pStart, dwLen)) - dwIndex = ParseWhile(szTokenStart, szTokenEnd, pBlockStack, pdwTop); - else if (CheckTag("endif", 5, pStart, dwLen)) - dwIndex = ParseEndIf(szTokenStart, szTokenEnd, pBlockStack, pdwTop); - else if (CheckTag("else", 4, pStart, dwLen)) - dwIndex = ParseElse(szTokenStart, szTokenEnd, pBlockStack, pdwTop); - else if (CheckTag("if", 2, pStart, dwLen)) - dwIndex = ParseIf(szTokenStart, szTokenEnd, pBlockStack, pdwTop); - else if (CheckTag("locale", 6, pStart, dwLen)) - dwIndex = ParseLocale(szTokenStart, szTokenEnd); - else if (CheckTag("handler", 7, pStart, dwLen)) - { - return ParseHandler(szTokenStart, szTokenEnd); - } - else if (CheckTag("codepage", 8, pStart, dwLen)) - { - ParseCodepage(szTokenStart, szTokenEnd); - return RESERVED_TOKEN; - } - else - { - dwIndex = ParseReplacement(szTokenStart, szTokenEnd, STENCIL_REPLACEMENT); - if (dwIndex == STENCIL_INVALIDINDEX) - return INVALID_TOKEN; - ret = NORMAL_TOKEN; - } - - if (dwIndex == STENCIL_INVALIDINDEX) - return INVALID_TOKEN; - return ret; - } - - virtual bool ParseReplacementsFromBuffer(ITagReplacer* pReplacer, LPCSTR pStart, LPCSTR pEnd) - { - LPCSTR szCurr = pStart; - DWORD BlockStack[ATL_MAX_BLOCK_STACK]; - DWORD dwTop = 0; - - m_pReplacer = pReplacer; - - DWORD dwCurrentTokenIndex = 0; - - if (!szCurr) - { - ATLASSERT(FALSE); - AddError(IDS_STENCIL_NULLPARAM, NULL); - return false; - } - - LPCSTR szEnd = pEnd; - if (szEnd <= szCurr) - { - ATLASSERT(FALSE); - AddError(IDS_STENCIL_INVALIDSTRING, NULL); - return true; - } - - while(szCurr < szEnd) - { - //mark the start of this block, then find the end of the block - //the end is denoted by an opening curly - LPCSTR szStart = szCurr; - while (szCurr < szEnd && (*szCurr != '{' || szCurr[1] != '{')) - { - LPSTR szNext = CharNextExA(m_nCodePage, szCurr, 0); - if (szNext == szCurr) - { - // embedded null - AddError(IDS_STENCIL_EMBEDDED_NULL, NULL); - return true; - } - szCurr = szNext; - } - - //special case for the last text block, if there is one - if (szCurr >= szEnd) - { - // add the last token. This is everything after the last - // double curly block, which is text. - dwCurrentTokenIndex = AddToken(szStart, szEnd-1, STENCIL_TEXTTAG); - break; - } - - //if there are any characters between szStart and szCurr inclusive, - //copy them to a text token. - if (szCurr-1 >= szStart) - dwCurrentTokenIndex = AddToken(szStart, szCurr-1, STENCIL_TEXTTAG); - - if (dwCurrentTokenIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_OUTOFMEMORY, pStart); - return false; - } - - //find the end of the tag - LPSTR szEndTag; - szStart = szCurr; - szCurr += 2; // Skip over the two '{' s - while (szCurr < szEnd) - { - if (szCurr[0] == '}' && szCurr[1] == '}') - break; - else if (szCurr[0] == '{') - break; - - LPSTR szNext = CharNextExA(m_nCodePage, szCurr, 0); - if (szNext == szCurr) - { - // embedded null - AddError(IDS_STENCIL_EMBEDDED_NULL, NULL); - return true; - } - szCurr = szNext; - } - - if (szCurr >= szEnd) - { - AddError(IDS_STENCIL_UNMATCHED_TAG_START, szStart); - if (AddToken(szStart, szCurr-1, STENCIL_TEXTTAG) == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_OUTOFMEMORY, pStart); - return false; - } - - break; - } - - if (szCurr[0] == '{') - { - if (szCurr[1] != '{') - { - szCurr--; - } - AddError(IDS_STENCIL_MISMATCHED_TAG_START, szStart); - if (AddToken(szStart, szCurr-1, STENCIL_TEXTTAG) == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_OUTOFMEMORY, pStart); - return false; - } - - continue; - } - - szEndTag = CharNextExA(m_nCodePage, szCurr, 0); - if (szEndTag == szCurr) - { - // embedded null - AddError(IDS_STENCIL_EMBEDDED_NULL, NULL); - return true; - } - - PARSE_TOKEN_RESULT ret = ParseToken(szStart, szEndTag, BlockStack, &dwTop); - - if (ret == INVALID_TOKEN) - { - dwCurrentTokenIndex = AddToken(szStart, szEndTag, STENCIL_TEXTTAG); - if (dwCurrentTokenIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_OUTOFMEMORY, pStart); - return false; - } - - szCurr = CharNextExA(m_nCodePage, szEndTag, 0); - continue; - } - - szCurr = CharNextExA(m_nCodePage, szEndTag, 0); - if (szEndTag == szCurr) - { - // embedded null - AddError(IDS_STENCIL_EMBEDDED_NULL, NULL); - return true; - } - - if (ret == RESERVED_TOKEN) - { - if (szCurr < szEnd && *szCurr == '\n') - szCurr++; - else if ((szCurr+1 < szEnd && *szCurr == '\r' && *(szCurr+1) == '\n')) - szCurr += 2; - } - } - - return true; - } - - HTTP_CODE GetHandlerAndMethodNames( - __in LPCSTR pStart, - __in LPCSTR pEnd, - __out_ecount_z(nMethodNameLen) LPSTR pszMethodName, - __in size_t nMethodNameLen, - __out_ecount_z(nHandlerNameLen) LPSTR pszHandlerName, - __in size_t nHandlerNameLen) throw() - { - - ATLASSERT(pStart); - ATLASSERT(pEnd); - ATLASSERT(pEnd > pStart); - - if (!pszMethodName || !pszHandlerName || nMethodNameLen < 1 || nHandlerNameLen < 1) - { - ATLASSERT(FALSE); - AddError(IDS_STENCIL_BAD_PARAMETER, pStart); - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - } - - - *pszMethodName = '\0'; - *pszHandlerName = '\0'; - CHAR szMethodString[ATL_MAX_METHOD_NAME_LEN + ATL_MAX_HANDLER_NAME_LEN+1]; - HTTP_CODE hcErr = HTTP_SUCCESS; - // - // copy the method string - // - size_t nMethodLen = (pEnd-pStart)+1; - if (nMethodLen >= (ATL_MAX_METHOD_NAME_LEN + ATL_MAX_HANDLER_NAME_LEN+1)) - { - AddError(IDS_STENCIL_METHODNAME_TOO_LONG, pStart); - return AtlsHttpError(500, ISE_SUBERR_LONGMETHODNAME); - } - - Checked::memcpy_s(szMethodString, ATL_MAX_METHOD_NAME_LEN + ATL_MAX_HANDLER_NAME_LEN+1, pStart, nMethodLen); - szMethodString[nMethodLen] = '\0'; - - // - // now crack the method string and get the handler - // id and function name - // - LPSTR szParen = strchr(szMethodString, '('); - LPSTR szDot = strchr(szMethodString, '.'); - if (szDot && (!szParen || (szDot < szParen))) - { - *szDot = '\0'; - szDot++; - - // copy method name - if (strlen(szDot) < nMethodNameLen) - Checked::strcpy_s(pszMethodName, nMethodNameLen, szDot); - else - { - AddError(IDS_STENCIL_METHODNAME_TOO_LONG, pStart + (szDot - szMethodString)); - hcErr = AtlsHttpError(500, ISE_SUBERR_LONGMETHODNAME); - } - // copy handler name - if (!hcErr) - { - if (strlen(szMethodString) < nHandlerNameLen) - Checked::strcpy_s(pszHandlerName, nHandlerNameLen, szMethodString); - else - { - AddError(IDS_STENCIL_HANDLERNAME_TOO_LONG, pStart); - hcErr = AtlsHttpError(500, ISE_SUBERR_LONGHANDLERNAME); - } - } - } - else - { - // only a method name so just copy it. - if (strlen(szMethodString) < nMethodNameLen) - Checked::strcpy_s(pszMethodName, nMethodNameLen, szMethodString); - else - { - AddError(IDS_STENCIL_METHODNAME_TOO_LONG, pStart); - hcErr = AtlsHttpError(500, ISE_SUBERR_LONGMETHODNAME); - } - } - return hcErr; - } - - virtual HTTP_CODE Render( - ITagReplacer *pReplacer, - IWriteStream *pWriteStream, - CStencilState* pState = NULL) const throw(...) - { - ATLENSURE(pReplacer != NULL); - ATLENSURE(pWriteStream != NULL); - - HTTP_CODE hcErrorCode = HTTP_SUCCESS; - DWORD dwIndex = 0; - DWORD dwArraySize = GetTokenCount(); - - // set up locale info - CSaveThreadLocale lcidSave; - - if (pState) - { - dwIndex = pState->dwIndex; - - // restore the locale if we're restarting rendering - if (pState->locale != CP_ACP) - SetThreadLocale(pState->locale); - } - - pReplacer->SetStream(pWriteStream); - while (dwIndex < dwArraySize) - { - // RenderToken advances dwIndex appropriately for us. - dwIndex = RenderToken(dwIndex, pReplacer, pWriteStream, &hcErrorCode, pState); - - if (dwIndex == STENCIL_INVALIDINDEX || - hcErrorCode != HTTP_SUCCESS) - break; - } - - if (IsAsyncStatus(hcErrorCode)) - { - ATLASSERT( pState != NULL ); // state is required for async - if (pState) - pState->dwIndex = dwIndex; - } - // lcidSave destructor will restore the locale info in case it was changed - - return hcErrorCode; - } - - inline BOOL IsValidIndex(DWORD dwIndex) const throw() - { - if (dwIndex == STENCIL_INVALIDINDEX) - return FALSE; - if (dwIndex < GetTokenCount()) - return TRUE; - else - return FALSE; - } - - virtual DWORD RenderToken( - DWORD dwIndex, - ITagReplacer *pReplacer, - IWriteStream *pWriteStream, - HTTP_CODE *phcErrorCode, - CStencilState* pState = NULL) const throw(...) - { - ATLENSURE(pReplacer != NULL); - ATLENSURE(pWriteStream != NULL); - - const StencilToken* pToken = GetToken(dwIndex); - DWORD dwNextToken = 0; - HTTP_CODE hcErrorCode = HTTP_SUCCESS; - - if (!pToken) - return STENCIL_INVALIDINDEX; - - switch (pToken->type) - { - case STENCIL_TEXTTAG: - { - pWriteStream->WriteStream(pToken->pStart, - (int)((pToken->pEnd-pToken->pStart)+1), NULL); - dwNextToken = dwIndex+1; - } - break; - case STENCIL_ITERATORSTART: - { - HTTP_CODE hcErr = STENCIL_SUCCESS; - -#ifdef ATL_DEBUG_STENCILS - // A 'while' token has to at least be followed by an endwhile! - if (!IsValidIndex(dwIndex+1)) - { - // This should have been caught at parse time - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_INVALIDINDEX); - ATLASSERT(FALSE); - break; - } - - // End of loop should be valid - if (!IsValidIndex(pToken->dwLoopIndex)) - { - // This should have been caught at parse time - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_MISMATCHWHILE); - ATLASSERT(FALSE); - break; - } - - if (pToken->dwFnOffset == STENCIL_INVALIDOFFSET) - { - // This should have been caught at parse time - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_INVALIDFUNCOFFSET); - ATLASSERT(FALSE); - break; - } -#endif // ATL_DEBUG_STENCILS - - DWORD dwLoopIndex = pToken->dwLoopIndex; // points to the end of the loop - - // Call the replacement method - // if it returns HTTP_SUCCESS, enter the loop - // if it returns HTTP_S_FALSE, terminate the loop - hcErr = pReplacer->RenderReplacement(pToken->dwFnOffset, - pToken->dwObjOffset, pToken->dwMap, (void *) pToken->dwData); - - if (hcErr == HTTP_SUCCESS) - { - dwNextToken = dwIndex+1; - hcErrorCode = HTTP_SUCCESS; - } - else if (hcErr == HTTP_S_FALSE) - { - dwNextToken = dwLoopIndex+1; - hcErrorCode = HTTP_SUCCESS; - } - else - { - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = hcErr; - break; - } - } - break; - case STENCIL_REPLACEMENT: - { -#ifdef ATL_DEBUG_STENCILS - if (pToken->dwFnOffset == STENCIL_INVALIDOFFSET) - { - // This should have been caught at parse time - ATLASSERT(FALSE); - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_INVALIDFUNCOFFSET); - break; - } -#endif // ATL_DEBUG_STENCILS - - hcErrorCode = pReplacer->RenderReplacement(pToken->dwFnOffset, - pToken->dwObjOffset, pToken->dwMap, (void *)pToken->dwData); - - if (IsAsyncContinueStatus(hcErrorCode)) - dwNextToken = dwIndex; // call the tag again after we get back - else - { - dwNextToken = dwIndex + 1; - - // when returned from a handler, these indicate that the handler is done - // and that we should move on to the next handler when called back - if (hcErrorCode == HTTP_SUCCESS_ASYNC_DONE) - hcErrorCode = HTTP_SUCCESS_ASYNC; - else if (hcErrorCode == HTTP_SUCCESS_ASYNC_NOFLUSH_DONE) - hcErrorCode = HTTP_SUCCESS_ASYNC_NOFLUSH; - } - } - break; - case STENCIL_ITERATOREND: - { - dwNextToken = pToken->dwLoopIndex; - hcErrorCode = HTTP_SUCCESS; - ATLASSERT(GetToken(dwNextToken)->type == STENCIL_ITERATORSTART); - } - break; - case STENCIL_CONDITIONALSTART: - { -#ifdef ATL_DEBUG_STENCILS - if (pToken->type == STENCIL_CONDITIONALSTART && pToken->dwFnOffset == STENCIL_INVALIDOFFSET) - { - // This should have been caught at parse time - ATLASSERT(FALSE); - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_INVALIDFUNCOFFSET); - break; - } - - if (pToken->dwLoopIndex == STENCIL_INVALIDINDEX) - { - // This should have been caught at parse time - ATLASSERT(FALSE); - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_MISMATCHIF); - break; - } -#endif // ATL_DEBUG_STENCILS - - DWORD dwLoopIndex = pToken->dwLoopIndex; // points to the end of the loop - - HTTP_CODE hcErr; - // Call the replacement method. - // If it returns HTTP_SUCCESS, we render everything up to - // the end of the conditional. - // if it returns HTTP_S_FALSE, the condition is not met and we - // render the else part if it exists or jump past the endif otherwise - hcErr = pReplacer->RenderReplacement(pToken->dwFnOffset, - pToken->dwObjOffset, pToken->dwMap, (void *)pToken->dwData); - - if (hcErr == HTTP_SUCCESS) - { - dwNextToken = dwIndex+1; - hcErrorCode = HTTP_SUCCESS; - } - else if (hcErr == HTTP_S_FALSE) - { - dwNextToken = dwLoopIndex+1; - hcErrorCode = HTTP_SUCCESS; - } - else - { - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = hcErr; - break; - } - } - break; - case STENCIL_CONDITIONALELSE: - { -#ifdef ATL_DEBUG_STENCILS - if (pToken->dwLoopIndex == STENCIL_INVALIDINDEX) - { - // This should have been caught at parse time - ATLASSERT(FALSE); - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_MISMATCHIF); - break; - } -#endif // ATL_DEBUG_STENCILS - - dwNextToken = pToken->dwLoopIndex+1; - hcErrorCode = HTTP_SUCCESS; - } - break; - case STENCIL_CONDITIONALEND: - { - dwNextToken = dwIndex+1; - hcErrorCode = HTTP_SUCCESS; - } - break; - case STENCIL_LOCALE: - { - if (pState) - { - pState->locale = (LCID) pToken->dwData; - } - SetThreadLocale((LCID) pToken->dwData); - dwNextToken = dwIndex + 1; - } - break; - default: - { - ATLASSERT(FALSE); - dwNextToken = STENCIL_INVALIDINDEX; - hcErrorCode = AtlsHttpError(500, ISE_SUBERR_STENCIL_UNEXPECTEDTYPE); - break; - } - } - - ATLASSERT(dwNextToken != dwIndex || IsAsyncContinueStatus(hcErrorCode)); - - if (phcErrorCode) - *phcErrorCode = hcErrorCode; - - return dwNextToken; - } - - DWORD GetTokenCount() const throw() - { - return (DWORD) m_arrTokens.GetCount(); - } - - const StencilToken* GetToken(DWORD dwIndex) const throw() - { - return &(m_arrTokens[dwIndex]); - } - - StencilToken* GetToken(DWORD dwIndex) throw() - { - return &(m_arrTokens[dwIndex]); - } - - LPCSTR GetBufferStart() const throw() - { - return m_pBufferStart; - } - - LPCSTR GetBufferEnd() const throw() - { - return m_pBufferEnd; - } - - WORD GetCodePage() const throw() - { - return m_nCodePage; - } - - // IMemoryCacheClient - STDMETHOD(QueryInterface)(REFIID riid, void **ppv) - { - if (!ppv) - return E_POINTER; - - if (InlineIsEqualGUID(riid, __uuidof(IUnknown)) || - InlineIsEqualGUID(riid, __uuidof(IMemoryCacheClient))) - { - *ppv = static_cast(this); - return S_OK; - } - - *ppv = NULL; - return E_NOINTERFACE; - } - - STDMETHOD_(ULONG, AddRef)() - { - return 1; - } - - STDMETHOD_(ULONG, Release)() - { - return 1; - } - - STDMETHOD(Free)(const void *pData) - { - if (!pData) - return E_POINTER; - - ATLASSERT(*((void **) pData) == static_cast(this)); - - delete this; - - return S_OK; - } -}; // class CStencil - -struct StencilIncludeInfo -{ -public: - CHAR m_szQueryString[ATL_URL_MAX_URL_LENGTH+1]; - CHAR m_szFileName[MAX_PATH]; -}; - - -class CIncludeServerContext : - public CComObjectRootEx, - public CWrappedServerContext -{ -public: - BEGIN_COM_MAP(CIncludeServerContext) - COM_INTERFACE_ENTRY(IHttpServerContext) - END_COM_MAP() - - IWriteStream * m_pStream; - const StencilIncludeInfo * m_pIncludeInfo; - - CIncludeServerContext() throw() - { - m_pStream = NULL; - m_pIncludeInfo = NULL; - } - - void Initialize( - IWriteStream *pStream, - IHttpServerContext* pServerContext, - const StencilIncludeInfo * pIncludeInfo) throw() - { - ATLASSERT(pStream != NULL); - ATLASSERT(pServerContext != NULL); - ATLASSERT(pIncludeInfo != NULL); - m_pStream = pStream; - m_spParent = pServerContext; - m_pIncludeInfo = pIncludeInfo; - } - - void Initialize(CIncludeServerContext *pOtherContext) - { - ATLENSURE(pOtherContext != NULL); - m_pStream = pOtherContext->m_pStream; - m_spParent = pOtherContext->m_spParent; - m_pIncludeInfo = pOtherContext->m_pIncludeInfo; - } - - LPCSTR GetRequestMethod() - { - return "GET"; - } - - LPCSTR GetQueryString() - { - ATLASSUME(m_pIncludeInfo != NULL); - return m_pIncludeInfo->m_szQueryString; - } - - LPCSTR GetPathTranslated() - { - ATLASSUME(m_pIncludeInfo != NULL); - return m_pIncludeInfo->m_szFileName; - } - - LPCSTR GetScriptPathTranslated() - { - ATLASSUME(m_pIncludeInfo != NULL); - return m_pIncludeInfo->m_szFileName; - } - - DWORD GetTotalBytes() - { - return 0; - } - - DWORD GetAvailableBytes() - { - return 0; - } - - BYTE *GetAvailableData() - { - return NULL; - } - - LPCSTR GetContentType() - { - return 0; - } - - BOOL WriteClient(void *pvBuffer, DWORD *pdwBytes) - { - ATLASSUME(m_pStream != NULL); - ATLENSURE(pvBuffer != NULL); - ATLENSURE(pdwBytes != NULL); - - HRESULT hr = S_OK; - _ATLTRY - { - hr = m_pStream->WriteStream((LPCSTR) pvBuffer, *pdwBytes, pdwBytes); - } - _ATLCATCHALL() - { - hr = E_FAIL; - } - - return SUCCEEDED(hr); - } - - BOOL ReadClient(void * /*pvBuffer*/, DWORD * /*pdwSize*/) - { - return FALSE; - } - - BOOL AsyncReadClient(void * /*pvBuffer*/, DWORD * /*pdwSize*/) - { - return FALSE; - } - - BOOL SendRedirectResponse(LPCSTR /*pszRedirectURL*/) - { - return FALSE; - } - - BOOL SendResponseHeader( - LPCSTR /*pszHeader*/, - LPCSTR /*pszStatusCode*/, - BOOL /*fKeepConn*/) - { - return TRUE; - } - - BOOL DoneWithSession(DWORD /*dwHttpStatusCode*/) - { - return TRUE; - } - - BOOL RequestIOCompletion(PFN_HSE_IO_COMPLETION /*pfn*/, DWORD * /*pdwContext*/) - { - return FALSE; - } -}; // class CIncludeServerContext - -class CIDServerContext : - public CComObjectRootEx, - public CWrappedServerContext -{ -public: - CHttpResponse *m_pResponse; - CHttpRequest *m_pRequest; - - BEGIN_COM_MAP(CIDServerContext) - COM_INTERFACE_ENTRY(IHttpServerContext) - END_COM_MAP() - - CIDServerContext() throw() - : m_pResponse(NULL), m_pRequest(NULL) - { - } - - BOOL Initialize( - CHttpResponse *pResponse, - CHttpRequest *pRequest) throw() - { - ATLASSERT(pResponse != NULL); - ATLASSERT(pRequest != NULL); - m_pResponse = pResponse; - m_pRequest = pRequest; - if(!m_pRequest) - { - return FALSE; - } - - HRESULT hr = m_pRequest->GetServerContext(&m_spParent); - return (SUCCEEDED(hr)); - } - - LPCSTR GetRequestMethod() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetMethodString(); - } - - LPCSTR GetQueryString() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetQueryString(); - } - - LPCSTR GetPathInfo() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetPathInfo(); - } - - LPCSTR GetPathTranslated() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetPathTranslated(); - } - - DWORD GetTotalBytes() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetTotalBytes(); - } - - DWORD GetAvailableBytes() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetAvailableBytes(); - } - - BYTE *GetAvailableData() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetAvailableData(); - } - - LPCSTR GetContentType() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetContentType(); - } - - LPCSTR GetScriptPathTranslated() - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->GetScriptPathTranslated(); - } - - BOOL WriteClient(void *pvBuffer, DWORD *pdwBytes) - { - ATLASSUME(m_pResponse != NULL); - return m_pResponse->WriteLen((LPCSTR)pvBuffer, *pdwBytes); - } - - BOOL ReadClient(void *pvBuffer, DWORD *pdwSize) - { - ATLASSUME(m_pRequest != NULL); - return m_pRequest->ReadData((LPSTR)pvBuffer, pdwSize); - } - - BOOL SendRedirectResponse(LPCSTR pszRedirectURL) - { - ATLASSUME(m_pResponse != NULL); - return m_pResponse->Redirect(pszRedirectURL); - } - - BOOL TransmitFile( - HANDLE hFile, - PFN_HSE_IO_COMPLETION pfn, - void *pContext, - LPCSTR szStatusCode, - DWORD dwBytesToWrite, - DWORD dwOffset, - void *pvHead, - DWORD dwHeadLen, - void *pvTail, - DWORD dwTailLen, - DWORD dwFlags) - { - ATLASSUME(m_pResponse != NULL); - ATLASSUME(m_spParent != NULL); - - m_pResponse->Flush(); - return m_spParent->TransmitFile(hFile, pfn, pContext, szStatusCode, - dwBytesToWrite, dwOffset, pvHead, dwHeadLen, pvTail, dwTailLen, dwFlags); - } - -}; // class CIDServerContext - -// -// CHtmlStencil -// CHtmlStencil is a specialization of CStencil. CHtmlStencil adds the following -// capabilities to CStencil: -// -// Support for rendering {{include }} tags -// The {{include }} tags specify another stencil to be included in-place during -// stencil rendering. The {{include }} tag takes a single parameter which is the -// URL of the stencil to include. That URL can optionally include parameters. -// An example: -// {{include mystencil.srf?param1=value1}} -// -// We also grab the handler name and the name of any subhandlers. The syntax for the -// handler specification is: -// {{handler MyDynamicHandler.dll/Default}} -// which would cause the MyDynamicHandler.dll to be loaded. Once loaded, the stencil -// processor will ask for the IReplacementHandler interface of the object named "Default". -// -// Additional handlers can be specified after the default handler. An example of an -// additional handler would be: -// {{subhandler OtherHandler MyOtherHandler.dll/Default}} -// would cause the MyOtherHandler.dll to be loaded. Once loaded, the stencil processor will -// ask for the IReplacementHandler interface of the object named "Default" and use it in -// processing the stencil anywhere it sees a stencil tag of the form -// {{OtherHandler.RenderReplacement}} - -struct CStringPair -{ - typedef CFixedStringT PathStrType; - typedef CFixedStringT HdlrNameStrType; - PathStrType strDllPath; - HdlrNameStrType strHandlerName; - - CStringPair()throw() - { - } - - CStringPair(PathStrType &strDllPath_, HdlrNameStrType &strHandlerName_) throw(...) - :strDllPath(strDllPath_), strHandlerName(strHandlerName_) - { - } - - CStringPair(CStringA &strDllPath_, CStringA &strHandlerName_) throw(...) - :strDllPath(strDllPath_), strHandlerName(strHandlerName_) - { - } -}; - -class CStringPairElementTraits : - public CElementTraitsBase< CStringPair > -{ -private: - - static ULONG HashStr( ULONG nHash, CStringElementTraits::INARGTYPE str ) - { - ATLENSURE( str != NULL ); - const CStringA::XCHAR* pch = str; - while( *pch != 0 ) - { - nHash = (nHash<<5)+nHash+(*pch); - pch++; - } - - return( nHash ); - } - -public: - static ULONG Hash( INARGTYPE pair ) throw() - { - ULONG nHash = HashStr(0, pair.strDllPath); - return HashStr(nHash, pair.strHandlerName); - } - - static bool CompareElements( INARGTYPE pair1, INARGTYPE pair2 ) throw() - { - return( (pair1.strDllPath == pair2.strDllPath) && (pair1.strHandlerName == pair2.strHandlerName) ); - } - - static int CompareElementsOrdered( INARGTYPE pair1, INARGTYPE pair2 ) throw() - { - return( pair1.strDllPath.Compare( pair2.strDllPath ) ); - } -}; - -class CHtmlStencil : public CStencil -{ -private: - - ATL_NOINLINE HTTP_CODE RenderInclude( - ITagReplacer *pReplacer, - const StencilToken *pToken, - IWriteStream *pWriteStream, - CStencilState *pState) const - { - ATLASSUME(m_spServiceProvider); - CComPtr spServerContext; - CComPtr spLookup; - if (FAILED(pReplacer->GetContext(__uuidof(IHttpServerContext), (VOID**) &spServerContext))) - { - return AtlsHttpError(500, 0); - } - if (FAILED(pReplacer->GetContext(__uuidof(IHttpRequestLookup), (VOID**) &spLookup))) - { - return AtlsHttpError(500, 0); - } - return RenderInclude(m_spServiceProvider, pWriteStream, - (StencilIncludeInfo *)pToken->dwData, spServerContext, spLookup, - pState); - } - - ATL_NOINLINE HTTP_CODE NoCachePage(ITagReplacer *pReplacer) const - { - CComPtr spContext; - HRESULT hr = pReplacer->GetContext(__uuidof(IHttpServerContext), (void **)&spContext); - if (hr == S_OK && spContext) - { - CComQIPtr spControl; - spControl = spContext; - if (spControl) - spControl->Cache(FALSE); - } - return HTTP_SUCCESS; - } - - - // CAllocIncludeAsyncContext is an unsupported implementation detail of RenderInclude - class CAllocIncludeAsyncContext : - public CAllocContextBase - { - public: - CAllocIncludeAsyncContext(CIncludeServerContext *pBase) : - m_pBase(pBase) - { - - } - HTTP_CODE Alloc(IHttpServerContext **ppNewContext) - { - ATLASSUME(m_pBase); - if (!ppNewContext) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - *ppNewContext = NULL; - CComObjectNoLock* pNewServerContext = NULL; - ATLTRY(pNewServerContext = new CComObjectNoLock); - if (pNewServerContext == NULL) - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); - pNewServerContext->Initialize(m_pBase); - pNewServerContext->AddRef(); - *ppNewContext = pNewServerContext; - return HTTP_SUCCESS; - } - - private: - CIncludeServerContext *m_pBase; - }; // CAllocIncludeAsyncContext - - - ATL_NOINLINE HTTP_CODE RenderInclude( - IServiceProvider *pServiceProvider, - IWriteStream *pWriteStream, - const StencilIncludeInfo *pIncludeInfo, - IHttpServerContext *pServerContext, - IHttpRequestLookup *pLookup, - CStencilState* pState = NULL) const throw(...) - { - CComObjectStackEx serverContext; - serverContext.Initialize(pWriteStream, pServerContext, pIncludeInfo); - CAllocIncludeAsyncContext AsyncAllocObj(&serverContext); - return _AtlRenderInclude(static_cast(&serverContext), - pIncludeInfo->m_szFileName, - pIncludeInfo->m_szQueryString, - GetCodePage(), - &AsyncAllocObj, - pServiceProvider, - pLookup, - pState); - - } - -protected: - CAtlMap, CStringPairElementTraits > m_arrExtraHandlers; - CHAR m_szBaseDir[MAX_PATH]; - CComPtr m_spServiceProvider; - CComPtr m_spExtension; - CComPtr m_spStencilCache; - CComPtr m_spDllCache; - -public: - typedef CAtlMap, CStringPairElementTraits > mapType; - typedef CStencil baseType; - - CHtmlStencil(IAtlMemMgr *pMemMgr=NULL) throw() : - CStencil(pMemMgr) - { - - } - - void Initialize(IServiceProvider *pProvider) throw(...) - { - ATLENSURE(pProvider); - if (m_spServiceProvider) - m_spServiceProvider.Release(); - - m_spServiceProvider = pProvider; - if (!m_spDllCache) - pProvider->QueryService(__uuidof(IDllCache), __uuidof(IDllCache), (void **) &m_spDllCache); - - if (!m_spExtension) - pProvider->QueryInterface(__uuidof(IIsapiExtension), (void **) &m_spExtension); - } - - BOOL GetIncludeInfo(LPCSTR szParamBegin, LPCSTR szParamEnd, StencilIncludeInfo *pInfo) const - { - ATLENSURE(szParamBegin != NULL); - ATLENSURE(szParamEnd != NULL); - ATLENSURE(pInfo != NULL); - - LPCSTR szQueryBegin = szParamBegin; - - while (*szQueryBegin && *szQueryBegin != '?' && *szQueryBegin != '}') - { - LPSTR szNext = CharNextExA(GetCodePage(), szQueryBegin, 0); - if (szNext == szQueryBegin) - { - return FALSE; - } - - szQueryBegin = szNext; - } - - CFixedStringT strPath; - - _ATLTRY - { - DWORD dwPrefixLen = 0; - if (*szParamBegin == '"') - { - szParamBegin++; - } - if (!IsFullPathA(szParamBegin)) - { - if (*szParamBegin != '\\') - { - strPath = m_szBaseDir; - } - else - { - LPCSTR szBackslash = strchr(m_szBaseDir, '\\'); - if (szBackslash) - { -#pragma warning(push) -#pragma warning(disable: 6204) - /* prefast noise VSW 492749 */ - strPath.SetString(m_szBaseDir, (int)(szBackslash-m_szBaseDir)); -#pragma warning(pop) - } - else - { - strPath = m_szBaseDir; - } - } - dwPrefixLen = strPath.GetLength(); - } - - if (*szQueryBegin=='?') - { - size_t nMinus = (*(szQueryBegin-1) == '"') ? 1 : 0; - strPath.Append(szParamBegin, (int)(szQueryBegin-szParamBegin-nMinus)); - if ((szParamEnd-szQueryBegin) > ATL_URL_MAX_PATH_LENGTH || ((szParamEnd - szQueryBegin) < 0)) - { - // query string is too long - return FALSE; - } - Checked::memcpy_s(pInfo->m_szQueryString, ATL_URL_MAX_URL_LENGTH+1, szQueryBegin + 1, szParamEnd - szQueryBegin); - pInfo->m_szQueryString[szParamEnd - szQueryBegin] = '\0'; - } - else - { - pInfo->m_szQueryString[0] = '\0'; - size_t nAdd = (*szParamEnd == '"') ? 0 : 1; - strPath.Append(szParamBegin, (int)(szParamEnd - szParamBegin + nAdd)); - } - } - _ATLCATCHALL() - { - // out of memory - return FALSE; - } - - if (strPath.GetLength() > MAX_PATH-1) - { - // path is too long - return FALSE; - } - - // strPath is <= MAX_PATH-1 - return PathCanonicalizeA(pInfo->m_szFileName, strPath); - } - - DWORD ParseInclude(LPCSTR szTokenStart, LPCSTR szTokenEnd) throw(...) - { - ATLENSURE(szTokenStart != NULL); - ATLENSURE(szTokenEnd != NULL); - - LPCSTR szStart = szTokenStart; - LPCSTR szEnd = szTokenEnd; - - FindTagArgs(szStart, szEnd, 7); - - CFixedStringT strFileNameRelative; - CFixedStringT strFileName; - - _ATLTRY - { - strFileNameRelative.SetString(szStart, (int)(szEnd-szStart + 1)); - - if (!IsFullPathA(strFileNameRelative)) - { - CFixedStringT strTemp; - if (*((LPCSTR)strFileNameRelative) != '\\') - { - strTemp = m_szBaseDir; - } - else - { - LPCSTR szBackslash = strchr(m_szBaseDir, '\\'); - if (szBackslash) - { -#pragma warning(push) -#pragma warning(disable: 6204) -#pragma warning(disable: 6535) - /* prefast noise VSW 492749 */ - /* prefast noise VSW 493256 */ - strTemp.SetString(m_szBaseDir, (int)(szBackslash-m_szBaseDir)); -#pragma warning(pop) - } - else - { - strTemp = m_szBaseDir; - } - } - - strTemp.Append(strFileNameRelative, strFileNameRelative.GetLength()); - CFixedStringT strConv = (LPCTSTR) CA2CT(strTemp); - LPTSTR szFileBuf = strFileName.GetBuffer(strConv.GetLength()+1); - if (szFileBuf == NULL) - { - AddError(IDS_STENCIL_OUTOFMEMORY, szTokenStart); - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - if (!PathCanonicalize(szFileBuf, strConv)) - { - return STENCIL_INVALIDINDEX; - } - - strFileName.ReleaseBuffer(); - } - else - { - strFileName = CA2CTEX(strFileNameRelative); - } - } - _ATLCATCHALL() - { - AddError(IDS_STENCIL_OUTOFMEMORY, szTokenStart); - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - LPCTSTR szFileName = strFileName; - - LPCTSTR szDot = NULL; - LPCTSTR szExtra = _tcschr(szFileName, '?'); - if (!szExtra) - { - szExtra = _tcschr(szFileName, '#'); - if (!szExtra) - { - szDot = _tcsrchr(szFileName, '.'); - } - } - - if (szExtra != NULL) - { - // there is some extra information - LPCTSTR szDotTmp = szFileName; - do - { - szDot = szDotTmp; - szDotTmp = _tcschr(szDotTmp+1, '.'); - } while (szDotTmp && szDotTmp < szExtra); - } - - if (!szDot || *szDot != '.') - { - AddError(IDS_STENCIL_UNEXPECTED, szTokenStart); - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - LPCTSTR szExtEnd = szDot; - - while (true) - { - szExtEnd++; - if (!*szExtEnd || *szExtEnd == '/' || *szExtEnd == '\\' || *szExtEnd == '?' || *szExtEnd == '#' || *szExtEnd == '"') - break; - } - - if (szDot && (size_t)(szExtEnd-szDot) == _tcslen(c_tAtlDLLExtension) && - !_tcsnicmp(szDot, c_tAtlDLLExtension, _tcslen(c_tAtlDLLExtension))) - { - // Do .dll stuff - DWORD dwIndex = AddToken(szStart, szEnd, STENCIL_STENCILINCLUDE); - if (dwIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_OUTOFMEMORY, szTokenStart); - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - StencilIncludeInfo *pInfo = (StencilIncludeInfo *)m_pMemMgr->Allocate(sizeof(StencilIncludeInfo)); - if (!pInfo) - { - return STENCIL_INVALIDINDEX; - } - - if (!GetIncludeInfo(szStart, szEnd, pInfo)) - { - return STENCIL_INVALIDINDEX; - } - - GetToken(dwIndex)->dwData = (DWORD_PTR) pInfo; - return dwIndex; - } - else if (szDot && (size_t)(szExtEnd-szDot) == _tcslen(c_tAtlSRFExtension) && - !_tcsnicmp(szDot, c_tAtlSRFExtension, _tcslen(c_tAtlSRFExtension))) - { - // Do .srf stuff - DWORD dwIndex = AddToken(szStart, szEnd, STENCIL_STENCILINCLUDE); - if (dwIndex == STENCIL_INVALIDINDEX) - { - AddError(IDS_STENCIL_OUTOFMEMORY, szTokenStart); - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - StencilIncludeInfo *pInfo = (StencilIncludeInfo *)m_pMemMgr->Allocate(sizeof(StencilIncludeInfo)); - if (!pInfo) - { - return STENCIL_INVALIDINDEX; - } - - if (!GetIncludeInfo(szStart, szEnd, pInfo)) - { - return STENCIL_INVALIDINDEX; - } - - GetToken(dwIndex)->dwData = (DWORD_PTR) pInfo; - return dwIndex; - } - else - { - // Assume static content - CAtlFile file; - - HRESULT hr = file.Create(szFileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING); - if (FAILED(hr) || GetFileType(file) != FILE_TYPE_DISK) - { - if (FAILED(hr)) - { - AddError(IDS_STENCIL_INCLUDE_ERROR, szTokenStart); - } - else - { - AddError(IDS_STENCIL_INCLUDE_INVALID, szTokenStart); - } - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - CAutoVectorPtr szBufferStart; - LPSTR szBufferEnd = NULL; - ULONGLONG dwLen = 0; - if (FAILED(file.GetSize(dwLen))) - { - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - if (!szBufferStart.Allocate((size_t) dwLen)) - { - AddError(IDS_STENCIL_OUTOFMEMORY, szTokenStart); - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - DWORD dwRead; - if (FAILED(file.Read(szBufferStart, (DWORD) dwLen, dwRead))) - { - return AddToken(szTokenStart, szTokenEnd, STENCIL_TEXTTAG); - } - - szBufferEnd = szBufferStart + dwRead-1; - - DWORD dwIndex = AddToken(szBufferStart, szBufferEnd, STENCIL_STATICINCLUDE); - if (dwIndex != STENCIL_INVALIDINDEX) - { - GetToken(dwIndex)->bDynamicAlloc = TRUE; - szBufferStart.Detach(); - } - - return dwIndex; - } - } - - PARSE_TOKEN_RESULT ParseSubhandler(LPCSTR szTokenStart, LPCSTR szTokenEnd) throw() - { - ATLASSERT(szTokenStart != NULL); - ATLASSERT(szTokenEnd != NULL); - - LPCSTR szStart = szTokenStart; - LPCSTR szEnd = szTokenEnd; - - // move to the start of the arguments - // (the first char past 'subhandler' - FindTagArgs(szStart, szEnd, 10); - - // skip any space to bring us to the start - // of the id for the subhandler. - szStart = SkipSpace(szStart, GetCodePage()); - - // id names cannot contain spaces. Mark the - // beginning and end if the subhandler id - LPCSTR szIdStart = szStart; - while (!isspace(static_cast(*szStart)) && *szStart != '}') - { - if (!isalnum(static_cast(*szStart))) - { - // id names can only contain alphanumeric characters - return INVALID_TOKEN; - } - - LPSTR szNext = CharNextExA(GetCodePage(), szStart, 0); - if (szNext == szStart) - { - // embedded null - AddError(IDS_STENCIL_EMBEDDED_NULL, NULL); - return INVALID_TOKEN; - } - szStart = szNext; - } - LPCSTR szIdEnd = szStart; - - // skip space to bring us to the beginning of the - // the dllpath/handlername - szStart = SkipSpace(szStart, GetCodePage()); - - // everything up to the end if the tag is - // part of the dllpath/handlername - LPCSTR szHandlerStart = szStart; - while (*szStart != '}') - { - LPCSTR szNext = CharNextExA(GetCodePage(), szStart, 0); - if (szNext == szStart) - { - // embedded null - AddError(IDS_STENCIL_EMBEDDED_NULL, NULL); - return INVALID_TOKEN; - } - szStart = szNext; - } - LPCSTR szHandlerEnd = szStart; - - _ATLTRY - { - CStringPair::HdlrNameStrType strName(szIdStart, (int)(szIdEnd-szIdStart)); - CStringPair::PathStrType strPath(szHandlerStart, (int)(szHandlerEnd-szHandlerStart)); - - CStringPair::PathStrType strDllPath; - CStringPair::HdlrNameStrType strHandlerName; - DWORD dwDllPathLen = MAX_PATH; - DWORD dwHandlerNameLen = ATL_MAX_HANDLER_NAME_LEN+1; - - LPSTR szDllPath = strDllPath.GetBuffer(dwDllPathLen); - LPSTR szHandlerName = strHandlerName.GetBuffer(dwHandlerNameLen); - - if (!_AtlCrackHandler(strPath, szDllPath, &dwDllPathLen, szHandlerName, &dwHandlerNameLen)) - { - strDllPath.ReleaseBuffer(); - strHandlerName.ReleaseBuffer(); - AddError(IDS_STENCIL_INVALID_SUBHANDLER, szTokenStart); - return INVALID_TOKEN; - } - - strDllPath.ReleaseBuffer(dwDllPathLen); - strHandlerName.ReleaseBuffer(dwHandlerNameLen); - - m_arrExtraHandlers.SetAt(strName, CStringPair(strDllPath, strHandlerName)); - } - _ATLCATCHALL() - { - AddError(IDS_STENCIL_OUTOFMEMORY, NULL); - return INVALID_TOKEN; - } - return RESERVED_TOKEN; - } - - virtual PARSE_TOKEN_RESULT ParseToken(LPCSTR szTokenStart, LPCSTR szTokenEnd, DWORD *pBlockStack, DWORD *pdwTop) - { - ATLASSERT(szTokenStart != NULL); - ATLASSERT(szTokenEnd != NULL); - - LPCSTR pStart = szTokenStart; - pStart += 2; //skip curlies - pStart = SkipSpace(pStart, GetCodePage()); - DWORD dwLen = (DWORD)(szTokenEnd - szTokenStart); - - DWORD dwIndex = STENCIL_INVALIDINDEX; - - if (CheckTag("include", sizeof("include")-1, pStart, dwLen)) - { - dwIndex = ParseInclude(szTokenStart, szTokenEnd); - } - else if (dwLen > 3 && !memcmp("!--", pStart, 3)) - { - return RESERVED_TOKEN; - } - else if (dwLen > 2 && !memcmp("//", pStart, 2)) - { - return RESERVED_TOKEN; - } - else if (CheckTag("subhandler", sizeof("subhandler")-1, pStart, dwLen)) - { - return ParseSubhandler(szTokenStart, szTokenEnd); - } - else - { - return CStencil::ParseToken(szTokenStart, szTokenEnd, pBlockStack, pdwTop); - } - if (dwIndex == STENCIL_INVALIDINDEX) - { - return INVALID_TOKEN; - } - return RESERVED_TOKEN; - } - - mapType* GetExtraHandlers() throw() - { - return &m_arrExtraHandlers; - } - - BOOL SetBaseDirFromFile(LPCSTR szBaseDir) - { - if (!SafeStringCopy(m_szBaseDir, szBaseDir)) - { - return FALSE; - } - - LPSTR szSlash = strrchr(m_szBaseDir, '\\'); - if (szSlash) - { - szSlash++; - *szSlash = '\0'; - } - else - { - *m_szBaseDir = '\0'; - } - - return TRUE; - } - - LPCSTR GetBaseDir() - { - return m_szBaseDir; - } - - DWORD RenderToken( - DWORD dwIndex, - ITagReplacer* pReplacer, - IWriteStream *pWriteStream, - HTTP_CODE *phcErrorCode, - CStencilState* pState = NULL) const throw(...) - { - DWORD dwNextToken = STENCIL_INVALIDINDEX; - HTTP_CODE hcErrorCode = HTTP_SUCCESS; - const StencilToken* pToken = GetToken(dwIndex); - if (pToken) - { - if (pToken->type == STENCIL_STENCILINCLUDE) - { - hcErrorCode = RenderInclude(pReplacer, pToken, pWriteStream, pState); - if (hcErrorCode == HTTP_SUCCESS || IsAsyncDoneStatus(hcErrorCode)) - { - dwNextToken = dwIndex+1; - } - else if (IsAsyncContinueStatus(hcErrorCode)) - { - dwNextToken = dwIndex; - } - } - else if (pToken->type == STENCIL_STATICINCLUDE) - { - pWriteStream->WriteStream(pToken->pStart, - (int)((pToken->pEnd-pToken->pStart)+1), NULL); - dwNextToken = dwIndex+1; - } - else - { - dwNextToken = baseType::RenderToken(dwIndex, pReplacer, - pWriteStream, &hcErrorCode, pState); - } - } - - if (hcErrorCode == HTTP_SUCCESS_NO_CACHE) - { - hcErrorCode = NoCachePage(pReplacer); - } - - if (phcErrorCode) - { - *phcErrorCode = hcErrorCode; - } - return dwNextToken; - } -}; // class CHtmlStencil - - -__declspec(selectany) CCRTHeap CStencil::m_crtHeap; - -// -// CHtmlTagReplacer -// This class manages CStencil based objects for HTTP requests. This class will retrieve -// CStencil based objects from the stencil cache, store CStencil based objects in the -// stencil cache and allocate and initialize CStencil based objects on a per reqeust -// basis. Typically, one instance of this class is created for each HTTP request. The -// instance is destroyed once the request has been completed. -template -class CHtmlTagReplacer : - public ITagReplacerImpl -{ -protected: - typedef StencilType StencilType; - - CSimpleArray m_hInstHandlers; - typedef CAtlMap > mapType; - mapType m_Handlers; - StencilType *m_pLoadedStencil; - WORD m_nCodePage; - CComPtr m_spStencilCache; - - AtlServerRequest m_RequestInfo; - -public: - // public members - - CHtmlTagReplacer() throw() : - m_pLoadedStencil(NULL) - { - memset(&m_RequestInfo, 0x00, sizeof(m_RequestInfo)); - m_nCodePage = CP_THREAD_ACP; - } - - ~CHtmlTagReplacer() throw() - { - // you should call FreeHandlers before - // the object is destructed - ATLASSUME(m_hInstHandlers.GetSize() == 0); - } - - HTTP_CODE Initialize(AtlServerRequest *pRequestInfo, IHttpServerContext *pSafeSrvCtx=NULL) throw(...) - { - ATLASSERT(pRequestInfo != NULL); - - CComPtr spServiceProvider; - THandler *pT = static_cast(this); - HRESULT hr = pT->GetContext(__uuidof(IServiceProvider), (void **)&spServiceProvider); - if (FAILED(hr)) - return HTTP_FAIL; - - spServiceProvider->QueryService(__uuidof(IStencilCache), __uuidof(IStencilCache), (void **) &m_spStencilCache); - if (!m_spStencilCache) - { - ATLASSERT(FALSE); - return HTTP_FAIL; - } - - // copy the AtlServerRequest into the safe version - Checked::memcpy_s(&m_RequestInfo, sizeof(m_RequestInfo), pRequestInfo, sizeof(m_RequestInfo)); - - // override appropriate fields - m_RequestInfo.cbSize = sizeof(m_RequestInfo); - m_RequestInfo.pServerContext = pSafeSrvCtx; - - return HTTP_SUCCESS; - } - - HTTP_CODE LoadStencilResource( - HINSTANCE hInstResource, - LPCSTR szResourceID, - LPCSTR szResourceType = NULL, LPCSTR szStencilName=NULL) throw(...) - { - if (!szResourceType) - szResourceType = (LPCSTR) (RT_HTML); - // look up stencil in cache - HTTP_CODE hcErr = HTTP_SUCCESS; - - // check the cache first - StencilType *pStencil = FindCacheStencil(szStencilName ? szStencilName : szResourceID); - if (!pStencil) - { - // create a new stencil - pStencil = GetNewCacheStencil(); - if (!pStencil) - { - return AtlsHttpError(500,ISE_SUBERR_OUTOFMEM); - } - - THandler *pT = static_cast(this); - LPCSTR szFileName = pT->m_spServerContext->GetScriptPathTranslated(); - - if (!szFileName) - return HTTP_FAIL; - - if (!pStencil->SetBaseDirFromFile(szFileName)) - { - return HTTP_FAIL; - } - - pStencil->SetErrorResource(GetResourceInstance()); - - // load the stencil and parse its replacements - if (HTTP_SUCCESS == pStencil->LoadFromResource(hInstResource, - szResourceID, szResourceType)) - { - _ATLTRY - { - if (!pStencil->ParseReplacements(this)) - { - return AtlsHttpError(500, ISE_SUBERR_BADSRF); - } - - hcErr = FinishLoadStencil(pStencil, NULL); - if (!hcErr) - { -#ifdef ATL_DEBUG_STENCILS - pStencil->FinishParseReplacements(); -#else - if (!pStencil->FinishParseReplacements()) - { - return AtlsHttpError(500, ISE_SUBERR_BADSRF); - } -#endif // ATL_DEBUG_STENCILS - } - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - } - else - { - hcErr = HTTP_FAIL; - } - - // if everything went OK, put the stencil in the stencil cache. - if (!hcErr) - { - hcErr = CacheStencil(szStencilName ? szStencilName : szResourceID, pStencil); - } - - if (pStencil && hcErr) // something went wrong, free the stencil data - { - FreeCacheStencil(pStencil); - } - } - else - { - hcErr = FinishLoadStencil(pStencil); - } - - return hcErr; - } - - HTTP_CODE LoadStencilResource(HINSTANCE hInstResource, UINT nID, LPCSTR szResourceType = NULL) throw(...) - { - if (!szResourceType) - szResourceType = (LPCSTR) RT_HTML; - char szName[80]; - int nResult = sprintf_s(szName, sizeof(szName), "%p/%u", hInstResource, nID); - if ((nResult < 0) || (nResult == sizeof(szName))) - { - return HTTP_FAIL; - } - return LoadStencilResource(hInstResource, MAKEINTRESOURCEA(nID), szResourceType, szName); - } - - HTTP_CODE LoadStencil(LPCSTR szFileName, IHttpRequestLookup * pLookup = NULL) throw(...) - { - if (!szFileName) - { - return HTTP_FAIL; - } - - HTTP_CODE hcErr = HTTP_FAIL; - // try to find the stencil in the cache - StencilType *pStencil = FindCacheStencil(szFileName); - - if (!pStencil) - { - // not in cache. Create a new one - pStencil = GetNewCacheStencil(); - if (!pStencil) - { - return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM); // out of memory! - } - - if (!pStencil->SetBaseDirFromFile(szFileName)) - { - return HTTP_FAIL; - } - - pStencil->SetErrorResource(GetResourceInstance()); - - // finish loading - hcErr = pStencil->LoadFromFile(szFileName); - if (!hcErr) - { - _ATLTRY - { - if (!pStencil->ParseReplacements(static_cast(this))) - { - return AtlsHttpError(500, ISE_SUBERR_BADSRF); - } - - hcErr = FinishLoadStencil(pStencil, pLookup); - if (!hcErr) - { -#ifdef ATL_DEBUG_STENCILS - pStencil->FinishParseReplacements(); -#else - if (!pStencil->FinishParseReplacements()) - { - return AtlsHttpError(500, ISE_SUBERR_BADSRF); - } -#endif // ATL_DEBUG_STENCILS - } - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - } - - // if everything is OK, cache the stencil - if (!hcErr) - { - hcErr = CacheStencil(szFileName, pStencil); - } - - if (pStencil && hcErr) // something went wrong, free stencil data - FreeCacheStencil(pStencil); - } - else - { - hcErr = FinishLoadStencil(pStencil, pLookup); - } - return hcErr; - } - - HTTP_CODE RenderStencil(IWriteStream* pStream, CStencilState* pState = NULL) throw(...) - { - if (!m_pLoadedStencil) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); - - WORD nCodePage = m_pLoadedStencil->GetCodePage(); - if (nCodePage != CP_ACP) - m_nCodePage = nCodePage; - - HTTP_CODE hcErr = HTTP_FAIL; - - hcErr = m_pLoadedStencil->Render(static_cast(this), - pStream, pState); - - if (!IsAsyncStatus(hcErr) && m_pLoadedStencil->GetCacheItem()) - m_spStencilCache->ReleaseStencil(m_pLoadedStencil->GetCacheItem()); - - return hcErr; - } - - -//Implementation - - void FreeHandlers() throw(...) - { - POSITION pos = m_Handlers.GetStartPosition(); - while (pos) - { - m_Handlers.GetValueAt(pos)->UninitializeHandler(); - m_Handlers.GetNextValue(pos)->Release(); - } - m_Handlers.RemoveAll(); - - int nLen = m_hInstHandlers.GetSize(); - if (nLen != 0) - { - THandler *pT = static_cast(this); - CComPtr spDllCache; - pT->m_spServiceProvider->QueryService(__uuidof(IDllCache), __uuidof(IDllCache), - (void **)&spDllCache); - for (int i=0; iFree(m_hInstHandlers[i]); - } - m_hInstHandlers.RemoveAll(); - } - } - - StencilType* GetNewCacheStencil() throw(...) - { - StencilType *pStencil = NULL; - THandler *pT = static_cast(this); - IAtlMemMgr *pMemMgr; - if (FAILED(pT->m_spServiceProvider->QueryService(__uuidof(IAtlMemMgr), __uuidof(IAtlMemMgr), (void **)&pMemMgr))) - pMemMgr = NULL; - - ATLTRY(pStencil = new StencilType(pMemMgr)); - if (pStencil != NULL) - { - pStencil->Initialize(pT->m_spServiceProvider); - } - return pStencil; - } - - HTTP_CODE CacheStencil( - LPCSTR szName, - StencilType* pStencilData) throw() - { - THandler *pT = static_cast(this); - HRESULT hr = E_FAIL; - - HCACHEITEM hCacheItem = NULL; - - hr = m_spStencilCache->CacheStencil(szName, - pStencilData, - sizeof(StencilType*), - &hCacheItem, - pT->m_hInstHandler, - static_cast(pStencilData)); - - if (hr == S_OK && hCacheItem) - { - _ATLTRY - { - pStencilData->SetCacheItem(hCacheItem); - } - _ATLCATCHALL() - { - hr = E_FAIL; - } - } - - return (hr == S_OK) ? HTTP_SUCCESS : HTTP_FAIL; - } - - StencilType *FindCacheStencil(LPCSTR szName) throw() - { - if (!szName || !m_spStencilCache) - return NULL; - - StencilType *pStencilData = NULL; - - HCACHEITEM hStencil; - - if (m_spStencilCache->LookupStencil(szName, &hStencil) != S_OK) - return NULL; - - m_spStencilCache->GetStencil(hStencil, reinterpret_cast(&pStencilData)); - - return pStencilData; - } - - void FreeCacheStencil(StencilType* pStencilData) - { - ATLASSERT( pStencilData != NULL ); - - if(!pStencilData) - { - return; - } - - IMemoryCacheClient *pMemCacheClient = static_cast(pStencilData); - - if(!pMemCacheClient) - { - return; - } - - _ATLTRY - { - pMemCacheClient->Free(pStencilData); - } - _ATLCATCHALL() - { - } - } - - HTTP_CODE GetHandlerOffset(LPCSTR szHandlerName, DWORD* pdwOffset) - { - if (!pdwOffset) - return HTTP_FAIL; - - mapType::CPair *p = m_Handlers.Lookup(szHandlerName); - if (p) - { - DWORD dwIndex = 0; - POSITION pos = m_Handlers.GetStartPosition(); - while (pos) - { - const mapType::CPair *p1 = m_Handlers.GetNext(pos); - if (p1 == p) - { - *pdwOffset = dwIndex; - return HTTP_SUCCESS; - } - dwIndex++; - } - ATLASSERT(FALSE); - } - *pdwOffset = 0; - return HTTP_FAIL; - } - - HTTP_CODE GetReplacementObject(DWORD dwObjOffset, ITagReplacer **ppReplacer) - { - HRESULT hr = E_FAIL; - - POSITION pos = m_Handlers.GetStartPosition(); - for (DWORD dwIndex=0; dwIndex < dwObjOffset; dwIndex++) - m_Handlers.GetNext(pos); - - ATLASSERT(pos != NULL); - - IRequestHandler *pHandler = NULL; - pHandler = m_Handlers.GetValueAt(pos); - - ATLENSURE(pHandler != NULL); - - hr = pHandler->QueryInterface(__uuidof(ITagReplacer), (void**)ppReplacer); - - if (hr != S_OK) - return HTTP_FAIL; - - return HTTP_SUCCESS; - } - - // This is where we would actually load any extra request - // handlers the HTML stencil might have parsed for us. - HTTP_CODE FinishLoadStencil(StencilType *pStencil, IHttpRequestLookup * pLookup = NULL) throw(...) - { - THandler *pT = static_cast(this); - ATLASSERT(pStencil); - if (!pStencil) - return AtlsHttpError(500, ISE_SUBERR_UNEXPECTED); // unexpected condition - m_pLoadedStencil = pStencil; - //load extra handlers if there are any - StencilType::mapType *pExtraHandlersMap = - pStencil->GetExtraHandlers(); - - if (pExtraHandlersMap) - { - POSITION pos = pExtraHandlersMap->GetStartPosition(); - CStringA name; - CStringPair path; - IRequestHandler *pHandler; - HINSTANCE hInstHandler; - while(pos) - { - pExtraHandlersMap->GetNextAssoc(pos, name, path); - pHandler = NULL; - hInstHandler = NULL; - HTTP_CODE hcErr = pT->m_spExtension->LoadRequestHandler(path.strDllPath, path.strHandlerName, - pT->m_spServerContext, - &hInstHandler, - &pHandler); - if (!hcErr) - { - _ATLTRY - { - //map the name to the pointer to request handler - m_Handlers.SetAt(name, pHandler); - //store HINSTANCE of handler - m_hInstHandlers.Add(hInstHandler); - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - - if (pLookup) - { - hcErr = pHandler->InitializeChild(&m_RequestInfo, pT->m_spServiceProvider, pLookup); - if (hcErr != HTTP_SUCCESS) - return hcErr; - } - - } - else - return hcErr; - } - } - return HTTP_SUCCESS; - } -}; // class CHtmlTagReplacer - - -// CRequestHandlerT -// This is the base class for all user request handlers. This class implements -// the IReplacementHandler interface whose methods will be called to render HTML -// into a stream. The stream will be returned as the HTTP response upon completion -// of the HTTP request. -template < class THandler, - class ThreadModel=CComSingleThreadModel, - class TagReplacerType=CHtmlTagReplacer - > -class CRequestHandlerT : - public TagReplacerType, - public CComObjectRootEx, - public IRequestHandlerImpl -{ -protected: - CStencilState m_state; - CComObjectStackEx m_SafeSrvCtx; - typedef CRequestHandlerT _requestHandler; - -public: - BEGIN_COM_MAP(_requestHandler) - COM_INTERFACE_ENTRY(IRequestHandler) - COM_INTERFACE_ENTRY(ITagReplacer) - END_COM_MAP() - - // public CRequestHandlerT members - CHttpResponse m_HttpResponse; - CHttpRequest m_HttpRequest; - ATLSRV_REQUESTTYPE m_dwRequestType; - AtlServerRequest* m_pRequestInfo; - - CRequestHandlerT() throw() - { - m_hInstHandler = NULL; - m_dwAsyncFlags = 0; - m_pRequestInfo = NULL; - } - - ~CRequestHandlerT() throw() - { - _ATLTRY - { - FreeHandlers(); // free handlers held by CTagReplacer - } - _ATLCATCHALL() - { - } - } - - void ClearResponse() throw() - { - m_HttpResponse.ClearResponse(); - } - // Where user initialization should take place - HTTP_CODE ValidateAndExchange() - { - return HTTP_SUCCESS; // continue processing request - } - - // Where user Uninitialization should take place - HTTP_CODE Uninitialize(HTTP_CODE hcError) - { - return hcError; - } - - HTTP_CODE InitializeInternal(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider) - { - // Initialize our internal references to required services - m_pRequestInfo = pRequestInfo; - m_state.pParentInfo = pRequestInfo; - m_hInstHandler = pRequestInfo->hInstDll; - m_spServerContext = pRequestInfo->pServerContext; - m_spServiceProvider = pProvider; - return HTTP_SUCCESS; - } - - HTTP_CODE InitializeHandler( - AtlServerRequest *pRequestInfo, - IServiceProvider *pProvider) - { - HTTP_CODE hcErr = HTTP_FAIL; - ATLASSERT(pRequestInfo); - ATLASSERT(pProvider); - - THandler* pT = static_cast(this); - hcErr = pT->InitializeInternal(pRequestInfo, pProvider); - if (!hcErr) - { - m_HttpResponse.Initialize(m_spServerContext); - hcErr = pT->CheckValidRequest(); - if (!hcErr) - { - hcErr = HTTP_FAIL; - if (m_HttpRequest.Initialize(m_spServerContext, - pT->MaxFormSize(), - pT->FormFlags())) - { - if (m_SafeSrvCtx.Initialize(&m_HttpResponse, &m_HttpRequest)) - { - hcErr = TagReplacerType::Initialize(pRequestInfo, &m_SafeSrvCtx); - if (!hcErr) - { - hcErr = pT->ValidateAndExchange(); - } - } - } - } - } - return hcErr; - } - - HTTP_CODE InitializeChild( - AtlServerRequest *pRequestInfo, - IServiceProvider *pProvider, - IHttpRequestLookup *pRequestLookup) - { - ATLASSERT(pRequestInfo); - ATLASSERT(pProvider); - - THandler *pT = static_cast(this); - HTTP_CODE hcErr = pT->InitializeInternal(pRequestInfo, pProvider); - if (hcErr) - return hcErr; - - if (pRequestLookup) - { - // initialize with the pRequestLookup - if(!m_HttpResponse.Initialize(pRequestLookup)) - { - return HTTP_FAIL; - } - - // Initialize with the IHttpServerContext if it exists - // the only time this is different than the previous call to - // initialize is if the user passes a different IHttpServerContext - // in pRequestInfo than the one extracted from pRequestLookup. - if (m_spServerContext) - { - if(!m_HttpResponse.Initialize(m_spServerContext)) - { - return HTTP_FAIL; - } - } - hcErr = pT->CheckValidRequest(); - if (hcErr) - { - return hcErr; - } - - // initialize with the pRequestLookup to chain query parameters - m_HttpRequest.Initialize(pRequestLookup); - - // initialize with the m_spServerContext to get additional query params - // if they exist. - if (m_spServerContext) - { - m_HttpRequest.Initialize(m_spServerContext); - } - } - - m_HttpResponse.SetBufferOutput(false); // child cannot buffer - - // initialize the safe server context - if (!m_SafeSrvCtx.Initialize(&m_HttpResponse, &m_HttpRequest)) - { - return HTTP_FAIL; - } - - hcErr = TagReplacerType::Initialize(pRequestInfo, &m_SafeSrvCtx); - if (hcErr) - { - return hcErr; - } - - return pT->ValidateAndExchange(); - } - - // HandleRequest is called to perform default processing of HTTP requests. Users - // can override this function in their derived classes if they need to perform - // specific initialization prior to processing this request or want to change the - // way the request is processed. - HTTP_CODE HandleRequest( - AtlServerRequest *pRequestInfo, - IServiceProvider* /*pServiceProvider*/) - { - ATLENSURE(pRequestInfo); - - THandler *pT = static_cast(this); - HTTP_CODE hcErr = HTTP_SUCCESS; - - if (pRequestInfo->dwRequestState == ATLSRV_STATE_BEGIN) - { - m_dwRequestType = pRequestInfo->dwRequestType; - - if (pRequestInfo->dwRequestType==ATLSRV_REQUEST_STENCIL) - { - LPCSTR szFileName = pRequestInfo->pServerContext->GetScriptPathTranslated(); - hcErr = HTTP_FAIL; - if (szFileName) - hcErr = pT->LoadStencil(szFileName, static_cast(&m_HttpRequest)); - } - } - else if (pRequestInfo->dwRequestState == ATLSRV_STATE_CONTINUE) - m_HttpResponse.ClearContent(); - -#ifdef ATL_DEBUG_STENCILS - if (m_pLoadedStencil && !m_pLoadedStencil->ParseSuccessful()) - { - // An error or series of errors occurred in parsing the stencil - _ATLTRY - { - m_pLoadedStencil->RenderErrors(static_cast(&m_HttpResponse)); - } - _ATLCATCHALL() - { - return HTTP_FAIL; - } - } -#endif - - if (hcErr == HTTP_SUCCESS && m_pLoadedStencil) - { - // if anything other than HTTP_SUCCESS is returned during - // the rendering of replacement tags, we return that value - // here. - hcErr = pT->RenderStencil(static_cast(&m_HttpResponse), &m_state); - - if (hcErr == HTTP_SUCCESS && !m_HttpResponse.Flush(TRUE)) - hcErr = HTTP_FAIL; - } - - if (IsAsyncFlushStatus(hcErr)) - { - pRequestInfo->pszBuffer = LPCSTR(m_HttpResponse.m_strContent); - pRequestInfo->dwBufferLen = m_HttpResponse.m_strContent.GetLength(); - } - - if (pRequestInfo->dwRequestState == ATLSRV_STATE_BEGIN || IsAsyncDoneStatus(hcErr)) - return pT->Uninitialize(hcErr); - - else if (!IsAsyncStatus(hcErr)) - m_HttpResponse.ClearContent(); - - return hcErr; - } - - HTTP_CODE ServerTransferRequest(LPCSTR szRequest, bool bContinueAfterTransfer=false, - WORD nCodePage = 0, CStencilState *pState = NULL) throw(...) - { - return m_spExtension->TransferRequest( - m_pRequestInfo, - m_spServiceProvider, - static_cast(&m_HttpResponse), - static_cast(&m_HttpRequest), - szRequest, - nCodePage == 0 ? m_nCodePage : nCodePage, - bContinueAfterTransfer, - pState); - } - - inline DWORD MaxFormSize() - { - return DEFAULT_MAX_FORM_SIZE; - } - - inline DWORD FormFlags() - { - return ATL_FORM_FLAG_IGNORE_FILES; - } - - // Override this function to check if the request - // is valid. This function is called after m_HttpResponse - // has been initialized, so you can use it if you need - // to return an error to the client. This is also a - // good place to initialize any internal class data needed - // to handle the request. CRequestHandlerT::CheckValidRequest - // is called after CRequestHandlerT::InitializeInternal is - // called, so your override of this method will have access to - // m_pRequestInfo (this request's AtlServerRequest structure), - // m_hInstHandler (the HINSTANCE of this handler dll), - // m_spServerContext (the IHttpServerContext interface for this request), - // m_spServiceProvider (the IServiceProvider interface for this request). - // You should call CRequestHandlerT::CheckValidRequest in your override - // if you override this function. - // - // Note that m_HttpRequest has not been initialized, so - // you cannot use it. This function is intended to - // do simple checking throught IHttpServerContext to avoid - // expensive initialization of m_HttpRequest. - HTTP_CODE CheckValidRequest() - { - LPCSTR szMethod = NULL; - ATLASSUME(m_pRequestInfo); - szMethod = m_pRequestInfo->pServerContext->GetRequestMethod(); - if (strcmp(szMethod, "GET") && strcmp(szMethod, "POST") && strcmp(szMethod, "HEAD")) - return HTTP_NOT_IMPLEMENTED; - - return HTTP_SUCCESS; - } - - HRESULT GetContext(REFIID riid, void** ppv) - { - if (!ppv) - return E_POINTER; - if (InlineIsEqualGUID(riid, __uuidof(IHttpServerContext))) - { - return m_spServerContext.CopyTo((IHttpServerContext **)ppv); - } - if (InlineIsEqualGUID(riid, __uuidof(IHttpRequestLookup))) - { - *ppv = static_cast(&m_HttpRequest); - m_HttpRequest.AddRef(); - return S_OK; - } - if (InlineIsEqualGUID(riid, __uuidof(IServiceProvider))) - { - *ppv = m_spServiceProvider; - m_spServiceProvider.p->AddRef(); - return S_OK; - } - return E_NOINTERFACE; - } - - HINSTANCE GetResourceInstance() - { - if (m_pRequestInfo != NULL) - { - return m_pRequestInfo->hInstDll; - } - - return NULL; - } - - template - HRESULT GetContext(Interface** ppInterface) throw(...) - { - return GetContext(__uuidof(Interface), reinterpret_cast(ppInterface)); - } -}; // class CRequestHandlerT - -} // namespace ATL -#pragma pack(pop) - -#pragma warning( pop ) - -#endif // __ATLSTENCIL_H__ diff --git a/include/atl/l.chs/atlsrv.rc b/include/atl/l.chs/atlsrv.rc deleted file mode 100644 index 281ab2371..000000000 --- a/include/atl/l.chs/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "´íÎóµÄÇëÇó´íÎóµÄÇëÇó" - IDS_ATLSRV_AUTH_REQUIRED - "ÒªÇóÉí·ÝÑéÖ¤ÒªÇóÉí·ÝÑéÖ¤" - IDS_ATLSRV_FORBIDDEN "½ûÖ¹½ûÖ¹" - IDS_ATLSRV_NOT_FOUND "δÕÒµ½Î´ÕÒµ½" - IDS_ATLSRV_SERVER_ERROR "·þÎñÆ÷´íÎó·þÎñÆ÷´íÎó" - IDS_ATLSRV_NOT_IMPLEMENTED - "δʵÏÖδʵÏÖ" - IDS_ATLSRV_BAD_GATEWAY "´íÎóµÄÍø¹Ø´íÎóµÄÍø¹Ø" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "·þÎñ²»¿ÉÓ÷þÎñ²»¿ÉÓÃ" - IDS_ATLSRV_SERVER_ERROR_BADSRF "Server Error

·þÎñÆ÷´íÎó

ÎÞ·¨¼ÓÔØ SRF Îļþ¡£" - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ËùÇëÇóµÄ SRF ÒѼÓÔØ£¬µ«ÎÞ·¨¶ÔÆä½øÐÐÕýÈ·´¦Àí¡£" - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ÎÞ·¨´´½¨ Windows ϵͳ¶ÔÏó¡£" - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

Îļþ¶Á²Ù×÷ʧ°Ü¡£" - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

Ö¸¶¨ÎļþÎÞ·¨´ò¿ª¡£" - IDS_ATLSRV_SERVER_ERROR_LOADLIB "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

LoadLibrary ʧ°Ü¡£" - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

¼ìË÷ÇëÇó´¦Àí³ÌÐò½Ó¿Úʧ°Ü¡£" - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

·þÎñÆ÷ÄÚ´æ²»×ã¡£" - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

·þÎñÆ÷Óöµ½ÒâÍâ´íÎó¡£" - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

·þÎñÆ÷ÔÚÊÔͼ·ÖÎöËùÇëÇóµÄÄ£°åʱÓöµ½ÒâÍâ´íÎó¡£" - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

·þÎñÆ÷δÄܼÓÔØËùÇëÇóµÄÄ£°å¡£¸ÃÄ£°åÎļþ¿ÉÄÜÒÑË𻵻ò²»Ôڸà Web ·þÎñÆ÷ÉÏ¡£" - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ÔÚÖ¸¶¨´¦Àí³ÌÐò .dll ÖÐδÕÒµ½ÔÚËùÇëÇóÄ£°åµÄ´¦Àí³ÌÐò±ê¼ÇÖÐÃüÃûµÄij¸ö´¦Àí³ÌÐò¡£" - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

¸ÃÄ£°å°üº¬Ò»¸öÎÞ·¨±»Ä£°å´¦ÀíÆ÷ÕýÈ·´¦ÀíµÄ´¦Àí³ÌÐò±ê¼Ç£¬»òÕ߸ÃÄ£°å¸ù±¾Ã»Óаüº¬´¦Àí³ÌÐò±ê¼Ç¡£Çë²é¿´ËùÇëÇóµÄÄ£°å£¬Á˽âÕýÈ·µÄÄ£°åÓï·¨¡£" - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ËùÇëÇóµÄÄ£°åûÓаüº¬Óд¦Àí³ÌÐò±ê¼Ç¡£" - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ÔÚËùÇëÇóµÄÄ£°åÖз¢ÏÖÒ»¸öÌæ»»±ê¼Ç£¬¸ÃÌæ»»±ê¼ÇµÄÌæ»»Ãû³Æ¹ý³¤¡£Ìæ»»Ãû³ÆµÄ×î´ó³¤¶È±ØÐëСÓÚ»òµÈÓÚ atlstencil.h Öж¨ÒåµÄ³£Êý ATL_MAX_METHOD_NAME" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ÔÚËùÇëÇóµÄÄ£°åÖз¢ÏÖÒ»¸öʹÓà id.tagname Óï·¨µÄÌæ»»±ê¼Ç¡£´¦Àí³ÌÐòÃû³ÆµÄ×î´ó³¤¶È±ØÐëСÓÚ»òµÈÓÚ atlstencil.h Öж¨ÒåµÄ³£Êý ATL_MAX_METHOD_NAME" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

Ä£Äâ¿Í»§¶ËÌá³öÇëÇóµÄ³¢ÊÔʧ°Ü¡£" - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "·þÎñÆ÷´íÎó

·þÎñÆ÷´íÎó

ÓÉÓÚ·¢Éúδ֪´íÎó£¬ÓÃÓÚ´¦Àí¸ÃÇëÇóµÄ ISAPI À©Õ¹ÎÞ·¨ÕýÈ·¼ÓÔØ¡£" - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "ÇëÇó¶Ñ´´½¨Ê§°Ü" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "¸¨ÖúÏ̳߳õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "ÁÙ½çÇø³õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "Ï̳߳سõʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "DLL »º´æ³õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "Page »º´æ³õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "Ä£°å»º´æ³õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "»á»°×´Ì¬·þÎñ³õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Blob »º´æ³õʼ»¯Ê§°Ü" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "Îļþ»º´æ³õʼ»¯Ê§°Ü" - - IDS_PERFMON_CACHE "ATL Server:»º´æ" - IDS_PERFMON_CACHE_HELP "ATL Server »º´æµÄÏà¹ØÐÅÏ¢" - IDS_PERFMON_HITCOUNT "»º´æÃüÖÐÊý" - IDS_PERFMON_HITCOUNT_HELP "ÃüÖлº´æµÄÊýÄ¿" - IDS_PERFMON_MISSCOUNT "»º´æδÃüÖÐÊý" - IDS_PERFMON_MISSCOUNT_HELP "δÃüÖлº´æµÄÊýÄ¿" - IDS_PERFMON_CURRENTALLOCATIONS "»º´æµ±Ç°·ÖÅä¶î" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "·ÖÅä¸ø»º´æµÄµ±Ç°ÄÚ´æ´óС" - IDS_PERFMON_MAXALLOCATIONS "»º´æ×î´ó·ÖÅä¶î" - IDS_PERFMON_MAXALLOCATIONS_HELP "·ÖÅä¸ø»º´æµÄ×î´óÄÚ´æ´óС" - IDS_PERFMON_CURRENTENTRIES "µ±Ç°»º´æÏîÊý" - IDS_PERFMON_CURRENTENTRIES_HELP "µ±Ç°»º´æÏîµÄÊýÄ¿" - IDS_PERFMON_MAXENTRIES "»º´æ×î´óÏîÊý" - IDS_PERFMON_MAXENTRIES_HELP "»º´æÏîµÄ×î´óÊýÄ¿" - IDS_PERFMON_HITCOUNTRATE "»º´æÃüÖÐÂÊ" - IDS_PERFMON_HITCOUNTRATE_HELP "ÿÃëÃüÖлº´æµÄ´ÎÊý" - IDS_PERFMON_REQUEST "ATL Server:ÇëÇó" - IDS_PERFMON_REQUEST_HELP "¹ØÓÚ½øÈë¸Ã·þÎñÆ÷µÄÇëÇóµÄͳ¼ÆÐÅÏ¢" - IDS_PERFMON_REQUEST_TOTAL "·þÎñÆ÷ÇëÇó×ÜÊý" - IDS_PERFMON_REQUEST_TOTAL_HELP "ÇëÇóµÄ×ÜÊý" - IDS_PERFMON_REQUEST_FAILED "·þÎñÆ÷ÇëÇóʧ°ÜÊý" - IDS_PERFMON_REQUEST_FAILED_HELP "ʧ°ÜµÄÇëÇóµÄÊýÄ¿" - IDS_PERFMON_REQUEST_RATE "·þÎñÆ÷ÇëÇó/Ãë" - IDS_PERFMON_REQUEST_RATE_HELP "ÿÃëÇëÇóµÄÊýÄ¿" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "ƽ¾ùÏìӦʱ¼ä" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "´¦ÀíÇëÇóËùÐèµÄƽ¾ùʱ¼ä" - IDS_PERFMON_REQUEST_CURR_WAITING "µ±Ç°¶ÓÁÐÖеÄÇëÇóÊý" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "µ±Ç°µÈ´ý´¦ÀíµÄÇëÇóÊýÄ¿" - IDS_PERFMON_REQUEST_MAX_WAITING "¶ÓÁÐÖÐÇëÇóµÄ×î´óÊýÄ¿" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "µÈ´ý´¦ÀíµÄÇëÇóµÄ×î´óÊýÄ¿" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "»î¶¯Ïß³ÌÊý" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "ÕýÔÚ´¦ÀíÇëÇóµÄ»î¶¯Ïß³ÌÊý" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

ÔÚÊÔͼ·ÖÎöÄ£°åÎļþʱ£¬·¢ÉúÈçÏ´íÎó£º

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
´íÎóÀàÐÍ{{GetErrorText}}
ÐкÅ{{GetErrorLineNumber}}
´íÎóÎı¾
{{GetErrorLine}}
\r\n{{endwhile}}
Ä£°åÊä³öΪ£º\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} ȱÉÙ {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} ȱÉÙ {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} ȱÉÙ {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} ȱÉÙ {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} ȱÉÙ {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} ȱÉÙ {{if}} or {{else}}" - - IDS_STENCIL_INVALID_HANDLER "ÎÞЧµÄ´¦Àí³ÌÐò±ê¼Ç" - IDS_STENCIL_NULLPARAM "ParseReplacements Ϊ Null ²ÎÊý" - IDS_STENCIL_INVALIDSTRING "´«µÝ¸ø ParseReplacements µÄ×Ö·û´®Îª¿Õ»òÕßΪ¸º" - IDS_STENCIL_EMBEDDED_NULL "ǶÈëÔÚÄ£°åÖеĿÕ×Ö·û" - IDS_STENCIL_UNMATCHED_TAG_START "²»Æ¥Åä {{" - IDS_STENCIL_MISMATCHED_TAG_START "Æ¥Åä´íÎó {{" - IDS_STENCIL_BAD_PARAMETER "´íÎóµÄ²ÎÊý" - IDS_STENCIL_METHODNAME_TOO_LONG "·½·¨Ãû³Æ¹ý³¤" - IDS_STENCIL_HANDLERNAME_TOO_LONG "´¦Àí³ÌÐòÃû³Æ¹ý³¤" - IDS_STENCIL_INVALID_SUBHANDLER "ÎÞЧµÄ×Ó´¦Àí³ÌÐò±ê¼Ç" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "ÎÞ·¨½âÎöµÄÌæ»» : '%s'" - - IDS_STENCIL_INCLUDE_ERROR "ÎÞ·¨´ò¿ª±»°üº¬Îļþ" - IDS_STENCIL_INCLUDE_INVALID "±»°üº¬Îļþ²»ÊÇ´ÅÅÌÎļþ" - - IDS_STENCIL_MLANG_COCREATE "ÎÞ·¨´´½¨ CMultiLanguage" - IDS_STENCIL_MLANG_LCID "»ñÈ¡ lcid ´íÎó" - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo ʧ°Ü" - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo ʧ°Ü" - - IDS_STENCIL_OUTOFMEMORY "ÄÚ´æ²»×ã" - IDS_STENCIL_UNEXPECTED "Òì³£´íÎó" -END - -#endif diff --git a/include/atl/l.cht/atlsrv.rc b/include/atl/l.cht/atlsrv.rc deleted file mode 100644 index 2d9f7340d..000000000 --- a/include/atl/l.cht/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "¤£¥¿½Tªº­n¨D¤£¥¿½Tªº­n¨D" - IDS_ATLSRV_AUTH_REQUIRED - "»Ý­n±ÂÅv»Ý­n±ÂÅv" - IDS_ATLSRV_FORBIDDEN "¸T¤î¨Ï¥Î¸T¤î¨Ï¥Î" - IDS_ATLSRV_NOT_FOUND "§ä¤£¨ì§ä¤£¨ì" - IDS_ATLSRV_SERVER_ERROR "¦øªA¾¹¿ù»~¦øªA¾¹¿ù»~" - IDS_ATLSRV_NOT_IMPLEMENTED - "¥¼¹ê§@¥¼¹ê§@" - IDS_ATLSRV_BAD_GATEWAY "¤£¥¿½Tªº¹h¹D¤£¥¿½Tªº¹h¹D" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "µLªk¨ú±oªA°ÈµLªk¨ú±oªA°È" - IDS_ATLSRV_SERVER_ERROR_BADSRF "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

µLªk¸ü¤J SRF ÀÉ¡C" - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¤w¸g¸ü¤J­n¨Dªº SRF ÀÉ¡A¦ýµLªk¦¨¥\³B²z¡C" - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

µLªk«Ø¥ß Windows ¨t²Îª«¥ó¡C" - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

ÀÉ®×Ū¨ú§@·~¤w¥¢±Ñ¡C" - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

µLªk¶}±Ò«ü©wªºÀɮסC" - IDS_ATLSRV_SERVER_ERROR_LOADLIB "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

LoadLibrary ¤w¥¢±Ñ¡C" - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

µLªkÂ^¨ú­n¨Dªº³B²z±`¦¡¤¶­±¡C" - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦øªA¾¹°O¾ÐÅ餣¨¬¡C" - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦øªA¾¹µo¥Í¥¼¹w´Áªº¿ù»~¡C" - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¹Á¸Õ­åªR­n¨Dªº¼ÒªO®É¡A¦øªA¾¹µo¥Í¥¼¹w´Áªº¿ù»~¡C" - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦øªA¾¹µLªk¸ü¤J­n¨Dªº¼ÒªO¡C¼ÒªOÀÉ¥i¯à¤w·l·´©Î¤£¦b¦¹ Web ¦øªA¾¹¤W¡C" - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦b«ü©wªº handler .dll ¤¤¡A§ä¤£¨ì¦b­n¨D¼ÒªOªº³B²z±`¦¡¼Ð°O¤¤©R¦Wªº¬Y­Ó³B²z±`¦¡¡C" - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦¹¼ÒªO¥]§t¼ÒªO³B²z¾¹µLªk¾A·í­åªRªº³B²z±`¦¡¼Ð°O¡A©Î¥¼¥]§t¥ô¦ó³B²z±`¦¡¼Ð°O¡C½ÐÀˬd­n¨Dªº¼ÒªO¬O§_¨Ï¥Î¾A¦Xªº¼ÒªO»yªk¡C" - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

­n¨Dªº¼ÒªO¥¼¥]§t³B²z±`¦¡¼Ð°O¡C" - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦b­n¨Dªº¼ÒªO¤¤µo²{¨ú¥N¼Ð°Oªº¨ú¥N¦WºÙ¤Óªø¡C¨ú¥N¦WºÙ³Ìªøªºªø«×¥²¶·¤p©ó©Îµ¥©ó¦b atlstencil.h ¤¤©Ò©w¸qªº ATL_MAX_METHOD_NAME ±`¼Æ¡C" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦b­n¨D¼ÒªO¤¤¨Ï¥Î id.tagname »yªkªº¨ú¥N¼Ð°Oªº³B²z±`¦¡¦WºÙ¤Óªø¡C³B²z±`¦¡¦WºÙ³Ìªøªºªø«×¥²¶·¤p©ó©Îµ¥©ó¦b atlstencil.h ¤¤©Ò©w¸qªº ATL_MAX_METHOD_NAME ±`¼Æ¡C" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¹Á¸Õ¼ÒÀÀ¥Î¤áºÝ³y¦¨­n¨D¥¢±Ñ¡C" - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "¦øªA¾¹¿ù»~

¦øªA¾¹¿ù»~

¦]¬°µo¥Í¥¼ª¾ªº¿ù»~¡AµLªk¥¿½T¸ü¤J¥Î¨ÓªA°È¦¹­n¨Dªº ISAPI ÂX¥Rµ{¦¡¡C" - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "­n¨D°ï¿n«Ø¥ß¥¢±Ñ" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "­I´º¤u§@°õ¦æºüªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "ÃöÁä°Ï¬qªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "°õ¦æºü¶°°Ïªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "DLL §Ö¨úªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "¤À­¶§Ö¨úªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "¼ÒªO§Ö¨úªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "¤u§@¶¥¬qª¬ºAªA°Èªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Blob §Ö¨úªì©l¤Æ¥¢±Ñ" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "Àɮק֨úªì©l¤Æ¥¢±Ñ" - - IDS_PERFMON_CACHE "ATL Server:§Ö¨ú" - IDS_PERFMON_CACHE_HELP "¦³Ãö ATL Server §Ö¨úªº¸ê°T" - IDS_PERFMON_HITCOUNT "§Ö¨ú¥s¥Î¦¸¼Æ" - IDS_PERFMON_HITCOUNT_HELP "§Ö¨ú¥s¥Îªº¦¸¼Æ" - IDS_PERFMON_MISSCOUNT "§Ö¨ú¿òº|¦¸¼Æ" - IDS_PERFMON_MISSCOUNT_HELP "§Ö¨ú¿òº|ªº¦¸¼Æ" - IDS_PERFMON_CURRENTALLOCATIONS "§Ö¨ú¥Ø«e°t¸m" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "§Ö¨ú¥Ø«eªº°O¾ÐÅé°t¸m" - IDS_PERFMON_MAXALLOCATIONS "§Ö¨ú°t¸m¤W­­" - IDS_PERFMON_MAXALLOCATIONS_HELP "§Ö¨úªº³Ì¤j°O¾ÐÅé°t¸m" - IDS_PERFMON_CURRENTENTRIES "§Ö¨ú¥Ø«e¶µ¥Ø" - IDS_PERFMON_CURRENTENTRIES_HELP "¥Ø«eªº§Ö¨ú¶µ¥Ø¼Æ" - IDS_PERFMON_MAXENTRIES "§Ö¨ú¶µ¥Ø¤W­­" - IDS_PERFMON_MAXENTRIES_HELP "§Ö¨ú¶µ¥Øªº³Ì¤j¼Æ" - IDS_PERFMON_HITCOUNTRATE "§Ö¨ú¥s¥Î²v" - IDS_PERFMON_HITCOUNTRATE_HELP "¨C¬í§Ö¨ú¥s¥Îªº¼Æ¥Ø" - IDS_PERFMON_REQUEST "ATL Server:­n¨D" - IDS_PERFMON_REQUEST_HELP "¦³Ãö¶i¤J¦¹¦øªA¾¹­n¨Dªº²Î­p¸ê®Æ" - IDS_PERFMON_REQUEST_TOTAL "¦øªA¾¹­n¨DÁ`¼Æ" - IDS_PERFMON_REQUEST_TOTAL_HELP "­n¨DªºÁ`¼Æ" - IDS_PERFMON_REQUEST_FAILED "¦øªA¾¹¥¢±Ñ­n¨D" - IDS_PERFMON_REQUEST_FAILED_HELP "¥¢±Ñ­n¨Dªº¼Æ¥Ø" - IDS_PERFMON_REQUEST_RATE "¦øªA¾¹­n¨D /¬í" - IDS_PERFMON_REQUEST_RATE_HELP "¨C¬í­n¨D¼Æ¥Ø" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "¥­§¡¦^À³®É¶¡" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "³B²z­n¨D©Òªá¶Oªº¥­§¡®É¶¡" - IDS_PERFMON_REQUEST_CURR_WAITING "¥Ø«e¤w±Æ¤J¦î¦Cªº­n¨D" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "¥Ø«eµ¥­Ô³B²zªº­n¨D¼Æ¥Ø" - IDS_PERFMON_REQUEST_MAX_WAITING "¦î¦C­n¨D¤W­­" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "µ¥­Ô³B²z­n¨Dªº³Ì¤j¼Æ" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "§@¥Î¤¤ªº°õ¦æºü" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "¥¿¦b³B²z­n¨Dªº°õ¦æºü¼Æ¥Ø" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

·í¹Á¸Õ­åªR¼ÒªOÀɮɡAµo¥Í¤U¦C¿ù»~:

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
¿ù»~Ãþ«¬{{GetErrorText}}
¦æ¸¹{{GetErrorLineNumber}}
¿ù»~¤å¦r
{{GetErrorLine}}
\r\n{{endwhile}}
¤§«áªº¼ÒªO¿é¥X:\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "¦³ {{if}} ¦ý¨S¦³ {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "¦³ {{else}} ¦ý¨S¦³ {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "¦³ {{while}} ¦ý¨S¦³ {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "¦³ {{endwhile}} ¦ý¨S¦³ {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "¦³ {{else}} ¦ý¨S¦³ {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "¦³ {{endif}} ¦ý¨S¦³ {{if}} ©Î {{else}}" - - IDS_STENCIL_INVALID_HANDLER "µL®Äªº³B²z±`¦¡¼Ð°O" - IDS_STENCIL_NULLPARAM "ParseReplacements ªº NULL °Ñ¼Æ" - IDS_STENCIL_INVALIDSTRING "¶Ç»¼¨ì ParseReplacements ªºªÅªº©Î­t­È¦r¦ê" - IDS_STENCIL_EMBEDDED_NULL "¼ÒªO¤¤´O¤Jªº Null ¦r¤¸" - IDS_STENCIL_UNMATCHED_TAG_START "¤£¬Û²Åªº {{" - IDS_STENCIL_MISMATCHED_TAG_START "¤£¬Û²Åªº {{" - IDS_STENCIL_BAD_PARAMETER "¤£¥¿½Tªº°Ñ¼Æ" - IDS_STENCIL_METHODNAME_TOO_LONG "¤èªk¦WºÙ¤Óªø" - IDS_STENCIL_HANDLERNAME_TOO_LONG "³B²z±`¦¡¦WºÙ¤Óªø" - IDS_STENCIL_INVALID_SUBHANDLER "µL®Äªº¤l³B²z±`¦¡¼Ð°O" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "µLªk¸ÑªRªº¨ú¥N : '%s'" - - IDS_STENCIL_INCLUDE_ERROR "µLªk¶}±Ò¥]§tªºÀÉ®×" - IDS_STENCIL_INCLUDE_INVALID "¥]§tªºÀɮפ£¬OºÏºÐÀÉ®×" - - IDS_STENCIL_MLANG_COCREATE "µLªk«Ø¥ß CMultiLanguage" - IDS_STENCIL_MLANG_LCID "¨ú±o lcid µo¥Í¿ù»~" - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo ¥¢±Ñ" - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo ¥¢±Ñ" - - IDS_STENCIL_OUTOFMEMORY "°O¾ÐÅ餣¨¬" - IDS_STENCIL_UNEXPECTED "¥¼¹w´Áªº¿ù»~" -END - -#endif diff --git a/include/atl/l.deu/atlsrv.rc b/include/atl/l.deu/atlsrv.rc deleted file mode 100644 index 2ffca35c6..000000000 --- a/include/atl/l.deu/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "Ungültige AnforderungUngültige Anforderung" - IDS_ATLSRV_AUTH_REQUIRED - "Authorisierung erforderlichAuthorisierung erforderlich" - IDS_ATLSRV_FORBIDDEN "UnzulässigUnzulässig" - IDS_ATLSRV_NOT_FOUND "Nicht gefundenNicht gefunden" - IDS_ATLSRV_SERVER_ERROR "ServerfehlerServerfehler" - IDS_ATLSRV_NOT_IMPLEMENTED - "Nicht implementiertNicht implementiert" - IDS_ATLSRV_BAD_GATEWAY "Ungültiger GatewayUngültiger Gateway" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "Dienst nicht verfügbarDienst nicht verfügbar" - IDS_ATLSRV_SERVER_ERROR_BADSRF "Serverfehler

Serverfehler

SRF-Datei konnte nicht geladen werden." - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "Serverfehler

Serverfehler

Die angeforderte SRF-Datei wurde geladen, aber konnte nicht verarbeitet werden." - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "Serverfehler

Serverfehler

Ein Windows-Systemobjekt konnte nicht erstellt werden." - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "Serverfehler

Serverfehler

Ein Dateilesevorgang ist fehlgeschlagen." - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "Serverfehler

Serverfehler

Die angegebene Datei konnte nicht geöffnet werden." - IDS_ATLSRV_SERVER_ERROR_LOADLIB "Serverfehler

Serverfehler

LoadLibrary fehlgeschlagen." - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "Serverfehler

Serverfehler

Die Anforderungshandlerschnittstelle konnte nicht abgerufen werden." - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "Serverfehler

Serverfehler

Auf dem Server ist nicht genügend Arbeitsspeicher verfügbar." - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "Serverfehler

Serverfehler

Auf dem Server ist ein unerwarteter Fehler aufgetreten." - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "Serverfehler

Serverfehler

Beim Bearbeiten des angeforderten Stencils ist ein unerwarteter Fehler auf dem Server aufgetreten." - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "Serverfehler

Serverfehler

Der Server konnte den angeforderten Stencil nicht laden. Die Stencildatei ist möglicherweise beschädigt oder nicht auf dem Webserver vorhanden." - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "Serverfehler

Serverfehler

Ein in einem Handlertag benannter Handler für den angeforderten Stencil konnte nicht im angegebenen Handler gefunden werden .dll." - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "Serverfehler

Serverfehler

Der Stencil enthält ein Handlertag, das vom Stencilprozessor nicht richtig bearbeitet werden konnte und kein Handlertag enthält. Überprüfen Sie die Stencilsyntax für den angeforderten Stencil." - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "Serverfehler

Serverfehler

Der angeforderte Stencil enthält kein Handlertag." - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "Serverfehler

Serverfehler

Im angeforderten Stencil wurde ein Ersetzungstag mit einem zu langen Namen gefunden. Die maximale Länge des Ersetzungsnamen muss kleiner oder gleich der ATL_MAX_METHOD_NAME-Konstante sein, die in atlstencil.h definiert ist." - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "Serverfehler

Serverfehler

Im angeforderten Stencil wurde ein Ersetzungstag mit einem zu langen Handlernamen gefunden, der die id.tagname-Syntax verwendet. Die maximale Länge des Handlernamens muss kleiner oder gleich der ATL_MAX_METHOD_NAME-Konstante sein, die in atlstencil.h definiert ist." - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "Serverfehler

Serverfehler

Die Anforderung ist fehlgeschlagen, da versucht wurde, den Client zu imitieren." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "Serverfehler

Serverfehler

Die ISAPI-Erweiterung für die Anforderung konnte nicht geladen werden, da ein unbekannter Fehler aufgetreten ist." - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "Anforderungsheap konnte nicht erstellt werden" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "Workerthread konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "Kritischer Abschnitt konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "Threadpool konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "DLL-Cache konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "Seitencache konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "Stencilcache konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "Sitzungsstatusdienst konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Blobcache konnte nicht initialisiert werden" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "Dateicache konnte nicht initialisiert werden" - - IDS_PERFMON_CACHE "ATL-Server:Cache" - IDS_PERFMON_CACHE_HELP "Informationen über den ATL-Servercache" - IDS_PERFMON_HITCOUNT "Cachetrefferanzahl" - IDS_PERFMON_HITCOUNT_HELP "Anzahl der Cachetreffer" - IDS_PERFMON_MISSCOUNT "Fehlgeschlagene Cachezugriffe" - IDS_PERFMON_MISSCOUNT_HELP "Anzahl der fehlgeschlagenen Cachezugriffe" - IDS_PERFMON_CURRENTALLOCATIONS "Aktuelle Cachezuordnungen" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "Aktuelle Speicherzuordnung für den Cache" - IDS_PERFMON_MAXALLOCATIONS "Max. Cachezuordnungen" - IDS_PERFMON_MAXALLOCATIONS_HELP "Maximale Speicherzuordnung für den Cache" - IDS_PERFMON_CURRENTENTRIES "Aktuelle Cacheeinträge" - IDS_PERFMON_CURRENTENTRIES_HELP "Aktuelle Anzahl der Cacheeinträge" - IDS_PERFMON_MAXENTRIES "Max. Cacheeinträge" - IDS_PERFMON_MAXENTRIES_HELP "Maximale Anzahl der Cacheeinträge" - IDS_PERFMON_HITCOUNTRATE "Cachetrefferanzahl" - IDS_PERFMON_HITCOUNTRATE_HELP "Anzahl der Treffer pro Sekunde" - IDS_PERFMON_REQUEST "ATL-Server:Request" - IDS_PERFMON_REQUEST_HELP "Statistik über die eingehenden Serveranforderungen" - IDS_PERFMON_REQUEST_TOTAL "Serveranforderungen insgesamt" - IDS_PERFMON_REQUEST_TOTAL_HELP "Gesamtanzahl der Anforderungen" - IDS_PERFMON_REQUEST_FAILED "Fehlgeschlagene Serveranforderungen" - IDS_PERFMON_REQUEST_FAILED_HELP "Anzahl der fehlgeschlagenen Anforderungen" - IDS_PERFMON_REQUEST_RATE "Serveranforderungen /Sek." - IDS_PERFMON_REQUEST_RATE_HELP "Anzahl der Anforderungen pro Sekunde" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "Durchschnittliche Antwortzeit" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "Durchschnittliche Bearbeitungszeit" - IDS_PERFMON_REQUEST_CURR_WAITING "Aktuelle Anforderungen in der Warteschlange" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "Die aktuvelle Anzahl der Anforderungen, die auf die Bearbeitung warten" - IDS_PERFMON_REQUEST_MAX_WAITING "Maximale Anforderungen in der Warteschlange" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "Die maximale Anzahl der Anforderungen, die auf die Bearbeitung warten" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "AKtive Threads" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "Die Anzahl der Threads, die Anforderungen bearbeiten" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

Beim Bearbeiten einer Stencildatei sind folgende Fehler aufgetreten:

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
Fehlertyp{{GetErrorText}}
Zeilennummer{{GetErrorLineNumber}}
Fehlertext
{{GetErrorLine}}
\r\n{{endwhile}}
Stencilausgabe:\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} ohne {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} ohne {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} ohne {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} ohne {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} ohne {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} ohne {{if}} oder {{else}}" - - IDS_STENCIL_INVALID_HANDLER "Ungültiges Handlertag" - IDS_STENCIL_NULLPARAM "NULL-Parameter für ParseReplacements" - IDS_STENCIL_INVALIDSTRING "An ParseReplacements wurde eine leere oder negative Zeichenfolge übergeben" - IDS_STENCIL_EMBEDDED_NULL "Eingebettetes Nullzeichen in Stencil" - IDS_STENCIL_UNMATCHED_TAG_START "Unterschiedlich {{" - IDS_STENCIL_MISMATCHED_TAG_START "Nicht übereinstimmend {{" - IDS_STENCIL_BAD_PARAMETER "Ungültiger Parameter" - IDS_STENCIL_METHODNAME_TOO_LONG "Methodenname zu lang" - IDS_STENCIL_HANDLERNAME_TOO_LONG "Handlername zu lang" - IDS_STENCIL_INVALID_SUBHANDLER "Ungültiges Unterhandlertag" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "Nicht aufgelöste Ersetzung : '%s'" - - IDS_STENCIL_INCLUDE_ERROR "Die einbezogene Datei konnte nicht geöffnet werden" - IDS_STENCIL_INCLUDE_INVALID "Die einbezogene Datei ist keine Datenträgerdatei" - - IDS_STENCIL_MLANG_COCREATE "CMultiLanguage konnte nicht erstellt werden" - IDS_STENCIL_MLANG_LCID "Beim Abfragen der lcid ist ein Fehler aufgetreten" - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo fehlgeschlagen" - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo fehlgeschlagen" - - IDS_STENCIL_OUTOFMEMORY "Nicht genügend Speicher verfügbar" - IDS_STENCIL_UNEXPECTED "Unerwarteter Fehler" -END - -#endif diff --git a/include/atl/l.esp/atlsrv.rc b/include/atl/l.esp/atlsrv.rc deleted file mode 100644 index 15bf88daa..000000000 --- a/include/atl/l.esp/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "Solicitud incorrectaSolicitud incorrecta" - IDS_ATLSRV_AUTH_REQUIRED - "Autorización requeridaSe necesita autorización" - IDS_ATLSRV_FORBIDDEN "ProhibidoProhibido" - IDS_ATLSRV_NOT_FOUND "No se encontróNo se encontró" - IDS_ATLSRV_SERVER_ERROR "Error del servidorError del servidor" - IDS_ATLSRV_NOT_IMPLEMENTED - "No implementadoNo implementado" - IDS_ATLSRV_BAD_GATEWAY "Puerta de enlace no válidaPuerta de enlace no válida" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "Servicio no disponibleServicio no disponible" - IDS_ATLSRV_SERVER_ERROR_BADSRF "Error del servidor

Error del servidor

No se puede cargar el archivo SRF." - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "Error del servidor

Error del servidor

El archivo SRF solicitado se cargó pero no se pudo procesar correctamente." - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "Error del servidor

Error del servidor

No se puede crear un objeto del sistema Windows." - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "Error del servidor

Error del servidor

Error en la operación de lectura de archivo." - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "Error en el servidor

Error en el servidor

No se puede abrir el archivo especificado." - IDS_ATLSRV_SERVER_ERROR_LOADLIB "Error del servidor

Error del servidor

Error de LoadLibrary." - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "Error del servidor

Error del servidor

Error al recuperar la interfaz del controlador de solicitudes." - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "Error del servidor

Error del servidor

El servidor no tiene suficiente memoria." - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "Error del servidor

Error del servidor

El servidor detectó un error inesperado." - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "Error del servidor

Error del servidor

El servidor detectó un error inesperado al intentar analizar el cliché solicitado." - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "Error del servidor

Error del servidor

Error del servidor al cargar el cliché solicitado. Es posible que el archivo de cliché esté dañado o no se encuentre en este servidor Web." - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "Error del servidor

Error del servidor

No se encontró uno de los controladores nombrado en una etiqueta de controlador para el cliché solicitado en el archivo DLL del controlador especificado." - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "Error del servidor

Error del servidor

Este cliché contiene una etiqueta de controlador que el procesador de cliché no puede analizar correctamente o bien no contiene ninguna etiqueta de controlador. Compruebe que la sintaxis del cliché solicitado sea correcta." - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "Error del servidor

Error del servidor

El cliché solicitado no contiene una etiqueta de controlador." - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "Error del servidor

Error del servidor

Se encontró una etiqueta de reemplazo en el cliché solicitado con un nombre de reemplazo demasiado largo. La longitud máxima del nombre de reemplazo debe ser inferior o igual a la constante ATL_MAX_METHOD_NAME definida en atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "Error del servidor

Error del servidor

Se encontró una etiqueta de reemplazo que utiliza la sintaxis id.tagname en el cliché seleccionado con un nombre de controlador demasiado largo. La longitud máxima del nombre del controlador debe ser inferior o igual a la constante ATL_MAX_METHOD_NAME definida en atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "Error del servidor

Error del servidor

Error al intentar identificar al cliente que realiza la solicitud." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "Error del servidor

Error del servidor

Error desconocido de la extensión ISAPI utilizada para dar servicio a esta solicitud al realizar la carga." - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "Error al crear el montón de solicitudes" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "Error al inicializar el subproceso de trabajo" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "Error al inicializar la sección crítica" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "Error al inicializar el grupo de subprocesos" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "Error al inicializar la caché de archivos DLL" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "Error al inicializar la caché de páginas" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "Error al inicializar la caché de clichés" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "Error al inicializar el servicio de estado de sesión" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Error al inicializar la caché de objetos binarios" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "Error al inicializar la caché de archivos" - - IDS_PERFMON_CACHE "Servidor ATL:caché" - IDS_PERFMON_CACHE_HELP "Información sobre la caché del servidor ATL" - IDS_PERFMON_HITCOUNT "Recuento de visitas de caché" - IDS_PERFMON_HITCOUNT_HELP "Número de visitas de caché" - IDS_PERFMON_MISSCOUNT "Recuento de errores de caché" - IDS_PERFMON_MISSCOUNT_HELP "Número de errores de caché" - IDS_PERFMON_CURRENTALLOCATIONS "Asignaciones actuales de caché" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "Memoria actual asignada a caché" - IDS_PERFMON_MAXALLOCATIONS "Asignaciones máximas de caché" - IDS_PERFMON_MAXALLOCATIONS_HELP "Memoria máxima asignada a caché" - IDS_PERFMON_CURRENTENTRIES "Entradas actuales de caché" - IDS_PERFMON_CURRENTENTRIES_HELP "Número actual de entradas de caché" - IDS_PERFMON_MAXENTRIES "Entradas máximas de caché" - IDS_PERFMON_MAXENTRIES_HELP "Número máximo de entradas de caché" - IDS_PERFMON_HITCOUNTRATE "Velocidad de recuento de visitas de caché" - IDS_PERFMON_HITCOUNTRATE_HELP "Número de recuentos de visitas por segundo" - IDS_PERFMON_REQUEST "Servidor ATL:solicitud" - IDS_PERFMON_REQUEST_HELP "Estadísticas de las solicitudes que entran en el servidor" - IDS_PERFMON_REQUEST_TOTAL "Solicitudes totales del servidor" - IDS_PERFMON_REQUEST_TOTAL_HELP "Número total de solicitudes" - IDS_PERFMON_REQUEST_FAILED "Solicitudes no procesadas del servidor" - IDS_PERFMON_REQUEST_FAILED_HELP "Número de solitudes no procesadas" - IDS_PERFMON_REQUEST_RATE "Solicitudes del servidor /seg" - IDS_PERFMON_REQUEST_RATE_HELP "Número de solicitudes por segundo" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "Tiempo medio de respuesta" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "Tiempo medio empleado en administrar una solicitud" - IDS_PERFMON_REQUEST_CURR_WAITING "Solicitudes en cola actuales" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "Número actual de solicitudes en espera de administración" - IDS_PERFMON_REQUEST_MAX_WAITING "Solicitudes máximas en cola" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "Número máximo de solicitudes en espera de administración" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "Subprocesos activos" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "Número de subprocesos que administran solicitudes activamente" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

Errores al analizar un archivo de clichés:

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
Tipo de error{{GetErrorText}}
Número de línea{{GetErrorLineNumber}}
Texto del error
{{GetErrorLine}}
\r\n{{endwhile}}
Resultados de cliché:\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} sin {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} sin {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} sin {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} sin {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} sin {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} sin {{if}} o {{else}}" - - IDS_STENCIL_INVALID_HANDLER "Etiqueta de controlador no válida" - IDS_STENCIL_NULLPARAM "Parámetro NULL para ParseReplacements" - IDS_STENCIL_INVALIDSTRING "Se pasó una cadena vacía o negativa a ParseReplacements" - IDS_STENCIL_EMBEDDED_NULL "Carácter null incrustado en el cliché" - IDS_STENCIL_UNMATCHED_TAG_START "Las llaves {{ no coinciden" - IDS_STENCIL_MISMATCHED_TAG_START "Diferente número de llaves {{" - IDS_STENCIL_BAD_PARAMETER "Parámetro erróneo" - IDS_STENCIL_METHODNAME_TOO_LONG "Nombre de método demasiado largo" - IDS_STENCIL_HANDLERNAME_TOO_LONG "Nombre de controlador demasiado largo" - IDS_STENCIL_INVALID_SUBHANDLER "Etiqueta de controlador secundario no válida" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "Reemplazo no resuelto: '%s'" - - IDS_STENCIL_INCLUDE_ERROR "No se puede abrir el archivo incluido" - IDS_STENCIL_INCLUDE_INVALID "El archivo incluido no es un archivo de disco" - - IDS_STENCIL_MLANG_COCREATE "No se puede crear CMultiLanguage" - IDS_STENCIL_MLANG_LCID "Error al obtener el identificador LCID" - IDS_STENCIL_MLANG_GETLOCALE "Error en GetLocaleInfo" - IDS_STENCIL_MLANG_GETCHARSET "Error en GetCharsetInfo" - - IDS_STENCIL_OUTOFMEMORY "Memoria insuficiente" - IDS_STENCIL_UNEXPECTED "Error inesperado" -END - -#endif diff --git a/include/atl/l.fra/atlsrv.rc b/include/atl/l.fra/atlsrv.rc deleted file mode 100644 index dc26cb83a..000000000 --- a/include/atl/l.fra/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "Demande incorrecteDemande incorrecte" - IDS_ATLSRV_AUTH_REQUIRED - "Autorisation requiseUne autorisation est requise" - IDS_ATLSRV_FORBIDDEN "InterditInterdit" - IDS_ATLSRV_NOT_FOUND "IntrouvableIntrouvable" - IDS_ATLSRV_SERVER_ERROR "Erreur serveurErreur serveur" - IDS_ATLSRV_NOT_IMPLEMENTED - "Non implémentéNon implémenté" - IDS_ATLSRV_BAD_GATEWAY "Passerelle incorrectePasserelle incorrecte" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "Service non disponibleService non disponible" - IDS_ATLSRV_SERVER_ERROR_BADSRF "Erreur serveur

Erreur serveur

Impossible de charger le fichier SRF." - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "Erreur serveur

Erreur serveur

Le fichier SRF requis a été chargé mais n'a pas pu être traité correctement." - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "Erreur serveur

Erreur serveur

Un objet système Windows n'a pas pu être créé." - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "Erreur serveur

Erreur serveur

Une opération de lecture de fichier a échoué." - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "Erreur serveur

Erreur serveur

Le fichier spécifié n'a pas pu être ouvert." - IDS_ATLSRV_SERVER_ERROR_LOADLIB "Erreur serveur

Erreur serveur

Échec de LoadLibrary." - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "Erreur serveur

Erreur serveur

Échec de la récupération de l'interface du gestionnaire des demandes." - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "Erreur serveur

Erreur serveur

La mémoire du serveur est saturée." - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "Erreur serveur

Erreur serveur

Le serveur a rencontré une erreur inattendue." - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "Erreur serveur

Erreur serveur

Le serveur a rencontré une erreur inattendue lors de l'analyse du stencil requis." - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "Erreur serveur

Erreur serveur

Le serveur n'a pas pu charger le stencil requis. Le fichier stencil est peut-être endommagé ou manquant sur ce serveur Web." - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "Erreur serveur

Erreur serveur

Un gestionnaire spécifié dans une balise de gestionnaire pour le stencil requis n'a pas pu être trouvé dans le fichier .dll de gestionnaire spécifié." - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "Erreur serveur

Erreur serveur

Soit ce stencil contient une balise de gestionnaire qui n'a pas pu être analysée correctement par le processeur de stencil, soit il ne contient aucune balise de gestionnaire. Vérifiez la syntaxe correcte à utiliser pour le stencil requis." - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "Erreur serveur

Erreur serveur

Le stencil requis ne contient aucune balise de gestionnaire." - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "Erreur serveur

Erreur serveur

Le stencil requis contient une balise de remplacement dans laquelle un nom de remplacement est trop long. La longueur maximale du nom de remplacement doit être inférieure ou égale à la valeur de la constante ATL_MAX_METHOD_NAME définie dans atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "Erreur serveur

Erreur serveur

Le stencil requis contient une balise de remplacement, utilisant la syntaxe id.nombalise, dans laquelle un nom de gestionnaire est trop long. La longueur maximale du nom d'un gestionnaire doit être inférieure ou égale à la valeur de la constante ATL_MAX_METHOD_NAME définie dans atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "Erreur serveur

Erreur serveur

Impossible d'emprunter l'identité du client qui a émis la demande." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "Erreur serveur

Erreur serveur

L'extension ISAPI utilisée pour traiter cette demande n'a pas pu être chargée en raison d'une erreur inconnue." - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "Échec de la création du segment de mémoire demandée" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "Échec de l'initialisation de la thread de traitement" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "Échec de l'initialisation de la section critique" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "Échec de l'initialisation du pool de threads" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "Échec de l'initialisation du cache de DLL" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "Échec de l'initialisation du cache de page" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "Échec de l'initialisation du cache du stencil" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "Échec de l'initialisation du service d'état de session" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Échec de l'initialisation du cache BLOB" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "Échec de l'initialisation du cache du fichier" - - IDS_PERFMON_CACHE "Serveur ATL : Cache" - IDS_PERFMON_CACHE_HELP "Information sur le cache du serveur ATL" - IDS_PERFMON_HITCOUNT "Accès cache avec résultat" - IDS_PERFMON_HITCOUNT_HELP "Nombre des accès cache avec résultat" - IDS_PERFMON_MISSCOUNT "Accès cache sans résultat" - IDS_PERFMON_MISSCOUNT_HELP "Nombre des accès cache sans résultat" - IDS_PERFMON_CURRENTALLOCATIONS "Allocations cache actuelles" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "Mémoire actuellement allouée au cache" - IDS_PERFMON_MAXALLOCATIONS "Allocations cache maximales" - IDS_PERFMON_MAXALLOCATIONS_HELP "Mémoire maximale allouée au cache" - IDS_PERFMON_CURRENTENTRIES "Entrées cache actuelles" - IDS_PERFMON_CURRENTENTRIES_HELP "Nombre actuel d'entrées du cache" - IDS_PERFMON_MAXENTRIES "Entrées cache maximales" - IDS_PERFMON_MAXENTRIES_HELP "Nombre maximal d'entrées du cache" - IDS_PERFMON_HITCOUNTRATE "Taux d'accès au cache" - IDS_PERFMON_HITCOUNTRATE_HELP "Nombre d'accès par seconde" - IDS_PERFMON_REQUEST "Serveur ATL : Demande" - IDS_PERFMON_REQUEST_HELP "Statistiques sur les demandes serveur entrantes" - IDS_PERFMON_REQUEST_TOTAL "Total des demandes serveur" - IDS_PERFMON_REQUEST_TOTAL_HELP "Nombre total des demandes" - IDS_PERFMON_REQUEST_FAILED "Demandes serveur échouées" - IDS_PERFMON_REQUEST_FAILED_HELP "Nombre de demandes ayant échoué" - IDS_PERFMON_REQUEST_RATE "Demandes serveur/s" - IDS_PERFMON_REQUEST_RATE_HELP "Nombre de demandes par seconde" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "Temps de réponse moyen" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "Durée moyenne du traitement d'une demande" - IDS_PERFMON_REQUEST_CURR_WAITING "Demandes actuelles en attente" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "Nombre de demandes actuellement en attente d'être traitées" - IDS_PERFMON_REQUEST_MAX_WAITING "Demandes maximales en attente" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "Nombre maximal de demandes en attente d'être traitées" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "Threads actives" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "Nombre de threads qui traitent activement des demandes" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

Lors de la tentative d'analyse d'un fichier stencil, les erreurs suivantes se sont produites :

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
Type d'erreur{{GetErrorText}}
Numéro de ligne{{GetErrorLineNumber}}
Texte de l'erreur
{{GetErrorLine}}
\r\n{{endwhile}}
La sortie du stencil est la suivante :\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} sans {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} sans {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} sans {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} sans {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} sans {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} sans {{if}} ou {{else}}" - - IDS_STENCIL_INVALID_HANDLER "Balise de gestionnaire non valide" - IDS_STENCIL_NULLPARAM "Paramètre NULL à ParseReplacements" - IDS_STENCIL_INVALIDSTRING "Chaîne vide ou négative passée à ParseReplacements" - IDS_STENCIL_EMBEDDED_NULL "Caractère null incorporé dans le stencil" - IDS_STENCIL_UNMATCHED_TAG_START "{{ non apparié" - IDS_STENCIL_MISMATCHED_TAG_START "{{ incompatible" - IDS_STENCIL_BAD_PARAMETER "Paramètre incorrect" - IDS_STENCIL_METHODNAME_TOO_LONG "Nom de méthode trop long" - IDS_STENCIL_HANDLERNAME_TOO_LONG "Nom de gestionnaire trop long" - IDS_STENCIL_INVALID_SUBHANDLER "Balise de sous-gestionnaire non valide" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "Remplacement non résolu : '%s'" - - IDS_STENCIL_INCLUDE_ERROR "Impossible d'ouvrir le fichier inclus" - IDS_STENCIL_INCLUDE_INVALID "Le fichier inclus n'est pas un fichier disque" - - IDS_STENCIL_MLANG_COCREATE "Impossible de créer CMultiLanguage" - IDS_STENCIL_MLANG_LCID "Erreur lors de l'obtention du lcid" - IDS_STENCIL_MLANG_GETLOCALE "Échec de GetLocaleInfo" - IDS_STENCIL_MLANG_GETCHARSET "Échec de GetCharsetInfo" - - IDS_STENCIL_OUTOFMEMORY "Mémoire insuffisante" - IDS_STENCIL_UNEXPECTED "Erreur inattendue" -END - -#endif diff --git a/include/atl/l.ita/atlsrv.rc b/include/atl/l.ita/atlsrv.rc deleted file mode 100644 index 009e0b2db..000000000 --- a/include/atl/l.ita/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "Richiesta non validaRichiesta non valida" - IDS_ATLSRV_AUTH_REQUIRED - "Autorizzazione richiestaAutorizzazione richiesta" - IDS_ATLSRV_FORBIDDEN "Non consentitoNon consentito" - IDS_ATLSRV_NOT_FOUND "Non trovatoNon trovato" - IDS_ATLSRV_SERVER_ERROR "Errore del serverErrore del server" - IDS_ATLSRV_NOT_IMPLEMENTED - "Non implementatoNon implementato" - IDS_ATLSRV_BAD_GATEWAY "Gateway non validoGateway non valido" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "Servizio non disponibileServizio non disponibile" - IDS_ATLSRV_SERVER_ERROR_BADSRF "Errore del server

Errore del server

Impossibile caricare il file SRF." - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "Errore del server

Errore del server

Il file SRF richiesto è stato caricato ma non elaborato correttamente." - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "Errore del server

Errore del server

Impossibile creare un oggetto di sistema Windows." - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "Errore del server

Errore del server

Operazione di lettura file non riuscita." - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "Errore del server

Errore del server

Impossibile aprire il file specificato." - IDS_ATLSRV_SERVER_ERROR_LOADLIB "Errore del server

Errore del server

LoadLibrary non riuscito." - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "Errore del server

Errore del server

Impossibile recuperare l'interfaccia del gestore delle richieste." - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "Errore del server

Errore del server

Memoria del server esaurita." - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "Errore del server

Errore del server

Errore imprevisto del server." - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "Errore del server

Errore del server

Errore imprevisto del server durante il tentativo di analizzare il file SRF richiesto." - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "Errore del server

Errore del server

Impossibile caricare il file SRF richiesto. Il file potrebbe essere danneggiato o mancante sul server Web." - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "Errore del server

Errore del server

Impossibile trovare nella DLL del gestore specificata uno dei gestori denominati in un tag di gestione per il file SRF richiesto." - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "Errore del server

Errore del server

Questo file SRF contiene un tag di gestione che non può essere analizzato correttamente dal processore dei file SRF o non contiene affatto un tag di gestione. Cercare nel file SRF richiesto la sintassi appropriata." - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "Errore del server

Errore del server

Il file SRF richiesto non contiene un tag di gestione." - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "Errore del server

Errore del server

Rilevato un tag di sostituzione nel file SRF richiesto con un nome di sostituzione troppo lungo. Il nome di sostituzione deve contenere un numero di caratteri inferiore o uguale alla costante ATL_MAX_METHOD_NAME definita in atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "Errore del server

Errore del server

Rilevato nel file SRF richiesto un tag di sostituzione che utilizza la sintassi id.tagname con un nome di gestore troppo lungo. Un nome di gestore deve contenere un numero di caratteri inferiore o uguale alla costante ATL_MAX_METHOD_NAME definita in atlstencil.h" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "Errore del server

Errore del server

Tentativo di rappresentare il client eseguendo la richiesta non riuscito." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "Errore del server

Errore del server

L'estensione ISAPI utilizzata per soddisfare questa richiesta non è riuscita a eseguire il caricamento correttamente. Errore sconosciuto." - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "Creazione heap richiesta non riuscita" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "Inizializzazione thread di lavoro non riuscita" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "Inizializzazione sezione critica non riuscita" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "Inizializzazione pool di thread non riuscita" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "Inizializzazione cache DLL non riuscita" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "Inizializzazione cache pagina non riuscita" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "Inizializzazione cache file SRF non riuscita" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "Inizializzazione servizio di stato sessione non riuscita" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Inizializzazione cache dati BLOB non riuscita" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "Inizializzazione cache file non riuscita" - - IDS_PERFMON_CACHE "Server ATL:Cache" - IDS_PERFMON_CACHE_HELP "Informazioni sulla cache del server ATL" - IDS_PERFMON_HITCOUNT "Passaggi cache" - IDS_PERFMON_HITCOUNT_HELP "Numero di riscontri cache" - IDS_PERFMON_MISSCOUNT "Conteggio mancati riscontri cache" - IDS_PERFMON_MISSCOUNT_HELP "Numero di mancati riscontri cache" - IDS_PERFMON_CURRENTALLOCATIONS "Allocazioni correnti cache" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "Memoria corrente allocata per la cache" - IDS_PERFMON_MAXALLOCATIONS "Numero massimo allocazioni cache" - IDS_PERFMON_MAXALLOCATIONS_HELP "Quantità massima di memoria allocata per la cache" - IDS_PERFMON_CURRENTENTRIES "Voci correnti cache" - IDS_PERFMON_CURRENTENTRIES_HELP "Numero corrente di voci della cache" - IDS_PERFMON_MAXENTRIES "Numero massimo voci cache" - IDS_PERFMON_MAXENTRIES_HELP "Numero massimo di voci della cache" - IDS_PERFMON_HITCOUNTRATE "Frequenza passaggi cache" - IDS_PERFMON_HITCOUNTRATE_HELP "Numero di passaggi al secondo" - IDS_PERFMON_REQUEST "Server ATL:Richiesta" - IDS_PERFMON_REQUEST_HELP "Statistica sulle richieste pervenute al server" - IDS_PERFMON_REQUEST_TOTAL "Richieste totali al server" - IDS_PERFMON_REQUEST_TOTAL_HELP "Numero totale di richieste" - IDS_PERFMON_REQUEST_FAILED "Richieste al server non riuscite" - IDS_PERFMON_REQUEST_FAILED_HELP "Numero di richieste non riuscite" - IDS_PERFMON_REQUEST_RATE "Richieste al server /sec" - IDS_PERFMON_REQUEST_RATE_HELP "Numero di richieste al secondo" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "Tempo medio di risposta" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "Tempo medio impiegato per la gestione di una richiesta" - IDS_PERFMON_REQUEST_CURR_WAITING "Richieste correnti in coda" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "Numero corrente di richieste in attesa di essere gestite" - IDS_PERFMON_REQUEST_MAX_WAITING "Numero massimo di richieste in coda" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "Numero massimo di richieste in attesa di essere gestite" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "Thread attivi" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "Numero di thread che gestiscono attivamente le richieste" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

Durante l'analisi di un file SRF, si è verificato il seguente errore:

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
Tipo di errore{{GetErrorText}}
Numero della riga{{GetErrorLineNumber}}
Testo dell'errore
{{GetErrorLine}}
\r\n{{endwhile}}
Output file SRF:\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} senza {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} senza {{endif}}" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} senza {{endwhile}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} senza {{while}}" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} senza {{if}}" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} senza {{if}} o {{else}}" - - IDS_STENCIL_INVALID_HANDLER "Tag di gestione non valido" - IDS_STENCIL_NULLPARAM "Parametro NULL in ParseReplacements" - IDS_STENCIL_INVALIDSTRING "Stringa vuota o negativa passata a ParseReplacements" - IDS_STENCIL_EMBEDDED_NULL "Carattere null incorporato in file SRF" - IDS_STENCIL_UNMATCHED_TAG_START "{{ non corrispondenti" - IDS_STENCIL_MISMATCHED_TAG_START "{{ non corrispondenti" - IDS_STENCIL_BAD_PARAMETER "Parametro non valido" - IDS_STENCIL_METHODNAME_TOO_LONG "Nome metodo troppo lungo" - IDS_STENCIL_HANDLERNAME_TOO_LONG "Nome gestore troppo lungo" - IDS_STENCIL_INVALID_SUBHANDLER "Tag di gestione secondaria non valida" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "Sostituzione non risolta: '%s'" - - IDS_STENCIL_INCLUDE_ERROR "Impossibile aprire il file incluso" - IDS_STENCIL_INCLUDE_INVALID "Il file incluso non è un file su disco" - - IDS_STENCIL_MLANG_COCREATE "Impossibile creare CMultiLanguage" - IDS_STENCIL_MLANG_LCID "Errore durante la ricerca di lcid" - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo non riuscito" - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo non riuscito" - - IDS_STENCIL_OUTOFMEMORY "Memoria insufficiente" - IDS_STENCIL_UNEXPECTED "Errore imprevisto" -END - -#endif diff --git a/include/atl/l.jpn/atlsrv.rc b/include/atl/l.jpn/atlsrv.rc deleted file mode 100644 index d908accdc..000000000 --- a/include/atl/l.jpn/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "•s“KØ‚È—v‹•s“KØ‚È—v‹" - IDS_ATLSRV_AUTH_REQUIRED - "”FØ‚ª•K—v‚Å‚·”FØ‚ª•K—v‚Å‚·" - IDS_ATLSRV_FORBIDDEN "Œ ŒÀ‚È‚µ/title></head><body>Œ ŒÀ‚È‚µ</body></html>" - IDS_ATLSRV_NOT_FOUND "<html><head><title>Œ©‚‚©‚è‚Ü‚¹‚ñŒ©‚‚©‚è‚Ü‚¹‚ñ" - IDS_ATLSRV_SERVER_ERROR "ƒT[ƒo[ ƒGƒ‰[ƒT[ƒo[ ƒGƒ‰[" - IDS_ATLSRV_NOT_IMPLEMENTED - "ŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ" - IDS_ATLSRV_BAD_GATEWAY "•s“K؂ȃQ[ƒgƒEƒFƒC•s“K؂ȃQ[ƒgƒEƒFƒC" - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "ƒT[ƒrƒX‚ªŽg—p‚Å‚«‚Ü‚¹‚ñƒT[ƒrƒX‚ªŽg—p‚Å‚«‚Ü‚¹‚ñ" - IDS_ATLSRV_SERVER_ERROR_BADSRF "ƒT[ƒo[ ƒGƒ‰[

Server Error

SRF ƒtƒ@ƒCƒ‹‚ð“Ç‚Ýž‚ß‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

—v‹‚³‚ꂽ SRF ƒtƒ@ƒCƒ‹‚Í“Ç‚Ýž‚ß‚Ü‚µ‚½‚ªA³í‚ɃvƒƒZƒX‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

Windows ƒVƒXƒeƒ€ ƒIƒuƒWƒFƒNƒg‚ð쬂ł«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

ƒtƒ@ƒCƒ‹‚Ì“Ç‚ÝŽæ‚葀삪‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

Žw’肳‚ꂽƒtƒ@ƒCƒ‹‚ðŠJ‚­‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_LOADLIB "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

LoadLibrary ‚ªŽ¸”s‚µ‚Ü‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

ƒnƒ“ƒhƒ‰—v‹ ƒCƒ“ƒ^[ƒtƒFƒCƒX‚ðŽæ“¾‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[‚̃ƒ‚ƒŠ‚ª•s‘«‚µ‚Ä‚¢‚Ü‚·B" - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[‚É—\Šú‚µ‚È‚¢ƒGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

—v‹‚³‚ꂽƒXƒeƒ“ƒVƒ‹‚ð‰ðÍ’†‚ÉAƒT[ƒo[‚É—\Šú‚µ‚È‚¢ƒGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ‚Í—v‹‚³‚ꂽƒXƒeƒ“ƒVƒ‹‚ð“Ç‚Ýž‚ß‚Ü‚¹‚ñ‚Å‚µ‚½BƒXƒeƒ“ƒVƒ‹ ƒtƒ@ƒCƒ‹‚ª‰ó‚ê‚Ä‚¢‚é‚©A‚±‚Ì Web ƒT[ƒo[‚É‚È‚¢‰Â”\«‚ª‚ ‚è‚Ü‚·B" - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

—v‹‚³‚ꂽƒXƒeƒ“ƒVƒ‹‚̃nƒ“ƒhƒ‰ ƒ^ƒO‚Å–¼‘OŽw’肳‚ꂽƒnƒ“ƒhƒ‰‚Ì 1 ‚‚ªŽw’肳‚ꂽƒnƒ“ƒhƒ‰ .dll ‚ÉŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

‚±‚̃Xƒeƒ“ƒVƒ‹‚ÍAƒXƒeƒ“ƒVƒ‹ ƒvƒƒZƒbƒT‚É‚æ‚Á‚Ä“K؂ɉðÍ‚Å‚«‚È‚¢ƒnƒ“ƒhƒ‰ ƒ^ƒO‚ðŠÜ‚ñ‚Å‚¢‚é‚©A‚Ü‚½‚̓nƒ“ƒhƒ‰ ƒ^ƒO‚ð‰½‚àŽ‚Á‚Ä‚¢‚Ü‚¹‚ñB—v‹‚µ‚½ƒXƒeƒ“ƒVƒ‹‚̃Xƒeƒ“ƒVƒ‹\•¶‚ª“KØ‚Å‚ ‚é‚©‚Ç‚¤‚©’m‚ç‚ׂĂ­‚¾‚³‚¢B" - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

—v‹‚³‚ꂽƒXƒeƒ“ƒVƒ‹‚̓nƒ“ƒhƒ‰ ƒ^ƒO‚ðŽ‚Á‚Ä‚¢‚Ü‚¹‚ñB" - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

—v‹‚³‚ꂽƒXƒeƒ“ƒVƒ‹‚Å’uŠ·ƒ^ƒO‚ªŒ©‚‚©‚è‚Ü‚µ‚½‚ªA’uŠ·–¼‚ª’·‚·‚¬‚Ü‚·B’uŠ·–¼‚ÌÅ‘åŒÀ‚Ì’·‚³‚ÍAatlstencil.h ‚Å’è‹`‚³‚ꂽ ATL_MAX_METHOD_NAME ’è” ‚Æ“¯‚¶‚©‚»‚ê‚æ‚è’Z‚­‚È‚­‚Ä‚Í‚È‚è‚Ü‚¹‚ñB" - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

ID.tagname \•¶‚ðŽg—p‚·‚é’uŠ·ƒ^ƒO‚ªA—v‹‚³‚ꂽƒXƒeƒ“ƒVƒ‹‚ÅŒ©‚‚©‚è‚Ü‚µ‚½‚ªA‚±‚̃^ƒO‚̃nƒ“ƒhƒ‰–¼‚Í’·‚·‚¬‚Ü‚·Bƒnƒ“ƒhƒ‰–¼‚ÌÅ‘åŒÀ‚Ì’·‚³‚ÍAatlstencil.h ‚Å’è‹`‚³‚ꂽ ATL_MAX_METHOD_NAME ’蔂Ɠ¯‚¶‚©‚»‚ê‚æ‚è’Z‚­‚È‚­‚Ä‚Í‚È‚è‚Ü‚¹‚ñB" - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "Server Error

Server Error

An attempt to impersonate the client making the request failed." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "ƒT[ƒo[ ƒGƒ‰[

ƒT[ƒo[ ƒGƒ‰[

‚±‚Ì—v‹‚É“š‚¦‚邽‚ß‚ÉŽg—p‚³‚ê‚é ISAPI Šg’£Žq‚ÍA—\Šú‚µ‚È‚¢ƒGƒ‰[‚Ì‚½‚ß³í‚É“Ç‚Ýž‚Ý‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "ƒq[ƒv‚Ì쬗v‹‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "ƒ[ƒJ[ ƒXƒŒƒbƒh‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "ƒNƒŠƒeƒBƒJƒ‹‚ȃZƒNƒVƒ‡ƒ“‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "ƒXƒŒƒbƒh ƒv[ƒ‹‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "DLL ƒLƒƒƒbƒVƒ…‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "ƒy[ƒW ƒLƒƒƒbƒVƒ…‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "ƒXƒeƒ“ƒVƒ‹ ƒLƒƒƒbƒVƒ…‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "ƒZƒbƒVƒ‡ƒ“ó‘ÔƒT[ƒrƒX‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Blob ƒLƒƒƒbƒVƒ…‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "ƒtƒ@ƒCƒ‹ ƒLƒƒƒbƒVƒ…‚̉Šú‰»‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B" - - IDS_PERFMON_CACHE "ATL ƒT[ƒo[ : ƒLƒƒƒbƒVƒ…" - IDS_PERFMON_CACHE_HELP "ATL ƒT[ƒo[ ƒLƒƒƒbƒVƒ…‚Ìî•ñ" - IDS_PERFMON_HITCOUNT "ƒLƒƒƒbƒVƒ…‚̃qƒbƒg ƒJƒEƒ“ƒg" - IDS_PERFMON_HITCOUNT_HELP "ƒLƒƒƒbƒVƒ… ƒqƒbƒg‚̉ñ”" - IDS_PERFMON_MISSCOUNT "ƒLƒƒƒbƒVƒ…‚̃~ƒX ƒJƒEƒ“ƒg" - IDS_PERFMON_MISSCOUNT_HELP "ƒLƒƒƒbƒVƒ…‚̃~ƒX ƒJƒEƒ“ƒg‚̉ñ”" - IDS_PERFMON_CURRENTALLOCATIONS "ƒLƒƒƒbƒVƒ…‚ÌŒ»Ý‚ÌŠ„‚è“–‚Ä" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "ƒLƒƒƒbƒVƒ…‚ÉŒ»ÝŠ„‚è“–‚Ä‚ç‚ê‚Ä‚¢‚郃‚ƒŠ" - IDS_PERFMON_MAXALLOCATIONS "ƒLƒƒƒbƒVƒ…‚ÌÅ‘å‚ÌŠ„‚è“–‚Ä" - IDS_PERFMON_MAXALLOCATIONS_HELP "ƒLƒƒƒbƒVƒ…‚ÉŠ„‚è“–‚Ä‚ç‚ꂽő僃‚ƒŠ" - IDS_PERFMON_CURRENTENTRIES "Œ»Ý‚̃LƒƒƒbƒVƒ… ƒGƒ“ƒgƒŠ" - IDS_PERFMON_CURRENTENTRIES_HELP "Œ»Ý‚̃LƒƒƒbƒVƒ… ƒGƒ“ƒgƒŠ‚Ì”" - IDS_PERFMON_MAXENTRIES "Å‘å‚̃LƒƒƒbƒVƒ… ƒGƒ“ƒgƒŠ" - IDS_PERFMON_MAXENTRIES_HELP "ƒLƒƒƒbƒVƒ… ƒGƒ“ƒgƒŠ‚ÌÅ‘å”" - IDS_PERFMON_HITCOUNTRATE "ƒLƒƒƒbƒVƒ…‚̃qƒbƒg ƒJƒEƒ“ƒg—¦" - IDS_PERFMON_HITCOUNTRATE_HELP "–ˆ•b‚̃qƒbƒg ƒJƒEƒ“ƒg”" - IDS_PERFMON_REQUEST "ATL ƒT[ƒo[ : —v‹" - IDS_PERFMON_REQUEST_HELP "ƒT[ƒo[‚É“ü‚Á‚Ä‚­‚é—v‹‚Ì“Œv" - IDS_PERFMON_REQUEST_TOTAL "ƒT[ƒo[—v‹‚Ì‘”" - IDS_PERFMON_REQUEST_TOTAL_HELP "—v‹‚Ì‘”" - IDS_PERFMON_REQUEST_FAILED "ƒT[ƒo[‚ª‰ž‚¶‚ç‚ê‚È‚©‚Á‚½—v‹ " - IDS_PERFMON_REQUEST_FAILED_HELP "‰ž‚¶‚ç‚ê‚È‚©‚Á‚½—v‹”" - IDS_PERFMON_REQUEST_RATE "ƒT[ƒo[—v‹ /sec" - IDS_PERFMON_REQUEST_RATE_HELP "–ˆ•b‚Ì—v‹”" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "•½‹Ï‚̉ž‘ÎŽžŠÔ" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "—v‹‚̈—‚É‚©‚©‚Á‚½•½‹ÏŽžŠÔ" - IDS_PERFMON_REQUEST_CURR_WAITING "Œ»ÝƒLƒ…[‚É‚ ‚é—v‹" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "Œ»Ý‰ž‘΂ð‘Ò‚Á‚Ä‚¢‚é—v‹”" - IDS_PERFMON_REQUEST_MAX_WAITING "ƒLƒ…[‚É‚ ‚é—v‹‚ÌÅ‘å”" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "‰ž‘΂ð‘Ò‚Á‚Ä‚¢‚é—v‹‚ÌÅ‘å”" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "ƒAƒNƒeƒBƒu ƒXƒŒƒbƒh" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "—v‹‚ðŒ»Ýˆ—’†‚̃XƒŒƒbƒh”" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{codepage 0}}

ƒXƒeƒ“ƒVƒ‹ ƒtƒ@ƒCƒ‹‚ð‰ðÍ’†‚ÉŽŸ‚̃Gƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½ :

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
ƒGƒ‰[‚ÌŽí—Þ{{GetErrorText}}
sƒiƒ“ƒo{{GetErrorLineNumber}}
ƒGƒ‰[ ƒeƒLƒXƒg
{{GetErrorLine}}
\r\n{{endwhile}}
ƒXƒeƒ“ƒVƒ‹o—Í‚ÍŽŸ‚̂悤‚É‚È‚Á‚Ä‚¢‚Ü‚· :\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} ‚É {{endif}} ‚ªŒ‡‚¯‚Ä‚¢‚Ü‚·" - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} ‚É {{endif}} ‚ªŒ‡‚¯‚Ä‚¢‚Ü‚·" - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} ‚É {{endwhile}} ‚ªŒ‡‚¯‚Ä‚¢‚Ü‚·" - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} ‚É {{while}} ‚ªŒ‡‚¯‚Ä‚¢‚Ü‚·" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} ‚É {{if}} ‚ªŒ‡‚¯‚Ä‚¢‚Ü‚·" - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} ‚É {{if}} or {{else}} ‚ªŒ‡‚¯‚Ä‚¢‚Ü‚·" - - IDS_STENCIL_INVALID_HANDLER "–³Œø‚ȃnƒ“ƒhƒ‰ ƒ^ƒO" - IDS_STENCIL_NULLPARAM "ParseReplacements ‚Ö‚Ì NULL ƒpƒ‰ƒ[ƒ^" - IDS_STENCIL_INVALIDSTRING "ParseReplacements ‚É‹óA‚Ü‚½‚Í•‰‚Ì•¶Žš—ñ‚ª“n‚³‚ê‚Ü‚µ‚½" - IDS_STENCIL_EMBEDDED_NULL "ƒXƒeƒ“ƒVƒ‹‚É –„‚ßž‚Ý‚Ì null •¶Žš‚ª‚ ‚è‚Ü‚·" - IDS_STENCIL_UNMATCHED_TAG_START "ˆê’v‚µ‚Ü‚¹‚ñ {{" - IDS_STENCIL_MISMATCHED_TAG_START "ˆê’v‚µ‚Ü‚¹‚ñ {{" - IDS_STENCIL_BAD_PARAMETER "•s“K؂ȃpƒ‰ƒ[ƒ^‚Å‚·" - IDS_STENCIL_METHODNAME_TOO_LONG "ƒƒ\ƒbƒh–¼‚ª’·‚·‚¬‚Ü‚·" - IDS_STENCIL_HANDLERNAME_TOO_LONG "ƒnƒ“ƒhƒ‰–¼‚ª’·‚·‚¬‚Ü‚·" - IDS_STENCIL_INVALID_SUBHANDLER "ƒTƒuƒnƒ“ƒhƒ‰ ƒ^ƒO‚ª–³Œø‚Å‚·" - IDS_STENCIL_UNRESOLVED_REPLACEMENT "’uŠ·‚ð‰ðŒˆ‚Å‚«‚Ü‚¹‚ñ : '%s'" - - IDS_STENCIL_INCLUDE_ERROR "“Y•tƒtƒ@ƒCƒ‹‚ðŠJ‚¯‚Ü‚¹‚ñ" - IDS_STENCIL_INCLUDE_INVALID "“Y•tƒtƒ@ƒCƒ‹‚̓fƒBƒXƒN ƒtƒ@ƒCƒ‹‚Å‚Í‚ ‚è‚Ü‚¹‚ñ" - - IDS_STENCIL_MLANG_COCREATE "CMultiLanguage ‚ð쬂ł«‚Ü‚¹‚ñ‚Å‚µ‚½" - IDS_STENCIL_MLANG_LCID "lcid Žæ“¾‚̃Gƒ‰[‚Å‚·" - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo ‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½" - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo ‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½" - - IDS_STENCIL_OUTOFMEMORY "ƒƒ‚ƒŠ‚ª‚ ‚è‚Ü‚¹‚ñ" - IDS_STENCIL_UNEXPECTED "—\Šú‚µ‚È‚¢ƒGƒ‰[‚Å‚·" -END - -#endif diff --git a/include/atl/l.kor/atlsrv.rc b/include/atl/l.kor/atlsrv.rc deleted file mode 100644 index 54208d9ca..000000000 --- a/include/atl/l.kor/atlsrv.rc +++ /dev/null @@ -1,146 +0,0 @@ -// This is a part of the Active Template Library. -// Copyright (C) Microsoft Corporation -// All rights reserved. -// -// This source code is only intended as a supplement to the -// Active Template Library Reference and related -// electronic documentation provided with the library. -// See these sources for detailed information regarding the -// Active Template Library product. - -#include -#include "atlsrvres.h" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ATLSRV_BAD_REQUEST "À߸øµÈ ¿äûÀ߸øµÈ ¿äûÀÔ´Ï´Ù." - IDS_ATLSRV_AUTH_REQUIRED - "ÀÎÁõ ÇÊ¿äÀÎÁõÀÌ ÇÊ¿äÇÕ´Ï´Ù." - IDS_ATLSRV_FORBIDDEN "±ÝÁöµÊ±ÝÁöµÇ¾ú½À´Ï´Ù." - IDS_ATLSRV_NOT_FOUND "ãÀ» ¼ö ¾øÀ½Ã£À» ¼ö ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR "¼­¹ö ¿À·ù¼­¹ö ¿À·ù" - IDS_ATLSRV_NOT_IMPLEMENTED - "±¸Çö ¾ÈµÊ±¸ÇöµÇÁö ¾Ê¾Ò½À´Ï´Ù." - IDS_ATLSRV_BAD_GATEWAY "À߸øµÈ °ÔÀÌÆ®¿þÀÌÀ߸øµÈ °ÔÀÌÆ®¿þÀÌÀÔ´Ï´Ù." - IDS_ATLSRV_SERVICE_NOT_AVAILABLE - "¼­ºñ½º¸¦ »ç¿ëÇÒ ¼ö ¾øÀ½¼­ºñ½º¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_BADSRF "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

SRF ÆÄÀÏÀ» ·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_HNDLFAIL "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¿äûÇÑ SRF ÆÄÀÏÀ» ·ÎµåÇßÁö¸¸ ó¸®ÇÒ ¼ö ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_SYSOBJFAIL "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

Windows ½Ã½ºÅÛ °³Ã¼¸¦ ¸¸µé ¼ö ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_READFILEFAIL "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

ÆÄÀÏ Àбâ ÀÛ¾÷À» ¼öÇàÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_LOADFILEFAIL "Server Error

Server Error

ÁöÁ¤ÇÑ ÆÄÀÏÀ» ¿­ ¼ö ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_LOADLIB "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

LoadLibrary È£ÃâÀÌ ½ÇÆÐÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_HANDLERIF "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¿äûÇÑ Ã³¸®±â ÀÎÅÍÆäÀ̽º¸¦ °¡Á®¿ÀÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_OUTOFMEM "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¼­¹öÀÇ ¸Þ¸ð¸®°¡ ºÎÁ·ÇÕ´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_UNEXPECTED "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¼­¹ö¿¡¼­ ¿¹±âÄ¡ ¾ÊÀº ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_STENCILPARSEFAIL "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¿äûÇÑ ½ºÅÙ½ÇÀ» ±¸¹® ºÐ¼®ÇÏ´Â µ¿¾È ¼­¹ö¿¡¼­ ¿¹±âÄ¡ ¾ÊÀº ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_STENCILLOADFAIL "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¿äûÇÑ ½ºÅÙ½ÇÀ» ¼­¹ö¿¡¼­ ·ÎµåÇÏÁö ¸øÇß½À´Ï´Ù. ½ºÅÙ½Ç ÆÄÀÏÀÌ ¼Õ»óµÇ¾ú°Å³ª À¥ ¼­¹ö¿¡ ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_HANDLERNOTFOUND "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

ÁöÁ¤ÇÑ Ã³¸®±â .dll¿¡ ¿äûÇÑ ½ºÅÙ½ÇÀÇ Ã³¸®±â ű׿¡ ¸í¸íµÈ 󸮱â Áß Çϳª°¡ ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_BADHANDLERTAG "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

ÀÌ ½ºÅٽǿ¡´Â 󸮱â űװ¡ ¾ø°Å³ª ½ºÅÙ½Ç ÇÁ·Î¼¼¼­¿¡¼­ Á¦´ë·Î ó¸®ÇÒ ¼ö Àִ ó¸®±â űװ¡ ¾ø½À´Ï´Ù. ¿äûÇÑ ½ºÅÙ½ÇÀ» È®ÀÎÇÏ¿© ½ºÅÙ½Ç ±¸¹®ÀÌ ¿Ã¹Ù¸¥Áö °ËÅäÇØ º¸½Ê½Ã¿À." - IDS_ATLSRV_SERVER_ERROR_NOHANDLERTAG "¼­¹ö ¿À·ù

¼­¹ö ¿À·ùServer Error

¿äûÇÑ ½ºÅٽǿ¡ 󸮱â űװ¡ ¾ø½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_LONGMETHODNAME "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¿äûÇÑ ½ºÅÙ½ÇÀÇ ´ëü ÅÂ±× À̸§ÀÌ ³Ê¹« ±é´Ï´Ù. ÀÌ °æ¿ì ¹Ù²Ü À̸§ÀÇ ÃÖ´ë ±æÀÌ´Â atlstencil.h¿¡ Á¤ÀÇµÈ ATL_MAX_METHOD_NAME »ó¼öº¸´Ù À۰ųª °°¾Æ¾ß ÇÕ´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_LONGHANDLERNAME "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¿äûÇÑ ½ºÅÙ½ÇÀÇ id.tagnameÀ» »ç¿ëÇÏ´Â ´ëü ű×ÀÇ Ã³¸®±â À̸§ÀÌ ³Ê¹« ±é´Ï´Ù. ÀÌ °æ¿ì 󸮱â À̸§ÀÇ ÃÖ´ë ±æÀÌ´Â atlstencil.h¿¡ Á¤ÀÇµÈ ATL_MAX_METHOD_NAME »ó¼öº¸´Ù À۰ųª °°¾Æ¾ß ÇÕ´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_IMPERSONATIONFAILED "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

Ŭ¶óÀ̾ðÆ®¸¦ °¡ÀåÇ߱⠶§¹®¿¡ ¿äûÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_ISAPISTARTUPFAILED "¼­¹ö ¿À·ù

¼­¹ö ¿À·ù

¾Ë ¼ö ¾ø´Â ¿À·ù·Î ÀÎÇØ ÀÌ ¿äûÀ» ó¸®ÇÏ´Â µ¥ »ç¿ëµÈ ISAPI ÀͽºÅÙ¼ÇÀ» Á¦´ë·Î ·ÎµåÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_SERVER_ERROR_SOAPNOSOAPACTION "Server Error

Server Error

SOAP request did not provide SOAPACTION header." - - IDS_ATLSRV_CRITICAL_HEAPCREATEFAILED "¿äû ÈüÀ» ÀÛ¼ºÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_WORKERINITFAILED "ÀÛ¾÷ÀÚ ½º·¹µå¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_CRITSECINITFAILED "ÀÓ°è ¼½¼ÇÀ» ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_THREADPOOLFAILED "½º·¹µå Ç®À» ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_DLLCACHEFAILED "DLL ij½Ã¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_PAGECACHEFAILED "ÆäÀÌÁö ij½Ã¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_STENCILCACHEFAILED "½ºÅÙ½Ç Ä³½Ã¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_SESSIONSTATEFAILED "¼¼¼Ç »óÅ ¼­ºñ½º¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_BLOBCACHEFAILED "Blob ij½Ã¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - IDS_ATLSRV_CRITICAL_FILECACHEFAILED "ÆÄÀÏ Ä³½Ã¸¦ ÃʱâÈ­ÇÏÁö ¸øÇß½À´Ï´Ù." - - IDS_PERFMON_CACHE "ATL ¼­¹ö:ij½Ã" - IDS_PERFMON_CACHE_HELP "ATL ¼­¹ö ij½Ã¿¡ ´ëÇÑ Á¤º¸" - IDS_PERFMON_HITCOUNT "ij½Ã ÀûÁß È½¼ö" - IDS_PERFMON_HITCOUNT_HELP "ij½Ã ÀûÁß È½¼ö" - IDS_PERFMON_MISSCOUNT "ij½Ã ÀûÁß ½ÇÆРȽ¼ö" - IDS_PERFMON_MISSCOUNT_HELP "ij½Ã ÀûÁß ½ÇÆРȽ¼ö" - IDS_PERFMON_CURRENTALLOCATIONS "ÇöÀç ij½Ã ÇÒ´ç·®" - IDS_PERFMON_CURRENTALLOCATIONS_HELP "ij½Ã·Î ÇÒ´çµÈ ÇöÀç ¸Þ¸ð¸® ¾ç" - IDS_PERFMON_MAXALLOCATIONS "ÃÖ´ë ij½Ã ÇÒ´ç·®" - IDS_PERFMON_MAXALLOCATIONS_HELP "ij½Ã·Î ÇÒ´çµÈ ÃÖ´ë ¸Þ¸ð¸® ¾ç" - IDS_PERFMON_CURRENTENTRIES "ÇöÀç ij½Ã ¿£Æ®¸®" - IDS_PERFMON_CURRENTENTRIES_HELP "ÇöÀç ij½Ã ¿£Æ®¸® ¼ö" - IDS_PERFMON_MAXENTRIES "ÃÖ´ë ij½Ã ¿£Æ®¸®" - IDS_PERFMON_MAXENTRIES_HELP "ÃÖ´ë ij½Ã ¿£Æ®¸® ¼ö" - IDS_PERFMON_HITCOUNTRATE "ij½Ã ÀûÁß·ü" - IDS_PERFMON_HITCOUNTRATE_HELP "ÃÊ ´ç ÀûÁß È½¼ö" - IDS_PERFMON_REQUEST "ATL ¼­¹ö:¿äû" - IDS_PERFMON_REQUEST_HELP "¼­¹ö¿¡ Àü´ÞµÇ´Â ¿äû¿¡ ´ëÇÑ Åë°è" - IDS_PERFMON_REQUEST_TOTAL "¼­¹ö ÃÑ ¿äû ¼ö" - IDS_PERFMON_REQUEST_TOTAL_HELP "ÃÑ ¿äû ¼ö" - IDS_PERFMON_REQUEST_FAILED "¼­¹ö ½ÇÆÐ ¿äû ¼ö" - IDS_PERFMON_REQUEST_FAILED_HELP "½ÇÆÐÇÑ ¿äû ¼ö" - IDS_PERFMON_REQUEST_RATE "¼­¹ö ¿äû ¼ö/ÃÊ" - IDS_PERFMON_REQUEST_RATE_HELP "ÃÊ ´ç ¿äû ¼ö" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME "Æò±Õ ÀÀ´ä ½Ã°£" - IDS_PERFMON_REQUEST_AVG_RESPONSE_TIME_HELP "¿äû ó¸® Æò±Õ ¼Ò¿ä ½Ã°£" - IDS_PERFMON_REQUEST_CURR_WAITING "´ë±â¿­¿¡ ÀÖ´Â ÇöÀç ¿äû" - IDS_PERFMON_REQUEST_CURR_WAITING_HELP "ó¸® ´ë±â ÁßÀÎ ÇöÀç ¿äû ¼ö" - IDS_PERFMON_REQUEST_MAX_WAITING "ÃÖ´ë ´ë±â ¿äû ¼ö" - IDS_PERFMON_REQUEST_MAX_WAITING_HELP "ó¸® ´ë±â °¡´ÉÇÑ ÃÖ´ë ¿äû ¼ö" - IDS_PERFMON_REQUEST_ACTIVE_THREADS "È°¼º ½º·¹µå" - IDS_PERFMON_REQUEST_ACTIVE_THREADS_HELP "¿äûÀ» ´ëÈ­ÇüÀ¸·Î ó¸®ÇÏ´Â ½º·¹µå ¼ö" -END - - -#ifndef ATL_NO_DEFAULT_STENCIL_RESOURCE -dllmgr.srf HTML "res\\dllmgr.srf" -stencilmgr.srf HTML "res\\stencilmgr.srf" -threadmgr.srf HTML "res\\threadmgr.srf" -#endif - - -// -// Stencil parse error support -// -#ifdef ATL_DEBUG_STENCILS - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STENCIL_ERROR_STENCIL -"{{ÄÚµå ÆäÀÌÁö 0}}

½ºÅÙ½Ç ÆÄÀÏÀ» ±¸¹® ºÐ¼®ÇÏ´Â µ¿¾È ´ÙÀ½ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.

\r\n{{while GetNextError}}\r\n\r\n\r\n\r\n
¿À·ù Çü½Ä{{GetErrorText}}
ÁÙ ¹øÈ£{{GetErrorLineNumber}}
¿À·ù ÅؽºÆ®
{{GetErrorLine}}
\r\n{{endwhile}}
½ºÅÙ½Ç Ãâ·ÂÀº ´ÙÀ½°ú °°½À´Ï´Ù.\r\n
" - - IDS_STENCIL_UNCLOSEDBLOCK_IF "{{if}} ¹®¿¡ {{endif}}°¡ ¾ø½À´Ï´Ù." - IDS_STENCIL_UNCLOSEDBLOCK_ELSE "{{else}} ¹®¿¡ {{endif}}°¡ ¾ø½À´Ï´Ù." - IDS_STENCIL_UNCLOSEDBLOCK_WHILE "{{while}} ¹®¿¡ {{endwhile}}ÀÌ ¾ø½À´Ï´Ù." - IDS_STENCIL_UNOPENEDBLOCK_ENDWHILE "{{endwhile}} ¹®¿¡ {{while}}ÀÌ ¾ø½À´Ï´Ù" - IDS_STENCIL_UNOPENEDBLOCK_ELSE "{{else}} ¹®¿¡ {{if}}°¡ ¾ø½À´Ï´Ù." - IDS_STENCIL_UNOPENEDBLOCK_ENDIF "{{endif}} ¹®¿¡ {{if}} ¶Ç´Â {{else}}°¡ ¾ø½À´Ï´Ù." - - IDS_STENCIL_INVALID_HANDLER "󸮱â űװ¡ À߸øµÇ¾ú½À´Ï´Ù." - IDS_STENCIL_NULLPARAM "ParseReplacements¿¡ ´ëÇÑ ¸Å°³ º¯¼ö°¡ NULLÀÔ´Ï´Ù." - IDS_STENCIL_INVALIDSTRING "ºñ¾î Àְųª À½¼öÀÎ ¹®ÀÚ¿­ÀÌ ParseReplacements¿¡ Àü´ÞµÇ¾ú½À´Ï´Ù." - IDS_STENCIL_EMBEDDED_NULL "½ºÅٽǿ¡ Æ÷ÇÔµÈ null ¹®ÀÚ°¡ ÀÖ½À´Ï´Ù." - IDS_STENCIL_UNMATCHED_TAG_START "{{°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù." - IDS_STENCIL_MISMATCHED_TAG_START "{{°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù." - IDS_STENCIL_BAD_PARAMETER "¸Å°³ º¯¼ö°¡ À߸øµÇ¾ú½À´Ï´Ù." - IDS_STENCIL_METHODNAME_TOO_LONG "¸Þ¼­µå À̸§ÀÌ ³Ê¹« ±é´Ï´Ù." - IDS_STENCIL_HANDLERNAME_TOO_LONG "󸮱â À̸§ÀÌ ³Ê¹« ±é´Ï´Ù." - IDS_STENCIL_INVALID_SUBHANDLER "ÇÏÀ§ 󸮱â űװ¡ À߸øµÇ¾ú½À´Ï´Ù." - IDS_STENCIL_UNRESOLVED_REPLACEMENT "´ëü ¹®À» È®ÀÎÇÒ ¼ö ¾ø½À´Ï´Ù: '%s'" - - IDS_STENCIL_INCLUDE_ERROR "Æ÷ÇÔµÈ ÆÄÀÏÀ» ¿­ ¼ö ¾ø½À´Ï´Ù." - IDS_STENCIL_INCLUDE_INVALID "Æ÷ÇÔµÈ ÆÄÀÏÀÌ µð½ºÅ© ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù." - - IDS_STENCIL_MLANG_COCREATE "CMultiLanguage¸¦ ¸¸µé ¼ö ¾ø½À´Ï´Ù." - IDS_STENCIL_MLANG_LCID "lcid¸¦ °¡Á®¿À´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù." - IDS_STENCIL_MLANG_GETLOCALE "GetLocaleInfo°¡ ½ÇÆÐÇß½À´Ï´Ù." - IDS_STENCIL_MLANG_GETCHARSET "GetCharsetInfo°¡ ½ÇÆÐÇß½À´Ï´Ù." - - IDS_STENCIL_OUTOFMEMORY "¸Þ¸ð¸®°¡ ºÎÁ·ÇÕ´Ï´Ù." - IDS_STENCIL_UNEXPECTED "¿¹±âÄ¡ ¾ÊÀº ¿À·ùÀÔ´Ï´Ù." -END - -#endif diff --git a/include/atl/readme.txt b/include/atl/readme.txt deleted file mode 100644 index 4737d2cc1..000000000 --- a/include/atl/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -ATL Server Library and Tools -http://www.codeplex.com/AtlServer/Release/ProjectReleases.aspx?ReleaseId=3754 \ No newline at end of file diff --git a/include/atl/res/dllmgr.srf b/include/atl/res/dllmgr.srf deleted file mode 100644 index 45f9c7049..000000000 --- a/include/atl/res/dllmgr.srf +++ /dev/null @@ -1,29 +0,0 @@ - - - - -

ATL Server DLL Cache Manager

- -Current DLL Cache Entries: {{GetNumEntries}}

- - - - -{{while EnumEntries}} - -{{endwhile}} - -
DLL PathRef Count
{{GetDllName}}{{GetDllReferences}}
- - - \ No newline at end of file diff --git a/include/atl/res/stencilmgr.srf b/include/atl/res/stencilmgr.srf deleted file mode 100644 index f0ca82fa3..000000000 --- a/include/atl/res/stencilmgr.srf +++ /dev/null @@ -1,69 +0,0 @@ - - - -

- ATL Server Stencil Cache Management -

- - - - {{while GetNextStencilCacheStats}} - - - - - {{endwhile}} -
- ValueQuantity
{{GetCacheValue}}{{GetCacheQuantity}}
-
- - -
- -
- -
- - - diff --git a/include/atl/res/threadmgr.srf b/include/atl/res/threadmgr.srf deleted file mode 100644 index fd322be77..000000000 --- a/include/atl/res/threadmgr.srf +++ /dev/null @@ -1,24 +0,0 @@ - - - -

- ATL Server Thread Pool Management -

- This server's thread pool is currently using {{GetSize}} threads.

-

- - Enter a new thread pool size: - -
- - diff --git a/include/aviutl/filter.h b/include/aviutl/filter.h deleted file mode 100644 index 97e28a41f..000000000 --- a/include/aviutl/filter.h +++ /dev/null @@ -1,476 +0,0 @@ -#pragma once - -typedef struct {short y, cb, cr;} PIXEL_YC; -typedef struct {unsigned char b, g, r;} PIXEL; - -// ƒtƒBƒ‹ƒ^PROC—p\‘¢‘Ì -typedef struct { - int flag; // ƒtƒBƒ‹ƒ^‚̃tƒ‰ƒO - PIXEL_YC *ycp_edit; // ‰æ‘œƒf[ƒ^‚ւ̃|ƒCƒ“ƒ^ - PIXEL_YC *ycp_temp; // ƒeƒ“ƒ|ƒ‰ƒŠ—̈æ‚ւ̃|ƒCƒ“ƒ^ - int w,h; // Œ»Ý‚̉摜‚̃TƒCƒY - int max_w,max_h; // ‰æ‘œ—̈æ‚̃TƒCƒY - int frame; // Œ»Ý‚̃tƒŒ[ƒ€”Ô†(”Ô†‚Í0‚©‚ç) - int frame_n; // ‘ƒtƒŒ[ƒ€” - int org_w,org_h; // Œ³‚̉摜‚̃TƒCƒY - short *audiop; // ƒI[ƒfƒBƒIƒf[ƒ^‚ւ̃|ƒCƒ“ƒ^ ( ƒI[ƒfƒBƒIƒtƒBƒ‹ƒ^‚ÌŽž‚Ì‚Ý ) - // ƒI[ƒfƒBƒIŒ`Ž®‚ÍPCM16bit‚Å‚· ( 1ƒTƒ“ƒvƒ‹‚Í mono = 2byte , stereo = 4byte ) - int audio_n; // ƒI[ƒfƒBƒIƒTƒ“ƒvƒ‹‚Ì‘” - int audio_ch; // ƒI[ƒfƒBƒIƒ`ƒƒƒ“ƒlƒ‹” - PIXEL *pixelp; // DIBŒ`Ž®‚̃f[ƒ^‚ւ̃|ƒCƒ“ƒ^( •\Ž¦ƒtƒBƒ‹ƒ^‚ÌŽž‚Ì‚Ý ) - void *editp; // ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - int reserve[10]; // Šg’£—p‚É—\–ñ‚³‚ê‚Ä‚Ü‚· -} FILTER_PROC_INFO; - -#define FILTER_PROC_INFO_FLAG_FILL_OVERAREA 1 -#define FILTER_PROC_INFO_FLAG_MASK 0x0fffffff - -// ƒtƒŒ[ƒ€ƒXƒe[ƒ^ƒX\‘¢‘Ì -typedef struct { - int video; // ŽÀۂ̉f‘œƒf[ƒ^”Ô† - int audio; // ŽÀۂ̉¹ºƒf[ƒ^”Ô† - int inter; // ƒtƒŒ[ƒ€‚̃Cƒ“ƒ^[ƒŒ[ƒX - // FRAME_STATUS_INTER_NORMAL : •W€ - // FRAME_STATUS_INTER_REVERSE : ”½“] - // FRAME_STATUS_INTER_ODD : Šï” - // FRAME_STATUS_INTER_EVEN : ‹ô” - // FRAME_STATUS_INTER_MIX : “ñd‰» - // FRAME_STATUS_INTER_AUTO : Ž©“® - int index24fps; // 24fp‚ÌŽüŠú - int config; // ƒtƒŒ[ƒ€‚ÌÝ’èŠÂ‹«‚̔Ԇ - int vcm; // ƒtƒŒ[ƒ€‚̈³kÝ’è‚̔Ԇ - int edit_flag; // •ÒWƒtƒ‰ƒO - // EDIT_FRAME_EDIT_FLAG_KEYFRAME : ƒL[ƒtƒŒ[ƒ€ - // EDIT_FRAME_EDIT_FLAG_MARKFRAME : ƒ}[ƒNƒtƒŒ[ƒ€ - // EDIT_FRAME_EDIT_FLAG_DELFRAME : —DæŠÔˆø‚«ƒtƒŒ[ƒ€ - // EDIT_FRAME_EDIT_FLAG_NULLFRAME : ƒRƒs[ƒtƒŒ[ƒ€ - int reserve[9]; // Šg’£—p‚É—\–ñ‚³‚ê‚Ä‚Ü‚· -} FRAME_STATUS; - -#define FRAME_STATUS_INTER_NORMAL 0 -#define FRAME_STATUS_INTER_REVERSE 1 -#define FRAME_STATUS_INTER_ODD 2 -#define FRAME_STATUS_INTER_EVEN 3 -#define FRAME_STATUS_INTER_MIX 4 -#define FRAME_STATUS_INTER_AUTO 5 -#define EDIT_FRAME_EDIT_FLAG_KEYFRAME 1 -#define EDIT_FRAME_EDIT_FLAG_MARKFRAME 2 -#define EDIT_FRAME_EDIT_FLAG_DELFRAME 4 -#define EDIT_FRAME_EDIT_FLAG_NULLFRAME 8 - -// ƒtƒ@ƒCƒ‹ƒCƒ“ƒtƒHƒ[ƒVƒ‡ƒ“\‘¢‘Ì -typedef struct { - int flag; // ƒtƒ@ƒCƒ‹‚̃tƒ‰ƒO - // FILE_INFO_FLAG_VIDEO : ‰f‘œ‚ª‘¶Ý‚·‚é - // FILE_INFO_FLAG_AUDIO : ‰¹º‚ª‘¶Ý‚·‚é - LPSTR name; // •ÒWƒtƒ@ƒCƒ‹–¼ - int w,h; // Œ³‚̃TƒCƒY - int video_rate,video_scale; // ƒtƒŒ[ƒ€ƒŒ[ƒg - int audio_rate; // ‰¹ºƒTƒ“ƒvƒŠƒ“ƒOƒŒ[ƒg - int audio_ch; // ‰¹ºƒ`ƒƒƒ“ƒlƒ‹” - int reserve[8]; // Šg’£—p‚É—\–ñ‚³‚ê‚Ä‚Ü‚· -} FILE_INFO; - -#define FILE_INFO_FLAG_VIDEO 1 -#define FILE_INFO_FLAG_AUDIO 2 - -// ƒVƒXƒeƒ€ƒCƒ“ƒtƒHƒ[ƒVƒ‡ƒ“\‘¢‘Ì -typedef struct { - int flag; // ƒVƒXƒeƒ€ƒtƒ‰ƒO - // SYS_INFO_FLAG_EDIT : •ÒW’† - // SYS_INFO_FLAG_VFAPI : VFAPI“®ìŽž - LPSTR info; // ƒo[ƒWƒ‡ƒ“î•ñ - int filter_n; // “o˜^‚³‚ê‚Ä‚éƒtƒBƒ‹ƒ^‚Ì” - int min_w,min_h; // •ÒWo—ˆ‚éŬ‰æ‘œƒTƒCƒY - int max_w,max_h; // •ÒWo—ˆ‚éÅ‘å‰æ‘œƒTƒCƒY - int max_frame; // •ÒWo—ˆ‚éÅ‘åƒtƒŒ[ƒ€” - LPSTR edit_name; // •ÒWƒtƒ@ƒCƒ‹–¼ (ƒtƒ@ƒCƒ‹–¼‚ªŒˆ‚Ü‚Á‚Ä‚¢‚È‚¢Žž‚͉½‚à“ü‚Á‚Ä‚¢‚Ü‚¹‚ñ) - LPSTR project_name; // ƒvƒƒWƒFƒNƒgƒtƒ@ƒCƒ‹–¼ (ƒtƒ@ƒCƒ‹–¼‚ªŒˆ‚Ü‚Á‚Ä‚¢‚È‚¢Žž‚͉½‚à“ü‚Á‚Ä‚¢‚Ü‚¹‚ñ) - LPSTR output_name; // o—̓tƒ@ƒCƒ‹–¼ (ƒtƒ@ƒCƒ‹–¼‚ªŒˆ‚Ü‚Á‚Ä‚¢‚È‚¢Žž‚͉½‚à“ü‚Á‚Ä‚¢‚Ü‚¹‚ñ) - int reserve[8]; // Šg’£—p‚É—\–ñ‚³‚ê‚Ä‚Ü‚· -} SYS_INFO; - -#define SYS_INFO_FLAG_EDIT 1 -#define SYS_INFO_FLAG_VFAPI 2 - -// ŠO•”ŠÖ”\‘¢‘Ì -typedef struct { - void *(*get_ycp_ofs)( void *editp,int n,int ofs ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚ÌAVIƒtƒ@ƒCƒ‹ã‚ł̃IƒtƒZƒbƒg•ªˆÚ“®‚µ‚½ - // ƒtƒŒ[ƒ€‚̉摜ƒf[ƒ^‚̃|ƒCƒ“ƒ^‚ðŽæ“¾‚µ‚Ü‚· - // ƒf[ƒ^‚̓tƒBƒ‹ƒ^‘O‚Ì‚à‚Ì‚Å‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // ofs : ƒtƒŒ[ƒ€‚©‚ç‚̃IƒtƒZƒbƒg - // –ß‚è’l : ‰æ‘œƒf[ƒ^‚ւ̃|ƒCƒ“ƒ^ (NULL‚Ȃ玸”s) - void *(*get_ycp)( void *editp,int n ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚̉摜ƒf[ƒ^‚̃|ƒCƒ“ƒ^‚ðŽæ“¾‚µ‚Ü‚· - // ƒf[ƒ^‚̓tƒBƒ‹ƒ^‘O‚Ì‚à‚Ì‚Å‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : ‰æ‘œƒf[ƒ^‚ւ̃|ƒCƒ“ƒ^ (NULL‚Ȃ玸”s) - void *(*get_pixelp)( void *editp,int n ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚ÌDIBŒ`Ž®(RGB24bit)‚̉摜ƒf[ƒ^‚̃|ƒCƒ“ƒ^‚ðŽæ“¾‚µ‚Ü‚· - // ƒf[ƒ^‚̓tƒBƒ‹ƒ^‘O‚Ì‚à‚Ì‚Å‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : DIBŒ`Ž®ƒf[ƒ^‚ւ̃|ƒCƒ“ƒ^ (NULL‚Ȃ玸”s) - int (*get_audio)( void *editp,int n,void *buf ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚̃I[ƒfƒBƒIƒf[ƒ^‚ð“Ç‚Ýž‚Ý‚Ü‚· - // ƒf[ƒ^‚̓tƒBƒ‹ƒ^‘O‚Ì‚à‚Ì‚Å‚· - // editp* : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // buf : Ši”[‚·‚éƒoƒbƒtƒ@ - // –ß‚è’l : “Ç‚Ýž‚ñ‚¾ƒTƒ“ƒvƒ‹” - BOOL (*is_editing)( void *editp ); - // Œ»Ý•ÒW’†‚©’²‚ׂ܂· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // –ß‚è’l : TRUE‚È‚ç•ÒW’† - BOOL (*is_saving)( void *editp ); - // Œ»Ý•Û‘¶’†‚©’²‚ׂ܂· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // –ß‚è’l : TRUE‚È‚ç•Û‘¶’† - int (*get_frame)( void *editp ); - // Œ»Ý‚Ì•\Ž¦ƒtƒŒ[ƒ€‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // –ß‚è’l : Œ»Ý‚̃tƒŒ[ƒ€”Ô† - int (*get_frame_n)( void *editp ); - // ‘ƒtƒŒ[ƒ€”‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // –ß‚è’l : Œ»Ý‚Ì‘ƒtƒŒ[ƒ€” - BOOL (*get_frame_size)( void *editp,int *w,int *h ); - // ƒtƒBƒ‹ƒ^‘O‚̃tƒŒ[ƒ€‚̃TƒCƒY‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // w,h : ‰æ‘œƒTƒCƒY‚ÌŠi”[ƒ|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - int (*set_frame)( void *editp,int n ); - // Œ»Ý‚Ì•\Ž¦ƒtƒŒ[ƒ€‚ð•ÏX‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : ݒ肳‚ꂽƒtƒŒ[ƒ€”Ô† - int (*set_frame_n)( void *editp,int n ); - // ‘ƒtƒŒ[ƒ€”‚ð•ÏX‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€” - // –ß‚è’l : ݒ肳‚ꂽ‘ƒtƒŒ[ƒ€” - BOOL (*copy_frame)( void *editp,int d,int s ); - // ƒtƒŒ[ƒ€‚𑼂̃tƒŒ[ƒ€‚ɃRƒs[‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // d : ƒRƒs[æƒtƒŒ[ƒ€”Ô† - // s : ƒRƒs[Œ³ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*copy_video)( void *editp,int d,int s ); - // ƒtƒŒ[ƒ€‚̉f‘œ‚¾‚¯‚𑼂̃tƒŒ[ƒ€‚ɃRƒs[‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // d : ƒRƒs[æƒtƒŒ[ƒ€”Ô† - // s : ƒRƒs[Œ³ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*copy_audio)( void *editp,int d,int s ); - // ƒtƒŒ[ƒ€‚̉¹º‚¾‚¯‚𑼂̃tƒŒ[ƒ€‚ɃRƒs[‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // d : ƒRƒs[æƒtƒŒ[ƒ€”Ô† - // s : ƒRƒs[Œ³ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*copy_clip)( HWND hwnd,void *pixelp,int w,int h ); - // ƒNƒŠƒbƒvƒ{[ƒh‚ÉDIBŒ`Ž®(RGB24bit)‚̉摜‚ðƒRƒs[‚µ‚Ü‚· - // hwnd : ƒEƒBƒ“ƒhƒEƒnƒ“ƒhƒ‹ - // pixelp : DIBŒ`Ž®ƒf[ƒ^‚ւ̃|ƒCƒ“ƒ^ - // w,h : ‰æ‘œƒTƒCƒY - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*paste_clip)( HWND hwnd,void *editp,int n ); - // ƒNƒŠƒbƒvƒ{[ƒh‚©‚ç‰æ‘œ‚𒣂è‚‚¯‚Ü‚· - // hwnd : ƒEƒBƒ“ƒhƒEƒnƒ“ƒhƒ‹ - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*get_frame_status)( void *editp,int n,FRAME_STATUS *fsp ); - // ƒtƒŒ[ƒ€‚̃Xƒe[ƒ^ƒX‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // fps : ƒtƒŒ[ƒ€ƒXƒe[ƒ^ƒX‚ւ̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*set_frame_status)( void *editp,int n,FRAME_STATUS *fsp ); - // ƒtƒŒ[ƒ€‚̃Xƒe[ƒ^ƒX‚ð•ÏX‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // fps : ƒtƒŒ[ƒ€ƒXƒe[ƒ^ƒX‚ւ̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*is_saveframe)( void *editp,int n ); - // ŽÀÛ‚É•Û‘¶‚³‚ê‚éƒtƒŒ[ƒ€‚©’²‚ׂ܂· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚È‚ç•Û‘¶‚³‚ê‚Ü‚· - BOOL (*is_keyframe)( void *editp,int n ); - // ƒL[ƒtƒŒ[ƒ€‚©‚Ç‚¤‚©’²‚ׂ܂· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚È‚çƒL[ƒtƒŒ[ƒ€ - BOOL (*is_recompress)( void *editp,int n ); - // Ĉ³k‚ª•K—v‚©’²‚ׂ܂· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // –ß‚è’l : TRUE‚È‚çĈ³k‚ª•K—v - BOOL (*filter_window_update)( void *fp ); - // Ý’èƒEƒBƒ“ƒhƒE‚̃gƒ‰ƒbƒNƒo[‚ƃ`ƒFƒbƒNƒ{ƒbƒNƒX‚ðÄ•`‰æ‚µ‚Ü‚· - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*is_filter_window_disp)( void *fp ); - // Ý’èƒEƒBƒ“ƒhƒE‚ª•\Ž¦‚³‚ê‚Ä‚¢‚é‚©’²‚ׂ܂· - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚È‚ç•\Ž¦‚³‚ê‚Ä‚¢‚é - BOOL (*get_file_info)( void *editp,FILE_INFO *fip ); - // •ÒWƒtƒ@ƒCƒ‹‚Ìî•ñ‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // fip : ƒtƒ@ƒCƒ‹ƒCƒ“ƒtƒHƒ[ƒVƒ‡ƒ“\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - LPSTR (*get_config_name)( void *editp,int n ); - // Ý’èŠÂ‹«‚Ì–¼‘O‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : Ý’èŠÂ‹«‚̔Ԇ - // –ß‚è’l : Ý’èŠÂ‹«‚Ì–¼‘O‚ւ̃|ƒCƒ“ƒ^ - BOOL (*is_filter_active)( void *fp ); - // ƒtƒBƒ‹ƒ^‚ª—LŒø‚É‚È‚Á‚Ä‚¢‚é‚©’²‚ׂ܂· - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚È‚çƒtƒBƒ‹ƒ^—LŒø - BOOL (*get_pixel_filtered)( void *editp,int n,void *pixelp,int *w,int *h ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚ÌDIBŒ`Ž®(RGB24bit)‚̉摜ƒf[ƒ^‚ð“Ç‚Ýž‚Ý‚Ü‚· - // ƒf[ƒ^‚̓tƒBƒ‹ƒ^Œã‚Ì‚à‚Ì‚Å‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // pixelp : DIBŒ`Ž®ƒf[ƒ^‚ðŠi”[‚·‚éƒ|ƒCƒ“ƒ^ (NULL‚È‚ç‰æ‘œƒTƒCƒY‚¾‚¯‚ð•Ô‚µ‚Ü‚·) - // w,h : ‰æ‘œ‚̃TƒCƒY (NULL‚È‚çDIBŒ`Ž®ƒf[ƒ^‚¾‚¯‚ð•Ô‚µ‚Ü‚·) - // –ß‚è’l : TRUE‚Ȃ笌÷ - int (*get_audio_filtered)( void *editp,int n,void *buf ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚̃I[ƒfƒBƒIƒf[ƒ^‚ð“Ç‚Ýž‚Ý‚Ü‚· - // ƒf[ƒ^‚̓tƒBƒ‹ƒ^Œã‚Ì‚à‚Ì‚Å‚· - // editp* : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // buf : Ši”[‚·‚éƒoƒbƒtƒ@ - // –ß‚è’l : “Ç‚Ýž‚ñ‚¾ƒTƒ“ƒvƒ‹” - BOOL (*get_select_frame)( void *editp,int *s,int *e ); - // ‘I‘ðŠJŽnI—¹ƒtƒŒ[ƒ€‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // s : ‘I‘ðŠJŽnƒtƒŒ[ƒ€ - // e : ‘I‘ðI—¹ƒtƒŒ[ƒ€ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*set_select_frame)( void *editp,int s,int e ); - // ‘I‘ðŠJŽnI—¹ƒtƒŒ[ƒ€‚ðݒ肵‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // s : ‘I‘ðŠJŽnƒtƒŒ[ƒ€ - // e : ‘I‘ðI—¹ƒtƒŒ[ƒ€ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*rgb2yc)( PIXEL_YC *ycp,PIXEL *pixelp,int w ); - // PIXEL‚©‚çPIXEL_YC‚É•ÏŠ·‚µ‚Ü‚· - // ycp : PIXEL_YC\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // pixelp : PIXEL\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // w : \‘¢‘Ì‚Ì” - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*yc2rgb)( PIXEL *pixelp,PIXEL_YC *ycp,int w ); - // PIXEL_YC‚©‚çPIXEL‚É•ÏŠ·‚µ‚Ü‚· - // pixelp : PIXEL\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // ycp : PIXEL_YC\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // w : \‘¢‘Ì‚Ì” - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*dlg_get_load_name)( LPSTR name,LPSTR filter,LPSTR def ); - // ƒtƒ@ƒCƒ‹ƒ_ƒCƒAƒƒO‚ðŽg‚Á‚Ä“Ç‚Ýž‚Þƒtƒ@ƒCƒ‹–¼‚ðŽæ“¾‚µ‚Ü‚· - // name : ƒtƒ@ƒCƒ‹–¼‚ðŠi”[‚·‚éƒ|ƒCƒ“ƒ^ - // filter : ƒtƒ@ƒCƒ‹ƒtƒBƒ‹ƒ^ - // def : ƒfƒtƒHƒ‹ƒg‚̃tƒ@ƒCƒ‹–¼ - // –ß‚è’l : TRUE‚Ȃ笌÷ FALSE‚È‚çƒLƒƒƒ“ƒZƒ‹ - BOOL (*dlg_get_save_name)( LPSTR name,LPSTR filter,LPSTR def ); - // ƒtƒ@ƒCƒ‹ƒ_ƒCƒAƒƒO‚ðŽg‚Á‚Ä‘‚«ž‚Þƒtƒ@ƒCƒ‹–¼‚ðŽæ“¾‚µ‚Ü‚· - // name : ƒtƒ@ƒCƒ‹–¼‚ðŠi”[‚·‚éƒ|ƒCƒ“ƒ^ - // filter : ƒtƒ@ƒCƒ‹ƒtƒBƒ‹ƒ^ - // def : ƒfƒtƒHƒ‹ƒg‚̃tƒ@ƒCƒ‹–¼ - // –ß‚è’l : TRUE‚Ȃ笌÷ FALSE‚È‚çƒLƒƒƒ“ƒZƒ‹ - int (*ini_load_int)( void *fp,LPSTR key,int n ); - // INIƒtƒ@ƒCƒ‹‚©‚ç”’l‚ð“Ç‚Ýž‚Þ - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // key : ƒAƒNƒZƒX—p‚̃L[‚Ì–¼‘O - // n : ƒfƒtƒHƒ‹ƒg‚Ì”’l - // –ß‚è’l : “Ç‚Ýž‚ñ‚¾”’l - int (*ini_save_int)( void *fp,LPSTR key,int n ); - // INIƒtƒ@ƒCƒ‹‚É”’l‚ð‘‚«ž‚Þ - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // key : ƒAƒNƒZƒX—p‚̃L[‚Ì–¼‘O - // n : ‘‚«ž‚Þ”’l - // –ß‚è’l : ‘‚«ž‚ñ‚¾”’l - BOOL (*ini_load_str)( void *fp,LPSTR key,LPSTR str,LPSTR def ); - // INIƒtƒ@ƒCƒ‹‚©‚當Žš—ñ‚ð“Ç‚Ýž‚Þ - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // key : ƒAƒNƒZƒX—p‚̃L[‚Ì–¼‘O - // str : •¶Žš—ñ‚ð“Ç‚Ýž‚Þƒoƒbƒtƒ@ - // def : ƒfƒtƒHƒ‹ƒg‚Ì•¶Žš—ñ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*ini_save_str)( void *fp,LPSTR key,LPSTR str ); - // INIƒtƒ@ƒCƒ‹‚É•¶Žš—ñ‚ð‘‚«ž‚Þ - // fp : ƒtƒBƒ‹ƒ^\‘¢‘̂̃|ƒCƒ“ƒ^ - // key : ƒAƒNƒZƒX—p‚̃L[‚Ì–¼‘O - // n : ‘‚«ž‚Þ•¶Žš—ñ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*get_source_file_info)( void *editp,FILE_INFO *fip,int source_file_id ); - // Žw’肵‚½ƒtƒ@ƒCƒ‹ID‚̃tƒ@ƒCƒ‹‚Ìî•ñ‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // fip : ƒtƒ@ƒCƒ‹ƒCƒ“ƒtƒHƒ[ƒVƒ‡ƒ“\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // souce_file_id - // : ƒtƒ@ƒCƒ‹ID - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*get_source_video_number)( void *editp,int n,int *source_file_id,int *source_video_number ); - // Žw’肵‚½ƒtƒŒ[ƒ€‚̃\[ƒX‚̃tƒ@ƒCƒ‹ID‚ƃtƒŒ[ƒ€”Ô†‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // n : ƒtƒŒ[ƒ€”Ô† - // souce_file_id - // : ƒtƒ@ƒCƒ‹ID‚ðŠi”[‚·‚éƒ|ƒCƒ“ƒ^ - // souce_video_number - // : ƒtƒŒ[ƒ€”Ô†‚ðŠi”[‚·‚éƒ|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - BOOL (*get_sys_info)( void *editp,SYS_INFO *sip ); - // ƒVƒXƒeƒ€‚Ìî•ñ‚ðŽæ“¾‚µ‚Ü‚· - // editp : ƒGƒfƒBƒbƒgƒnƒ“ƒhƒ‹ - // sip : ƒVƒXƒeƒ€ƒCƒ“ƒtƒHƒ[ƒVƒ‡ƒ“\‘¢‘̂ւ̃|ƒCƒ“ƒ^ - // –ß‚è’l : TRUE‚Ȃ笌÷ - void *(*get_filterp)( int filter_id ); - // Žw’è‚̃tƒBƒ‹ƒ^ID‚̃tƒBƒ‹ƒ^\‘¢‘̂ւ̃|ƒCƒ“ƒ^‚ðŽæ“¾‚µ‚Ü‚· - // filter_id - // : ƒtƒBƒ‹ƒ^ID (0`“o˜^‚³‚ê‚Ä‚éƒtƒBƒ‹ƒ^‚Ì”-1‚Ü‚Å‚Ì’l) - // –ß‚è’l : ƒtƒBƒ‹ƒ^\‘¢‘̂ւ̃|ƒCƒ“ƒ^ (NULL‚Ȃ玸”s) - int reserve[6]; -} EXFUNC; - -// ƒtƒBƒ‹ƒ^\‘¢‘Ì -typedef struct { - int flag; // ƒtƒBƒ‹ƒ^‚̃tƒ‰ƒO - // FILTER_FLAG_ALWAYS_ACTIVE : ƒtƒBƒ‹ƒ^‚ðí‚ɃAƒNƒeƒBƒu‚É‚µ‚Ü‚· - // FILTER_FLAG_CONFIG_POPUP : Ý’è‚ðƒ|ƒbƒvƒAƒbƒvƒƒjƒ…[‚É‚µ‚Ü‚· - // FILTER_FLAG_CONFIG_CHECK : Ý’è‚ðƒ`ƒFƒbƒNƒ{ƒbƒNƒXƒƒjƒ…[‚É‚µ‚Ü‚· - // FILTER_FLAG_CONFIG_RADIO : Ý’è‚ðƒ‰ƒWƒIƒ{ƒ^ƒ“ƒƒjƒ…[‚É‚µ‚Ü‚· - // FILTER_FLAG_EX_DATA : Šg’£ƒf[ƒ^‚ð•Û‘¶o—ˆ‚é‚悤‚É‚µ‚Ü‚· - // FILTER_FLAG_PRIORITY_HIGHEST : ƒtƒBƒ‹ƒ^‚̃vƒ‰ƒCƒIƒŠƒeƒB‚ðí‚ÉÅãˆÊ‚É‚µ‚Ü‚· - // FILTER_FLAG_PRIORITY_LOWEST : ƒtƒBƒ‹ƒ^‚̃vƒ‰ƒCƒIƒŠƒeƒB‚ðí‚ÉʼnºˆÊ‚É‚µ‚Ü‚· - // FILTER_FLAG_WINDOW_THICKFRAME : ƒTƒCƒY•ÏX‰Â”\‚ȃEƒBƒ“ƒhƒE‚ðì‚è‚Ü‚· - // FILTER_FLAG_WINDOW_SIZE : Ý’èƒEƒBƒ“ƒhƒE‚̃TƒCƒY‚ðŽw’èo—ˆ‚é‚悤‚É‚µ‚Ü‚· - // FILTER_FLAG_DISP_FILTER : •\Ž¦ƒtƒBƒ‹ƒ^‚É‚µ‚Ü‚· - // FILTER_FLAG_REDRAW : Ä•`‰æ‚ðplugin‘¤‚ň—‚·‚é‚悤‚É‚µ‚Ü‚· - // FILTER_FLAG_EX_INFORMATION : ƒtƒBƒ‹ƒ^‚ÌŠg’£î•ñ‚ðÝ’è‚Å‚«‚é‚悤‚É‚µ‚Ü‚· - // FILTER_FLAG_INFORMATION : FILTER_FLAG_EX_INFORMATION ‚ðŽg‚¤‚悤‚É‚µ‚ĉº‚³‚¢ - // FILTER_FLAG_NO_CONFIG : Ý’èƒEƒBƒ“ƒhƒE‚ð•\Ž¦‚µ‚È‚¢‚悤‚É‚µ‚Ü‚· - // FILTER_FLAG_AUDIO_FILTER : ƒI[ƒfƒBƒIƒtƒBƒ‹ƒ^‚É‚µ‚Ü‚· - // FILTER_FLAG_RADIO_BUTTON : ƒ`ƒFƒbƒNƒ{ƒbƒNƒX‚ðƒ‰ƒWƒIƒ{ƒ^ƒ“‚É‚µ‚Ü‚· - // FILTER_FLAG_WINDOW_HSCROLL : …•½ƒXƒNƒ[ƒ‹ƒo[‚ðŽ‚ƒEƒBƒ“ƒhƒE‚ðì‚è‚Ü‚· - // FILTER_FLAG_WINDOW_VSCROLL : ‚’¼ƒXƒNƒ[ƒ‹ƒo[‚ðŽ‚ƒEƒBƒ“ƒhƒE‚ðì‚è‚Ü‚· - // FILTER_FLAG_IMPORT : ƒCƒ“ƒ|[ƒgƒƒjƒ…[‚ðì‚è‚Ü‚· - // FILTER_FLAG_EXPORT : ƒGƒNƒXƒ|[ƒgƒƒjƒ…[‚ðì‚è‚Ü‚· - int x,y; // Ý’èƒEƒCƒ“ƒhƒE‚̃TƒCƒY (FILTER_FLAG_WINDOW_SIZE‚ª—§‚Á‚Ä‚¢‚鎞‚É—LŒø) - TCHAR *name; // ƒtƒBƒ‹ƒ^‚Ì–¼‘O - int track_n; // ƒgƒ‰ƒbƒNƒo[‚Ì” - TCHAR **track_name; // ƒgƒ‰ƒbƒNƒo[‚Ì–¼‘OŒS‚ւ̃|ƒCƒ“ƒ^(ƒgƒ‰ƒbƒNƒo[”‚ª0‚È‚çNULL‚Å‚æ‚¢) - int *track_default; // ƒgƒ‰ƒbƒNƒo[‚̉Šú’lŒS‚ւ̃|ƒCƒ“ƒ^(ƒgƒ‰ƒbƒNƒo[”‚ª0‚È‚çNULL‚Å‚æ‚¢) - int *track_s,*track_e; // ƒgƒ‰ƒbƒNƒo[‚Ì”’l‚̉ºŒÀãŒÀ (NULL‚È‚ç‘S‚Ä0`256) - int check_n; // ƒ`ƒFƒbƒNƒ{ƒbƒNƒX‚Ì” - TCHAR **check_name; // ƒ`ƒFƒbƒNƒ{ƒbƒNƒX‚Ì–¼‘OŒS‚ւ̃|ƒCƒ“ƒ^(ƒ`ƒFƒbƒNƒ{ƒbƒNƒX”‚ª0‚È‚çNULL‚Å‚æ‚¢) - int *check_default; // ƒ`ƒFƒbƒNƒ{ƒbƒNƒX‚̉Šú’lŒS‚ւ̃|ƒCƒ“ƒ^(ƒ`ƒFƒbƒNƒ{ƒbƒNƒX”‚ª0‚È‚çNULL‚Å‚æ‚¢) - BOOL (*func_proc)( void *fp,FILTER_PROC_INFO *fpip ); - // ƒtƒBƒ‹ƒ^ˆ—ŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - BOOL (*func_init)( void *fp ); - // ŠJŽnŽž‚ɌĂ΂ê‚éŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - BOOL (*func_exit)( void *fp ); - // I—¹Žž‚ɌĂ΂ê‚éŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - BOOL (*func_update)( void *fp ); - // ݒ肪•ÏX‚³‚ꂽ‚Æ‚«‚ɌĂ΂ê‚éŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - BOOL (*func_WndProc)( HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam,void *editp,void *fp ); - // Ý’èƒEƒBƒ“ƒhƒE‚ɃEƒBƒ“ƒhƒEƒƒbƒZ[ƒW‚ª—ˆ‚½Žž‚ɌĂ΂ê‚éŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - // ’Êí‚̃ƒbƒZ[ƒWˆÈŠO‚Ɉȉº‚ÌŠg’£ƒƒbƒZ[ƒW‚ª‘—‚ç‚ê‚Ü‚· - // WM_FILTER_UPDATE : ƒtƒBƒ‹ƒ^Ý’è‚â•ÒW“à—e‚ª•ÏX‚³‚ꂽ’¼Œã‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_FILE_OPEN : •ÒWƒtƒ@ƒCƒ‹‚ªƒI[ƒvƒ“‚³‚ꂽ’¼Œã‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_FILE_CLOSE : •ÒWƒtƒ@ƒCƒ‹‚ªƒNƒ[ƒY‚³‚ê‚é’¼‘O‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_INIT : ŠJŽn’¼Œã‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_EXIT : I—¹’¼‘O‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_SAVE_START : ƒZ[ƒu‚ªŠJŽn‚³‚ê‚é’¼‘O‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_SAVE_END : ƒZ[ƒu‚ªI—¹‚³‚ꂽ’¼Œã‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_IMPORT : ƒCƒ“ƒ|[ƒg‚ª‘I‘ð‚³‚ê‚½’¼Œã‚É‘—‚ç‚ê‚Ü‚· - // WM_FILTER_EXPORT : ƒGƒNƒXƒ|[ƒg‚ª‘I‘ð‚³‚ê‚½’¼Œã‚É‘—‚ç‚ê‚Ü‚· - // –ß‚è’l‚ðTRUE‚É‚·‚é‚Æ•ÒW“à—e‚ªXV‚³‚ꂽ‚Æ‚µ‚Ä‘S‘Ì‚ªÄ•`‰æ‚³‚ê‚Ü‚· - int *track,*check; // ƒVƒXƒeƒ€‚ÅŽg‚¢‚Ü‚·‚Ì‚ÅŽg—p‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ - void *ex_data_ptr; // Šg’£ƒf[ƒ^—̈æ‚ւ̃|ƒCƒ“ƒ^ (FILTER_FLAG_EX_DATA‚ª—§‚Á‚Ä‚¢‚鎞‚É—LŒø) - int ex_data_size; // Šg’£ƒf[ƒ^ƒTƒCƒY (FILTER_FLAG_EX_DATA‚ª—§‚Á‚Ä‚¢‚鎞‚É—LŒø) - TCHAR *information; // ƒtƒBƒ‹ƒ^î•ñ‚ւ̃|ƒCƒ“ƒ^ (FILTER_FLAG_EX_INFORMATION‚ª—§‚Á‚Ä‚¢‚鎞‚É—LŒø) - BOOL (*func_save_start)( void *fp,int s,int e,void *editp ); - // ƒZ[ƒu‚ªŠJŽn‚³‚ê‚é’¼‘O‚ɌĂ΂ê‚éŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - BOOL (*func_save_end)( void *fp,void *editp ); - // ƒZ[ƒu‚ªI—¹‚µ‚½’¼‘O‚ɌĂ΂ê‚éŠÖ”‚ւ̃|ƒCƒ“ƒ^ (NULL‚È‚çŒÄ‚΂ê‚Ü‚¹‚ñ) - EXFUNC *exfunc; // ŠO•”ŠÖ”ƒe[ƒuƒ‹‚ւ̃|ƒCƒ“ƒ^ - HWND hwnd; // ƒEƒBƒ“ƒhƒEƒnƒ“ƒhƒ‹ - HINSTANCE dll_hinst; // DLL‚̃Cƒ“ƒXƒ^ƒ“ƒXƒnƒ“ƒhƒ‹ - int reserve[8]; // Šg’£—p‚É—\–ñ‚³‚ê‚Ä‚Ü‚· -} FILTER; -#define FILTER_FLAG_ACTIVE 1 -#define FILTER_FLAG_ALWAYS_ACTIVE 4 -#define FILTER_FLAG_CONFIG_POPUP 8 -#define FILTER_FLAG_CONFIG_CHECK 16 -#define FILTER_FLAG_CONFIG_RADIO 32 -#define FILTER_FLAG_EX_DATA 1024 -#define FILTER_FLAG_PRIORITY_HIGHEST 2048 -#define FILTER_FLAG_PRIORITY_LOWEST 4096 -#define FILTER_FLAG_WINDOW_THICKFRAME 8192 -#define FILTER_FLAG_WINDOW_SIZE 16384 -#define FILTER_FLAG_DISP_FILTER 32768 -#define FILTER_FLAG_REDRAW 0x20000 -#define FILTER_FLAG_EX_INFORMATION 0x40000 -#define FILTER_FLAG_INFORMATION 0x80000 -#define FILTER_FLAG_NO_CONFIG 0x100000 -#define FILTER_FLAG_AUDIO_FILTER 0x200000 -#define FILTER_FLAG_RADIO_BUTTON 0x400000 -#define FILTER_FLAG_WINDOW_HSCROLL 0x800000 -#define FILTER_FLAG_WINDOW_VSCROLL 0x1000000 -#define FILTER_FLAG_IMPORT 0x10000000 -#define FILTER_FLAG_EXPORT 0x20000000 -#define WM_FILTER_UPDATE (WM_USER+100) -#define WM_FILTER_FILE_OPEN (WM_USER+101) -#define WM_FILTER_FILE_CLOSE (WM_USER+102) -#define WM_FILTER_INIT (WM_USER+103) -#define WM_FILTER_EXIT (WM_USER+104) -#define WM_FILTER_SAVE_START (WM_USER+105) -#define WM_FILTER_SAVE_END (WM_USER+106) -#define WM_FILTER_IMPORT (WM_USER+107) -#define WM_FILTER_EXPORT (WM_USER+108) - -// ƒtƒBƒ‹ƒ^DLL—p\‘¢‘Ì -typedef struct { - int flag; - int x,y; - TCHAR *name; - int track_n; - TCHAR **track_name; - int *track_default; - int *track_s,*track_e; - int check_n; - TCHAR **check_name; - int *check_default; - BOOL (*func_proc)( FILTER *fp,FILTER_PROC_INFO *fpip ); - BOOL (*func_init)( FILTER *fp ); - BOOL (*func_exit)( FILTER *fp ); - BOOL (*func_update)( FILTER *fp ); - BOOL (*func_WndProc)( HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam,void *editp,FILTER *fp ); - int *track,*check; - void *ex_data_ptr; - int ex_data_size; - TCHAR *information; - BOOL (*func_save_start)( void *fp,int s,int e,void *editp ); - BOOL (*func_save_end)( void *fp,void *editp ); - EXFUNC *exfunc; - HWND hwnd; - HINSTANCE dll_hinst; - int reserve[8]; -} FILTER_DLL; - -#define MID_FILTER_BUTTON 12004 - -BOOL func_proc( FILTER *fp,FILTER_PROC_INFO *fpip ); -BOOL func_init( FILTER *fp ); -BOOL func_exit( FILTER *fp ); -BOOL func_update( FILTER *fp ); -BOOL func_WndProc( HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam,void *editp,FILTER *fp ); -BOOL func_save_start( FILTER *fp,int s,int e,void *editp ); -BOOL func_save_end( FILTER *fp,void *editp ); - - diff --git a/include/detours/detours.h b/include/detours/detours.h deleted file mode 100644 index 3c0ce910f..000000000 --- a/include/detours/detours.h +++ /dev/null @@ -1,616 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// File: detours.h -// Module: detours.lib -// -// Detours for binary functions. Version 1.5 (Build 46) -// -// Copyright 1995-2001, Microsoft Corporation -// - -#pragma once -#ifndef _DETOURS_H_ -#define _DETOURS_H_ - -#pragma comment(lib, "detours") - -////////////////////////////////////////////////////////////////////////////// -// -#ifndef GUID_DEFINED -#define GUID_DEFINED -typedef struct _GUID -{ - DWORD Data1; - WORD Data2; - WORD Data3; - BYTE Data4[ 8 ]; -} GUID; -#endif // !GUID_DEFINED - -#if defined(__cplusplus) -#ifndef _REFGUID_DEFINED -#define _REFGUID_DEFINED -#define REFGUID const GUID & -#endif // !_REFGUID_DEFINED -#else // !__cplusplus -#ifndef _REFGUID_DEFINED -#define _REFGUID_DEFINED -#define REFGUID const GUID * const -#endif // !_REFGUID_DEFINED -#endif // !__cplusplus -// -////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -/////////////////////////////////////////////////// Instruction Target Macros. -// -#define DETOUR_INSTRUCTION_TARGET_NONE ((PBYTE)0) -#define DETOUR_INSTRUCTION_TARGET_DYNAMIC ((PBYTE)~0ul) - -/////////////////////////////////////////////////////////// Trampoline Macros. -// -// DETOUR_TRAMPOLINE(trampoline_prototype, target_name) -// -// The naked trampoline must be at least DETOUR_TRAMPOLINE_SIZE bytes. -// -#define DETOUR_TRAMPOLINE_SIZE 32 -#define DETOUR_SECTION_HEADER_SIGNATURE 0x00727444 // "Dtr\0" - -#define DETOUR_TRAMPOLINE(trampoline,target) \ -static PVOID __fastcall _Detours_GetVA_##target(VOID) \ -{ \ - return ⌖ \ -} \ -\ -__declspec(naked) trampoline \ -{ \ - __asm { nop };\ - __asm { nop };\ - __asm { call _Detours_GetVA_##target };\ - __asm { jmp eax };\ - __asm { ret };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ -} - -#define DETOUR_TRAMPOLINE_EMPTY(trampoline) \ -__declspec(naked) trampoline \ -{ \ - __asm { nop };\ - __asm { nop };\ - __asm { xor eax, eax };\ - __asm { mov eax, [eax] };\ - __asm { ret };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ - __asm { nop };\ -} - -/////////////////////////////////////////////////////////// Binary Structures. -// -#pragma pack(push, 8) -typedef struct _DETOUR_SECTION_HEADER -{ - DWORD cbHeaderSize; - DWORD nSignature; - DWORD nDataOffset; - DWORD cbDataSize; - - DWORD nOriginalImportVirtualAddress; - DWORD nOriginalImportSize; - DWORD nOriginalBoundImportVirtualAddress; - DWORD nOriginalBoundImportSize; - - DWORD nOriginalIatVirtualAddress; - DWORD nOriginalIatSize; - DWORD nOriginalSizeOfImage; - DWORD nReserve; -} DETOUR_SECTION_HEADER, *PDETOUR_SECTION_HEADER; - -typedef struct _DETOUR_SECTION_RECORD -{ - DWORD cbBytes; - DWORD nReserved; - GUID guid; -} DETOUR_SECTION_RECORD, *PDETOUR_SECTION_RECORD; -#pragma pack(pop) - -#define DETOUR_SECTION_HEADER_DECLARE(cbSectionSize) \ -{ \ - sizeof(DETOUR_SECTION_HEADER),\ - DETOUR_SECTION_HEADER_SIGNATURE,\ - sizeof(DETOUR_SECTION_HEADER),\ - (cbSectionSize),\ - \ - 0,\ - 0,\ - 0,\ - 0,\ - \ - 0,\ - 0,\ - 0,\ - 0,\ -} - -///////////////////////////////////////////////////////////// Binary Typedefs. -// -typedef BOOL (CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK)(PVOID pContext, - PCHAR pszFile, - PCHAR *ppszOutFile); -typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK)(PVOID pContext, - PCHAR pszOrigFile, - PCHAR pszFile, - PCHAR *ppszOutFile); -typedef BOOL (CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK)(PVOID pContext, - DWORD nOrdinal, - PCHAR pszOrigSymbol, - PCHAR pszSymbol, - PCHAR *ppszOutSymbol); -typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FINAL_CALLBACK)(PVOID pContext); -typedef BOOL (CALLBACK *PF_DETOUR_BINARY_EXPORT_CALLBACK)(PVOID pContext, - DWORD nOrdinal, - PCHAR pszName, - PBYTE pbCode); - -typedef VOID * PDETOUR_BINARY; -typedef VOID * PDETOUR_LOADED_BINARY; - -//////////////////////////////////////////////////////// Trampoline Functions. -// -PBYTE WINAPI DetourFunction(PBYTE pbTargetFunction, - PBYTE pbDetourFunction); - -BOOL WINAPI DetourFunctionWithEmptyTrampoline(PBYTE pbTrampoline, - PBYTE pbTarget, - PBYTE pbDetour); - -BOOL WINAPI DetourFunctionWithEmptyTrampolineEx(PBYTE pbTrampoline, - PBYTE pbTarget, - PBYTE pbDetour, - PBYTE *ppbRealTrampoline, - PBYTE *ppbRealTarget, - PBYTE *ppbRealDetour); - -BOOL WINAPI DetourFunctionWithTrampoline(PBYTE pbTrampoline, - PBYTE pbDetour); - -BOOL WINAPI DetourFunctionWithTrampolineEx(PBYTE pbTrampoline, - PBYTE pbDetour, - PBYTE *ppbRealTrampoline, - PBYTE *ppbRealTarget); - -BOOL WINAPI DetourRemove(PBYTE pbTrampoline, PBYTE pbDetour); - -////////////////////////////////////////////////////////////// Code Functions. -// -PBYTE WINAPI DetourFindFunction(PCHAR pszModule, PCHAR pszFunction); -PBYTE WINAPI DetourGetFinalCode(PBYTE pbCode, BOOL fSkipJmp); - -PBYTE WINAPI DetourCopyInstruction(PBYTE pbDst, PBYTE pbSrc, PBYTE *ppbTarget); -PBYTE WINAPI DetourCopyInstructionEx(PBYTE pbDst, - PBYTE pbSrc, - PBYTE *ppbTarget, - LONG *plExtra); - -///////////////////////////////////////////////////// Loaded Binary Functions. -// -HMODULE WINAPI DetourEnumerateModules(HMODULE hModuleLast); -PBYTE WINAPI DetourGetEntryPoint(HMODULE hModule); -BOOL WINAPI DetourEnumerateExports(HMODULE hModule, - PVOID pContext, - PF_DETOUR_BINARY_EXPORT_CALLBACK pfExport); - -PBYTE WINAPI DetourFindPayload(HMODULE hModule, REFGUID rguid, DWORD *pcbData); -DWORD WINAPI DetourGetSizeOfPayloads(HMODULE hModule); - -///////////////////////////////////////////////// Persistent Binary Functions. -// -BOOL WINAPI DetourBinaryBindA(PCHAR pszFile, PCHAR pszDll, PCHAR pszPath); -BOOL WINAPI DetourBinaryBindW(PWCHAR pwzFile, PWCHAR pwzDll, PWCHAR pwzPath); -#ifdef UNICODE -#define DetourBinaryBind DetourBinaryBindW -#else -#define DetourBinaryBind DetourBinaryBindA -#endif // !UNICODE - -PDETOUR_BINARY WINAPI DetourBinaryOpen(HANDLE hFile); -PBYTE WINAPI DetourBinaryEnumeratePayloads(PDETOUR_BINARY pBinary, - GUID *pGuid, - DWORD *pcbData, - DWORD *pnIterator); -PBYTE WINAPI DetourBinaryFindPayload(PDETOUR_BINARY pBinary, - REFGUID rguid, - DWORD *pcbData); -PBYTE WINAPI DetourBinarySetPayload(PDETOUR_BINARY pBinary, - REFGUID rguid, - PBYTE pbData, - DWORD cbData); -BOOL WINAPI DetourBinaryDeletePayload(PDETOUR_BINARY pBinary, REFGUID rguid); -BOOL WINAPI DetourBinaryPurgePayloads(PDETOUR_BINARY pBinary); -BOOL WINAPI DetourBinaryResetImports(PDETOUR_BINARY pBinary); -BOOL WINAPI DetourBinaryEditImports(PDETOUR_BINARY pBinary, - PVOID pContext, - PF_DETOUR_BINARY_BYWAY_CALLBACK pfByway, - PF_DETOUR_BINARY_FILE_CALLBACK pfFile, - PF_DETOUR_BINARY_SYMBOL_CALLBACK pfSymbol, - PF_DETOUR_BINARY_FINAL_CALLBACK pfFinal); -BOOL WINAPI DetourBinaryWrite(PDETOUR_BINARY pBinary, HANDLE hFile); -BOOL WINAPI DetourBinaryClose(PDETOUR_BINARY pBinary); - -/////////////////////////////////////////////// First Chance Exception Filter. -// -LPTOP_LEVEL_EXCEPTION_FILTER WINAPI -DetourFirstChanceExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelFilter); - -///////////////////////////////////////////////// Create Process & Inject Dll. -// -typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEA) - (LPCSTR lpApplicationName, - LPSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, - BOOL bInheritHandles, - DWORD dwCreationFlags, - LPVOID lpEnvironment, - LPCSTR lpCurrentDirectory, - LPSTARTUPINFOA lpStartupInfo, - LPPROCESS_INFORMATION lpProcessInformation); - -typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEW) - (LPCWSTR lpApplicationName, - LPWSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, - BOOL bInheritHandles, - DWORD dwCreationFlags, - LPVOID lpEnvironment, - LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, - LPPROCESS_INFORMATION lpProcessInformation); - -BOOL WINAPI DetourCreateProcessWithDllA(LPCSTR lpApplicationName, - LPSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, - BOOL bInheritHandles, - DWORD dwCreationFlags, - LPVOID lpEnvironment, - LPCSTR lpCurrentDirectory, - LPSTARTUPINFOA lpStartupInfo, - LPPROCESS_INFORMATION lpProcessInformation, - LPCSTR lpDllName, - PDETOUR_CREATE_PROCESS_ROUTINEA - pfCreateProcessA); - -BOOL WINAPI DetourCreateProcessWithDllW(LPCWSTR lpApplicationName, - LPWSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, - BOOL bInheritHandles, - DWORD dwCreationFlags, - LPVOID lpEnvironment, - LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, - LPPROCESS_INFORMATION lpProcessInformation, - LPCWSTR lpDllName, - PDETOUR_CREATE_PROCESS_ROUTINEW - pfCreateProcessW); - -#ifdef UNICODE -#define DetourCreateProcessWithDll DetourCreateProcessWithDllW -#define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEW -#else -#define DetourCreateProcessWithDll DetourCreateProcessWithDllA -#define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEA -#endif // !UNICODE - -BOOL WINAPI DetourContinueProcessWithDllA(HANDLE hProcess, LPCSTR lpDllName); -BOOL WINAPI DetourContinueProcessWithDllW(HANDLE hProcess, LPCWSTR lpDllName); - -#ifdef UNICODE -#define DetourContinueProcessWithDll DetourContinueProcessWithDllW -#else -#define DetourContinueProcessWithDll DetourContinueProcessWithDllA -#endif // !UNICODE -// -////////////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -} -#endif // __cplusplus - -/////////////////////////////////////////////////////////////////// Old Names. -// -#define ContinueProcessWithDll DetourContinueProcessWithDll -#define ContinueProcessWithDllA DetourContinueProcessWithDllA -#define ContinueProcessWithDllW DetourContinueProcessWithDllW -#define CreateProcessWithDll DetourCreateProcessWithDll -#define CreateProcessWithDllA DetourCreateProcessWithDllA -#define CreateProcessWithDllW DetourCreateProcessWithDllW -#define DETOUR_TRAMPOLINE_WO_TARGET DETOUR_TRAMPOLINE_EMPTY -#define DetourBinaryPurgePayload DetourBinaryPurgePayloads -#define DetourEnumerateExportsForInstance DetourEnumerateExports -#define DetourEnumerateInstances DetourEnumerateModules -#define DetourFindEntryPointForInstance DetourGetEntryPoint -#define DetourFindFinalCode DetourGetFinalCode -#define DetourFindPayloadInBinary DetourFindPayload -#define DetourGetSizeOfBinary DetourGetSizeOfPayloads -#define DetourRemoveWithTrampoline DetourRemove -#define PCREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINE -#define PCREATE_PROCESS_ROUTINEA PDETOUR_CREATE_PROCESS_ROUTINEA -#define PCREATE_PROCESS_ROUTINEW PDETOUR_CREATE_PROCESS_ROUTINEW -// - -//////////////////////////////////////////////// Detours Internal Definitions. -// -#ifdef __cplusplus -#ifdef DETOURS_INTERNAL - -////////////////////////////////////////////////////////////////////////////// -// -#ifdef IMAGEAPI // defined by IMAGEHLP.H -typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(LPAPI_VERSION AppVersion); - -typedef BOOL (NTAPI *PF_SymInitialize)(IN HANDLE hProcess, - IN LPSTR UserSearchPath, - IN BOOL fInvadeProcess); -typedef DWORD (NTAPI *PF_SymSetOptions)(IN DWORD SymOptions); -typedef DWORD (NTAPI *PF_SymGetOptions)(VOID); -typedef BOOL (NTAPI *PF_SymLoadModule)(IN HANDLE hProcess, - IN HANDLE hFile, - IN PSTR ImageName, - IN PSTR ModuleName, - IN DWORD BaseOfDll, - IN DWORD SizeOfDll); -typedef BOOL (NTAPI *PF_SymGetModuleInfo)(IN HANDLE hProcess, - IN DWORD dwAddr, - OUT PIMAGEHLP_MODULE ModuleInfo); -typedef BOOL (NTAPI *PF_SymGetSymFromName)(IN HANDLE hProcess, - IN LPSTR Name, - OUT PIMAGEHLP_SYMBOL Symbol); -typedef BOOL (NTAPI *PF_BindImage)(IN LPSTR pszImageName, - IN LPSTR pszDllPath, - IN LPSTR pszSymbolPath); - -typedef struct _DETOUR_SYM_INFO -{ - HANDLE hProcess; - HMODULE hImageHlp; - PF_ImagehlpApiVersionEx pfImagehlpApiVersionEx; - PF_SymInitialize pfSymInitialize; - PF_SymSetOptions pfSymSetOptions; - PF_SymGetOptions pfSymGetOptions; - PF_SymLoadModule pfSymLoadModule; - PF_SymGetModuleInfo pfSymGetModuleInfo; - PF_SymGetSymFromName pfSymGetSymFromName; - PF_BindImage pfBindImage; -} DETOUR_SYM_INFO, *PDETOUR_SYM_INFO; - -PDETOUR_SYM_INFO DetourLoadImageHlp(VOID); - -#endif // IMAGEAPI - -////////////////////////////////////////////////////////////////////////////// -// -class CDetourEnableWriteOnCodePage -{ -public: - CDetourEnableWriteOnCodePage(PBYTE pbCode, LONG cbCode = DETOUR_TRAMPOLINE_SIZE) - { - m_pbCode = pbCode; - m_cbCode = cbCode; - m_dwOldPerm = 0; - m_hProcess = GetCurrentProcess(); - - if (m_pbCode && m_cbCode) { - if (!FlushInstructionCache(m_hProcess, pbCode, cbCode)) { - return; - } - if (!VirtualProtect(pbCode, - cbCode, - PAGE_EXECUTE_READWRITE, - &m_dwOldPerm)) { - return; - } - } - } - - ~CDetourEnableWriteOnCodePage() - { - if (m_dwOldPerm && m_pbCode && m_cbCode) { - DWORD dwTemp = 0; - if (!FlushInstructionCache(m_hProcess, m_pbCode, m_cbCode)) { - return; - } - if (!VirtualProtect(m_pbCode, m_cbCode, m_dwOldPerm, &dwTemp)) { - return; - } - } - } - - BOOL SetPermission(DWORD dwPerms) - { - if (m_dwOldPerm && m_pbCode && m_cbCode) { - m_dwOldPerm = dwPerms; - return TRUE; - } - return FALSE; - } - - BOOL IsValid(VOID) - { - return m_pbCode && m_cbCode && m_dwOldPerm; - } - -private: - HANDLE m_hProcess; - PBYTE m_pbCode; - LONG m_cbCode; - DWORD m_dwOldPerm; -}; - -////////////////////////////////////////////////////////////////////////////// -// -inline PBYTE DetourGenMovEax(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xB8; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEbx(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xBB; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEcx(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xB9; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEdx(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xBA; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEsi(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xBE; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEdi(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xBF; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEbp(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xBD; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenMovEsp(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0xBC; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenPush(PBYTE pbCode, UINT32 nValue) -{ - *pbCode++ = 0x68; - *((UINT32*&)pbCode)++ = nValue; - return pbCode; -} - -inline PBYTE DetourGenPushad(PBYTE pbCode) -{ - *pbCode++ = 0x60; - return pbCode; -} - -inline PBYTE DetourGenPopad(PBYTE pbCode) -{ - *pbCode++ = 0x61; - return pbCode; -} - -inline PBYTE DetourGenJmp(PBYTE pbCode, PBYTE pbJmpDst, PBYTE pbJmpSrc = 0) -{ - if (pbJmpSrc == 0) { - pbJmpSrc = pbCode; - } - *pbCode++ = 0xE9; - *((INT32*&)pbCode)++ = pbJmpDst - (pbJmpSrc + 5); - return pbCode; -} - -inline PBYTE DetourGenCall(PBYTE pbCode, PBYTE pbJmpDst, PBYTE pbJmpSrc = 0) -{ - if (pbJmpSrc == 0) { - pbJmpSrc = pbCode; - } - *pbCode++ = 0xE8; - *((INT32*&)pbCode)++ = pbJmpDst - (pbJmpSrc + 5); - return pbCode; -} - -inline PBYTE DetourGenBreak(PBYTE pbCode) -{ - *pbCode++ = 0xcc; - return pbCode; -} - -inline PBYTE DetourGenRet(PBYTE pbCode) -{ - *pbCode++ = 0xc3; - return pbCode; -} - -inline PBYTE DetourGenNop(PBYTE pbCode) -{ - *pbCode++ = 0x90; - return pbCode; -} -#endif DETOURS_INTERAL -#endif // __cplusplus - -#endif // _DETOURS_H_ -// -//////////////////////////////////////////////////////////////// End of File. diff --git a/include/dsm/dsm.h b/include/dsm/dsm.h deleted file mode 100644 index 73082a1e0..000000000 --- a/include/dsm/dsm.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#define DSMF_VERSION 0x01 - -#define DSMSW 0x44534D53ui64 -#define DSMSW_SIZE 4 - -enum dsmp_t -{ - DSMP_FILEINFO = 0, - DSMP_STREAMINFO = 1, - DSMP_MEDIATYPE = 2, - DSMP_CHAPTERS = 3, - DSMP_SAMPLE = 4, - DSMP_SYNCPOINTS = 5, - DSMP_RESOURCE = 6 -}; \ No newline at end of file diff --git a/include/dsm/dsm.txt b/include/dsm/dsm.txt deleted file mode 100644 index ed796278c..000000000 --- a/include/dsm/dsm.txt +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2005 Gabest - * http://www.gabest.org - * - * This file format is free to use as long as its specification is not - * modified or extended without the permission of Gabest. Suggestions - * can be sent in email or posted to the forum at sf.net/projects/guliverkli. - * - */ - ------------------------ -The .dsm file structure ------------------------ - -FileInfo + Header Packets + Samples + Footer Packets - -Header & Footer Packets: -- Required: MediaType -- Optional: StreamInfo, Chapters, SyncPoints, Resource - -Notes: -- SyncPoints is optional because seeking can be performed simply by searching for packet syncpoints and their timestamps. -- This layout is fine for streaming. On connection send everything up to Sample packets, build the graph at the other end, then the rest when playing. (TODO: introduce NewSegment packet, to support seeking over network) -- The resolution of timestamp and duration is 100ns. -- Strings are zero terminated utf-8 strings. -- Date format string: "%Y-%m-%d %H:%M:%S". (GMT) -- Byte order is big-endian - -Definitions ------------ - -DSMF_VERSION = 0x01 - -DSMSW = 44534D53 ("DSMS") -DSMSW_SIZE = 4 - -DSMP_FILEINFO = 0 -DSMP_STREAMINFO = 1 -DSMP_MEDIATYPE = 2 -DSMP_CHAPTERS = 3 -DSMP_SAMPLE = 4 -DSMP_SYNCPOINTS = 5 -DSMP_RESOURCE = 6 - -Packet ------- - -DSMSW (DSMSW_SIZE bytes) (DirectShow Media SyncWord) -DSMP_* (5 bits) -data size length (3 bits -> 1-8 bytes) -data size (1-8 bytes) - -[... data ...] - -FileInfo : extends Packet (DSMP_FILEINFO) ------------------------------------------ - -version (1 byte, DSMF_VERSION) - -... repeated n times ... - -id (4 bytes, alphanum) -string - -... repeated n times ... - -Notes: -- Parsers should not open files with higher "version" than they were compiled for. -- Suggested values of "id": - "TITL": Title - "AUTH": Author - "RTNG": Rating - "CPYR": Copyright - "DESC": Description - "APPL": Application - "MUXR": Muxer - "DATE": Encoding date - ... more to be defined ... - -MediaType : extends Packet (DSMP_MEDIATYPE) -------------------------------------------- - -stream id (1 byte) - -majortype (sizeof(GUID)) -subtype (sizeof(GUID)) -bFixedSizeSamples (1 bit) -bTemporalCompression (1 bit) -lSampleSize (30 bit) -formattype (sizeof(GUID)) - -[... format data ...] - -Notes: -- Multiple MediaTypes per stream is NOT allowed -- bFixedSizeSamples, bTemporalCompression, lSampleSize are only there to preserve compatibility with dshow's media type structure, they aren't playing a role in anything really. - -StreamInfo : extends Packet (DSMP_STREAMINFO) ---------------------------------------------- - -stream id (1 byte) - -... repeated n times ... - -id (4 bytes, alphanum) -string - -... repeated n times ... - -Notes: -- Suggested values of "id": - "NAME": Stream name - "SGRP": Stream group (groupped streams can be useful if the splitter is able to group and switch between them, but it's not a strict requirement towards dsm splitters) - "LANG": Language code (ISO 639-2) - "DESC": Description - ... more to be defined ... - -Chapters : extends Packet (DSMP_CHAPTERS) ------------------------------------------ - -... repeated n times ... - -timestamp delta sign (1 bit, <0?) -timestamp delta length (3 bits -> 0-7 bytes) -reserved (4 bits) -timestamp delta (0-7 bytes) -string - -... repeated n times ... - -Notes: -- "timestamp delta" holds the difference to the previous value, starts at 0. - -Sample : extends Packet (DSMP_SAMPLE) -------------------------------------- - -stream id (1 byte) - -syncpoint (1 bit) -timestamp sign (1 bit, <0?) -timestamp length (3 bits -> 0-7 bytes) -duration length (3 bits -> 0-7 bytes) - -timestamp (0-7 bytes) -duration (0-7 bytes) - -[... data ...] - -Notes: -- sign == 1 && timestamp length == 0 -> timestamp and duration is unknown (but for syncpoints it cannot be unknown!) -- sign == 0 && timestamp length == 0 -> simply means the value is stored on zero bytes and its value is zero too. -- timestamps of syncpoints must be strictly in increasing order. -- timestamps can be negative (to allow cutting a file at anywhere, preroll samples may need to be saved) - -SyncPoints : extends Packet (DSMP_SYNCPOINTS) ---------------------------------------------- - -... repeated n times ... - -timestamp delta sign (1 bit, <0?) -timestamp delta length (3 bits -> 0-7 bytes) -file position delta length (3 bits -> 0-7 bytes) -reserved (1 bit) - -timestamp delta (0-7 bytes) -file position delta (0-7 bytes) - -... repeated n times ... - -Notes: -- "timestamp delta" / "file position delta" holds the difference to the previous value, both start at 0. - -The algorithm of SyncPoints generation --------------------------------------- - -First example: - -stream 1: 1,5,8 (video) -stream 2: 2,3,6,7,9 (audio) -stream 3: 4 (subtitle) - -1 ----| 1->2 1 +2 -> 1 (t 1, fp 1) - |---- 2 2->3 1,2 +3 -2 -> 1 - |---- 3 3->4 1,3 +4 -> 1 - +-|-- 4 (start) 4->5 1,3,4 +5 -1 -> 1 -5 --|-| 5->6 3,4,5 +6 -3 -> 3 (t 5, fp 3) - | |---- 6 6->7 4,5,6 +7 -6 -> 4 (t 6, fp 4) - | |---- 7 7->8 4,5,7 +8 -7 -4 -> 4 - +-|-- 4 (stop) - |---- 8 8->9 5,8 +9 -5 -> 5 (t 8, fp 5) -9 ----| 9->10 8,9 +10 -8 -> 8 (t 9, fp 8) - |---- 10 10-> 9,10 -> 9 (t 10, fp 9) - -Notice how it is the values of the first and last elements of the queue are used. - -In the end it represents the following: (timestamp ranges mapped to file positions) - -1->5: [1] -5->6: [3] -6->8: [4] -8->9: [5] -9->10: [8] -10->: [9] - -Example usage: - -Seeking to 7 would mean we need to start decoding at the file position of 4, which -makes sure we hit at least one syncpoint from every stream (4,5,7 and 6 too, but 6 -can be skipped) until we reach 7. - ---- - -Second example: - -This is going to be a bit more complicated case. (I hope you like my ascii art :) - -stream 1: 1,4,5,6,7 (video) -stream 2: 2,3 (subtitle) - -1 -----| 1->2 1 +2 -> 1 (t 1, fp 1) - +-|--- 2 (start) 2->3 1,2 (+3 NOT!) -> 1 - +-|-|- 3 (start) 3->4 1,2 +4 -1 -> 1 -4 -|-|-| 4->5 2,4 +5 -4 -> 2 (t 4, fp 2) -5 -|-|-| 5->6 2,5 +6 -5 -2 -> 2 - +-|-|- 3 (stop) - +-|--- 2 (stop) -6 -----| 6->7 6 +7 -6 -> 6 (t 6, fp 6) -7 -----| 7-> 7 -> 7 (t 7, fp 7) - -The problem with subtitles that they are discontinous, overlapped and can totally hide -other syncpoints, just like 2 hides 4, 5 and even 3 fully (which requires special handling, -see "NOT!"). That means such a subtitle, when it is too long, can influence seeking time -by a lot. It might be wise and worth limiting the duration of samples to a couple of minutes, -possibly sacrificing a bit of correctness by it. Splitters can also choose to ignore the -suggested seek position, when it falls too far from the required, and go on searching the -stream for syncpoints themselves. - -Resource : extends Packet (DSMP_RESOURCE) ------------------------------------------ - -compression type (2 bits, 0: none, 1: gzip, 2-3: reserved) -reserved (6 bits) -name string -desc string -mime string - -[... data ...] diff --git a/include/qedit.h b/include/qedit.h deleted file mode 100644 index 855720a8e..000000000 --- a/include/qedit.h +++ /dev/null @@ -1,6580 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0499 */ -/* Compiler settings for qedit.idl: - Oicf, W1, Zp8, env=Win32 (32b run) - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -//@@MIDL_FILE_HEADING( ) - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCSAL_H_VERSION__ -#define __REQUIRED_RPCSAL_H_VERSION__ 100 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __qedit_h__ -#define __qedit_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IPropertySetter_FWD_DEFINED__ -#define __IPropertySetter_FWD_DEFINED__ -typedef interface IPropertySetter IPropertySetter; -#endif /* __IPropertySetter_FWD_DEFINED__ */ - - -#ifndef __IDxtCompositor_FWD_DEFINED__ -#define __IDxtCompositor_FWD_DEFINED__ -typedef interface IDxtCompositor IDxtCompositor; -#endif /* __IDxtCompositor_FWD_DEFINED__ */ - - -#ifndef __IDxtAlphaSetter_FWD_DEFINED__ -#define __IDxtAlphaSetter_FWD_DEFINED__ -typedef interface IDxtAlphaSetter IDxtAlphaSetter; -#endif /* __IDxtAlphaSetter_FWD_DEFINED__ */ - - -#ifndef __IDxtJpeg_FWD_DEFINED__ -#define __IDxtJpeg_FWD_DEFINED__ -typedef interface IDxtJpeg IDxtJpeg; -#endif /* __IDxtJpeg_FWD_DEFINED__ */ - - -#ifndef __IDxtKey_FWD_DEFINED__ -#define __IDxtKey_FWD_DEFINED__ -typedef interface IDxtKey IDxtKey; -#endif /* __IDxtKey_FWD_DEFINED__ */ - - -#ifndef __IMediaLocator_FWD_DEFINED__ -#define __IMediaLocator_FWD_DEFINED__ -typedef interface IMediaLocator IMediaLocator; -#endif /* __IMediaLocator_FWD_DEFINED__ */ - - -#ifndef __IMediaDet_FWD_DEFINED__ -#define __IMediaDet_FWD_DEFINED__ -typedef interface IMediaDet IMediaDet; -#endif /* __IMediaDet_FWD_DEFINED__ */ - - -#ifndef __IGrfCache_FWD_DEFINED__ -#define __IGrfCache_FWD_DEFINED__ -typedef interface IGrfCache IGrfCache; -#endif /* __IGrfCache_FWD_DEFINED__ */ - - -#ifndef __IRenderEngine_FWD_DEFINED__ -#define __IRenderEngine_FWD_DEFINED__ -typedef interface IRenderEngine IRenderEngine; -#endif /* __IRenderEngine_FWD_DEFINED__ */ - - -#ifndef __IRenderEngine2_FWD_DEFINED__ -#define __IRenderEngine2_FWD_DEFINED__ -typedef interface IRenderEngine2 IRenderEngine2; -#endif /* __IRenderEngine2_FWD_DEFINED__ */ - - -#ifndef __IFindCompressorCB_FWD_DEFINED__ -#define __IFindCompressorCB_FWD_DEFINED__ -typedef interface IFindCompressorCB IFindCompressorCB; -#endif /* __IFindCompressorCB_FWD_DEFINED__ */ - - -#ifndef __ISmartRenderEngine_FWD_DEFINED__ -#define __ISmartRenderEngine_FWD_DEFINED__ -typedef interface ISmartRenderEngine ISmartRenderEngine; -#endif /* __ISmartRenderEngine_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineObj_FWD_DEFINED__ -#define __IAMTimelineObj_FWD_DEFINED__ -typedef interface IAMTimelineObj IAMTimelineObj; -#endif /* __IAMTimelineObj_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineEffectable_FWD_DEFINED__ -#define __IAMTimelineEffectable_FWD_DEFINED__ -typedef interface IAMTimelineEffectable IAMTimelineEffectable; -#endif /* __IAMTimelineEffectable_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineEffect_FWD_DEFINED__ -#define __IAMTimelineEffect_FWD_DEFINED__ -typedef interface IAMTimelineEffect IAMTimelineEffect; -#endif /* __IAMTimelineEffect_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineTransable_FWD_DEFINED__ -#define __IAMTimelineTransable_FWD_DEFINED__ -typedef interface IAMTimelineTransable IAMTimelineTransable; -#endif /* __IAMTimelineTransable_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineSplittable_FWD_DEFINED__ -#define __IAMTimelineSplittable_FWD_DEFINED__ -typedef interface IAMTimelineSplittable IAMTimelineSplittable; -#endif /* __IAMTimelineSplittable_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineTrans_FWD_DEFINED__ -#define __IAMTimelineTrans_FWD_DEFINED__ -typedef interface IAMTimelineTrans IAMTimelineTrans; -#endif /* __IAMTimelineTrans_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineSrc_FWD_DEFINED__ -#define __IAMTimelineSrc_FWD_DEFINED__ -typedef interface IAMTimelineSrc IAMTimelineSrc; -#endif /* __IAMTimelineSrc_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineTrack_FWD_DEFINED__ -#define __IAMTimelineTrack_FWD_DEFINED__ -typedef interface IAMTimelineTrack IAMTimelineTrack; -#endif /* __IAMTimelineTrack_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineVirtualTrack_FWD_DEFINED__ -#define __IAMTimelineVirtualTrack_FWD_DEFINED__ -typedef interface IAMTimelineVirtualTrack IAMTimelineVirtualTrack; -#endif /* __IAMTimelineVirtualTrack_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineComp_FWD_DEFINED__ -#define __IAMTimelineComp_FWD_DEFINED__ -typedef interface IAMTimelineComp IAMTimelineComp; -#endif /* __IAMTimelineComp_FWD_DEFINED__ */ - - -#ifndef __IAMTimelineGroup_FWD_DEFINED__ -#define __IAMTimelineGroup_FWD_DEFINED__ -typedef interface IAMTimelineGroup IAMTimelineGroup; -#endif /* __IAMTimelineGroup_FWD_DEFINED__ */ - - -#ifndef __IAMTimeline_FWD_DEFINED__ -#define __IAMTimeline_FWD_DEFINED__ -typedef interface IAMTimeline IAMTimeline; -#endif /* __IAMTimeline_FWD_DEFINED__ */ - - -#ifndef __IXml2Dex_FWD_DEFINED__ -#define __IXml2Dex_FWD_DEFINED__ -typedef interface IXml2Dex IXml2Dex; -#endif /* __IXml2Dex_FWD_DEFINED__ */ - - -#ifndef __IAMErrorLog_FWD_DEFINED__ -#define __IAMErrorLog_FWD_DEFINED__ -typedef interface IAMErrorLog IAMErrorLog; -#endif /* __IAMErrorLog_FWD_DEFINED__ */ - - -#ifndef __IAMSetErrorLog_FWD_DEFINED__ -#define __IAMSetErrorLog_FWD_DEFINED__ -typedef interface IAMSetErrorLog IAMSetErrorLog; -#endif /* __IAMSetErrorLog_FWD_DEFINED__ */ - - -#ifndef __ISampleGrabberCB_FWD_DEFINED__ -#define __ISampleGrabberCB_FWD_DEFINED__ -typedef interface ISampleGrabberCB ISampleGrabberCB; -#endif /* __ISampleGrabberCB_FWD_DEFINED__ */ - - -#ifndef __ISampleGrabber_FWD_DEFINED__ -#define __ISampleGrabber_FWD_DEFINED__ -typedef interface ISampleGrabber ISampleGrabber; -#endif /* __ISampleGrabber_FWD_DEFINED__ */ - - -#ifndef __IResize_FWD_DEFINED__ -#define __IResize_FWD_DEFINED__ -typedef interface IResize IResize; -#endif /* __IResize_FWD_DEFINED__ */ - - -#ifndef __AMTimeline_FWD_DEFINED__ -#define __AMTimeline_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimeline AMTimeline; -#else -typedef struct AMTimeline AMTimeline; -#endif /* __cplusplus */ - -#endif /* __AMTimeline_FWD_DEFINED__ */ - - -#ifndef __AMTimelineObj_FWD_DEFINED__ -#define __AMTimelineObj_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineObj AMTimelineObj; -#else -typedef struct AMTimelineObj AMTimelineObj; -#endif /* __cplusplus */ - -#endif /* __AMTimelineObj_FWD_DEFINED__ */ - - -#ifndef __AMTimelineSrc_FWD_DEFINED__ -#define __AMTimelineSrc_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineSrc AMTimelineSrc; -#else -typedef struct AMTimelineSrc AMTimelineSrc; -#endif /* __cplusplus */ - -#endif /* __AMTimelineSrc_FWD_DEFINED__ */ - - -#ifndef __AMTimelineTrack_FWD_DEFINED__ -#define __AMTimelineTrack_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineTrack AMTimelineTrack; -#else -typedef struct AMTimelineTrack AMTimelineTrack; -#endif /* __cplusplus */ - -#endif /* __AMTimelineTrack_FWD_DEFINED__ */ - - -#ifndef __AMTimelineComp_FWD_DEFINED__ -#define __AMTimelineComp_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineComp AMTimelineComp; -#else -typedef struct AMTimelineComp AMTimelineComp; -#endif /* __cplusplus */ - -#endif /* __AMTimelineComp_FWD_DEFINED__ */ - - -#ifndef __AMTimelineGroup_FWD_DEFINED__ -#define __AMTimelineGroup_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineGroup AMTimelineGroup; -#else -typedef struct AMTimelineGroup AMTimelineGroup; -#endif /* __cplusplus */ - -#endif /* __AMTimelineGroup_FWD_DEFINED__ */ - - -#ifndef __AMTimelineTrans_FWD_DEFINED__ -#define __AMTimelineTrans_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineTrans AMTimelineTrans; -#else -typedef struct AMTimelineTrans AMTimelineTrans; -#endif /* __cplusplus */ - -#endif /* __AMTimelineTrans_FWD_DEFINED__ */ - - -#ifndef __AMTimelineEffect_FWD_DEFINED__ -#define __AMTimelineEffect_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AMTimelineEffect AMTimelineEffect; -#else -typedef struct AMTimelineEffect AMTimelineEffect; -#endif /* __cplusplus */ - -#endif /* __AMTimelineEffect_FWD_DEFINED__ */ - - -#ifndef __RenderEngine_FWD_DEFINED__ -#define __RenderEngine_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class RenderEngine RenderEngine; -#else -typedef struct RenderEngine RenderEngine; -#endif /* __cplusplus */ - -#endif /* __RenderEngine_FWD_DEFINED__ */ - - -#ifndef __SmartRenderEngine_FWD_DEFINED__ -#define __SmartRenderEngine_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SmartRenderEngine SmartRenderEngine; -#else -typedef struct SmartRenderEngine SmartRenderEngine; -#endif /* __cplusplus */ - -#endif /* __SmartRenderEngine_FWD_DEFINED__ */ - - -#ifndef __AudMixer_FWD_DEFINED__ -#define __AudMixer_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class AudMixer AudMixer; -#else -typedef struct AudMixer AudMixer; -#endif /* __cplusplus */ - -#endif /* __AudMixer_FWD_DEFINED__ */ - - -#ifndef __Xml2Dex_FWD_DEFINED__ -#define __Xml2Dex_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class Xml2Dex Xml2Dex; -#else -typedef struct Xml2Dex Xml2Dex; -#endif /* __cplusplus */ - -#endif /* __Xml2Dex_FWD_DEFINED__ */ - - -#ifndef __MediaLocator_FWD_DEFINED__ -#define __MediaLocator_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class MediaLocator MediaLocator; -#else -typedef struct MediaLocator MediaLocator; -#endif /* __cplusplus */ - -#endif /* __MediaLocator_FWD_DEFINED__ */ - - -#ifndef __PropertySetter_FWD_DEFINED__ -#define __PropertySetter_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PropertySetter PropertySetter; -#else -typedef struct PropertySetter PropertySetter; -#endif /* __cplusplus */ - -#endif /* __PropertySetter_FWD_DEFINED__ */ - - -#ifndef __MediaDet_FWD_DEFINED__ -#define __MediaDet_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class MediaDet MediaDet; -#else -typedef struct MediaDet MediaDet; -#endif /* __cplusplus */ - -#endif /* __MediaDet_FWD_DEFINED__ */ - - -#ifndef __SampleGrabber_FWD_DEFINED__ -#define __SampleGrabber_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SampleGrabber SampleGrabber; -#else -typedef struct SampleGrabber SampleGrabber; -#endif /* __cplusplus */ - -#endif /* __SampleGrabber_FWD_DEFINED__ */ - - -#ifndef __NullRenderer_FWD_DEFINED__ -#define __NullRenderer_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class NullRenderer NullRenderer; -#else -typedef struct NullRenderer NullRenderer; -#endif /* __cplusplus */ - -#endif /* __NullRenderer_FWD_DEFINED__ */ - - -#ifndef __DxtCompositor_FWD_DEFINED__ -#define __DxtCompositor_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DxtCompositor DxtCompositor; -#else -typedef struct DxtCompositor DxtCompositor; -#endif /* __cplusplus */ - -#endif /* __DxtCompositor_FWD_DEFINED__ */ - - -#ifndef __DxtAlphaSetter_FWD_DEFINED__ -#define __DxtAlphaSetter_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DxtAlphaSetter DxtAlphaSetter; -#else -typedef struct DxtAlphaSetter DxtAlphaSetter; -#endif /* __cplusplus */ - -#endif /* __DxtAlphaSetter_FWD_DEFINED__ */ - - -#ifndef __DxtJpeg_FWD_DEFINED__ -#define __DxtJpeg_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DxtJpeg DxtJpeg; -#else -typedef struct DxtJpeg DxtJpeg; -#endif /* __cplusplus */ - -#endif /* __DxtJpeg_FWD_DEFINED__ */ - - -#ifndef __ColorSource_FWD_DEFINED__ -#define __ColorSource_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class ColorSource ColorSource; -#else -typedef struct ColorSource ColorSource; -#endif /* __cplusplus */ - -#endif /* __ColorSource_FWD_DEFINED__ */ - - -#ifndef __DxtKey_FWD_DEFINED__ -#define __DxtKey_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DxtKey DxtKey; -#else -typedef struct DxtKey DxtKey; -#endif /* __cplusplus */ - -#endif /* __DxtKey_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "dxtrans.h" -#include "amstream.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_qedit_0000_0000 */ -/* [local] */ - - -typedef /* [public] */ -enum __MIDL___MIDL_itf_qedit_0000_0000_0001 - { DEXTERF_JUMP = 0, - DEXTERF_INTERPOLATE = ( DEXTERF_JUMP + 1 ) - } DEXTERF; - -typedef /* [public][public][public][public] */ struct __MIDL___MIDL_itf_qedit_0000_0000_0002 - { - BSTR Name; - DISPID dispID; - LONG nValues; - } DEXTER_PARAM; - -typedef /* [public][public][public][public] */ struct __MIDL___MIDL_itf_qedit_0000_0000_0003 - { - VARIANT v; - REFERENCE_TIME rt; - DWORD dwInterp; - } DEXTER_VALUE; - - -enum __MIDL___MIDL_itf_qedit_0000_0000_0004 - { DEXTER_AUDIO_JUMP = 0, - DEXTER_AUDIO_INTERPOLATE = ( DEXTER_AUDIO_JUMP + 1 ) - } ; -typedef /* [public] */ struct __MIDL___MIDL_itf_qedit_0000_0000_0005 - { - REFERENCE_TIME rtEnd; - double dLevel; - BOOL bMethod; - } DEXTER_AUDIO_VOLUMEENVELOPE; - - -enum __MIDL___MIDL_itf_qedit_0000_0000_0006 - { TIMELINE_INSERT_MODE_INSERT = 1, - TIMELINE_INSERT_MODE_OVERLAY = 2 - } ; -typedef /* [public][public][public][public][public][public][public][public] */ -enum __MIDL___MIDL_itf_qedit_0000_0000_0007 - { TIMELINE_MAJOR_TYPE_COMPOSITE = 1, - TIMELINE_MAJOR_TYPE_TRACK = 2, - TIMELINE_MAJOR_TYPE_SOURCE = 4, - TIMELINE_MAJOR_TYPE_TRANSITION = 8, - TIMELINE_MAJOR_TYPE_EFFECT = 16, - TIMELINE_MAJOR_TYPE_GROUP = 128 - } TIMELINE_MAJOR_TYPE; - -typedef /* [public] */ -enum __MIDL___MIDL_itf_qedit_0000_0000_0008 - { DEXTERF_BOUNDING = -1, - DEXTERF_EXACTLY_AT = 0, - DEXTERF_FORWARDS = 1 - } DEXTERF_TRACK_SEARCH_FLAGS; - -typedef struct _SCompFmt0 - { - long nFormatId; - AM_MEDIA_TYPE MediaType; - } SCompFmt0; - - -enum __MIDL___MIDL_itf_qedit_0000_0000_0009 - { RESIZEF_STRETCH = 0, - RESIZEF_CROP = ( RESIZEF_STRETCH + 1 ) , - RESIZEF_PRESERVEASPECTRATIO = ( RESIZEF_CROP + 1 ) , - RESIZEF_PRESERVEASPECTRATIO_NOLETTERBOX = ( RESIZEF_PRESERVEASPECTRATIO + 1 ) - } ; - -enum __MIDL___MIDL_itf_qedit_0000_0000_0010 - { CONNECTF_DYNAMIC_NONE = 0, - CONNECTF_DYNAMIC_SOURCES = 0x1, - CONNECTF_DYNAMIC_EFFECTS = 0x2 - } ; - -enum __MIDL___MIDL_itf_qedit_0000_0000_0011 - { SFN_VALIDATEF_CHECK = 0x1, - SFN_VALIDATEF_POPUP = 0x2, - SFN_VALIDATEF_TELLME = 0x4, - SFN_VALIDATEF_REPLACE = 0x8, - SFN_VALIDATEF_USELOCAL = 0x10, - SFN_VALIDATEF_NOFIND = 0x20, - SFN_VALIDATEF_IGNOREMUTED = 0x40, - SFN_VALIDATEF_END = ( SFN_VALIDATEF_IGNOREMUTED + 1 ) - } ; - -enum __MIDL___MIDL_itf_qedit_0000_0000_0012 - { DXTKEY_RGB = 0, - DXTKEY_NONRED = ( DXTKEY_RGB + 1 ) , - DXTKEY_LUMINANCE = ( DXTKEY_NONRED + 1 ) , - DXTKEY_ALPHA = ( DXTKEY_LUMINANCE + 1 ) , - DXTKEY_HUE = ( DXTKEY_ALPHA + 1 ) - } ; - - -extern RPC_IF_HANDLE __MIDL_itf_qedit_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_qedit_0000_0000_v0_0_s_ifspec; - -#ifndef __IPropertySetter_INTERFACE_DEFINED__ -#define __IPropertySetter_INTERFACE_DEFINED__ - -/* interface IPropertySetter */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IPropertySetter; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AE9472BD-B0C3-11D2-8D24-00A0C9441E20") - IPropertySetter : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE LoadXML( - /* [in] */ __RPC__in_opt IUnknown *pxml) = 0; - - virtual HRESULT STDMETHODCALLTYPE PrintXML( - /* [out] */ __RPC__out char *pszXML, - /* [in] */ int cbXML, - /* [out] */ __RPC__out int *pcbPrinted, - /* [in] */ int indent) = 0; - - virtual HRESULT STDMETHODCALLTYPE CloneProps( - /* [out] */ __RPC__deref_out_opt IPropertySetter **ppSetter, - /* [in] */ REFERENCE_TIME rtStart, - /* [in] */ REFERENCE_TIME rtStop) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddProp( - /* [in] */ DEXTER_PARAM Param, - /* [in] */ __RPC__in DEXTER_VALUE *paValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProps( - /* [out] */ __RPC__out LONG *pcParams, - /* [out] */ __RPC__deref_out_opt DEXTER_PARAM **paParam, - /* [out] */ __RPC__deref_out_opt DEXTER_VALUE **paValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE FreeProps( - /* [in] */ LONG cParams, - /* [in] */ __RPC__in DEXTER_PARAM *paParam, - /* [in] */ __RPC__in DEXTER_VALUE *paValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE ClearProps( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SaveToBlob( - /* [out] */ __RPC__out LONG *pcSize, - /* [out] */ __RPC__deref_out_opt BYTE **ppb) = 0; - - virtual HRESULT STDMETHODCALLTYPE LoadFromBlob( - /* [in] */ LONG cSize, - /* [in] */ __RPC__in BYTE *pb) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetProps( - /* [in] */ __RPC__in_opt IUnknown *pTarget, - /* [in] */ REFERENCE_TIME rtNow) = 0; - - virtual HRESULT STDMETHODCALLTYPE PrintXMLW( - /* [out] */ __RPC__out WCHAR *pszXML, - /* [in] */ int cchXML, - /* [out] */ __RPC__out int *pcchPrinted, - /* [in] */ int indent) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPropertySetterVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPropertySetter * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPropertySetter * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPropertySetter * This); - - HRESULT ( STDMETHODCALLTYPE *LoadXML )( - IPropertySetter * This, - /* [in] */ __RPC__in_opt IUnknown *pxml); - - HRESULT ( STDMETHODCALLTYPE *PrintXML )( - IPropertySetter * This, - /* [out] */ __RPC__out char *pszXML, - /* [in] */ int cbXML, - /* [out] */ __RPC__out int *pcbPrinted, - /* [in] */ int indent); - - HRESULT ( STDMETHODCALLTYPE *CloneProps )( - IPropertySetter * This, - /* [out] */ __RPC__deref_out_opt IPropertySetter **ppSetter, - /* [in] */ REFERENCE_TIME rtStart, - /* [in] */ REFERENCE_TIME rtStop); - - HRESULT ( STDMETHODCALLTYPE *AddProp )( - IPropertySetter * This, - /* [in] */ DEXTER_PARAM Param, - /* [in] */ __RPC__in DEXTER_VALUE *paValue); - - HRESULT ( STDMETHODCALLTYPE *GetProps )( - IPropertySetter * This, - /* [out] */ __RPC__out LONG *pcParams, - /* [out] */ __RPC__deref_out_opt DEXTER_PARAM **paParam, - /* [out] */ __RPC__deref_out_opt DEXTER_VALUE **paValue); - - HRESULT ( STDMETHODCALLTYPE *FreeProps )( - IPropertySetter * This, - /* [in] */ LONG cParams, - /* [in] */ __RPC__in DEXTER_PARAM *paParam, - /* [in] */ __RPC__in DEXTER_VALUE *paValue); - - HRESULT ( STDMETHODCALLTYPE *ClearProps )( - IPropertySetter * This); - - HRESULT ( STDMETHODCALLTYPE *SaveToBlob )( - IPropertySetter * This, - /* [out] */ __RPC__out LONG *pcSize, - /* [out] */ __RPC__deref_out_opt BYTE **ppb); - - HRESULT ( STDMETHODCALLTYPE *LoadFromBlob )( - IPropertySetter * This, - /* [in] */ LONG cSize, - /* [in] */ __RPC__in BYTE *pb); - - HRESULT ( STDMETHODCALLTYPE *SetProps )( - IPropertySetter * This, - /* [in] */ __RPC__in_opt IUnknown *pTarget, - /* [in] */ REFERENCE_TIME rtNow); - - HRESULT ( STDMETHODCALLTYPE *PrintXMLW )( - IPropertySetter * This, - /* [out] */ __RPC__out WCHAR *pszXML, - /* [in] */ int cchXML, - /* [out] */ __RPC__out int *pcchPrinted, - /* [in] */ int indent); - - END_INTERFACE - } IPropertySetterVtbl; - - interface IPropertySetter - { - CONST_VTBL struct IPropertySetterVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPropertySetter_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPropertySetter_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPropertySetter_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPropertySetter_LoadXML(This,pxml) \ - ( (This)->lpVtbl -> LoadXML(This,pxml) ) - -#define IPropertySetter_PrintXML(This,pszXML,cbXML,pcbPrinted,indent) \ - ( (This)->lpVtbl -> PrintXML(This,pszXML,cbXML,pcbPrinted,indent) ) - -#define IPropertySetter_CloneProps(This,ppSetter,rtStart,rtStop) \ - ( (This)->lpVtbl -> CloneProps(This,ppSetter,rtStart,rtStop) ) - -#define IPropertySetter_AddProp(This,Param,paValue) \ - ( (This)->lpVtbl -> AddProp(This,Param,paValue) ) - -#define IPropertySetter_GetProps(This,pcParams,paParam,paValue) \ - ( (This)->lpVtbl -> GetProps(This,pcParams,paParam,paValue) ) - -#define IPropertySetter_FreeProps(This,cParams,paParam,paValue) \ - ( (This)->lpVtbl -> FreeProps(This,cParams,paParam,paValue) ) - -#define IPropertySetter_ClearProps(This) \ - ( (This)->lpVtbl -> ClearProps(This) ) - -#define IPropertySetter_SaveToBlob(This,pcSize,ppb) \ - ( (This)->lpVtbl -> SaveToBlob(This,pcSize,ppb) ) - -#define IPropertySetter_LoadFromBlob(This,cSize,pb) \ - ( (This)->lpVtbl -> LoadFromBlob(This,cSize,pb) ) - -#define IPropertySetter_SetProps(This,pTarget,rtNow) \ - ( (This)->lpVtbl -> SetProps(This,pTarget,rtNow) ) - -#define IPropertySetter_PrintXMLW(This,pszXML,cchXML,pcchPrinted,indent) \ - ( (This)->lpVtbl -> PrintXMLW(This,pszXML,cchXML,pcchPrinted,indent) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPropertySetter_INTERFACE_DEFINED__ */ - - -#ifndef __IDxtCompositor_INTERFACE_DEFINED__ -#define __IDxtCompositor_INTERFACE_DEFINED__ - -/* interface IDxtCompositor */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IDxtCompositor; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("BB44391E-6ABD-422f-9E2E-385C9DFF51FC") - IDxtCompositor : public IDXEffect - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OffsetX( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_OffsetX( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OffsetY( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_OffsetY( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Width( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Width( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Height( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Height( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SrcOffsetX( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SrcOffsetX( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SrcOffsetY( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SrcOffsetY( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SrcWidth( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SrcWidth( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SrcHeight( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SrcHeight( - /* [in] */ long newVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDxtCompositorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDxtCompositor * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDxtCompositor * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDxtCompositor * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IDxtCompositor * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IDxtCompositor * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IDxtCompositor * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDxtCompositor * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Capabilities )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Progress )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Progress )( - IDxtCompositor * This, - /* [in] */ float newVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StepResolution )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( - IDxtCompositor * This, - /* [in] */ float newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OffsetX )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_OffsetX )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OffsetY )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_OffsetY )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Width )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Width )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Height )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Height )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SrcOffsetX )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SrcOffsetX )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SrcOffsetY )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SrcOffsetY )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SrcWidth )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SrcWidth )( - IDxtCompositor * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SrcHeight )( - IDxtCompositor * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SrcHeight )( - IDxtCompositor * This, - /* [in] */ long newVal); - - END_INTERFACE - } IDxtCompositorVtbl; - - interface IDxtCompositor - { - CONST_VTBL struct IDxtCompositorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDxtCompositor_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDxtCompositor_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDxtCompositor_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDxtCompositor_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDxtCompositor_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDxtCompositor_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDxtCompositor_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDxtCompositor_get_Capabilities(This,pVal) \ - ( (This)->lpVtbl -> get_Capabilities(This,pVal) ) - -#define IDxtCompositor_get_Progress(This,pVal) \ - ( (This)->lpVtbl -> get_Progress(This,pVal) ) - -#define IDxtCompositor_put_Progress(This,newVal) \ - ( (This)->lpVtbl -> put_Progress(This,newVal) ) - -#define IDxtCompositor_get_StepResolution(This,pVal) \ - ( (This)->lpVtbl -> get_StepResolution(This,pVal) ) - -#define IDxtCompositor_get_Duration(This,pVal) \ - ( (This)->lpVtbl -> get_Duration(This,pVal) ) - -#define IDxtCompositor_put_Duration(This,newVal) \ - ( (This)->lpVtbl -> put_Duration(This,newVal) ) - - -#define IDxtCompositor_get_OffsetX(This,pVal) \ - ( (This)->lpVtbl -> get_OffsetX(This,pVal) ) - -#define IDxtCompositor_put_OffsetX(This,newVal) \ - ( (This)->lpVtbl -> put_OffsetX(This,newVal) ) - -#define IDxtCompositor_get_OffsetY(This,pVal) \ - ( (This)->lpVtbl -> get_OffsetY(This,pVal) ) - -#define IDxtCompositor_put_OffsetY(This,newVal) \ - ( (This)->lpVtbl -> put_OffsetY(This,newVal) ) - -#define IDxtCompositor_get_Width(This,pVal) \ - ( (This)->lpVtbl -> get_Width(This,pVal) ) - -#define IDxtCompositor_put_Width(This,newVal) \ - ( (This)->lpVtbl -> put_Width(This,newVal) ) - -#define IDxtCompositor_get_Height(This,pVal) \ - ( (This)->lpVtbl -> get_Height(This,pVal) ) - -#define IDxtCompositor_put_Height(This,newVal) \ - ( (This)->lpVtbl -> put_Height(This,newVal) ) - -#define IDxtCompositor_get_SrcOffsetX(This,pVal) \ - ( (This)->lpVtbl -> get_SrcOffsetX(This,pVal) ) - -#define IDxtCompositor_put_SrcOffsetX(This,newVal) \ - ( (This)->lpVtbl -> put_SrcOffsetX(This,newVal) ) - -#define IDxtCompositor_get_SrcOffsetY(This,pVal) \ - ( (This)->lpVtbl -> get_SrcOffsetY(This,pVal) ) - -#define IDxtCompositor_put_SrcOffsetY(This,newVal) \ - ( (This)->lpVtbl -> put_SrcOffsetY(This,newVal) ) - -#define IDxtCompositor_get_SrcWidth(This,pVal) \ - ( (This)->lpVtbl -> get_SrcWidth(This,pVal) ) - -#define IDxtCompositor_put_SrcWidth(This,newVal) \ - ( (This)->lpVtbl -> put_SrcWidth(This,newVal) ) - -#define IDxtCompositor_get_SrcHeight(This,pVal) \ - ( (This)->lpVtbl -> get_SrcHeight(This,pVal) ) - -#define IDxtCompositor_put_SrcHeight(This,newVal) \ - ( (This)->lpVtbl -> put_SrcHeight(This,newVal) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDxtCompositor_INTERFACE_DEFINED__ */ - - -#ifndef __IDxtAlphaSetter_INTERFACE_DEFINED__ -#define __IDxtAlphaSetter_INTERFACE_DEFINED__ - -/* interface IDxtAlphaSetter */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IDxtAlphaSetter; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4EE9EAD9-DA4D-43d0-9383-06B90C08B12B") - IDxtAlphaSetter : public IDXEffect - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Alpha( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Alpha( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AlphaRamp( - /* [retval][out] */ __RPC__out double *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AlphaRamp( - /* [in] */ double newVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDxtAlphaSetterVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDxtAlphaSetter * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDxtAlphaSetter * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDxtAlphaSetter * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IDxtAlphaSetter * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IDxtAlphaSetter * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IDxtAlphaSetter * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDxtAlphaSetter * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Capabilities )( - IDxtAlphaSetter * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Progress )( - IDxtAlphaSetter * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Progress )( - IDxtAlphaSetter * This, - /* [in] */ float newVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StepResolution )( - IDxtAlphaSetter * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( - IDxtAlphaSetter * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( - IDxtAlphaSetter * This, - /* [in] */ float newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Alpha )( - IDxtAlphaSetter * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Alpha )( - IDxtAlphaSetter * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AlphaRamp )( - IDxtAlphaSetter * This, - /* [retval][out] */ __RPC__out double *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AlphaRamp )( - IDxtAlphaSetter * This, - /* [in] */ double newVal); - - END_INTERFACE - } IDxtAlphaSetterVtbl; - - interface IDxtAlphaSetter - { - CONST_VTBL struct IDxtAlphaSetterVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDxtAlphaSetter_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDxtAlphaSetter_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDxtAlphaSetter_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDxtAlphaSetter_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDxtAlphaSetter_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDxtAlphaSetter_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDxtAlphaSetter_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDxtAlphaSetter_get_Capabilities(This,pVal) \ - ( (This)->lpVtbl -> get_Capabilities(This,pVal) ) - -#define IDxtAlphaSetter_get_Progress(This,pVal) \ - ( (This)->lpVtbl -> get_Progress(This,pVal) ) - -#define IDxtAlphaSetter_put_Progress(This,newVal) \ - ( (This)->lpVtbl -> put_Progress(This,newVal) ) - -#define IDxtAlphaSetter_get_StepResolution(This,pVal) \ - ( (This)->lpVtbl -> get_StepResolution(This,pVal) ) - -#define IDxtAlphaSetter_get_Duration(This,pVal) \ - ( (This)->lpVtbl -> get_Duration(This,pVal) ) - -#define IDxtAlphaSetter_put_Duration(This,newVal) \ - ( (This)->lpVtbl -> put_Duration(This,newVal) ) - - -#define IDxtAlphaSetter_get_Alpha(This,pVal) \ - ( (This)->lpVtbl -> get_Alpha(This,pVal) ) - -#define IDxtAlphaSetter_put_Alpha(This,newVal) \ - ( (This)->lpVtbl -> put_Alpha(This,newVal) ) - -#define IDxtAlphaSetter_get_AlphaRamp(This,pVal) \ - ( (This)->lpVtbl -> get_AlphaRamp(This,pVal) ) - -#define IDxtAlphaSetter_put_AlphaRamp(This,newVal) \ - ( (This)->lpVtbl -> put_AlphaRamp(This,newVal) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDxtAlphaSetter_INTERFACE_DEFINED__ */ - - -#ifndef __IDxtJpeg_INTERFACE_DEFINED__ -#define __IDxtJpeg_INTERFACE_DEFINED__ - -/* interface IDxtJpeg */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IDxtJpeg; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("DE75D011-7A65-11D2-8CEA-00A0C9441E20") - IDxtJpeg : public IDXEffect - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MaskNum( - /* [retval][out] */ __RPC__out long *__MIDL__IDxtJpeg0000) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_MaskNum( - /* [in] */ long __MIDL__IDxtJpeg0001) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MaskName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_MaskName( - /* [in] */ __RPC__in BSTR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ScaleX( - /* [retval][out] */ __RPC__out double *__MIDL__IDxtJpeg0002) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ScaleX( - /* [in] */ double __MIDL__IDxtJpeg0003) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ScaleY( - /* [retval][out] */ __RPC__out double *__MIDL__IDxtJpeg0004) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ScaleY( - /* [in] */ double __MIDL__IDxtJpeg0005) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OffsetX( - /* [retval][out] */ __RPC__out long *__MIDL__IDxtJpeg0006) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_OffsetX( - /* [in] */ long __MIDL__IDxtJpeg0007) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OffsetY( - /* [retval][out] */ __RPC__out long *__MIDL__IDxtJpeg0008) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_OffsetY( - /* [in] */ long __MIDL__IDxtJpeg0009) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReplicateX( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ReplicateX( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReplicateY( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ReplicateY( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderColor( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderColor( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderWidth( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderWidth( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderSoftness( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderSoftness( - /* [in] */ long newVal) = 0; - - virtual HRESULT STDMETHODCALLTYPE ApplyChanges( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE LoadDefSettings( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDxtJpegVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDxtJpeg * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDxtJpeg * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDxtJpeg * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IDxtJpeg * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IDxtJpeg * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IDxtJpeg * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDxtJpeg * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Capabilities )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Progress )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Progress )( - IDxtJpeg * This, - /* [in] */ float newVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StepResolution )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( - IDxtJpeg * This, - /* [in] */ float newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaskNum )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *__MIDL__IDxtJpeg0000); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MaskNum )( - IDxtJpeg * This, - /* [in] */ long __MIDL__IDxtJpeg0001); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaskName )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MaskName )( - IDxtJpeg * This, - /* [in] */ __RPC__in BSTR newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ScaleX )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out double *__MIDL__IDxtJpeg0002); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ScaleX )( - IDxtJpeg * This, - /* [in] */ double __MIDL__IDxtJpeg0003); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ScaleY )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out double *__MIDL__IDxtJpeg0004); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ScaleY )( - IDxtJpeg * This, - /* [in] */ double __MIDL__IDxtJpeg0005); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OffsetX )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *__MIDL__IDxtJpeg0006); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_OffsetX )( - IDxtJpeg * This, - /* [in] */ long __MIDL__IDxtJpeg0007); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OffsetY )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *__MIDL__IDxtJpeg0008); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_OffsetY )( - IDxtJpeg * This, - /* [in] */ long __MIDL__IDxtJpeg0009); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ReplicateX )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ReplicateX )( - IDxtJpeg * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ReplicateY )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ReplicateY )( - IDxtJpeg * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BorderColor )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BorderColor )( - IDxtJpeg * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BorderWidth )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BorderWidth )( - IDxtJpeg * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BorderSoftness )( - IDxtJpeg * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BorderSoftness )( - IDxtJpeg * This, - /* [in] */ long newVal); - - HRESULT ( STDMETHODCALLTYPE *ApplyChanges )( - IDxtJpeg * This); - - HRESULT ( STDMETHODCALLTYPE *LoadDefSettings )( - IDxtJpeg * This); - - END_INTERFACE - } IDxtJpegVtbl; - - interface IDxtJpeg - { - CONST_VTBL struct IDxtJpegVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDxtJpeg_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDxtJpeg_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDxtJpeg_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDxtJpeg_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDxtJpeg_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDxtJpeg_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDxtJpeg_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDxtJpeg_get_Capabilities(This,pVal) \ - ( (This)->lpVtbl -> get_Capabilities(This,pVal) ) - -#define IDxtJpeg_get_Progress(This,pVal) \ - ( (This)->lpVtbl -> get_Progress(This,pVal) ) - -#define IDxtJpeg_put_Progress(This,newVal) \ - ( (This)->lpVtbl -> put_Progress(This,newVal) ) - -#define IDxtJpeg_get_StepResolution(This,pVal) \ - ( (This)->lpVtbl -> get_StepResolution(This,pVal) ) - -#define IDxtJpeg_get_Duration(This,pVal) \ - ( (This)->lpVtbl -> get_Duration(This,pVal) ) - -#define IDxtJpeg_put_Duration(This,newVal) \ - ( (This)->lpVtbl -> put_Duration(This,newVal) ) - - -#define IDxtJpeg_get_MaskNum(This,__MIDL__IDxtJpeg0000) \ - ( (This)->lpVtbl -> get_MaskNum(This,__MIDL__IDxtJpeg0000) ) - -#define IDxtJpeg_put_MaskNum(This,__MIDL__IDxtJpeg0001) \ - ( (This)->lpVtbl -> put_MaskNum(This,__MIDL__IDxtJpeg0001) ) - -#define IDxtJpeg_get_MaskName(This,pVal) \ - ( (This)->lpVtbl -> get_MaskName(This,pVal) ) - -#define IDxtJpeg_put_MaskName(This,newVal) \ - ( (This)->lpVtbl -> put_MaskName(This,newVal) ) - -#define IDxtJpeg_get_ScaleX(This,__MIDL__IDxtJpeg0002) \ - ( (This)->lpVtbl -> get_ScaleX(This,__MIDL__IDxtJpeg0002) ) - -#define IDxtJpeg_put_ScaleX(This,__MIDL__IDxtJpeg0003) \ - ( (This)->lpVtbl -> put_ScaleX(This,__MIDL__IDxtJpeg0003) ) - -#define IDxtJpeg_get_ScaleY(This,__MIDL__IDxtJpeg0004) \ - ( (This)->lpVtbl -> get_ScaleY(This,__MIDL__IDxtJpeg0004) ) - -#define IDxtJpeg_put_ScaleY(This,__MIDL__IDxtJpeg0005) \ - ( (This)->lpVtbl -> put_ScaleY(This,__MIDL__IDxtJpeg0005) ) - -#define IDxtJpeg_get_OffsetX(This,__MIDL__IDxtJpeg0006) \ - ( (This)->lpVtbl -> get_OffsetX(This,__MIDL__IDxtJpeg0006) ) - -#define IDxtJpeg_put_OffsetX(This,__MIDL__IDxtJpeg0007) \ - ( (This)->lpVtbl -> put_OffsetX(This,__MIDL__IDxtJpeg0007) ) - -#define IDxtJpeg_get_OffsetY(This,__MIDL__IDxtJpeg0008) \ - ( (This)->lpVtbl -> get_OffsetY(This,__MIDL__IDxtJpeg0008) ) - -#define IDxtJpeg_put_OffsetY(This,__MIDL__IDxtJpeg0009) \ - ( (This)->lpVtbl -> put_OffsetY(This,__MIDL__IDxtJpeg0009) ) - -#define IDxtJpeg_get_ReplicateX(This,pVal) \ - ( (This)->lpVtbl -> get_ReplicateX(This,pVal) ) - -#define IDxtJpeg_put_ReplicateX(This,newVal) \ - ( (This)->lpVtbl -> put_ReplicateX(This,newVal) ) - -#define IDxtJpeg_get_ReplicateY(This,pVal) \ - ( (This)->lpVtbl -> get_ReplicateY(This,pVal) ) - -#define IDxtJpeg_put_ReplicateY(This,newVal) \ - ( (This)->lpVtbl -> put_ReplicateY(This,newVal) ) - -#define IDxtJpeg_get_BorderColor(This,pVal) \ - ( (This)->lpVtbl -> get_BorderColor(This,pVal) ) - -#define IDxtJpeg_put_BorderColor(This,newVal) \ - ( (This)->lpVtbl -> put_BorderColor(This,newVal) ) - -#define IDxtJpeg_get_BorderWidth(This,pVal) \ - ( (This)->lpVtbl -> get_BorderWidth(This,pVal) ) - -#define IDxtJpeg_put_BorderWidth(This,newVal) \ - ( (This)->lpVtbl -> put_BorderWidth(This,newVal) ) - -#define IDxtJpeg_get_BorderSoftness(This,pVal) \ - ( (This)->lpVtbl -> get_BorderSoftness(This,pVal) ) - -#define IDxtJpeg_put_BorderSoftness(This,newVal) \ - ( (This)->lpVtbl -> put_BorderSoftness(This,newVal) ) - -#define IDxtJpeg_ApplyChanges(This) \ - ( (This)->lpVtbl -> ApplyChanges(This) ) - -#define IDxtJpeg_LoadDefSettings(This) \ - ( (This)->lpVtbl -> LoadDefSettings(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDxtJpeg_INTERFACE_DEFINED__ */ - - -#ifndef __IDxtKey_INTERFACE_DEFINED__ -#define __IDxtKey_INTERFACE_DEFINED__ - -/* interface IDxtKey */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IDxtKey; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3255de56-38fb-4901-b980-94b438010d7b") - IDxtKey : public IDXEffect - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_KeyType( - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0000) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_KeyType( - /* [in] */ int __MIDL__IDxtKey0001) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Hue( - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0002) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Hue( - /* [in] */ int __MIDL__IDxtKey0003) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Luminance( - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0004) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Luminance( - /* [in] */ int __MIDL__IDxtKey0005) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_RGB( - /* [retval][out] */ __RPC__out DWORD *__MIDL__IDxtKey0006) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_RGB( - /* [in] */ DWORD __MIDL__IDxtKey0007) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Similarity( - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0008) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Similarity( - /* [in] */ int __MIDL__IDxtKey0009) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Invert( - /* [retval][out] */ __RPC__out BOOL *__MIDL__IDxtKey0010) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Invert( - /* [in] */ BOOL __MIDL__IDxtKey0011) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDxtKeyVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDxtKey * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDxtKey * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDxtKey * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IDxtKey * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IDxtKey * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IDxtKey * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDxtKey * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Capabilities )( - IDxtKey * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Progress )( - IDxtKey * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Progress )( - IDxtKey * This, - /* [in] */ float newVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StepResolution )( - IDxtKey * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( - IDxtKey * This, - /* [retval][out] */ __RPC__out float *pVal); - - /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( - IDxtKey * This, - /* [in] */ float newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_KeyType )( - IDxtKey * This, - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0000); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_KeyType )( - IDxtKey * This, - /* [in] */ int __MIDL__IDxtKey0001); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Hue )( - IDxtKey * This, - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0002); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Hue )( - IDxtKey * This, - /* [in] */ int __MIDL__IDxtKey0003); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Luminance )( - IDxtKey * This, - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0004); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Luminance )( - IDxtKey * This, - /* [in] */ int __MIDL__IDxtKey0005); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RGB )( - IDxtKey * This, - /* [retval][out] */ __RPC__out DWORD *__MIDL__IDxtKey0006); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_RGB )( - IDxtKey * This, - /* [in] */ DWORD __MIDL__IDxtKey0007); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Similarity )( - IDxtKey * This, - /* [retval][out] */ __RPC__out int *__MIDL__IDxtKey0008); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Similarity )( - IDxtKey * This, - /* [in] */ int __MIDL__IDxtKey0009); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Invert )( - IDxtKey * This, - /* [retval][out] */ __RPC__out BOOL *__MIDL__IDxtKey0010); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Invert )( - IDxtKey * This, - /* [in] */ BOOL __MIDL__IDxtKey0011); - - END_INTERFACE - } IDxtKeyVtbl; - - interface IDxtKey - { - CONST_VTBL struct IDxtKeyVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDxtKey_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDxtKey_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDxtKey_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDxtKey_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDxtKey_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDxtKey_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDxtKey_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDxtKey_get_Capabilities(This,pVal) \ - ( (This)->lpVtbl -> get_Capabilities(This,pVal) ) - -#define IDxtKey_get_Progress(This,pVal) \ - ( (This)->lpVtbl -> get_Progress(This,pVal) ) - -#define IDxtKey_put_Progress(This,newVal) \ - ( (This)->lpVtbl -> put_Progress(This,newVal) ) - -#define IDxtKey_get_StepResolution(This,pVal) \ - ( (This)->lpVtbl -> get_StepResolution(This,pVal) ) - -#define IDxtKey_get_Duration(This,pVal) \ - ( (This)->lpVtbl -> get_Duration(This,pVal) ) - -#define IDxtKey_put_Duration(This,newVal) \ - ( (This)->lpVtbl -> put_Duration(This,newVal) ) - - -#define IDxtKey_get_KeyType(This,__MIDL__IDxtKey0000) \ - ( (This)->lpVtbl -> get_KeyType(This,__MIDL__IDxtKey0000) ) - -#define IDxtKey_put_KeyType(This,__MIDL__IDxtKey0001) \ - ( (This)->lpVtbl -> put_KeyType(This,__MIDL__IDxtKey0001) ) - -#define IDxtKey_get_Hue(This,__MIDL__IDxtKey0002) \ - ( (This)->lpVtbl -> get_Hue(This,__MIDL__IDxtKey0002) ) - -#define IDxtKey_put_Hue(This,__MIDL__IDxtKey0003) \ - ( (This)->lpVtbl -> put_Hue(This,__MIDL__IDxtKey0003) ) - -#define IDxtKey_get_Luminance(This,__MIDL__IDxtKey0004) \ - ( (This)->lpVtbl -> get_Luminance(This,__MIDL__IDxtKey0004) ) - -#define IDxtKey_put_Luminance(This,__MIDL__IDxtKey0005) \ - ( (This)->lpVtbl -> put_Luminance(This,__MIDL__IDxtKey0005) ) - -#define IDxtKey_get_RGB(This,__MIDL__IDxtKey0006) \ - ( (This)->lpVtbl -> get_RGB(This,__MIDL__IDxtKey0006) ) - -#define IDxtKey_put_RGB(This,__MIDL__IDxtKey0007) \ - ( (This)->lpVtbl -> put_RGB(This,__MIDL__IDxtKey0007) ) - -#define IDxtKey_get_Similarity(This,__MIDL__IDxtKey0008) \ - ( (This)->lpVtbl -> get_Similarity(This,__MIDL__IDxtKey0008) ) - -#define IDxtKey_put_Similarity(This,__MIDL__IDxtKey0009) \ - ( (This)->lpVtbl -> put_Similarity(This,__MIDL__IDxtKey0009) ) - -#define IDxtKey_get_Invert(This,__MIDL__IDxtKey0010) \ - ( (This)->lpVtbl -> get_Invert(This,__MIDL__IDxtKey0010) ) - -#define IDxtKey_put_Invert(This,__MIDL__IDxtKey0011) \ - ( (This)->lpVtbl -> put_Invert(This,__MIDL__IDxtKey0011) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDxtKey_INTERFACE_DEFINED__ */ - - -#ifndef __IMediaLocator_INTERFACE_DEFINED__ -#define __IMediaLocator_INTERFACE_DEFINED__ - -/* interface IMediaLocator */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IMediaLocator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("288581E0-66CE-11d2-918F-00C0DF10D434") - IMediaLocator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE FindMediaFile( - __RPC__in BSTR Input, - __RPC__in BSTR FilterString, - __RPC__deref_in_opt BSTR *pOutput, - long Flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddFoundLocation( - __RPC__in BSTR DirectoryName) = 0; - - }; - -#else /* C style interface */ - - typedef struct IMediaLocatorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IMediaLocator * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IMediaLocator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IMediaLocator * This); - - HRESULT ( STDMETHODCALLTYPE *FindMediaFile )( - IMediaLocator * This, - __RPC__in BSTR Input, - __RPC__in BSTR FilterString, - __RPC__deref_in_opt BSTR *pOutput, - long Flags); - - HRESULT ( STDMETHODCALLTYPE *AddFoundLocation )( - IMediaLocator * This, - __RPC__in BSTR DirectoryName); - - END_INTERFACE - } IMediaLocatorVtbl; - - interface IMediaLocator - { - CONST_VTBL struct IMediaLocatorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IMediaLocator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IMediaLocator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IMediaLocator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IMediaLocator_FindMediaFile(This,Input,FilterString,pOutput,Flags) \ - ( (This)->lpVtbl -> FindMediaFile(This,Input,FilterString,pOutput,Flags) ) - -#define IMediaLocator_AddFoundLocation(This,DirectoryName) \ - ( (This)->lpVtbl -> AddFoundLocation(This,DirectoryName) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IMediaLocator_INTERFACE_DEFINED__ */ - - -#ifndef __IMediaDet_INTERFACE_DEFINED__ -#define __IMediaDet_INTERFACE_DEFINED__ - -/* interface IMediaDet */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IMediaDet; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("65BD0710-24D2-4ff7-9324-ED2E5D3ABAFA") - IMediaDet : public IUnknown - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Filter( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Filter( - /* [in] */ __RPC__in_opt IUnknown *newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OutputStreams( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStream( - /* [retval][out] */ __RPC__out long *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentStream( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamType( - /* [retval][out] */ __RPC__out GUID *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamTypeB( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamLength( - /* [retval][out] */ __RPC__out double *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Filename( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Filename( - /* [in] */ __RPC__in BSTR newVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetBitmapBits( - double StreamTime, - __RPC__in long *pBufferSize, - __RPC__in char *pBuffer, - long Width, - long Height) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteBitmapBits( - double StreamTime, - long Width, - long Height, - __RPC__in BSTR Filename) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamMediaType( - /* [retval][out] */ __RPC__out AM_MEDIA_TYPE *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSampleGrabber( - /* [out] */ __RPC__deref_out_opt ISampleGrabber **ppVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_FrameRate( - /* [retval][out] */ __RPC__out double *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnterBitmapGrabMode( - double SeekTime) = 0; - - }; - -#else /* C style interface */ - - typedef struct IMediaDetVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IMediaDet * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IMediaDet * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IMediaDet * This); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Filter )( - IMediaDet * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Filter )( - IMediaDet * This, - /* [in] */ __RPC__in_opt IUnknown *newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OutputStreams )( - IMediaDet * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStream )( - IMediaDet * This, - /* [retval][out] */ __RPC__out long *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_CurrentStream )( - IMediaDet * This, - /* [in] */ long newVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamType )( - IMediaDet * This, - /* [retval][out] */ __RPC__out GUID *pVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamTypeB )( - IMediaDet * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamLength )( - IMediaDet * This, - /* [retval][out] */ __RPC__out double *pVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Filename )( - IMediaDet * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Filename )( - IMediaDet * This, - /* [in] */ __RPC__in BSTR newVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetBitmapBits )( - IMediaDet * This, - double StreamTime, - __RPC__in long *pBufferSize, - __RPC__in char *pBuffer, - long Width, - long Height); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *WriteBitmapBits )( - IMediaDet * This, - double StreamTime, - long Width, - long Height, - __RPC__in BSTR Filename); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamMediaType )( - IMediaDet * This, - /* [retval][out] */ __RPC__out AM_MEDIA_TYPE *pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSampleGrabber )( - IMediaDet * This, - /* [out] */ __RPC__deref_out_opt ISampleGrabber **ppVal); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameRate )( - IMediaDet * This, - /* [retval][out] */ __RPC__out double *pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnterBitmapGrabMode )( - IMediaDet * This, - double SeekTime); - - END_INTERFACE - } IMediaDetVtbl; - - interface IMediaDet - { - CONST_VTBL struct IMediaDetVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IMediaDet_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IMediaDet_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IMediaDet_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IMediaDet_get_Filter(This,pVal) \ - ( (This)->lpVtbl -> get_Filter(This,pVal) ) - -#define IMediaDet_put_Filter(This,newVal) \ - ( (This)->lpVtbl -> put_Filter(This,newVal) ) - -#define IMediaDet_get_OutputStreams(This,pVal) \ - ( (This)->lpVtbl -> get_OutputStreams(This,pVal) ) - -#define IMediaDet_get_CurrentStream(This,pVal) \ - ( (This)->lpVtbl -> get_CurrentStream(This,pVal) ) - -#define IMediaDet_put_CurrentStream(This,newVal) \ - ( (This)->lpVtbl -> put_CurrentStream(This,newVal) ) - -#define IMediaDet_get_StreamType(This,pVal) \ - ( (This)->lpVtbl -> get_StreamType(This,pVal) ) - -#define IMediaDet_get_StreamTypeB(This,pVal) \ - ( (This)->lpVtbl -> get_StreamTypeB(This,pVal) ) - -#define IMediaDet_get_StreamLength(This,pVal) \ - ( (This)->lpVtbl -> get_StreamLength(This,pVal) ) - -#define IMediaDet_get_Filename(This,pVal) \ - ( (This)->lpVtbl -> get_Filename(This,pVal) ) - -#define IMediaDet_put_Filename(This,newVal) \ - ( (This)->lpVtbl -> put_Filename(This,newVal) ) - -#define IMediaDet_GetBitmapBits(This,StreamTime,pBufferSize,pBuffer,Width,Height) \ - ( (This)->lpVtbl -> GetBitmapBits(This,StreamTime,pBufferSize,pBuffer,Width,Height) ) - -#define IMediaDet_WriteBitmapBits(This,StreamTime,Width,Height,Filename) \ - ( (This)->lpVtbl -> WriteBitmapBits(This,StreamTime,Width,Height,Filename) ) - -#define IMediaDet_get_StreamMediaType(This,pVal) \ - ( (This)->lpVtbl -> get_StreamMediaType(This,pVal) ) - -#define IMediaDet_GetSampleGrabber(This,ppVal) \ - ( (This)->lpVtbl -> GetSampleGrabber(This,ppVal) ) - -#define IMediaDet_get_FrameRate(This,pVal) \ - ( (This)->lpVtbl -> get_FrameRate(This,pVal) ) - -#define IMediaDet_EnterBitmapGrabMode(This,SeekTime) \ - ( (This)->lpVtbl -> EnterBitmapGrabMode(This,SeekTime) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IMediaDet_INTERFACE_DEFINED__ */ - - -#ifndef __IGrfCache_INTERFACE_DEFINED__ -#define __IGrfCache_INTERFACE_DEFINED__ - -/* interface IGrfCache */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IGrfCache; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AE9472BE-B0C3-11D2-8D24-00A0C9441E20") - IGrfCache : public IDispatch - { - public: - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AddFilter( - __RPC__in_opt IGrfCache *ChainedCache, - LONGLONG ID, - __RPC__in_opt const IBaseFilter *pFilter, - __RPC__in LPCWSTR pName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ConnectPins( - __RPC__in_opt IGrfCache *ChainedCache, - LONGLONG PinID1, - __RPC__in_opt const IPin *pPin1, - LONGLONG PinID2, - __RPC__in_opt const IPin *pPin2) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetGraph( - __RPC__in_opt const IGraphBuilder *pGraph) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE DoConnectionsNow( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IGrfCacheVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IGrfCache * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IGrfCache * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IGrfCache * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IGrfCache * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IGrfCache * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IGrfCache * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IGrfCache * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *AddFilter )( - IGrfCache * This, - __RPC__in_opt IGrfCache *ChainedCache, - LONGLONG ID, - __RPC__in_opt const IBaseFilter *pFilter, - __RPC__in LPCWSTR pName); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ConnectPins )( - IGrfCache * This, - __RPC__in_opt IGrfCache *ChainedCache, - LONGLONG PinID1, - __RPC__in_opt const IPin *pPin1, - LONGLONG PinID2, - __RPC__in_opt const IPin *pPin2); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetGraph )( - IGrfCache * This, - __RPC__in_opt const IGraphBuilder *pGraph); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *DoConnectionsNow )( - IGrfCache * This); - - END_INTERFACE - } IGrfCacheVtbl; - - interface IGrfCache - { - CONST_VTBL struct IGrfCacheVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IGrfCache_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IGrfCache_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IGrfCache_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IGrfCache_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IGrfCache_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IGrfCache_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IGrfCache_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IGrfCache_AddFilter(This,ChainedCache,ID,pFilter,pName) \ - ( (This)->lpVtbl -> AddFilter(This,ChainedCache,ID,pFilter,pName) ) - -#define IGrfCache_ConnectPins(This,ChainedCache,PinID1,pPin1,PinID2,pPin2) \ - ( (This)->lpVtbl -> ConnectPins(This,ChainedCache,PinID1,pPin1,PinID2,pPin2) ) - -#define IGrfCache_SetGraph(This,pGraph) \ - ( (This)->lpVtbl -> SetGraph(This,pGraph) ) - -#define IGrfCache_DoConnectionsNow(This) \ - ( (This)->lpVtbl -> DoConnectionsNow(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IGrfCache_INTERFACE_DEFINED__ */ - - -#ifndef __IRenderEngine_INTERFACE_DEFINED__ -#define __IRenderEngine_INTERFACE_DEFINED__ - -/* interface IRenderEngine */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IRenderEngine; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6BEE3A81-66C9-11d2-918F-00C0DF10D434") - IRenderEngine : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetTimelineObject( - __RPC__in_opt IAMTimeline *pTimeline) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimelineObject( - /* [out] */ __RPC__deref_out_opt IAMTimeline **ppTimeline) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFilterGraph( - /* [out] */ __RPC__deref_out_opt IGraphBuilder **ppFG) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFilterGraph( - __RPC__in_opt IGraphBuilder *pFG) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInterestRange( - REFERENCE_TIME Start, - REFERENCE_TIME Stop) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInterestRange2( - double Start, - double Stop) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetRenderRange( - REFERENCE_TIME Start, - REFERENCE_TIME Stop) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetRenderRange2( - double Start, - double Stop) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGroupOutputPin( - long Group, - /* [out] */ __RPC__deref_out_opt IPin **ppRenderPin) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScrapIt( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE RenderOutputPins( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVendorString( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVendorID) = 0; - - virtual HRESULT STDMETHODCALLTYPE ConnectFrontEnd( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSourceConnectCallback( - __RPC__in_opt IGrfCache *pCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDynamicReconnectLevel( - long Level) = 0; - - virtual HRESULT STDMETHODCALLTYPE DoSmartRecompression( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE UseInSmartRecompressionGraph( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSourceNameValidation( - __RPC__in BSTR FilterString, - __RPC__in_opt IMediaLocator *pOverride, - LONG Flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Decommit( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCaps( - long Index, - __RPC__in long *pReturn) = 0; - - }; - -#else /* C style interface */ - - typedef struct IRenderEngineVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IRenderEngine * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IRenderEngine * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *SetTimelineObject )( - IRenderEngine * This, - __RPC__in_opt IAMTimeline *pTimeline); - - HRESULT ( STDMETHODCALLTYPE *GetTimelineObject )( - IRenderEngine * This, - /* [out] */ __RPC__deref_out_opt IAMTimeline **ppTimeline); - - HRESULT ( STDMETHODCALLTYPE *GetFilterGraph )( - IRenderEngine * This, - /* [out] */ __RPC__deref_out_opt IGraphBuilder **ppFG); - - HRESULT ( STDMETHODCALLTYPE *SetFilterGraph )( - IRenderEngine * This, - __RPC__in_opt IGraphBuilder *pFG); - - HRESULT ( STDMETHODCALLTYPE *SetInterestRange )( - IRenderEngine * This, - REFERENCE_TIME Start, - REFERENCE_TIME Stop); - - HRESULT ( STDMETHODCALLTYPE *SetInterestRange2 )( - IRenderEngine * This, - double Start, - double Stop); - - HRESULT ( STDMETHODCALLTYPE *SetRenderRange )( - IRenderEngine * This, - REFERENCE_TIME Start, - REFERENCE_TIME Stop); - - HRESULT ( STDMETHODCALLTYPE *SetRenderRange2 )( - IRenderEngine * This, - double Start, - double Stop); - - HRESULT ( STDMETHODCALLTYPE *GetGroupOutputPin )( - IRenderEngine * This, - long Group, - /* [out] */ __RPC__deref_out_opt IPin **ppRenderPin); - - HRESULT ( STDMETHODCALLTYPE *ScrapIt )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *RenderOutputPins )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *GetVendorString )( - IRenderEngine * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVendorID); - - HRESULT ( STDMETHODCALLTYPE *ConnectFrontEnd )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *SetSourceConnectCallback )( - IRenderEngine * This, - __RPC__in_opt IGrfCache *pCallback); - - HRESULT ( STDMETHODCALLTYPE *SetDynamicReconnectLevel )( - IRenderEngine * This, - long Level); - - HRESULT ( STDMETHODCALLTYPE *DoSmartRecompression )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *UseInSmartRecompressionGraph )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *SetSourceNameValidation )( - IRenderEngine * This, - __RPC__in BSTR FilterString, - __RPC__in_opt IMediaLocator *pOverride, - LONG Flags); - - HRESULT ( STDMETHODCALLTYPE *Commit )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *Decommit )( - IRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *GetCaps )( - IRenderEngine * This, - long Index, - __RPC__in long *pReturn); - - END_INTERFACE - } IRenderEngineVtbl; - - interface IRenderEngine - { - CONST_VTBL struct IRenderEngineVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IRenderEngine_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IRenderEngine_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IRenderEngine_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IRenderEngine_SetTimelineObject(This,pTimeline) \ - ( (This)->lpVtbl -> SetTimelineObject(This,pTimeline) ) - -#define IRenderEngine_GetTimelineObject(This,ppTimeline) \ - ( (This)->lpVtbl -> GetTimelineObject(This,ppTimeline) ) - -#define IRenderEngine_GetFilterGraph(This,ppFG) \ - ( (This)->lpVtbl -> GetFilterGraph(This,ppFG) ) - -#define IRenderEngine_SetFilterGraph(This,pFG) \ - ( (This)->lpVtbl -> SetFilterGraph(This,pFG) ) - -#define IRenderEngine_SetInterestRange(This,Start,Stop) \ - ( (This)->lpVtbl -> SetInterestRange(This,Start,Stop) ) - -#define IRenderEngine_SetInterestRange2(This,Start,Stop) \ - ( (This)->lpVtbl -> SetInterestRange2(This,Start,Stop) ) - -#define IRenderEngine_SetRenderRange(This,Start,Stop) \ - ( (This)->lpVtbl -> SetRenderRange(This,Start,Stop) ) - -#define IRenderEngine_SetRenderRange2(This,Start,Stop) \ - ( (This)->lpVtbl -> SetRenderRange2(This,Start,Stop) ) - -#define IRenderEngine_GetGroupOutputPin(This,Group,ppRenderPin) \ - ( (This)->lpVtbl -> GetGroupOutputPin(This,Group,ppRenderPin) ) - -#define IRenderEngine_ScrapIt(This) \ - ( (This)->lpVtbl -> ScrapIt(This) ) - -#define IRenderEngine_RenderOutputPins(This) \ - ( (This)->lpVtbl -> RenderOutputPins(This) ) - -#define IRenderEngine_GetVendorString(This,pVendorID) \ - ( (This)->lpVtbl -> GetVendorString(This,pVendorID) ) - -#define IRenderEngine_ConnectFrontEnd(This) \ - ( (This)->lpVtbl -> ConnectFrontEnd(This) ) - -#define IRenderEngine_SetSourceConnectCallback(This,pCallback) \ - ( (This)->lpVtbl -> SetSourceConnectCallback(This,pCallback) ) - -#define IRenderEngine_SetDynamicReconnectLevel(This,Level) \ - ( (This)->lpVtbl -> SetDynamicReconnectLevel(This,Level) ) - -#define IRenderEngine_DoSmartRecompression(This) \ - ( (This)->lpVtbl -> DoSmartRecompression(This) ) - -#define IRenderEngine_UseInSmartRecompressionGraph(This) \ - ( (This)->lpVtbl -> UseInSmartRecompressionGraph(This) ) - -#define IRenderEngine_SetSourceNameValidation(This,FilterString,pOverride,Flags) \ - ( (This)->lpVtbl -> SetSourceNameValidation(This,FilterString,pOverride,Flags) ) - -#define IRenderEngine_Commit(This) \ - ( (This)->lpVtbl -> Commit(This) ) - -#define IRenderEngine_Decommit(This) \ - ( (This)->lpVtbl -> Decommit(This) ) - -#define IRenderEngine_GetCaps(This,Index,pReturn) \ - ( (This)->lpVtbl -> GetCaps(This,Index,pReturn) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IRenderEngine_INTERFACE_DEFINED__ */ - - -#ifndef __IRenderEngine2_INTERFACE_DEFINED__ -#define __IRenderEngine2_INTERFACE_DEFINED__ - -/* interface IRenderEngine2 */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IRenderEngine2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6BEE3A82-66C9-11d2-918F-00C0DF10D434") - IRenderEngine2 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetResizerGUID( - GUID ResizerGuid) = 0; - - }; - -#else /* C style interface */ - - typedef struct IRenderEngine2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IRenderEngine2 * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IRenderEngine2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IRenderEngine2 * This); - - HRESULT ( STDMETHODCALLTYPE *SetResizerGUID )( - IRenderEngine2 * This, - GUID ResizerGuid); - - END_INTERFACE - } IRenderEngine2Vtbl; - - interface IRenderEngine2 - { - CONST_VTBL struct IRenderEngine2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IRenderEngine2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IRenderEngine2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IRenderEngine2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IRenderEngine2_SetResizerGUID(This,ResizerGuid) \ - ( (This)->lpVtbl -> SetResizerGUID(This,ResizerGuid) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IRenderEngine2_INTERFACE_DEFINED__ */ - - -#ifndef __IFindCompressorCB_INTERFACE_DEFINED__ -#define __IFindCompressorCB_INTERFACE_DEFINED__ - -/* interface IFindCompressorCB */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IFindCompressorCB; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F03FA8DE-879A-4d59-9B2C-26BB1CF83461") - IFindCompressorCB : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetCompressor( - __RPC__in AM_MEDIA_TYPE *pType, - __RPC__in AM_MEDIA_TYPE *pCompType, - /* [out] */ __RPC__deref_out_opt IBaseFilter **ppFilter) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFindCompressorCBVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFindCompressorCB * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFindCompressorCB * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFindCompressorCB * This); - - HRESULT ( STDMETHODCALLTYPE *GetCompressor )( - IFindCompressorCB * This, - __RPC__in AM_MEDIA_TYPE *pType, - __RPC__in AM_MEDIA_TYPE *pCompType, - /* [out] */ __RPC__deref_out_opt IBaseFilter **ppFilter); - - END_INTERFACE - } IFindCompressorCBVtbl; - - interface IFindCompressorCB - { - CONST_VTBL struct IFindCompressorCBVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFindCompressorCB_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IFindCompressorCB_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IFindCompressorCB_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IFindCompressorCB_GetCompressor(This,pType,pCompType,ppFilter) \ - ( (This)->lpVtbl -> GetCompressor(This,pType,pCompType,ppFilter) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFindCompressorCB_INTERFACE_DEFINED__ */ - - -#ifndef __ISmartRenderEngine_INTERFACE_DEFINED__ -#define __ISmartRenderEngine_INTERFACE_DEFINED__ - -/* interface ISmartRenderEngine */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_ISmartRenderEngine; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F03FA8CE-879A-4d59-9B2C-26BB1CF83461") - ISmartRenderEngine : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetGroupCompressor( - long Group, - __RPC__in_opt IBaseFilter *pCompressor) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGroupCompressor( - long Group, - __RPC__deref_in_opt IBaseFilter **pCompressor) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFindCompressorCB( - __RPC__in_opt IFindCompressorCB *pCallback) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISmartRenderEngineVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ISmartRenderEngine * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ISmartRenderEngine * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ISmartRenderEngine * This); - - HRESULT ( STDMETHODCALLTYPE *SetGroupCompressor )( - ISmartRenderEngine * This, - long Group, - __RPC__in_opt IBaseFilter *pCompressor); - - HRESULT ( STDMETHODCALLTYPE *GetGroupCompressor )( - ISmartRenderEngine * This, - long Group, - __RPC__deref_in_opt IBaseFilter **pCompressor); - - HRESULT ( STDMETHODCALLTYPE *SetFindCompressorCB )( - ISmartRenderEngine * This, - __RPC__in_opt IFindCompressorCB *pCallback); - - END_INTERFACE - } ISmartRenderEngineVtbl; - - interface ISmartRenderEngine - { - CONST_VTBL struct ISmartRenderEngineVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISmartRenderEngine_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISmartRenderEngine_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISmartRenderEngine_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISmartRenderEngine_SetGroupCompressor(This,Group,pCompressor) \ - ( (This)->lpVtbl -> SetGroupCompressor(This,Group,pCompressor) ) - -#define ISmartRenderEngine_GetGroupCompressor(This,Group,pCompressor) \ - ( (This)->lpVtbl -> GetGroupCompressor(This,Group,pCompressor) ) - -#define ISmartRenderEngine_SetFindCompressorCB(This,pCallback) \ - ( (This)->lpVtbl -> SetFindCompressorCB(This,pCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISmartRenderEngine_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineObj_INTERFACE_DEFINED__ -#define __IAMTimelineObj_INTERFACE_DEFINED__ - -/* interface IAMTimelineObj */ -/* [unique][helpstring][uuid][local][object] */ - - -EXTERN_C const IID IID_IAMTimelineObj; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("78530B77-61F9-11D2-8CAD-00A024580902") - IAMTimelineObj : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStartStop( - REFERENCE_TIME *pStart, - REFERENCE_TIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStartStop2( - REFTIME *pStart, - REFTIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FixTimes( - REFERENCE_TIME *pStart, - REFERENCE_TIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FixTimes2( - REFTIME *pStart, - REFTIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStartStop( - REFERENCE_TIME Start, - REFERENCE_TIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStartStop2( - REFTIME Start, - REFTIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertySetter( - /* [retval][out] */ IPropertySetter **pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetPropertySetter( - IPropertySetter *newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSubObject( - /* [retval][out] */ IUnknown **pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetSubObject( - IUnknown *newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetSubObjectGUID( - GUID newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetSubObjectGUIDB( - BSTR newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSubObjectGUID( - GUID *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSubObjectGUIDB( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSubObjectLoaded( - BOOL *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetTimelineType( - TIMELINE_MAJOR_TYPE *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetTimelineType( - TIMELINE_MAJOR_TYPE newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetUserID( - long *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetUserID( - long newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetGenID( - long *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetUserName( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetUserName( - BSTR newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetUserData( - BYTE *pData, - long *pSize) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetUserData( - BYTE *pData, - long Size) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMuted( - BOOL *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMuted( - BOOL newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetLocked( - BOOL *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetLocked( - BOOL newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDirtyRange( - REFERENCE_TIME *pStart, - REFERENCE_TIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDirtyRange2( - REFTIME *pStart, - REFTIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetDirtyRange( - REFERENCE_TIME Start, - REFERENCE_TIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetDirtyRange2( - REFTIME Start, - REFTIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ClearDirty( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Remove( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveAll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimelineNoRef( - IAMTimeline **ppResult) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGroupIBelongTo( - /* [out] */ IAMTimelineGroup **ppGroup) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetEmbedDepth( - long *pVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineObjVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineObj * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineObj * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineObj * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStartStop )( - IAMTimelineObj * This, - REFERENCE_TIME *pStart, - REFERENCE_TIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStartStop2 )( - IAMTimelineObj * This, - REFTIME *pStart, - REFTIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FixTimes )( - IAMTimelineObj * This, - REFERENCE_TIME *pStart, - REFERENCE_TIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FixTimes2 )( - IAMTimelineObj * This, - REFTIME *pStart, - REFTIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStartStop )( - IAMTimelineObj * This, - REFERENCE_TIME Start, - REFERENCE_TIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStartStop2 )( - IAMTimelineObj * This, - REFTIME Start, - REFTIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertySetter )( - IAMTimelineObj * This, - /* [retval][out] */ IPropertySetter **pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetPropertySetter )( - IAMTimelineObj * This, - IPropertySetter *newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSubObject )( - IAMTimelineObj * This, - /* [retval][out] */ IUnknown **pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetSubObject )( - IAMTimelineObj * This, - IUnknown *newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetSubObjectGUID )( - IAMTimelineObj * This, - GUID newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetSubObjectGUIDB )( - IAMTimelineObj * This, - BSTR newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSubObjectGUID )( - IAMTimelineObj * This, - GUID *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSubObjectGUIDB )( - IAMTimelineObj * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSubObjectLoaded )( - IAMTimelineObj * This, - BOOL *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetTimelineType )( - IAMTimelineObj * This, - TIMELINE_MAJOR_TYPE *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetTimelineType )( - IAMTimelineObj * This, - TIMELINE_MAJOR_TYPE newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetUserID )( - IAMTimelineObj * This, - long *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetUserID )( - IAMTimelineObj * This, - long newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetGenID )( - IAMTimelineObj * This, - long *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetUserName )( - IAMTimelineObj * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetUserName )( - IAMTimelineObj * This, - BSTR newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetUserData )( - IAMTimelineObj * This, - BYTE *pData, - long *pSize); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetUserData )( - IAMTimelineObj * This, - BYTE *pData, - long Size); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMuted )( - IAMTimelineObj * This, - BOOL *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMuted )( - IAMTimelineObj * This, - BOOL newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetLocked )( - IAMTimelineObj * This, - BOOL *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetLocked )( - IAMTimelineObj * This, - BOOL newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDirtyRange )( - IAMTimelineObj * This, - REFERENCE_TIME *pStart, - REFERENCE_TIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDirtyRange2 )( - IAMTimelineObj * This, - REFTIME *pStart, - REFTIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetDirtyRange )( - IAMTimelineObj * This, - REFERENCE_TIME Start, - REFERENCE_TIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetDirtyRange2 )( - IAMTimelineObj * This, - REFTIME Start, - REFTIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ClearDirty )( - IAMTimelineObj * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Remove )( - IAMTimelineObj * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveAll )( - IAMTimelineObj * This); - - HRESULT ( STDMETHODCALLTYPE *GetTimelineNoRef )( - IAMTimelineObj * This, - IAMTimeline **ppResult); - - HRESULT ( STDMETHODCALLTYPE *GetGroupIBelongTo )( - IAMTimelineObj * This, - /* [out] */ IAMTimelineGroup **ppGroup); - - HRESULT ( STDMETHODCALLTYPE *GetEmbedDepth )( - IAMTimelineObj * This, - long *pVal); - - END_INTERFACE - } IAMTimelineObjVtbl; - - interface IAMTimelineObj - { - CONST_VTBL struct IAMTimelineObjVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineObj_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineObj_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineObj_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineObj_GetStartStop(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetStartStop(This,pStart,pStop) ) - -#define IAMTimelineObj_GetStartStop2(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetStartStop2(This,pStart,pStop) ) - -#define IAMTimelineObj_FixTimes(This,pStart,pStop) \ - ( (This)->lpVtbl -> FixTimes(This,pStart,pStop) ) - -#define IAMTimelineObj_FixTimes2(This,pStart,pStop) \ - ( (This)->lpVtbl -> FixTimes2(This,pStart,pStop) ) - -#define IAMTimelineObj_SetStartStop(This,Start,Stop) \ - ( (This)->lpVtbl -> SetStartStop(This,Start,Stop) ) - -#define IAMTimelineObj_SetStartStop2(This,Start,Stop) \ - ( (This)->lpVtbl -> SetStartStop2(This,Start,Stop) ) - -#define IAMTimelineObj_GetPropertySetter(This,pVal) \ - ( (This)->lpVtbl -> GetPropertySetter(This,pVal) ) - -#define IAMTimelineObj_SetPropertySetter(This,newVal) \ - ( (This)->lpVtbl -> SetPropertySetter(This,newVal) ) - -#define IAMTimelineObj_GetSubObject(This,pVal) \ - ( (This)->lpVtbl -> GetSubObject(This,pVal) ) - -#define IAMTimelineObj_SetSubObject(This,newVal) \ - ( (This)->lpVtbl -> SetSubObject(This,newVal) ) - -#define IAMTimelineObj_SetSubObjectGUID(This,newVal) \ - ( (This)->lpVtbl -> SetSubObjectGUID(This,newVal) ) - -#define IAMTimelineObj_SetSubObjectGUIDB(This,newVal) \ - ( (This)->lpVtbl -> SetSubObjectGUIDB(This,newVal) ) - -#define IAMTimelineObj_GetSubObjectGUID(This,pVal) \ - ( (This)->lpVtbl -> GetSubObjectGUID(This,pVal) ) - -#define IAMTimelineObj_GetSubObjectGUIDB(This,pVal) \ - ( (This)->lpVtbl -> GetSubObjectGUIDB(This,pVal) ) - -#define IAMTimelineObj_GetSubObjectLoaded(This,pVal) \ - ( (This)->lpVtbl -> GetSubObjectLoaded(This,pVal) ) - -#define IAMTimelineObj_GetTimelineType(This,pVal) \ - ( (This)->lpVtbl -> GetTimelineType(This,pVal) ) - -#define IAMTimelineObj_SetTimelineType(This,newVal) \ - ( (This)->lpVtbl -> SetTimelineType(This,newVal) ) - -#define IAMTimelineObj_GetUserID(This,pVal) \ - ( (This)->lpVtbl -> GetUserID(This,pVal) ) - -#define IAMTimelineObj_SetUserID(This,newVal) \ - ( (This)->lpVtbl -> SetUserID(This,newVal) ) - -#define IAMTimelineObj_GetGenID(This,pVal) \ - ( (This)->lpVtbl -> GetGenID(This,pVal) ) - -#define IAMTimelineObj_GetUserName(This,pVal) \ - ( (This)->lpVtbl -> GetUserName(This,pVal) ) - -#define IAMTimelineObj_SetUserName(This,newVal) \ - ( (This)->lpVtbl -> SetUserName(This,newVal) ) - -#define IAMTimelineObj_GetUserData(This,pData,pSize) \ - ( (This)->lpVtbl -> GetUserData(This,pData,pSize) ) - -#define IAMTimelineObj_SetUserData(This,pData,Size) \ - ( (This)->lpVtbl -> SetUserData(This,pData,Size) ) - -#define IAMTimelineObj_GetMuted(This,pVal) \ - ( (This)->lpVtbl -> GetMuted(This,pVal) ) - -#define IAMTimelineObj_SetMuted(This,newVal) \ - ( (This)->lpVtbl -> SetMuted(This,newVal) ) - -#define IAMTimelineObj_GetLocked(This,pVal) \ - ( (This)->lpVtbl -> GetLocked(This,pVal) ) - -#define IAMTimelineObj_SetLocked(This,newVal) \ - ( (This)->lpVtbl -> SetLocked(This,newVal) ) - -#define IAMTimelineObj_GetDirtyRange(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetDirtyRange(This,pStart,pStop) ) - -#define IAMTimelineObj_GetDirtyRange2(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetDirtyRange2(This,pStart,pStop) ) - -#define IAMTimelineObj_SetDirtyRange(This,Start,Stop) \ - ( (This)->lpVtbl -> SetDirtyRange(This,Start,Stop) ) - -#define IAMTimelineObj_SetDirtyRange2(This,Start,Stop) \ - ( (This)->lpVtbl -> SetDirtyRange2(This,Start,Stop) ) - -#define IAMTimelineObj_ClearDirty(This) \ - ( (This)->lpVtbl -> ClearDirty(This) ) - -#define IAMTimelineObj_Remove(This) \ - ( (This)->lpVtbl -> Remove(This) ) - -#define IAMTimelineObj_RemoveAll(This) \ - ( (This)->lpVtbl -> RemoveAll(This) ) - -#define IAMTimelineObj_GetTimelineNoRef(This,ppResult) \ - ( (This)->lpVtbl -> GetTimelineNoRef(This,ppResult) ) - -#define IAMTimelineObj_GetGroupIBelongTo(This,ppGroup) \ - ( (This)->lpVtbl -> GetGroupIBelongTo(This,ppGroup) ) - -#define IAMTimelineObj_GetEmbedDepth(This,pVal) \ - ( (This)->lpVtbl -> GetEmbedDepth(This,pVal) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineObj_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineEffectable_INTERFACE_DEFINED__ -#define __IAMTimelineEffectable_INTERFACE_DEFINED__ - -/* interface IAMTimelineEffectable */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineEffectable; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EAE58537-622E-11d2-8CAD-00A024580902") - IAMTimelineEffectable : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EffectInsBefore( - __RPC__in_opt IAMTimelineObj *pFX, - long priority) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EffectSwapPriorities( - long PriorityA, - long PriorityB) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EffectGetCount( - __RPC__in long *pCount) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetEffect( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppFx, - long Which) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineEffectableVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineEffectable * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineEffectable * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineEffectable * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EffectInsBefore )( - IAMTimelineEffectable * This, - __RPC__in_opt IAMTimelineObj *pFX, - long priority); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EffectSwapPriorities )( - IAMTimelineEffectable * This, - long PriorityA, - long PriorityB); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EffectGetCount )( - IAMTimelineEffectable * This, - __RPC__in long *pCount); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetEffect )( - IAMTimelineEffectable * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppFx, - long Which); - - END_INTERFACE - } IAMTimelineEffectableVtbl; - - interface IAMTimelineEffectable - { - CONST_VTBL struct IAMTimelineEffectableVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineEffectable_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineEffectable_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineEffectable_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineEffectable_EffectInsBefore(This,pFX,priority) \ - ( (This)->lpVtbl -> EffectInsBefore(This,pFX,priority) ) - -#define IAMTimelineEffectable_EffectSwapPriorities(This,PriorityA,PriorityB) \ - ( (This)->lpVtbl -> EffectSwapPriorities(This,PriorityA,PriorityB) ) - -#define IAMTimelineEffectable_EffectGetCount(This,pCount) \ - ( (This)->lpVtbl -> EffectGetCount(This,pCount) ) - -#define IAMTimelineEffectable_GetEffect(This,ppFx,Which) \ - ( (This)->lpVtbl -> GetEffect(This,ppFx,Which) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineEffectable_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineEffect_INTERFACE_DEFINED__ -#define __IAMTimelineEffect_INTERFACE_DEFINED__ - -/* interface IAMTimelineEffect */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineEffect; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("BCE0C264-622D-11d2-8CAD-00A024580902") - IAMTimelineEffect : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EffectGetPriority( - __RPC__in long *pVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineEffectVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineEffect * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineEffect * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineEffect * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EffectGetPriority )( - IAMTimelineEffect * This, - __RPC__in long *pVal); - - END_INTERFACE - } IAMTimelineEffectVtbl; - - interface IAMTimelineEffect - { - CONST_VTBL struct IAMTimelineEffectVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineEffect_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineEffect_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineEffect_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineEffect_EffectGetPriority(This,pVal) \ - ( (This)->lpVtbl -> EffectGetPriority(This,pVal) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineEffect_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineTransable_INTERFACE_DEFINED__ -#define __IAMTimelineTransable_INTERFACE_DEFINED__ - -/* interface IAMTimelineTransable */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineTransable; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("378FA386-622E-11d2-8CAD-00A024580902") - IAMTimelineTransable : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE TransAdd( - __RPC__in_opt IAMTimelineObj *pTrans) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE TransGetCount( - __RPC__in long *pCount) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNextTrans( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppTrans, - __RPC__in REFERENCE_TIME *pInOut) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNextTrans2( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppTrans, - __RPC__in REFTIME *pInOut) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetTransAtTime( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppObj, - REFERENCE_TIME Time, - long SearchDirection) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetTransAtTime2( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppObj, - REFTIME Time, - long SearchDirection) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineTransableVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineTransable * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineTransable * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineTransable * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *TransAdd )( - IAMTimelineTransable * This, - __RPC__in_opt IAMTimelineObj *pTrans); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *TransGetCount )( - IAMTimelineTransable * This, - __RPC__in long *pCount); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetNextTrans )( - IAMTimelineTransable * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppTrans, - __RPC__in REFERENCE_TIME *pInOut); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetNextTrans2 )( - IAMTimelineTransable * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppTrans, - __RPC__in REFTIME *pInOut); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetTransAtTime )( - IAMTimelineTransable * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppObj, - REFERENCE_TIME Time, - long SearchDirection); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetTransAtTime2 )( - IAMTimelineTransable * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppObj, - REFTIME Time, - long SearchDirection); - - END_INTERFACE - } IAMTimelineTransableVtbl; - - interface IAMTimelineTransable - { - CONST_VTBL struct IAMTimelineTransableVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineTransable_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineTransable_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineTransable_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineTransable_TransAdd(This,pTrans) \ - ( (This)->lpVtbl -> TransAdd(This,pTrans) ) - -#define IAMTimelineTransable_TransGetCount(This,pCount) \ - ( (This)->lpVtbl -> TransGetCount(This,pCount) ) - -#define IAMTimelineTransable_GetNextTrans(This,ppTrans,pInOut) \ - ( (This)->lpVtbl -> GetNextTrans(This,ppTrans,pInOut) ) - -#define IAMTimelineTransable_GetNextTrans2(This,ppTrans,pInOut) \ - ( (This)->lpVtbl -> GetNextTrans2(This,ppTrans,pInOut) ) - -#define IAMTimelineTransable_GetTransAtTime(This,ppObj,Time,SearchDirection) \ - ( (This)->lpVtbl -> GetTransAtTime(This,ppObj,Time,SearchDirection) ) - -#define IAMTimelineTransable_GetTransAtTime2(This,ppObj,Time,SearchDirection) \ - ( (This)->lpVtbl -> GetTransAtTime2(This,ppObj,Time,SearchDirection) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineTransable_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineSplittable_INTERFACE_DEFINED__ -#define __IAMTimelineSplittable_INTERFACE_DEFINED__ - -/* interface IAMTimelineSplittable */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineSplittable; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A0F840A0-D590-11d2-8D55-00A0C9441E20") - IAMTimelineSplittable : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SplitAt( - REFERENCE_TIME Time) = 0; - - virtual HRESULT STDMETHODCALLTYPE SplitAt2( - REFTIME Time) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineSplittableVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineSplittable * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineSplittable * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineSplittable * This); - - HRESULT ( STDMETHODCALLTYPE *SplitAt )( - IAMTimelineSplittable * This, - REFERENCE_TIME Time); - - HRESULT ( STDMETHODCALLTYPE *SplitAt2 )( - IAMTimelineSplittable * This, - REFTIME Time); - - END_INTERFACE - } IAMTimelineSplittableVtbl; - - interface IAMTimelineSplittable - { - CONST_VTBL struct IAMTimelineSplittableVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineSplittable_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineSplittable_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineSplittable_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineSplittable_SplitAt(This,Time) \ - ( (This)->lpVtbl -> SplitAt(This,Time) ) - -#define IAMTimelineSplittable_SplitAt2(This,Time) \ - ( (This)->lpVtbl -> SplitAt2(This,Time) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineSplittable_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineTrans_INTERFACE_DEFINED__ -#define __IAMTimelineTrans_INTERFACE_DEFINED__ - -/* interface IAMTimelineTrans */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineTrans; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("BCE0C265-622D-11d2-8CAD-00A024580902") - IAMTimelineTrans : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCutPoint( - __RPC__in REFERENCE_TIME *pTLTime) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCutPoint2( - __RPC__in REFTIME *pTLTime) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetCutPoint( - REFERENCE_TIME TLTime) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetCutPoint2( - REFTIME TLTime) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSwapInputs( - __RPC__in BOOL *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetSwapInputs( - BOOL pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCutsOnly( - __RPC__in BOOL *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetCutsOnly( - BOOL pVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineTransVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineTrans * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineTrans * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineTrans * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCutPoint )( - IAMTimelineTrans * This, - __RPC__in REFERENCE_TIME *pTLTime); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCutPoint2 )( - IAMTimelineTrans * This, - __RPC__in REFTIME *pTLTime); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetCutPoint )( - IAMTimelineTrans * This, - REFERENCE_TIME TLTime); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetCutPoint2 )( - IAMTimelineTrans * This, - REFTIME TLTime); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSwapInputs )( - IAMTimelineTrans * This, - __RPC__in BOOL *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetSwapInputs )( - IAMTimelineTrans * This, - BOOL pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCutsOnly )( - IAMTimelineTrans * This, - __RPC__in BOOL *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetCutsOnly )( - IAMTimelineTrans * This, - BOOL pVal); - - END_INTERFACE - } IAMTimelineTransVtbl; - - interface IAMTimelineTrans - { - CONST_VTBL struct IAMTimelineTransVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineTrans_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineTrans_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineTrans_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineTrans_GetCutPoint(This,pTLTime) \ - ( (This)->lpVtbl -> GetCutPoint(This,pTLTime) ) - -#define IAMTimelineTrans_GetCutPoint2(This,pTLTime) \ - ( (This)->lpVtbl -> GetCutPoint2(This,pTLTime) ) - -#define IAMTimelineTrans_SetCutPoint(This,TLTime) \ - ( (This)->lpVtbl -> SetCutPoint(This,TLTime) ) - -#define IAMTimelineTrans_SetCutPoint2(This,TLTime) \ - ( (This)->lpVtbl -> SetCutPoint2(This,TLTime) ) - -#define IAMTimelineTrans_GetSwapInputs(This,pVal) \ - ( (This)->lpVtbl -> GetSwapInputs(This,pVal) ) - -#define IAMTimelineTrans_SetSwapInputs(This,pVal) \ - ( (This)->lpVtbl -> SetSwapInputs(This,pVal) ) - -#define IAMTimelineTrans_GetCutsOnly(This,pVal) \ - ( (This)->lpVtbl -> GetCutsOnly(This,pVal) ) - -#define IAMTimelineTrans_SetCutsOnly(This,pVal) \ - ( (This)->lpVtbl -> SetCutsOnly(This,pVal) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineTrans_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineSrc_INTERFACE_DEFINED__ -#define __IAMTimelineSrc_INTERFACE_DEFINED__ - -/* interface IAMTimelineSrc */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineSrc; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("78530B79-61F9-11D2-8CAD-00A024580902") - IAMTimelineSrc : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMediaTimes( - __RPC__in REFERENCE_TIME *pStart, - __RPC__in REFERENCE_TIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMediaTimes2( - __RPC__in REFTIME *pStart, - __RPC__in REFTIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ModifyStopTime( - REFERENCE_TIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ModifyStopTime2( - REFTIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FixMediaTimes( - __RPC__in REFERENCE_TIME *pStart, - __RPC__in REFERENCE_TIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FixMediaTimes2( - __RPC__in REFTIME *pStart, - __RPC__in REFTIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaTimes( - REFERENCE_TIME Start, - REFERENCE_TIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaTimes2( - REFTIME Start, - REFTIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaLength( - REFERENCE_TIME Length) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaLength2( - REFTIME Length) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMediaLength( - __RPC__in REFERENCE_TIME *pLength) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMediaLength2( - __RPC__in REFTIME *pLength) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMediaName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaName( - __RPC__in BSTR newVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SpliceWithNext( - __RPC__in_opt IAMTimelineObj *pNext) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStreamNumber( - __RPC__in long *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStreamNumber( - long Val) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsNormalRate( - __RPC__in BOOL *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDefaultFPS( - __RPC__in double *pFPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetDefaultFPS( - double FPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStretchMode( - __RPC__in int *pnStretchMode) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStretchMode( - int nStretchMode) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineSrcVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineSrc * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineSrc * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineSrc * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMediaTimes )( - IAMTimelineSrc * This, - __RPC__in REFERENCE_TIME *pStart, - __RPC__in REFERENCE_TIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMediaTimes2 )( - IAMTimelineSrc * This, - __RPC__in REFTIME *pStart, - __RPC__in REFTIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ModifyStopTime )( - IAMTimelineSrc * This, - REFERENCE_TIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ModifyStopTime2 )( - IAMTimelineSrc * This, - REFTIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FixMediaTimes )( - IAMTimelineSrc * This, - __RPC__in REFERENCE_TIME *pStart, - __RPC__in REFERENCE_TIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FixMediaTimes2 )( - IAMTimelineSrc * This, - __RPC__in REFTIME *pStart, - __RPC__in REFTIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaTimes )( - IAMTimelineSrc * This, - REFERENCE_TIME Start, - REFERENCE_TIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaTimes2 )( - IAMTimelineSrc * This, - REFTIME Start, - REFTIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaLength )( - IAMTimelineSrc * This, - REFERENCE_TIME Length); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaLength2 )( - IAMTimelineSrc * This, - REFTIME Length); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMediaLength )( - IAMTimelineSrc * This, - __RPC__in REFERENCE_TIME *pLength); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMediaLength2 )( - IAMTimelineSrc * This, - __RPC__in REFTIME *pLength); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMediaName )( - IAMTimelineSrc * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaName )( - IAMTimelineSrc * This, - __RPC__in BSTR newVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpliceWithNext )( - IAMTimelineSrc * This, - __RPC__in_opt IAMTimelineObj *pNext); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStreamNumber )( - IAMTimelineSrc * This, - __RPC__in long *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStreamNumber )( - IAMTimelineSrc * This, - long Val); - - HRESULT ( STDMETHODCALLTYPE *IsNormalRate )( - IAMTimelineSrc * This, - __RPC__in BOOL *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDefaultFPS )( - IAMTimelineSrc * This, - __RPC__in double *pFPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetDefaultFPS )( - IAMTimelineSrc * This, - double FPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStretchMode )( - IAMTimelineSrc * This, - __RPC__in int *pnStretchMode); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStretchMode )( - IAMTimelineSrc * This, - int nStretchMode); - - END_INTERFACE - } IAMTimelineSrcVtbl; - - interface IAMTimelineSrc - { - CONST_VTBL struct IAMTimelineSrcVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineSrc_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineSrc_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineSrc_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineSrc_GetMediaTimes(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetMediaTimes(This,pStart,pStop) ) - -#define IAMTimelineSrc_GetMediaTimes2(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetMediaTimes2(This,pStart,pStop) ) - -#define IAMTimelineSrc_ModifyStopTime(This,Stop) \ - ( (This)->lpVtbl -> ModifyStopTime(This,Stop) ) - -#define IAMTimelineSrc_ModifyStopTime2(This,Stop) \ - ( (This)->lpVtbl -> ModifyStopTime2(This,Stop) ) - -#define IAMTimelineSrc_FixMediaTimes(This,pStart,pStop) \ - ( (This)->lpVtbl -> FixMediaTimes(This,pStart,pStop) ) - -#define IAMTimelineSrc_FixMediaTimes2(This,pStart,pStop) \ - ( (This)->lpVtbl -> FixMediaTimes2(This,pStart,pStop) ) - -#define IAMTimelineSrc_SetMediaTimes(This,Start,Stop) \ - ( (This)->lpVtbl -> SetMediaTimes(This,Start,Stop) ) - -#define IAMTimelineSrc_SetMediaTimes2(This,Start,Stop) \ - ( (This)->lpVtbl -> SetMediaTimes2(This,Start,Stop) ) - -#define IAMTimelineSrc_SetMediaLength(This,Length) \ - ( (This)->lpVtbl -> SetMediaLength(This,Length) ) - -#define IAMTimelineSrc_SetMediaLength2(This,Length) \ - ( (This)->lpVtbl -> SetMediaLength2(This,Length) ) - -#define IAMTimelineSrc_GetMediaLength(This,pLength) \ - ( (This)->lpVtbl -> GetMediaLength(This,pLength) ) - -#define IAMTimelineSrc_GetMediaLength2(This,pLength) \ - ( (This)->lpVtbl -> GetMediaLength2(This,pLength) ) - -#define IAMTimelineSrc_GetMediaName(This,pVal) \ - ( (This)->lpVtbl -> GetMediaName(This,pVal) ) - -#define IAMTimelineSrc_SetMediaName(This,newVal) \ - ( (This)->lpVtbl -> SetMediaName(This,newVal) ) - -#define IAMTimelineSrc_SpliceWithNext(This,pNext) \ - ( (This)->lpVtbl -> SpliceWithNext(This,pNext) ) - -#define IAMTimelineSrc_GetStreamNumber(This,pVal) \ - ( (This)->lpVtbl -> GetStreamNumber(This,pVal) ) - -#define IAMTimelineSrc_SetStreamNumber(This,Val) \ - ( (This)->lpVtbl -> SetStreamNumber(This,Val) ) - -#define IAMTimelineSrc_IsNormalRate(This,pVal) \ - ( (This)->lpVtbl -> IsNormalRate(This,pVal) ) - -#define IAMTimelineSrc_GetDefaultFPS(This,pFPS) \ - ( (This)->lpVtbl -> GetDefaultFPS(This,pFPS) ) - -#define IAMTimelineSrc_SetDefaultFPS(This,FPS) \ - ( (This)->lpVtbl -> SetDefaultFPS(This,FPS) ) - -#define IAMTimelineSrc_GetStretchMode(This,pnStretchMode) \ - ( (This)->lpVtbl -> GetStretchMode(This,pnStretchMode) ) - -#define IAMTimelineSrc_SetStretchMode(This,nStretchMode) \ - ( (This)->lpVtbl -> SetStretchMode(This,nStretchMode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineSrc_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineTrack_INTERFACE_DEFINED__ -#define __IAMTimelineTrack_INTERFACE_DEFINED__ - -/* interface IAMTimelineTrack */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineTrack; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EAE58538-622E-11d2-8CAD-00A024580902") - IAMTimelineTrack : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SrcAdd( - __RPC__in_opt IAMTimelineObj *pSource) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNextSrc( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - __RPC__in REFERENCE_TIME *pInOut) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNextSrc2( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - __RPC__in REFTIME *pInOut) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE MoveEverythingBy( - REFERENCE_TIME Start, - REFERENCE_TIME MoveBy) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE MoveEverythingBy2( - REFTIME Start, - REFTIME MoveBy) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSourcesCount( - __RPC__in long *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AreYouBlank( - __RPC__in long *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSrcAtTime( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - REFERENCE_TIME Time, - long SearchDirection) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSrcAtTime2( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - REFTIME Time, - long SearchDirection) = 0; - - virtual HRESULT STDMETHODCALLTYPE InsertSpace( - REFERENCE_TIME rtStart, - REFERENCE_TIME rtEnd) = 0; - - virtual HRESULT STDMETHODCALLTYPE InsertSpace2( - REFTIME rtStart, - REFTIME rtEnd) = 0; - - virtual HRESULT STDMETHODCALLTYPE ZeroBetween( - REFERENCE_TIME rtStart, - REFERENCE_TIME rtEnd) = 0; - - virtual HRESULT STDMETHODCALLTYPE ZeroBetween2( - REFTIME rtStart, - REFTIME rtEnd) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextSrcEx( - __RPC__in_opt IAMTimelineObj *pLast, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppNext) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineTrackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineTrack * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineTrack * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineTrack * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SrcAdd )( - IAMTimelineTrack * This, - __RPC__in_opt IAMTimelineObj *pSource); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetNextSrc )( - IAMTimelineTrack * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - __RPC__in REFERENCE_TIME *pInOut); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetNextSrc2 )( - IAMTimelineTrack * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - __RPC__in REFTIME *pInOut); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *MoveEverythingBy )( - IAMTimelineTrack * This, - REFERENCE_TIME Start, - REFERENCE_TIME MoveBy); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *MoveEverythingBy2 )( - IAMTimelineTrack * This, - REFTIME Start, - REFTIME MoveBy); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSourcesCount )( - IAMTimelineTrack * This, - __RPC__in long *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AreYouBlank )( - IAMTimelineTrack * This, - __RPC__in long *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSrcAtTime )( - IAMTimelineTrack * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - REFERENCE_TIME Time, - long SearchDirection); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetSrcAtTime2 )( - IAMTimelineTrack * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppSrc, - REFTIME Time, - long SearchDirection); - - HRESULT ( STDMETHODCALLTYPE *InsertSpace )( - IAMTimelineTrack * This, - REFERENCE_TIME rtStart, - REFERENCE_TIME rtEnd); - - HRESULT ( STDMETHODCALLTYPE *InsertSpace2 )( - IAMTimelineTrack * This, - REFTIME rtStart, - REFTIME rtEnd); - - HRESULT ( STDMETHODCALLTYPE *ZeroBetween )( - IAMTimelineTrack * This, - REFERENCE_TIME rtStart, - REFERENCE_TIME rtEnd); - - HRESULT ( STDMETHODCALLTYPE *ZeroBetween2 )( - IAMTimelineTrack * This, - REFTIME rtStart, - REFTIME rtEnd); - - HRESULT ( STDMETHODCALLTYPE *GetNextSrcEx )( - IAMTimelineTrack * This, - __RPC__in_opt IAMTimelineObj *pLast, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppNext); - - END_INTERFACE - } IAMTimelineTrackVtbl; - - interface IAMTimelineTrack - { - CONST_VTBL struct IAMTimelineTrackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineTrack_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineTrack_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineTrack_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineTrack_SrcAdd(This,pSource) \ - ( (This)->lpVtbl -> SrcAdd(This,pSource) ) - -#define IAMTimelineTrack_GetNextSrc(This,ppSrc,pInOut) \ - ( (This)->lpVtbl -> GetNextSrc(This,ppSrc,pInOut) ) - -#define IAMTimelineTrack_GetNextSrc2(This,ppSrc,pInOut) \ - ( (This)->lpVtbl -> GetNextSrc2(This,ppSrc,pInOut) ) - -#define IAMTimelineTrack_MoveEverythingBy(This,Start,MoveBy) \ - ( (This)->lpVtbl -> MoveEverythingBy(This,Start,MoveBy) ) - -#define IAMTimelineTrack_MoveEverythingBy2(This,Start,MoveBy) \ - ( (This)->lpVtbl -> MoveEverythingBy2(This,Start,MoveBy) ) - -#define IAMTimelineTrack_GetSourcesCount(This,pVal) \ - ( (This)->lpVtbl -> GetSourcesCount(This,pVal) ) - -#define IAMTimelineTrack_AreYouBlank(This,pVal) \ - ( (This)->lpVtbl -> AreYouBlank(This,pVal) ) - -#define IAMTimelineTrack_GetSrcAtTime(This,ppSrc,Time,SearchDirection) \ - ( (This)->lpVtbl -> GetSrcAtTime(This,ppSrc,Time,SearchDirection) ) - -#define IAMTimelineTrack_GetSrcAtTime2(This,ppSrc,Time,SearchDirection) \ - ( (This)->lpVtbl -> GetSrcAtTime2(This,ppSrc,Time,SearchDirection) ) - -#define IAMTimelineTrack_InsertSpace(This,rtStart,rtEnd) \ - ( (This)->lpVtbl -> InsertSpace(This,rtStart,rtEnd) ) - -#define IAMTimelineTrack_InsertSpace2(This,rtStart,rtEnd) \ - ( (This)->lpVtbl -> InsertSpace2(This,rtStart,rtEnd) ) - -#define IAMTimelineTrack_ZeroBetween(This,rtStart,rtEnd) \ - ( (This)->lpVtbl -> ZeroBetween(This,rtStart,rtEnd) ) - -#define IAMTimelineTrack_ZeroBetween2(This,rtStart,rtEnd) \ - ( (This)->lpVtbl -> ZeroBetween2(This,rtStart,rtEnd) ) - -#define IAMTimelineTrack_GetNextSrcEx(This,pLast,ppNext) \ - ( (This)->lpVtbl -> GetNextSrcEx(This,pLast,ppNext) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineTrack_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineVirtualTrack_INTERFACE_DEFINED__ -#define __IAMTimelineVirtualTrack_INTERFACE_DEFINED__ - -/* interface IAMTimelineVirtualTrack */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineVirtualTrack; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A8ED5F80-C2C7-11d2-8D39-00A0C9441E20") - IAMTimelineVirtualTrack : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE TrackGetPriority( - __RPC__in long *pPriority) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetTrackDirty( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineVirtualTrackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineVirtualTrack * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineVirtualTrack * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineVirtualTrack * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *TrackGetPriority )( - IAMTimelineVirtualTrack * This, - __RPC__in long *pPriority); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetTrackDirty )( - IAMTimelineVirtualTrack * This); - - END_INTERFACE - } IAMTimelineVirtualTrackVtbl; - - interface IAMTimelineVirtualTrack - { - CONST_VTBL struct IAMTimelineVirtualTrackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineVirtualTrack_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineVirtualTrack_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineVirtualTrack_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineVirtualTrack_TrackGetPriority(This,pPriority) \ - ( (This)->lpVtbl -> TrackGetPriority(This,pPriority) ) - -#define IAMTimelineVirtualTrack_SetTrackDirty(This) \ - ( (This)->lpVtbl -> SetTrackDirty(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineVirtualTrack_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineComp_INTERFACE_DEFINED__ -#define __IAMTimelineComp_INTERFACE_DEFINED__ - -/* interface IAMTimelineComp */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineComp; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EAE58536-622E-11d2-8CAD-00A024580902") - IAMTimelineComp : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VTrackInsBefore( - __RPC__in_opt IAMTimelineObj *pVirtualTrack, - long Priority) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VTrackSwapPriorities( - long VirtualTrackA, - long VirtualTrackB) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VTrackGetCount( - __RPC__in long *pVal) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVTrack( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppVirtualTrack, - long Which) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCountOfType( - __RPC__in long *pVal, - __RPC__in long *pValWithComps, - TIMELINE_MAJOR_TYPE MajorType) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetRecursiveLayerOfType( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppVirtualTrack, - long WhichLayer, - TIMELINE_MAJOR_TYPE Type) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetRecursiveLayerOfTypeI( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppVirtualTrack, - /* [out][in] */ __RPC__inout long *pWhichLayer, - TIMELINE_MAJOR_TYPE Type) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextVTrack( - __RPC__in_opt IAMTimelineObj *pVirtualTrack, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppNextVirtualTrack) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineCompVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineComp * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineComp * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineComp * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VTrackInsBefore )( - IAMTimelineComp * This, - __RPC__in_opt IAMTimelineObj *pVirtualTrack, - long Priority); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VTrackSwapPriorities )( - IAMTimelineComp * This, - long VirtualTrackA, - long VirtualTrackB); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VTrackGetCount )( - IAMTimelineComp * This, - __RPC__in long *pVal); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVTrack )( - IAMTimelineComp * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppVirtualTrack, - long Which); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCountOfType )( - IAMTimelineComp * This, - __RPC__in long *pVal, - __RPC__in long *pValWithComps, - TIMELINE_MAJOR_TYPE MajorType); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRecursiveLayerOfType )( - IAMTimelineComp * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppVirtualTrack, - long WhichLayer, - TIMELINE_MAJOR_TYPE Type); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRecursiveLayerOfTypeI )( - IAMTimelineComp * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppVirtualTrack, - /* [out][in] */ __RPC__inout long *pWhichLayer, - TIMELINE_MAJOR_TYPE Type); - - HRESULT ( STDMETHODCALLTYPE *GetNextVTrack )( - IAMTimelineComp * This, - __RPC__in_opt IAMTimelineObj *pVirtualTrack, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppNextVirtualTrack); - - END_INTERFACE - } IAMTimelineCompVtbl; - - interface IAMTimelineComp - { - CONST_VTBL struct IAMTimelineCompVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineComp_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineComp_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineComp_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineComp_VTrackInsBefore(This,pVirtualTrack,Priority) \ - ( (This)->lpVtbl -> VTrackInsBefore(This,pVirtualTrack,Priority) ) - -#define IAMTimelineComp_VTrackSwapPriorities(This,VirtualTrackA,VirtualTrackB) \ - ( (This)->lpVtbl -> VTrackSwapPriorities(This,VirtualTrackA,VirtualTrackB) ) - -#define IAMTimelineComp_VTrackGetCount(This,pVal) \ - ( (This)->lpVtbl -> VTrackGetCount(This,pVal) ) - -#define IAMTimelineComp_GetVTrack(This,ppVirtualTrack,Which) \ - ( (This)->lpVtbl -> GetVTrack(This,ppVirtualTrack,Which) ) - -#define IAMTimelineComp_GetCountOfType(This,pVal,pValWithComps,MajorType) \ - ( (This)->lpVtbl -> GetCountOfType(This,pVal,pValWithComps,MajorType) ) - -#define IAMTimelineComp_GetRecursiveLayerOfType(This,ppVirtualTrack,WhichLayer,Type) \ - ( (This)->lpVtbl -> GetRecursiveLayerOfType(This,ppVirtualTrack,WhichLayer,Type) ) - -#define IAMTimelineComp_GetRecursiveLayerOfTypeI(This,ppVirtualTrack,pWhichLayer,Type) \ - ( (This)->lpVtbl -> GetRecursiveLayerOfTypeI(This,ppVirtualTrack,pWhichLayer,Type) ) - -#define IAMTimelineComp_GetNextVTrack(This,pVirtualTrack,ppNextVirtualTrack) \ - ( (This)->lpVtbl -> GetNextVTrack(This,pVirtualTrack,ppNextVirtualTrack) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineComp_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimelineGroup_INTERFACE_DEFINED__ -#define __IAMTimelineGroup_INTERFACE_DEFINED__ - -/* interface IAMTimelineGroup */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimelineGroup; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9EED4F00-B8A6-11d2-8023-00C0DF10D434") - IAMTimelineGroup : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetTimeline( - __RPC__in_opt IAMTimeline *pTimeline) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetTimeline( - /* [out] */ __RPC__deref_out_opt IAMTimeline **ppTimeline) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPriority( - __RPC__in long *pPriority) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMediaType( - /* [out] */ __RPC__out AM_MEDIA_TYPE *__MIDL__IAMTimelineGroup0000) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaType( - /* [in] */ __RPC__in AM_MEDIA_TYPE *__MIDL__IAMTimelineGroup0001) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetOutputFPS( - double FPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetOutputFPS( - __RPC__in double *pFPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetGroupName( - __RPC__in BSTR pGroupName) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetGroupName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pGroupName) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetPreviewMode( - BOOL fPreview) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPreviewMode( - __RPC__in BOOL *pfPreview) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMediaTypeForVB( - /* [in] */ long Val) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetOutputBuffering( - /* [out] */ __RPC__out int *pnBuffer) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetOutputBuffering( - /* [in] */ int nBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSmartRecompressFormat( - __RPC__in long *pFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSmartRecompressFormat( - __RPC__deref_in_opt long **ppFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsSmartRecompressFormatSet( - __RPC__in BOOL *pVal) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsRecompressFormatDirty( - __RPC__in BOOL *pVal) = 0; - - virtual HRESULT STDMETHODCALLTYPE ClearRecompressFormatDirty( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetRecompFormatFromSource( - __RPC__in_opt IAMTimelineSrc *pSource) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineGroupVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimelineGroup * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimelineGroup * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimelineGroup * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetTimeline )( - IAMTimelineGroup * This, - __RPC__in_opt IAMTimeline *pTimeline); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetTimeline )( - IAMTimelineGroup * This, - /* [out] */ __RPC__deref_out_opt IAMTimeline **ppTimeline); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPriority )( - IAMTimelineGroup * This, - __RPC__in long *pPriority); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMediaType )( - IAMTimelineGroup * This, - /* [out] */ __RPC__out AM_MEDIA_TYPE *__MIDL__IAMTimelineGroup0000); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaType )( - IAMTimelineGroup * This, - /* [in] */ __RPC__in AM_MEDIA_TYPE *__MIDL__IAMTimelineGroup0001); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetOutputFPS )( - IAMTimelineGroup * This, - double FPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetOutputFPS )( - IAMTimelineGroup * This, - __RPC__in double *pFPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetGroupName )( - IAMTimelineGroup * This, - __RPC__in BSTR pGroupName); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetGroupName )( - IAMTimelineGroup * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pGroupName); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetPreviewMode )( - IAMTimelineGroup * This, - BOOL fPreview); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPreviewMode )( - IAMTimelineGroup * This, - __RPC__in BOOL *pfPreview); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMediaTypeForVB )( - IAMTimelineGroup * This, - /* [in] */ long Val); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetOutputBuffering )( - IAMTimelineGroup * This, - /* [out] */ __RPC__out int *pnBuffer); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetOutputBuffering )( - IAMTimelineGroup * This, - /* [in] */ int nBuffer); - - HRESULT ( STDMETHODCALLTYPE *SetSmartRecompressFormat )( - IAMTimelineGroup * This, - __RPC__in long *pFormat); - - HRESULT ( STDMETHODCALLTYPE *GetSmartRecompressFormat )( - IAMTimelineGroup * This, - __RPC__deref_in_opt long **ppFormat); - - HRESULT ( STDMETHODCALLTYPE *IsSmartRecompressFormatSet )( - IAMTimelineGroup * This, - __RPC__in BOOL *pVal); - - HRESULT ( STDMETHODCALLTYPE *IsRecompressFormatDirty )( - IAMTimelineGroup * This, - __RPC__in BOOL *pVal); - - HRESULT ( STDMETHODCALLTYPE *ClearRecompressFormatDirty )( - IAMTimelineGroup * This); - - HRESULT ( STDMETHODCALLTYPE *SetRecompFormatFromSource )( - IAMTimelineGroup * This, - __RPC__in_opt IAMTimelineSrc *pSource); - - END_INTERFACE - } IAMTimelineGroupVtbl; - - interface IAMTimelineGroup - { - CONST_VTBL struct IAMTimelineGroupVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimelineGroup_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimelineGroup_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimelineGroup_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimelineGroup_SetTimeline(This,pTimeline) \ - ( (This)->lpVtbl -> SetTimeline(This,pTimeline) ) - -#define IAMTimelineGroup_GetTimeline(This,ppTimeline) \ - ( (This)->lpVtbl -> GetTimeline(This,ppTimeline) ) - -#define IAMTimelineGroup_GetPriority(This,pPriority) \ - ( (This)->lpVtbl -> GetPriority(This,pPriority) ) - -#define IAMTimelineGroup_GetMediaType(This,__MIDL__IAMTimelineGroup0000) \ - ( (This)->lpVtbl -> GetMediaType(This,__MIDL__IAMTimelineGroup0000) ) - -#define IAMTimelineGroup_SetMediaType(This,__MIDL__IAMTimelineGroup0001) \ - ( (This)->lpVtbl -> SetMediaType(This,__MIDL__IAMTimelineGroup0001) ) - -#define IAMTimelineGroup_SetOutputFPS(This,FPS) \ - ( (This)->lpVtbl -> SetOutputFPS(This,FPS) ) - -#define IAMTimelineGroup_GetOutputFPS(This,pFPS) \ - ( (This)->lpVtbl -> GetOutputFPS(This,pFPS) ) - -#define IAMTimelineGroup_SetGroupName(This,pGroupName) \ - ( (This)->lpVtbl -> SetGroupName(This,pGroupName) ) - -#define IAMTimelineGroup_GetGroupName(This,pGroupName) \ - ( (This)->lpVtbl -> GetGroupName(This,pGroupName) ) - -#define IAMTimelineGroup_SetPreviewMode(This,fPreview) \ - ( (This)->lpVtbl -> SetPreviewMode(This,fPreview) ) - -#define IAMTimelineGroup_GetPreviewMode(This,pfPreview) \ - ( (This)->lpVtbl -> GetPreviewMode(This,pfPreview) ) - -#define IAMTimelineGroup_SetMediaTypeForVB(This,Val) \ - ( (This)->lpVtbl -> SetMediaTypeForVB(This,Val) ) - -#define IAMTimelineGroup_GetOutputBuffering(This,pnBuffer) \ - ( (This)->lpVtbl -> GetOutputBuffering(This,pnBuffer) ) - -#define IAMTimelineGroup_SetOutputBuffering(This,nBuffer) \ - ( (This)->lpVtbl -> SetOutputBuffering(This,nBuffer) ) - -#define IAMTimelineGroup_SetSmartRecompressFormat(This,pFormat) \ - ( (This)->lpVtbl -> SetSmartRecompressFormat(This,pFormat) ) - -#define IAMTimelineGroup_GetSmartRecompressFormat(This,ppFormat) \ - ( (This)->lpVtbl -> GetSmartRecompressFormat(This,ppFormat) ) - -#define IAMTimelineGroup_IsSmartRecompressFormatSet(This,pVal) \ - ( (This)->lpVtbl -> IsSmartRecompressFormatSet(This,pVal) ) - -#define IAMTimelineGroup_IsRecompressFormatDirty(This,pVal) \ - ( (This)->lpVtbl -> IsRecompressFormatDirty(This,pVal) ) - -#define IAMTimelineGroup_ClearRecompressFormatDirty(This) \ - ( (This)->lpVtbl -> ClearRecompressFormatDirty(This) ) - -#define IAMTimelineGroup_SetRecompFormatFromSource(This,pSource) \ - ( (This)->lpVtbl -> SetRecompFormatFromSource(This,pSource) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimelineGroup_INTERFACE_DEFINED__ */ - - -#ifndef __IAMTimeline_INTERFACE_DEFINED__ -#define __IAMTimeline_INTERFACE_DEFINED__ - -/* interface IAMTimeline */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMTimeline; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("78530B74-61F9-11D2-8CAD-00A024580902") - IAMTimeline : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreateEmptyNode( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppObj, - TIMELINE_MAJOR_TYPE Type) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddGroup( - __RPC__in_opt IAMTimelineObj *pGroup) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemGroupFromList( - __RPC__in_opt IAMTimelineObj *pGroup) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGroup( - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppGroup, - long WhichGroup) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGroupCount( - __RPC__in long *pCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE ClearAllGroups( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInsertMode( - __RPC__in long *pMode) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetInsertMode( - long Mode) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnableTransitions( - BOOL fEnabled) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE TransitionsEnabled( - __RPC__in BOOL *pfEnabled) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnableEffects( - BOOL fEnabled) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EffectsEnabled( - __RPC__in BOOL *pfEnabled) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetInterestRange( - REFERENCE_TIME Start, - REFERENCE_TIME Stop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDuration( - __RPC__in REFERENCE_TIME *pDuration) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDuration2( - __RPC__in double *pDuration) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetDefaultFPS( - double FPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDefaultFPS( - __RPC__in double *pFPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE IsDirty( - __RPC__in BOOL *pDirty) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDirtyRange( - __RPC__in REFERENCE_TIME *pStart, - __RPC__in REFERENCE_TIME *pStop) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCountOfType( - long Group, - __RPC__in long *pVal, - __RPC__in long *pValWithComps, - TIMELINE_MAJOR_TYPE MajorType) = 0; - - virtual HRESULT STDMETHODCALLTYPE ValidateSourceNames( - long ValidateFlags, - __RPC__in_opt IMediaLocator *pOverride, - LONG_PTR NotifyEventHandle) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDefaultTransition( - __RPC__in GUID *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDefaultTransition( - __RPC__in GUID *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDefaultEffect( - __RPC__in GUID *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDefaultEffect( - __RPC__in GUID *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDefaultTransitionB( - __RPC__in BSTR pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDefaultTransitionB( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDefaultEffectB( - __RPC__in BSTR pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDefaultEffectB( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pGuid) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMTimelineVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMTimeline * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMTimeline * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMTimeline * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateEmptyNode )( - IAMTimeline * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppObj, - TIMELINE_MAJOR_TYPE Type); - - HRESULT ( STDMETHODCALLTYPE *AddGroup )( - IAMTimeline * This, - __RPC__in_opt IAMTimelineObj *pGroup); - - HRESULT ( STDMETHODCALLTYPE *RemGroupFromList )( - IAMTimeline * This, - __RPC__in_opt IAMTimelineObj *pGroup); - - HRESULT ( STDMETHODCALLTYPE *GetGroup )( - IAMTimeline * This, - /* [out] */ __RPC__deref_out_opt IAMTimelineObj **ppGroup, - long WhichGroup); - - HRESULT ( STDMETHODCALLTYPE *GetGroupCount )( - IAMTimeline * This, - __RPC__in long *pCount); - - HRESULT ( STDMETHODCALLTYPE *ClearAllGroups )( - IAMTimeline * This); - - HRESULT ( STDMETHODCALLTYPE *GetInsertMode )( - IAMTimeline * This, - __RPC__in long *pMode); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetInsertMode )( - IAMTimeline * This, - long Mode); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnableTransitions )( - IAMTimeline * This, - BOOL fEnabled); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *TransitionsEnabled )( - IAMTimeline * This, - __RPC__in BOOL *pfEnabled); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnableEffects )( - IAMTimeline * This, - BOOL fEnabled); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EffectsEnabled )( - IAMTimeline * This, - __RPC__in BOOL *pfEnabled); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetInterestRange )( - IAMTimeline * This, - REFERENCE_TIME Start, - REFERENCE_TIME Stop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDuration )( - IAMTimeline * This, - __RPC__in REFERENCE_TIME *pDuration); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDuration2 )( - IAMTimeline * This, - __RPC__in double *pDuration); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetDefaultFPS )( - IAMTimeline * This, - double FPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDefaultFPS )( - IAMTimeline * This, - __RPC__in double *pFPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsDirty )( - IAMTimeline * This, - __RPC__in BOOL *pDirty); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDirtyRange )( - IAMTimeline * This, - __RPC__in REFERENCE_TIME *pStart, - __RPC__in REFERENCE_TIME *pStop); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCountOfType )( - IAMTimeline * This, - long Group, - __RPC__in long *pVal, - __RPC__in long *pValWithComps, - TIMELINE_MAJOR_TYPE MajorType); - - HRESULT ( STDMETHODCALLTYPE *ValidateSourceNames )( - IAMTimeline * This, - long ValidateFlags, - __RPC__in_opt IMediaLocator *pOverride, - LONG_PTR NotifyEventHandle); - - HRESULT ( STDMETHODCALLTYPE *SetDefaultTransition )( - IAMTimeline * This, - __RPC__in GUID *pGuid); - - HRESULT ( STDMETHODCALLTYPE *GetDefaultTransition )( - IAMTimeline * This, - __RPC__in GUID *pGuid); - - HRESULT ( STDMETHODCALLTYPE *SetDefaultEffect )( - IAMTimeline * This, - __RPC__in GUID *pGuid); - - HRESULT ( STDMETHODCALLTYPE *GetDefaultEffect )( - IAMTimeline * This, - __RPC__in GUID *pGuid); - - HRESULT ( STDMETHODCALLTYPE *SetDefaultTransitionB )( - IAMTimeline * This, - __RPC__in BSTR pGuid); - - HRESULT ( STDMETHODCALLTYPE *GetDefaultTransitionB )( - IAMTimeline * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pGuid); - - HRESULT ( STDMETHODCALLTYPE *SetDefaultEffectB )( - IAMTimeline * This, - __RPC__in BSTR pGuid); - - HRESULT ( STDMETHODCALLTYPE *GetDefaultEffectB )( - IAMTimeline * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pGuid); - - END_INTERFACE - } IAMTimelineVtbl; - - interface IAMTimeline - { - CONST_VTBL struct IAMTimelineVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMTimeline_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMTimeline_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMTimeline_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMTimeline_CreateEmptyNode(This,ppObj,Type) \ - ( (This)->lpVtbl -> CreateEmptyNode(This,ppObj,Type) ) - -#define IAMTimeline_AddGroup(This,pGroup) \ - ( (This)->lpVtbl -> AddGroup(This,pGroup) ) - -#define IAMTimeline_RemGroupFromList(This,pGroup) \ - ( (This)->lpVtbl -> RemGroupFromList(This,pGroup) ) - -#define IAMTimeline_GetGroup(This,ppGroup,WhichGroup) \ - ( (This)->lpVtbl -> GetGroup(This,ppGroup,WhichGroup) ) - -#define IAMTimeline_GetGroupCount(This,pCount) \ - ( (This)->lpVtbl -> GetGroupCount(This,pCount) ) - -#define IAMTimeline_ClearAllGroups(This) \ - ( (This)->lpVtbl -> ClearAllGroups(This) ) - -#define IAMTimeline_GetInsertMode(This,pMode) \ - ( (This)->lpVtbl -> GetInsertMode(This,pMode) ) - -#define IAMTimeline_SetInsertMode(This,Mode) \ - ( (This)->lpVtbl -> SetInsertMode(This,Mode) ) - -#define IAMTimeline_EnableTransitions(This,fEnabled) \ - ( (This)->lpVtbl -> EnableTransitions(This,fEnabled) ) - -#define IAMTimeline_TransitionsEnabled(This,pfEnabled) \ - ( (This)->lpVtbl -> TransitionsEnabled(This,pfEnabled) ) - -#define IAMTimeline_EnableEffects(This,fEnabled) \ - ( (This)->lpVtbl -> EnableEffects(This,fEnabled) ) - -#define IAMTimeline_EffectsEnabled(This,pfEnabled) \ - ( (This)->lpVtbl -> EffectsEnabled(This,pfEnabled) ) - -#define IAMTimeline_SetInterestRange(This,Start,Stop) \ - ( (This)->lpVtbl -> SetInterestRange(This,Start,Stop) ) - -#define IAMTimeline_GetDuration(This,pDuration) \ - ( (This)->lpVtbl -> GetDuration(This,pDuration) ) - -#define IAMTimeline_GetDuration2(This,pDuration) \ - ( (This)->lpVtbl -> GetDuration2(This,pDuration) ) - -#define IAMTimeline_SetDefaultFPS(This,FPS) \ - ( (This)->lpVtbl -> SetDefaultFPS(This,FPS) ) - -#define IAMTimeline_GetDefaultFPS(This,pFPS) \ - ( (This)->lpVtbl -> GetDefaultFPS(This,pFPS) ) - -#define IAMTimeline_IsDirty(This,pDirty) \ - ( (This)->lpVtbl -> IsDirty(This,pDirty) ) - -#define IAMTimeline_GetDirtyRange(This,pStart,pStop) \ - ( (This)->lpVtbl -> GetDirtyRange(This,pStart,pStop) ) - -#define IAMTimeline_GetCountOfType(This,Group,pVal,pValWithComps,MajorType) \ - ( (This)->lpVtbl -> GetCountOfType(This,Group,pVal,pValWithComps,MajorType) ) - -#define IAMTimeline_ValidateSourceNames(This,ValidateFlags,pOverride,NotifyEventHandle) \ - ( (This)->lpVtbl -> ValidateSourceNames(This,ValidateFlags,pOverride,NotifyEventHandle) ) - -#define IAMTimeline_SetDefaultTransition(This,pGuid) \ - ( (This)->lpVtbl -> SetDefaultTransition(This,pGuid) ) - -#define IAMTimeline_GetDefaultTransition(This,pGuid) \ - ( (This)->lpVtbl -> GetDefaultTransition(This,pGuid) ) - -#define IAMTimeline_SetDefaultEffect(This,pGuid) \ - ( (This)->lpVtbl -> SetDefaultEffect(This,pGuid) ) - -#define IAMTimeline_GetDefaultEffect(This,pGuid) \ - ( (This)->lpVtbl -> GetDefaultEffect(This,pGuid) ) - -#define IAMTimeline_SetDefaultTransitionB(This,pGuid) \ - ( (This)->lpVtbl -> SetDefaultTransitionB(This,pGuid) ) - -#define IAMTimeline_GetDefaultTransitionB(This,pGuid) \ - ( (This)->lpVtbl -> GetDefaultTransitionB(This,pGuid) ) - -#define IAMTimeline_SetDefaultEffectB(This,pGuid) \ - ( (This)->lpVtbl -> SetDefaultEffectB(This,pGuid) ) - -#define IAMTimeline_GetDefaultEffectB(This,pGuid) \ - ( (This)->lpVtbl -> GetDefaultEffectB(This,pGuid) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMTimeline_INTERFACE_DEFINED__ */ - - -#ifndef __IXml2Dex_INTERFACE_DEFINED__ -#define __IXml2Dex_INTERFACE_DEFINED__ - -/* interface IXml2Dex */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IXml2Dex; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("18C628ED-962A-11D2-8D08-00A0C9441E20") - IXml2Dex : public IDispatch - { - public: - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateGraphFromFile( - /* [out] */ __RPC__deref_out_opt IUnknown **ppGraph, - __RPC__in_opt IUnknown *pTimeline, - __RPC__in BSTR Filename) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteGrfFile( - __RPC__in_opt IUnknown *pGraph, - __RPC__in BSTR FileName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteXMLFile( - __RPC__in_opt IUnknown *pTimeline, - __RPC__in BSTR FileName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReadXMLFile( - __RPC__in_opt IUnknown *pTimeline, - __RPC__in BSTR XMLName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Delete( - __RPC__in_opt IUnknown *pTimeline, - double dStart, - double dEnd) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteXMLPart( - __RPC__in_opt IUnknown *pTimeline, - double dStart, - double dEnd, - __RPC__in BSTR FileName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE PasteXMLFile( - __RPC__in_opt IUnknown *pTimeline, - double dStart, - __RPC__in BSTR FileName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CopyXML( - __RPC__in_opt IUnknown *pTimeline, - double dStart, - double dEnd) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE PasteXML( - __RPC__in_opt IUnknown *pTimeline, - double dStart) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReadXML( - __RPC__in_opt IUnknown *pTimeline, - __RPC__in_opt IUnknown *pXML) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteXML( - __RPC__in_opt IUnknown *pTimeline, - __RPC__deref_in_opt BSTR *pbstrXML) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXml2DexVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IXml2Dex * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IXml2Dex * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IXml2Dex * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IXml2Dex * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IXml2Dex * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IXml2Dex * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IXml2Dex * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CreateGraphFromFile )( - IXml2Dex * This, - /* [out] */ __RPC__deref_out_opt IUnknown **ppGraph, - __RPC__in_opt IUnknown *pTimeline, - __RPC__in BSTR Filename); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *WriteGrfFile )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pGraph, - __RPC__in BSTR FileName); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *WriteXMLFile )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - __RPC__in BSTR FileName); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ReadXMLFile )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - __RPC__in BSTR XMLName); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Delete )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - double dStart, - double dEnd); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *WriteXMLPart )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - double dStart, - double dEnd, - __RPC__in BSTR FileName); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *PasteXMLFile )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - double dStart, - __RPC__in BSTR FileName); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CopyXML )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - double dStart, - double dEnd); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *PasteXML )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - double dStart); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - IXml2Dex * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ReadXML )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - __RPC__in_opt IUnknown *pXML); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *WriteXML )( - IXml2Dex * This, - __RPC__in_opt IUnknown *pTimeline, - __RPC__deref_in_opt BSTR *pbstrXML); - - END_INTERFACE - } IXml2DexVtbl; - - interface IXml2Dex - { - CONST_VTBL struct IXml2DexVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXml2Dex_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXml2Dex_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXml2Dex_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXml2Dex_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IXml2Dex_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IXml2Dex_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IXml2Dex_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IXml2Dex_CreateGraphFromFile(This,ppGraph,pTimeline,Filename) \ - ( (This)->lpVtbl -> CreateGraphFromFile(This,ppGraph,pTimeline,Filename) ) - -#define IXml2Dex_WriteGrfFile(This,pGraph,FileName) \ - ( (This)->lpVtbl -> WriteGrfFile(This,pGraph,FileName) ) - -#define IXml2Dex_WriteXMLFile(This,pTimeline,FileName) \ - ( (This)->lpVtbl -> WriteXMLFile(This,pTimeline,FileName) ) - -#define IXml2Dex_ReadXMLFile(This,pTimeline,XMLName) \ - ( (This)->lpVtbl -> ReadXMLFile(This,pTimeline,XMLName) ) - -#define IXml2Dex_Delete(This,pTimeline,dStart,dEnd) \ - ( (This)->lpVtbl -> Delete(This,pTimeline,dStart,dEnd) ) - -#define IXml2Dex_WriteXMLPart(This,pTimeline,dStart,dEnd,FileName) \ - ( (This)->lpVtbl -> WriteXMLPart(This,pTimeline,dStart,dEnd,FileName) ) - -#define IXml2Dex_PasteXMLFile(This,pTimeline,dStart,FileName) \ - ( (This)->lpVtbl -> PasteXMLFile(This,pTimeline,dStart,FileName) ) - -#define IXml2Dex_CopyXML(This,pTimeline,dStart,dEnd) \ - ( (This)->lpVtbl -> CopyXML(This,pTimeline,dStart,dEnd) ) - -#define IXml2Dex_PasteXML(This,pTimeline,dStart) \ - ( (This)->lpVtbl -> PasteXML(This,pTimeline,dStart) ) - -#define IXml2Dex_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IXml2Dex_ReadXML(This,pTimeline,pXML) \ - ( (This)->lpVtbl -> ReadXML(This,pTimeline,pXML) ) - -#define IXml2Dex_WriteXML(This,pTimeline,pbstrXML) \ - ( (This)->lpVtbl -> WriteXML(This,pTimeline,pbstrXML) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXml2Dex_INTERFACE_DEFINED__ */ - - -#ifndef __IAMErrorLog_INTERFACE_DEFINED__ -#define __IAMErrorLog_INTERFACE_DEFINED__ - -/* interface IAMErrorLog */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMErrorLog; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E43E73A2-0EFA-11d3-9601-00A0C9441E20") - IAMErrorLog : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE LogError( - long Severity, - __RPC__in BSTR pErrorString, - long ErrorCode, - long hresult, - /* [in] */ __RPC__in VARIANT *pExtraInfo) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMErrorLogVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMErrorLog * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMErrorLog * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMErrorLog * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *LogError )( - IAMErrorLog * This, - long Severity, - __RPC__in BSTR pErrorString, - long ErrorCode, - long hresult, - /* [in] */ __RPC__in VARIANT *pExtraInfo); - - END_INTERFACE - } IAMErrorLogVtbl; - - interface IAMErrorLog - { - CONST_VTBL struct IAMErrorLogVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMErrorLog_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMErrorLog_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMErrorLog_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMErrorLog_LogError(This,Severity,pErrorString,ErrorCode,hresult,pExtraInfo) \ - ( (This)->lpVtbl -> LogError(This,Severity,pErrorString,ErrorCode,hresult,pExtraInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMErrorLog_INTERFACE_DEFINED__ */ - - -#ifndef __IAMSetErrorLog_INTERFACE_DEFINED__ -#define __IAMSetErrorLog_INTERFACE_DEFINED__ - -/* interface IAMSetErrorLog */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IAMSetErrorLog; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("963566DA-BE21-4eaf-88E9-35704F8F52A1") - IAMSetErrorLog : public IUnknown - { - public: - virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorLog( - /* [retval][out] */ __RPC__deref_out_opt IAMErrorLog **pVal) = 0; - - virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ErrorLog( - /* [in] */ __RPC__in_opt IAMErrorLog *newVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IAMSetErrorLogVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMSetErrorLog * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMSetErrorLog * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMSetErrorLog * This); - - /* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ErrorLog )( - IAMSetErrorLog * This, - /* [retval][out] */ __RPC__deref_out_opt IAMErrorLog **pVal); - - /* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ErrorLog )( - IAMSetErrorLog * This, - /* [in] */ __RPC__in_opt IAMErrorLog *newVal); - - END_INTERFACE - } IAMSetErrorLogVtbl; - - interface IAMSetErrorLog - { - CONST_VTBL struct IAMSetErrorLogVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAMSetErrorLog_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAMSetErrorLog_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAMSetErrorLog_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAMSetErrorLog_get_ErrorLog(This,pVal) \ - ( (This)->lpVtbl -> get_ErrorLog(This,pVal) ) - -#define IAMSetErrorLog_put_ErrorLog(This,newVal) \ - ( (This)->lpVtbl -> put_ErrorLog(This,newVal) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAMSetErrorLog_INTERFACE_DEFINED__ */ - - -#ifndef __ISampleGrabberCB_INTERFACE_DEFINED__ -#define __ISampleGrabberCB_INTERFACE_DEFINED__ - -/* interface ISampleGrabberCB */ -/* [unique][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_ISampleGrabberCB; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0579154A-2B53-4994-B0D0-E773148EFF85") - ISampleGrabberCB : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SampleCB( - double SampleTime, - IMediaSample *pSample) = 0; - - virtual HRESULT STDMETHODCALLTYPE BufferCB( - double SampleTime, - BYTE *pBuffer, - long BufferLen) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISampleGrabberCBVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ISampleGrabberCB * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ISampleGrabberCB * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ISampleGrabberCB * This); - - HRESULT ( STDMETHODCALLTYPE *SampleCB )( - ISampleGrabberCB * This, - double SampleTime, - IMediaSample *pSample); - - HRESULT ( STDMETHODCALLTYPE *BufferCB )( - ISampleGrabberCB * This, - double SampleTime, - BYTE *pBuffer, - long BufferLen); - - END_INTERFACE - } ISampleGrabberCBVtbl; - - interface ISampleGrabberCB - { - CONST_VTBL struct ISampleGrabberCBVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISampleGrabberCB_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISampleGrabberCB_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISampleGrabberCB_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISampleGrabberCB_SampleCB(This,SampleTime,pSample) \ - ( (This)->lpVtbl -> SampleCB(This,SampleTime,pSample) ) - -#define ISampleGrabberCB_BufferCB(This,SampleTime,pBuffer,BufferLen) \ - ( (This)->lpVtbl -> BufferCB(This,SampleTime,pBuffer,BufferLen) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISampleGrabberCB_INTERFACE_DEFINED__ */ - - -#ifndef __ISampleGrabber_INTERFACE_DEFINED__ -#define __ISampleGrabber_INTERFACE_DEFINED__ - -/* interface ISampleGrabber */ -/* [unique][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_ISampleGrabber; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6B652FFF-11FE-4fce-92AD-0266B5D7C78F") - ISampleGrabber : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetOneShot( - BOOL OneShot) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetMediaType( - const AM_MEDIA_TYPE *pType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType( - AM_MEDIA_TYPE *pType) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBufferSamples( - BOOL BufferThem) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( - /* [out][in] */ long *pBufferSize, - /* [out] */ long *pBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( - /* [retval][out] */ IMediaSample **ppSample) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - ISampleGrabberCB *pCallback, - long WhichMethodToCallback) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISampleGrabberVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ISampleGrabber * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ISampleGrabber * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ISampleGrabber * This); - - HRESULT ( STDMETHODCALLTYPE *SetOneShot )( - ISampleGrabber * This, - BOOL OneShot); - - HRESULT ( STDMETHODCALLTYPE *SetMediaType )( - ISampleGrabber * This, - const AM_MEDIA_TYPE *pType); - - HRESULT ( STDMETHODCALLTYPE *GetConnectedMediaType )( - ISampleGrabber * This, - AM_MEDIA_TYPE *pType); - - HRESULT ( STDMETHODCALLTYPE *SetBufferSamples )( - ISampleGrabber * This, - BOOL BufferThem); - - HRESULT ( STDMETHODCALLTYPE *GetCurrentBuffer )( - ISampleGrabber * This, - /* [out][in] */ long *pBufferSize, - /* [out] */ long *pBuffer); - - HRESULT ( STDMETHODCALLTYPE *GetCurrentSample )( - ISampleGrabber * This, - /* [retval][out] */ IMediaSample **ppSample); - - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - ISampleGrabber * This, - ISampleGrabberCB *pCallback, - long WhichMethodToCallback); - - END_INTERFACE - } ISampleGrabberVtbl; - - interface ISampleGrabber - { - CONST_VTBL struct ISampleGrabberVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISampleGrabber_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISampleGrabber_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISampleGrabber_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISampleGrabber_SetOneShot(This,OneShot) \ - ( (This)->lpVtbl -> SetOneShot(This,OneShot) ) - -#define ISampleGrabber_SetMediaType(This,pType) \ - ( (This)->lpVtbl -> SetMediaType(This,pType) ) - -#define ISampleGrabber_GetConnectedMediaType(This,pType) \ - ( (This)->lpVtbl -> GetConnectedMediaType(This,pType) ) - -#define ISampleGrabber_SetBufferSamples(This,BufferThem) \ - ( (This)->lpVtbl -> SetBufferSamples(This,BufferThem) ) - -#define ISampleGrabber_GetCurrentBuffer(This,pBufferSize,pBuffer) \ - ( (This)->lpVtbl -> GetCurrentBuffer(This,pBufferSize,pBuffer) ) - -#define ISampleGrabber_GetCurrentSample(This,ppSample) \ - ( (This)->lpVtbl -> GetCurrentSample(This,ppSample) ) - -#define ISampleGrabber_SetCallback(This,pCallback,WhichMethodToCallback) \ - ( (This)->lpVtbl -> SetCallback(This,pCallback,WhichMethodToCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISampleGrabber_INTERFACE_DEFINED__ */ - - - -#ifndef __DexterLib_LIBRARY_DEFINED__ -#define __DexterLib_LIBRARY_DEFINED__ - -/* library DexterLib */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_DexterLib; - -#ifndef __IResize_INTERFACE_DEFINED__ -#define __IResize_INTERFACE_DEFINED__ - -/* interface IResize */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IResize; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4ada63a0-72d5-11d2-952a-0060081840bc") - IResize : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE get_Size( - /* [out] */ __RPC__out int *piHeight, - /* [out] */ __RPC__out int *piWidth, - /* [out] */ __RPC__out long *pFlag) = 0; - - virtual HRESULT STDMETHODCALLTYPE get_InputSize( - /* [out] */ __RPC__out int *piHeight, - /* [out] */ __RPC__out int *piWidth) = 0; - - virtual HRESULT STDMETHODCALLTYPE put_Size( - /* [in] */ int Height, - /* [in] */ int Width, - /* [in] */ long Flag) = 0; - - virtual HRESULT STDMETHODCALLTYPE get_MediaType( - /* [out] */ __RPC__out AM_MEDIA_TYPE *pmt) = 0; - - virtual HRESULT STDMETHODCALLTYPE put_MediaType( - /* [in] */ __RPC__in const AM_MEDIA_TYPE *pmt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IResizeVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IResize * This, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IResize * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IResize * This); - - HRESULT ( STDMETHODCALLTYPE *get_Size )( - IResize * This, - /* [out] */ __RPC__out int *piHeight, - /* [out] */ __RPC__out int *piWidth, - /* [out] */ __RPC__out long *pFlag); - - HRESULT ( STDMETHODCALLTYPE *get_InputSize )( - IResize * This, - /* [out] */ __RPC__out int *piHeight, - /* [out] */ __RPC__out int *piWidth); - - HRESULT ( STDMETHODCALLTYPE *put_Size )( - IResize * This, - /* [in] */ int Height, - /* [in] */ int Width, - /* [in] */ long Flag); - - HRESULT ( STDMETHODCALLTYPE *get_MediaType )( - IResize * This, - /* [out] */ __RPC__out AM_MEDIA_TYPE *pmt); - - HRESULT ( STDMETHODCALLTYPE *put_MediaType )( - IResize * This, - /* [in] */ __RPC__in const AM_MEDIA_TYPE *pmt); - - END_INTERFACE - } IResizeVtbl; - - interface IResize - { - CONST_VTBL struct IResizeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IResize_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IResize_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IResize_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IResize_get_Size(This,piHeight,piWidth,pFlag) \ - ( (This)->lpVtbl -> get_Size(This,piHeight,piWidth,pFlag) ) - -#define IResize_get_InputSize(This,piHeight,piWidth) \ - ( (This)->lpVtbl -> get_InputSize(This,piHeight,piWidth) ) - -#define IResize_put_Size(This,Height,Width,Flag) \ - ( (This)->lpVtbl -> put_Size(This,Height,Width,Flag) ) - -#define IResize_get_MediaType(This,pmt) \ - ( (This)->lpVtbl -> get_MediaType(This,pmt) ) - -#define IResize_put_MediaType(This,pmt) \ - ( (This)->lpVtbl -> put_MediaType(This,pmt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IResize_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_AMTimeline; - -#ifdef __cplusplus - -class DECLSPEC_UUID("78530B75-61F9-11D2-8CAD-00A024580902") -AMTimeline; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineObj; - -#ifdef __cplusplus - -class DECLSPEC_UUID("78530B78-61F9-11D2-8CAD-00A024580902") -AMTimelineObj; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineSrc; - -#ifdef __cplusplus - -class DECLSPEC_UUID("78530B7A-61F9-11D2-8CAD-00A024580902") -AMTimelineSrc; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineTrack; - -#ifdef __cplusplus - -class DECLSPEC_UUID("8F6C3C50-897B-11d2-8CFB-00A0C9441E20") -AMTimelineTrack; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineComp; - -#ifdef __cplusplus - -class DECLSPEC_UUID("74D2EC80-6233-11d2-8CAD-00A024580902") -AMTimelineComp; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineGroup; - -#ifdef __cplusplus - -class DECLSPEC_UUID("F6D371E1-B8A6-11d2-8023-00C0DF10D434") -AMTimelineGroup; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineTrans; - -#ifdef __cplusplus - -class DECLSPEC_UUID("74D2EC81-6233-11d2-8CAD-00A024580902") -AMTimelineTrans; -#endif - -EXTERN_C const CLSID CLSID_AMTimelineEffect; - -#ifdef __cplusplus - -class DECLSPEC_UUID("74D2EC82-6233-11d2-8CAD-00A024580902") -AMTimelineEffect; -#endif - -EXTERN_C const CLSID CLSID_RenderEngine; - -#ifdef __cplusplus - -class DECLSPEC_UUID("64D8A8E0-80A2-11d2-8CF3-00A0C9441E20") -RenderEngine; -#endif - -EXTERN_C const CLSID CLSID_SmartRenderEngine; - -#ifdef __cplusplus - -class DECLSPEC_UUID("498B0949-BBE9-4072-98BE-6CCAEB79DC6F") -SmartRenderEngine; -#endif - -EXTERN_C const CLSID CLSID_AudMixer; - -#ifdef __cplusplus - -class DECLSPEC_UUID("036A9790-C153-11d2-9EF7-006008039E37") -AudMixer; -#endif - -EXTERN_C const CLSID CLSID_Xml2Dex; - -#ifdef __cplusplus - -class DECLSPEC_UUID("18C628EE-962A-11D2-8D08-00A0C9441E20") -Xml2Dex; -#endif - -EXTERN_C const CLSID CLSID_MediaLocator; - -#ifdef __cplusplus - -class DECLSPEC_UUID("CC1101F2-79DC-11D2-8CE6-00A0C9441E20") -MediaLocator; -#endif - -EXTERN_C const CLSID CLSID_PropertySetter; - -#ifdef __cplusplus - -class DECLSPEC_UUID("ADF95821-DED7-11d2-ACBE-0080C75E246E") -PropertySetter; -#endif - -EXTERN_C const CLSID CLSID_MediaDet; - -#ifdef __cplusplus - -class DECLSPEC_UUID("65BD0711-24D2-4ff7-9324-ED2E5D3ABAFA") -MediaDet; -#endif - -EXTERN_C const CLSID CLSID_SampleGrabber; - -#ifdef __cplusplus - -class DECLSPEC_UUID("C1F400A0-3F08-11d3-9F0B-006008039E37") -SampleGrabber; -#endif - -EXTERN_C const CLSID CLSID_NullRenderer; - -#ifdef __cplusplus - -class DECLSPEC_UUID("C1F400A4-3F08-11d3-9F0B-006008039E37") -NullRenderer; -#endif - -EXTERN_C const CLSID CLSID_DxtCompositor; - -#ifdef __cplusplus - -class DECLSPEC_UUID("BB44391D-6ABD-422f-9E2E-385C9DFF51FC") -DxtCompositor; -#endif - -EXTERN_C const CLSID CLSID_DxtAlphaSetter; - -#ifdef __cplusplus - -class DECLSPEC_UUID("506D89AE-909A-44f7-9444-ABD575896E35") -DxtAlphaSetter; -#endif - -EXTERN_C const CLSID CLSID_DxtJpeg; - -#ifdef __cplusplus - -class DECLSPEC_UUID("DE75D012-7A65-11D2-8CEA-00A0C9441E20") -DxtJpeg; -#endif - -EXTERN_C const CLSID CLSID_ColorSource; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0cfdd070-581a-11d2-9ee6-006008039e37") -ColorSource; -#endif - -EXTERN_C const CLSID CLSID_DxtKey; - -#ifdef __cplusplus - -class DECLSPEC_UUID("C5B19592-145E-11d3-9F04-006008039E37") -DxtKey; -#endif -#endif /* __DexterLib_LIBRARY_DEFINED__ */ - -/* interface __MIDL_itf_qedit_0001_0097 */ -/* [local] */ - - -enum __MIDL___MIDL_itf_qedit_0001_0097_0001 - { E_NOTINTREE = 0x80040400, - E_RENDER_ENGINE_IS_BROKEN = 0x80040401, - E_MUST_INIT_RENDERER = 0x80040402, - E_NOTDETERMINED = 0x80040403, - E_NO_TIMELINE = 0x80040404, - S_WARN_OUTPUTRESET = 40404 - } ; -#define DEX_IDS_BAD_SOURCE_NAME 1400 -#define DEX_IDS_BAD_SOURCE_NAME2 1401 -#define DEX_IDS_MISSING_SOURCE_NAME 1402 -#define DEX_IDS_UNKNOWN_SOURCE 1403 -#define DEX_IDS_INSTALL_PROBLEM 1404 -#define DEX_IDS_NO_SOURCE_NAMES 1405 -#define DEX_IDS_BAD_MEDIATYPE 1406 -#define DEX_IDS_STREAM_NUMBER 1407 -#define DEX_IDS_OUTOFMEMORY 1408 -#define DEX_IDS_DIBSEQ_NOTALLSAME 1409 -#define DEX_IDS_CLIPTOOSHORT 1410 -#define DEX_IDS_INVALID_DXT 1411 -#define DEX_IDS_INVALID_DEFAULT_DXT 1412 -#define DEX_IDS_NO_3D 1413 -#define DEX_IDS_BROKEN_DXT 1414 -#define DEX_IDS_NO_SUCH_PROPERTY 1415 -#define DEX_IDS_ILLEGAL_PROPERTY_VAL 1416 -#define DEX_IDS_INVALID_XML 1417 -#define DEX_IDS_CANT_FIND_FILTER 1418 -#define DEX_IDS_DISK_WRITE_ERROR 1419 -#define DEX_IDS_INVALID_AUDIO_FX 1420 -#define DEX_IDS_CANT_FIND_COMPRESSOR 1421 -#define DEX_IDS_TIMELINE_PARSE 1426 -#define DEX_IDS_GRAPH_ERROR 1427 -#define DEX_IDS_GRID_ERROR 1428 -#define DEX_IDS_INTERFACE_ERROR 1429 -EXTERN_GUID(CLSID_VideoEffects1Category, 0xcc7bfb42, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59); -EXTERN_GUID(CLSID_VideoEffects2Category, 0xcc7bfb43, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59); -EXTERN_GUID(CLSID_AudioEffects1Category, 0xcc7bfb44, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59); -EXTERN_GUID(CLSID_AudioEffects2Category, 0xcc7bfb45, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59); - - -extern RPC_IF_HANDLE __MIDL_itf_qedit_0001_0097_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_qedit_0001_0097_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); -void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); - -unsigned long __RPC_USER VARIANT_UserSize( unsigned long *, unsigned long , VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserMarshal( unsigned long *, unsigned char *, VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserUnmarshal(unsigned long *, unsigned char *, VARIANT * ); -void __RPC_USER VARIANT_UserFree( unsigned long *, VARIANT * ); - -unsigned long __RPC_USER BSTR_UserSize64( unsigned long *, unsigned long , BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( unsigned long *, unsigned char *, BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(unsigned long *, unsigned char *, BSTR * ); -void __RPC_USER BSTR_UserFree64( unsigned long *, BSTR * ); - -unsigned long __RPC_USER VARIANT_UserSize64( unsigned long *, unsigned long , VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserMarshal64( unsigned long *, unsigned char *, VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserUnmarshal64(unsigned long *, unsigned char *, VARIANT * ); -void __RPC_USER VARIANT_UserFree64( unsigned long *, VARIANT * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/include/realmedia/pnbastsd.h b/include/realmedia/pnbastsd.h deleted file mode 100644 index b4f02c23d..000000000 --- a/include/realmedia/pnbastsd.h +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** - * - * $Id: pnbastsd.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This file is a replacement for the basetsd.h file from VC++ 6.0. - * This will automatically be included by pntypes.h when using VC++ - * 6.0 or greater. This file correctly defines the basic sized types - * so they don't conflict with the G2 SDK. - * - */ - -#if !(defined(_MSC_VER) && (_MSC_VER > 1100)) -#error pnbastsd.h is only intended for use with Microsoft VC++ 6.0 or higher -#endif - -#ifndef _BASETSD_H_ -#define _BASETSD_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following types were defined in pntypes.h and so are intentionally - * not included in this file. They are left here for documentation purposes. - */ -#if 0 -typedef int LONG32; -typedef int INT32; -typedef unsigned int ULONG32; -typedef unsigned int UINT32; -#endif - -/* - * The following types are 32 bits wide and unsigned. - */ -typedef unsigned int *PULONG32; -typedef unsigned int DWORD32, *PDWORD32; -typedef unsigned int *PUINT32; - -/* - * INT_PTR is the same size as a pointer. Its size changes with pointer - * size (32 bit or 64 bit). HALF_PTR is half the size of a pointer. - */ -#ifdef _WIN64 - -typedef __int64 INT_PTR, *PINT_PTR; -typedef unsigned __int64 UINT_PTR, *PUINT_PTR; - -#define MAXINT_PTR (0x7fffffffffffffffI64) -#define MININT_PTR (0x8000000000000000I64) -#define MAXUINT_PTR (0xffffffffffffffffUI64) - -typedef unsigned int UHALF_PTR, *PUHALF_PTR; -typedef int HALF_PTR, *PHALF_PTR; - -#define MAXUHALF_PTR (0xffffffffUL) -#define MAXHALF_PTR (0x7fffffffL) -#define MINHALF_PTR (0x80000000L) - -#pragma warning(disable:4311) /* type cast truncation */ - -#if !defined(__midl) -__inline -unsigned long -HandleToUlong( - void *h - ) -{ - return((unsigned long) h ); -} - -__inline -unsigned long -PtrToUlong( - void *p - ) -{ - return((unsigned long) p ); -} - -__inline -unsigned short -PtrToUshort( - void *p - ) -{ - return((unsigned short) p ); -} - -__inline -long -PtrToLong( - void *p - ) -{ - return((long) p ); -} - -__inline -short -PtrToShort( - void *p - ) -{ - return((short) p ); -} -#endif -#pragma warning(3:4311) /* type cast truncation */ - -#else - - -typedef long INT_PTR, *PINT_PTR; -typedef unsigned long UINT_PTR, *PUINT_PTR; - -#define MAXINT_PTR (0x7fffffffL) -#define MININT_PTR (0x80000000L) -#define MAXUINT_PTR (0xffffffffUL) - -typedef unsigned short UHALF_PTR, *PUHALF_PTR; -typedef short HALF_PTR, *PHALF_PTR; - -#define MAXUHALF_PTR 0xffff -#define MAXHALF_PTR 0x7fff -#define MINHALF_PTR 0x8000 - -#define HandleToUlong( h ) ((ULONG) (h) ) -#define PtrToUlong( p ) ((ULONG) (p) ) -#define PtrToLong( p ) ((LONG) (p) ) -#define PtrToUshort( p ) ((unsigned short) (p) ) -#define PtrToShort( p ) ((short) (p) ) - -#endif - -/* - * Basic SIZE_T support. - */ -typedef UINT_PTR SIZE_T, *PSIZE_T; -typedef INT_PTR SSIZE_T, *PSSIZE_T; - -/* - * These types are 64 bits wide and signed. - */ -typedef __int64 LONG64, *PLONG64; -typedef __int64 INT64, *PINT64; - -/* - * These types are 64 bits wide and unsigned. - */ -typedef unsigned __int64 ULONG64, *PULONG64; -typedef unsigned __int64 DWORD64, *PDWORD64; -typedef unsigned __int64 UINT64, *PUINT64; - -#ifdef __cplusplus -} -#endif - -#endif /* _BASETSD_H_ */ diff --git a/include/realmedia/pncom.h b/include/realmedia/pncom.h deleted file mode 100644 index 6e89ecc46..000000000 --- a/include/realmedia/pncom.h +++ /dev/null @@ -1,715 +0,0 @@ -/**************************************************************************** - * - * $Id: pncom.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Component Object Model defines, and macros - * - * This file defines items required for COM interfaces in RealMedia and - * Progressive Networks SDKs. - * - * - */ - -#ifndef _PNCOM_H_ -#define _PNCOM_H_ - -#include "pntypes.h" /* Needed for most type definitions */ -#include "string.h" - -// have to use the double expansion to get the prescan level - -#define STATCONCAT1(w,x,y,z) STATCONCAT2(w,x,y,z) -#define STATCONCAT2(w,x,y,z) w##x##y##z - -#ifdef _STATICALLY_LINKED -#ifndef _PLUGINNAME -#define ENTRYPOINT(func) STATCONCAT1(entrypoint_error_symbol_should_not_be_needed,_PLUGINNAME,_,func) -#else /* _PLUGINNAME */ -#define ENTRYPOINT(func) STATCONCAT1(entrypoint_for_,_PLUGINNAME,_,func) -#endif -#else /* _STATICALLY_LINKED */ -#define ENTRYPOINT(func) func -#endif - -/* - * We include objbase.h when building for windows so that pncom.h can - * easily be used in any windows code. - */ -#ifdef _WIN32 -#include -#endif /* _WIN32 */ - -#include "pnresult.h" - -/* - * REF: - * Use this for reference parameters, so that C users can - * use the interface as well. - */ -#if defined(__cplusplus) -#define REF(type) type& -#else -#define REF(type) const type * const -#endif - -/* - * CONSTMETHOD: - * Use this for constant methods in an interface - * Compiles away under C - */ -#if !defined( CONSTMETHOD ) - -#if defined(__cplusplus) -#define CONSTMETHOD const -#else -#define CONSTMETHOD -#endif - -#endif -/* - * CALL: - * - * Used by C users to easily call a function through an interface - * - * EXAMPLE: - * - * pIFooObject->CALL(IFoo,DoSomething)(bar); - * - */ -#if !defined(__cplusplus) || defined(CINTERFACE) -#define CALL(iface, func) iface##Vtbl->func -#endif - - -#define _INTERFACE struct - -/* - * If useing windows.h or the windows implementation of COM - * these defines are not needed. - */ -#if !defined( _OBJBASE_H_ ) - -#ifdef _WIN16 -typedef unsigned int MMRESULT; -#define FAR _far -#else -#define FAR -#endif /* WIN16 */ -#define PASCAL _pascal -#define CDECL _cdecl - -/* - * EXTERN_C - */ -#ifndef EXTERN_C -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C extern -#endif -#endif - -#ifdef OLDERRORCODES -#ifndef MAKE_HRESULT -#define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) -#endif /*MAKE_HRESULT*/ -#endif /* OLDERRORCODES */ - -/* - * STDMETHODCALLTYPE - */ -#ifndef STDMETHODCALLTYPE -#if defined(_WIN32) || defined(_MPPC_) -#ifdef _MPPC_ -#define STDMETHODCALLTYPE __cdecl -#else -#define STDMETHODCALLTYPE __stdcall -#endif -#elif defined(_WIN16) -#define STDMETHODCALLTYPE __export FAR CDECL -#else -#define STDMETHODCALLTYPE -#endif -#endif - -/* - * STDMETHODVCALLTYPE - */ -#ifndef STDMETHODVCALLTYPE -#if defined(_WINDOWS) || defined(_MPPC_) -#define STDMETHODVCALLTYPE __cdecl -#else -#define STDMETHODVCALLTYPE -#endif -#endif - -/* - * STDAPICALLTYPE - */ -#ifndef STDAPICALLTYPE -#if defined(_WIN32) || defined(_MPPC_) -#define STDAPICALLTYPE __stdcall -#elif defined(_WIN16) -#define STDAPICALLTYPE __export FAR PASCAL -#else -#define STDAPICALLTYPE -#endif -#endif - -/* - * STDAPIVCALLTYPE - */ -#ifndef STDAPIVCALLTYPE -#if defined(_WINDOWS) || defined(_MPPC_) -#define STDAPIVCALLTYPE __cdecl -#else -#define STDAPIVCALLTYPE -#endif -#endif - -/* - * Standard API defines: - * - * NOTE: the 'V' versions allow Variable Argument lists. - * - * STDAPI - * STDAPI_(type) - * STDAPIV - * STDAPIV_(type) - */ -#ifndef STDAPI -#define STDAPI EXTERN_C PN_RESULT STDAPICALLTYPE -#endif -#ifndef STDAPI_ -#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE -#endif -#ifndef STDAPIV -#define STDAPIV EXTERN_C PN_RESULT STDAPIVCALLTYPE -#endif -#ifndef STDAPIV_ -#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE -#endif - - -/* - * Standard Interface Method defines: - * - * NOTE: the 'V' versions allow Variable Argument lists. - * - * STDMETHODIMP - * STDMETHODIMP_(type) - * STDMETHODIMPV - * STDMETHODIMPV_(type) - */ -#ifndef STDMETHODIMP -#define STDMETHODIMP PN_RESULT STDMETHODCALLTYPE -#endif -#ifndef STDMETHODIMP_ -#define STDMETHODIMP_(type) type STDMETHODCALLTYPE -#endif -#ifndef STDMETHODIMPV -#define STDMETHODIMPV PN_RESULT STDMETHODVCALLTYPE -#endif -#ifndef STDMETHODIMPV_ -#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE -#endif - - -/* - * - * Interface Declaration - * - * These are macros for declaring interfaces. They exist so that - * a single definition of the interface is simulataneously a proper - * declaration of the interface structures (C++ abstract classes) - * for both C and C++. - * - * DECLARE_INTERFACE(iface) is used to declare an interface that does - * not derive from a base interface. - * DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface - * that does derive from a base interface. - * - * By default if the source file has a .c extension the C version of - * the interface declaratations will be expanded; if it has a .cpp - * extension the C++ version will be expanded. if you want to force - * the C version expansion even though the source file has a .cpp - * extension, then define the macro "CINTERFACE". - * eg. cl -DCINTERFACE file.cpp - * - * Example Interface declaration: - * - * #undef INTERFACE - * #define INTERFACE IClassFactory - * - * DECLARE_INTERFACE_(IClassFactory, IUnknown) - * { - * // *** IUnknown methods - * STDMETHOD(QueryInterface) (THIS_ - * REFIID riid, - * LPVOID FAR* ppvObj) PURE; - * STDMETHOD_(ULONG,AddRef) (THIS) PURE; - * STDMETHOD_(ULONG,Release) (THIS) PURE; - * - * // *** IClassFactory methods *** - * STDMETHOD(CreateInstance) (THIS_ - * LPUNKNOWN pUnkOuter, - * REFIID riid, - * LPVOID FAR* ppvObject) PURE; - * }; - * - * Example C++ expansion: - * - * struct FAR IClassFactory : public IUnknown - * { - * virtual PN_RESULT STDMETHODCALLTYPE QueryInterface( - * IID FAR& riid, - * LPVOID FAR* ppvObj) = 0; - * virtual PN_RESULT STDMETHODCALLTYPE AddRef(void) = 0; - * virtual PN_RESULT STDMETHODCALLTYPE Release(void) = 0; - * virtual PN_RESULT STDMETHODCALLTYPE CreateInstance( - * LPUNKNOWN pUnkOuter, - * IID FAR& riid, - * LPVOID FAR* ppvObject) = 0; - * }; - * - * NOTE: Our documentation says '#define interface class' but we use - * 'struct' instead of 'class' to keep a lot of 'public:' lines - * out of the interfaces. The 'FAR' forces the 'this' pointers to - * be far, which is what we need. - * - * Example C expansion: - * - * typedef struct IClassFactory - * { - * const struct IClassFactoryVtbl FAR* lpVtbl; - * } IClassFactory; - * - * typedef struct IClassFactoryVtbl IClassFactoryVtbl; - * - * struct IClassFactoryVtbl - * { - * PN_RESULT (STDMETHODCALLTYPE * QueryInterface) ( - * IClassFactory FAR* This, - * IID FAR* riid, - * LPVOID FAR* ppvObj) ; - * PN_RESULT (STDMETHODCALLTYPE * AddRef) (IClassFactory FAR* This) ; - * PN_RESULT (STDMETHODCALLTYPE * Release) (IClassFactory FAR* This) ; - * PN_RESULT (STDMETHODCALLTYPE * CreateInstance) ( - * IClassFactory FAR* This, - * LPUNKNOWN pUnkOuter, - * IID FAR* riid, - * LPVOID FAR* ppvObject); - * PN_RESULT (STDMETHODCALLTYPE * LockServer) ( - * IClassFactory FAR* This, - * BOOL fLock); - * }; - * - */ - -#if defined(__cplusplus) && !defined(CINTERFACE) -#define _INTERFACE struct -#define STDMETHOD(method) virtual PN_RESULT STDMETHODCALLTYPE method -#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method -#define PURE = 0 -#define THIS_ -#define THIS void - -#if defined(_WINDOWS) && defined(EXPORT_CLASSES) -#define DECLARE_INTERFACE(iface) _INTERFACE PNEXPORT_CLASS iface -#define DECLARE_INTERFACE_(iface, baseiface) _INTERFACE PNEXPORT_CLASS iface : public baseiface -#else -#define DECLARE_INTERFACE(iface) _INTERFACE iface -#define DECLARE_INTERFACE_(iface, baseiface) _INTERFACE iface : public baseiface -#endif // defined(_WINDOWS) && defined(EXPORT_CLASSES) - -#if !defined(BEGIN_INTERFACE) -#if defined(_MPPC_) && \ - ( (defined(_MSC_VER) || defined(__SC__) || defined(__MWERKS__)) && \ - !defined(NO_NULL_VTABLE_ENTRY) ) - #define BEGIN_INTERFACE virtual void a() {} - #define END_INTERFACE -#else - #define BEGIN_INTERFACE - #define END_INTERFACE -#endif -#endif - - -#else - -#define _INTERFACE struct - -#define STDMETHOD(method) PN_RESULT (STDMETHODCALLTYPE * method) -#define STDMETHOD_(type,method) type (STDMETHODCALLTYPE * method) - -#if !defined(BEGIN_INTERFACE) -#if defined(_MPPC_) - #define BEGIN_INTERFACE void *b; - #define END_INTERFACE -#else - #define BEGIN_INTERFACE - #define END_INTERFACE -#endif -#endif - - -#define PURE -#define THIS_ INTERFACE FAR* This, -#define THIS INTERFACE FAR* This -#ifdef CONST_VTABLE -#undef CONST_VTBL -#define CONST_VTBL const -#define DECLARE_INTERFACE(iface) typedef _INTERFACE iface { \ - const struct iface##Vtbl FAR* lpVtbl; \ - } iface; \ - typedef const struct iface##Vtbl iface##Vtbl; \ - const struct iface##Vtbl -#else -#undef CONST_VTBL -#define CONST_VTBL -#define DECLARE_INTERFACE(iface) typedef _INTERFACE iface { \ - struct iface##Vtbl FAR* lpVtbl; \ - } iface; \ - typedef struct iface##Vtbl iface##Vtbl; \ - struct iface##Vtbl -#endif -#define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE(iface) - -#endif - -/* - * COMMON TYPES - */ - -#ifndef GUID_DEFINED -#define GUID_DEFINED -typedef struct _GUID - { - ULONG32 Data1; - UINT16 Data2; - UINT16 Data3; - UCHAR Data4[ 8 ]; - } GUID; - -#endif - -#if !defined( __IID_DEFINED__ ) -#define __IID_DEFINED__ -typedef GUID IID; -#define IID_NULL GUID_NULL -typedef GUID CLSID; -#define CLSID_NULL GUID_NULL - -#if defined(__cplusplus) -#ifndef _REFGUID_DEFINED -#define _REFGUID_DEFINED -#define REFGUID const GUID & -#endif - -#ifndef _REFIID_DEFINED -#define _REFIID_DEFINED -#define REFIID const IID & -#endif - -#ifndef _REFCLSID_DEFINED -#define _REFCLSID_DEFINED -#define REFCLSID const CLSID & -#endif - -#else -#ifndef _REFGUID_DEFINED -#define _REFGUID_DEFINED -#define REFGUID const GUID * const -#endif -#ifndef _REFIID_DEFINED -#define _REFIID_DEFINED -#define REFIID const IID * const -#endif -#ifndef _REFCLSID_DEFINED -#define _REFCLSID_DEFINED -#define REFCLSID const CLSID * const -#endif -#endif -#endif - - -/* - * - * macros to define byte pattern for a GUID. - * Example: DEFINE_GUID(GUID_XXX, a, b, c, ...); - * - * Each dll/exe must initialize the GUIDs once. This is done in one of - * two ways. If you are not using precompiled headers for the file(s) which - * initializes the GUIDs, define INITGUID before including objbase.h. This - * is how OLE builds the initialized versions of the GUIDs which are included - * in ole2.lib. The GUIDs in ole2.lib are all defined in the same text - * segment GUID_TEXT. - * - * The alternative (which some versions of the compiler don't handle properly; - * they wind up with the initialized GUIDs in a data, not a text segment), - * is to use a precompiled version of objbase.h and then include initguid.h - * after objbase.h followed by one or more of the guid defintion files. - * - */ - -#if !defined (INITGUID) || (defined (_STATICALLY_LINKED) && !defined(NCIHACK)) -#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - EXTERN_C const GUID FAR name -#else - -#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - EXTERN_C const GUID name \ - = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -#endif - -#ifndef _VXWORKS -#include /* for memcmp */ -#endif - -#ifdef __cplusplus -inline BOOL IsEqualGUID(REFGUID rguid1, REFGUID rguid2) -{ - return !memcmp(&rguid1, &rguid2, sizeof(GUID)); -} - -inline void SetGUID(GUID& rguid1, REFGUID rguid2) -{ - memcpy(&rguid1, &rguid2, sizeof(GUID)); -} -#else -#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID))) -#define SetGUID(rguid1, rguid2) (memcpy(rguid1, rguid2, sizeof(GUID))) -#endif - -#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2) -#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2) - -#define SetIID(riid1, riid2) SetGUID(riid1, riid2) -#define SetCLSID(rclsid1, rclsid2) SetGUID(rclsid1, rclsid2) - -#ifdef __cplusplus - -/* - * Because GUID is defined elsewhere in WIN32 land, the operator == and != - * are moved outside the class to global scope. - */ - -inline BOOL operator==(const GUID& guidOne, const GUID& guidOther) -{ - return !memcmp(&guidOne,&guidOther,sizeof(GUID)); -} - -inline BOOL operator!=(const GUID& guidOne, const GUID& guidOther) -{ - return !(guidOne == guidOther); -} - -#endif - - -/**************************************************************************** - * - * Interface: - * - * IUnknown - * - * Purpose: - * - * Base class of all interfaces. Defines life time management and - * support for dynamic cast. - * - * IID_IUnknown: - * - * {00000000-0000-0000-C000000000000046} - * - */ -DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); - -#undef INTERFACE -#define INTERFACE IUnknown - -DECLARE_INTERFACE(IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IMalloc - * - * Purpose: - * - * Basic memory management interface. - * - * IID_IMalloc: - * - * {00000002-0000-0000-C000000000000046} - * - */ -DEFINE_GUID(IID_IMalloc, 00000002, 0x0000, 0x0000, 0xC0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); - -#undef INTERFACE -#define INTERFACE IMalloc - -DECLARE_INTERFACE_(IMalloc, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IMalloc methods - */ - STDMETHOD_(void*,Alloc) (THIS_ - UINT32 /*IN*/ count) PURE; - - STDMETHOD_(void*,Realloc) (THIS_ - void* /*IN*/ pMem, - UINT32 /*IN*/ count) PURE; - - STDMETHOD_(void,Free) (THIS_ - void* /*IN*/ pMem) PURE; - - STDMETHOD_(UINT32,GetSize) (THIS_ - void* /*IN*/ pMem) PURE; - - STDMETHOD_(BOOL,DidAlloc) (THIS_ - void* /*IN*/ pMem) PURE; - - STDMETHOD_(void,HeapMinimize) (THIS) PURE; -}; - -/* - * - * Synchronization: NOTE: These should be made thread safe or use built - * in synchronization support in an OS that supports it. - * - */ -#define InterlockedIncrement(plong) (++(*(plong))) -#define InterlockedDecrement(plong) (--(*(plong))) - -#else /* else case of !defined( _OBJBASE_H_ ) && !defined( _COMPOBJ_H_ ) */ - - -/* Even in windows we want these GUID's defined... */ - -#if !(defined(INITGUID) && defined(USE_IUNKNOWN_AND_IMALLOC_FROM_UUID_LIB)) -DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); - -DEFINE_GUID(IID_IMalloc, 00000002, 0x0000, 0x0000, 0xC0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); -#endif - -#include /* for memcmp */ - -#ifdef __cplusplus -inline void SetGUID(REFGUID rguid1, REFGUID rguid2) -{ - memcpy((void*)&rguid1, (void*)&rguid2, sizeof(GUID)); -} -#else -#define SetGUID(rguid1, rguid2) (memcpy((void*)rguid1, (void*)rguid2, sizeof(GUID))) -#endif -#define SetIID(riid1, riid2) SetGUID(riid1, riid2) -#define SetCLSID(rclsid1, rclsid2) SetGUID(rclsid1, rclsid2) - -#endif /* !defined( _OBJBASE_H_ ) && !defined( _COMPOBJ_H_ )*/ - -#ifdef IsEqualIID -#undef IsEqualIID -#endif - -#ifdef IsEqualCLSID -#undef IsEqualCLSID -#endif - -#define IsEqualIID(riid1, riid2) RNIsEqualGUID(riid1, riid2) -#define IsEqualCLSID(rclsid1, rclsid2) RNIsEqualGUID(rclsid1, rclsid2) - -#ifdef __cplusplus -inline BOOL RNIsEqualGUID(REFGUID rguid1, REFGUID rguid2) -{ - return (((UINT32*) &rguid1)[0] == ((UINT32*) &rguid2)[0] && - ((UINT32*) &rguid1)[1] == ((UINT32*) &rguid2)[1] && - ((UINT32*) &rguid1)[2] == ((UINT32*) &rguid2)[2] && - ((UINT32*) &rguid1)[3] == ((UINT32*) &rguid2)[3]); -} -#else -#define RNIsEqualGUID(rguid1, rguid2) \ - (((UINT32*) &rguid1)[0] == ((UINT32*) &rguid2)[0] && \ - ((UINT32*) &rguid1)[1] == ((UINT32*) &rguid2)[1] && \ - ((UINT32*) &rguid1)[2] == ((UINT32*) &rguid2)[2] && \ - ((UINT32*) &rguid1)[3] == ((UINT32*) &rguid2)[3]); -#endif - -/**************************************************************************** - * - * Putting the following macro in the definition of your class will overload - * new and delete for that object. New will then take an IMalloc* from - * which to allocate memory from and store it in the begining of the - * memory which it will return. Delete will grab this IMalloc* from - * the beginning of the mem and use this pointer to deallocate the mem. - * - * Example useage: - * class A - * { - * public: - * A(int); - * ~A(); - * - * IMALLOC_MEM - * }; - * - * IMalloc* pMalloc; - * m_pContext->QueryInterface(IID_IMalloc, (void**)&pMalloc); - * A* p = new(pMalloc) A(0); - * pMalloc->Release(); - * delete p; - */ - -#define IMALLOC_MEM\ - void* operator new(size_t size, IMalloc* pMalloc)\ - {\ - void* pMem = pMalloc->Alloc(size + sizeof(IMalloc*));\ - *(IMalloc**)pMem = pMalloc;\ - pMalloc->AddRef();\ - return ((unsigned char*)pMem + sizeof(IMalloc*));\ - }\ -\ - void operator delete(void* pMem)\ - {\ - pMem = (unsigned char*)pMem - sizeof(IMalloc*);\ - IMalloc* pMalloc = *(IMalloc**)pMem;\ - pMalloc->Free(pMem);\ - pMalloc->Release();\ - }\ - -#endif /* _PNCOM_H_ */ diff --git a/include/realmedia/pnresult.h b/include/realmedia/pnresult.h deleted file mode 100644 index d845cecff..000000000 --- a/include/realmedia/pnresult.h +++ /dev/null @@ -1,362 +0,0 @@ -/**************************************************************************** - * - * $Id: pnresult.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * This file contains the PN_RESULT type and it's associated result codes - */ - -#ifndef _PNRESULT_H_ -#define _PNRESULT_H_ - -/* Some files include this before pntypes.h. */ -#include "pntypes.h" - -typedef LONG32 PN_RESULT; - -#ifndef _WIN32 - typedef PN_RESULT HRESULT; -# define NOERROR 0 -# define FACILITY_ITF 4 -# define MAKE_HRESULT(sev,fac,code) \ - ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | \ - ((unsigned long)(code))) ) -# define SUCCEEDED(Status) (((unsigned long)(Status)>>31) == 0) -# define FAILED(Status) (((unsigned long)(Status)>>31) != 0) -#else -# ifndef _HRESULT_DEFINED - typedef LONG32 HRESULT; -# endif /* _HRESULT_DEFINED */ -# include -#endif /* _WIN32 */ - -#define MAKE_PN_RESULT(sev,fac,code) MAKE_HRESULT(sev, FACILITY_ITF, \ - ((fac << 6) | (code))) - -#define SS_GLO 0 /* General errors */ -#define SS_NET 1 /* Networking errors */ -#define SS_FIL 2 /* File errors */ -#define SS_PRT 3 /* Protocol Error */ -#define SS_AUD 4 /* Audio error */ -#define SS_INT 5 /* General internal errors */ -#define SS_USR 6 /* The user is broken. */ -#define SS_MSC 7 /* Miscellaneous */ -#define SS_DEC 8 /* Decoder errors */ -#define SS_ENC 9 /* Encoder errors */ -#define SS_REG 10 /* Registry (not Windows registry ;) errors */ -#define SS_PPV 11 /* Pay Per View errors */ -#define SS_RSC 12 /* Errors for PNXRES */ -#define SS_UPG 13 /* Auto-upgrade & Certificate Errors */ -#define SS_PLY 14 /* RealPlayer/Plus specific errors (USE ONLY IN /rpmisc/pub/rpresult.h) */ -#define SS_RMT 15 /* RMTools Errors */ -#define SS_CFG 16 /* AutoConfig Errors */ -#define SS_RPX 17 /* RealPix-related Errors */ -#define SS_XML 18 /* XML-related Errors */ - -#define SS_DPR 63 /* Deprecated errors */ - -#define PNR_NOTIMPL MAKE_HRESULT(1,0,0x4001) -#define PNR_OUTOFMEMORY MAKE_HRESULT(1,7,0x000e) -#define PNR_INVALID_PARAMETER MAKE_HRESULT(1,7,0x0057) -#define PNR_NOINTERFACE MAKE_HRESULT(1,0,0x4002) -#define PNR_POINTER MAKE_HRESULT(1,0,0x4003) -#define PNR_HANDLE MAKE_HRESULT(1,7,0x0006) -#define PNR_ABORT MAKE_HRESULT(1,0,0x4004) -#define PNR_FAIL MAKE_HRESULT(1,0,0x4005) -#define PNR_ACCESSDENIED MAKE_HRESULT(1,7,0x0005) -#define PNR_IGNORE MAKE_HRESULT(1,0,0x0006) -#define PNR_OK MAKE_HRESULT(0,0,0) - - -#define PNR_INVALID_OPERATION MAKE_PN_RESULT(1,SS_GLO,4) -#define PNR_INVALID_VERSION MAKE_PN_RESULT(1,SS_GLO,5) -#define PNR_INVALID_REVISION MAKE_PN_RESULT(1,SS_GLO,6) -#define PNR_NOT_INITIALIZED MAKE_PN_RESULT(1,SS_GLO,7) -#define PNR_DOC_MISSING MAKE_PN_RESULT(1,SS_GLO,8) -#define PNR_UNEXPECTED MAKE_PN_RESULT(1,SS_GLO,9) -#define PNR_INCOMPLETE MAKE_PN_RESULT(1,SS_GLO,12) -#define PNR_BUFFERTOOSMALL MAKE_PN_RESULT(1,SS_GLO,13) -#define PNR_UNSUPPORTED_VIDEO MAKE_PN_RESULT(1,SS_GLO,14) -#define PNR_UNSUPPORTED_AUDIO MAKE_PN_RESULT(1,SS_GLO,15) -#define PNR_INVALID_BANDWIDTH MAKE_PN_RESULT(1,SS_GLO,16) -/* PNR_NO_RENDERER and PNR_NO_FILEFORMAT old value is being deprecated -#define PNR_NO_FILEFORMAT MAKE_PN_RESULT(1,SS_GLO,10) -#define PNR_NO_RENDERER MAKE_PN_RESULT(1,SS_GLO,11)*/ -#define PNR_NO_RENDERER MAKE_PN_RESULT(1,SS_GLO,17) -#define PNR_NO_FILEFORMAT MAKE_PN_RESULT(1,SS_GLO,17) -#define PNR_MISSING_COMPONENTS MAKE_PN_RESULT(1,SS_GLO,17) -#define PNR_ELEMENT_NOT_FOUND MAKE_PN_RESULT(0,SS_GLO,18) -#define PNR_NOCLASS MAKE_PN_RESULT(0,SS_GLO,19) -#define PNR_CLASS_NOAGGREGATION MAKE_PN_RESULT(0,SS_GLO,20) -#define PNR_NOT_LICENSED MAKE_PN_RESULT(1,SS_GLO,21) -#define PNR_NO_FILESYSTEM MAKE_PN_RESULT(1,SS_GLO,22) -#define PNR_REQUEST_UPGRADE MAKE_PN_RESULT(1,SS_GLO,23) -#define PNR_AWAITING_LICENSE MAKE_PN_RESULT(1,SS_GLO,24) - -#define PNR_BUFFERING MAKE_PN_RESULT(0,SS_NET,0) -#define PNR_PAUSED MAKE_PN_RESULT(0,SS_NET,1) -#define PNR_NO_DATA MAKE_PN_RESULT(0,SS_NET,2) -#define PNR_STREAM_DONE MAKE_PN_RESULT(0,SS_NET,3) -#define PNR_NET_SOCKET_INVALID MAKE_PN_RESULT(1,SS_NET,3) -#define PNR_NET_CONNECT MAKE_PN_RESULT(1,SS_NET,4) -#define PNR_BIND MAKE_PN_RESULT(1,SS_NET,5) -#define PNR_SOCKET_CREATE MAKE_PN_RESULT(1,SS_NET,6) -#define PNR_INVALID_HOST MAKE_PN_RESULT(1,SS_NET,7) -#define PNR_NET_READ MAKE_PN_RESULT(1,SS_NET,8) -#define PNR_NET_WRITE MAKE_PN_RESULT(1,SS_NET,9) -#define PNR_NET_UDP MAKE_PN_RESULT(1,SS_NET,10) -#define PNR_RETRY MAKE_PN_RESULT(1,SS_NET,11) /* XXX */ -#define PNR_SERVER_TIMEOUT MAKE_PN_RESULT(1,SS_NET,12) -#define PNR_SERVER_DISCONNECTED MAKE_PN_RESULT(1,SS_NET,13) -#define PNR_WOULD_BLOCK MAKE_PN_RESULT(1,SS_NET,14) -#define PNR_GENERAL_NONET MAKE_PN_RESULT(1,SS_NET,15) -#define PNR_BLOCK_CANCELED MAKE_PN_RESULT(1,SS_NET,16) /* XXX */ -#define PNR_MULTICAST_JOIN MAKE_PN_RESULT(1,SS_NET,17) -#define PNR_GENERAL_MULTICAST MAKE_PN_RESULT(1,SS_NET,18) -#define PNR_MULTICAST_UDP MAKE_PN_RESULT(1,SS_NET,19) -#define PNR_AT_INTERRUPT MAKE_PN_RESULT(1,SS_NET,20) -#define PNR_MSG_TOOLARGE MAKE_PN_RESULT(1,SS_NET,21) -#define PNR_NET_TCP MAKE_PN_RESULT(1,SS_NET,22) -#define PNR_TRY_AUTOCONFIG MAKE_PN_RESULT(1,SS_NET,23) -#define PNR_NOTENOUGH_BANDWIDTH MAKE_PN_RESULT(1,SS_NET,24) -#define PNR_HTTP_CONNECT MAKE_PN_RESULT(1,SS_NET,25) -#define PNR_PORT_IN_USE MAKE_PN_RESULT(1,SS_NET,26) -#define PNR_LOADTEST_NOT_SUPPORTED MAKE_PN_RESULT(1,SS_NET,27) - -#define PNR_AT_END MAKE_PN_RESULT(0,SS_FIL,0) -#define PNR_INVALID_FILE MAKE_PN_RESULT(1,SS_FIL,1) -#define PNR_INVALID_PATH MAKE_PN_RESULT(1,SS_FIL,2) -#define PNR_RECORD MAKE_PN_RESULT(1,SS_FIL,3) -#define PNR_RECORD_WRITE MAKE_PN_RESULT(1,SS_FIL,4) -#define PNR_TEMP_FILE MAKE_PN_RESULT(1,SS_FIL,5) -#define PNR_ALREADY_OPEN MAKE_PN_RESULT(1,SS_FIL,6) -#define PNR_SEEK_PENDING MAKE_PN_RESULT(1,SS_FIL,7) -#define PNR_CANCELLED MAKE_PN_RESULT(1,SS_FIL,8) -#define PNR_FILE_NOT_FOUND MAKE_PN_RESULT(1,SS_FIL,9) -#define PNR_WRITE_ERROR MAKE_PN_RESULT(1,SS_FIL,10) -#define PNR_FILE_EXISTS MAKE_PN_RESULT(1,SS_FIL,11) -#define PNR_FILE_NOT_OPEN MAKE_PN_RESULT(1,SS_FIL,12) -#define PNR_ADVISE_PREFER_LINEAR MAKE_PN_RESULT(0,SS_FIL,13) -#define PNR_PARSE_ERROR MAKE_PN_RESULT(1,SS_FIL,14) - -#define PNR_BAD_SERVER MAKE_PN_RESULT(1,SS_PRT,0) -#define PNR_ADVANCED_SERVER MAKE_PN_RESULT(1,SS_PRT,1) -#define PNR_OLD_SERVER MAKE_PN_RESULT(1,SS_PRT,2) -#define PNR_REDIRECTION MAKE_PN_RESULT(0,SS_PRT,3) /* XXX */ -#define PNR_SERVER_ALERT MAKE_PN_RESULT(1,SS_PRT,4) -#define PNR_PROXY MAKE_PN_RESULT(1,SS_PRT,5) -#define PNR_PROXY_RESPONSE MAKE_PN_RESULT(1,SS_PRT,6) -#define PNR_ADVANCED_PROXY MAKE_PN_RESULT(1,SS_PRT,7) -#define PNR_OLD_PROXY MAKE_PN_RESULT(1,SS_PRT,8) -#define PNR_INVALID_PROTOCOL MAKE_PN_RESULT(1,SS_PRT,9) -#define PNR_INVALID_URL_OPTION MAKE_PN_RESULT(1,SS_PRT,10) -#define PNR_INVALID_URL_HOST MAKE_PN_RESULT(1,SS_PRT,11) -#define PNR_INVALID_URL_PATH MAKE_PN_RESULT(1,SS_PRT,12) -#define PNR_HTTP_CONTENT_NOT_FOUND MAKE_PN_RESULT(1,SS_PRT,13) -#define PNR_NOT_AUTHORIZED MAKE_PN_RESULT(1,SS_PRT,14) -#define PNR_UNEXPECTED_MSG MAKE_PN_RESULT(1,SS_PRT,15) -#define PNR_BAD_TRANSPORT MAKE_PN_RESULT(1,SS_PRT,16) -#define PNR_NO_SESSION_ID MAKE_PN_RESULT(1,SS_PRT,17) -#define PNR_PROXY_DNR MAKE_PN_RESULT(1,SS_PRT,18) -#define PNR_PROXY_NET_CONNECT MAKE_PN_RESULT(1,SS_PRT,19) - -#define PNR_AUDIO_DRIVER MAKE_PN_RESULT(1,SS_AUD,0) -#define PNR_LATE_PACKET MAKE_PN_RESULT(1,SS_AUD,1) -#define PNR_OVERLAPPED_PACKET MAKE_PN_RESULT(1,SS_AUD,2) -#define PNR_OUTOFORDER_PACKET MAKE_PN_RESULT(1,SS_AUD,3) -#define PNR_NONCONTIGUOUS_PACKET MAKE_PN_RESULT(1,SS_AUD,4) - -#define PNR_OPEN_NOT_PROCESSED MAKE_PN_RESULT(1,SS_INT,0) - -#define PNR_EXPIRED MAKE_PN_RESULT(1,SS_USR,0) - -#define PNR_INVALID_INTERLEAVER MAKE_PN_RESULT(1,SS_DPR,0) -#define PNR_BAD_FORMAT MAKE_PN_RESULT(1,SS_DPR,1) -#define PNR_CHUNK_MISSING MAKE_PN_RESULT(1,SS_DPR,2) -#define PNR_INVALID_STREAM MAKE_PN_RESULT(1,SS_DPR,3) -#define PNR_DNR MAKE_PN_RESULT(1,SS_DPR,4) -#define PNR_OPEN_DRIVER MAKE_PN_RESULT(1,SS_DPR,5) -#define PNR_UPGRADE MAKE_PN_RESULT(1,SS_DPR,6) -#define PNR_NOTIFICATION MAKE_PN_RESULT(1,SS_DPR,7) -#define PNR_NOT_NOTIFIED MAKE_PN_RESULT(1,SS_DPR,8) -#define PNR_STOPPED MAKE_PN_RESULT(1,SS_DPR,9) -#define PNR_CLOSED MAKE_PN_RESULT(1,SS_DPR,10) -#define PNR_INVALID_WAV_FILE MAKE_PN_RESULT(1,SS_DPR,11) -#define PNR_NO_SEEK MAKE_PN_RESULT(1,SS_DPR,12) - -#define PNR_DEC_INITED MAKE_PN_RESULT(1,SS_DEC,0) -#define PNR_DEC_NOT_FOUND MAKE_PN_RESULT(1,SS_DEC,1) -#define PNR_DEC_INVALID MAKE_PN_RESULT(1,SS_DEC,2) -#define PNR_DEC_TYPE_MISMATCH MAKE_PN_RESULT(1,SS_DEC,3) -#define PNR_DEC_INIT_FAILED MAKE_PN_RESULT(1,SS_DEC,4) -#define PNR_DEC_NOT_INITED MAKE_PN_RESULT(1,SS_DEC,5) -#define PNR_DEC_DECOMPRESS MAKE_PN_RESULT(1,SS_DEC,6) -#define PNR_OBSOLETE_VERSION MAKE_PN_RESULT(1,SS_DEC,7) - -#define PNR_ENC_FILE_TOO_SMALL MAKE_PN_RESULT(1,SS_ENC,0) -#define PNR_ENC_UNKNOWN_FILE MAKE_PN_RESULT(1,SS_ENC,1) -#define PNR_ENC_BAD_CHANNELS MAKE_PN_RESULT(1,SS_ENC,2) -#define PNR_ENC_BAD_SAMPSIZE MAKE_PN_RESULT(1,SS_ENC,3) -#define PNR_ENC_BAD_SAMPRATE MAKE_PN_RESULT(1,SS_ENC,4) -#define PNR_ENC_INVALID MAKE_PN_RESULT(1,SS_ENC,5) -#define PNR_ENC_NO_OUTPUT_FILE MAKE_PN_RESULT(1,SS_ENC,6) -#define PNR_ENC_NO_INPUT_FILE MAKE_PN_RESULT(1,SS_ENC,7) -#define PNR_ENC_NO_OUTPUT_PERMISSIONS MAKE_PN_RESULT(1,SS_ENC,8) -#define PNR_ENC_BAD_FILETYPE MAKE_PN_RESULT(1,SS_ENC,9) -#define PNR_ENC_INVALID_VIDEO MAKE_PN_RESULT(1,SS_ENC,10) -#define PNR_ENC_INVALID_AUDIO MAKE_PN_RESULT(1,SS_ENC,11) -#define PNR_ENC_NO_VIDEO_CAPTURE MAKE_PN_RESULT(1,SS_ENC,12) -#define PNR_ENC_INVALID_VIDEO_CAPTURE MAKE_PN_RESULT(1,SS_ENC,13) -#define PNR_ENC_NO_AUDIO_CAPTURE MAKE_PN_RESULT(1,SS_ENC,14) -#define PNR_ENC_INVALID_AUDIO_CAPTURE MAKE_PN_RESULT(1,SS_ENC,15) -#define PNR_ENC_TOO_SLOW_FOR_LIVE MAKE_PN_RESULT(1,SS_ENC,16) -#define PNR_ENC_ENGINE_NOT_INITIALIZED MAKE_PN_RESULT(1,SS_ENC,17) -#define PNR_ENC_CODEC_NOT_FOUND MAKE_PN_RESULT(1,SS_ENC,18) -#define PNR_ENC_CODEC_NOT_INITIALIZED MAKE_PN_RESULT(1,SS_ENC,19) -#define PNR_ENC_INVALID_INPUT_DIMENSIONS MAKE_PN_RESULT(1,SS_ENC,20) -#define PNR_ENC_MESSAGE_IGNORED MAKE_PN_RESULT(1,SS_ENC,21) -#define PNR_ENC_NO_SETTINGS MAKE_PN_RESULT(1,SS_ENC,22) -#define PNR_ENC_NO_OUTPUT_TYPES MAKE_PN_RESULT(1,SS_ENC,23) -#define PNR_ENC_IMPROPER_STATE MAKE_PN_RESULT(1,SS_ENC,24) -#define PNR_ENC_INVALID_SERVER MAKE_PN_RESULT(1,SS_ENC,25) -#define PNR_ENC_INVALID_TEMP_PATH MAKE_PN_RESULT(1,SS_ENC,26) -#define PNR_ENC_MERGE_FAIL MAKE_PN_RESULT(1,SS_ENC,27) -#define PNR_BIN_DATA_NOT_FOUND MAKE_PN_RESULT(0,SS_ENC,28) -#define PNR_BIN_END_OF_DATA MAKE_PN_RESULT(0,SS_ENC,29) -#define PNR_BIN_DATA_PURGED MAKE_PN_RESULT(1,SS_ENC,30) -#define PNR_BIN_FULL MAKE_PN_RESULT(1,SS_ENC,31) -#define PNR_BIN_OFFSET_PAST_END MAKE_PN_RESULT(1,SS_ENC,32) -#define PNR_ENC_NO_ENCODED_DATA MAKE_PN_RESULT(1,SS_ENC,33) -#define PNR_ENC_INVALID_DLL MAKE_PN_RESULT(1,SS_ENC,34) -#define PNR_NOT_INDEXABLE MAKE_PN_RESULT(1,SS_ENC,35) -#define PNR_ENC_NO_BROWSER MAKE_PN_RESULT(1,SS_ENC,36) -#define PNR_ENC_NO_FILE_TO_SERVER MAKE_PN_RESULT(1,SS_ENC,37) -#define PNR_ENC_INSUFFICIENT_DISK_SPACE MAKE_PN_RESULT(1,SS_ENC,38) - -#define PNR_RMT_USAGE_ERROR MAKE_PN_RESULT(1,SS_RMT,1) -#define PNR_RMT_INVALID_ENDTIME MAKE_PN_RESULT(1,SS_RMT,2) -#define PNR_RMT_MISSING_INPUT_FILE MAKE_PN_RESULT(1,SS_RMT,3) -#define PNR_RMT_MISSING_OUTPUT_FILE MAKE_PN_RESULT(1,SS_RMT,4) -#define PNR_RMT_INPUT_EQUALS_OUTPUT_FILE MAKE_PN_RESULT(1,SS_RMT,5) -#define PNR_RMT_UNSUPPORTED_AUDIO_VERSION MAKE_PN_RESULT(1,SS_RMT,6) -#define PNR_RMT_DIFFERENT_AUDIO MAKE_PN_RESULT(1,SS_RMT,7) -#define PNR_RMT_DIFFERENT_VIDEO MAKE_PN_RESULT(1,SS_RMT,8) -#define PNR_RMT_PASTE_MISSING_STREAM MAKE_PN_RESULT(1,SS_RMT,9) -#define PNR_RMT_END_OF_STREAM MAKE_PN_RESULT(1,SS_RMT,10) -#define PNR_RMT_IMAGE_MAP_PARSE_ERROR MAKE_PN_RESULT(1,SS_RMT,11) -#define PNR_RMT_INVALID_IMAGEMAP_FILE MAKE_PN_RESULT(1,SS_RMT,12) -#define PNR_RMT_EVENT_PARSE_ERROR MAKE_PN_RESULT(1,SS_RMT,13) -#define PNR_RMT_INVALID_EVENT_FILE MAKE_PN_RESULT(1,SS_RMT,14) -#define PNR_RMT_INVALID_OUTPUT_FILE MAKE_PN_RESULT(1,SS_RMT,15) -#define PNR_RMT_INVALID_DURATION MAKE_PN_RESULT(1,SS_RMT,16) -#define PNR_RMT_NO_DUMP_FILES MAKE_PN_RESULT(1,SS_RMT,17) -#define PNR_RMT_NO_EVENT_DUMP_FILE MAKE_PN_RESULT(1,SS_RMT,18) -#define PNR_RMT_NO_IMAP_DUMP_FILE MAKE_PN_RESULT(1,SS_RMT,19) -#define PNR_RMT_NO_DATA MAKE_PN_RESULT(1,SS_RMT,20) -#define PNR_RMT_EMPTY_STREAM MAKE_PN_RESULT(1,SS_RMT,21) -#define PNR_RMT_READ_ONLY_FILE MAKE_PN_RESULT(1,SS_RMT,22) -#define PNR_RMT_PASTE_MISSING_AUDIO_STREAM MAKE_PN_RESULT(1,SS_RMT,23) -#define PNR_RMT_PASTE_MISSING_VIDEO_STREAM MAKE_PN_RESULT(1,SS_RMT,24) - - -#define PNR_PROP_NOT_FOUND MAKE_PN_RESULT(1,SS_REG,1) -#define PNR_PROP_NOT_COMPOSITE MAKE_PN_RESULT(1,SS_REG,2) -#define PNR_PROP_DUPLICATE MAKE_PN_RESULT(1,SS_REG,3) -#define PNR_PROP_TYPE_MISMATCH MAKE_PN_RESULT(1,SS_REG,4) -#define PNR_PROP_ACTIVE MAKE_PN_RESULT(1,SS_REG,5) -#define PNR_PROP_INACTIVE MAKE_PN_RESULT(1,SS_REG,6) - -#define PNR_COULDNOTINITCORE MAKE_PN_RESULT(1,SS_MSC,1) -#define PNR_PERFECTPLAY_NOT_SUPPORTED MAKE_PN_RESULT(1,SS_MSC,2) -#define PNR_NO_LIVE_PERFECTPLAY MAKE_PN_RESULT(1,SS_MSC,3) -#define PNR_PERFECTPLAY_NOT_ALLOWED MAKE_PN_RESULT(1,SS_MSC,4) -#define PNR_NO_CODECS MAKE_PN_RESULT(1,SS_MSC,5) -#define PNR_SLOW_MACHINE MAKE_PN_RESULT(1,SS_MSC,6) -#define PNR_FORCE_PERFECTPLAY MAKE_PN_RESULT(1,SS_MSC,7) -#define PNR_INVALID_HTTP_PROXY_HOST MAKE_PN_RESULT(1,SS_MSC,8) -#define PNR_INVALID_METAFILE MAKE_PN_RESULT(1,SS_MSC,9) -#define PNR_BROWSER_LAUNCH MAKE_PN_RESULT(1,SS_MSC,10) -#define PNR_VIEW_SOURCE_NOCLIP MAKE_PN_RESULT(1,SS_MSC,11) -#define PNR_VIEW_SOURCE_DISSABLED MAKE_PN_RESULT(1,SS_MSC,12) - -#define PNR_RESOURCE_NOT_CACHED MAKE_PN_RESULT(1,SS_RSC,1) -#define PNR_RESOURCE_NOT_FOUND MAKE_PN_RESULT(1,SS_RSC,2) -#define PNR_RESOURCE_CLOSE_FILE_FIRST MAKE_PN_RESULT(1,SS_RSC,3) -#define PNR_RESOURCE_NODATA MAKE_PN_RESULT(1,SS_RSC,4) -#define PNR_RESOURCE_BADFILE MAKE_PN_RESULT(1,SS_RSC,5) -#define PNR_RESOURCE_PARTIALCOPY MAKE_PN_RESULT(1,SS_RSC,6) - -#define PNR_PPV_NO_USER MAKE_PN_RESULT(1,SS_PPV,0) -#define PNR_PPV_GUID_READ_ONLY MAKE_PN_RESULT(1,SS_PPV,1) -#define PNR_PPV_GUID_COLLISION MAKE_PN_RESULT(1,SS_PPV,2) -#define PNR_REGISTER_GUID_EXISTS MAKE_PN_RESULT(1,SS_PPV,3) -#define PNR_PPV_AUTHORIZATION_FAILED MAKE_PN_RESULT(1,SS_PPV,4) -#define PNR_PPV_OLD_PLAYER MAKE_PN_RESULT(1,SS_PPV,5) -#define PNR_PPV_ACCOUNT_LOCKED MAKE_PN_RESULT(1,SS_PPV,6) -// #define PNR_PPV_PROTOCOL_IGNORES MAKE_PN_RESULT(1,SS_PPV,7) -#define PNR_PPV_DBACCESS_ERROR MAKE_PN_RESULT(1,SS_PPV,8) -#define PNR_PPV_USER_ALREADY_EXISTS MAKE_PN_RESULT(1,SS_PPV,9) - -// auto-upgrade (RealUpdate) errors -#define PNR_UPG_AUTH_FAILED MAKE_PN_RESULT(1,SS_UPG,0) -#define PNR_UPG_CERT_AUTH_FAILED MAKE_PN_RESULT(1,SS_UPG,1) -#define PNR_UPG_CERT_EXPIRED MAKE_PN_RESULT(1,SS_UPG,2) -#define PNR_UPG_CERT_REVOKED MAKE_PN_RESULT(1,SS_UPG,3) -#define PNR_UPG_RUP_BAD MAKE_PN_RESULT(1,SS_UPG,4) - -// auto-config errors -#define PNR_AUTOCFG_SUCCESS MAKE_PN_RESULT(1,SS_CFG,0) -#define PNR_AUTOCFG_FAILED MAKE_PN_RESULT(1,SS_CFG,1) -#define PNR_AUTOCFG_ABORT MAKE_PN_RESULT(1,SS_CFG,2) - -#define PNR_FAILED PNR_FAIL - -#ifdef _WIN16 -/*typedef UINT MMRESULT;*/ -#else -#ifdef _WIN32 -#define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc) -#ifdef _WINCE -#undef E_NOTIMPL -#undef E_OUTOFMEMORY -#undef E_INVALIDARG -#undef E_NOINTERFACE -#undef E_POINTER -#undef E_HANDLE -#undef E_ABORT -#undef E_FAIL -#undef E_ACCESSDENIED -#endif -#define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L) -#define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL) -#define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L) -#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L) -#define E_POINTER _HRESULT_TYPEDEF_(0x80004003L) -#define E_HANDLE _HRESULT_TYPEDEF_(0x80070006L) -#define E_ABORT _HRESULT_TYPEDEF_(0x80004004L) -#define E_FAIL _HRESULT_TYPEDEF_(0x80004005L) -#define E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80070005L) -#else -#define S_OK PNR_OK -#define E_NOTIMPL PNR_NOTIMPL -#define E_INVALIDARG PNR_INVALID_PARAMETER -#define E_NOINTERFACE PNR_NOINTERFACE -#define E_POINTER PNR_POINTER -#define E_HANDLE PNR_HANDLE -#define E_ABORT PNR_ABORT -#define E_FAIL PNR_FAIL -#define E_ACCESSDENIES PNR_ACCESSDENIED -#endif /* _WIN32 */ -#endif /* _WIN16 */ - -#define PN_STATUS_OK PNR_OK -#define PN_STATUS_FAILED E_FAIL - -#endif /* _PNRESULT_H_ */ diff --git a/include/realmedia/pntypes.h b/include/realmedia/pntypes.h deleted file mode 100644 index 5021f4e6c..000000000 --- a/include/realmedia/pntypes.h +++ /dev/null @@ -1,492 +0,0 @@ -/**************************************************************************** - * - * $Id: pntypes.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * This file defines data types that are too be used in all cross-platform - * Progressive Networks modules. - * - */ - -#ifndef _PNTYPES_H_ -#define _PNTYPES_H_ - -#if (defined(_MSC_VER) && (_MSC_VER > 1100) && defined(_BASETSD_H_)) -//#error For VC++ 6.0 or higher you must include pntypes.h before other windows header files. -#endif - -#if defined _WINDOWS || defined _OSF1 || defined _ALPHA - -#ifndef RN_LITTLE_ENDIAN -#define RN_LITTLE_ENDIAN 1 -#endif - -#ifndef RN_BIG_ENDIAN -#define RN_BIG_ENDIAN 0 -#endif - -#else - -#ifndef RN_LITTLE_ENDIAN -#define RN_LITTLE_ENDIAN 0 -#endif - -#ifndef RN_BIG_ENDIAN -#define RN_BIG_ENDIAN 1 -#endif - -#endif /* !_WINDOWS || !_OSF1 || !_ALPHA */ - -typedef signed char INT8; /* signed 8 bit value */ -typedef unsigned char UINT8; /* unsigned 8 bit value */ -typedef short int INT16; /* signed 16 bit value */ -typedef unsigned short int UINT16; /* unsigned 16 bit value */ -typedef signed int INT32; /* signed 32 bit value */ -typedef unsigned int UINT32; /* unsigned 32 bit value */ -typedef unsigned int UINT; - -#define __LONG_MAX__ 2147483647 - - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 1 -#endif - -#ifndef BOOL -typedef int BOOL; /* signed int value (0 or 1) */ -#endif -#endif /* _VXWORKS */ - -#define ARE_BOOLS_EQUAL(a,b) (((a) && (b)) || (!(a) && !(b))) - -#ifndef PN_BITFIELD -typedef unsigned char PN_BITFIELD; -#endif - -#if defined __alpha__ -typedef long int INT64; -#elif defined _WINDOWS -typedef __int64 INT64; -#else -typedef long long INT64; -#endif /* _WINDOWS */ - -/* - * Added for ease of reading. - * Instead of using __MWERKS__ you can now use _MACINTOSH - */ -#ifdef __MWERKS__ - #if __dest_os==__macos - #ifndef _MACINTOSH - #define _MACINTOSH 1 - - #ifdef powerc - #define _MACPPC - #else - #define _MAC68K - #endif - - #endif - #endif -#endif - -#if defined (_SCO_SV) && !defined (MAXPATHLEN) -#include -#define MAXPATHLEN _POSIX_PATH_MAX -#define PATH_MAX _POSIX_PATH_MAX -#endif - -#ifdef _SCO_UW -#include //for sprintf -#endif - - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - -#define LANGUAGE_CODE "EN" - -#ifdef _WIN16 -#define MAX_PATH 260 -#define PRODUCT_ID "play16" -#define PLUS_PRODUCT_ID "plus16" -#else -#define PRODUCT_ID "play32" -#define PLUS_PRODUCT_ID "plus32" -#endif - - -#define MAX_DISPLAY_NAME 256 -#define PN_INVALID_VALUE (ULONG32)0xffffffff - -#define PN_DELETE(x) ((x) ? (delete (x), (x) = 0) : 0) -#define PN_VECTOR_DELETE(x) ((x) ? (delete [] (x), (x) = 0) : 0) -#define PN_RELEASE(x) ((x) ? ((x)->Release(), (x) = 0) : 0) - -#define RA_FILE_MAGIC_NUMBER 0x2E7261FDL /* RealAudio File Identifier */ -#define RM_FILE_MAGIC_NUMBER 0x2E524D46L /* RealMedia File Identifier */ -#define RIFF_FILE_MAGIC_NUMBER 0x52494646L /* RIFF (AVI etc.) File Identifier */ - -typedef INT32 LONG32; /* signed 32 bit value */ -typedef UINT32 ULONG32; /* unsigned 32 bit value */ -#ifndef _VXWORKS -typedef UINT8 UCHAR; /* unsigned 8 bit value */ -#endif -//typedef INT8 CHAR; /* signed 8 bit value */ - -typedef UINT8 BYTE; -typedef INT32 long32; -typedef UINT32 u_long32; - -typedef INT8 Int8; -typedef UINT8 u_Int8; -typedef INT16 Int16; -typedef UINT16 u_Int16; -typedef INT32 Int32; -typedef UINT32 u_Int32; - -typedef ULONG32 UFIXED32; /* FIXED point value */ -#define FLOAT_TO_FIXED(x) ((UFIXED32) ((x) * (1L << 16) + 0.5)) -#define FIXED_TO_FLOAT(x) ((float) ((((float)x)/ (float)(1L <<16)))) - -/* - * UFIXED32 is a 32 value where the upper 16 bits are the unsigned integer - * portion of value, and the lower 16 bits are the fractional part of the - * value - */ - -typedef const char* PCSTR; - -/* - * FOURCC's are 32bit codes used in Tagged File formats like - * the RealMedia file format. - */ - -#ifndef PN_FOURCC -#define PN_FOURCC( ch0, ch1, ch2, ch3 ) \ - ( (UINT32)(UINT8)(ch0) | ( (UINT32)(UINT8)(ch1) << 8 ) | \ - ( (UINT32)(UINT8)(ch2) << 16 ) | ( (UINT32)(UINT8)(ch3) << 24 ) ) -#endif - -typedef UINT16 PrefKey; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*-------------------------------------------------------------------------- -| ZeroInit - initializes a block of memory with zeros ---------------------------------------------------------------------------*/ -#define ZeroInit(pb) memset((void *)pb,0,sizeof(*(pb))) - -#ifndef __MACTYPES__ -typedef unsigned char Byte; -#endif - -/* -///////////////////////////////////////////////////////////////////////////// -// PNEXPORT needed for RA.H and RAGUI.H, should be able to be defined -// and used in cross platform code... -///////////////////////////////////////////////////////////////////////////// -*/ -#define PNEXPORT __declspec(dllexport) __stdcall -#define PNEXPORT_PTR __stdcall * - -typedef void (*RANOTIFYPROC)( void* ); - -#if defined(EXPORT_CLASSES) && defined(_WINDOWS) -#ifdef _WIN32 -#define PNEXPORT_CLASS __declspec(dllexport) -#else -#define PNEXPORT_CLASS __export -#endif // _WIN32 -#else -#define PNEXPORT_CLASS -#endif // EXPORT_CLASSES - - -/* - * STDMETHODCALLTYPE - */ -#ifndef STDMETHODCALLTYPE -#if defined(_WIN32) || defined(_MPPC_) -#ifdef _MPPC_ -#define STDMETHODCALLTYPE __cdecl -#else -#define STDMETHODCALLTYPE __stdcall -#endif -#elif defined(_WIN16) -// XXXTW I made the change below on 5/18/98. The __export was causing -// conflicts with duplicate CPNBuffer methods in being linked into -// rpupgrd and rpdestpn. Also, the warning was "export imported". -// This was fixed by removing the __export. The __export is also -// causing the same problem in pndebug methods. -//#define STDMETHODCALLTYPE __export far _cdecl -#define STDMETHODCALLTYPE far _cdecl -#else -#define STDMETHODCALLTYPE -#endif -#endif - -/* - * STDMETHODVCALLTYPE (V is for variable number of arguments) - */ -#ifndef STDMETHODVCALLTYPE -#if defined(_WINDOWS) || defined(_MPPC_) -#define STDMETHODVCALLTYPE __cdecl -#else -#define STDMETHODVCALLTYPE -#endif -#endif - -/* - * STDAPICALLTYPE - */ -#ifndef STDAPICALLTYPE -#if defined(_WIN32) || defined(_MPPC_) -#define STDAPICALLTYPE __stdcall -#elif defined(_WIN16) -#define STDAPICALLTYPE __export FAR PASCAL -#else -#define STDAPICALLTYPE -#endif -#endif - -/* - * STDAPIVCALLTYPE (V is for variable number of arguments) - */ -#ifndef STDAPIVCALLTYPE -#if defined(_WINDOWS) || defined(_MPPC_) -#define STDAPIVCALLTYPE __cdecl -#else -#define STDAPIVCALLTYPE -#endif -#endif - -/* -///////////////////////////////////////////////////////////////////////////// -// -// Macro: -// -// PN_GET_MAJOR_VERSION() -// -// Purpose: -// -// Returns the Major version portion of the encoded product version -// of the RealAudio application interface DLL previously returned from -// a call to RaGetProductVersion(). -// -// Parameters: -// -// prodVer -// The encoded product version of the RealAudio application interface -// DLL previously returned from a call to RaGetProductVersion(). -// -// Return: -// -// The major version number of the RealAudio application interface DLL -// -// -*/ -#define PN_GET_MAJOR_VERSION(prodVer) ((prodVer >> 28) & 0xF) - -/* -///////////////////////////////////////////////////////////////////////////// -// -// Macro: -// -// PN_GET_MINOR_VERSION() -// -// Purpose: -// -// Returns the minor version portion of the encoded product version -// of the RealAudio application interface DLL previously returned from -// a call to RaGetProductVersion(). -// -// Parameters: -// -// prodVer -// The encoded product version of the RealAudio application interface -// DLL previously returned from a call to RaGetProductVersion(). -// -// Return: -// -// The minor version number of the RealAudio application interface DLL -// -// -*/ -#define PN_GET_MINOR_VERSION(prodVer) ((prodVer >> 20) & 0xFF) - -/* -///////////////////////////////////////////////////////////////////////////// -// -// Macro: -// -// PN_GET_RELEASE_NUMBER() -// -// Purpose: -// -// Returns the release number portion of the encoded product version -// of the RealAudio application interface DLL previously returned from -// a call to RaGetProductVersion(). -// -// Parameters: -// -// prodVer -// The encoded product version of the RealAudio application interface -// DLL previously returned from a call to RaGetProductVersion(). -// -// Return: -// -// The release number of the RealAudio application interface DLL -// -// -*/ -#define PN_GET_RELEASE_NUMBER(prodVer) ((prodVer >> 12) & 0xFF) - -/* -///////////////////////////////////////////////////////////////////////////// -// -// Macro: -// -// PN_GET_BUILD_NUMBER() -// -// Purpose: -// -// Returns the build number portion of the encoded product version -// of the RealAudio application interface DLL previously returned from -// a call to RaGetProductVersion(). -// -// Parameters: -// -// prodVer -// The encoded product version of the RealAudio application interface -// DLL previously returned from a call to RaGetProductVersion(). -// -// Return: -// -// The build number of the RealAudio application interface DLL -// -// -*/ -#define PN_GET_BUILD_NUMBER(prodVer) (prodVer & 0xFFF) - -/* -///////////////////////////////////////////////////////////////////////////// -// -// Macro: -// -// PN_ENCODE_PROD_VERSION() -// -// Purpose: -// -// Encodes a major version, minor version, release number, and build -// number into a product version for testing against the product version -// of the RealAudio application interface DLL returned from a call to -// RaGetProductVersion(). -// -// Parameters: -// -// major -// The major version number to encode. -// -// mimor -// The minor version number to encode. -// -// release -// The release number to encode. -// -// build -// The build number to encode. -// -// Return: -// -// The encoded product version. -// -// NOTES: -// -// Macintosh DEVELOPERS especially, make sure when using the PN_ENCODE_PROD_VERSION -// that you are passing a ULONG32 or equivalent for each of the parameters. -// By default a number passed in as a constant is a short unless it requires more room, -// so designate the constant as a long by appending a L to the end of it. -// Example: -// WORKS: -// PN_ENCODE_VERSION(2L,1L,1L,0L); -// -// DOES NOT WORK: -// PN_ENCODE_VERSION(2,1,1,0); -// -*/ - -#define PN_ENCODE_PROD_VERSION(major,minor,release,build) \ - ((ULONG32)((ULONG32)major << 28) | ((ULONG32)minor << 20) | \ - ((ULONG32)release << 12) | (ULONG32)build) - -#define PN_ENCODE_ADD_PRIVATE_FIELD(ulversion,ulprivate) \ - ((ULONG32)((ULONG32)(ulversion) & (UINT32)0xFFFFFF00) | (ULONG32)(ulprivate) ) - -#define PN_EXTRACT_PRIVATE_FIELD(ulversion)(ulversion & (UINT32)0xFF) - -#define PN_EXTRACT_MAJOR_VERSION(ulversion) ((ulversion)>>28) -#define PN_EXTRACT_MINOR_VERSION(ulversion) (((ulversion)>>20) & (UINT32)0xFF) - -#ifdef _AIX - typedef int tv_sec_t; - typedef int tv_usec_t; -#elif (defined _HPUX) - typedef UINT32 tv_sec_t; - typedef INT32 tv_usec_t; -#else - typedef INT32 tv_sec_t; - typedef INT32 tv_usec_t; -#endif /* _AIX */ - -#ifndef VOLATILE -#define VOLATILE volatile -#endif - -#ifdef __GNUC__ -#define PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME friend class SilenceGCCWarnings; -#else -#define PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME -#endif - -typedef ULONG32 PNXRESOURCE; -typedef ULONG32 PNXHANDLE; -typedef ULONG32 PNXIMAGE; - -// Macro which indicates that a particular variable is unused. Use this to -// avoid compiler warnings. -//#define UNUSED(x) - -/* - * For VC++ 6.0 and higher we need to include this substitute header file - * in place of the standard header file basetsd.h, since this standard - * header file conflicts with our definitions. - */ -#if defined(_MSC_VER) && (_MSC_VER > 1100) -#include "pnbastsd.h" -#ifdef _WINCE -#define _TYPES_H_ -#endif -#endif - -#ifdef _VXWORKS -/* throw in some defines for VXWORKS */ -#define MAXPATHLEN 255 - - -#endif /* _PNTYPES_H_ */ diff --git a/include/realmedia/pnwintyp.h b/include/realmedia/pnwintyp.h deleted file mode 100644 index 5c9c6f426..000000000 --- a/include/realmedia/pnwintyp.h +++ /dev/null @@ -1,278 +0,0 @@ -/**************************************************************************** - * - * $Id: pnwintyp.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Defines the public classes for cross platform windows used in various - * Progressive Networks modules. - * - */ - -#ifndef _PNWINTYP_H_ -#define _PNWINTYP_H_ - -#include "pntypes.h" /* Needed at least for various defines and types. */ - -#ifdef _WIN16 -#define BI_BITFIELDS 3L -#endif - -/**************************************************************************** - * - * Structure: - * - * PNxSize - * - * Purpose: - * - * Cross Platform definition of a size. - * - */ -typedef struct PNEXPORT_CLASS _PNxSize -{ - INT32 cx; - INT32 cy; -} PNxSize; - -/**************************************************************************** - * - * Structure: - * - * PNxPoint - * - * Purpose: - * - * Cross Platform definition of a point. - * - */ -typedef struct PNEXPORT_CLASS _PNxPoint -{ - INT32 x; - INT32 y; -} PNxPoint; - -/**************************************************************************** - * - * Structure: - * - * PNxRect - * - * Purpose: - * - * Cross Platform definition of a rectangle. - * - */ -typedef struct PNEXPORT_CLASS _PNxRect -{ - INT32 left; - INT32 top; - INT32 right; - INT32 bottom; -} PNxRect; - -#define PNxRECT_WIDTH(r) ((r).right - (r).left) -#define PNxRECT_HEIGHT(r) ((r).bottom - (r).top) - -/**************************************************************************** - * - * Structure: - * - * PNxWindow - * - * Purpose: - * - * Cross Platform definition of a window. This struct is sufficiently - * wide to describe parent or child windows in Windows, MacOS, and - * various flavours of X-Windows. - * - * Data Members: - * - * void* window - * platform specific window handle - * - * ULONG32 x, y - * position of top left corner relative to a client page - * - * ULONG32 width, height - * maximum window size - * - * PNxRect clipRect; - * clipping rectangle in port coordinates - * - */ -typedef struct PNEXPORT_CLASS _PNxWindow -{ - /* NOTE: The window parameter is NOT guaranteed to be unique for every - corresponding CPNWindow. Use PNxWindowID if this is desired. */ - void* window; - ULONG32 x; - ULONG32 y; - ULONG32 width; - ULONG32 height; - PNxRect clipRect; - #ifdef _UNIX - void * display; - #endif -} PNxWindow; - -typedef void* PNxWindowID; - -/**************************************************************************** - * - * Structure: - * - * PNxEvent - * - * Purpose: - * - * Cross Platform definition of a event. This struct is sufficiently - * wide to describe an event in Windows, MacOS, and various flavours of - * X-Windows. - * - * Data Members: - * - * void* event - * platform specific event ID, can also be one of the several PNxMSG_* - * event IDs which map onto existing platform specific event IDs - * UNIX: X Event Type - * - * void* window - * platform specific window handle - * UNIX: X Window ID - * - * void* param1 - * message specific parameter - * UNIX: Display* - * - * void* param2 - * Mac: for UpdateEvt, either NULL or RgnHandle to be filled with updated area - * UNIX: Native XEvent* - * RMA_SURFACE_UPDATE PNxWindow* - * - */ -typedef struct PNEXPORT_CLASS _PNxEvent -{ - ULONG32 event; /* IN */ - void* window; /* IN */ - void* param1; /* IN */ - void* param2; /* IN */ - - UINT32 result; /* OUT */ - BOOL handled; /* OUT */ -} PNxEvent; - - -/**************************************************************************** - * - * typedef: - * - * PNxRegion - * - * Purpose: - * - * Cross Platform definition of a region. This typedef is redefined as - * appropriate to describe a region in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef void* PNxRegion; - -/**************************************************************************** - * - * typedef: - * - * PNxDC - * - * Purpose: - * - * Cross Platform definition of a device context. This typedef is redefined as - * appropriate to describe a device context in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef void* PNxDC; - -/**************************************************************************** - * - * typedef: - * - * PNxFont - * - * Purpose: - * - * Cross Platform definition of a font. This typedef is redefined as - * appropriate to describe a font in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef void* PNxFont; - -/**************************************************************************** - * - * typedef: - * - * PNxColor - * - * Purpose: - * - * Cross Platform definition of a color. This typedef is redefined as - * appropriate to describe a font in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef ULONG32 PNxColor; - -/**************************************************************************** - * - * typedef: - * - * PNxIcon - * - * Purpose: - * - * Cross Platform definition of a icon. This typedef is redefined as - * appropriate to describe a font in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef void* PNxIcon; - -/**************************************************************************** - * - * typedef: - * - * PNxMenu - * - * Purpose: - * - * Cross Platform definition of a menu. This typedef is redefined as - * appropriate to describe a font in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef void* PNxMenu; - -/**************************************************************************** - * - * typedef: - * - * PNxCursor - * - * Purpose: - * - * Cross Platform definition of a cursor. This typedef is redefined as - * appropriate to describe a cursor in Windows, MacOS, and various - * flavours of X-Windows. - * - */ -typedef void* PNxCursor; - -#endif /* _PNWINTYP_H_ */ diff --git a/include/realmedia/pxresult.h b/include/realmedia/pxresult.h deleted file mode 100644 index 9bbf61695..000000000 --- a/include/realmedia/pxresult.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _PXRESULT_H -#define _PXRESULT_H - -#define PNR_UNKNOWN_IMAGE MAKE_PN_RESULT(1,SS_RPX,0) -#define PNR_UNKNOWN_EFFECT MAKE_PN_RESULT(1,SS_RPX,1) -#define PNR_SENDIMAGE_ABORTED MAKE_PN_RESULT(0,SS_RPX,2) -#define PNR_SENDEFFECT_ABORTED MAKE_PN_RESULT(0,SS_RPX,3) - -#endif diff --git a/include/realmedia/rmaaconf.h b/include/realmedia/rmaaconf.h deleted file mode 100644 index 4d9188960..000000000 --- a/include/realmedia/rmaaconf.h +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** - * - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture AutoConfiguration interfaces - * - */ - -#ifndef _RMAACONF_H_ -#define _RMAACONF_H_ - -/* - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMAAutoConfig IRMAAutoConfig; -typedef _INTERFACE IRMAAutoConfigResponse IRMAAutoConfigResponse; - -#define RMA_TRANSPORT_MULTICAST 0 -#define RMA_TRANSPORT_UDP 1 -#define RMA_TRANSPORT_TCP 2 -#define RMA_TRANSPORT_HTTP 3 - -/**************************************************************************** - * - * Interface: - * - * IRMAAutoConfig - * - * Purpose: - * This interface allows the auto-configuration of the protocol used by - * the client core. - * - * IID_IRMAAutoConfig: - * - * {00002700-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAutoConfig, 0x00002700, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAutoConfig - -DECLARE_INTERFACE_(IRMAAutoConfig, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAutoConfig methods - */ - /************************************************************************ - * Method: - * IRMAAutoConfig::Init - * Purpose: - * Shutdown the configuration process. - * - */ - STDMETHOD(Init) (THIS_ - IRMAAutoConfigResponse* pResponse, - const char* pPNAURL, - const char* pRTSPURL) PURE; - - /************************************************************************ - * Method: - * IRMAAutoConfig::Close - * Purpose: - * Shutdown the configuration process. - * - */ - STDMETHOD(Close) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAutoConfig::Abort - * Purpose: - * Abort the configuration process. - * - */ - STDMETHOD(Abort) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAutoConfig::DoAutoConfig - * Purpose: - * Start the auto-configuration Process. - * - */ - STDMETHOD(DoAutoConfig) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAutoConfigResponse - * - * Purpose: - * Response interface for IRMAAutoConfig. - * - * IID_IRMAAutoConfig: - * - * {00002701-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAutoConfigResponse, 0x00002701, 0x901, 0x11d1, 0x8b, - 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAutoConfigResponse - -DECLARE_INTERFACE_(IRMAAutoConfigResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAutoConfigResponse methods - */ - /************************************************************************ - * Method: - * IRMAAutoConfigResponse::OnBegin - * Purpose: - * Notification for start of auto-configure process - * - */ - STDMETHOD(OnBegin) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAutoConfigResponse::OnProgress - * Purpose: - * Notification for progress of auto-configure process - * - */ - STDMETHOD(OnProgress) (THIS_ - UINT32 ulProgress, - UINT32 ulProtocolID, - const char* pProtocolDescription) PURE; - - /************************************************************************ - * Method: - * IRMAAutoConfigResponse::OnComplete - * Purpose: - * Notification for completion of auto-configure process - * - */ - STDMETHOD(OnComplete) (THIS_ - PN_RESULT PNAResult, - UINT32 ulPNAProtocolID, - PN_RESULT RTSPResult, - UINT32 ulRTSPProtocolID) PURE; -}; - - -#endif /* _RMAACONF_H_ */ diff --git a/include/realmedia/rmaallow.h b/include/realmedia/rmaallow.h deleted file mode 100644 index cdb550215..000000000 --- a/include/realmedia/rmaallow.h +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaallow.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * Interfaces related to allowance plugins. - * - */ - -#ifndef _RMAALLOW_H_ -#define _RMAALLOW_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMARequest IRMARequest; -typedef _INTERFACE IRMAPlayerConnectionAdviseSinkManager IRMAPlayerConnectionAdviseSinkManager; -typedef _INTERFACE IRMAPlayerConnectionAdviseSink IRMAPlayerConnectionAdviseSink; -typedef _INTERFACE IRMAPlayerConnectionResponse IRMAPlayerConnectionResponse; -typedef _INTERFACE IRMAPlayerController IRMAPlayerController; -typedef _INTERFACE IRMAPlayerControllerProxyRedirect IRMAPlayerControllerProxyRedirect; - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerConnectionAdviseSink - * - * Purpose: - * - * Advise Sink which receives notification whenever a new player - * connects to the server. - * - * IID_IRMAPlayerConnectionAdviseSink: - * - * {00002600-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlayerConnectionAdviseSink, 0x00002600, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayerConnectionAdviseSink - -DECLARE_INTERFACE_(IRMAPlayerConnectionAdviseSink, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* OnConnection is called when a new player has connected to the - * server. If the result is PNR_OK, then the plugin will be notified - * when certain events occur in the player's life cycle. - */ - STDMETHOD(OnConnection) (THIS_ - IRMAPlayerConnectionResponse* pResponse) PURE; - - /* SetPlayerController is called by the server core to provide us with - * an interface which can stop, alert, redirect or otherwise control - * the player we are receiving notifications about. - */ - STDMETHOD(SetPlayerController) (THIS_ - IRMAPlayerController* pPlayerController) PURE; - - /* SetRegistryID is called by the server core to provide us with the - * ID for this Player in the server registry. The plugin can use this - * registry ID to find out various information about the connected player. - */ - STDMETHOD(SetRegistryID) (THIS_ UINT32 ulPlayerRegistryID) PURE; - - STDMETHOD(OnURL) (THIS_ IRMARequest* pRequest) PURE; - STDMETHOD(OnBegin) (THIS) PURE; - STDMETHOD(OnStop) (THIS) PURE; - STDMETHOD(OnPause) (THIS) PURE; - STDMETHOD(OnDone) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerConnectionResponse - * - * Purpose: - * - * Response object for the PlayerConnectionAdviseSink. - * - * IID_IRMAPlayerConnectionResponse: - * - * {00002601-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlayerConnectionResponse, 0x00002601, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayerConnectionResponse - -DECLARE_INTERFACE_(IRMAPlayerConnectionResponse, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - STDMETHOD(OnConnectionDone) (THIS_ PN_RESULT status) PURE; - STDMETHOD(OnURLDone) (THIS_ PN_RESULT status) PURE; - STDMETHOD(OnBeginDone) (THIS_ PN_RESULT status) PURE; - STDMETHOD(OnStopDone) (THIS_ PN_RESULT status) PURE; - STDMETHOD(OnPauseDone) (THIS_ PN_RESULT status) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerController - * - * Purpose: - * - * Object created by the server core and given to the - * IRMAPlayerConnectionResponse object so that the response object - * can control the connected player. - * - * IID_IRMAPlayerController: - * - * {00002602-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlayerController, 0x00002602, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayerController - -DECLARE_INTERFACE_(IRMAPlayerController, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - STDMETHOD(Pause) (THIS) PURE; - STDMETHOD(Resume) (THIS) PURE; - STDMETHOD(Disconnect) (THIS) PURE; - STDMETHOD(AlertAndDisconnect) (THIS_ IRMABuffer* pAlert) PURE; - - /* HostRedirect is called by a PlayerConnectionAdviseSink to redirect - * this player to another host and/or port, for the same URL. This - * method works with both RTSP and PNA protocols. - */ - STDMETHOD(HostRedirect) (THIS_ IRMABuffer* pHost, - UINT16 nPort) PURE; - - /* NetworkRedirect is called by a PlayerConnectionAdviseSink to redirect - * this player to another URL. Note: This method is only available for - * redirecting an RTSP player connection to another RTSP URL. - */ - STDMETHOD(NetworkRedirect) (THIS_ IRMABuffer* pURL, - UINT32 ulSecsFromNow) PURE; - - /* Redirect is called by a PlayerConnectionAdviseSink to redirect - * this player to another URL on the same server. For example, if - * pPartialURL were set to "welcome.rm", the player would be redirected - * to "current_protocol://current_host:current_port/welcome.rm". This - * method works with both RTSP and PNA protocols. - */ - STDMETHOD(Redirect) (THIS_ IRMABuffer* pPartialURL) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerConnectionAdviseSinkManager - * - * Purpose: - * - * Manages the creation of IRMAPlayerConnectionAdviseSink objects - * - * IID_IRMAPlayerConnectionAdviseSinkManager: - * - * {00002603-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlayerConnectionAdviseSinkManager, 0x00002603, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayerConnectionAdviseSinkManager - -DECLARE_INTERFACE_(IRMAPlayerConnectionAdviseSinkManager, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - STDMETHOD(CreatePlayerConnectionAdviseSink) - (THIS_ - REF(IRMAPlayerConnectionAdviseSink*) pPCAdviseSink) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerControllerProxyRedirect - * - * Purpose: - * - * QueryInterfaced from IRMAPlayerController. Allows 305 proxy redirect - * to be issued (as per RTSP spec). - * - * IID_IRMAPlayerControllerProxyRedirect: - * - * {00002607-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlayerControllerProxyRedirect, 0x00002607, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayerControllerProxyRedirect - -DECLARE_INTERFACE_(IRMAPlayerControllerProxyRedirect, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * This URL is just a hostname / port. It must be formatted like this: - * "rtsp://audio.real.com:554/". - * - * NOTE: You can *only* call this method between OnURL() and OnURLDone(). - * NOTE: This method only works on RTSP connections. - */ - STDMETHOD(NetworkProxyRedirect) (THIS_ IRMABuffer* pURL) PURE; -}; - -#endif /* _RMAALLOW_H_ */ diff --git a/include/realmedia/rmaasm.h b/include/realmedia/rmaasm.h deleted file mode 100644 index cba8844de..000000000 --- a/include/realmedia/rmaasm.h +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaasm.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Interfaces for Adaptive Stream Management and - * Backchannel Support. - * - */ - -#ifndef _RMAASM_H_ -#define _RMAASM_H_ - -/* - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMABackChannel IRMABackChannel; -typedef _INTERFACE IRMAASMSource IRMAASMSource; -typedef _INTERFACE IRMAASMStreamSink IRMAASMStreamSink; -typedef _INTERFACE IRMAASMStream IRMAASMStream; - - -/**************************************************************************** - * - * Interface: - * - * IRMABackChannel - * - * Purpose: - * - * Backchannel interface to be used by renderers and implemented by - * FileFormat Plugins - * - * IID_IRMABackChannel: - * - * {00001500-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMABackChannel, 0x00001500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMABackChannel - -DECLARE_INTERFACE_(IRMABackChannel, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMABackChannel method - */ - - /************************************************************************ - * Method: - * IRMABackChannel::PacketReady - * Purpose: - * A back channel packet sent from Renderer to FileFormat plugin. - */ - STDMETHOD(PacketReady) (THIS_ - IRMAPacket* pPacket) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAASMSource - * - * Purpose: - * - * This interface is implemented by file formats so that they can - * act on ASM Subscribe and Unsubscribe actions. - * - * IID_IRMAASMSource: - * - * {00001501-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAASMSource, 0x00001501, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAASMSource - -DECLARE_INTERFACE_(IRMAASMSource, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAASMSource methods - */ - - /************************************************************************ - * Method: - * IRMAASMSource::Subscribe - * Purpose: - * Called to inform a file format that a subscription has occurred, - * to rule number uRuleNumber, for stream uStreamNumber. - */ - STDMETHOD(Subscribe) (THIS_ - UINT16 uStreamNumber, - UINT16 uRuleNumber) PURE; - - /************************************************************************ - * Method: - * IRMAASMSource::Unsubscribe - * Purpose: - * Called to inform a file format that a unsubscription has occurred, - * to rule number uRuleNumber, for stream uStreamNumber. - */ - STDMETHOD(Unsubscribe) (THIS_ - UINT16 uStreamNumber, - UINT16 uRuleNumber) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAASMStream - * - * Purpose: - * This interface is implemented by the client core. Top level clients - * renderers, etc can query for this interface off of IRMAStream. This - * interface allows you to subscribe and unsubscribe to certain rules, - * and it also allows you to add a advise sink for these events. - * - * IID_IRMAASMStream: - * - * {00001502-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAASMStream, 0x00001502, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAASMStream - -DECLARE_INTERFACE_(IRMAASMStream, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAASMStream methods - */ - - /************************************************************************ - * Method: - * IRMAASMStream::AddASMStreamSink - * Purpose: - * Add an advise sink for getting subscribe and unsubscribe - * notifications. - */ - STDMETHOD(AddStreamSink) (THIS_ - IRMAASMStreamSink* pASMStreamSink) PURE; - - /************************************************************************ - * Method: - * IRMAASMStream::RemoveStreamSink - * Purpose: - * Remove an advise sink for getting subscribe and unsubscribe - * notifications. - */ - STDMETHOD(RemoveStreamSink) (THIS_ - IRMAASMStreamSink* pASMStreamSink) PURE; - - /************************************************************************ - * Method: - * IRMAASMStream::Subscribe - * Purpose: - * Called by renderers and possibly even top level clients to - * inform the core to subscribe to a particular rule number for - * this stream. - */ - STDMETHOD(Subscribe) (THIS_ - UINT16 uRuleNumber) PURE; - - /************************************************************************ - * Method: - * IRMAASMStream::Unsubscribe - * Purpose: - * Called by renderers and possibly even top level clients to - * inform the core to unsubscribe to a particular rule number for - * this stream. - */ - STDMETHOD (Unsubscribe) (THIS_ - UINT16 uRuleNumber) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAASMStreamSink - * - * Purpose: - * This is a advise sink for getting notification about subscriptions - * and unsubscriptions for a stream. - * - * IID_IRMAASMStream: - * - * {00001503-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAASMStreamSink, 0x00001503, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAASMStreamSink - -DECLARE_INTERFACE_(IRMAASMStreamSink, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAASMStreamSink methods - */ - - /************************************************************************ - * Method: - * IRMAASMStreamSink::OnSubscribe - * Purpose: - * Called to inform you that a subscribe has occurred. - */ - STDMETHOD (OnSubscribe) (THIS_ - UINT16 uRuleNumber) PURE; - - /************************************************************************ - * Method: - * IRMAASMStreamSink::OnUnsubscribe - * Purpose: - * Called to inform you that a unsubscribe has occurred. - */ - STDMETHOD (OnUnsubscribe) (THIS_ - UINT16 uRuleNumber) PURE; -}; - -#endif /*_RMAASM_H_*/ diff --git a/include/realmedia/rmaausvc.h b/include/realmedia/rmaausvc.h deleted file mode 100644 index ce8542116..000000000 --- a/include/realmedia/rmaausvc.h +++ /dev/null @@ -1,1261 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaausvc.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Audio Services Interfaces. - * - */ - -#ifndef _RMAAUSVC_H_ -#define _RMAAUSVC_H_ - -/**************************************************************************** - * - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMAAudioPlayer IRMAAudioPlayer; -typedef _INTERFACE IRMAAudioPlayerResponse IRMAAudioPlayerResponse; -typedef _INTERFACE IRMAAudioStream IRMAAudioStream; -typedef _INTERFACE IRMAAudioStream2 IRMAAudioStream2; -typedef _INTERFACE IRMAAudioDevice IRMAAudioDevice; -typedef _INTERFACE IRMAAudioDeviceResponse IRMAAudioDeviceResponse; -typedef _INTERFACE IRMAAudioHook IRMAAudioHook; -typedef _INTERFACE IRMAAudioStreamInfoResponse IRMAAudioStreamInfoResponse; -typedef _INTERFACE IRMAVolume IRMAVolume; -typedef _INTERFACE IRMAVolumeAdviseSink IRMAVolumeAdviseSink; -typedef _INTERFACE IRMADryNotification IRMADryNotification; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAValues IRMAValues; - -/**************************************************************************** - * - * Audio Services Data Structures - */ -typedef struct _RMAAudioFormat -{ - UINT16 uChannels; /* Num. of Channels (1=Mono, 2=Stereo, etc. */ - UINT16 uBitsPerSample; /* 8 or 16 */ - ULONG32 ulSamplesPerSec;/* Sampling Rate */ - UINT16 uMaxBlockSize; /* Max Blocksize */ -} RMAAudioFormat; - -typedef enum _AudioStreamType -{ - STREAMING_AUDIO = 0, - INSTANTANEOUS_AUDIO = 1, - TIMED_AUDIO = 2 -} AudioStreamType; - -typedef struct _RMAAudioData -{ - IRMABuffer* pData; /* Audio data */ - ULONG32 ulAudioTime; /* Start time in milliseconds */ - AudioStreamType uAudioStreamType; -} RMAAudioData; - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioPlayer - * - * Purpose: - * - * This interface provides access to the Audio Player services. Use this - * interface to create audio streams, "hook" post-mixed audio data, and to - * control volume levels. - * - * IID_IRMAAudioPlayer: - * - * {00000700-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioPlayer, 0x00000700, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAAudioPlayer - -DECLARE_INTERFACE_(IRMAAudioPlayer, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioPlayer methods - */ - /************************************************************************ - * Method: - * IRMAAudioPlayer::CreateAudioStream - * Purpose: - * Call this to create an audio stream. - */ - STDMETHOD(CreateAudioStream) (THIS_ - IRMAAudioStream** /*OUT*/ pAudioStream - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::AddPostMixHook - * Purpose: - * Call this to hook audio data after all audio streams in this - * have been mixed. - */ - STDMETHOD(AddPostMixHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook, - const BOOL /*IN*/ bDisableWrite, - const BOOL /*IN*/ bFinal - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::RemovePostMixHook - * Purpose: - * Call this to remove an already added post hook. - */ - STDMETHOD(RemovePostMixHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::GetAudioStreamCount - * Purpose: - * Get the number of audio streams currently active in the - * audio player. Since streams can be added mid-presentation - * this function may return different values on different calls. - * If the user needs to know about all the streams as they get - * get added to the player, IRMAAudioStreamInfoResponse should - * be implemented and passed in SetStreamInfoResponse. - */ - STDMETHOD_(UINT16,GetAudioStreamCount) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::GetAudioStream - * Purpose: - * Get an audio stream at position given. - */ - STDMETHOD_(IRMAAudioStream*,GetAudioStream) (THIS_ - UINT16 /*IN*/ uIndex - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::SetStreamInfoResponse - * Purpose: - * Set a stream info response interface. A client must implement - * an IRMAAudioStreamInfoResponse and then call this method with - * the IRMAAudioStreamInfoResponse as the parameter. The audio - * player will call IRMAAudioStreamInfoResponse::OnStreamsReady - * with the total number of audio streams associated with this - * audio player. - */ - STDMETHOD(SetStreamInfoResponse) (THIS_ - IRMAAudioStreamInfoResponse* /*IN*/ pResponse - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::RemoveStreamInfoResponse - * Purpose: - * Remove stream info response that was added earlier - */ - STDMETHOD(RemoveStreamInfoResponse) (THIS_ - IRMAAudioStreamInfoResponse* /*IN*/ pResponse - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::GetAudioVolume - * Purpose: - * Get the audio player's volume interface. This volume controls - * the volume level of all the mixed audio streams for this - * audio player. - */ - STDMETHOD_(IRMAVolume*,GetAudioVolume) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioPlayer::GetDeviceVolume - * Purpose: - * Get the audio device volume interface. This volume controls - * the audio device volume levels. - */ - STDMETHOD_(IRMAVolume*,GetDeviceVolume) (THIS) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioPlayerResponse - * - * Purpose: - * - * This interface provides access to the Audio Player Response. Use this - * to receive audio player playback notifications. Your implementation of - * OnTimeSync() is called with the current audio playback time (millisecs). - * This interface is currently to be used ONLY by the RMA engine internally. - * - * IID_IRMAAudioPlayerResponse: - * - * {00000701-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioPlayerResponse, 0x00000701, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAAudioPlayerResponse - -DECLARE_INTERFACE_(IRMAAudioPlayerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioPlayerResponse methods - */ - - /************************************************************************ - * Method: - * IRMAAudioPlayerResponse::OnTimeSync - * Purpose: - * This method is called with the current audio playback time. - */ - STDMETHOD(OnTimeSync) (THIS_ - ULONG32 /*IN*/ ulTimeEnd - ) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioStream - * - * Purpose: - * - * This interface provides access to an Audio Stream. Use this to play - * audio, "hook" audio stream data, and to get audio stream information. - * - * IID_IRMAAudioStream: - * - * {00000702-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioStream, 0x00000702, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAAudioStream - -DECLARE_INTERFACE_(IRMAAudioStream, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioStream methods - */ - - /************************************************************************ - * Method: - * IRMAAudioStream::Init - * Purpose: - * Initialize an audio stream with the given audio format. The - * IRMAValues contains stream identification information. - */ - STDMETHOD(Init) (THIS_ - const RMAAudioFormat* /*IN*/ pAudioFormat, - IRMAValues* /*IN*/ pValues - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream::Write - * Purpose: - * Write audio data to Audio Services. - * - * NOTE: If the renderer loses packets and there is no loss - * correction, then the renderer should write the next packet - * using a meaningful start time. Audio Services will play - * silence where packets are missing. - */ - STDMETHOD(Write) (THIS_ - RMAAudioData* /*IN*/ pAudioData - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream::AddPreMixHook - * Purpose: - * Use this to "hook" audio stream data prior to the mixing. - * Set bDisableWrite to TRUE to prevent this audio stream data - * from being mixed with other audio stream data associated - * with this audio player. - */ - STDMETHOD(AddPreMixHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook, - const BOOL /*IN*/ bDisableWrite - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream::RemovePreMixHook - * Purpose: - * Use this to remove an already added "hook". - */ - STDMETHOD(RemovePreMixHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream::AddDryNotification - * Purpose: - * Use this to add a notification response object to get - * notifications when audio stream is running dry. - */ - STDMETHOD(AddDryNotification) (THIS_ - IRMADryNotification* /*IN*/ pNotification - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream::GetStreamInfo - * Purpose: - * Use this to get information specific to this audio stream. - */ - STDMETHOD_(IRMAValues*,GetStreamInfo) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream::GetAudioVolume - * Purpose: - * Get the audio stream's volume interface. This volume controls - * the volume level for this audio stream. - */ - STDMETHOD_(IRMAVolume*,GetAudioVolume) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioDevice - * - * Purpose: - * - * Object that exports audio device API - * This interface is currently to be used ONLY by the RMA engine - * internally. - * - * IID_IRMAAudioDevice: - * - * {00000703-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioDevice, 0x00000703, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioDevice - -DECLARE_INTERFACE_(IRMAAudioDevice, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioDevice methods - */ - - /************************************************************************ - * Method: - * IRMAAudioDevice::Open - * Purpose: - * The caller calls this to open the audio device using the audio - * format given. - */ - STDMETHOD(Open) (THIS_ - const RMAAudioFormat* /*IN*/ pAudioFormat, - IRMAAudioDeviceResponse* /*IN*/ pStreamResponse) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::Close - * Purpose: - * The caller calls this to close the audio device. - */ - STDMETHOD(Close) (THIS_ - const BOOL /*IN*/ bFlush ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::Resume - * Purpose: - * The caller calls this to start or resume audio playback. - */ - STDMETHOD(Resume) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::Pause - * Purpose: - * The caller calls this to pause the audio device. If bFlush is - * TRUE, any buffers in the audio device will be flushed; otherwise, - * the buffers are played. - */ - STDMETHOD(Pause) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::Write - * Purpose: - * The caller calls this to write an audio buffer. - */ - STDMETHOD(Write) (THIS_ - const RMAAudioData* /*IN*/ pAudioData) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::InitVolume - * Purpose: - * The caller calls this to inform the audio stream of the client's - * volume range. The audio stream maps the client's volume range - * into the audio device volume range. - * NOTE: This function returns TRUE if volume is supported by this - * audio device. - */ - STDMETHOD_(BOOL,InitVolume) (THIS_ - const UINT16 /*IN*/ uMinVolume, - const UINT16 /*IN*/ uMaxVolume) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::SetVolume - * Purpose: - * The caller calls this to set the audio device volume level. - */ - STDMETHOD(SetVolume) (THIS_ - const UINT16 /*IN*/ uVolume) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::GetVolume - * Purpose: - * The caller calls this to get the audio device volume level. - */ - STDMETHOD_(UINT16,GetVolume) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::Reset - * Purpose: - * The caller calls this to reset the audio device. - */ - STDMETHOD(Reset) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::Drain - * Purpose: - * The caller calls this to drain the audio device. - */ - STDMETHOD(Drain) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::CheckFormat - * Purpose: - * The caller calls this to check the input format with the - * audio device format. - */ - STDMETHOD(CheckFormat) (THIS_ - const RMAAudioFormat* /*IN*/ pAudioFormat ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDevice::GetCurrentAudioTime - * Purpose: - * The caller calls this to get current system audio time. - */ - STDMETHOD(GetCurrentAudioTime) (THIS_ - REF(ULONG32) /*OUT*/ ulCurrentTime) PURE; -}; - -/**************************************************************************** - * - * Interface: - * IRMAAudioDeviceResponse - * - * Purpose: - * - * Object that exports audio device Response API - * This interface is currently to be used ONLY by the RMA engine - * internally. - * - * IID_IRMAAudioDeviceResponse: - * - * {00000704-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioDeviceResponse, 0x00000704, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioDeviceResponse - -DECLARE_INTERFACE_(IRMAAudioDeviceResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioDeviceResponse methods - */ - - /************************************************************************ - * Method: - * IRMAAudioDeviceResponse::OnTimeSync - * Purpose: - * Notification interface provided by users of the IRMAAudioDevice - * interface. This method is called by the IRMAAudioDevice when - * audio playback occurs. - */ - STDMETHOD(OnTimeSync) (THIS_ - ULONG32 /*IN*/ ulTimeEnd) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioHook - * - * Purpose: - * - * Clients must implement this interface to access pre- or post-mixed - * audio data. Use this interface to get post processed audio buffers and - * their associated audio format. - * - * IID_IRMAAudioHook: - * - * {00000705-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioHook, 0x00000705, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioHook - -DECLARE_INTERFACE_(IRMAAudioHook, IUnknown) -{ - /* - * IUnknown methods! - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioHook methods - */ - /************************************************************************ - * Method: - * IRMAAudioHook::OnInit - * Purpose: - * Audio Services calls OnInit() with the audio data format of the - * audio data that will be provided in the OnBuffer() method. - */ - STDMETHOD(OnInit) (THIS_ - RMAAudioFormat* /*IN*/ pFormat) PURE; - - /************************************************************************ - * Method: - * IRMAAudioHook::OnBuffer - * Purpose: - * Audio Services calls OnBuffer() with audio data packets. The - * renderer should not modify the data in the IRMABuffer part of - * pAudioInData. If the renderer wants to write a modified - * version of the data back to Audio Services, then it should - * create its own IRMABuffer, modify the data and then associate - * this buffer with the pAudioOutData->pData member. - */ - STDMETHOD(OnBuffer) (THIS_ - RMAAudioData* /*IN*/ pAudioInData, - RMAAudioData* /*OUT*/ pAudioOutData) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioStreamInfoResponse - * - * Purpose: - * - * Clients must implement this interface when interested in receiving - * notification of the total number of streams associated with this - * audio player. - * - * IID_IRMAAudioStreamInfoResponse: - * - * {00000706-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioStreamInfoResponse, 0x00000706, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioStreamInfoResponse - -DECLARE_INTERFACE_(IRMAAudioStreamInfoResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioStreamInfoResponse methods - */ - - /************************************************************************ - * Method: - * IRMAAudioStreamInfoResponse::OnStream - * Purpose: - * The client implements this to get notification of streams - * associated with this player. Use - * AudioPlayer::SetStreamInfoResponse() to register your - * implementation with the AudioPlayer. Once player has been - * initialized, it will call OnStream() multiple times to pass all - * the streams. Since a stream can be added mid-presentation, - * IRMAAudioStreamInfoResponse object should be written to handle - * OnStream() in the midst of the presentation as well. - */ - STDMETHOD(OnStream) (THIS_ - IRMAAudioStream* /*IN*/ pAudioStream) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAVolume - * - * Purpose: - * - * This interface provides access to Audio Services volume control. Use this - * interface to get, set, or receive notifications of volume changes. Audio - * Services implements IRMAVolume for IRMAAudioPlayer, IRMAAudioStream and - * for the audio device. Clients can use the IRMAVolume interface to get/set - * volume levels of each audio stream, to get/set volume levels for the - * audio player's mixed data, or to get/set the volume levels of the audio - * device. See AudioStream::GetStreamVolume() (TBD), AudioPlayer:: - * GetAudioVolume() and AudioPlayer::GetDeviceVolume(). - * - * IID_IRMAVolume: - * - * {00000707-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAVolume, 0x00000707, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAVolume - -DECLARE_INTERFACE_(IRMAVolume, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAVolume methods - */ - /************************************************************************ - * Method: - * IRMAVolume::SetVolume - * Purpose: - * Call this to set the volume level. - */ - STDMETHOD(SetVolume) (THIS_ - const UINT16 /*IN*/ uVolume ) PURE; - - /************************************************************************ - * Method: - * IRMAVolume::GetVolume - * Purpose: - * Call this to get the current volume level. - */ - STDMETHOD_(UINT16,GetVolume) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAVolume::SetMute - * Purpose: - * Call this to mute the volume. - */ - STDMETHOD(SetMute) (THIS_ - const BOOL /*IN*/ bMute ) PURE; - - /************************************************************************ - * Method: - * IRMAVolume::GetMute - * Purpose: - * Call this to determine if the volume is muted. - * - */ - STDMETHOD_(BOOL,GetMute) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAVolume::AddAdviseSink - * Purpose: - * Call this to register an IRMAVolumeAdviseSink. The advise sink - * methods: OnVolumeChange() and OnMuteChange() are called when - * ever IRMAVolume::SetVolume() and IRMAVolume::SetMute() are - * called. - */ - STDMETHOD(AddAdviseSink) (THIS_ - IRMAVolumeAdviseSink* /*IN*/ pSink - ) PURE; - - /************************************************************************ - * Method: - * IRMAVolume::RemoveAdviseSink - * Purpose: - * Call this to unregister an IRMAVolumeAdviseSink. Use this when - * you are no longer interested in receiving volume or mute change - * notifications. - */ - STDMETHOD(RemoveAdviseSink) (THIS_ - IRMAVolumeAdviseSink* /*IN*/ pSink - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAVolumeAdviseSink - * - * Purpose: - * - * This interface provides access to notifications of volume changes. A - * client must implement this interface if they are interested in receiving - * notifications of volume level changes or mute state changes. A client must - * register their volume advise sink using IRMAVolume::AddAdviseSink(). - * See the IRMAVolume interface. - * - * IID_IRMAVolumeAdviseSink: - * - * {00000708-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAVolumeAdviseSink, 0x00000708, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAVolumeAdviseSink - -DECLARE_INTERFACE_(IRMAVolumeAdviseSink, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAVolumeAdviseSink methods - */ - - /************************************************************************ - * Method: - * IRMAVolumeAdviseSink::OnVolumeChange - * Purpose: - * This interface is called whenever the associated IRMAVolume - * SetVolume() is called. - */ - STDMETHOD(OnVolumeChange) (THIS_ - const UINT16 uVolume - ) PURE; - - /************************************************************************ - * Method: - * IRMAVolumeAdviseSink::OnMuteChange - * Purpose: - * This interface is called whenever the associated IRMAVolume - * SetMute() is called. - * - */ - STDMETHOD(OnMuteChange) (THIS_ - const BOOL bMute - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMADryNotification - * - * Purpose: - * - * Audio Renderer should implement this if it needs notification when the - * audio stream is running dry. - * - * IID_IRMADryNotification: - * - * {00000709-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADryNotification, 0x00000709, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADryNotification - -DECLARE_INTERFACE_(IRMADryNotification, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADryNotification methods - */ - - /************************************************************************ - * Method: - * IRMADryNotification::OnDryNotification - * Purpose: - * This function is called when it is time to write to audio device - * and there is not enough data in the audio stream. The renderer can - * then decide to add more data to the audio stream. This should be - * done synchronously within the call to this function. - * It is OK to not write any data. Silence will be played instead. - */ - STDMETHOD(OnDryNotification) (THIS_ - UINT32 /*IN*/ ulCurrentStreamTime, - UINT32 /*IN*/ ulMinimumDurationRequired - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioDeviceManager - * - * Purpose: - * - * Allows the default audio device to be replaced. - * - * IID_IRMAAudioDeviceManager: - * - * {0000070A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioDeviceManager, 0x0000070A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioDeviceManager - -DECLARE_INTERFACE_(IRMAAudioDeviceManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioDeviceManager methods - */ - - /********************************************************************** - * Method: - * IRMAAudioDeviceManager::Replace - * Purpose: - * This is used to replace the default implementation of the audio - * device by the given audio device interface. - */ - STDMETHOD(Replace) (THIS_ - IRMAAudioDevice* /*IN*/ pAudioDevice) PURE; - - /********************************************************************** - * Method: - * IRMAAudioDeviceManager::Remove - * Purpose: - * This is used to remove the audio device given to the manager in - * the earlier call to Replace. - */ - STDMETHOD(Remove) (THIS_ - IRMAAudioDevice* /*IN*/ pAudioDevice) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDeviceManager::AddFinalHook - * Purpose: - * One last chance to modify data being written to the audio device. - * This hook allows the user to change the audio format that - * is to be written to the audio device. This can be done in call - * to OnInit() in IRMAAudioHook. - */ - STDMETHOD(SetFinalHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDeviceManager::RemoveFinalHook - * Purpose: - * Remove final hook - */ - STDMETHOD(RemoveFinalHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioDeviceManager::GetAudioFormat - * Purpose: - * Returns the audio format in which the audio device is opened. - * This function will fill in the pre-allocated RMAAudioFormat - * structure passed in. - */ - STDMETHOD(GetAudioFormat) (THIS_ - RMAAudioFormat* /*IN/OUT*/pAudioFormat) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioCrossFade - * - * Purpose: - * - * This interface can be used to cross-fade two audio streams. It is exposed - * by IRMAAudioPlayer - * - * IID_IRMAAudioCrossFade: - * - * {0000070B-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioCrossFade, 0x0000070B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioCrossFade - -DECLARE_INTERFACE_(IRMAAudioCrossFade, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioCrossFade methods - */ - - /************************************************************************ - * Method: - * IRMAAudioCrossFade::CrossFade - * Purpose: - * Cross-fade two audio streams. - * pStreamFrom - Stream to be cross faded from - * pStreamTo - Stream to be cross faded to - * ulFromCrossFadeStartTime- "From" Stream time when cross fade is - * to be started - * ulToCrossFadeStartTime - "To" Stream time when cross fade is to - * be started - * ulCrossFadeDuration - Duration over which cross-fade needs - * to be done - * - */ - STDMETHOD(CrossFade) (THIS_ - IRMAAudioStream* pStreamFrom, - IRMAAudioStream* pStreamTo, - UINT32 ulFromCrossFadeStartTime, - UINT32 ulToCrossFadeStartTime, - UINT32 ulCrossFadeDuration) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioStream2 - * - * Purpose: - * - * This interface contains some last-minute added audio stream functions - * - * IID_IRMAAudioStream2: - * - * {0000070C-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioStream2, 0x0000070C, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioStream2 - -DECLARE_INTERFACE_(IRMAAudioStream2, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioStream2 methods - */ - /************************************************************************ - * Method: - * IRMAAudioStream2::RemoveDryNotification - * Purpose: - * Use this to remove itself from the notification response object - * during the stream switching. - */ - STDMETHOD(RemoveDryNotification) (THIS_ - IRMADryNotification* /*IN*/ pNotification - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioStream2::GetAudioFormat - * Purpose: - * Returns the input audio format of the data written by the - * renderer. This function will fill in the pre-allocated - * RMAAudioFormat structure passed in. - */ - STDMETHOD(GetAudioFormat) (THIS_ - RMAAudioFormat* /*IN/OUT*/pAudioFormat) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioPushdown - * - * Purpose: - * - * This interface can be used to setup the audio pushdown time. - * - * IID_IRMAAudioPushdown: - * - * {0000070D-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioPushdown, 0x0000070D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioPushdown - -DECLARE_INTERFACE_(IRMAAudioPushdown, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioPushdown methods - */ - /************************************************************************ - * Method: - * IRMAAudioPushdown::SetAudioPushdown - * Purpose: - * Use this to set the minimum audio pushdown value in ms. - * This is the amount of audio data that is being written - * to the audio device before starting playback. - */ - STDMETHOD(SetAudioPushdown) (THIS_ - UINT32 /*IN*/ ulAudioPushdown - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAudioHookManager - * - * Purpose: - * - * This interface can be used to add a hook at the audio device layer. - * - * IID_IRMAAudioHookManager: - * - * {0000070E-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAudioHookManager, 0x0000070E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAudioHookManager - -DECLARE_INTERFACE_(IRMAAudioHookManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAudioHookManager methods - */ - /************************************************************************ - * Method: - * IRMAAudioHookManager::AddHook - * Purpose: - * Use this to add a hook - */ - STDMETHOD(AddHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook - ) PURE; - - /************************************************************************ - * Method: - * IRMAAudioHookManager::RemoveHook - * Purpose: - * Use this to remove a hook - */ - STDMETHOD(RemoveHook) (THIS_ - IRMAAudioHook* /*IN*/ pHook - ) PURE; -}; - -#endif /* _RMAAUSVC_H_ */ diff --git a/include/realmedia/rmaauth.h b/include/realmedia/rmaauth.h deleted file mode 100644 index 866bf87bf..000000000 --- a/include/realmedia/rmaauth.h +++ /dev/null @@ -1,342 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaauth.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * Authentication and password interfaces. - * - */ - -#ifndef _RMAAUTH_H_ -#define _RMAAUTH_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMAAuthenticator IRMAAuthenticator; -typedef _INTERFACE IRMAAuthenticatorResponse IRMAAuthenticatorResponse; -typedef _INTERFACE IRMAAuthenticatorRequest IRMAAuthenticatorRequest; -typedef _INTERFACE IRMAPassword IRMAPassword; -typedef _INTERFACE IRMAAuthenticationManagerResponse IRMAAuthenticationManagerResponse; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMABuffer IRMABuffer; - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticator - * - * Purpose: - * - * Provide a means of authenticating users. - * - * IID_IRMAAuthenticator: - * - * {00001800-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAAuthenticator, 0x00001800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAAuthenticator IID_IRMAAuthenticator - -#undef INTERFACE -#define INTERFACE IRMAAuthenticator - -DECLARE_INTERFACE_(IRMAAuthenticator, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * InitAuthenticator is called by the creator of the Authenticator - * object in order to pass it an IRMAAuthenticatorRequest object, - * usually implemented by the creator itself. - */ - STDMETHOD(InitAuthenticator) (THIS_ - IRMAAuthenticatorRequest* pRequest) PURE; - /* - * Authenticate is called by a file object (and others??) - * when it wants to ask the creator, presumably an FS Manager, - * for authorization to open it's file. - * - * Authenticate will call IRMAAuthenticateResponse::AuthenticateDone - * when done with PNR_OK or an error. - * - * File objects will presumably perform the Authenticate response as - * part of their Init() call, and not call InitDone until they receive - * a response one way or the other. - */ - STDMETHOD(Authenticate) (THIS_ - IRMAValues* pValues, - IRMAAuthenticatorResponse* pResponse) PURE; - - /* GenerateAuthRequest is called by the creator of this object - * when they want to send an authentication request to someone. - */ - STDMETHOD(GenerateAuthRequest) (THIS_ - UINT32 authType, - REF(IRMAValues*) pValues) PURE; - /* - * AuthValuesReady is called by IRMAAuthenticatorRequest when it - * is ready to respond to a GetAuthValues request. - */ - STDMETHOD(AuthValuesReady) (THIS_ - PN_RESULT result, - IRMAValues* pValues) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticatorResponse - * - * Purpose: - * - * Response object for the Authenticator class. - * - * IID_IRMAAuthenticatorResponse: - * - * {00001801-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAAuthenticatorResponse, 0x00001801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticatorResponse - -DECLARE_INTERFACE_(IRMAAuthenticatorResponse, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* AuthenticateDone is called by an IRMAAuthenticator when it has - * finished it's authorization steps. If the result is PNR_OK, - * then the values contain authorization information as generated by - * IRMAPassword. - */ - STDMETHOD(AuthenticateDone) (THIS_ PN_RESULT result, - IRMAValues* pAuthResponseValues) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticatorRequest - * - * Purpose: - * - * Request object for the Authenticator class. - * - * IID_IRMAAuthenticatorRequest: - * - * {00001802-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAAuthenticatorRequest, 0x00001802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticatorRequest - -DECLARE_INTERFACE_(IRMAAuthenticatorRequest, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* GetAuthValues is called by the Authenticator object when it - * needs to know the authorization info for this transaction. - * - * This object should call AuthValuesReady when ready. - */ - STDMETHOD(GetAuthValues) (THIS_ IRMAValues* pOrigValues) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPassword - * - * Purpose: - * - * Provides a general password facility for storing of passwords in - * an encrypted form and a facility for verifying passwords securely - * over the network. - * - * IID_IRMAPassword: - * - * {00001700-0901-11d1-8B06-00A024406D59} - * - */ - -#define PN_AUTH_BASIC 1 -#define PN_AUTH_DIGEST 2 -#define PN_AUTH_RN5 3 -#define PN_AUTH_NTLM 4 - -DEFINE_GUID(IID_IRMAPassword, 0x00001700, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPassword - -DECLARE_INTERFACE_(IRMAPassword, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPassword methods - */ - - STDMETHOD(Crypt) (THIS_ IRMAValues* pAuthentication) PURE; - STDMETHOD(Verify) (THIS_ IRMAValues* pAuth1, IRMAValues* pAuth2) PURE; - - STDMETHOD(AsString) (THIS_ IRMAValues* pAuth, REF(IRMABuffer*) pBuffer) PURE; - STDMETHOD(AsValues) (THIS_ const char* str, IRMAValues* pValues) PURE; - - /* - * CreateBuffer is provided for the convenince of external users, - * who would otherwise have to get a context and common class factory - * just to create IRMABuffers. This method can be used instead, but - * is not advisable if other means are available. - */ - STDMETHOD(CreateBuffer) (THIS_ REF(IRMABuffer*) pBuffer) PURE; - - /* - * Ditto for CreateValues - */ - STDMETHOD(CreateValues) (THIS_ REF(IRMAValues*) pValues) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticationManager - * - * Purpose: - * - * Provide a means of authenticating users. - * - * IID_IRMAAuthenticator: - * - * {00001a00-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAAuthenticationManager, 0x00001a00, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticationManager - -DECLARE_INTERFACE_(IRMAAuthenticationManager, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* HandleAuthenticationRequest is called when the core wants us to get - * a username and password. - */ - STDMETHOD(HandleAuthenticationRequest) ( - THIS_ IRMAAuthenticationManagerResponse* pResponse) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticationManagerResponse - * - * Purpose: - * - * Response object for IRMAAuthenticationManager. - * - * IID_IRMAAuthenticator: - * - * {00001a01-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAAuthenticationManagerResponse, 0x00001a01, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAAuthenticationManagerResponse - -DECLARE_INTERFACE_(IRMAAuthenticationManagerResponse, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* HandleAuthenticationRequest is called when the core wants us to get - * a username and password. - */ - STDMETHOD(AuthenticationRequestDone) (THIS_ - PN_RESULT result, - const char* pUserName, - const char* pPassword) PURE; -}; - -#ifdef _MACINTOSH -#pragma export on -#endif - -STDAPI CreatePassword(IUnknown** /* OUT */ ppIUnknown); - -#ifdef _MACINTOSH -#pragma export off -#endif - -#endif /* _RMAAUTH_H_ */ diff --git a/include/realmedia/rmaauthn.h b/include/realmedia/rmaauthn.h deleted file mode 100644 index 4f2e39b7f..000000000 --- a/include/realmedia/rmaauthn.h +++ /dev/null @@ -1,716 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaauthn.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Interface. - * - */ - -#ifndef _RMAAUTHN_H_ -#define _RMAAUTHN_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMACredRequest IRMACredRequest; -typedef _INTERFACE IRMACredRequestResponse IRMACredRequestResponse; -typedef _INTERFACE IRMAClientAuthConversation IRMAClientAuthConversation; -typedef _INTERFACE IRMAClientAuthResponse IRMAClientAuthResponse; -typedef _INTERFACE IRMAServerAuthConversation IRMAServerAuthConversation; -typedef _INTERFACE IRMAServerAuthResponse IRMAServerAuthResponse; -typedef _INTERFACE IRMAUserContext IRMAUserContext; -typedef _INTERFACE IRMAUserProperties IRMAUserProperties; -typedef _INTERFACE IRMAUserImpersonation IRMAUserImpersonation; -typedef _INTERFACE IRMAChallenge IRMAChallenge; -typedef _INTERFACE IRMAChallengeResponse IRMAChallengeResponse; -typedef _INTERFACE IRMARequest IRMARequest; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAValues IRMAValues; - - -/**************************************************************************** - * - * Interface: - * - * IRMACredRequest - * - * Purpose: - * - * This is queried from the response interface passed into - * IRMAClientAuthConversation::MakeResponse. MakeResponse - * uses it to request the current user to enter their credentials. - * - * IRMACredRequest: - * - * {00002801-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMACredRequest, 0x00002801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMACredRequest - -DECLARE_INTERFACE_(IRMACredRequest, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMACredRequest::GetCredentials - * Purpose: - * - * Call this to request the credentials. Usually presents UI to - * the user asking for username and password. - * - * While ignored at this time, pValuesCredentialRequest should - * contain CString properties that describe the reason for the - * request. (like the URL, the Realm, the Auth protocol, and how - * secure it is, etc..) In the future this data will be displayed - * to the user. - * - */ - STDMETHOD(GetCredentials) - ( - THIS_ - IRMACredRequestResponse* pCredRequestResponseRequester, - IRMAValues* pValuesCredentialRequest - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMACredRequestResponse - * - * Purpose: - * - * This is implemented by a client authenticator in order to receive - * the credentials requested in IRMACredRequest::GetCredentials - * - * IRMACredRequestResponse: - * - * {00002800-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMACredRequestResponse, 0x00002800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMACredRequestResponse - -DECLARE_INTERFACE_(IRMACredRequestResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMACredRequestResponse::CredentialsReady - * Purpose: - * - * Reports the success or failure of - * IRMACredRequest::GetCredentials - * - * If successful pValuesCredentials contains the requested - * credentials. (usually CString:Username and CString:Password) - * - */ - STDMETHOD(CredentialsReady) - ( - THIS_ - PN_RESULT ResultStatus, - IRMAValues* pValuesCredentials - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAClientAuthConversation - * - * Purpose: - * - * This is implemented by a client authenticator in order to perform - * the client side of an authentication protocol. - * - * IRMAClientAuthConversation: - * - * {00002803-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAClientAuthConversation, 0x00002803, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_CRMAClientAuthenticator IID_IRMAClientAuthConversation - -#undef INTERFACE -#define INTERFACE IRMAClientAuthConversation - -DECLARE_INTERFACE_(IRMAClientAuthConversation, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAuthConversation::MakeResponse - * Purpose: - * - * Call this when a challenge is received from the server. - * - * pRequestChallengeHeaders should contain the server challenge. - * - */ - STDMETHOD(MakeResponse) - ( - THIS_ - IRMAClientAuthResponse* pClientAuthResponseRequester, - IRMARequest* pRequestChallengeHeaders - ) PURE; - - /************************************************************************ - * Method: - * IRMAClientAuthConversation::IsDone - * Purpose: - * - * Call this to determine whether the conversation is complete. - * (some protocols have more then one message exchange.) - * - */ - STDMETHOD_(BOOL,IsDone)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAuthConversation::Authenticated - * Purpose: - * - * Call this to signal the authenticator that the conversation - * just completed succeeded or failed. - * - */ - STDMETHOD(Authenticated)(THIS_ BOOL bAuthenticated) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAClientAuthResponse - * - * Purpose: - * - * This is implemented by the client core in order to receive the - * response generated by IRMAClientAuthConversation::MakeResponse - * - * IRMAClientAuthResponse: - * - * {00002802-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAClientAuthResponse, 0x00002802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAClientAuthResponse - -DECLARE_INTERFACE_(IRMAClientAuthResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAuthResponse::ResponseReady - * Purpose: - * - * Reports the success or failure of - * IRMAClientAuthConversation::MakeResponse - * - * pRequestResponseHeaders should be the same Request object - * that was passed into MakeResponse, it should contain - * CString values for each MimeHeader it wishes to send to - * the Server. - * - */ - STDMETHOD(ResponseReady) - ( - THIS_ - PN_RESULT ResultStatus, - IRMARequest* pRequestResponseHeaders - ) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAServerAuthConversation - * - * Purpose: - * - * This is implemented by a server authenticator in order to perform - * the server side of an authentication protocol. - * - * IRMAServerAuthConversation: - * - * {00002805-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAServerAuthConversation, 0x00002805, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_CRMAServerAuthenticator IID_IRMAServerAuthResponse - -#undef INTERFACE -#define INTERFACE IRMAServerAuthConversation - -DECLARE_INTERFACE_(IRMAServerAuthConversation, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAServerAuthConversation::MakeChallenge - * Purpose: - * - * Call this to create a challenge for a client. If the request - * passed in does not contain a respose from the client, then it - * will generate the initial challenge. - * - * pRequestResponseHeaders is the request for a secured URL. If - * this is the initial request for the URL it probably does not - * have any credentials from the client. - * - */ - STDMETHOD(MakeChallenge) - ( - THIS_ - IRMAServerAuthResponse* pServerAuthResponseRequester, - IRMARequest* pRequestResponseHeaders - ) PURE; - - /************************************************************************ - * Method: - * IRMAServerAuthConversation::IsAuthenticated - * Purpose: - * - * Call this to determine whether the last response from the - * client completed the authentication successfully. - * - */ - STDMETHOD_(BOOL,IsAuthenticated)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAServerAuthConversation::GetUserContext - * Purpose: - * - * Call this to retrieve the Context of the user that completed - * authentication successfully. - * - * If successful pUnknownUser is a valid context - * - */ - STDMETHOD(GetUserContext)(THIS_ REF(IUnknown*) pUnknownUser) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAServerAuthResponse - * - * Purpose: - * - * This is implemented by various server plugins in order to receive the - * challenge generated by IRMAServerAuthConversation::MakeChallenge - * - * IRMAServerAuthResponse: - * - * {00002804-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAServerAuthResponse, 0x00002804, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAServerAuthResponse - -DECLARE_INTERFACE_(IRMAServerAuthResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAServerAuthResponse::ChallengeReady - * Purpose: - * - * Reports the success or failure of - * IRMAServerAuthConversation::MakeChallenge - * - * pRequestChallengeHeaders should be the same Request object - * that was passed into MakeChallenge, it should contain - * CString values for each MimeHeader it wishes to send to - * the client. - * - */ - STDMETHOD(ChallengeReady) - ( - THIS_ - PN_RESULT ResultStatus, - IRMARequest* pRequestChallengeHeaders - ) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUserContext - * - * Purpose: - * - * This is implemented by a user context in order to provide - * access to information about the currently authenticated user. - * - * IRMAUserContext: - * - * {00002806-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAUserContext, 0x00002806, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUserContext - -DECLARE_INTERFACE_(IRMAUserContext, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAUserContext::IsMemberOf - * Purpose: - * - * Call this to determine whether the authenticated user - * is a member of the specified group. - * - */ - STDMETHOD(IsMemberOf)(THIS_ IRMABuffer* pBufferGroupID) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUserProperties - * - * Purpose: - * - * This is implemented by a user context in order to provide - * access to properties of the currently authenticated user. - * - * IRMAUserProperties: - * - * {00002807-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAUserProperties, 0x00002807, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUserProperties - -DECLARE_INTERFACE_(IRMAUserProperties, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /************************************************************************ - * Method: - * IRMAUserProperties::GetPrincipalID - * Purpose: - * - * Call this to determine the principalID of the authenticated user. - * - */ - STDMETHOD(GetPrincipalID)(THIS_ REF(IRMABuffer*) pBufferPrincipalID) PURE; - - /************************************************************************ - * Method: - * IRMAUserProperties::GetAuthorityName - * Purpose: - * - * Call this to determine the authority name that authorized the - * authenticated user. (realm or domain name) - * - */ - STDMETHOD(GetAuthorityName)(THIS_ REF(IRMABuffer*) pBufferAuthorityName) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUserImpersonation - * - * Purpose: - * - * This can be implemented by a user context in order to provide - * the ability to have the server impersonate the currently authenticated - * user. - * - * IRMAUserImpersonation: - * - * {00002808-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAUserImpersonation, 0x00002808, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUserImpersonation - -DECLARE_INTERFACE_(IRMAUserImpersonation, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAUserImpersonation::Start - * Purpose: - * - * Call this to impersonate the authenticated user. - * - */ - STDMETHOD(Start)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAUserImpersonation::Stop - * Purpose: - * - * Call this to stop impersonating the authenticated user. - * - */ - STDMETHOD(Stop)(THIS) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAChallenge - * - * Purpose: - * - * This is implemented by the server core in order to allow - * additional exchanges of information with the client without - * creating a new request. (It is stored in the IRMARequest object - * and can be retrieved by calling IRMARequestContext::GetRequester() - * if it is absent then the protocol that this request was made on - * does not support multi-message authentication (PNA doesn't) ) - * - * IRMAChallenge: - * - * {0000280A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAChallenge, 0x0000280A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAChallenge - -DECLARE_INTERFACE_(IRMAChallenge, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAChallenge::SendChallenge - * Purpose: - * - * Call this to request additional information from the client. - * - * pRequestChallenge should be the same Request object - * that was passed into MakeChallenge, it should contain - * CString values for each MimeHeader it wishes to send to - * the client. - * - */ - STDMETHOD(SendChallenge) - ( - THIS_ - IRMAChallengeResponse* pChallengeResponseSender, - IRMARequest* pRequestChallenge - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAChallengeResponse - * - * Purpose: - * - * This is implemented by a server authenticator in order to - * receive the Response returned by the client in response to - * IRMAChallenge::SendChallenge. - * - * IRMAChallengeResponse: - * - * {00002809-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAChallengeResponse, 0x00002809, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAChallengeResponse - -DECLARE_INTERFACE_(IRMAChallengeResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAChallengeResponse::ResponseReady - * Purpose: - * - * Called this to return the additional information requested - * from IRMAChallenge::SendChallenge. - * - * pRequestResponse should be the same Request object - * that was passed into MakeChallenge and SendChallenge. - * - */ - STDMETHOD(ResponseReady) - ( - THIS_ - IRMARequest* pRequestResponse - ) PURE; - -}; - -#endif //!_RMAAUTHN_H_ diff --git a/include/realmedia/rmacfg.h b/include/realmedia/rmacfg.h deleted file mode 100644 index d2fdde3ee..000000000 --- a/include/realmedia/rmacfg.h +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** - * - * $Id: rmacfg.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * Server Configuration File Interface - * - */ - -#ifndef _RMACFG_H_ -#define _RMACFG_H_ - -typedef _INTERFACE IRMABuffer IRMABuffer; - -/**************************************************************************** - * - * Interface: - * - * IRMAConfigFile - * - * Purpose: - * - * IID_IRMAConfigFile: - * - * {00001c00-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAConfigFile, 0x00001c00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAConfigFile - -DECLARE_INTERFACE_(IRMAConfigFile, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAConfigFile methods - */ - /************************************************************************ - * Method: - * IRMAConfigFile::LoadFrom - * Purpose: - * - * LoadFrom tells the server to load the config file specified, - * and sets that file as the default for future Reloads and Saves - */ - STDMETHOD(LoadFrom) (THIS_ - IRMABuffer* filename) PURE; - - /************************************************************************ - * Method: - * IRMAConfigFile::Reload - * Purpose: - * - * Reload causes the current default config file to be reloaded. - */ - STDMETHOD(Reload) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAConfigFile::Save - * Purpose: - * - * Save causes the current configuration to be written to the - * current default file. - */ - STDMETHOD(Save) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAConfigFile::SaveAs - * Purpose: - * - * SaveAs writes the configuration to the named file, and sets that - * file as the default. - */ - STDMETHOD(SaveAs) (THIS_ - IRMABuffer* pFilename) PURE; - - /************************************************************************ - * Method: - * IRMAConfigFile::GetFilename - * Purpose: - * - * GetFilename returns the current default file - */ - STDMETHOD(GetFilename) (THIS_ - REF(IRMABuffer*) pFilename) PURE; - - /************************************************************************ - * Method: - * IRMAConfigFile::SetFilename - * Purpose: - * - * SetFilename sets the current default file, but does not read it - * or change its contents. - */ - STDMETHOD(SetFilename) (THIS_ - IRMABuffer* pFilename) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMARegConfig - * - * Purpose: - * - * IID_IRMARegConfig: - * - * {00001c01-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARegConfig, 0x00001c01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARegConfig - -DECLARE_INTERFACE_(IRMARegConfig, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMARegConfig::WriteKey - * Purpose: - * - * Write out the registry from the passed in keyname to the - * currently active permanent config storage area (ex. config file, - * registry). - */ - STDMETHOD(WriteKey) (THIS_ - const char* pKeyName) PURE; - -}; - -#endif /* _RMACFG_H_ */ diff --git a/include/realmedia/rmaclsnk.h b/include/realmedia/rmaclsnk.h deleted file mode 100644 index ac66fe0b4..000000000 --- a/include/realmedia/rmaclsnk.h +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaclsnk.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Client Advise Sink Interfaces - * - */ - -#ifndef _RMACLSNK_H_ -#define _RMACLSNK_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMAClientAdviseSink IRMAClientAdviseSink; - -/**************************************************************************** - * - * Interface: - * - * IRMAClientAdviseSink - * - * Purpose: - * - * Interface supplied by client to core to receive notifications of - * status changes. - * - * IID_IRMAClientAdviseSink: - * - * {00000B00-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAClientAdviseSink, 0x00000B00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAClientAdviseSink - -DECLARE_INTERFACE_(IRMAClientAdviseSink, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAClientAdviseSink methods - */ - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnPosLength - * Purpose: - * Called to advise the client that the position or length of the - * current playback context has changed. - */ - STDMETHOD(OnPosLength) (THIS_ - UINT32 ulPosition, - UINT32 ulLength) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnPresentationOpened - * Purpose: - * Called to advise the client a presentation has been opened. - */ - STDMETHOD(OnPresentationOpened) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnPresentationClosed - * Purpose: - * Called to advise the client a presentation has been closed. - */ - STDMETHOD(OnPresentationClosed) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnStatisticsChanged - * Purpose: - * Called to advise the client that the presentation statistics - * have changed. - */ - STDMETHOD(OnStatisticsChanged) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnPreSeek - * Purpose: - * Called by client engine to inform the client that a seek is - * about to occur. The render is informed the last time for the - * stream's time line before the seek, as well as the first new - * time for the stream's time line after the seek will be completed. - * - */ - STDMETHOD(OnPreSeek) (THIS_ - ULONG32 ulOldTime, - ULONG32 ulNewTime) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnPostSeek - * Purpose: - * Called by client engine to inform the client that a seek has - * just occurred. The render is informed the last time for the - * stream's time line before the seek, as well as the first new - * time for the stream's time line after the seek. - * - */ - STDMETHOD(OnPostSeek) (THIS_ - ULONG32 ulOldTime, - ULONG32 ulNewTime) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnStop - * Purpose: - * Called by client engine to inform the client that a stop has - * just occurred. - * - */ - STDMETHOD(OnStop) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnPause - * Purpose: - * Called by client engine to inform the client that a pause has - * just occurred. The render is informed the last time for the - * stream's time line before the pause. - * - */ - STDMETHOD(OnPause) (THIS_ - ULONG32 ulTime) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnBegin - * Purpose: - * Called by client engine to inform the client that a begin or - * resume has just occurred. The render is informed the first time - * for the stream's time line after the resume. - * - */ - STDMETHOD(OnBegin) (THIS_ - ULONG32 ulTime) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnBuffering - * Purpose: - * Called by client engine to inform the client that buffering - * of data is occuring. The render is informed of the reason for - * the buffering (start-up of stream, seek has occurred, network - * congestion, etc.), as well as percentage complete of the - * buffering process. - * - */ - STDMETHOD(OnBuffering) (THIS_ - ULONG32 ulFlags, - UINT16 unPercentComplete) PURE; - - /************************************************************************ - * Method: - * IRMAClientAdviseSink::OnContacting - * Purpose: - * Called by client engine to inform the client is contacting - * hosts(s). - * - */ - STDMETHOD(OnContacting) (THIS_ - const char* pHostName) PURE; -}; - -#endif /* _RMACLSNK_H_ */ diff --git a/include/realmedia/rmacmenu.h b/include/realmedia/rmacmenu.h deleted file mode 100644 index 4491282cd..000000000 --- a/include/realmedia/rmacmenu.h +++ /dev/null @@ -1,215 +0,0 @@ -/**************************************************************************** - * - * $Id: rmacmenu.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary information of RealNetworks, Inc, - * and is licensed subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Context Menu Interfaces. - * - */ - -#ifndef _RMACMENU_H_ -#define _RMACMENU_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMAContextMenu IRMAContextMenu; -typedef _INTERFACE IRMAContextMenuResponse IRMAContextMenuResponse; - - -/**************************************************************************** - * - * Interface: - * - * IRMAContextMenu - * - * Purpose: - * - * Interface implemented by top level clients and provided to renderers. - * Allows the renderer to show a context menu and the top level client - * to add client specitic commands unknown to the renderer to that menu. - * - * IID_IRMAContextMenu: - * - * {00001f00-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAContextMenu, 0x00001f00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAContextMenu - -DECLARE_INTERFACE_(IRMAContextMenu, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAContextMenu methods - */ - - /************************************************************************ - * Method: - * IRMAContextMenu::InitContextMenu - * Purpose: - * Initializes the context menu to a blank menu, and sets the name - * of the "sub menu" for the renderer if appropriate. This will - * clear any previously added menu items and sub menus. - */ - STDMETHOD(InitContextMenu) (THIS_ - const char* pMenuText - ) PURE; - - /************************************************************************ - * Method: - * IRMAContextMenu::AddMenuItem - * Purpose: - * Returns information vital to the instantiation of rendering - * plugins. - */ - STDMETHOD(AddMenuItem) (THIS_ - UINT16 commandID, - const char* pMenuItemText, - BOOL bChecked, - BOOL bRadioOn, - BOOL bDisabled - ) PURE; - - /************************************************************************ - * Method: - * IRMAContextMenu::AddMenuItem - * Purpose: - * Returns information vital to the instantiation of rendering - * plugins. - */ - STDMETHOD(AddSeparator) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAContextMenu::AddChildMenu - * Purpose: - * Returns information vital to the instantiation of rendering - * plugins. - */ - STDMETHOD(AddChildMenu) (THIS_ - const char* pMenuText - ) PURE; - - /************************************************************************ - * Method: - * IRMAContextMenu::EndChildMenu - * Purpose: - * Returns information vital to the instantiation of rendering - * plugins. - */ - STDMETHOD(EndChildMenu) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAContextMenu::ChangeMenuItem - * Purpose: - * Returns information vital to the instantiation of rendering - * plugins. - */ - STDMETHOD(ChangeMenuItem) (THIS_ - UINT16 commandID, - const char* pMenuItemText, - BOOL bChecked, - BOOL bRadioOn, - BOOL bDisabled - ) PURE; - - /************************************************************************ - * Method: - * IRMAContextMenu::ShowMenu - * Purpose: - * Shows the setup context menu at the specified point. - */ - STDMETHOD(ShowMenu) (THIS_ - IRMAContextMenuResponse* pResonse, - PNxPoint ptPopup - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAContextMenuResponse - * - * Purpose: - * - * Interface implemented by renderers that use the context menut. - * Is called to inform the renderer that a particular menu item was - * chosen. - * - * IRMAContextMenuResponse: - * - * {00001f01-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAContextMenuResponse, 0x00001f01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAContextMenuResponse - -DECLARE_INTERFACE_(IRMAContextMenuResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAContextMenuResponse methods - */ - - /************************************************************************ - * Method: - * IRMAContextMenuResponse::OnCommand - * Purpose: - * Called to inform the renderer that a command was chosen from - * the context menu. - */ - STDMETHOD(OnCommand) (THIS_ - UINT16 commandID - ) PURE; - - - /************************************************************************ - * Method: - * IRMAContextMenuResponse::OnCanceled - * Purpose: - * Called to inform the renderer that the context menu was closed - * without a command being chosen from the renders set of commands. - */ - STDMETHOD(OnCanceled) (THIS) PURE; - -}; - -#endif /* _RMACMENU_H_ */ diff --git a/include/realmedia/rmacomm.h b/include/realmedia/rmacomm.h deleted file mode 100644 index c9f2ed120..000000000 --- a/include/realmedia/rmacomm.h +++ /dev/null @@ -1,568 +0,0 @@ -/**************************************************************************** - * - * $Id: rmacomm.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Common Utility interfaces - * - */ - -#ifndef _RMACOMM_H_ -#define _RMACOMM_H_ - -#include "rmaengin.h" // For RMATimeval - -/* - * Forward declarations of some interfaces defined here-in. - */ - -typedef _INTERFACE IRMACommonClassFactory IRMACommonClassFactory; -typedef _INTERFACE IRMAStatistics IRMAStatistics; -typedef _INTERFACE IRMARegistryID IRMARegistryID; -typedef _INTERFACE IRMAServerFork IRMAServerFork; -typedef _INTERFACE IRMAServerControl IRMAServerControl; -typedef _INTERFACE IRMAReconfigServerResponse IRMAReconfigServerResponse; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAWantServerReconfigNotification - IRMAWantServerReconfigNotification; -typedef _INTERFACE IRMAFastAlloc IRMAFastAlloc; - - - -/**************************************************************************** - * - * Interface: - * - * IRMACommonClassFactory - * - * Purpose: - * - * RMA interface that manages the creation of common RMA classes. - * - * IID_IRMACommonClassFactory: - * - * {00000000-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMACommonClassFactory, 0x00000000, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMACommonClassFactory - -DECLARE_INTERFACE_(IRMACommonClassFactory, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMACommonClassFactory methods - */ - - /************************************************************************ - * Method: - * IRMACommonClassFactory::CreateInstance - * Purpose: - * Creates instances of common objects supported by the system, - * like IRMABuffer, IRMAPacket, IRMAValues, etc. - * - * This method is similar to Window's CoCreateInstance() in its - * purpose, except that it only creates objects of a well known - * types. - * - * NOTE: Aggregation is never used. Therefore and outer unknown is - * not passed to this function, and you do not need to code for this - * situation. - */ - STDMETHOD(CreateInstance) (THIS_ - REFCLSID /*IN*/ rclsid, - void** /*OUT*/ ppUnknown) PURE; - - /************************************************************************ - * Method: - * IRMAController::CreateInstanceAggregatable - * Purpose: - * Creates instances of common objects that can be aggregated - * supported by the system, like IRMASiteWindowed - * - * This method is similar to Window's CoCreateInstance() in its - * purpose, except that it only creates objects of a well known - * types. - * - * NOTE 1: Unlike CreateInstance, this method will create internal - * objects that support Aggregation. - * - * NOTE 2: The output interface is always the non-delegating - * IUnknown. - */ - STDMETHOD(CreateInstanceAggregatable) - (THIS_ - REFCLSID /*IN*/ rclsid, - REF(IUnknown*) /*OUT*/ ppUnknown, - IUnknown* /*IN*/ pUnkOuter) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAStatistics - * - * Purpose: - * - * This interface allows update of the client statistics. - * - * IID_IRMAStatistics: - * - * {00000001-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAStatistics, 0x00000001, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAStatistics - -DECLARE_INTERFACE_(IRMAStatistics, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAStatistics methods - */ - - /************************************************************************ - * Method: - * IRMAStatistics::Init - * Purpose: - * Pass registry ID to the caller - * - */ - STDMETHOD(InitializeStatistics) (THIS_ - UINT32 /*IN*/ ulRegistryID) PURE; - - /************************************************************************ - * Method: - * IRMAStatistics::Update - * Purpose: - * Notify the client to update its statistics stored in the registry - * - */ - STDMETHOD(UpdateStatistics) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMARegistryID - * - * Purpose: - * - * This interface is implemented by IRMAPlayer, IRMAStreamSource, - * and IRMAStream. It allows the user to get the registry Base ID, - * for an object that you have a pointer to. - * - * IID_IRMARegistryID: - * - * {00000002-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARegistryID, 0x00000002, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARegistryID - -DECLARE_INTERFACE_(IRMARegistryID, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMARegistryID methods - */ - - /************************************************************************ - * Method: - * IRMARegistryID::GetID - * Purpose: - * Get the registry ID of the object. - * - */ - STDMETHOD(GetID) (THIS_ - REF(UINT32) /*OUT*/ ulRegistryID) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAServerFork - * - * Purpose: - * - * This interface is implemented by the server context on Unix - * platforms. This interface allows your plugin to fork off a - * process. Note that the process that is forked off cannot use - * any RMA APIs. The fork() system call is prohibited from within - * a RMA plugin. - * - * IID_IRMAServerFork: - * - * {00000003-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAServerFork, 0x00000003, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAServerFork - -DECLARE_INTERFACE_(IRMAServerFork, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAServerFork methods - */ - - /************************************************************************ - * Method: - * IRMAServerFork::Fork - * Purpose: - * Fork off a child process. The child process cannot use any RMA - * APIs. Upon successful completion, Fork returns 0 to the child - * process and the PID of the child to the parent. A return value - * of -1 indicates an error. - * - * Note: The child process should *NOT* Release any interfaces. - * The cleanup of the IRMAServerFork() interface and other - * RMA interfaces is done by the parent. - * - */ - STDMETHOD_(INT32, Fork) (THIS) PURE; -}; - -/* - * - * Interface: - * - * IRMAServerControl - * - * Purpose: - * - * This inteface provides access to the RealMedia server's controls - * for shutting down (for now). - * - * Note: This registry is not related to the Windows system registry. - * - * IID_IRMAServerControl: - * - * {00000004-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAServerControl, 0x00000004, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAServerControl IID_IRMAServerControl - -#undef INTERFACE -#define INTERFACE IRMAServerControl - -DECLARE_INTERFACE_(IRMAServerControl, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAServerControl methods - */ - - /************************************************************************ - * Method: - * IRMAServerControl::ShutdownServer - * Purpose: - * Shutdown the server. - */ - STDMETHOD(ShutdownServer) (THIS_ - UINT32 status) PURE; -}; - -/* - * - * Interface: - * - * IRMAServerControl2 - * - * Purpose: - * - * Interface for extended server control methods. - * - * - * IID_IRMAServerControl2: - * - * {00000005-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAServerControl2, 0x00000005, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAServerControl2 - -DECLARE_INTERFACE_(IRMAServerControl2, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAServerControl2 methods - */ - - /************************************************************************ - * IRMAServerControl2::RestartServer - * - * Purpose: - * - * Completely shutdown the server, then restart. Mainly used to - * cause not hot setting config var changes to take effect. - */ - STDMETHOD(RestartServer) (THIS) PURE; - - /************************************************************************ - * IRMAServerControl2::ReconfigServer - * - * Purpose: - * - * Used to cause the server to re-read in config from file or registry - * (however it was started) and attempt to use the values. - */ - STDMETHOD(ReconfigServer) (THIS_ IRMAReconfigServerResponse* pResp) PURE; - -}; - -/* - * - * Interface: - * - * IRMAReconfigServerResponse - * - * Purpose: - * - * Response interface for IRMAServerControl2::ReconfigServer - * - * - * IID_IRMAReconfigServerResponse: - * - * {00000006-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAReconfigServerResponse, 0x00000006, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAReconfigServerResponse - -DECLARE_INTERFACE_(IRMAReconfigServerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAReconfigServerResponse::ReconfigServerDone - * - * Purpose: - * - * Notification that reconfiguring the server is done. - */ - STDMETHOD(ReconfigServerDone) (THIS_ - PN_RESULT res, - IRMABuffer** pInfo, - UINT32 ulNumInfo) PURE; -}; - -/* - * - * Interface: - * - * IRMAServerReconfigNotification - * - * Purpose: - * - * Register with the server that you want notification when a reconfig - * request comes in and want/need to take part in the reconfiguration. This - * is used when you have configuration info outside the server config file - * which needs to be re-initialized. - * - * - * IID_IRMAServerReconfigNotification: - * - * {00000007-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAServerReconfigNotification, 0x00000007, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAServerReconfigNotification - -DECLARE_INTERFACE_(IRMAServerReconfigNotification, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAServerReconfigNotification::WantReconfigNotification - * - * Purpose: - * - * Tell the server that you want reconfig notification. - */ - STDMETHOD(WantReconfigNotification) (THIS_ - IRMAWantServerReconfigNotification* pResponse) PURE; - - /************************************************************************ - * IRMAServerReconfigNotification::CancelReconfigNotification - * - * Purpose: - * - * Tell the server that you no longer want reconfig notification. - */ - STDMETHOD(CancelReconfigNotification) (THIS_ - IRMAWantServerReconfigNotification* pResponse) PURE; - -}; - -/* - * - * Interface: - * - * IRMAWantServerReconfigNotification - * - * Purpose: - * - * Tell user that the server got a reconfig request and it is time to - * do your reconfiguration. NOTE: You should not need this if all of your - * configuration is stored in the config file; that is taken care of through - * IRMAActiveRegistry. - * - * IID_IRMAWantServerReconfigNotification: - * - * {00000008-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAWantServerReconfigNotification, 0x00000008, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAWantServerReconfigNotification - -DECLARE_INTERFACE_(IRMAWantServerReconfigNotification, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAWantServerReconfigNotification::ServerReconfig - * - * Purpose: - * - * Notify user that a server reconfig request had come in and it - * is now your turn to do external (not server config) reconfiguration.* - */ - STDMETHOD(ServerReconfig) (THIS_ - IRMAReconfigServerResponse* pResponse) PURE; - -}; - - -#endif /*_RMACOMM_H_*/ diff --git a/include/realmedia/rmacore.h b/include/realmedia/rmacore.h deleted file mode 100644 index 8461dafba..000000000 --- a/include/realmedia/rmacore.h +++ /dev/null @@ -1,844 +0,0 @@ -/**************************************************************************** - * - * $Id: rmacore.h 74 2003-07-02 02:42:47Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Client Core interfaces - * - */ - -#ifndef _RMACORE_H_ -#define _RMACORE_H_ - - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAStream IRMAStream; -typedef _INTERFACE IRMAStreamSource IRMAStreamSource; -typedef _INTERFACE IRMAPlayer IRMAPlayer; -typedef _INTERFACE IRMAClientEngine IRMAClientEngine; -typedef _INTERFACE IRMAScheduler IRMAScheduler; -typedef _INTERFACE IRMAClientAdviseSink IRMAClientAdviseSink; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMARenderer IRMARenderer; -typedef _INTERFACE IRMAPlayer2 IRMAPlayer2; -typedef _INTERFACE IRMARequest IRMArequest; - -typedef struct _PNxEvent PNxEvent; - - -#ifdef _MACINTOSH -#pragma export on -#endif - -#if defined _UNIX && !(defined _VXWORKS) -/* Includes needed for select() stuff */ -#include -#include -#include -#endif - -#ifdef _BEOS // fd_set stuff -#include -#endif - -/* Used in renderer and advise sink interface */ -enum BUFFERING_REASON -{ - BUFFERING_START_UP = 0, - BUFFERING_SEEK, - BUFFERING_CONGESTION, - BUFFERING_LIVE_PAUSE -}; - -/**************************************************************************** - * - * Function: - * - * CreateEngine() - * - * Purpose: - * - * Function implemented by the RMA core to return a pointer to the - * client engine. This function would be run by top level clients. - */ -STDAPI CreateEngine - ( - IRMAClientEngine** /*OUT*/ ppEngine - ); - -/**************************************************************************** - * - * Function: - * - * CloseEngine() - * - * Purpose: - * - * Function implemented by the RMA core to close the engine which - * was returned in CreateEngine(). - */ -STDAPI CloseEngine - ( - IRMAClientEngine* /*IN*/ pEngine - ); - -#ifdef _MACINTOSH -#pragma export off -#endif - -/* - * Definitions of Function Pointers to CreateEngine() and Close Engine(). - * These types are provided as a convenince to authors of top level clients. - */ -typedef PN_RESULT (PNEXPORT_PTR FPRMCREATEENGINE)(IRMAClientEngine** ppEngine); -typedef PN_RESULT (PNEXPORT_PTR FPRMCLOSEENGINE) (IRMAClientEngine* pEngine); -typedef PN_RESULT (PNEXPORT_PTR FPRMSETDLLACCESSPATH) (const char*); - -/**************************************************************************** - * - * Interface: - * - * IRMAStream - * - * Purpose: - * - * Interface provided by the client engine to the renderers. This - * interface allows access to stream related information and properties. - * - * IID_IRMAStream: - * - * {00000400-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAStream, 0x00000400, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAStream - -DECLARE_INTERFACE_(IRMAStream, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAStream methods - */ - - /************************************************************************ - * Method: - * IRMAStream::GetSource - * Purpose: - * Get the interface to the source object of which the stream is - * a part of. - * - */ - STDMETHOD(GetSource) (THIS_ - REF(IRMAStreamSource*) pSource) PURE; - - /************************************************************************ - * Method: - * IRMAStream::GetStreamNumber - * Purpose: - * Get the stream number for this stream relative to the source - * object of which the stream is a part of. - * - */ - STDMETHOD_(UINT16,GetStreamNumber) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStream::GetStreamType - * Purpose: - * Get the MIME type for this stream. NOTE: The returned string is - * assumed to be valid for the life of the IRMAStream from which it - * was returned. - * - */ - STDMETHOD_(const char*,GetStreamType) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStream::GetHeader - * Purpose: - * Get the header for this stream. - * - */ - STDMETHOD_(IRMAValues*,GetHeader) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStream::ReportQualityOfService - * Purpose: - * Call this method to report to the playback context that the - * quality of service for this stream has changed. The unQuality - * should be on a scale of 0 to 100, where 100 is the best possible - * quality for this stream. Although the transport engine can - * determine lost packets and report these through the user - * interface, only the renderer of this stream can determine the - * "real" perceived damage associated with this loss. - * - * NOTE: The playback context may use this value to indicate loss - * in quality to the user interface. When the effects of a lost - * packet are eliminated the renderer should call this method with - * a unQuality of 100. - * - */ - STDMETHOD(ReportQualityOfService) (THIS_ - UINT8 unQuality) PURE; - - /************************************************************************ - * Method: - * IRMAStream::ReportRebufferStatus - * Purpose: - * Call this method to report to the playback context that the - * available data has dropped to a critically low level, and that - * rebuffering should occur. The renderer should call back into this - * interface as it receives additional data packets to indicate the - * status of its rebuffering effort. - * - * NOTE: The values of unNeeded and unAvailable are used to indicate - * the general status of the rebuffering effort. For example, if a - * renderer has "run dry" and needs 5 data packets to play smoothly - * again, it should call ReportRebufferStatus() with 5,0 then as - * packet arrive it should call again with 5,1; 5,2... and eventually - * 5,5. - * - */ - STDMETHOD(ReportRebufferStatus) (THIS_ - UINT8 unNeeded, - UINT8 unAvailable) PURE; - - /************************************************************************ - * Method: - * IRMAStream::SetGranularity - * Purpose: - * Sets the desired Granularity for this stream. The actual - * granularity will be the lowest granularity of all streams. - * Valid to call before stream actually begins. Best to call during - * IRMARenderer::OnHeader(). - */ - STDMETHOD(SetGranularity) (THIS_ - ULONG32 ulGranularity) PURE; - - /************************************************************************ - * Method: - * IRMAStream::GetRendererCount - * Purpose: - * Returns the current number of renderer instances supported by - * this stream instance. - */ - STDMETHOD_(UINT16, GetRendererCount)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStream::GetRenderer - * Purpose: - * Returns the Nth renderer instance supported by this stream. - */ - STDMETHOD(GetRenderer) (THIS_ - UINT16 nIndex, - REF(IUnknown*) pUnknown) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAStreamSource - * - * Purpose: - * - * Interface provided by the client engine to the renderers. This - * interface allows access to source related information and properties. - * - * IID_IRMAStreamSource: - * - * {00000401-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAStreamSource, 0x00000401, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAStreamSource - -DECLARE_INTERFACE_(IRMAStreamSource, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAStreamSource methods - */ - - /************************************************************************ - * Method: - * IRMAStreamSource::IsLive - * Purpose: - * Ask the source whether it is live - * - */ - STDMETHOD_ (BOOL,IsLive) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStreamSource::GetPlayer - * Purpose: - * Get the interface to the player object of which the source is - * a part of. - * - */ - STDMETHOD(GetPlayer) (THIS_ - REF(IRMAPlayer*) pPlayer) PURE; - - /************************************************************************ - * Method: - * IRMAStreamSource::GetURL - * Purpose: - * Get the URL for this source. NOTE: The returned string is - * assumed to be valid for the life of the IRMAStreamSource from which - * it was returned. - * - */ - STDMETHOD_(const char*,GetURL) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStreamSource::GetStreamCount - * Purpose: - * Returns the current number of stream instances supported by - * this source instance. - */ - STDMETHOD_(UINT16, GetStreamCount)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAStreamSource::GetStream - * Purpose: - * Returns the Nth stream instance supported by this source. - */ - STDMETHOD(GetStream) (THIS_ - UINT16 nIndex, - REF(IUnknown*) pUnknown) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayer - * - * Purpose: - * - * Interface provided by the client engine to the renderers. This - * interface allows access to player related information, properties, - * and operations. - * - * IID_IRMAPlayer: - * - * {00000402-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPlayer, 0x00000402, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayer - -DECLARE_INTERFACE_(IRMAPlayer, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPlayer methods - */ - - /************************************************************************ - * Method: - * IRMAPlayer::GetClientEngine - * Purpose: - * Get the interface to the client engine object of which the - * player is a part of. - * - */ - STDMETHOD(GetClientEngine) (THIS_ - REF(IRMAClientEngine*) pEngine) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::IsDone - * Purpose: - * Ask the player if it is done with the current presentation - * - */ - STDMETHOD_(BOOL,IsDone) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::IsLive - * Purpose: - * Ask the player whether it contains the live source - * - */ - STDMETHOD_(BOOL,IsLive) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::GetCurrentPlayTime - * Purpose: - * Get the current time on the Player timeline - * - */ - STDMETHOD_(ULONG32,GetCurrentPlayTime) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::OpenURL - * Purpose: - * Tell the player to begin playback of all its sources. - * - */ - STDMETHOD(OpenURL) (THIS_ - const char* pURL) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::Begin - * Purpose: - * Tell the player to begin playback of all its sources. - * - */ - STDMETHOD(Begin) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::Stop - * Purpose: - * Tell the player to stop playback of all its sources. - * - */ - STDMETHOD(Stop) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::Pause - * Purpose: - * Tell the player to pause playback of all its sources. - * - */ - STDMETHOD(Pause) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::Seek - * Purpose: - * Tell the player to seek in the playback timeline of all its - * sources. - * - */ - STDMETHOD(Seek) (THIS_ - ULONG32 ulTime) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::GetSourceCount - * Purpose: - * Returns the current number of source instances supported by - * this player instance. - */ - STDMETHOD_(UINT16, GetSourceCount)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::GetSource - * Purpose: - * Returns the Nth source instance supported by this player. - */ - STDMETHOD(GetSource) (THIS_ - UINT16 nIndex, - REF(IUnknown*) pUnknown) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::SetClientContext - * Purpose: - * Called by the client to install itself as the provider of client - * services to the core. This is traditionally called by the top - * level client application. - */ - STDMETHOD(SetClientContext) (THIS_ - IUnknown* pUnknown) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::GetClientContext - * Purpose: - * Called to get the client context for this player. This is - * set by the top level client application. - */ - STDMETHOD(GetClientContext) (THIS_ - REF(IUnknown*) pUnknown) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::AddAdviseSink - * Purpose: - * Call this method to add a client advise sink. - * - */ - STDMETHOD(AddAdviseSink) (THIS_ - IRMAClientAdviseSink* pAdviseSink) PURE; - - /************************************************************************ - * Method: - * IRMAPlayer::RemoveAdviseSink - * Purpose: - * Call this method to remove a client advise sink. - */ - STDMETHOD(RemoveAdviseSink) (THIS_ - IRMAClientAdviseSink* pAdviseSink) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAClientEngine - * - * Purpose: - * - * Interface to the basic client engine. Provided to the renderers and - * other client side components. - * - * IID_IRMAClientEngine: - * - * {00000403-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAClientEngine, 0x00000403, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAClientEngine - -DECLARE_INTERFACE_(IRMAClientEngine, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAClientEngine methods - */ - - /************************************************************************ - * Method: - * IRMAClientEngine::CreatePlayer - * Purpose: - * Creates a new IRMAPlayer instance. - * - */ - STDMETHOD(CreatePlayer) (THIS_ - REF(IRMAPlayer*) pPlayer) PURE; - - /************************************************************************ - * Method: - * IRMAClientEngine::ClosePlayer - * Purpose: - * Called by the client when it is done using the player... - * - */ - STDMETHOD(ClosePlayer) (THIS_ - IRMAPlayer* pPlayer) PURE; - - /************************************************************************ - * Method: - * IRMAClientEngine::GetPlayerCount - * Purpose: - * Returns the current number of IRMAPlayer instances supported by - * this client engine instance. - */ - STDMETHOD_(UINT16, GetPlayerCount)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientEngine::GetPlayer - * Purpose: - * Returns the Nth IRMAPlayer instances supported by this client - * engine instance. - */ - STDMETHOD(GetPlayer) (THIS_ - UINT16 nPlayerNumber, - REF(IUnknown*) pUnknown) PURE; - - /************************************************************************ - * Method: - * IRMAClientEngine::EventOccurred - * Purpose: - * Clients call this to pass OS events to all players. PNxEvent - * defines a cross-platform event. - */ - STDMETHOD(EventOccurred) (THIS_ - PNxEvent* /*IN*/ pEvent) PURE; -}; - -#if defined _UNIX && !defined (_VXWORKS) -DEFINE_GUID(IID_IRMAClientEngineSelector, 0x00000404, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAClientEngineSelector - -DECLARE_INTERFACE_(IRMAClientEngineSelector, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAClientEngine::Select - * Purpose: - * Top level clients under Unix should use this instead of - * select() to select for events. - */ - STDMETHOD_(INT32, Select) (THIS_ - INT32 n, - fd_set *readfds, - fd_set *writefds, - fd_set *exceptfds, - struct timeval* timeout) PURE; -}; -#endif /* _UNIX */ - -/**************************************************************************** - * - * Interface: - * - * IRMAClientEngineSetup - * - * Purpose: - * - * Interface to the basic client engine. Provided to the renderers and - * other client side components. - * - * IID_IRMAClientEngineSetup: - * - * {00000405-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAClientEngineSetup, 0x00000405, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAClientEngineSetup - -DECLARE_INTERFACE_(IRMAClientEngineSetup, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAClientEngineSetup methods - */ - - /************************************************************************ - * Method: - * IRMAClientEngineSetup::Setup - * Purpose: - * Top level clients use this interface to over-ride certain basic - * interfaces implemented by the core. Current over-ridable - * interfaces are: IRMAPreferences, IRMAHyperNavigate - */ - STDMETHOD(Setup) (THIS_ - IUnknown* pContext) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAInfoLogger - * - * Purpose: - * - * Interface to send any logging information back to the server. - * This information will appear in the server's access log. - * - * IID_IRMAInfoLogger: - * - * {00000409-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAInfoLogger, 0x00000409, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAInfoLogger - -DECLARE_INTERFACE_(IRMAInfoLogger, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAInfoLogger methods - */ - - /************************************************************************ - * Method: - * IRMAInfoLogger::LogInformation - * Purpose: - * Logs any user defined information in form of action and - * associated data. - */ - STDMETHOD(LogInformation) (THIS_ - const char* /*IN*/ pAction, - const char* /*IN*/ pData) PURE; -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayer2 - * - * Purpose: - * - * Extra methods in addition to IRMAPlayer - * - * IID_IRMAPlayer2: - * - * {00000411-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPlayer2, 0x00000411, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlayer2 - -DECLARE_INTERFACE_(IRMAPlayer2, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IID_IRMAPlayer2::SetMinimumPreroll - * Purpose: - * Call this method to set the minimum preroll of this clip - */ - STDMETHOD(SetMinimumPreroll) (THIS_ - UINT32 ulMinPreroll) PURE; - - /************************************************************************ - * Method: - * IID_IRMAPlayer2::GetMinimumPreroll - * Purpose: - * Call this method to get the minimum preroll of this clip - */ - STDMETHOD(GetMinimumPreroll) (THIS_ - REF(UINT32) ulMinPreroll) PURE; - - /************************************************************************ - * Method: - * IID_IRMAPlayer2::OpenRequest - * Purpose: - * Call this method to open the IRMARequest - */ - STDMETHOD(OpenRequest) (THIS_ - IRMARequest* pRequest) PURE; - - /************************************************************************ - * Method: - * IID_IRMAPlayer2::GetRequest - * Purpose: - * Call this method to get the IRMARequest - */ - STDMETHOD(GetRequest) (THIS_ - REF(IRMARequest*) pRequest) PURE; -}; - -#endif /* _RMACORE_H_ */ - diff --git a/include/realmedia/rmadb.h b/include/realmedia/rmadb.h deleted file mode 100644 index bc1c090a5..000000000 --- a/include/realmedia/rmadb.h +++ /dev/null @@ -1,1304 +0,0 @@ -/**************************************************************************** - * - * $Id: rmadb.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Interface. - * - */ - -#ifndef _RMADB_H_ -#define _RMADB_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMADatabaseManager IRMADatabaseManager; -typedef _INTERFACE IRMAAuthenticationDBManager IRMAAuthenticationDBManager; -typedef _INTERFACE IRMAAuthenticationDBManagerResponse IRMAAuthenticationDBManagerResponse; -typedef _INTERFACE IRMAAsyncEnumAuthenticationDB IRMAAsyncEnumAuthenticationDB; -typedef _INTERFACE IRMAAsyncEnumAuthenticationDBResponse IRMAAsyncEnumAuthenticationDBResponse; -typedef _INTERFACE IRMAAuthenticationDBAccess IRMAAuthenticationDBAccess; -typedef _INTERFACE IRMAAuthenticationDBAccessResponse IRMAAuthenticationDBAccessResponse; -typedef _INTERFACE IRMAGUIDDBManager IRMAGUIDDBManager; -typedef _INTERFACE IRMAGUIDDBManagerResponse IRMAGUIDDBManagerResponse; -typedef _INTERFACE IRMAPPVDBManager IRMAPPVDBManager; -typedef _INTERFACE IRMAPPVDBManagerResponse IRMAPPVDBManagerResponse; -typedef _INTERFACE IRMARedirectDBManager IRMARedirectDBManager; -typedef _INTERFACE IRMARedirectDBManagerResponse IRMARedirectDBManagerResponse; -typedef _INTERFACE IRMARegistrationLogger IRMARegistrationLogger; - -/**************************************************************************** - * - * Interface: - * - * IRMADatabaseManager - * - * Purpose: - * - * This is implemented by the database manager in order to provide - * access to the databases it manages. - * - * IRMADatabaseManager: - * - * {00002A00-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADatabaseManager, 0x00002A00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_CRMADatabaseManager IID_IRMADatabaseManager - -#undef INTERFACE -#define INTERFACE IRMADatabaseManager - -DECLARE_INTERFACE_(IRMADatabaseManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMADatabaseManager::GetInstanceFromID - * Purpose: - * - * Returns a database object configured as defined for the specifed - * DatabaseID in the server config file. - * - */ - STDMETHOD(GetInstanceFromID) - ( - THIS_ - IRMABuffer* pBufferID, - REF(IUnknown*) pUnknownDatabase - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticationDBManager - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * storage for authentication data. - * - * IRMAAuthenticationDBManager: - * - * {00002A02-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAuthenticationDBManager, 0x00002A02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticationDBManager - -DECLARE_INTERFACE_(IRMAAuthenticationDBManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBManager::AddPrincipal - * Purpose: - * - * Adds the specified user to the database, if it is not already - * there. - * - */ - STDMETHOD(AddPrincipal) - ( - THIS_ - IRMAAuthenticationDBManagerResponse* pAuthenticationDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBManager::RemovePrincipal - * Purpose: - * - * Removes the specified user from the database, if it is there. - * - * - */ - STDMETHOD(RemovePrincipal) - ( - THIS_ - IRMAAuthenticationDBManagerResponse* pAuthenticationDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBManager::SetCredentials - * Purpose: - * - * Replaces the credentials for the specified user. - * Usually the credentials are a password. - * It is not the databases job to protect this data - * Authentication plugins will protect this data - * before storing it when neccesary. - * - */ - STDMETHOD(SetCredentials) - ( - THIS_ - IRMAAuthenticationDBManagerResponse* pAuthenticationDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID, - IRMABuffer* pBufferCredentials - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticationDBManagerResponse - * - * Purpose: - * - * A database user will implement this when it desires to manage - * storage for authentication data. - * This interface receives the results of IRMAAuthenticationDBManager - * methods - * - * IRMAAuthenticationDBManagerResponse: - * - * {00002A01-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAuthenticationDBManagerResponse, 0x00002A01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticationDBManagerResponse - -DECLARE_INTERFACE_(IRMAAuthenticationDBManagerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBManagerResponse::AddPrincipalDone - * Purpose: - * - * Reports the success or failure of - * IRMAAuthenticationDBManager::AddPrincipal - * - */ - STDMETHOD(AddPrincipalDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBManagerResponse::RemovePrincipalDone - * Purpose: - * - * Reports the success or failure of - * IRMAAuthenticationDBManager::RemovePrincipal - * - */ - STDMETHOD(RemovePrincipalDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBManagerResponse::SetCredentialsDone - * Purpose: - * - * Reports the success or failure of - * IRMAAuthenticationDBManager::SetCredentials - * - */ - STDMETHOD(SetCredentialsDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAsyncEnumAuthenticationDB - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * enumeration of authentication data. - * - * IRMAAsyncEnumAuthenticationDB: - * - * {00002A04-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAsyncEnumAuthenticationDB, 0x00002A04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAsyncEnumAuthenticationDB - -DECLARE_INTERFACE_(IRMAAsyncEnumAuthenticationDB, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDB::Reset - * Purpose: - * - * Call this to reset this enumerator to the beginning of the - * collection. - * - */ - STDMETHOD(Reset) - ( - THIS_ - IRMAAsyncEnumAuthenticationDBResponse* pAsyncEnumAuthenticationDBResponseNew - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDB::Next - * Purpose: - * - * Call this to retrieve the next item in the collection. - * - */ - STDMETHOD(Next) - ( - THIS_ - IRMAAsyncEnumAuthenticationDBResponse* pAsyncEnumAuthenticationDBResponseNew - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDB::Skip - * Purpose: - * - * Call this to skip the next n items in the collection and - * retrieve the n+1 item. - * - */ - STDMETHOD(Skip) - ( - THIS_ - IRMAAsyncEnumAuthenticationDBResponse* pAsyncEnumAuthenticationDBResponseNew, - UINT32 ulNumToSkip - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDB::Clone - * Purpose: - * - * Call this to make a new enumerator of this collection. - * - */ - STDMETHOD(Clone) - ( - THIS_ - REF(IRMAAsyncEnumAuthenticationDB*) pAsyncEnumAuthenticationDBNew - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAsyncEnumAuthenticationDBResponse - * - * Purpose: - * - * A database user will implement this when it desires to - * enumerate authentication data. - * This interface receives the results of IRMAAsyncEnumAuthenticationDB - * methods - * - * IRMAAsyncEnumAuthenticationDBResponse: - * - * {00002A03-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAsyncEnumAuthenticationDBResponse, 0x00002A03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAsyncEnumAuthenticationDBResponse - -DECLARE_INTERFACE_(IRMAAsyncEnumAuthenticationDBResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDBResponse::ResetDone - * Purpose: - * - * Reports the success or failure of - * IRMAAsyncEnumAuthenticationDB::Reset - * - */ - STDMETHOD(ResetDone) - ( - THIS_ - PN_RESULT ResultStatus - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDBResponse::NextDone - * Purpose: - * - * Reports the success or failure of - * IRMAAsyncEnumAuthenticationDB::Next - * If successful the PrincipalID is valid. - * - */ - STDMETHOD(NextDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferNextPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncEnumAuthenticationDBResponse::SkipDone - * Purpose: - * - * Reports the success or failure of - * IRMAAsyncEnumAuthenticationDB::Skip - * If successful the PrincipalID is valid. - * - */ - STDMETHOD(SkipDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferNextPrincipalID - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticationDBAccess - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * access to authentication data. - * - * IRMAAuthenticationDBAccess: - * - * {00002A06-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAuthenticationDBAccess, 0x00002A06, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticationDBAccess - -DECLARE_INTERFACE_(IRMAAuthenticationDBAccess, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBAccess::_NewEnum - * Purpose: - * - * Call this to make a new enumerator of this collection. - * - */ - STDMETHOD(_NewEnum) - ( - THIS_ - REF(IRMAAsyncEnumAuthenticationDB*) pAsyncEnumAuthenticationDBNew - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBAccess::CheckExistence - * Purpose: - * - * Call this to verify the existance of a principal. - * - */ - STDMETHOD(CheckExistence) - ( - THIS_ - IRMAAuthenticationDBAccessResponse* pAuthenticationDBAccessResponseNew, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBAccess::GetCredentials - * Purpose: - * - * Call this to access the credentials for the specified principal. - * - */ - STDMETHOD(GetCredentials) - ( - THIS_ - IRMAAuthenticationDBAccessResponse* pAuthenticationDBAccessResponseNew, - IRMABuffer* pBufferPrincipalID - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAAuthenticationDBAccessResponse - * - * Purpose: - * - * A database user will implement this when it desires to - * access authentication data. - * This interface receives the results of IRMAAuthenticationDBAccess - * methods - * - * IRMAAuthenticationDBAccessResponse: - * - * {00002A05-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAuthenticationDBAccessResponse, 0x00002A05, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAuthenticationDBAccessResponse - -DECLARE_INTERFACE_(IRMAAuthenticationDBAccessResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBAccessResponse::ExistenceCheckDone - * Purpose: - * - * Reports the success or failure of - * IRMAAuthenticationDBAccess::ExistenceCheck - * - */ - STDMETHOD(ExistenceCheckDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAAuthenticationDBAccessResponse::GetCredentialsDone - * Purpose: - * - * Reports the success or failure of - * IRMAAuthenticationDBAccess::GetCredentials - * If successful the Credentials var is valid. - * - */ - STDMETHOD(GetCredentialsDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID, - IRMABuffer* pBufferCredentials - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAGUIDDBManager - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * storage of player GUID data (for Player Authentication). - * - * IRMAGUIDDBManager: - * - * {00002A08-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGUIDDBManager, 0x00002A08, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAGUIDDBManager - -DECLARE_INTERFACE_(IRMAGUIDDBManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAGUIDDBManager::SetGUIDForPrincipalID - * Purpose: - * - * Call this to associate a player GUID with a user. - * - */ - STDMETHOD(SetGUIDForPrincipalID) - ( - THIS_ - IRMAGUIDDBManagerResponse* pGUIDDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID, - IRMABuffer* pBufferGUID - ) PURE; - - /************************************************************************ - * Method: - * IRMAGUIDDBManager::GetPrincipalIDFromGUID - * Purpose: - * - * Call this to get the associated player GUID from a user. - * - */ - STDMETHOD(GetPrincipalIDFromGUID) - ( - THIS_ - IRMAGUIDDBManagerResponse* pGUIDDBManagerResponseNew, - IRMABuffer* pBufferGUID - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAGUIDDBManagerResponse - * - * Purpose: - * - * A database user will implement this when it desires to - * manage player GUID data. - * This interface receives the results of IRMAGUIDDBManager - * methods - * - * IRMAGUIDDBManagerResponse: - * - * {00002A07-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGUIDDBManagerResponse, 0x00002A07, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAGUIDDBManagerResponse - -DECLARE_INTERFACE_(IRMAGUIDDBManagerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAGUIDDBManagerResponse::SetGUIDForPrincipalIDDone - * Purpose: - * - * Reports the success or failure of - * IRMAGUIDDBManager::SetGUIDForPrincipalID - * - */ - STDMETHOD(SetGUIDForPrincipalIDDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAGUIDDBManagerResponse::GetPrincipalIDFromGUIDDone - * Purpose: - * - * Reports the success or failure of - * IRMAGUIDDBManager::GetGUIDForPrincipalID - * - */ - STDMETHOD(GetPrincipalIDFromGUIDDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferGUID, - IRMABuffer* pBufferPrincipalID - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPPVDBManager - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * storage of Pay-Per-View permission data. - * - * IRMAPPVDBManager: - * - * {00002A0A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPPVDBManager, 0x00002A0A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPPVDBManager - -DECLARE_INTERFACE_(IRMAPPVDBManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManager::GetPermissions - * Purpose: - * - * Call this to find the PPV permissions for the specified URL - * and user. - * - */ - STDMETHOD(GetPermissions) - ( - THIS_ - IRMAPPVDBManagerResponse* pPPVDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID, - IRMABuffer* pBufferURL - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManager::SetPermissions - * Purpose: - * - * Call this to set the PPV permissions for the specified URL - * and user. - * - */ - STDMETHOD(SetPermissions) - ( - THIS_ - IRMAPPVDBManagerResponse* pPPVDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID, - IRMABuffer* pBufferURL, - IRMAValues* pValuesPermissions - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManager::RevokePermissions - * Purpose: - * - * Call this to remove the PPV permissions for the specified URL - * and user. - * - */ - STDMETHOD(RevokePermissions) - ( - THIS_ - IRMAPPVDBManagerResponse* pPPVDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID, - IRMABuffer* pBufferURL - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManager::RevokeAllPermissions - * Purpose: - * - * Call this to remove the PPV permissions for all URL's - * that this user has access too. - * - */ - STDMETHOD(RevokeAllPermissions) - ( - THIS_ - IRMAPPVDBManagerResponse* pPPVDBManagerResponseNew, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManager::LogAccessAttempt - * Purpose: - * - * Call this to record the results of an attempt to access - * protected content. - * - */ - STDMETHOD(LogAccessAttempt) - ( - THIS_ - IRMAValues* pValuesAccess - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPPVDBManagerResponse - * - * Purpose: - * - * A database user will implement this when it desires to - * manage Pay-Per-View permission data. - * This interface receives the results of IRMAPPVDBManager - * methods - * - * IRMAPPVDBManagerResponse: - * - * {00002A09-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPPVDBManagerResponse, 0x00002A09, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPPVDBManagerResponse - -DECLARE_INTERFACE_(IRMAPPVDBManagerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManagerResponse::GetPermissionsDone - * Purpose: - * - * Reports the success or failure of - * IRMAPPVDBManager::GetPermissions - * If successful then the Permissions are valid - * - */ - STDMETHOD(GetPermissionsDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID, - IRMAValues* pValuesPermissions - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManagerResponse::SetPermissionsDone - * Purpose: - * - * Reports the success or failure of - * IRMAPPVDBManager::SetPermissions - * - */ - STDMETHOD(SetPermissionsDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManagerResponse::RevokePermissionsDone - * Purpose: - * - * Reports the success or failure of - * IRMAPPVDBManager::RevokePermissions - * - */ - STDMETHOD(RevokePermissionsDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDBManagerResponse::RevokeAllPermissionsDone - * Purpose: - * - * Reports the success or failure of - * IRMAPPVDBManager::RevokeAllPermissions - * - */ - STDMETHOD(RevokeAllPermissionsDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferPrincipalID - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMARedirectDBManager - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * storage of URL's to redirect. - * - * IRMARedirectDBManager: - * - * {00002A0C-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARedirectDBManager, 0x00002A0C, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARedirectDBManager - -DECLARE_INTERFACE_(IRMARedirectDBManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMARedirectDBManager::GetRedirect - * Purpose: - * - * Call this to retrieve the URL that the specified URL should - * be redirected to. - * - */ - STDMETHOD(GetRedirect) - ( - THIS_ - IRMARedirectDBManagerResponse* pRedirectDBManagerResponseNew, - IRMABuffer* pBufferURL - ) PURE; - - /************************************************************************ - * Method: - * IRMARedirectDBManager::AddRedirect - * Purpose: - * - * Call this to set the new URL that the specified URL should - * be redirected to. - * - */ - STDMETHOD(AddRedirect) - ( - THIS_ - IRMARedirectDBManagerResponse* pRedirectDBManagerResponseNew, - IRMABuffer* pBufferURL, - IRMABuffer* pBufferNewURL - ) PURE; - - /************************************************************************ - * Method: - * IRMARedirectDBManager::RemoveRedirect - * Purpose: - * - * Call this to stop redirecting the specified URL. - * - */ - STDMETHOD(RemoveRedirect) - ( - THIS_ - IRMARedirectDBManagerResponse* pRedirectDBManagerResponseNew, - IRMABuffer* pBufferURL - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMARedirectDBManagerResponse - * - * Purpose: - * - * A database user will implement this when it desires to - * manage the URL's to redirect. - * This interface receives the results of IRMARedirectDBManager - * methods - * - * IRMARedirectDBManagerResponse: - * - * {00002A0B-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARedirectDBManagerResponse, 0x00002A0B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARedirectDBManagerResponse - -DECLARE_INTERFACE_(IRMARedirectDBManagerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMARedirectDBManagerResponse::GetRedirectDone - * Purpose: - * - * Reports the success or failure of - * IRMARedirectDBManager::GetRedirect - * If successful then the new URL is valid - * - */ - STDMETHOD(GetRedirectDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferURL, - IRMABuffer* pBufferNewURL - ) PURE; - - /************************************************************************ - * Method: - * IRMARedirectDBManagerResponse::AddRedirectDone - * Purpose: - * - * Reports the success or failure of - * IRMARedirectDBManager::AddRedirect - * - */ - STDMETHOD(AddRedirectDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferURL - ) PURE; - - /************************************************************************ - * Method: - * IRMARedirectDBManagerResponse::RemoveRedirectDone - * Purpose: - * - * Reports the success or failure of - * IRMARedirectDBManager::RemoveRedirect - * - */ - STDMETHOD(RemoveRedirectDone) - ( - THIS_ - PN_RESULT ResultStatus, - IRMABuffer* pBufferURL - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMARegistrationLogger - * - * Purpose: - * - * A database plugin will implement this when it desires to provide - * storage of player registration attempts. - * - * IRMARegistrationLogger: - * - * {00002A0E-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARegistrationLogger, 0x00002A0E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARegistrationLogger - -DECLARE_INTERFACE_(IRMARegistrationLogger, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) - ( - THIS_ - REFIID IIDOfInterfaceDesired, - void** ppVoidRequestedInterface - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( - THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( - THIS - ) PURE; - - /************************************************************************ - * Method: - * IRMARegistrationLogger::LogRegistrationAttempt - * Purpose: - * - * Call this to record the results of an attempt to register - * a player's GUID. - * - */ - STDMETHOD(LogRegistrationAttempt) - ( - THIS_ - IRMAValues* pValuesRegistration - ) PURE; -}; - - -#endif /* !_RMADB_H_ */ diff --git a/include/realmedia/rmadtcvt.h b/include/realmedia/rmadtcvt.h deleted file mode 100644 index 042436151..000000000 --- a/include/realmedia/rmadtcvt.h +++ /dev/null @@ -1,533 +0,0 @@ -/**************************************************************************** - * - * $Id: rmadtcvt.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-2000 RealNetworks, Inc. All rights reserved.. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Stream Data Conversion Interfaces. - * - */ - - -#ifndef _RMADTCVT_H -#define _RMADTCVT_H - -typedef _INTERFACE IRMADataConvertSystemObject - IRMADataConvertSystemObject; -typedef _INTERFACE IRMADataConvert IRMADataConvert; -typedef _INTERFACE IRMADataConvertResponse IRMADataConvertResponse; -typedef _INTERFACE IRMADataRevert IRMADataRevert; -typedef _INTERFACE IRMADataRevertResponse IRMADataRevertResponse; - -/**************************************************************************** - * - * Interface: - * - * IRMADataConvertSystemObject - * - * Purpose: - * - * Object that allows Controller to communicate with a specific - * Data Convert plugin session (similar to IRMAFileSystemObject) - * - * Implemented by: - * - * Server side plugin. - * - * IID_IMADataConvertSystemObject: - * - * {00003900-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADataConvertSystemObject, - 0x00003900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADataConvertSystemObject - -DECLARE_INTERFACE_(IRMADataConvertSystemObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADataConvertSystemObject - */ - - /*********************************************************************** - * Method: GetDataConvertInfo - * - * Purpose: - * Returns information needed for proper instantiation of data - * convert plugin. pShortName should be a short, human readable - * name in the form of "company-dcname". For example: - * pShortName = "rn-dataconvert" - */ - STDMETHOD(GetDataConvertInfo) (THIS_ REF(const char*) pShortName) PURE; - - /*********************************************************************** - * Method: InitDataConvertSystem - * - * Purpose: - * Pass in options from config file from under DataConvertMount - * for this specific plugin. - */ - STDMETHOD(InitDataConvertSystem) (THIS_ IRMAValues* pOptions) PURE; - - /*********************************************************************** - * Method: CreateDataConvert - * - * Purpose: - * Purpose: - * System is requesting an IRMADataConvert object for this mount - * point. - */ - STDMETHOD(CreateDataConvert) (THIS_ IUnknown** /*OUT*/ ppConvObj) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMADataConvert - * - * Purpose: - * - * Per connection object to handle the actual data and header - * conversions. - * - * Implemented by: - * - * Server side plugin. - * - * IID_IMADataConvert: - * - * {00003901-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADataConvert, - 0x00003901, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADataConvert - -DECLARE_INTERFACE_(IRMADataConvert, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADataConvert - */ - - /* - * NOTE: for each of ConvertFileHeader, ConvertStreamHeader, - * ConvertData, you can call the appropriate done method on - * the response object with a result of PNR_OK and a NULL buffer - * and the system will use the original header/packet. Do this - * if you aren't going to change things in the header/packet. - */ - /************************************************************************ - * Method: DataConvertInit - * - *Purpose: - * Basic initialization, mainly just to pass in response object. - */ - STDMETHOD(DataConvertInit) (THIS_ IRMADataConvertResponse* pResponse) PURE; - - /************************************************************************ - * Method: ConvertFileHeader - * - * Purpose: - * Pass in file headers for data conversion. - */ - STDMETHOD(ConvertFileHeader) (THIS_ IRMAValues* pFileHeader) PURE; - - /************************************************************************ - * Method: ConvertStreamHeader - * - * Purpose: - * Pass in stream headers for data conversion. - */ - STDMETHOD(ConvertStreamHeader) (THIS_ IRMAValues* pStreamHeader) PURE; - - /************************************************************************ - * Method: GetConversionMimeType - * - * Purpose: - * Tell the server what converstion type you are using for the - * session. - */ - STDMETHOD(GetConversionMimeType) - (THIS_ REF(const char*) pConversionType) PURE; - - /************************************************************************ - * Method: ConvertData - * - * Purpose: - * Pass in data to be converted. - */ - STDMETHOD(ConvertData) (THIS_ IRMAPacket* pPacket) PURE; - - /************************************************************************ - * Method: ControlBufferReady - * - * Purpose: - * Pass in a control channel buffer sent from the IRMADataRevert - * on the other side (player). - */ - STDMETHOD(ControlBufferReady) (THIS_ IRMABuffer* pBuffer) PURE; - - /************************************************************************ - * Method: SetMulticastTransportConverter - * - * Purpose: - * In this case the IRMADataConvert is only handling the header - * conversions per player and this call is handing you the data - * converter which is doing the data. This will a different - * instance of the same object. - */ - STDMETHOD(SetMulticastTransportConverter) (THIS_ - IRMADataConvert* pConverter) PURE; - - - /************************************************************************ - * Method: AddMulticastControlConverter - * - * Purpose: - * In this case the IRMADataConvert is only handling the data - * conversions for all of the players (but only once because it's - * multicast). This call is handing you one of a possible many - * IRMADataConvert objects which will be handling the header - * conversions. - */ - STDMETHOD(AddMulticastControlConverter) (THIS_ - IRMADataConvert* pConverter) PURE; - - /************************************************************************ - * Method: Done - * - * Purpose: - * Let IRMADataConvert know that it is done. This is mainly to clear - * circular refs between multicast transport and controllers. - */ - STDMETHOD(Done) (THIS) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMADataConvertResponse - * - * Purpose: - * - * Response object for IRMADataConvert. - * - * Implemented by: - * - * Server Core. - * - * IID_IMADataConvertResponse: - * - * {00003902-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADataConvertResponse, - 0x00003902, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADataConvertResponse - -DECLARE_INTERFACE_(IRMADataConvertResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADataConvertResponse - */ - - /* - * NOTE: for each of ConvertFileHeader, ConvertStreamHeader, - * ConvertData, you can call the appropriate done method on - * the response object with a result of PNR_OK and a NULL buffer - * and the system will use the original header/packet. Do this - * if you aren't going to change things in the header/packet. - */ - /************************************************************************ - * Method: DataConvertInitDone - * - * Purpose: - * Async notification that the IRMADataConvert is done with - * intialization. - */ - STDMETHOD(DataConvertInitDone) (THIS_ PN_RESULT status) PURE; - - /************************************************************************ - * Method: ConvertedFileHeaderReady - * - * Purpose: - * Async notification that the IRMADataCovert is done converting the - * file header. - */ - STDMETHOD(ConvertedFileHeaderReady) (THIS_ - PN_RESULT status, IRMAValues* pFileHeader) PURE; - - /************************************************************************ - * Method: ConvertedStreamHeaderReady - * - * Purpose: - * Async notification that the IRMADataConvert is done converting the - * stream header. - */ - STDMETHOD(ConvertedStreamHeaderReady) (THIS_ - PN_RESULT status, IRMAValues* pStreamHeader) PURE; - - /************************************************************************ - * Method: ConvertedDataReady - * - * Purpose: - * Async notification that the IRMADataConvert is done converting - * the stream data packet. - */ - STDMETHOD(ConvertedDataReady) (THIS_ PN_RESULT status, - IRMAPacket* pPacket) PURE; - - /************************************************************************ - * Method: SendControlBuffer - * - * Purpose: - * Provided to allow IRMADataConvert to send an arbitrary buffer - * to the IRMADataRevert on the other side (player). - */ - STDMETHOD(SendControlBuffer) (THIS_ IRMABuffer* pBuffer) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMADataRevert - * - * Purpose: - * - * Revert data coming from coresponding IRMADataConvert on server. - * - * Implemented by: - * - * Player side plugin. - * - * IID_IMADataRevert: - * - * {00003903-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADataRevert, - 0x00003903, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADataRevert - -DECLARE_INTERFACE_(IRMADataRevert, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADataRevert - */ - - /************************************************************************ - * Method: DataRevertInit - * - * Purpose: - * Basic inialization of IRMADataRevert. Mainly just to pass in - * response object. - */ - STDMETHOD(DataRevertInit) (THIS_ IRMADataRevertResponse* pResponse) PURE; - - /************************************************************************ - * Method: GetDataRevertInfo - * - * Purpose: - * Allow IRMADataRevert to notify player core about which data - * conversion mime types it is willing to handle. - */ - STDMETHOD(GetDataRevertInfo) (THIS_ REF(const char**) - ppConversionMimeTypes) PURE; - - /************************************************************************ - * Method: RevertFileHeader - * - * Purpose: - * Pass in converted FileHeader to allow IRMADataRevert to revert - * the header. - */ - STDMETHOD(RevertFileHeader) (THIS_ IRMAValues* pFileHeader) PURE; - - /************************************************************************ - * Method: RevertStreamHeader - * - * Purpose: - * Pass in converted StreamHeader to allow IRMADataRevert to revert - * the header. - */ - STDMETHOD(RevertStreamHeader)(THIS_ IRMAValues* pStreamHeader) PURE; - - /************************************************************************ - * Method: RevertData - * - * Purpose: - * Pass in converted stream data to allow IRMADataRevert to - * revert the data. - */ - STDMETHOD(RevertData) (THIS_ IRMAPacket* pPacket) PURE; - - /************************************************************************ - * Method: ControlBufferReady - * - * Purpose: - * Pass in control channel buffer received from corresponding - * IRMADataConvert on server side. - */ - STDMETHOD(ControlBufferReady) (THIS_ IRMABuffer* pBuffer) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMADataRevertResponse - * - * Purpose: - * - * Response ojbect for IRMADataRevert. - * - * Implemented by: - * - * Player core. - * - * IID_IMADataRevertResponse: - * - * {00003904-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADataRevertResponse, - 0x00003904, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADataRevertResponse - -DECLARE_INTERFACE_(IRMADataRevertResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADataRevertResponse - */ - - /************************************************************************ - * Method: DataRevertInitDone - * - * Purpose: - * Async notification that the IRMADataRevert is done intializing - * and can begin processing headers. - */ - STDMETHOD(DataRevertInitDone) (THIS_ PN_RESULT status) PURE; - - /************************************************************************ - * Method: RevertedFileHeaderReady - * - * Purpose: - * Async notification that the IRMADataRevert is done reverting the - * file headers. - */ - STDMETHOD(RevertedFileHeaderReady) (THIS_ - PN_RESULT status, IRMAValues* pHeader) PURE; - - /************************************************************************ - * Method: RevertedStreamHeaderReady - * - * Purpose: - * Async notification that the IRMADataRevert is done reverting the - * stream headers. - */ - STDMETHOD(RevertedStreamHeaderReady) (THIS_ - PN_RESULT status, IRMAValues* pHeader) PURE; - - /************************************************************************ - * Method: RevertedDataReady - * - * Purpose: - * Async notification that the IRMADataRevert is done reverting the - * stream data. - */ - STDMETHOD(RevertedDataReady) (THIS_ PN_RESULT status, - IRMAPacket* pPacket) PURE; - - /************************************************************************ - * Method: SendControlBuffer - * - * Purpose: - * Provided to allow IRMADataRevert to send an arbitrary control - * buffer to the IRMADataConvert on the other side (server). - */ - STDMETHOD(SendControlBuffer) (THIS_ IRMABuffer* pBuffer) PURE; - -}; - - -#endif diff --git a/include/realmedia/rmaencod.h b/include/realmedia/rmaencod.h deleted file mode 100644 index f03c224c7..000000000 --- a/include/realmedia/rmaencod.h +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaencod.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Encoder Interfaces. - * - */ - -#ifndef _RMAENCOD_H_ -#define _RMAENCOD_H_ - -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMARequest IRMARequest; -typedef _INTERFACE IRMAEncoder IRMAEncoder; -typedef _INTERFACE IRMAEncoderResponse IRMAEncoderResponse; -typedef _INTERFACE IRMAEncoderCompletion IRMAEncoderCompletion; -typedef _INTERFACE IRMAEncoderResponseCompletion IRMAEncoderResponseCompletion; -typedef _INTERFACE IRMAConnectionlessControl IRMAConnectionlessControl; -typedef _INTERFACE IRMATransportControl IRMATransportControl; - -#ifndef _MACINTOSH -STDAPI_(IUnknown*) CreateContext(); -#else -#pragma export on -STDAPI_(IUnknown*) CreateContext(); -#pragma export off -#endif - - -DEFINE_GUID(IID_IRMAEncoderResponse, 0x00001600, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAEncoderResponse - -DECLARE_INTERFACE_(IRMAEncoderResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAEncoderResponse methods - */ - STDMETHOD(InitEncoderResponse) (THIS_ - const char* pHost, - UINT16 unPort, - IRMARequest* pRequest, - const char* pUsername, - const char* pPassword, - IRMAEncoder* pEncoder) PURE; - - STDMETHOD(FileHeaderReady) (THIS_ - PN_RESULT result, - IRMAValues* pHeader) PURE; - - STDMETHOD(StreamHeaderReady) (THIS_ - PN_RESULT result, - IRMAValues* pHeader) PURE; - - STDMETHOD(PacketReady) (THIS_ - PN_RESULT result, - IRMAPacket* pPacket) PURE; - - STDMETHOD(StreamDone) (THIS_ - UINT16 unStream) PURE; - - STDMETHOD(Process) (THIS) PURE; - - STDMETHOD_(UINT32,GetTime) (THIS) PURE; -}; - -DEFINE_GUID(IID_IRMAEncoder, 0x00001601, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAEncoder - -DECLARE_INTERFACE_(IRMAEncoder, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAEncoder methods - */ - STDMETHOD(InitEncoderResponseDone) (THIS_ - PN_RESULT result) PURE; - - STDMETHOD(GetFileHeader) (THIS) PURE; - - STDMETHOD(GetStreamHeader) (THIS_ - UINT16 unStream) PURE; - - STDMETHOD(StartPackets) (THIS_ - UINT16 unStream) PURE; - - STDMETHOD(StopPackets) (THIS_ - UINT16 unStream) PURE; -}; - -DEFINE_GUID(IID_IRMAEncoderCompletion, 0x00001602, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAEncoderCompletion - -DECLARE_INTERFACE_(IRMAEncoderCompletion, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAEncoderCompletion methods - */ - - STDMETHOD(EncoderDone) (THIS_ - PN_RESULT result) PURE; -}; - -DEFINE_GUID(IID_IRMAConnectionlessControl, 0x00001603, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAConnectionlessControl - -DECLARE_INTERFACE_(IRMAConnectionlessControl, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAConnectionlessControl methods - */ - - STDMETHOD(EnableConnectionlessControl) - (THIS) PURE; - - STDMETHOD(ConnectionCheckFailed) (THIS_ - PN_RESULT status) PURE; - - STDMETHOD(SetConnectionTimeout) (THIS_ - UINT32 uSeconds) PURE; -}; - -DEFINE_GUID(IID_IRMAEncoderResponseCompletion, 0x00001604, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAEncoderResponseCompletion - -DECLARE_INTERFACE_(IRMAEncoderResponseCompletion, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAEncoderResponseCompletion methods - */ - - STDMETHOD(EncoderResponseDone) (THIS) PURE; -}; - -/* - * The only 2 encoder transport types supported are: - * "x-pn-tng/udp" - * "x-pn-tng/tcp" - */ - -DEFINE_GUID(IID_IRMATransportControl, 0x00001605, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMATransportControl - -DECLARE_INTERFACE_(IRMATransportControl, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMATransportControl methods - */ - - STDMETHOD(SetTransportType) (const char* pTransportType) PURE; -}; - -#endif /* _RMAENCOD_H_ */ diff --git a/include/realmedia/rmaengin.h b/include/realmedia/rmaengin.h deleted file mode 100644 index abcf8a542..000000000 --- a/include/realmedia/rmaengin.h +++ /dev/null @@ -1,1500 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaengin.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Callback, Networking, and Scheduling interfaces. - * - */ - -#ifndef _RMAENGIN_H_ -#define _RMAENGIN_H_ - -/* - * Forward declarations of some interfaces used here-in. - */ - -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMACallback IRMACallback; -typedef _INTERFACE IRMAScheduler IRMAScheduler; -typedef _INTERFACE IRMATCPResponse IRMATCPResponse; -typedef _INTERFACE IRMALBoundTCPSocket IRMALBoundTCPSocket; -typedef _INTERFACE IRMATCPSocket IRMATCPSocket; -typedef _INTERFACE IRMAListenResponse IRMAListenResponse; -typedef _INTERFACE IRMAListenSocket IRMAListenSocket; -typedef _INTERFACE IRMANetworkServices IRMANetworkServices; -typedef _INTERFACE IRMANetworkServices2 IRMANetworkServices2; -typedef _INTERFACE IRMAUDPResponse IRMAUDPResponse; -typedef _INTERFACE IRMAUDPSocket IRMAUDPSocket; -typedef _INTERFACE IRMAResolver IRMAResolver; -typedef _INTERFACE IRMAResolverResponse IRMAResolverResponse; -typedef _INTERFACE IRMAInterruptSafe IRMAInterruptSafe; -typedef _INTERFACE IRMAAsyncIOSelection IRMAAsyncIOSelection; -typedef _INTERFACE IRMAUDPMulticastInit IRMAUDPMulticastInit; -typedef _INTERFACE IRMAInterruptState IRMAInterruptState; -typedef _INTERFACE IRMAOptimizedScheduler IRMAOptimizedScheduler; - - -/* - * Address flags starting with PNR are depricated. - */ -#define PNR_INADDR_ANY (UINT32)0x00000000 //THIS FLAG IS DEPRICATED -#define PN_INADDR_ANY (UINT32)0x00000000 - -/* - * 255.255.255.254 - * - * Bind to all ports in IPBindings list from - * server config. - */ -#define PNR_INADDR_IPBINDINGS (UINT32)0xfffffffe //THIS FLAG IS DEPRICATED -#define PN_INADDR_IPBINDINGS (UINT32)0xfffffffe - - -/* Async IO Selection Type (Unix Only) */ - -#define PNAIO_READ 1 -#define PNAIO_WRITE 2 -#define PNAIO_EXCEPTION 4 - -/**************************************************************************** - * - * Interface: - * - * IRMACallback - * - * Purpose: - * - * This interface defines a simple callback which will be used in - * various interfaces such as IRMAScheduler. - * - * IID_IRMACallback: - * - * {00000100-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMACallback, 0x00000100, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMACallback - -DECLARE_INTERFACE_(IRMACallback, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMACallback methods - */ - - /************************************************************************ - * Method: - * IRMACallback::Func - * Purpose: - * This is the function that will be called when a callback is - * to be executed. - */ - STDMETHOD(Func) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAScheduler - * - * Purpose: - * - * This interface provides the user with a way of scheduling callbacks - * that will be executed at some time in the future. - * - * IID_IRMAScheduler: - * - * {00000101-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAScheduler, 0x00000101, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAScheduler - -typedef ULONG32 CallbackHandle; - -typedef struct _RMATimeval -{ - UINT32 tv_sec; - UINT32 tv_usec; -} RMATimeval; - -DECLARE_INTERFACE_(IRMAScheduler, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAScheduler methods - */ - - /************************************************************************ - * Method: - * IRMAScheduler::RelativeEnter - * Purpose: - * Schedule a callback to be executed "ms" milliseconds from now - * This function is less percise then AbsoluteEnter and should only - * be used when accurate timing is not critical. - */ - STDMETHOD_(CallbackHandle,RelativeEnter) (THIS_ - IRMACallback* pCallback, - UINT32 ms) PURE; - - /************************************************************************ - * Method: - * IRMAScheduler::AbsoluteEnter - * Purpose: - * Schedule a callback to be executed at time "tVal". - */ - STDMETHOD_(CallbackHandle,AbsoluteEnter) (THIS_ - IRMACallback* pCallback, - RMATimeval tVal) PURE; - - /************************************************************************ - * Method: - * IRMAScheduler::Remove - * Purpose: - * Remove a callback from the scheduler. - */ - STDMETHOD(Remove) (THIS_ - CallbackHandle Handle) PURE; - - /************************************************************************ - * Method: - * IRMAScheduler::GetCurrentSchedulerTime - * Purpose: - * Gives the current time (in the timeline of the scheduler). - */ - STDMETHOD_(RMATimeval,GetCurrentSchedulerTime) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMATCPResponse - * - * Purpose: - * - * This is the response interface for the asynchronous TCP networking - * interface. - * - * IID_IRMATCPResponse: - * - * {00000102-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMATCPResponse, 0x00000102, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMATCPResponse - -DECLARE_INTERFACE_(IRMATCPResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMATCPResponse methods - */ - - /************************************************************************ - * Method: - * IRMATCPResponse::ConnectDone - * Purpose: - * A Connect operation has been completed or an error has occurred. - */ - STDMETHOD(ConnectDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMATCPResponse::ReadDone - * Purpose: - * A Read operation has been completed or an error has occurred. - * The data is returned in the IRMABuffer. - */ - STDMETHOD(ReadDone) (THIS_ - PN_RESULT status, - IRMABuffer* pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMATCPResponse::WriteReady - * Purpose: - * This is the response method for WantWrite. - * If PN_RESULT is ok, then the TCP channel is ok to Write to. - */ - STDMETHOD(WriteReady) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMATCPResponse::Closed - * Purpose: - * This method is called to inform you that the TCP channel has - * been closed by the peer or closed due to error. - */ - STDMETHOD(Closed) (THIS_ - PN_RESULT status) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMATCPSocket - * - * Purpose: - * - * Provides the user with an asynchronous TCP networking interface. - * - * IID_IRMATCPSocket: - * - * {00000103-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMATCPSocket, 0x00000103, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMATCPSocket - -DECLARE_INTERFACE_(IRMATCPSocket, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMATCPSocket methods - * - * Network addresses and ports are in native byte order - * - */ - - STDMETHOD(Init) (THIS_ - IRMATCPResponse* /*IN*/ pTCPResponse) PURE; - - STDMETHOD(SetResponse) (THIS_ - IRMATCPResponse* pTCPResponse) PURE; - - STDMETHOD(Bind) (THIS_ - UINT32 ulLocalAddr, - UINT16 nPort) PURE; - - /* - * pDestination is a string containing host name or dotted-ip notation - */ - STDMETHOD(Connect) (THIS_ - const char* pDestination, - UINT16 nPort) PURE; - - STDMETHOD(Read) (THIS_ - UINT16 Size) PURE; - - STDMETHOD(Write) (THIS_ - IRMABuffer* pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMATCPSocket::WantWrite - * Purpose: - * This method is called when you wish to write a large amount of - * data. If you are only writing small amounts of data, you can - * just call Write (all data not ready to be transmitted will be - * buffered on your behalf). When the TCP channel is ready to be - * written to, the response interfaces WriteReady method will be - * called. - */ - STDMETHOD(WantWrite) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMATCPSocket::GetForeignAddress - * Purpose: - * Returns the address of the other end of the TCP socket as a - * ULONG32 in local host order - */ - STDMETHOD(GetForeignAddress) (THIS_ - REF(ULONG32) lAddress) PURE; - - STDMETHOD(GetLocalAddress) (THIS_ - REF(ULONG32) lAddress) PURE; - - /************************************************************************ - * Method: - * IRMATCPSocket::GetForeignPort - * Purpose: - * Returns the port of the other end of the TCP socket in local - * host order. - */ - STDMETHOD(GetForeignPort) (THIS_ - REF(UINT16) port) PURE; - - STDMETHOD(GetLocalPort) (THIS_ - REF(UINT16) port) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAListenResponse - * - * Purpose: - * - * This is the response interface for the asynchronous TCP listening - * socket interface. - * - * IID_IRMAListenResponse: - * - * {00000104-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAListenResponse, 0x00000104, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAListenResponse - -DECLARE_INTERFACE_(IRMAListenResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAListenResponse methods - */ - - STDMETHOD(NewConnection) (THIS_ - PN_RESULT status, - IRMATCPSocket* pTCPSocket) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAListenSocket - * - * Purpose: - * - * This interfaces allows you to asynchronously listen on a port for - * TCP connections. - * - * IID_IRMAListenSocket: - * - * {00000105-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAListenSocket, 0x00000105, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAListenSocket - -DECLARE_INTERFACE_(IRMAListenSocket, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAListenSocket methods - */ - - STDMETHOD(Init) (THIS_ - UINT32 ulLocalAddr, - UINT16 port, - IRMAListenResponse* /*IN*/ pListenResponse - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMANetworkServices - * - * Purpose: - * - * This is a factory interface for the various types of networking - * interfaces described above. - * - * IID_IRMANetworkServices: - * - * {00000106-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMANetworkServices, 0x00000106, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMANetworkServices - -DECLARE_INTERFACE_(IRMANetworkServices, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMANetworkServices methods - */ - - /************************************************************************ - * Method: - * IRMANetworkServices::CreateTCPSocket - * Purpose: - * Create a new TCP socket. - */ - STDMETHOD(CreateTCPSocket) (THIS_ - IRMATCPSocket** /*OUT*/ ppTCPSocket) PURE; - - /************************************************************************ - * Method: - * IRMANetworkServices::CreateUDPSocket - * Purpose: - * Create a new UDP socket. - */ - STDMETHOD(CreateUDPSocket) (THIS_ - IRMAUDPSocket** /*OUT*/ ppUDPSocket) PURE; - - /************************************************************************ - * Method: - * IRMANetworkServices::CreateListenSocket - * Purpose: - * Create a new TCP socket that will listen for connections on a - * particular port. - */ - STDMETHOD(CreateListenSocket) (THIS_ - IRMAListenSocket** /*OUT*/ ppListenSocket - ) PURE; - - /************************************************************************ - * Method: - * IRMANetworkServices::CreateResolver - * Purpose: - * Create a new resolver that can lookup host names - */ - STDMETHOD(CreateResolver) (THIS_ - IRMAResolver** /*OUT*/ ppResolver) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMANetworkServices2 - * - * Purpose: - * - * This is a factory interface for the various types of networking - * interfaces described above. - * - * IID_IRMANetworkServices: - * - * {17951551-5683-11d3-B6BA-00C0F031C237} - * - */ - -// {17951551-5683-11d3-B6BA-00C0F031C237} -DEFINE_GUID(IID_IRMANetworkServices2, 0x17951551, 0x5683, 0x11d3, 0xb6, 0xba, 0x0, 0xc0, 0xf0, 0x31, 0xc2, 0x37); - -#undef INTERFACE -#define INTERFACE IRMANetworkServices2 - -DECLARE_INTERFACE_(IRMANetworkServices2, IRMANetworkServices) -{ - /************************************************************************ - * Method: - * IRMANetworkServices2::CreateLBoundTCPSocket - * Purpose: - * Create a new local bound TCP socket. - */ - STDMETHOD(CreateLBoundTCPSocket) (THIS_ - IRMATCPSocket** /*OUT*/ ppTCPSocket) PURE; -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMAUDPResponse - * - * Purpose: - * - * This is the response interface for the asynchronous UDP networking - * interface. - * - * IID_IRMAUDPResponse: - * - * {00000107-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAUDPResponse, 0x00000107, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUDPResponse - -DECLARE_INTERFACE_(IRMAUDPResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAUDPResponse methods - */ - - STDMETHOD(ReadDone) (THIS_ - PN_RESULT status, - IRMABuffer* pBuffer, - ULONG32 ulAddr, - UINT16 nPort) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUDPSocket - * - * Purpose: - * - * Provides the user with an asynchronous UDP networking interface. - * - * IID_IRMAUDPSocket: - * - * {00000108-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAUDPSocket, 0x00000108, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUDPSocket - -DECLARE_INTERFACE_(IRMAUDPSocket, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAUDPSocket methods - * - * Network addresses and ports are in native byte order - */ - - STDMETHOD(Init) (THIS_ - ULONG32 ulAddr, - UINT16 nPort, - IRMAUDPResponse* pUDPResponse) PURE; - - STDMETHOD(Bind) (THIS_ - UINT32 ulLocalAddr, - UINT16 nPort) PURE; - - STDMETHOD(Read) (THIS_ - UINT16 Size) PURE; - - STDMETHOD(Write) (THIS_ - IRMABuffer* pBuffer) PURE; - - STDMETHOD(WriteTo) (THIS_ - ULONG32 ulAddr, - UINT16 nPort, - IRMABuffer* pBuffer) PURE; - - STDMETHOD(GetLocalPort) (THIS_ - REF(UINT16) port) PURE; - - STDMETHOD(JoinMulticastGroup) (THIS_ - ULONG32 ulMulticastAddr, - ULONG32 ulInterfaceAddr) PURE; - - STDMETHOD(LeaveMulticastGroup) (THIS_ - ULONG32 ulMulticastAddr, - ULONG32 ulInterfaceAddr) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAResolver - * - * Purpose: - * - * This interface allows you to asynchronously resolve hostnames. - * - * IID_IRMAResolver: - * - * {00000109-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAResolver, 0x00000109, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAResolver - -DECLARE_INTERFACE_(IRMAResolver, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAResolver methods - */ - - STDMETHOD(Init) (THIS_ - IRMAResolverResponse* pResponse) PURE; - - STDMETHOD(GetHostByName) (THIS_ - const char* pHostName) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAResolverResponse - * - * Purpose: - * - * This is the response interface for the asynchronous DNS hostname - * resolver. - * - * IID_IRMAResolverResponse: - * - * {0000010A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAResolverResponse, 0x0000010A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAResolverResponse - -DECLARE_INTERFACE_(IRMAResolverResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAResolverResponse methods - */ - - STDMETHOD(GetHostByNameDone) (THIS_ - PN_RESULT status, - ULONG32 ulAddr) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAInterruptSafe - * - * Purpose: - * - * This interface is used in Macintosh implementations of callback - * functions, renderers, etc... to determine if interrupt time execution - * is supported. If this interface is not implemented then it is assumed - * that interrupt time execution is NOT supported. There are restrictions - * on what may be executed at interrupt time; please consult the Macintosh - * Deferred Task Manager tech notes from Apple. - * - * IID_IRMAInterruptSafe: - * - * {0000010B-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAInterruptSafe, 0x0000010B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAInterruptSafe - -DECLARE_INTERFACE_(IRMAInterruptSafe, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAInterruptSafe methods - */ - - /************************************************************************ - * Method: - * IRMAInterruptSafe::IsInterruptSafe - * Purpose: - * This is the function that will be called to determine if - * interrupt time execution is supported. - */ - STDMETHOD_(BOOL,IsInterruptSafe) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAAsyncIOSelection - * - * Purpose: - * - * This interface is implemented by the server/player context on Unix - * platforms. This interface allows your plugin to get callbacks based - * I/O events that are normally handled by select(). This interface - * allows you to setup callbacks which will be executed when a file - * descriptor is ready for reading, writing, or has an exception. - * - * IID_IRMAAsyncIOSelection: - * - * {0000010C-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAAsyncIOSelection, 0x0000010C, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAAsyncIOSelection - -DECLARE_INTERFACE_(IRMAAsyncIOSelection, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAAsyncIOSelection methods - */ - - /************************************************************************ - * Method: - * IRMAAsyncIOSelection::Add - * Purpose: - * This function will allow you to receive a callback when the - * given descriptor is ready for read, write, or has an - * exception. This function is only available on Unix, and is - * intended to replace the functionality of select(). - */ - STDMETHOD(Add) (THIS_ - IRMACallback* pCallback, - INT32 lFileDescriptor, - UINT32 ulType) PURE; - - /************************************************************************ - * Method: - * IRMAAsyncIOSelection::Remove - * Purpose: - * This function will allow you remove the callback associated - * with the given descriptor from the event handler. - * This function is only available on Unix, and is intended to - * replace the functionality of select(). - */ - STDMETHOD(Remove) (THIS_ - INT32 lFileDescriptor, - UINT32 ulType) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUDPMulticastInit - * - * Purpose: - * - * Provides the user with a way to set the TTL for outgoing multicast - * UDP packets. Usually shared with IRMAUDPSocket. - * - * IID_IRMAUDPMulticastInit: - * - * {0000010D-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAUDPMulticastInit, 0x0000010D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUDPMulticastInit - -DECLARE_INTERFACE_(IRMAUDPMulticastInit, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAUDPMulticastInit methods - * - */ - - /************************************************************************ - * Method: - * IRMAUDPMulticastInit::InitMulticast - * Purpose: - * This function will set the TTL (time to live) for the UDP socket - * so it can be used as a multicast socket, sending packets across - * the number of routers specified in the ulTTL parameter. - */ - - STDMETHOD(InitMulticast) (THIS_ - UINT8 chTTL) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAInterruptState - * - * Purpose: - * - * This interface is used in Macintosh implementations to inform the - * the client engine when entering & leaving an interupt task. It is - * also used to determine if it is currently at interrupt time. - * Please consult the Macintosh Deferred Task Manager tech notes from Apple - * for information on interrupt tasks. - * - * IID_IRMAInterruptState: - * - * {0000010E-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAInterruptState, 0x0000010E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAInterruptState - -DECLARE_INTERFACE_(IRMAInterruptState, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAInterruptState methods - */ - - /************************************************************************ - * Method: - * IRMAInterruptState::AtInterruptTime - * Purpose: - * This function is called to determine if we are currently at - * interrupt task time. - */ - STDMETHOD_(BOOL,AtInterruptTime) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAInterruptState::EnterInterruptState - * Purpose: - * This function is called when starting a deferred/interrupt task - */ - STDMETHOD(EnterInterruptState) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAInterruptState::LeaveInterruptState - * Purpose: - * This function is called when leaving a deferred/interrupt task - */ - STDMETHOD(LeaveInterruptState) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAInterruptState::EnableInterrupt - * Purpose: - * This function can be called to enable/disable interrupt time - * processsing - */ - STDMETHOD(EnableInterrupt) (THIS_ - BOOL bEnable) PURE; - - /************************************************************************ - * Method: - * IRMAInterruptState::IsInterruptEnabled - * Purpose: - * This function can be called to find if the core is currently - * interrupt enabled. - */ - STDMETHOD_(BOOL, IsInterruptEnabled) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAOptimizedScheduler - * - * Purpose: - * - * This interface provides the user with a way of scheduling callbacks - * that will be executed at some time in the future. - * - * This interface should ONLY be used if you need accurately timed - * callbacks. These callbacks should be efficient and should not consume - * much time/CPU. This is not a thread safe interface. The user has to - * take care of synchronization in their callbacks. - * - * IID_IRMAOptimizedScheduler: - * - * {0000010F-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAOptimizedScheduler, 0x0000010F, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAOptimizedScheduler - -DECLARE_INTERFACE_(IRMAOptimizedScheduler, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAOptimizedScheduler methods - */ - - /************************************************************************ - * Method: - * IRMAOptimizedScheduler::RelativeEnter - * Purpose: - * Schedule a callback to be executed "ms" milliseconds from now - * This function is less percise then AbsoluteEnter and should only - * be used when accurate timing is not critical. - */ - STDMETHOD_(CallbackHandle,RelativeEnter) (THIS_ - IRMACallback* pCallback, - UINT32 ms) PURE; - - /************************************************************************ - * Method: - * IRMAOptimizedScheduler::AbsoluteEnter - * Purpose: - * Schedule a callback to be executed at time "tVal". - */ - STDMETHOD_(CallbackHandle,AbsoluteEnter) (THIS_ - IRMACallback* pCallback, - RMATimeval tVal) PURE; - - /************************************************************************ - * Method: - * IRMAOptimizedScheduler::Remove - * Purpose: - * Remove a callback from the scheduler. - */ - STDMETHOD(Remove) (THIS_ - CallbackHandle Handle) PURE; - - /************************************************************************ - * Method: - * IRMAOptimizedScheduler::GetCurrentSchedulerTime - * Purpose: - * Gives the current time (in the timeline of the scheduler). - */ - STDMETHOD_(RMATimeval,GetCurrentSchedulerTime) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMALoadBalancedListen - * - * Purpose: - * - * This interface is queried off of IRMAListenSocket. It allows - * a plugin to specify that it wants the server to load balance - * multiple instances of itself. The server will instantiate multiple - * instances of the plugin as needed based on socket / descriptor limits. - * Each plugin instance should attempt to listen on the same port as - * other instances (they will share the port). - * - * IID_IRMALoadBalancedListen: - * - * {00000110-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMALoadBalancedListen, 0x00000110, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMALoadBalancedListen - -DECLARE_INTERFACE_(IRMALoadBalancedListen, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMALoadBalancedListen methods - */ - - /************************************************************************ - * Method: - * IRMALoadBalancedListen::SetID - * Purpose: - * This function set's the unique ID for this listen socket. This - * ID is used to determine whether or not different instances of - * a plugin trying to listen on a single port are actually the - * same plugin. Without this function, it would be possible for - * two completely different plugins to listen on the same port using - * the load balanced listener. - */ - STDMETHOD(SetID) (THIS_ - REFIID ID) PURE; - - /************************************************************************ - * Method: - * IRMALoadBalancedListen::SetReserveLimit - * Purpose: - * Sets the reserve limit for descriptors / sockets. If less - * than reserve limit descriptors / sockets are left then a new - * instance of the plugin will be created. - */ - STDMETHOD(SetReserveLimit) (THIS_ - UINT32 ulDescriptors, - UINT32 ulSockets) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAOverrideDefaultServices - * - * Purpose: - * - * This interface is queried off of the context. It allows - * a plugin to override any default services provided by the G2 system. - * Currently, it is supported only on the client side. - * You may currently override IRMANetworkServices using this interface - * You can use the same interface to later restore back the overriden services. - * This is done by calling the same OverrideServices() function with the - * original service QIed before the initial override. - * - * IID_IRMAOverrideDefaultServices: - * - * {00000111-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAOverrideDefaultServices, 0x00000111, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAOverrideDefaultServices - -DECLARE_INTERFACE_(IRMAOverrideDefaultServices, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAOverrideDefaultServices methods - */ - - /************************************************************************ - * Method: - * IRMAOverrideDefaultServices::OverrideServices - * Purpose: - * Override default services provided by the G2 system. - * - */ - STDMETHOD(OverrideServices) (THIS_ - IUnknown* pContext) PURE; -}; - -enum PN_SOCKET_OPTION -{ - PN_SOCKOPT_REUSE_ADDR, - PN_SOCKOPT_REUSE_PORT, - PN_SOCKOPT_BROADCAST, - PN_SOCKOPT_SET_RECVBUF_SIZE, - PN_SOCKOPT_SET_SENDBUF_SIZE -}; - -/**************************************************************************** - * - * Interface: - * - * IRMASetSocketOption - * - * Purpose: - * - * Set sockt option - * - * IID_IRMASetSocketOption: - * - * IID_IRMASetSocketOption: {00000114-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASetSocketOption, - 0x00000114, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASetSocketOption -DECLARE_INTERFACE_(IRMASetSocketOption, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAListenSocket methods - */ - - STDMETHOD(SetOption) (THIS_ - PN_SOCKET_OPTION option, - UINT32 ulValue) PURE; -}; - -#define RMA_THREADSAFE_METHOD_FF_GETPACKET 0x00000001 -/* - * FileFormat::GetPacket() only calls: - * CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, - * FS->Read(), FS->Close(), FS->Seek(), - * FFR->PacketReady(), FFR->StreamDone() - * Context->Scheduler->*, - * CCF->CI(Mutex), Mutex->* - * Context->ErrorMessages - * - * XXXSMPNOW - */ - -#define RMA_THREADSAFE_METHOD_FS_READ 0x00000002 -/* - * FileSystem::Read()/Seek()/Close() only calls: - * CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, - * FS->Read(), FS->Close(), FS->Seek(), - * Context->Scheduler->*, - * CCF->CI(Mutex), Mutex->* - * Context->ErrorMessages - * - * XXXSMPNOW - */ -#define RMA_THREADSAFE_METHOD_FSR_READDONE 0x00000004 -/* - * FileFormat::ReadDone()/SeekDone()/CloseDone() only calls: - * CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, - * FS->Read(), FS->Close(), FS->Seek(), - * FFR->PacketReady(), FFR->StreamDone() - * Context->Scheduler->*, - * CCF->CI(Mutex), Mutex->* - * Context->ErrorMessages - * - * XXXSMPNOW - */ -#define RMA_THREADSAFE_METHOD_CACHE_FILE 0x00000008 -/* - * FileSystem::Read()/Seek()/Close() only calls: - * CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, - * FS->Read(), FS->Close(), FS->Seek(), - * IRMACacheFile->*, IRMACacheFileResponse->*, - * Context->Scheduler->*, - * CCF->CI(Mutex), Mutex->* - * Context->ErrorMessages - * - * XXXSMPNOW - */ -#define RMA_THREADSAFE_METHOD_CACHE_FILE_RESPONSE 0x00000010 -/* - * FileSystem::Read()/Seek()/Close() only calls: - * CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, - * FS->Read(), FS->Close(), FS->Seek(), - * IRMACacheFile->*, IRMACacheFileResponse->*, - * Context->Scheduler->*, - * CCF->CI(Mutex), Mutex->* - * Context->ErrorMessages - * - * XXXSMPNOW - */ - -/**************************************************************************** - * - * Interface: - * - * IRMAThreadSafeMethods - * - * Purpose: - * - * XXXSMPNOW - * - * IID_IRMAThreadSafeMethods: - * - * {00000115-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAThreadSafeMethods, 0x00000115, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAThreadSafeMethods - -DECLARE_INTERFACE_(IRMAThreadSafeMethods, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAThreadSafeMethods methods - */ - - /************************************************************************ - * Method: - * IRMAThreadSafeMethods::IsThreadSafe - * Purpose: - * XXXSMPNOW - */ - STDMETHOD_(UINT32,IsThreadSafe) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAMutex - * - * Purpose: - * - * XXXSMPNOW - * - * IID_IRMAMutex: - * - * {00000116-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAMutex, 0x00000116, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAMutex - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_IRMAMutex IID_IRMAMutex - -DECLARE_INTERFACE_(IRMAMutex, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAMutex methods - */ - - /* XXXSMPNOW Comments */ - STDMETHOD(Lock) (THIS) PURE; - - STDMETHOD(TryLock) (THIS) PURE; - - STDMETHOD(Unlock) (THIS) PURE; -}; - - -#endif /* _RMAENGIN_H_ */ diff --git a/include/realmedia/rmaerror.h b/include/realmedia/rmaerror.h deleted file mode 100644 index c923c5a33..000000000 --- a/include/realmedia/rmaerror.h +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaerror.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture error reporting interfaces. - * - */ - -#ifndef _RMAERROR_H_ -#define _RMAERROR_H_ - -/* - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAErrorSinkControl IRMAErrorSinkControl; - - -/* Message Severity values */ - -enum { - PNLOG_EMERG = 0, /* A panic condition. Server / Player will halt or - restart. */ - - PNLOG_ALERT = 1, /* A condition that should be corrected immediately. - Needs user intervention to prevent problems. */ - - PNLOG_CRIT = 2, /* Critical conditions. */ - - PNLOG_ERR = 3, /* Errors. */ - - PNLOG_WARNING = 4, /* Warning messages. */ - - PNLOG_NOTICE = 5, /* Conditions that are not error conditions, but - should possibly be handled specially. */ - - PNLOG_INFO = 6, /* Informational messages. */ - - PNLOG_DEBUG = 7 /* Messages that contain information normally of use - only when debugging a program. */ -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAErrorMessages - * - * Purpose: - * - * Error, event, and status message reporting interface - * - * IID_IRMAErrorMessages: - * - * {00000800-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAErrorMessages, 0x00000800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAErrorMessages - -DECLARE_INTERFACE_(IRMAErrorMessages, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAErrorMessages methods - */ - - /************************************************************************ - * Method: - * IRMAErrorMessages::Report - * Purpose: - * Call this method to report an error, event, or status message. - * Parameters: - * - * const UINT8 unSeverity - * Type of report. This value will impact how the player, tool, or - * server will react to the report. Possible values are described - * above. Depending on the error type, an error message with the - * RMA code, anda string translation of that code will be displayed. - * The error dialog includes a "more info" section that displays the - * user code and string, and a link to the more info URL. In the - * server these messages are logged to the log file. - * - * const ULONG32 ulRMACode - * Well known RMA error code. This will be translated to a text - * representation for display in an error dialog box or log file. - * - * const ULONG32 ulUserCode - * User specific error code. This will NOT be translated to a text - * representation. This can be any value the caller wants, it will - * be logged or displayed but not interpretted. - * - * const char* pUserString - * User specific error string. This will NOT be translated or - * modified. This can be any value the caller wants, it will - * be logged or displayed but not interpretted. - * - * const char* pMoreInfoURL - * User specific more info URL string. - * - */ - STDMETHOD(Report) (THIS_ - const UINT8 unSeverity, - PN_RESULT ulRMACode, - const ULONG32 ulUserCode, - const char* pUserString, - const char* pMoreInfoURL) PURE; - - /************************************************************************ - * Method: - * IRMAErrorMessages::GetErrorText - * Purpose: - * Call this method to get the text description of a RMA error code. - * Parameters: - * PN_RESULT ulRMACode (A RMA error code) - * Return Value: - * IRMABuffer* containing error text. - */ - STDMETHOD_(IRMABuffer*, GetErrorText) (THIS_ - PN_RESULT ulRMACode) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAErrorSink - * - * Purpose: - * - * Error Sink Interface - * - * IID_IRMAErrorSink: - * - * {00000801-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAErrorSink, 0x00000801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAErrorSink - -DECLARE_INTERFACE_(IRMAErrorSink, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAErrorSink methods - */ - - /************************************************************************ - * Method: - * IRMAErrorSink::ErrorOccurred - * Purpose: - * After you have registered your error sink with an - * IRMAErrorSinkControl (either in the server or player core) this - * method will be called to report an error, event, or status message. - * - * The meaning of the arguments is exactly as described in - * rmaerror.h - */ - STDMETHOD(ErrorOccurred) (THIS_ - const UINT8 unSeverity, - const ULONG32 ulRMACode, - const ULONG32 ulUserCode, - const char* pUserString, - const char* pMoreInfoURL - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAErrorSinkControl - * - * Purpose: - * - * Error Sink Control Interface - * - * IID_IRMAErrorSinkControl: - * - * {00000802-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAErrorSinkControl, 0x00000802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAErrorSinkControl - - -DECLARE_INTERFACE_(IRMAErrorSinkControl, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAErrorSinkControl methods - */ - - /************************************************************************ - * Method: - * IRMAErrorSinkControl::AddErrorSink - * Purpose: - * Call this method to tell the sink controller to handle an error - * sink. - * - * This method also allows you to set a range of severity levels which - * you will receive reports for. - * - * Note: You should specify an invalid range (Low = 1, High = 0 for - * example) if you don't want to receive any errors. - * - * The default severity range is PNLOG_EMERG to PNLOG_INFO (0-6). - */ - STDMETHOD(AddErrorSink) (THIS_ - IRMAErrorSink* pErrorSink, - const UINT8 unLowSeverity, - const UINT8 unHighSeverity) PURE; - - /************************************************************************ - * Method: - * IRMAErrorSinkControl::AddErrorSink - * Purpose: - * Call this method to remove an error sink. - */ - STDMETHOD(RemoveErrorSink) (THIS_ - IRMAErrorSink* pErrorSink) PURE; - -}; - -#endif /* _RMAERROR_H_ */ diff --git a/include/realmedia/rmaevent.h b/include/realmedia/rmaevent.h deleted file mode 100644 index 6a0ee2fc3..000000000 --- a/include/realmedia/rmaevent.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaevent.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * This program contains proprietary information of RealNetworks, Inc., - * and is licensed subject to restrictions on use and distribution. - * - * rmaevent.h - * - */ - -#ifndef _RMAEVENT_H_ -#define _RMAEVENT_H_ - -#define RMA_BASE_EVENT 0x00001000UL - -// This class of events are events sent to site users of windowless -// sites to notify them of events on the site with platform independent -// messages. -#define RMA_SURFACE_EVENTS RMA_BASE_EVENT + 0x00001000 - -// RMA_SURFACE_UPDATE is sent by the site to the renderer when the -// surface has damage and needs to be updated. The event struct is -// filled out as follows: -// -// ULONG32 event; RMA_SURFACE_UPDATE -// void* window; Native Window - may be null if no window is associated with the site -// void* param1; IRMAVideoSurface* -// void* param2; UNIX - PNxWindow, Mac/Win - UNUSED -// -// void* result; HRESULT result code of message handling -// BOOL handled; TRUE if handled, FALSE if not handled -// -#define RMA_SURFACE_UPDATE RMA_SURFACE_EVENTS + 1 - -// Each event should document the values of PNxEvent struct expected -// on input and output. -// The next surface event should use this ID: -#define RMA_SURFACE_NEXT_EVENT RMA_SURFACE_EVENTS + 2 - -// This class of events are sent to site users to -// notify them of mouse events. -// All mouse events have the event structure filled out as follows: -// -// UINT32 event; -// void* window; -// void* param1; PNxPoint struct with mouse position local to the renderer -// void* param2; UINT32 of flags for modifier keys -// void* result; HRESULT result code of message handling -// BOOL handled; TRUE if handled, FALSE if not handled -// -#define RMA_MOUSE_EVENTS (RMA_BASE_EVENT + 0x00002000) - -#define RMA_SHIFT_KEY 0x00000001 -#define RMA_CTRL_KEY 0x00000002 -#define RMA_ALT_COMMAND_KEY 0x00000004 // Apple/Splat key - -#define RMA_PRIMARY_BUTTON_DOWN (RMA_MOUSE_EVENTS + 1) -#define RMA_PRIMARY_BUTTON_UP (RMA_MOUSE_EVENTS + 2) -#define RMA_CONTEXT_BUTTON_DOWN (RMA_MOUSE_EVENTS + 3) -#define RMA_CONTEXT_BUTTON_UP (RMA_MOUSE_EVENTS + 4) -#define RMA_MOUSE_MOVE (RMA_MOUSE_EVENTS + 5) -#define RMA_MOUSE_ENTER (RMA_MOUSE_EVENTS + 6) -#define RMA_MOUSE_LEAVE (RMA_MOUSE_EVENTS + 7) - -// This class of events are sent to renderers to -// notify them of the validation of the window -// All window events have the event structure filled out as follows: -// -// UINT32 event; -// void* window; -// void* UNUSED; -// void* UNUSED; -// void* result; HRESULT result code of message handling -// BOOL handled; TRUE if handled, FALSE if not handled -// -#define RMA_WINDOW_EVENTS RMA_BASE_EVENT + 0x00003000 - -#define RMA_ATTACH_WINDOW RMA_WINDOW_EVENTS + 1 -#define RMA_DETACH_WINDOW RMA_WINDOW_EVENTS + 2 - -// Each event class should have a comment describing the kinds -// of events that belong to this class -// The next event class should use this base: -#define RMA_NEXT_EVENT_CLASS RMA_BASE_EVENT + 0x00004000 - - -#endif // _RMAEVENT_H_ diff --git a/include/realmedia/rmafiles.h b/include/realmedia/rmafiles.h deleted file mode 100644 index 33e8b5a32..000000000 --- a/include/realmedia/rmafiles.h +++ /dev/null @@ -1,1583 +0,0 @@ -/**************************************************************************** - * - * $Id: rmafiles.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture File Format and File System Plug-in Interfaces. - * - */ - -#ifndef _RMAFILES_H_ -#define _RMAFILES_H_ - -/* - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMAFileObject IRMAFileObject; -typedef _INTERFACE IRMAFileResponse IRMAFileResponse; -typedef _INTERFACE IRMAFileSystemObject IRMAFileSystemObject; -typedef _INTERFACE IRMAFileStat IRMAFileStat; -typedef _INTERFACE IRMAFileStatResponse IRMAFileStatResponse; - -typedef _INTERFACE IRMAFileSystemManager IRMAFileSystemManager; -typedef _INTERFACE IRMAFileSystemManagerResponse IRMAFileSystemManagerResponse; -typedef _INTERFACE IRMAFileExists IRMAFileExists; -typedef _INTERFACE IRMAFileExistsResponse IRMAFileExistsResponse; -typedef _INTERFACE IRMAFileMimeMapper IRMAFileMimeMapper; -typedef _INTERFACE IRMAFileMimeMapperResponse IRMAFileMimeMapperResponse; -typedef _INTERFACE IRMABroadcastMapper IRMABroadcastMapper; -typedef _INTERFACE IRMABroadcastMapperResponse IRMABroadcastMapperResponse; -typedef _INTERFACE IRMAGetFileFromSamePoolResponse IRMAGetFileFromSamePoolResponse; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAMetaCreation IRMAMetaCreation; - -typedef _INTERFACE IRMAAuthenticator IRMAAuthenticator; -typedef _INTERFACE IRMARequest IRMARequest; -typedef _INTERFACE IRMAFileRename IRMAFileRename; -typedef _INTERFACE IRMADirHandler IRMADirHandler; -typedef _INTERFACE IRMADirHandlerResponse IRMADirHandlerResponse; -typedef _INTERFACE IRMAFileRemove IRMAFileRemove; - - - -/**************************************************************************** - * Defines: - * PN_FILE_XXXX - * Purpose: - * Flags for opening file objects - */ -#define PN_FILE_READ 1 -#define PN_FILE_WRITE 2 -#define PN_FILE_BINARY 4 -#define PN_FILE_NOTRUNC 8 - - -/**************************************************************************** - * Defines: - * RMA_FILEADVISE_XXXX - * Purpose: - * Flags for file object Advise method - */ -#define RMA_FILEADVISE_RANDOMACCESS 1 - - -#if defined(_UNIX) || defined(_WINDOWS) -#include -/* - * This is a subset of standard stat()/fstat() values that both Unix and - * Windows support (or at least define). - * - * These flags are returned from IRMAFileStatResponse::StatDone() in the - * ulMode argument. - */ -#define PN_S_IFMT S_IFMT -#define PN_S_IFDIR S_IFDIR -#define PN_S_IFCHR S_IFCHR -#define PN_S_IFIFO S_IFIFO -#define PN_S_IFREG S_IFREG -#else -/* Macintosh */ -#define PN_S_IFMT 0170000 -#define PN_S_IFDIR 0040000 -#define PN_S_IFCHR 0020000 -#define PN_S_IFIFO 0010000 -#define PN_S_IFREG 0100000 -#endif - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileObject - * - * Purpose: - * - * Object that exports file control API - * - * IID_IRMAFileObject: - * - * {00000200-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileObject, 0x00000200, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileObject - -DECLARE_INTERFACE_(IRMAFileObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileObject methods - */ - - /************************************************************************ - * Method: - * IRMAFileObject::Init - * Purpose: - * Associates a file object with the file response object it should - * notify of operation completness. This method should also check - * for validity of the object (for example by opening it if it is - * a local file). - */ - STDMETHOD(Init) (THIS_ - ULONG32 /*IN*/ ulFlags, - IRMAFileResponse* /*IN*/ pFileResponse) PURE; - - /************************************************************************ - * Method: - * IRMAFileObject::GetFilename - * Purpose: - * Returns the filename (without any path information) associated - * with a file object. - * - * Note: The returned pointer's lifetime expires as soon as the - * caller returns from a function which was called from the RMA - * core (i.e. when you return control to the RMA core) - * - */ - STDMETHOD(GetFilename) (THIS_ - REF(const char*) /*OUT*/ pFilename) PURE; - - /************************************************************************ - * Method: - * IRMAFileObject::Close - * Purpose: - * Closes the file resource and releases all resources associated - * with the object. - */ - STDMETHOD(Close) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAFileObject::Read - * Purpose: - * Reads a buffer of data of the specified length from the file - * and asynchronously returns it to the caller via the - * IRMAFileResponse interface passed in to Init. - */ - STDMETHOD(Read) (THIS_ - ULONG32 ulCount) PURE; - - /************************************************************************ - * Method: - * IRMAFileObject::Write - * Purpose: - * Writes a buffer of data to the file and asynchronously notifies - * the caller via the IRMAFileResponse interface passed in to Init, - * of the completeness of the operation. - */ - STDMETHOD(Write) (THIS_ - IRMABuffer* pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMAFileObject::Seek - * Purpose: - * Seeks to an offset in the file and asynchronously notifies - * the caller via the IRMAFileResponse interface passed in to Init, - * of the completeness of the operation. - * If the bRelative flag is TRUE, it is a relative seek; else - * an absolute seek. - */ - STDMETHOD(Seek) (THIS_ - ULONG32 ulOffset, - BOOL bRelative) PURE; - - /************************************************************************ - * Method: - * IRMAFileObject::Advise - * Purpose: - * To pass information to the File Object advising it about usage - * heuristics. - */ - STDMETHOD(Advise) (THIS_ - ULONG32 ulInfo) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileResponse - * - * Purpose: - * - * Object that exports file response API - * - * IID_IRMAFileResponse: - * - * {00000201-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileResponse, 0x00000201, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileResponse - -DECLARE_INTERFACE_(IRMAFileResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileResponse methods - */ - - /************************************************************************ - * Method: - * IRMAFileResponse::InitDone - * Purpose: - * Notification interface provided by users of the IRMAFileObject - * interface. This method is called by the IRMAFileObject when the - * initialization of the file is complete. If the file is not valid - * for the file system, the status PNR_FAILED should be - * returned. - */ - STDMETHOD(InitDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMAFileResponse::CloseDone - * Purpose: - * Notification interface provided by users of the IRMAFileObject - * interface. This method is called by the IRMAFileObject when the - * close of the file is complete. - */ - STDMETHOD(CloseDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMAFileResponse::ReadDone - * Purpose: - * Notification interface provided by users of the IRMAFileObject - * interface. This method is called by the IRMAFileObject when the - * last read from the file is complete and a buffer is available. - */ - STDMETHOD(ReadDone) (THIS_ - PN_RESULT status, - IRMABuffer* pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMAFileResponse::WriteDone - * Purpose: - * Notification interface provided by users of the IRMAFileObject - * interface. This method is called by the IRMAFileObject when the - * last write to the file is complete. - */ - STDMETHOD(WriteDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMAFileResponse::SeekDone - * Purpose: - * Notification interface provided by users of the IRMAFileObject - * interface. This method is called by the IRMAFileObject when the - * last seek in the file is complete. - */ - STDMETHOD(SeekDone) (THIS_ - PN_RESULT status) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileSystemObject - * - * Purpose: - * - * Object that allows a Controller to communicate with a specific - * File System plug-in session - * - * IID_IRMAFileSystemObject: - * - * {00000202-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileSystemObject, 0x00000202, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileSystemObject - -DECLARE_INTERFACE_(IRMAFileSystemObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileSystemObject methods - */ - - /************************************************************************ - * Method: - * IRMAFileSystemObject::GetFileSystemInfo - * Purpose: - * Returns information vital to the instantiation of file system - * plugin. - * - * pShortName should be a short, human readable name in the form - * of "company-fsname". For example: pShortName = "pn-local". - */ - STDMETHOD(GetFileSystemInfo) (THIS_ - REF(const char*) /*OUT*/ pShortName, - REF(const char*) /*OUT*/ pProtocol) PURE; - - STDMETHOD(InitFileSystem) (THIS_ - IRMAValues* pOptions) PURE; - - STDMETHOD(CreateFile) (THIS_ - IUnknown** /*OUT*/ ppFileObject) PURE; - - /* - * The following method is deprecated and should return PNR_NOTIMPL - */ - - STDMETHOD(CreateDir) (THIS_ - IUnknown** /*OUT*/ ppDirObject) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileStat - * - * Purpose: - * - * Gets information about a specific File object - * - * IID_IRMAFileStat: - * - * {00000205-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileStat, 0x00000205, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileStat - -DECLARE_INTERFACE_(IRMAFileStat, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileStat methods - */ - - STDMETHOD(Stat) (THIS_ - IRMAFileStatResponse* pFileStatResponse - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileStatResponse - * - * Purpose: - * - * Returns information about a specific File object - * - * IID_IRMAFileStatResponse: - * - * {00000206-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileStatResponse, 0x00000206, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileStatResponse - -DECLARE_INTERFACE_(IRMAFileStatResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileStat methods - */ - - STDMETHOD(StatDone) (THIS_ - PN_RESULT status, - UINT32 ulSize, - UINT32 ulCreationTime, - UINT32 ulAccessTime, - UINT32 ulModificationTime, - UINT32 ulMode) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileSystemManager - * - * Purpose: - * - * Gives out File Objects based on URLs - * - * IID_IRMAFileSystemManager: - * - * {00000207-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileSystemManager, 0x00000207, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileSystemManager - -#define CLSID_IRMAFileSystemManager IID_IRMAFileSystemManager - -DECLARE_INTERFACE_(IRMAFileSystemManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileSystemManager methods - */ - - STDMETHOD(Init) (THIS_ - IRMAFileSystemManagerResponse* /*IN*/ pFileManagerResponse - ) PURE; - - /* GetFileObject attempts to locate an existing file via the DoesExist - * method in each file system's objects, and returns that object through - * FSManagerResponse->FileObjectReady - */ - STDMETHOD(GetFileObject) (THIS_ - IRMARequest* pRequest, - IRMAAuthenticator* pAuthenticator) PURE; - - /* GetNewFileObject is similar to GetFileObject except that no DoesExist - * checks are done. The first file system that matches the mount point - * or protocol for the path in the request object creates the file - * which is then returned through FileObjectReady. This is especially - * useful for those who wish to open a brand new file for writing. - */ - STDMETHOD(GetNewFileObject) (THIS_ - IRMARequest* pRequest, - IRMAAuthenticator* pAuthenticator) PURE; - - STDMETHOD(GetRelativeFileObject) (THIS_ - IUnknown* pOriginalObject, - const char* pPath) PURE; - - /* - * The following method is deprecated and should return PNR_NOTIMPL - */ - - STDMETHOD(GetDirObjectFromURL) (THIS_ - const char* pURL) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileSystemManagerResponse - * - * Purpose: - * - * Gives out File System objects based on URLs - * - * IID_IRMAFileSystemManagerResponse: - * - * {00000208-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileSystemManagerResponse, 0x00000208, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileSystemManagerResponse - -DECLARE_INTERFACE_(IRMAFileSystemManagerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileSystemManagerResponse methods - */ - - /************************************************************************ - * Method: - * IRMAFileSystemManagerResponse::InitDone - * Purpose: - */ - STDMETHOD(InitDone) (THIS_ - PN_RESULT status) PURE; - - STDMETHOD(FileObjectReady) (THIS_ - PN_RESULT status, - IUnknown* pObject) PURE; - - /* - * The following method is deprecated and should return PNR_NOTIMPL - */ - - STDMETHOD(DirObjectReady) (THIS_ - PN_RESULT status, - IUnknown* pDirObject) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileExists - * - * Purpose: - * - * Checks for the existense of a file. Must be implemented. - * - * IID_IRMAFileExists: - * - * {00000209-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileExists, 0x00000209, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileExists - -DECLARE_INTERFACE_(IRMAFileExists, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileExists methods - */ - - /************************************************************************ - * Method: - * IRMAFileExists::DoesExist - * Purpose: - */ - STDMETHOD(DoesExist) (THIS_ - const char* /*IN*/ pPath, - IRMAFileExistsResponse* /*IN*/ pFileResponse) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileExistsResponse - * - * Purpose: - * - * Response interface for IRMAFileExists. Must be implemented. - * - * IID_IRMAFileExistsResponse: - * - * {0000020A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileExistsResponse, 0x0000020a, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileExists - -DECLARE_INTERFACE_(IRMAFileExistsResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileExistsResponse methods - */ - - STDMETHOD(DoesExistDone) (THIS_ - BOOL bExist) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileMimeMapper - * - * Purpose: - * - * Allows you to specify a mime type for a specific file. - * Optional interface. - * - * IID_IRMAFileMimeMapper: - * - * {0000020B-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileMimeMapper, 0x0000020b, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileMimeMapper - -DECLARE_INTERFACE_(IRMAFileMimeMapper, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileMimeMapper methods - */ - - /************************************************************************ - * Method: - * IRMAFileMimeMapper::FindMimeType - * Purpose: - */ - STDMETHOD(FindMimeType) (THIS_ - const char* /*IN*/ pURL, - IRMAFileMimeMapperResponse* /*IN*/ pMimeMapperResponse - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileMimeMapperResponse - * - * Purpose: - * - * Response interface for IRMAFileMimeMapper. - * Optional interface. - * - * IID_IRMAFileMimeMapperResponse: - * - * {0000020C-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileMimeMapperResponse, 0x0000020c, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileMimeMapperResponse - -DECLARE_INTERFACE_(IRMAFileMimeMapperResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileMimeMapperResponse methods - */ - - /************************************************************************ - * Method: - * IRMAFileMimeMapperResponse::MimeTypeFound - * Purpose: - * Notification interface provided by users of the IRMAFileMimeMapper - * interface. This method is called by the IRMAFileObject when the - * initialization of the file is complete, and the Mime type is - * available for the request file. If the file is not valid for the - * file system, the status PNR_FAILED should be returned, - * with a mime type of NULL. If the file is valid but the mime type - * is unknown, then the status PNR_OK should be returned with - * a mime type of NULL. - * - */ - STDMETHOD(MimeTypeFound) (THIS_ - PN_RESULT status, - const char* pMimeType) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMABroadcastMapper - * - * Purpose: - * - * Associates a file with a broadcast format plugin. - * Implementation only required by broadcast plugin file systems. - * - * IID_IRMABroadcastMapper: - * - * {0000020D-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMABroadcastMapper, 0x0000020d, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMABroadcastMapper - -DECLARE_INTERFACE_(IRMABroadcastMapper, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMABroadcastMapper methods - */ - - /************************************************************************ - * Method: - * IRMABroadcastMapper::FindBroadcastType - * Purpose: - */ - STDMETHOD(FindBroadcastType) (THIS_ - const char* /*IN*/ pURL, - IRMABroadcastMapperResponse* /*IN*/ pBroadcastMapperResponse) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMABroadcastMapperResponse - * - * Purpose: - * - * Response interface for IRMABroadcastMapper. - * Implementation only required by broadcast plugin file systems. - * - * IID_IRMABroadcastMapperResponse: - * - * {0000020E-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMABroadcastMapperResponse, 0x0000020e, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMABroadcastMapperResponse - -DECLARE_INTERFACE_(IRMABroadcastMapperResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMABroadcastMapperResponse methods - */ - - /************************************************************************ - * Method: - * IRMABroadcastMapperResponse::BroadcastTypeFound - * Purpose: - * Notification interface provided by users of the IRMABroadcastMapper - * interface. This method is called by the File Object when the - * initialization of the file is complete, and the broadcast type is - * available for the request file. If the file is not valid for the - * file system, the status PNR_FAILED should be returned, - * with the broadcast type set to NULL. - * - */ - STDMETHOD(BroadcastTypeFound) (THIS_ - PN_RESULT status, - const char* pBroadcastType) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAGetFileFromSamePool - * - * Purpose: - * - * Gives out File Objects based on filenames and relative "paths" - * - * IID_IRMAGetFileFromSamePool: - * - * {0000020f-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGetFileFromSamePool, 0x0000020f, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAGetFileFromSamePool - -#define CLSID_IRMAGetFileFromSamePool IID_IRMAGetFileFromSamePool - -DECLARE_INTERFACE_(IRMAGetFileFromSamePool, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /* - * IRMAGetFileFromSamePool method - */ - /************************************************************************ - * Method: - * IRMAGetFileFromSamePool::GetFileObjectFromPool - * Purpose: - * To get another FileObject from the same pool. - */ - STDMETHOD(GetFileObjectFromPool) (THIS_ - IRMAGetFileFromSamePoolResponse*) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAGetFileFromSamePoolResponse - * - * Purpose: - * - * Gives out File Objects based on filenames and relative "paths" - * - * IID_IRMAGetFileFromSamePoolResponse: - * - * {00000210-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGetFileFromSamePoolResponse, 0x00000210, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAGetFileFromSamePoolResponse - -#define CLSID_IRMAGetFileFromSamePoolResponse IID_IRMAGetFileFromSamePoolResponse - -DECLARE_INTERFACE_(IRMAGetFileFromSamePoolResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAGetFileFromSamePoolResponse method - */ - /************************************************************************ - * Method: - * IRMAGetFileFromSamePoolResponse::FileObjectReady - * Purpose: - * To return another FileObject from the same pool. - */ - STDMETHOD(FileObjectReady) (THIS_ - PN_RESULT status, - IUnknown* ppUnknown) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileAuthenticator - * - * Purpose: - * - * Set and Get a file object's authenticator object. - * - * IID_IRMAFileAuthenticator: - * - * {00000211-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileAuthenticator, 0x00000211, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAFileAuthenticator - -#define CLSID_IRMAFileAuthenticator IID_IRMAFileAuthenticator - -DECLARE_INTERFACE_(IRMAFileAuthenticator, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileAuthenticator methods - */ - STDMETHOD(SetAuthenticator) (THIS_ - IRMAAuthenticator* pAuthenticator) PURE; - - STDMETHOD(GetAuthenticator) (THIS_ - REF(IRMAAuthenticator*) pAuthenticator) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMARequestHandler - * - * Purpose: - * - * Object to manage IRMARequest objects - * - * IID_IRMARequestHandler: - * - * {00000212-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARequestHandler, 0x00000212, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMARequestHandler - -#define CLSID_IRMARequestHandler IID_IRMARequestHandler - -DECLARE_INTERFACE_(IRMARequestHandler, IUnknown) -{ - /* - * IUnknown methods - */ - - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMARequestHandler::SetRequest - * Purpose: - * Associates an IRMARequest with an object - */ - STDMETHOD(SetRequest) (THIS_ - IRMARequest* /*IN*/ pRequest) PURE; - - /************************************************************************ - * Method: - * IRMARequestHandler::GetRequest - * Purpose: - * Gets the IRMARequest object associated with an object - */ - STDMETHOD(GetRequest) (THIS_ - REF(IRMARequest*) /*OUT*/ pRequest) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMARequestContext - * - * Purpose: - * - * Object to manage the context of the Request - * - * IID_IRMARequestContext: - * - * {00000217-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARequestContext, 0x00000217, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMARequestContext - -#define CLSID_IRMARequestContext IID_IRMARequestContext - -DECLARE_INTERFACE_(IRMARequestContext, IUnknown) -{ - /* - * IUnknown methods - */ - - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMARequestContext methods - */ - - /************************************************************************ - * Method: - * IRMARequestContext::SetUserContext - * Purpose: - * Sets the Authenticated users Context. - */ - STDMETHOD(SetUserContext) - ( - THIS_ - IUnknown* pIUnknownNewContext - ) PURE; - - /************************************************************************ - * Method: - * IRMARequestContext::GetUserContext - * Purpose: - * Gets the Authenticated users Context. - */ - STDMETHOD(GetUserContext) - ( - THIS_ - REF(IUnknown*) pIUnknownCurrentContext - ) PURE; - - /************************************************************************ - * Method: - * IRMARequestContext::SetRequester - * Purpose: - * Sets the Object that made the request. - */ - STDMETHOD(SetRequester) - ( - THIS_ - IUnknown* pIUnknownNewRequester - ) PURE; - - /************************************************************************ - * Method: - * IRMARequestContext::GetRequester - * Purpose: - * Gets the Object that made the request. - */ - STDMETHOD(GetRequester) - ( - THIS_ - REF(IUnknown*) pIUnknownCurrentRequester - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMARequest - * - * Purpose: - * - * Object to manage the RFC822 headers sent by the client - * - * IID_IRMARequest: - * - * {00000213-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARequest, 0x00000213, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMARequest - -#define CLSID_IRMARequest IID_IRMARequest - -DECLARE_INTERFACE_(IRMARequest, IUnknown) -{ - /* - * IUnknown methods - */ - - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMARequest methods - */ - - /************************************************************************ - * Method: - * IRMARequest::SetRequestHeaders - * Purpose: - * Sets the headers that will be sent in the RFC822 header section - * of the request message - */ - STDMETHOD(SetRequestHeaders) (THIS_ - IRMAValues* pRequestHeaders) PURE; - - /************************************************************************ - * Method: - * IRMARequest::GetRequestHeaders - * Purpose: - * Gets the headers that were sent in the RFC822 header section - * of the request message - */ - STDMETHOD(GetRequestHeaders) (THIS_ - REF(IRMAValues*) pRequestHeaders) PURE; - - /************************************************************************ - * Method: - * IRMARequest::SetResponseHeaders - * Purpose: - * Sets the headers that will be returned in the RFC822 header - * section of the response message - */ - STDMETHOD(SetResponseHeaders) (THIS_ - IRMAValues* pResponseHeaders) PURE; - - /************************************************************************ - * Method: - * IRMARequest::GetResponseHeaders - * Purpose: - * Gets the headers that were returned in the RFC822 header section - * of the response message - */ - STDMETHOD(GetResponseHeaders) (THIS_ - REF(IRMAValues*) pResponseHeaders) PURE; - - /************************************************************************ - * Method: - * IRMARequest::SetURL - * Purpose: - * Sets the fully qualified path associated with a file object. - * Note: On the server, this path does not include the file system - * mount point. - */ - STDMETHOD(SetURL) (THIS_ - const char* pURL) PURE; - - /************************************************************************ - * Method: - * IRMARequest::GetURL - * Purpose: - * Returns the fully qualified path associated with a file object. - * Note: On the server, this path does not include the file system - * mount point. - * - * Note: The returned pointer's lifetime expires as soon as the - * caller returns from a function which was called from the RMA - * core (i.e. when you return control to the RMA core) - */ - STDMETHOD(GetURL) (THIS_ - REF(const char*) pURL) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAFileRename - * - * Purpose: - * - * Interface to allow renaming of files. Query off of the File Object. - * Not all filesystem plugins implement this feature. - * - * IID_IRMAFileRename: - * - * {00000214-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileRename, 0x00000214, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAFileRename - -DECLARE_INTERFACE_(IRMAFileRename, IUnknown) -{ - /* - * IUnknown methods - */ - - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileRename methods - */ - - /************************************************************************ - * Method: - * IRMAFileRename::Rename - * Purpose: - * Renames a file to a new name. - */ - STDMETHOD(Rename) (THIS_ - const char* pNewFileName) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMADirHandler - * - * Purpose: - * - * Object that exports directory handler API - * - * IID_IRMADirHandler: - * - * {00000215-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADirHandler, 0x00000215, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADirHandler - -DECLARE_INTERFACE_(IRMADirHandler, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADirHandler methods - */ - - /************************************************************************ - * Method: - * IRMADirHandler::InitDirHandler - * Purpose: - * Associates a directory handler with the directory handler - * response, it should notify of operation completness. - */ - STDMETHOD(InitDirHandler) (THIS_ - IRMADirHandlerResponse* /*IN*/ pDirResponse) PURE; - - /************************************************************************ - * Method: - * IRMADirHandler::CloseDirHandler - * Purpose: - * Closes the directory handler resource and releases all resources - * associated with the object. - */ - STDMETHOD(CloseDirHandler) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMADirHandler::MakeDir - * Purpose: - * Create the directory - */ - STDMETHOD(MakeDir) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMADirHandler::ReadDir - * Purpose: - * Get a dump of the directory - */ - STDMETHOD(ReadDir) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMADirHandlerResponse - * - * Purpose: - * - * Object that exports the directory handler response API - * - * IID_IRMADirHandlerResponse: - * - * {00000216-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMADirHandlerResponse, 0x00000216, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMADirHandlerResponse - -DECLARE_INTERFACE_(IRMADirHandlerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMADirHandlerResponse methods - */ - - /************************************************************************ - * Method: - * IRMADirHandlerResponse::InitDirHandlerDone - * Purpose: - * Notification interface provided by users of the IRMADirHandler - * interface. This method is called by the IRMADirHandler when the - * initialization of the object is complete. - */ - STDMETHOD(InitDirHandlerDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMADirHandlerResponse::CloseDirHandlerDone - * Purpose: - * Notification interface provided by users of the IRMADirHandler - * interface. This method is called by the IRMADirHandler when the - * close of the directory is complete. - */ - STDMETHOD(CloseDirHandlerDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMADirHandler::MakeDirDone - * Purpose: - * Notification interface provided by users of the IRMADirHandler - * interface. This method is called by the IRMADirHandler when the - * attempt to create the directory is complete. - */ - STDMETHOD(MakeDirDone) (THIS_ - PN_RESULT status) PURE; - - /************************************************************************ - * Method: - * IRMADirHandler::ReadDirDone - * Purpose: - * Notification interface provided by users of the IRMADirHandler - * interface. This method is called by the IRMADirHandler when the - * read from the directory is complete and a buffer is available. - */ - STDMETHOD(ReadDirDone) (THIS_ - PN_RESULT status, - IRMABuffer* pBuffer) PURE; -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileRemove - * - * Purpose: - * - * Interface to allow removing of files. Query off of the File Object. - * Not all filesystem plugins implement this feature. - * - * IID_IRMAFileRemove: - * - * {0000021A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileRemove, 0x0000021A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAFileRemove - -DECLARE_INTERFACE_(IRMAFileRemove, IUnknown) -{ - /* - * IUnknown methods - */ - - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileRemove methods - */ - - /************************************************************************ - * Method: - * IRMAFileRemove::Remove - * Purpose: - * Removes a file from the file system. - */ - STDMETHOD(Remove) (THIS) PURE; -}; - - - - - -#endif /* _RMAFILES_H_ */ diff --git a/include/realmedia/rmaformt.h b/include/realmedia/rmaformt.h deleted file mode 100644 index 57a922521..000000000 --- a/include/realmedia/rmaformt.h +++ /dev/null @@ -1,518 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaformt.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Broadcast Format Plug-in Interfaces. - * - */ - -#ifndef _RMAFORMT_H_ -#define _RMAFORMT_H_ - -#include "rmafiles.h" - -/* - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMAFileFormatObject IRMAFileFormatObject; -typedef _INTERFACE IRMABroadcastFormatObject IRMABroadcastFormatObject; -typedef _INTERFACE IRMAFormatResponse IRMAFormatResponse; -typedef _INTERFACE IRMAFileObject IRMAFileObject; -typedef _INTERFACE IRMANetworkServices IRMANetworkServices; -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAPacketTimeOffsetHandler IRMAPacketTimeOffsetHandler; -typedef _INTERFACE IRMAPacketTimeOffsetHandlerResponse - IRMAPacketTimeOffsetHandlerResponse; -typedef _INTERFACE IRMALiveFileFormatInfo IRMALiveFileFormatInfo; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileFormatObject - * - * Purpose: - * - * Object that allows a Controller to communicate with a specific - * File Format plug-in session - * - * IID_IRMAFileFormatObject: - * - * {00000F00-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFileFormatObject, 0x00000F00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileFormatObject - -DECLARE_INTERFACE_(IRMAFileFormatObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFileFormatObject methods - */ - - /************************************************************************ - * Method: - * IRMAFileFormatObject::GetFileFormatInfo - * Purpose: - * Returns information vital to the instantiation of file format - * plugins. - */ - STDMETHOD(GetFileFormatInfo)(THIS_ - REF(const char**) /*OUT*/ pFileMimeTypes, - REF(const char**) /*OUT*/ pFileExtensions, - REF(const char**) /*OUT*/ pFileOpenNames - ) PURE; - - STDMETHOD(InitFileFormat) - (THIS_ - IRMARequest* /*IN*/ pRequest, - IRMAFormatResponse* /*IN*/ pFormatResponse, - IRMAFileObject* /*IN*/ pFileObject) PURE; - - STDMETHOD(GetFileHeader) (THIS) PURE; - - STDMETHOD(GetStreamHeader) (THIS_ - UINT16 unStreamNumber) PURE; - - STDMETHOD(GetPacket) (THIS_ - UINT16 unStreamNumber) PURE; - - STDMETHOD(Seek) (THIS_ - ULONG32 ulOffset) PURE; - - STDMETHOD(Close) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMABroadcastFormatObject - * - * Purpose: - * - * Object that allows a Controller to communicate with a specific - * Broadcast Format plug-in session - * - * IID_IRMABroadcastFormatObject: - * - * {00000F01-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMABroadcastFormatObject, 0x00000F01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMABroadcastFormatObject - -DECLARE_INTERFACE_(IRMABroadcastFormatObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMABroadcastFormatObject methods - */ - - /************************************************************************ - * Method: - * IRMABroadcastFormatObject::GetBroadcastFormatInfo - * Purpose: - * Returns information vital to the instantiation of broadcast format - * plugins. - */ - STDMETHOD(GetBroadcastFormatInfo)(THIS_ - REF(const char*) /*OUT*/ pToken) PURE; - - STDMETHOD(InitBroadcastFormat) (THIS_ - const char* /*IN*/ pURL, - IRMAFormatResponse* /*IN*/ pFormatResponse - ) PURE; - - STDMETHOD(GetFileHeader) (THIS) PURE; - - STDMETHOD(GetStreamHeader) (THIS_ - UINT16 unStreamNumber) PURE; - - STDMETHOD(StartPackets) (THIS_ - UINT16 unStreamNumber) PURE; - - STDMETHOD(StopPackets) (THIS_ - UINT16 unStreamNumber) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAFormatResponse - * - * Purpose: - * - * Object that allows a specific File Format Object to communicate - * with its user - * - * IID_IRMAFormatResponse: - * - * {00000F02-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAFormatResponse, 0x00000F02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFormatResponse - -DECLARE_INTERFACE_(IRMAFormatResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAFormatResponse methods - */ - STDMETHOD(InitDone) (THIS_ - PN_RESULT status) PURE; - - STDMETHOD(PacketReady) (THIS_ - PN_RESULT status, - IRMAPacket* pPacket) PURE; - - STDMETHOD(SeekDone) (THIS_ - PN_RESULT status) PURE; - - STDMETHOD(FileHeaderReady) (THIS_ - PN_RESULT status, - IRMAValues* pHeader) PURE; - - STDMETHOD(StreamHeaderReady) (THIS_ - PN_RESULT status, - IRMAValues* pHeader) PURE; - - STDMETHOD(StreamDone) (THIS_ - UINT16 unStreamNumber) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketFormat - * - * Purpose: - * - * Interface that modifies the behavior of an IRMAFileFormat by defining - * the packet format it will be creating. - * - * IID_IRMAPacketFormat: - * - * {00000F03-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPacketFormat, 0x00000F03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPacketFormat - -DECLARE_INTERFACE_(IRMAPacketFormat, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketFormat methods - */ - STDMETHOD(GetSupportedPacketFormats) - (THIS_ - REF(const char**) pFormats) PURE; - - STDMETHOD(SetPacketFormat) (THIS_ - const char* pFormat) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketTimeOffsetHandler - * - * Purpose: - * - * Provides methods for handling the changing of a packets timestamp. - * - * IID_IRMAPacketTimeOffsetHandler: - * - * {00000F04-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPacketTimeOffsetHandler, 0x00000F04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -DECLARE_INTERFACE_(IRMAPacketTimeOffsetHandler, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketTimeOffsetHandler methods - */ - - /************************************************************************ - * Method: - * IRMAPacketTimeOffsetHandler::Init - * Purpose: - * Initialize the IRMAPacketTimeOffsetHandler and set the response. - * Implementors should look up the MimeType. - */ - STDMETHOD(Init) (THIS_ - IRMAPacketTimeOffsetHandlerResponse* pResponse, - IRMAValues* pHeader, - IUnknown* pContext) PURE; - - /************************************************************************ - * Method: - * IRMAPacketTimeOffsetHandler::SetTimeOffset - * Purpose: - * Called to set the time offset. Uses a bool and a UINT32 instead - * of and INT32 so that the time offset wraps around after 47 days - * instead of 24. bPlus says whether to add or subtract. - */ - STDMETHOD(SetTimeOffset) (THIS_ - UINT32 ulTimeOffset, - BOOL bPlus) PURE; - - /************************************************************************ - * Method: - * IRMAPacketTimeOffsetHandler::HandlePacket - * Purpose: - * give the IRMAPacketTimeOffsetHandler a packet to modify for the - * time offset. - */ - STDMETHOD(HandlePacket) (THIS_ - IRMAPacket* pPacket) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketTimeOffsetHandlerResponse - * - * Purpose: - * - * Provides methods for the IRMAPacketTimeOffsetHandler to respond to. - * - * IID_IRMAPacketTimeOffsetHandlerResponse: - * - * {00000F05-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPacketTimeOffsetHandlerResponse, 0x00000F05, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -DECLARE_INTERFACE_(IRMAPacketTimeOffsetHandlerResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketTimeOffsetHandler methods - */ - - /************************************************************************ - * Method: - * IRMAPacketTimeOffsetHandler::PacketReady - * Purpose: - * Called by IRMAPacketTimeOffsetHandler to pass back the packet - * when it is done with it. - */ - STDMETHOD(TimeOffsetPacketReady) (THIS_ - IRMAPacket* pPacket) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMALiveFileFormatInfo - * - * Purpose: - * - * Provides miscellaneous information needed to transmit a live stream. - * Optionally implemented by the file format object. - * - * IID_IRMALiveFileFormatInfo: - * - * {00000F06-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMALiveFileFormatInfo, 0x00000F06, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMALiveFileFormatInfo - -DECLARE_INTERFACE_(IRMALiveFileFormatInfo, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMALiveFileFormatInfo methods - */ - - /************************************************************************ - * Method: - * IRMALiveFileFormatInfo::VerifyFileCompatibility - * Purpose: - * Compares two file headers and returns PNR_OK if these two - * files can be transmitted sequentially in a single live - * presentation. - */ - STDMETHOD(VerifyFileCompatibility) (THIS_ - IRMAValues* pFileHeader1, - IRMAValues* pFileHeader2) PURE; - - /************************************************************************ - * Method: - * IRMALiveFileFormatInfo::VerifyStreamCompatibility - * Purpose: - * Compares two stream headers and returns PNR_OK if these two - * streams can be transmitted sequentially in a single live - * presentation. - */ - STDMETHOD(VerifyStreamCompatibility) (THIS_ - IRMAValues* pStreamHeader1, - IRMAValues* pStreamHeader2) PURE; - - /************************************************************************ - * Method: - * IRMALiveFileFormatInfo::IsLiveResendRequired - * Purpose: - * Returns TRUE if this stream requires the latest packet to be - * resent periodically in a live presentation. - */ - STDMETHOD_(BOOL,IsLiveResendRequired) (THIS_ - UINT16 unStreamNumber) PURE; - - /************************************************************************ - * Method: - * IRMALiveFileFormatInfo::GetResendBitrate - * Purpose: - * If periodic live resends are required for this stream, this - * method returns the rate at which we should resend packets. The - * resend rate is measured in bits per second. - */ - STDMETHOD(GetResendBitrate) (THIS_ - UINT16 unStreamNumber, - REF(UINT32) ulBitrate) PURE; - - /************************************************************************ - * Method: - * IRMALiveFileFormatInfo::GetResendDuration - * Purpose: - * If periodic live resends are required for this stream, this - * method returns the number of milliseconds for which this packet - * should be resent. - */ - STDMETHOD(GetResendDuration) (THIS_ - IRMAPacket* pPacket, - REF(UINT32) ulDuration) PURE; - - /************************************************************************ - * Method: - * IRMALiveFileFormatInfo::FormResendPacket - * Purpose: - * Forms a live resend packet based upon the original packet passed - * as the first parameter. This allows the file format plugin to - * make resend packets distinguishable from original packets. - */ - STDMETHOD(FormResendPacket) (THIS_ - IRMAPacket* pOriginalPacket, - REF(IRMAPacket*) pResendPacket) PURE; -}; - - - - -#endif /* _RMAFORMT_H_ */ diff --git a/include/realmedia/rmagroup.h b/include/realmedia/rmagroup.h deleted file mode 100644 index 14ad71b25..000000000 --- a/include/realmedia/rmagroup.h +++ /dev/null @@ -1,391 +0,0 @@ -/**************************************************************************** - * - * $Id: rmagroup.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Group Interface. - * - */ - -#ifndef _IRMAGROUP_H_ -#define _IRMAGROUP_H_ - -/**************************************************************************** - * - * Forward declarations of some interfaces defined/used here-in. - */ -typedef _INTERFACE IRMAGroup IRMAGroup; -typedef _INTERFACE IRMAGroupManager IRMAGroupManager; -typedef _INTERFACE IRMAGroupSink IRMAGroupSink; -typedef _INTERFACE IRMAValues IRMAValues; - - -/**************************************************************************** - * - * Interface: - * - * IRMAGroup - * - * Purpose: - * - * - * IID_IRMAGroup: - * - * {0x00002400-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGroup, 0x00002400, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAGroup - -DECLARE_INTERFACE_(IRMAGroup, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAGroup methods - */ - /************************************************************************ - * Method: - * IRMAGroup::SetGroupProperties - * Purpose: - * Set any group specific information like Title Author - * Copyright etc. - */ - STDMETHOD(SetGroupProperties) (THIS_ - IRMAValues* /*IN*/ pProperties) PURE; - - /************************************************************************ - * Method: - * IRMAGroup::GetGroupProperties - * Purpose: - * Get any group specific information. May return NULL. - */ - STDMETHOD_(IRMAValues*, GetGroupProperties) (THIS) PURE; - /************************************************************************ - * Method: - * IRMAGroup::GetTrackCount - * Purpose: - * Get the number of tracks within this group. - */ - STDMETHOD_(UINT16,GetTrackCount) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAGroup::GetTrack - * Purpose: - * Get ith track in this group - */ - STDMETHOD(GetTrack) (THIS_ - UINT16 /*IN*/ uTrackIndex, - REF(IRMAValues*) /*OUT*/ pTrack) PURE; - - /************************************************************************ - * Method: - * IRMAGroup::AddTrack - * Purpose: - * Add Tracks to the group. - */ - STDMETHOD(AddTrack) (THIS_ - IRMAValues* /*IN*/ pTrack) PURE; - - /************************************************************************ - * Method: - * IRMAGroup::RemoveTrack - * Purpose: - * Remove an already added track - */ - STDMETHOD(RemoveTrack) (THIS_ - UINT16 /*IN*/ uTrackIndex) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAGroupManager - * - * Purpose: - * - * - * IID_IRMAGroupManager: - * - * {0x00002401-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGroupManager, 0x00002401, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAGroupManager - -DECLARE_INTERFACE_(IRMAGroupManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAGroupManager methods - */ - - /************************************************************************ - * Method: - * IRMAGroupManager::CreateGroup - * Purpose: - * Create a group - */ - STDMETHOD(CreateGroup) (REF(IRMAGroup*) pGroup) PURE; - - /************************************************************************ - * Method: - * IRMAGroupManager::GetGroupCount - * Purpose: - * Get the number of groups within the presentation. - */ - STDMETHOD_(UINT16,GetGroupCount) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAGroupManager::GetGroup - * Purpose: - * Get ith group in the presentation - */ - STDMETHOD(GetGroup) (THIS_ - UINT16 /*IN*/ uGroupIndex, - REF(IRMAGroup*) /*OUT*/ pGroup) PURE; - - /************************************************************************ - * Method: - * IRMAGroupManager::SetCurrentGroup - * Purpose: - * Play this group in the presentation. - */ - STDMETHOD(SetCurrentGroup) (THIS_ - UINT16 /*IN*/ uGroupIndex) PURE; - - /************************************************************************ - * Method: - * IRMAGroupMgr::GetCurrentGroup - * Purpose: - * Get the current group index - */ - STDMETHOD(GetCurrentGroup) (THIS_ - REF(UINT16) /*OUT*/ uGroupIndex) PURE; - - /************************************************************************ - * Method: - * IRMAGroupManager::AddGroup - * Purpose: - * Add a group to the presentation. - */ - STDMETHOD(AddGroup) (THIS_ - IRMAGroup* /*IN*/ pGroup) PURE; - - /************************************************************************ - * Method: - * IRMAGroupManager::RemoveGroup - * Purpose: - * Remove an already added group - */ - STDMETHOD(RemoveGroup) (THIS_ - UINT16 /*IN*/ uGroupIndex) PURE; - - - /************************************************************************ - * Method: - * IRMAGroupManager::AddSink - * Purpose: - * Add a sink to get notifications about any tracks or groups - * being added to the presentation. - */ - STDMETHOD(AddSink) (THIS_ - IRMAGroupSink* /*IN*/ pGroupSink) PURE; - - - /************************************************************************ - * Method: - * IRMAGroupManager::RemoveSink - * Purpose: - * Remove Sink - */ - STDMETHOD(RemoveSink) (THIS_ - IRMAGroupSink* /*IN*/ pGroupSink) PURE; - - /************************************************************************ - * Method: - * IRMAGroup::GetPresentationProperties - * Purpose: - * Get any presentation information. May return NULL. - */ - STDMETHOD_(IRMAValues*, GetPresentationProperties) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAGroup::SetPresentationProperties - * Purpose: - * Set any presentation information like Title Author - * Copyright etc. - */ - STDMETHOD(SetPresentationProperties) (THIS_ - IRMAValues* /*IN*/ pProperties) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAGroupSink - * - * Purpose: - * - * - * IID_IRMAGroupSink: - * - * {0x00002402-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAGroupSink, 0x00002402, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMAGroupSink - -DECLARE_INTERFACE_(IRMAGroupSink, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAGroupSink methods - */ - /************************************************************************ - * Method: - * IRMAGroupSink::GroupAdded - * Purpose: - * Notification of a new group being added to the presentation. - */ - STDMETHOD(GroupAdded) (THIS_ - UINT16 /*IN*/ uGroupIndex, - IRMAGroup* /*IN*/ pGroup) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::GroupRemoved - * Purpose: - * Notification of a group being removed from the presentation. - */ - STDMETHOD(GroupRemoved) (THIS_ - UINT16 /*IN*/ uGroupIndex, - IRMAGroup* /*IN*/ pGroup) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::AllGroupsRemoved - * Purpose: - * Notification that all groups have been removed from the - * current presentation. - */ - STDMETHOD(AllGroupsRemoved) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::TrackAdded - * Purpose: - * Notification of a new track being added to a group. - */ - STDMETHOD(TrackAdded) (THIS_ - UINT16 /*IN*/ uGroupIndex, - UINT16 /*IN*/ uTrackIndex, - IRMAValues* /*IN*/ pTrack) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::TrackRemoved - * Purpose: - * Notification of a track being removed from a group. - */ - STDMETHOD(TrackRemoved) (THIS_ - UINT16 /*IN*/ uGroupIndex, - UINT16 /*IN*/ uTrackIndex, - IRMAValues* /*IN*/ pTrack) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::TrackStarted - * Purpose: - * Notification of a track being started (to get duration, for - * instance...) - */ - STDMETHOD(TrackStarted) (THIS_ - UINT16 /*IN*/ uGroupIndex, - UINT16 /*IN*/ uTrackIndex, - IRMAValues* /*IN*/ pTrack) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::TrackStopped - * Purpose: - * Notification of a track being stopped - * - */ - STDMETHOD(TrackStopped) (THIS_ - UINT16 /*IN*/ uGroupIndex, - UINT16 /*IN*/ uTrackIndex, - IRMAValues* /*IN*/ pTrack) PURE; - - /************************************************************************ - * Method: - * IRMAGroupSink::CurrentGroupSet - * Purpose: - * This group is being currently played in the presentation. - */ - STDMETHOD(CurrentGroupSet) (THIS_ - UINT16 /*IN*/ uGroupIndex, - IRMAGroup* /*IN*/ pGroup) PURE; -}; - - - - -#endif /*_IRMAGROUP_H_*/ diff --git a/include/realmedia/rmahyper.h b/include/realmedia/rmahyper.h deleted file mode 100644 index a19afbeda..000000000 --- a/include/realmedia/rmahyper.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * - * $Id: rmahyper.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Simple Hyper Navigation Interfaces - * - */ - -#ifndef _RMAHYPER_H_ -#define _RMAHYPER_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAHyperNavigate IRMAHyperNavigate; - - -/**************************************************************************** - * - * Interface: - * - * IRMAHyperNavigate - * - * Purpose: - * - * Allows you to perform simple "Go to URL" operations. - * - * IID_IRMAHyperNavigate: - * - * {00000900-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAHyperNavigate, 0x00000900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAHyperNavigate - -DECLARE_INTERFACE_(IRMAHyperNavigate, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAHyperNavigate methods - */ - - /************************************************************************ - * Method: - * IRMAHyperNavigate::GoToURL - * Purpose: - * Performs a simple Go To URL operation. - * Parameters: - * pURL: fully qualified URL such as http://www.real.com - * pTarget: target frame. To not use a frame, set this to NULL - */ - STDMETHOD(GoToURL) (THIS_ - const char* pURL, - const char* pTarget) PURE; - -}; - - - -#endif /* _RMAHYPER_H_ */ diff --git a/include/realmedia/rmaiids.h b/include/realmedia/rmaiids.h deleted file mode 100644 index 2d9a657cc..000000000 --- a/include/realmedia/rmaiids.h +++ /dev/null @@ -1,1094 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaiids.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Exhaustive list of IID's used in IRMA interfaces - * - * Note: These IIDs generally are duplicated in the headers that are specific - * to each interface, so if you change this file, change the other file(s) as - * well. Having all these IIDS in one files is convenient to some folks, but - * not everyone includes this file, hence the need to keep them in individual - * files as well. - */ - -#ifndef _RMAIIDS_H_ -#define _RMAIIDS_H_ - -/* - * File: - * pncom.h - * Description: - * Interfaces defined by COM. - * Interfaces: - * IID_IUnknown: {00000000-0000-0000-C000000000000046} - * IID_IMalloc: {00000002-0000-0000-C000000000000046} - */ - -/* - * These GUIDs are defined in pncom.h: - * - * DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); - * DEFINE_GUID(IID_IMalloc, 0x00000002, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); - * - */ - -/* - * File: - * rmacomm.h - * Description: - * RealMedia Common Utility interfaces - * Interfaces: - * IID_IRMACommonClassFactory: {00000000-0901-11d1-8B06-00A024406D59} - * IID_IRMAStatistics: {00000001-0901-11d1-8B06-00A024406D59} - * IID_IRMARegistryID: {00000002-0901-11d1-8B06-00A024406D59} - * IID_IRMAServerFork: {00000003-0901-11d1-8B06-00A024406D59} - * IID_IRMAServerControl: {00000004-0901-11d1-8B06-00A024406D59} - * IID_IRMAServerControl2: {00000005-0901-11d1-8B06-00A024406D59} - * IID_IRMAReconfigServerResponse: {00000006-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMACOMM_H_ -DEFINE_GUID(IID_IRMACommonClassFactory, 0x00000000, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAStatistics, 0x00000001, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARegistryID, 0x00000002, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAServerFork, 0x00000003, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAServerControl, 0x00000004, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAServerControl2, 0x00000005, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAReconfigServerResponse, 0x00000006, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAServerReconfigNotification, 0x00000007, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAWantServerReconfigNotification, 0x00000008, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - -/* - * File: - * rmaengin.h - * Description: - * Interfaces related to callbacks, networking, and scheduling. - * Interfaces: - * IID_IRMACallback: {00000100-0901-11d1-8B06-00A024406D59} - * IID_IRMAScheduler: {00000101-0901-11d1-8B06-00A024406D59} - * IID_IRMATCPResponse: {00000102-0901-11d1-8B06-00A024406D59} - * IID_IRMATCPSocket: {00000103-0901-11d1-8B06-00A024406D59} - * IID_IRMAListenResponse: {00000104-0901-11d1-8B06-00A024406D59} - * IID_IRMAListenSocket: {00000105-0901-11d1-8B06-00A024406D59} - * IID_IRMANetworkServices: {00000106-0901-11d1-8B06-00A024406D59} - * IID_IRMAUDPResponse: {00000107-0901-11d1-8B06-00A024406D59} - * IID_IRMAUDPSocket: {00000108-0901-11d1-8B06-00A024406D59} - * IID_IRMAResolver: {00000109-0901-11d1-8B06-00A024406D59} - * IID_IRMAResolverResponse: {0000010A-0901-11d1-8B06-00A024406D59} - * IID_IRMAInterruptSafe: {0000010B-0901-11d1-8B06-00A024406D59} - * IID_IRMAAsyncIOSelection: {0000010C-0901-11d1-8B06-00A024406D59} - * IID_IRMAUDPMulticastInit: {0000010D-0901-11d1-8B06-00A024406D59} - * IID_IRMAInterruptState: {0000010E-0901-11d1-8B06-00A024406D59} - * IID_IRMAOptimizedScheduler: {0000010F-0901-11d1-8B06-00A024406D59} - * IID_IRMALoadBalancedListen: {00000110-0901-11d1-8B06-00A024406D59} - * IID_IRMAOverrideDefaultServices: {00000111-0901-11d1-8B06-00A024406D59} - * IID_IRMAHTTPPostObject: {00000112-0901-11d1-8B06-00A024406D59} - * IID_IRMAHTTPPostResponse: {00000113-0901-11d1-8B06-00A024406D59} - * IID_IRMASetSocketOption: {00000114-0901-11d1-8B06-00A024406D59} - * IID_IRMAThreadSafeMethods: {00000115-0901-11d1-8B06-00A024406D59} - * IID_IRMAMutex: {00000116-0901-11d1-8B06-00A024406D59} - * - */ -#ifndef _RMAENGIN_H_ -DEFINE_GUID(IID_IRMACallback, 0x00000100, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAScheduler, 0x00000101, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMATCPResponse, 0x00000102, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMATCPSocket, 0x00000103, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAListenResponse, 0x00000104, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAListenSocket, 0x00000105, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMANetworkServices, 0x00000106, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMANetworkServices2, 0x17951551, 0x5683, 0x11d3, 0xb6, 0xba, 0x0, 0xc0, 0xf0, 0x31, 0xc2, 0x37); -DEFINE_GUID(IID_IRMAUDPResponse, 0x00000107, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAUDPSocket, 0x00000108, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAResolver, 0x00000109, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAResolverResponse, 0x0000010A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAInterruptSafe, 0x0000010B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAsyncIOSelection, 0x0000010C, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAUDPMulticastInit, 0x0000010D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAInterruptState, 0x0000010E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAOptimizedScheduler, 0x0000010F, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMALoadBalancedListen, 0x00000110, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAOverrideDefaultServices, 0x00000111, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASetSocketOption, 0x00000114, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAThreadSafeMethods, 0x00000115, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAMutex, 0x00000116, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - - -/* - * File: - * rmafiles.h - * Description: - * Interfaces related to file systems. - * Interfaces: - * IID_IRMAFileObject: {00000200-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileResponse: {00000201-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileSystemObject: {00000202-0901-11d1-8B06-00A024406D59} - * IID_IRMADirObject: {00000203-0901-11d1-8B06-00A024406D59} - * IID_IRMADirResponse: {00000204-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileStat: {00000205-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileStatResponse: {00000206-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileSystemManager: {00000207-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileSystemManagerResponse: - * {00000208-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileExists: {00000209-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileExistsResponse: {0000020A-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileMimeMapper: {0000020B-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileMimeMapperResponse: {0000020C-0901-11d1-8B06-00A024406D59} - * IID_IRMABroadcastMapper: {0000020D-0901-11d1-8B06-00A024406D59} - * IID_BroadcastMimeMapperResponse:{0000020E-0901-11d1-8B06-00A024406D59} - * IID_IRMAGetFileFromSamePool: {0000020F-0901-11d1-8B06-00A024406D59} - * IID_GetFileFromSamePoolResponse:{00000210-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileAuthenticator: {00000211-0901-11d1-8B06-00A024406D59} - * IID_IRMARequestHandler: {00000212-0901-11d1-8B06-00A024406D59} - * IID_IRMARequest: {00000213-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileRename: {00000214-0901-11d1-8B06-00A024406D59} - * IID_IRMADirHandler: {00000215-0901-11d1-8B06-00A024406D59} - * IID_IRMADirHandlerResponse: {00000216-0901-11d1-8B06-00A024406D59} - * IID_IRMARequestContext {00000217-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileRemove: {0000021A-0901-11d1-8B06-00A024406D59} - * DEPRECATED DEPRECATED {0000021B-0901-11d1-8B06-00A024406D59} - * - */ -#ifndef _RMAFILES_H_ -DEFINE_GUID(IID_IRMAHTTPPostObject, 0x00000112, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAHTTPPostResponse, 0x00000113, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileObject, 0x00000200, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileResponse, 0x00000201, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileSystemObject, 0x00000202, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADirObject, 0x00000203, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); //NOTE, use is deprecated -DEFINE_GUID(IID_IRMADirResponse, 0x00000204, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); //NOTE, use is deprecated -DEFINE_GUID(IID_IRMAFileStat, 0x00000205, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileStatResponse, 0x00000206, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileSystemManager, 0x00000207, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileSystemManagerResponse, 0x00000208, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileExists, 0x00000209, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileExistsResponse, 0x0000020a, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileMimeMapper, 0x0000020b, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileMimeMapperResponse, 0x0000020c, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMABroadcastMapper, 0x0000020d, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMABroadcastMapperResponse, 0x0000020e, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAGetFileFromSamePool, 0x0000020f, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAGetFileFromSamePoolResponse,0x00000210, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileAuthenticator, 0x00000211, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARequestHandler, 0x00000212, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARequest, 0x00000213, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileRename, 0x00000214, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADirHandler, 0x00000215, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADirHandlerResponse, 0x00000216, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARequestContext, 0x00000217, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileRemove, 0x0000021a, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmarendr.h - * Description: - * Interfaces related to renderers. - * Interfaces: - * IID_IRMARenderer: {00000300-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMARenderer, 0x00000300, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmacore.h - * Description: - * Interfaces related to the client core services. - * Interfaces: - * IID_IRMAStream: {00000400-0901-11d1-8B06-00A024406D59} - * IID_IRMAStreamSource {00000401-0901-11d1-8B06-00A024406D59} - * IID_IRMAPlayer: {00000402-0901-11d1-8B06-00A024406D59} - * IID_IRMAClientEngine: {00000403-0901-11d1-8B06-00A024406D59} - * IID_IRMAClientEngineSelector{00000404-0901-11d1-8B06-00A024406D59} - * IID_IRMAClientEngineSetup: {00000405-0901-11d1-8B06-00A024406D59} - * : {00000406-0901-11d1-8B06-00A024406D59} -- Deprecated - * IID_IRMAInfoLogger: {00000409-0901-11d1-8B06-00A024406D59} - * {0000040F-0901-11d1-8B06-00A024406D59} -- Deprecated - * IID_IRMAPlayer2: {00000411-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMACORE_H_ -DEFINE_GUID(IID_IRMAStream, 0x00000400, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAStreamSource, 0x00000401, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayer, 0x00000402, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAClientEngine, 0x00000403, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#ifdef _UNIX -DEFINE_GUID(IID_IRMAClientEngineSelector, 0x00000404, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -DEFINE_GUID(IID_IRMAClientEngineSetup, 0x00000405, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAInfoLogger, 0x00000409, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayer2, 0x00000411, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmaprefs.h - * Description: - * Interfaces related to persistent preferences services. - * Interfaces: - * IID_IRMAPreferences: {00000500-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAPREFS_H_ -DEFINE_GUID(IID_IRMAPreferences, 0x00000500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPreferences2, 0x00000503, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPreferenceEnumerator, 0x00000504, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - -/* - * File: - * rmamon.h - * Description: - * Interfaces related to Monitor plugins. - * Interfaces: - * IID_IRMAPNRegistry: {00000600-0901-11d1-8B06-00A024406D59} - * IID_IRMAPropWatch: {00000601-0901-11d1-8B06-00A024406D59} - * IID_IRMAPropWatchResponse: {00000602-0901-11d1-8B06-00A024406D59} - * IID_IRMAActiveRegistry: {00000603-0901-11d1-8B06-00A024406D59} - * IID_IRMAActivePropUser: {00000604-0901-11d1-8B06-00A024406D59} - * IID_IRMAActivePropUserResponse: {00000605-0901-11d1-8B06-00A024406D59} - * IID_IRMACopyRegistry: {00000606-0901-11d1-8B06-00A024406D59} - * IID_IRMAPNRegistryAltStringHandling: {00000607-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAMON_H_ -DEFINE_GUID(IID_IRMAPNRegistry, 0x00000600, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPropWatch, 0x00000601, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPropWatchResponse, 0x00000602, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAActiveRegistry, 0x00000603, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAActivePropUser, 0x00000604, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAActivePropUserResponse, 0x00000605, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMACopyRegistry, 0x00000606, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPNRegistryAltStringHandling, 0x00000607, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmaausvc.h - * Description: - * Interfaces related to audio services. - * Interfaces: - * IID_IRMAAudioPlayer: {00000700-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioPlayerResponse: {00000701-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioStream: {00000702-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioDevice: {00000703-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioDeviceResponse: {00000704-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioHook: {00000705-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioStreamInfoResponse: {00000706-0901-11d1-8B06-00A024406D59} - * IID_IRMAVolume: {00000707-0901-11d1-8B06-00A024406D59} - * IID_IRMAVolumeAdviseSink: {00000708-0901-11d1-8B06-00A024406D59} - * IID_IRMADryNotification: {00000709-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioDeviceManager: {0000070A-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioCrossFade: {0000070B-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioStream2: {0000070C-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioPushdown: {0000070D-0901-11d1-8B06-00A024406D59} - * IID_IRMAAudioHookManager: {0000070E-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAAudioPlayer, 0x00000700, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioPlayerResponse, 0x00000701, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioStream, 0x00000702, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioDevice, 0x00000703, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioDeviceResponse, 0x00000704, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioHook, 0x00000705, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioStreamInfoResponse, 0x00000706, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAVolume, 0x00000707, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAVolumeAdviseSink, 0x00000708, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADryNotification, 0x00000709, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioDeviceManager, 0x0000070A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioCrossFade, 0x0000070B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioStream2, 0x0000070C, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioPushdown, 0x0000070D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAudioHookManager, 0x0000070E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaerror.h - * Description: - * Interfaces related to error reporting and receiving notification of errors. - * Interfaces: - * IID_IRMAErrorMessages: {00000800-0901-11d1-8B06-00A024406D59} - * IID_IRMAErrorSink: {00000801-0901-11d1-8B06-00A024406D59} - * IID_IRMAErrorSinkControl: {00000802-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAERROR_H_ -DEFINE_GUID(IID_IRMAErrorMessages, 0x00000800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAErrorSink, 0x00000801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAErrorSinkControl, 0x00000802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmahyper.h - * Description: - * Simple Hyper Navigation Interfaces - * Interfaces: - * IID_IRMAHyperNavigate: {00000900-0901-11d1-8B06-00A024406D59} - * IID_IRMAHyperNavigate2: {00000901-0901-11d1-8B06-00A024406D59} - * IID_IRMAHyperNavigateWithContext: {00000902-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAHyperNavigate, 0x00000900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaclsnk.h - * Description: - * Client Advise Sink Interfaces - * Interfaces: - * IID_IRMAClientAdviseSink: {00000B00-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAClientAdviseSink, 0x00000B00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaplugn.h - * Description: - * Plugin inspector interface - * Interfaces: - * IID_IRMAPlugin: {00000C00-0901-11d1-8B06-00A024406D59} - * IID_IRMAPluginEnumerator {00000C01-0901-11d1-8B06-00A024406D59} - * IID_IRMAPluginGroupEnumerator {00000C02-0901-11d1-8B06-00A024406D59} - * IID_IRMAPluginReloader {00000C03-0901-11d1-8B06-00A024406D59} - * IID_IRMAPluginFactory {00000C04-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAPLUGN_H_ -DEFINE_GUID(IID_IRMAPlugin, 0x00000C00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPluginEnumerator, 0x00000C01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPluginGroupEnumerator, 0x00000C02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPluginReloader, 0x00000C03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPluginFactory, 0x00000C04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmawin.h - * Description: - * Site interfaces - * Interfaces: - * IID_IRMASiteWindowed: {00000D01-0901-11d1-8B06-00A024406D59} - * IID_IRMASiteWindowless: {00000D02-0901-11d1-8B-6-00A024406D59} - * IID_IRMASite: {00000D03-0901-11d1-8B-6-00A024406D59} - * IID_IRMASiteUser: {00000D04-0901-11d1-8B-6-00A024406D59} - * IID_IRMASiteWatcher: {00000D05-0901-11d1-8B-6-00A024406D59} - * IID_IRMASiteUserSupplier: {00000D06-0901-11d1-8B-6-00A024406D59} - * IID_IRMASiteSupplier: {00000D07-0901-11d1-8B-6-00A024406D59} - * IID_IRMASiteManager: {00000D08-0901-11d1-8B-6-00A024406D59} - * IID_IRMAMultiInstanceSiteUserSupplier: {00000D09-0901-11d1-8B-6-00A024406D59} - * IID_IRMASite2: {00000D0A-0901-11d1-8B-6-00A024406D59} - * IID_IRMASiteFullScreen {00000D0B-0901-11d1-8B-6-00A024406D59} - * IID_IRMAEventHookMgr {00000D0D-0901-11d1-8B-6-00A024406D59} - * IID_IRMAEventHook {00000D0E-0901-11d1-8B-6-00A024406D59} - * IID_IRMAPassiveSiteWatcher {00000D0F-0901-11d1-8B-6-00A024406D59} - * IID_IRMAStatusMessage {00000D10-0901-11d1-8B-6-00A024406D59} - */ -#ifndef _RMAWIN_H_ -DEFINE_GUID(IID_IRMASiteWindowed, 0x00000D01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteWindowless, 0x00000D02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASite, 0x00000D03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteUser, 0x00000D04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteWatcher, 0x00000D05, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteUserSupplier, 0x00000D06, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteSupplier, 0x00000D07, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteManager, 0x00000D08, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAMultiInstanceSiteUserSupplier, 0x00000D09, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASite2, 0x00000D0A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMASiteFullScreen, 0x00000D0B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAEventHookMgr, 0x00000D0D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAEventHook, 0x00000D0E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPassiveSiteWatcher, 0x00000D0F, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAStatusMessage, 0x00000D10, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmaformt.h - * Description: - * Interfaces related to file and broadcast format plugins. - * Interfaces: - * - * IID_IRMAFileFormatObject: {00000F00-0901-11d1-8B06-00A024406D59} - * IID_IRMABroadcastFormatObject: {00000F01-0901-11d1-8B06-00A024406D59} - * IID_IRMAFormatResponse: {00000F02-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacketFormat: {00000F03-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacketTimeOffsetHandler {00000F04-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacketTimeOffsetHandlerResponse {00000F05-0901-11d1-8B06-00A024406D59} - * IID_IRMALiveFileFormatInfo {00000F06-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAFORMT_H_ -DEFINE_GUID(IID_IRMAFileFormatObject, 0x00000F00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMABroadcastFormatObject, 0x00000F01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFormatResponse, 0x00000F02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacketFormat, 0x00000F03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacketTimeOffsetHandler, 0x00000F04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacketTimeOffsetHandlerResponse, 0x00000F05, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMALiveFileFormatInfo, 0x00000F06, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - -/* - * File: - * rmapends.h - * Description: - * Interfaces related to get pending status from objects - * Interfaces: - * IRMAPendingStatus: {00001100-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAPENDS_H_ -DEFINE_GUID(IID_IRMAPendingStatus, 0x00001100, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmapckts.h - * Description: - * Interfaces related to buffers, packets, streams, etc. - * Interfaces: - * IID_IRMABuffer: {00001300-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacket: {00001301-0901-11d1-8B06-00A024406D59} - * IID_IRMARTPPacket {0169A731-1ED0-11d4-952B-00902742C923} - * IID_IRMAValues: {00001302-0901-11d1-8B06-00A024406D59} - * IID_IRMAValuesRemove: {00001303-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAPCKTS_H_ -DEFINE_GUID(IID_IRMABuffer, 0x00001300, 0x0901, 0x11d1, 0x8b, 0x06, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacket, 0x00001301, 0x0901, 0x11d1, 0x8b, 0x06, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARTPPacket, 0x0169a731, 0x1ed0, 0x11d4, 0x95, 0x2b, 0x0, 0x90, 0x27, 0x42, 0xc9, 0x23); -DEFINE_GUID(IID_IRMAValues, 0x00001302, 0x0901, 0x11d1, 0x8b, 0x06, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAValuesRemove, 0x00001303, 0x0901, 0x11d1, 0x8b, 0x06, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmaasm.h - * Description: - * Interfaces related to abm and back channel support. - * - * Interfaces: - * IID_IRMABackChannel: {00001500-0901-11d1-8B06-00A024406D59} - * IID_IRMAASMSource: {00001501-0901-11d1-8B06-00A024406D59} - * IID_IRMAASMStream: {00001502-0901-11d1-8B06-00A024406D59} - * IID_IRMAASMStreamSink: {00001503-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAASM_H_ -DEFINE_GUID(IID_IRMABackChannel, 0x00001500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAASMSource, 0x00001501, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAASMStream, 0x00001502, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAASMStreamSink, 0x00001503, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmaencod.h - * Description: - * Interfaces related to superencoders. - * - * Interaces: - * IID_IRMAEncoderResponse {00001600-0901-11d1-8B06-00A024406D59} - * IID_IRMAEncoder {00001601-0901-11d1-8B06-00A024406D59} - * IID_IRMAEncoderCompletion {00001602-0901-11d1-8B06-00A024406D59} - * IID_IRMAConnectionlessControl - {00001603-0901-11d1-8B06-00A024406D59} - * IID_IRMAEncoderResponseCompletion - {00001604-0901-11d1-8B06-00A024406D59} - * IID_IRMATransportControl {00001605-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAENCOD_H_ -DEFINE_GUID(IID_IRMAEncoderResponse, 0x00001600, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAEncoder, 0x00001601, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAEncoderCompletion, 0x00001602, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAConnectionlessControl, - 0x00001603, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAEncoderResponseCompletion, - 0x00001604, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMATransportControl, 0x00001605, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmaauth.h - * Description: - * Password handling API - * Interfaces: - * IID_IRMAPassword {00001700-0901-11d1-8B06-00A024406D59} - */ - -/* - * 000017**-0901-11d1-8B06-00A024406D59 is reserved for interfaces in rmaauth.h (below) - */ - -/* - * File: - * rmaauth.h - * Description: - * Authentication API - * Interfaces: - * IID_IRMAAuthenticator {00001800-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticatorResponse {00001801-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticatorRequest {00001802-0901-11d1-8B06-00A024406D59} - * IID_IRMAPassword {00001700-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticationManager {00001A00-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticationManagerResponse - * {00001A01-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAAUTH_H_ -DEFINE_GUID(IID_IRMAAuthenticator, 0x00001800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticatorResponse, 0x00001801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticatorRequest, 0x00001802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPassword, 0x00001700, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticationManager, 0x00001a00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticationManagerResponse, 0x00001a01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmasdesc.h - * Description: - * Stream description API - * Interfaces: - * IID_IRMAStreamDescription {00001900-0901-11d1-8B06-00A024406D59} - * IID_IRMARTPPacketInfo {00001901-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMASDESC_ -DEFINE_GUID(IID_IRMAStreamDescription, 0x00001900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARTPPacketInfo, 0x00001901, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * 00001A**-0901-11d1-8B06-00A024406D59 is reserved for interfaces in rmaauth.h (above) - */ - -/* - * File: - * rmalvtxt.h - * Description: - * Interfaces related to live text superencoder. - * - * Interaces: - * IID_IRMALiveText {00001b00-0901-11d1-8B06-00A024406D59} - * IID_IRMALiveText2 {00001b01-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMALVTXT_H_ -DEFINE_GUID(IID_IRMALiveText, 0x00001b00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMALiveText2, 0x00001b01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif -/* - * File: - * rmacfg.h - * Description: - * Interfaces used by server configuration tools. - * - * Interfaces: - * IID_IRMAConfigFile {00001c00-0901-11d1-8B06-00A024406D59} - * IID_IRMARegConfig {00001c01-0901-11d1-8B06-00A024406D59} - * - */ -#ifndef _RMACFG_H_ -DEFINE_GUID(IID_IRMAConfigFile, 0x00001c00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARegConfig, 0x00001c01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - -/* - * File: - * rmappv.h - * Description: - * Interfaces related to Pay Per View Database Plugins - * Interfaces: - * IID_IRMAPPVDatabase {00001d00-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAPPVDatabase, - 0x00001d00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -/* - * 00001e**-0901-11d1-8B06-00A024406D59 is reserved for an interface which - * has been deprecated. - */ - -/* - * File: - * rmacmenu.h - * Description: - * Interfaces used by renderers for context menus. - * - * Interfaces: - * IID_IRMAContextMenu {00001f00-0901-11d1-8B06-00A024406D59} - * IID_IRMAContextMenuResponse {00001f01-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMACMENU_H_ -DEFINE_GUID(IID_IRMAContextMenu, 0x00001f00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAContextMenuResponse, 0x00001f01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#endif -/* - * File: - * rmaphook.h - * Description: - * Interfaces used by the top level client. client core and renderer to - * support Selective Record. - * - * Interfaces: - * IID_IRMAPacketHook {00002000-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacketHookManager {00002001-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacketHookHelper {00002002-0901-11d1-8B06-00A024406D59} - * IID_IRMAPacketHookHelperResponse {00002003-0901-11d1-8B06-00A024406D59} - */ - -DEFINE_GUID(IID_IRMAPacketHook, 0x00002000, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacketHookManager, 0x00002001, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacketHookHelper, 0x00002002, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPacketHookHelperResponse, 0x00002003, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmapsink.h - * Description: - * Interfaces used by the top level client or renderers to determine - * that a player has been created or closed. - * - * Interfaces: - * IID_IRMAPlayerCreationSink {00002100-0901-11d1-8B06-00A024406D59} - * IID_IRMAPlayerSinkControl {00002101-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAPlayerCreationSink, 0x00002100, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayerSinkControl, 0x00002101, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmavsurf.h - * Description: - * Interface used by renderers to blt data to the screen (when in - * full screen mode). - * - * Interfaces: - * IID_IRMAVideoSurface {00002200-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAVideoSurface, 0x00002200, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -/* - * File: - * rmagroup.h - * Description: - * Client side Group related interfaces - * - * Interfaces: - * IID_IRMAGroup {00002400-0901-11d1-8B06-00A024406D59} - * IID_IRMAGroupManager {00002401-0901-11d1-8B06-00A024406D59} - * IID_IRMAGroupSink {00002402-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAGroup, 0x00002400, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAGroupManager, 0x00002401, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAGroupSink, 0x00002402, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaupgrd.h - * Description: - * Interfaces used by player for auto-upgrade. - * - * Interfaces: - * IID_IRMAUpgradeCollection {00002500-0901-11d1-8B06-00A024406D59} - * IID_IRMAUpgradeHandler {00002501-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAUpgradeCollection, - 0x00002500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAUpgradeHandler, - 0x00002501, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaallow.h - * Description: - * Interfaces related to Allowance plugins - * Interfaces: - * IID_IRMAPlayerConnectionAdviseSink {00002600-0901-11d1-8B06-00A024406D59} - * IID_IRMAPlayerConnectionResponse {00002601-0901-11d1-8B06-00A024406D59} - * IID_IRMAPlayerController {00002602-0901-11d1-8B06-00A024406D59} - * IID_IRMAPlayerConnectionAdviseSinkManager - {00002603-0901-11d1-8B06-00A024406D59} - * IID_IRMAProxyConnectionAdviseSink {00002604-0901-11d1-8B06-00A024406D59} - * IID_IRMAProxyConnectionResponse {00002605-0901-11d1-8B06-00A024406D59} - * IID_IRMAProxyController {00002605-0901-11d1-8B06-00A024406D59} - * IID_IRMAPlayerControllerProxyRedirect {00002607-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAPlayerConnectionAdviseSink, - 0x00002600, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayerConnectionResponse, - 0x00002601, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayerController, - 0x00002602, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayerConnectionAdviseSinkManager, - 0x00002603, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -DEFINE_GUID(IID_IRMAProxyConnectionAdviseSink, - 0x00002604, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAProxyConnectionResponse, - 0x00002605, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAProxyController, - 0x00002606, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPlayerControllerProxyRedirect, 0x00002607, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaaconf.h - * Description: - * Interfaces used by the top level client. client core to - * support Auto. Transport Configuration - * - * Interfaces: - * IID_IRMAAutoConfig {00002700-0901-11d1-8B06-00A024406D59} - * IID_IRMAAutoConfigResponse {00002701-0901-11d1-8B06-00A024406D59} - */ - -DEFINE_GUID(IID_IRMAAutoConfig, 0x00002700, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAutoConfigResponse, 0x00002701, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaauthn.h - * Description: - * Interfaces used to validate a users access to content. - * - * Interfaces: - * IID_IRMACredRequestResponse, {00002800-0901-11d1-8B06-00A024406D59} - * IID_IRMACredRequest, {00002801-0901-11d1-8B06-00A024406D59} - * IID_IRMAClientAuthResponse, {00002802-0901-11d1-8B06-00A024406D59} - * IID_IRMAClientAuthConversation, {00002803-0901-11d1-8B06-00A024406D59} - * IID_IRMAServerAuthResponse, {00002804-0901-11d1-8B06-00A024406D59} - * IID_IRMAServerAuthConversation, {00002805-0901-11d1-8B06-00A024406D59} - * IID_IRMAUserContext, {00002806-0901-11d1-8B06-00A024406D59} - * IID_IRMAUserProperties, {00002807-0901-11d1-8B06-00A024406D59} - * IID_IRMAUserImpersonation, {00002808-0901-11d1-8B06-00A024406D59} - * IID_IRMAUserDB, {00002809-0901-11d1-8B06-00A024406D59} - * IID_IRMAChallengeResponse, {0000280A-0901-11d1-8B06-00A024406D59} - * IID_IRMAChallenge, {0000280B-0901-11d1-8B06-00A024406D59} - */ - -DEFINE_GUID(IID_IRMACredRequestResponse, 0x00002800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMACredRequest, 0x00002801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAClientAuthResponse, 0x00002802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAClientAuthConversation, 0x00002803, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAServerAuthResponse, 0x00002804, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAServerAuthConversation, 0x00002805, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAUserContext, 0x00002806, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAUserProperties, 0x00002807, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAUserImpersonation, 0x00002808, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAChallengeResponse, 0x00002809, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAChallenge, 0x0000280A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -/* - * File: - * rmaplgns.h - * - * Description: - * Interfaces for Plugins: - * IRMAObjectConfiguration - Consistant configuration. - * IRMAPluginProperties - Consistant property retrival. - * - * Interfaces: - * IID_IRMAObjectConfiguration: {00002900-0901-11d1-8B06-00A024406D59} - * IID_IRMAPluginProperties: {00002901-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAObjectConfiguration, 0x00002900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPluginProperties, 0x00002901, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmadb.h - * - * Description: - * Interfaces for Plugins: - * IRMADatabaseManager - Creates Configured Database Instances - * IRMAAuthenticationDBManagerResponse - Provides Callbacks for IRMAAuthenticationDBManager - * IRMAAuthenticationDBManager - Functions to add and remove users from a database - * IRMAAsyncEnumAuthenticationDBResponse - Provides Callbacks for IRMAAsyncEnumAuthenticationDB - * IRMAAsyncEnumAuthenticationDB - Functions to enumerate the list of users in a database - * IRMAAuthenticationDBAccessResponse - Provides Callbacks for IRMAAuthenticationDBAccess - * IRMAAuthenticationDBAccess - Functions to access a users info in the database - * IRMAGUIDDBManagerResponse - Provides Callbacks for IRMAGUIDDBManager - * IRMAGUIDDBManager - Functions to add and remove GUID's from a database - * IRMAPPVDBManagerResponse - Provides Callbacks for IRMAPPVDBManager - * IRMAPPVDBManager - Functions to add, remove, and adjust a user's permissions from a database - * IRMARedirectDBManagerResponse - Provides Callbacks for IRMARedirectDBManager - * IRMARedirectDBManager - Functions to add and remove URL Redirects from a database - * IRMARegistrationLoggerResponse - Provides Callbacks for IRMARegistrationLogger - * IRMARegistrationLogger - Functions to Log registration Activity. - * - * Interfaces: - * IID_IRMADatabaseManager: {00002A00-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticationDBManagerResponse: {00002A01-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticationDBManager: {00002A02-0901-11d1-8B06-00A024406D59} - * IID_IRMAAsyncEnumAuthenticationDBResponse:{00002A03-0901-11d1-8B06-00A024406D59} - * IID_IRMAAsyncEnumAuthenticationDB: {00002A04-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticationDBAccessResponse: {00002A05-0901-11d1-8B06-00A024406D59} - * IID_IRMAAuthenticationDBAccess: {00002A06-0901-11d1-8B06-00A024406D59} - * IID_IRMAGUIDDBManagerResponse: {00002A07-0901-11d1-8B06-00A024406D59} - * IID_IRMAGUIDDBManager: {00002A08-0901-11d1-8B06-00A024406D59} - * IID_IRMAPPVDBManagerResponse: {00002A09-0901-11d1-8B06-00A024406D59} - * IID_IRMAPPVDBManager: {00002A0A-0901-11d1-8B06-00A024406D59} - * IID_IRMARedirectDBManagerResponse: {00002A0B-0901-11d1-8B06-00A024406D59} - * IID_IRMARedirectDBManager: {00002A0C-0901-11d1-8B06-00A024406D59} - * IID_IRMARegistrationLoggerResponse: {00002A0D-0901-11d1-8B06-00A024406D59} - * IID_IRMARegistrationLogger: {00002A0E-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMADatabaseManager, 0x00002A00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticationDBManagerResponse, 0x00002A01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticationDBManager, 0x00002A02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAsyncEnumAuthenticationDBResponse, 0x00002A03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAsyncEnumAuthenticationDB, 0x00002A04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticationDBAccessResponse, 0x00002A05, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAAuthenticationDBAccess, 0x00002A06, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAGUIDDBManagerResponse, 0x00002A07, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAGUIDDBManager, 0x00002A08, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPPVDBManagerResponse, 0x00002A09, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAPPVDBManager, 0x00002A0A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARedirectDBManagerResponse, 0x00002A0B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARedirectDBManager, 0x00002A0C, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARegistrationLoggerResponse, 0x00002A0D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMARegistrationLogger, 0x00002A0E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -/* - * File: - * rmaxmltg.h - * - * Description: - * Interfaces for Plugins: - * IRMAXMLTagHandler: Interface for registering for a specific tag - * and providing an IRMAXMLTagObject to tagfsys. - * (Works like IRMAFileSystemObject) - * - * IRMAXMLTagObject: Interface for receiving the contents of a tag - * for which the creating IRMAXMLTagHandler has registerd. - * - * IRMAXMLTagObjectResponse: Interface for IRMAXMLTagObject to return - * the replacement for the tag. This is implemented by tagfsys. - * - * - * Interfaces: - * IID_IRMAXMLTagObjectResponse: {00002C02-0901-11d1-8B06-00A024406D59} - * IID_IRMAXMLTagHandler: {00002C03-0901-11d1-8B06-00A024406D59} - * IID_IRMAXMLTagObject: {00002C04-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAXMLTG_H -DEFINE_GUID(IID_IRMAXMLTagObjectResponse, 0x00002C02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAXMLTagHandler, 0x00002C03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAXMLTagObject, 0x00002C04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - - -/* - * File: - * rmacache.h - * - * Description: - * Interfaces for caching services: - * IRMACache - Creates IRMACacheFiles - * IRMACacheResponse - Response object for IRMACache - * IRMACacheFile - Persistant store object for caching - * IRMACacheFileResponse - Response object for IRMACacheFile - * - * Interfaces: - * IID_IRMACache: {00002E00-0901-11d1-8B06-00A024406D59} - * IID_IRMACacheResponse: {00002E01-0901-11d1-8B06-00A024406D59} - * IID_IRMACacheFile: {00002E02-0901-11d1-8B06-00A024406D59} - * IID_IRMACacheFileResponse: {00002E03-0901-11d1-8B06-00A024406D59} - * IID_IRMAMIIFetch: {00002E04-0901-11d1-8B06-00A024406D59} - */ - -DEFINE_GUID(IID_IRMACache, 0x00002E00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMACacheResponse, 0x00002E01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMACacheFile, 0x00002E02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMACacheFileResponse, 0x00002E03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAMIIFetch, 0x00002E04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -/* - * File: intrpm.h - * - * IID_IRMAInterPluginMessenger: {00003000-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAInterPluginMessenger, 0x00003000, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: rmavalue.h - * - * DEPRECATED: {00003100-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003101-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003102-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003103-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003104-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003105-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003106-0901-11d1-8B06-00A024406D59} - * DEPRECATED: {00003107-0901-11d1-8B06-00A024406D59} - * - * IID_IRMAKeyValueList: {00003108-0901-11d1-8B06-00A024406D59} - * IID_IRMAKeyValueListIter: {00003109-0901-11d1-8B06-00A024406D59} - * IID_IRMAKeyValueListIterOneKey: {00003110-0901-11d1-8B06-00A024406D59} - * IID_IRMAOptions: {00003111-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAVALUE_H_ -/* DEPRECATED 3100 - 3107 */ -DEFINE_GUID(IID_IRMAKeyValueList, 0x00003108, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAKeyValueListIter, 0x00003109, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAKeyValueListIterOneKey, 0x00003110, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAOptions, 0x00003111, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - -/* - * File: - * rmcookie.h - * - * Description: - * Interfaces for Plugins: - * IRMACookies - Cookie database management APIs - * IRMACookiesHelper - Cookie output helper APIs - * - * Interfaces: - * IID_IRMACookies: {00003200-0901-11d1-8B06-00A024406D59} - * IID_IRMACookiesHelper: {00003201-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMACookies, 0x00003200, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMACookiesHelper, 0x00003201, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: addrpool.h - * - * IID_IRMAMulticastAddressPool: {00003300-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAMulticastAddressPool, 0x00003300, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: sapmgr.h - * - * IID_IRMASapManager: {00003400-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMASapManager, 0x00003400, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmavsrc.h - * - * Description: - * Interfaces for Plugins: - * IRMAFileViewSource - Interface so file formats can support view source. - * IRMAFileViewSourceResponse - Response interface. - * - * Interfaces: - * IID_IRMAFileViewSource: {00003500-0901-11d1-8B06-00A024406D59} - * IID_IRMAFileViewSourceResponse: {00003501-0901-11d1-8B06-00A024406D59} - * IID_IRMAViewSourceCommand: {00003504-0901-11d1-8B06-00A024406D59} - * IID_IRMAViewSourceURLResponse {00003505-0901-11d1-8B06-00A024406D59} - */ -#ifndef _RMAVSRC_H_ -DEFINE_GUID(IID_IRMAFileViewSource, 0x00003500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAFileViewSourceResponse, 0x00003501, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAViewSourceCommand, 0x00003504, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMAViewSourceURLResponse, 0x00003505, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#endif - - - - - -/* File: - * embdengn.h - * - * Description: - * - * IRCAEmbeddedPlayerEngine - RCA embedded player engine - */ - -DEFINE_GUID(IID_IRCAEmbeddedEngine, - 0x00003800, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* File: - * embdctxt.h - * - * Description: - * - * IRCAEmbeddedContext - RCA embedded player engine context - */ - -DEFINE_GUID(IID_IRCAEmbeddedContext, - 0x00003801, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* File: - * embdplay.h - * - * Description: - * - * IRCAEmbeddedPlayer - RCA embedded player interface - */ - -DEFINE_GUID(IID_IRCAEmbeddedPlayer, - 0x00003802, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* File: - * embdsink.h - * - * Description: - * - * IRCAEmbeddedSink - RCA embedded player event sink - * IRCAEmbeddedSinkResponse - RCA embedded player event sink response object - */ - -DEFINE_GUID(IID_IRCAEmbeddedSink, - 0x00003803, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRCAEmbeddedSinkResponse, - 0x00003804, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* File: - * embdstrm.h - * - * Description: - * - * IRCAEmbeddedStreamManager - RCA embedded player stream manager - * IRCAEmbeddedStream - RCA embedded player stream - */ - -DEFINE_GUID(IID_IRCAEmbeddedStreamManager, - 0x00003805, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRCAEmbeddedStream, - 0x00003806, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* File: - * rmadtcvt.h - * - * Description - * IRMADataConvertSystemObject - RMA Stream data conversion creator - * IRMADataConvert - RMA Stream data conversion - * IRMADataConvertResponse - response for above - * IRMADataRevert - RMA Stream data reversion - * IRMADataRevertResponse - response for above - */ -DEFINE_GUID(IID_IRMADataConvertSystemObject, - 0x00003900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADataConvert, - 0x00003901, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADataConvertResponse, - 0x00003902, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADataRevert, - 0x00003903, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -DEFINE_GUID(IID_IRMADataRevertResponse, - 0x00003904, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * File: - * rmaslta.h - * - * Description: - * - * IRMASLTA - RMA version of slta. Simulates a live stream from file format. - * - * IRMASltaEvent - Allows events to be sent in an SLTA stream - */ -DEFINE_GUID(IID_IRMASLTA, - 0x00000D00, 0xb4c8, 0x11d0, 0x99, 0x95, 0x0, 0xa0, 0x24, 0x8d, 0xa5, 0xf0); - -DEFINE_GUID(IID_IRMASltaEvent, - 0x00000D01, 0xb4c8, 0x11d0, 0x99, 0x95, 0x0, 0xa0, 0x24, 0x8d, 0xa5, 0xf0); - -#endif /* _RMAIIDS_H_ */ - diff --git a/include/realmedia/rmalvpix.h b/include/realmedia/rmalvpix.h deleted file mode 100644 index 5ad3f8b92..000000000 --- a/include/realmedia/rmalvpix.h +++ /dev/null @@ -1,385 +0,0 @@ -/**************************************************************************** - * - * rmalvpix.h - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealPix live encoder interfaces - * - */ - -#ifndef _RMALVPIX_H -#define _RMALVPIX_H - -/* - * PixInitInfo - * - * This struct contains initialization information - * and is passed in in the IRMALiveRealPix::StartEncoder() - * method. All of the members of this struct are input variables. - */ -typedef struct PNEXPORT_CLASS _PixInitInfo -{ - UINT32 m_ulStructLength; /* length in bytes of this structure */ - char *m_pServerAddress; /* name or ip address of server */ - UINT32 m_ulServerPort; /* pn-encoder port on server */ - char *m_pUsername; /* username for authentication on server */ - char *m_pPassword; /* password for authentication on server */ - char *m_pFilename; /* filename which clients should open */ - char *m_pTitle; /* title of live presentation */ - char *m_pAuthor; /* author of live presentation */ - char *m_pCopyright; /* copyright on live presentation */ - UINT32 m_ulBitrate; /* bitrate of realpix stream */ - UINT32 m_ulMaxFps; /* max frames per second of effects */ - UINT32 m_ulDisplayWidth; /* display width in pixels */ - UINT32 m_ulDisplayHeight; /* display height in pixels */ - BOOL m_bPreserveAspect; /* preserve aspect ratio by default? */ - char *m_pDefaultURL; /* default URL to send browser to when clicked */ - UINT32 m_ulNumImageCodecs; /* number of image codecs used in this stream */ - char **m_ppImageCodec; /* string names of codecs */ - UINT32 m_ulNumEffectPackages; /* number of external effect packages used */ - char **m_ppEffectPackage; /* string names of effect packages*/ -} -PixInitInfo; - -/* - * PixImageInfo - * - * This struct contains all the information for images which - * should be sent down the stream. This struct is used in the - * IRMALiveRealPix::InitImage() method. - */ -typedef struct PNEXPORT_CLASS _PixImageInfo -{ - UINT32 m_ulStructLength; /* Input: size of struct */ - BYTE *m_pImageBuffer; /* Input: buffer holding image data */ - UINT32 m_ulImageBufferSize; /* Input: size of image buffer */ - char *m_pImageCodec; /* Input: image codec to be used */ - UINT32 m_ulHandle; /* Output: image handle */ - UINT32 m_ulNumPackets; /* Output: number of packets image will be sent */ - UINT32 m_ulTimeToSend; /* Output: milliseconds required to send image */ -} -PixImageInfo; - -#define EFFECT_FILL 0 -#define EFFECT_FADEIN 1 -#define EFFECT_FADEOUT 2 -#define EFFECT_CROSSFADE 3 -#define EFFECT_WIPE 4 -#define EFFECT_VIEWCHANGE 5 -#define EFFECT_EXTERNAL 6 -#define EFFECT_ANIMATE 7 - -#define WIPE_DIRECTION_UP 0 -#define WIPE_DIRECTION_DOWN 1 -#define WIPE_DIRECTION_LEFT 2 -#define WIPE_DIRECTION_RIGHT 3 - -#define WIPE_TYPE_NORMAL 0 -#define WIPE_TYPE_PUSH 1 - -/* - * PixEffectInfo - * - * This struct contains all the information about the effect which - * the RealPix renderer should perform. This struct is used in the - * IRMALiveRealPix::SendEffect() method. - */ -typedef struct PNEXPORT_CLASS _PixEffectInfo -{ - UINT32 m_ulStructLength; /* Input: Length in bytes of this struct */ - BYTE m_ucEffectType; /* Input: Effect Type: EFFECT_FILL, EFFECT_FADEIN, etc. */ - UINT32 m_ulStart; /* Input: Start time in milliseconds of effect */ - UINT32 m_ulDuration; /* Input: Duration in milliseconds of effect */ - UINT32 m_ulTarget; /* Input: Handle of image to perform effect on */ - UINT32 m_ulSrcX; /* Input: Horizontal offset of source rectangle */ - UINT32 m_ulSrcY; /* Input: Vertical offset of source rectangle */ - UINT32 m_ulSrcW; /* Input: Width of source rectangle */ - UINT32 m_ulSrcH; /* Input: Height of source rectangle */ - UINT32 m_ulDstX; /* Input: Horizontal offset of destination rectangle */ - UINT32 m_ulDstY; /* Input: Vertical offset of destination rectangle */ - UINT32 m_ulDstW; /* Input: Width of destination rectangle */ - UINT32 m_ulDstH; /* Input: Height of destination rectangle */ - UINT32 m_ulMaxFps; /* Input: Max frames per second for this effect */ - BOOL m_bAspectFlag; /* Input: TRUE: preserve aspect on this effect; FALSE: don't preserve */ - BYTE m_ucRed; /* Input: Red component of fill or fadeout color */ - BYTE m_ucGreen; /* Input: Green component of fill or fadeout color */ - BYTE m_ucBlue; /* Input: Blue component of fill or fadeout color */ - BYTE m_ucWipeDirection; /* Input: WIPE_DIRECTION_xxx, where xxx is UP, DOWN, LEFT, or RIGHT */ - BYTE m_ucWipeType; /* Input: WIPE_TYPE_NORMAL or WIPE_TYPE_PUSH */ - char *m_pURL; /* Input: URL for this effect */ - char *m_pExtPackage; /* Input: Name of external effect package */ - char *m_pExtName; /* Input: Name of external effect within the package */ - char *m_pExtData; /* Input Opaque string data for external effect */ - char *m_pExtFile; /* Input: File contents of external effect data */ - BOOL m_bDiscardImage; /* Input: TRUE: discard image after doing effect; FALSE: don't discard */ - BOOL m_bDisplayImmediately; /* Input: FALSE: obey start time; TRUE: do effect immediately */ - UINT32 m_ulHandle; /* Output: Handle by which effect will be referred to */ -} -PixEffectInfo; - -/* - * Forward declarations of some interfaces defined here. - */ -typedef _INTERFACE IRMALiveRealPix IRMALiveRealPix; -typedef _INTERFACE IRMALiveRealPixResponse IRMALiveRealPixResponse; -typedef _INTERFACE IRMALiveRealPixResend IRMALiveRealPixResend; - -/* - * Forward declarations of interfaces used here - */ -typedef _INTERFACE IRMAValues IRMAValues; - -/* - * Declaration of the DLL entry point - */ -STDAPI CreateLiveRealPix(IRMALiveRealPix **); - -typedef PN_RESULT (PNEXPORT_PTR FPRMCREATELIVEREALPIX)(IRMALiveRealPix **ppLiveRealPix); - -/**************************************************************************** - * - * Interface: - * - * IRMALivePix - * - * Purpose: - * - * Asynchronous interface that allows an application to encode live RealPix - * - * IID_IRMALiveRealPix: - * - * {E7ADF466-477D-11d2-AA0C-0060972D23A7} - * - */ -DEFINE_GUID(IID_IRMALiveRealPix, 0xe7adf466, 0x477d, 0x11d2, 0xaa, 0xc, 0x0, - 0x60, 0x97, 0x2d, 0x23, 0xa7); - -#undef INTERFACE -#define INTERFACE IRMALiveRealPix - -DECLARE_INTERFACE_(IRMALiveRealPix, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMALiveRealPix methods - */ - - /* - * StartEncoder() must be called before anything else and a pointer to - * an IRMALiveRealPixResponse interface must be passed in. The encoder will - * respond to this call asynchronously with IRMALiveRealPixResponse::EncoderStarted(). - */ - STDMETHOD(StartEncoder) (THIS_ PixInitInfo *pInitInfo, - IRMALiveRealPixResponse *pResponse) PURE; - - /* - * InitImage() is called to prep an image for being sent. It returns several useful - * pieces of information which the caller can make use of: the handle to refer to - * the image in SendImage(), the number of packets this image will be broken up into, - * and the time required to send this image in milliseconds. Note that InitImage() - * simply breaks the image up into packets - nothing has been sent to the server yet. - * This is not an asynchronous call - all processing has finished by the time this - * call returns. - */ - STDMETHOD(InitImage) (THIS_ PixImageInfo *pImageInfo) PURE; - - /* - * SendImage() tranfers the all the packets for the image referred to by ulImageHandle - * into the packet send queue. Further calls to Process() will result in these - * packets being sent to the RealServer. When all the packets for this image have - * been sent, the encoder will respond with IRMALiveRealPixResponse::ImageSent(). - */ - STDMETHOD(SendImage) (THIS_ UINT32 ulImageHandle) PURE; - - /* - * SendEffect() creates an effect packet with the information contained in - * the PixEffectInfo struct and immediately adds this packet to the packet - * send queue. Further calls to Process() will result in this packet being - * sent to the server. A handle is returned in the PixEffectInfo struct by - * which this effect can later be identified. When the effect has been - * sent to the server, the encoder will respond with - * IRMALiveRealPixResponse::EffectSent(). - */ - STDMETHOD(SendEffect) (THIS_ PixEffectInfo *pEffectInfo) PURE; - - /* - * StopEncoder() may be called at any time after calling StartEncoder(). - * This tells the encoder that no more images of effects are going to - * be sent to the encoder. The encoder shuts down the connection to - * the server and responds with IRMALiveRealPixResponse::EncoderStopped(). - */ - STDMETHOD(StopEncoder) (THIS) PURE; - - /* - * GetTime() returns the time in milliseconds since the encoder library was initialized. - */ - STDMETHOD_(UINT32, GetTime) (THIS) PURE; - - /* - * Process() must be called in order to give the library time to send - * packets to the server. It should be called very often in between SendImage() - * and ImageSent(), as well as between SendEffect() and EffectSent(). Other - * that these times, it should be called every 3-5 seconds. - */ - STDMETHOD(Process) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMALiveRealPixResponse - * - * Purpose: - * - * Asynchronous response interface that allows an application to - * encode live RealPix - * - * IID_IRMALiveRealPixResponse: - * - * {E7ADF46C-477D-11d2-AA0C-0060972D23A7} - * - */ -DEFINE_GUID(IID_IRMALiveRealPixResponse, 0xe7adf46c, 0x477d, 0x11d2, 0xaa, 0xc, 0x0, - 0x60, 0x97, 0x2d, 0x23, 0xa7); - - -#undef INTERFACE -#define INTERFACE IRMALiveRealPixResponse - -DECLARE_INTERFACE_(IRMALiveRealPixResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMALiveRealPixResponse methods - */ - - /* - * EncoderStarted() is the asynchronous response to StartEncoder(). The status - * argument tells whether initializing the server was successful or not, and the pszHeaderString - * argument returns the text string returned by the RealServer. - */ - STDMETHOD(EncoderStarted) (THIS_ PN_RESULT status, const char *pszHeaderString) PURE; - - /* - * ImageSent() is the asynchronous response to SendImage(). The ulImageHandle argument - * identifies which image has just completed sending to the server, and the status - * argument tells whether or not the send was successful or not. - */ - STDMETHOD(ImageSent) (THIS_ PN_RESULT status, UINT32 ulImageHandle) PURE; - - /* - * EffectSent() is the asynchronous response to SendEffect(). The ulEffectHandle argument - * identifies which effect has just completed sending to the server, and the status - * argument tells whether or not the send was successful or not. - */ - STDMETHOD(EffectSent) (THIS_ PN_RESULT status, UINT32 ulEffectHandle) PURE; - - /* - * EncoderStopped() is the asynchronous response to StopEncoder(). The status - * argument tells whether or not the stopping of the encoder was successful. - * If the status is PNR_OK, then the application can then shut down or turn - * around and call StartEncoder() again. - */ - STDMETHOD(EncoderStopped) (THIS_ PN_RESULT status) PURE; - - /* - * ErrorOccurred() is called when the encoder receives an error from the RealServer. - * Depending upon the severity of the error, the RealServer may then shut down - * the encoder and an EncoderStopped() call would be made. Therefore, the - * application should be ready to handle an EncoderStopped() call at any time. - * If an error occurs, it's probably a good idea to call StopEncoder() and shut - * down the encoder from the application side anyway. - */ - STDMETHOD(ErrorOccurred) (THIS_ const UINT8 unSeverity, - const ULONG32 ulRMACode, - const ULONG32 ulUserCode, - const char *pszUserString, - const char *pszMoreInfoURL) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMALiveRealPixResend - * - * Purpose: - * - * Allows re-sending and releasing of images with IRMALiveRealPix - * - * IID_IRMALiveRealPixResend: - * - * {D814DA11-8B02-11D3-8AF3-00C0F030B4E5} - */ -DEFINE_GUID(IID_IRMALiveRealPixResend, 0xd814da11, 0x8b02, 0x11d3, 0x8a, 0xfe, 0x0, - 0xc0, 0xf0, 0x30, 0xb4, 0xe5); - - -#undef INTERFACE -#define INTERFACE IRMALiveRealPixResend - -DECLARE_INTERFACE_(IRMALiveRealPixResend, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMALiveRealPixResend methods - */ - - /* - * InitResend() informs the encoder that from now on, after an - * image is sent with SendImage() it should not be discarded - * but held in the encoder until ReleaseImage() is called(). - */ - STDMETHOD(InitResend) (THIS_ IRMAValues* pOptions) PURE; - - /* - * ReleaseImage() informs the encoder that the application no longer - * intends to call SendImage() on the image referenced by ulImageHandle - * and that it can discard the image. Further calls to SendImage(x) will - * return PNR_UNKNOWN_IMAGE after ReleaseImage(x) has been called. - * ReleaseImage(x) will return PNR_UNKNOWN_IMAGE if x is an unknown handle. - */ - STDMETHOD(ReleaseImage) (THIS_ UINT32 ulImageHandle) PURE; - - /* - * DumpAllQueuedPackets() clears any packets currently waiting to be - * sent to the server. These packets were put on the send queue by - * either IRMALiveRealPix::SendImage() or IRMALiveRealPix::SendEffect(). - */ - STDMETHOD(DumpAllQueuedPackets) (THIS) PURE; -}; - -#endif diff --git a/include/realmedia/rmalvtxt.h b/include/realmedia/rmalvtxt.h deleted file mode 100644 index 98f58fb05..000000000 --- a/include/realmedia/rmalvtxt.h +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************** - * - * $Id: rmalvtxt.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealText encoder class using the SuperEncoder library. - * - */ - -#ifndef _RMALVTXT_H_ -#define _RMALVTXT_H_ - -/* These need to be visible to rtlive and to exlvtext: */ -/* For live, duration is max allowed val, or max ulong: - */ -#if !defined(MAX_ULONG32) -# define MAX_ULONG32 0xFFFFFFFF -#endif -#if !defined(MIN_LONG32) -# define MIN_LONG32 0xFFFFFFFF -#endif - -/* These, too, need to be visible to rtlive and to exlvtext: */ -#define MAX_PACKET_SIZE 500 -#define USE_DEFAULT_TYPE NULL -#define USE_DEFAULT_HEIGHT MAX_ULONG32 -#define USE_DEFAULT_WIDTH MAX_ULONG32 -#define USE_DEFAULT_SCROLLRATE MIN_LONG32 -#define USE_DEFAULT_CRAWLRATE MIN_LONG32 -#define USE_DEFAULT_BGCOLOR NULL -#define USE_DEFAULT_LINKCOLOR NULL -#define USE_DEFAULT_LINKUNDERLINING 0x2 -#define USE_DEFAULT_WORDWRAP 0x2 -#define USE_DEFAULT_DOLOOPING 0L - -#define USE_DEFAULT_IGNOREEXTRASPACES FALSE - - -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMALiveText IRMALiveText; -typedef _INTERFACE IRMALiveText2 IRMALiveText2; - -STDAPI -CreateLiveText(IRMALiveText**); - -typedef PN_RESULT (PNEXPORT_PTR FPRMCREATELIVETEXT)(IRMALiveText** ppLiveText); - - -DEFINE_GUID(IID_IRMALiveText, 0x00001b00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMALiveText - -DECLARE_INTERFACE_(IRMALiveText, IUnknown) -{ - /***********************************************************************/ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /***********************************************************************/ - /* - * IRMALiveText methods - */ - - /* - * InitLiveText() must be called before any of the other IRMALiveText - * methods: - */ - STDMETHOD(InitLiveText) (THIS_ - /* - * This is the computer where the - * RMServer is running: - */ - char* pAddress, - /* - * This is the port number defined in - * the config file where the FSMount - * option has the following entry: - * { /encoder/, pn-encoder, Port=#### } - * where #### is the port number that - * encoders will use: - */ - UINT16 port, - char* pUsername, - char* pPassword, - /* - * This is the "file" name that - * RMPlayers can use to view the - * stream. For example, if your - * server was called "srv1" and the - * rtsp port in the config file was - * 8080, and the filename from the - * encoder was "foo.rtx", then a - * player could view the stream by - * opening the following location: - * "rtsp://srv1:8080/encoder/foo.rtx" - */ - char* pFilename) PURE; - - - /* ******************************************************************* */ - /* The following methods are to be called prior to sending any data - * and exist as overrides to the default attributes of a RealText - * presentation. Please see the section on the header tag - * in the realtext.htm in the SDK's doc directory for more information. - * Note: with live text, you do not need a tag; you must use - * the following methods to set the stream type (e.g., "tickertape"), - * window width, height, background color, ...etc. - */ - - STDMETHOD(SetType) (THIS_ - char* szType) PURE; - - STDMETHOD(SetWindowDimensions) (THIS_ - ULONG32 width, - ULONG32 height) PURE; - - STDMETHOD(SetTextMotion) (THIS_ - LONG32 scrollrate, - LONG32 crawlrate) PURE; - - STDMETHOD(SetBackgroundColor) (THIS_ - char* szBackgroundColor) PURE; - - STDMETHOD(SetHyperlinkInfo) (THIS_ - BOOL underlineHyperlinks, - char* szLinkColor) PURE; - - STDMETHOD(UseWordwrap) (THIS_ - BOOL useWordwrap) PURE; - /* - * This is for "TickerTape"-type windows only; it is ignored by all - * other types: - */ - STDMETHOD(SetDoLooping) (THIS_ - BOOL bDoLooping) PURE; - - - /* ******************************************************************* */ - - /* - * AddData() lets you add text to the stream. The second - * parameter, bSendImmediately, can be used to force the encoder to - * send all text that's been added (and not yet sent) immediately. - * Note: if bSendImmediately is FALSE, the encoder will decide when - * to send the text it has buffered based on the length of the text in - * the buffer and the time since the last packet was sent: - */ - STDMETHOD(AddData) (THIS_ - char* szMoreData, - BOOL bSendImmediately) PURE; - /* - * AddTickerItem() lets you add "tickertape" text to the stream. - * This method prepends "" to szTickerUpperData, and - * "" to szTickerLowerData. Calling: - * AddTickerItem("ABCD", "5 1/2", TRUE) - * is the same as calling - * AddData("ABCD", FALSE); - * AddData("5 1/2", TRUE); - * except that the former guarantees that the "upper" and "lower" - * items will be sent in the same packet. - * (Please see the comments above for AddData() for details on use of - * the second parameter, bSendImmediately. - */ - STDMETHOD(AddTickerItem) (THIS_ - char* szTickerUpperData, - char* szTickerLowerData, - BOOL bSendImmediately) PURE; - - - /* ******************************************************************* */ - /* - * flush() tells the encoder to send everything that's in the buffer and - * clear it: - */ - STDMETHOD(flush) (THIS) PURE; - - - /* ******************************************************************* */ - /* - * GetTime returns the current system time in milliseconds. The return - * value is a UINT32 (32-bit unsigned int): - */ - STDMETHOD_(UINT32,GetTime) (THIS) PURE; - - - /* ******************************************************************* */ - /* - * This must be called on a regular basis: - */ - STDMETHOD(Process) (THIS) PURE; - - - /* ******************************************************************* */ - /* - * These methods keep track of the encoder's state and must be called - * as they are in main.cpp in the exlvtext directory: - */ - STDMETHOD_(BOOL,EncoderIsInitialized) (THIS) PURE; - STDMETHOD_(BOOL,PacketsHaveStarted) (THIS) PURE; - STDMETHOD_(BOOL,EncoderIsDone) (THIS) PURE; - STDMETHOD(SetEncoderDone) (THIS) PURE; -}; - - -DEFINE_GUID(IID_IRMALiveText2, 0x00001b01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMALiveText2 - -DECLARE_INTERFACE_(IRMALiveText2, IUnknown) -{ - /***********************************************************************/ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /***********************************************************************/ - /* - * IRMALiveText2 methods - */ - - /* ******************************************************************* */ - /* The following methods are to be called prior to sending any data - * and exist as overrides to the default attributes of a RealText - * presentation. Please see the section on the header tag - * in the realtext.htm in the SDK's doc directory for more information. - * Note: these are additional to the IRMALiveText methods, listed - * above. - */ - - /* This allows you to give an estimate of the bit rate needed by a live - * text stream so that the server can determine whether or not a player - * can view the stream based on its available bandwidth This method - * should be called before sending any data:: - */ - STDMETHOD(DeclareAverageBitrate) (THIS_ - ULONG32 ulAvgBitsPerSecond) PURE; - - /* As above, for DeclareAverageBitrate, this method should be called - * before sending any data:: - */ - STDMETHOD(DeclareMaximumBitrate) (THIS_ - ULONG32 ulMaxBitsPerSecond) PURE; - - /*This determines how multiple contiguous space characters are presented; - * Defaults to FALSE which means that multiple spaces in non-tag text - * would all be renderered. If this value is TRUE, multiple contiguous - * spaces will be treated as a single space. This method should be - * called before sending any data. - */ - STDMETHOD(IgnoreExtraSpaces) (THIS_ - BOOL bIgnoreExtraSpaces) PURE; - - /* This is for internal testing use only and does not affect the - * presentation of a live text stream: - */ - STDMETHOD(SetFlags) (THIS_ - ULONG32 ulFlags) PURE; - - - - /* ******************************************************************* */ - /* The following methods can be called at any time while the encoder is - * running. - */ - - /* This method tells you when the last-sent text will end. This - * allows you to determine when it's ok to send more text. For example, - * if you're streaming a presentation that's scrolling at a rate of 20 - * pixels per second in a window that's 200 pixels high and you call - * IRMALiveText's AddData() with 100 lines of 20-point text, it will take - * 100 seconds for all that text to scroll up and out of the window. The - * following method would return the current time plus 100 if you called - * it right after calling AddData(): - */ - STDMETHOD(GetLastSentTextEndTime) (THIS_ - ULONG32& ulLastEndTime) PURE; - - /* This method allows you to adjust the time, since the last data was - * sent, that the encoder waits before resending "heartbeat" packets that - * let the server know the encoder still alive and to let newly-connected - * players know what's currently visible in the window (in case they - * connected during a "dry" period in the stream, after the last new - * text was sent). Time is in milliseconds. NOTE: this defaults to - * 3000 milliseconds; any number higher than this will result in longer - * connect times for players coming in during a "dry" spell in the - * stream, and a sufficiently high value may cause the server to - * disconnect since it assumes the encoder has stopped if it does not - * periodically send data. This value's minimum is 500 milliseconds. - */ - STDMETHOD(SetTimeBetweenDryStreamResends) (THIS_ - ULONG32 ulMillisecBetweenResends) PURE; -}; - - -#endif /* _RMALVTXT_H_ */ diff --git a/include/realmedia/rmamon.h b/include/realmedia/rmamon.h deleted file mode 100644 index 4f9c177fe..000000000 --- a/include/realmedia/rmamon.h +++ /dev/null @@ -1,1105 +0,0 @@ -/**************************************************************************** - * - * $Id: rmamon.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Registry Interfaces. - * - */ - -#ifndef _RMAMON_H_ -#define _RMAMON_H_ - -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAPlugin IRMAPlugin; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAPropWatch IRMAPropWatch; -typedef _INTERFACE IRMAPropWatchResponse IRMAPropWatchResponse; -typedef _INTERFACE IRMAActiveRegistry IRMAActiveRegistry; -typedef _INTERFACE IRMAActivePropUser IRMAActivePropUser; -typedef _INTERFACE IRMAActivePropUserResponse IRMAActivePropUserResponse; -typedef _INTERFACE IRMAPNRegistryAltStringHandling IRMAPNRegistryAltStringHandling; - -/* - * Types of the values stored in the registry. - */ -typedef enum _RMAPropType -{ - PT_UNKNOWN, - PT_COMPOSITE, /* Contains other values (elements) */ - PT_INTEGER, /* 32-bit signed value */ - PT_INTREF, /* Integer reference object -- 32-bit signed integer */ - PT_STRING, /* Signed char* value */ - PT_BUFFER /* IRMABuffer object */ -} RMAPropType; - - -/* - * - * Interface: - * - * IRMAPNRegistry - * - * Purpose: - * - * This inteface provides access to the "Registry" in the server and - * client. The "Registry" is a hierarchical structure of Name/Value - * pairs (properties) which is capable of storing many different types - * of data including strings, buffers, and integers. The registry - * provides various types of information including statistics, - * configuration information, and system status. - * - * Note: This registry is not related to the Windows system registry. - * - * IID_IRMAPNRegistry: - * - * {00000600-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPNRegistry, 0x00000600, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAPNRegistry IID_IRMAPNRegistry - -#undef INTERFACE -#define INTERFACE IRMAPNRegistry - -DECLARE_INTERFACE_(IRMAPNRegistry, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPNRegistry methods - */ - - /************************************************************************ - * Method: - * IRMAPNRegistry::CreatePropWatch - * Purpose: - * Create a new IRMAPropWatch object which can then be queried for - * the right kind of IRMAPropWatch object. - * - * pPropWatch - OUT - returns a new addref'ed IRMAPropWatch object - */ - STDMETHOD(CreatePropWatch) (THIS_ - REF(IRMAPropWatch*) pPropWatch) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::AddComp - * Purpose: - * Add a COMPOSITE property to the registry and return its ID - * if successful. It returns ZERO (0) if an error occurred - * during the operation. - * - * pName - IN - name of the Property that is going to be added to - * the registry - */ - STDMETHOD_(UINT32, AddComp) (THIS_ - const char* pName) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::AddInt - * Purpose: - * Add an INTEGER property with name in "pName" and value in - * "iValue" to the registry. The return value is the id to - * the newly added Property or ZERO if there was an error. - * - * pName - IN - name of the Property that is going to be added to - * the registry - * nValue - IN - integer value of the Property that is going to be - * added to the registry - */ - STDMETHOD_(UINT32, AddInt) (THIS_ - const char* pName, - const INT32 nValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetIntByName - * Purpose: - * Retreive an INTEGER value from the registry given its Property - * name "pName". If the Property is found, it will return PNR_OK, - * otherwise it returns PNR_FAIL. - * - * pName - IN - name of the Property whose value is to be retreived - * nValue - OUT - parameter into which the value of the Property is - * going to be returned - */ - STDMETHOD(GetIntByName) (THIS_ - const char* pName, - REF(INT32) nValue) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetIntById - * Purpose: - * Retreive an INTEGER value from the registry given its id "ulId". - * If the Property is found, it will return PNR_OK, otherwise it - * returns PNR_FAIL. - * - * ulId - IN - unique id of the Property whose value is to be retreived - * nValue - OUT - parameter into which the value of the Property is - * going to be returned - */ - STDMETHOD(GetIntById) (THIS_ - const UINT32 ulId, - REF(INT32) nValue) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::SetIntByName - * Purpose: - * Modify a Property's INTEGER value in the registry given the - * Property's name "pName". If the value was set, it will return PNR_OK, - * otherwise it returns PNR_FAIL. - * - * pName - IN - name of the Property whose value is to be set - * nValue - IN - the new value of the Property which is going to be set - */ - STDMETHOD(SetIntByName) (THIS_ - const char* pName, - const INT32 nValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::SetIntById - * Purpose: - * Modify a Property's INTEGER value in the registry given the - * its id "id". If the value was set, it will return PNR_OK, otherwise - * it returns PNR_FAIL. - * - * ulId - IN - unique id of the Property whose value is to be set - * nValue - IN - the new value of the Property which is going to be set - */ - STDMETHOD(SetIntById) (THIS_ - const UINT32 id, - const INT32 nValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::AddStr - * Purpose: - * Add an STRING property with name in "pName" and value in - * "pValue" to the registry. - * - * pName - IN - name of the Property that is going to be added to - * the registry - * pValue - IN - buffer value of the Property that is going to be - * added to the registry - */ - STDMETHOD_(UINT32, AddStr) (THIS_ - const char* pName, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetStrByName - * Purpose: - * Retreive an STRING value from the registry given its Property - * name "pName". If the Property is found, it will return PNR_OK, - * otherwise it returns PNR_FAIL. - * - * pName - IN - name of the Property whose value is to be retreived - * pValue - OUT - parameter into which the value of the Property is - * going to be returned - */ - STDMETHOD(GetStrByName) (THIS_ - const char* pName, - REF(IRMABuffer*) pValue) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetStrById - * Purpose: - * Retreive an STRING value from the registry given its id "ulId". - * If the Property is found, it will return PNR_OK, otherwise it - * returns PNR_FAIL. - * - * ulId - IN - unique id of the Property whose value is to be retreived - * pValue - OUT - parameter into which the value of the Property is - * going to be returned - */ - STDMETHOD(GetStrById) (THIS_ - const UINT32 ulId, - REF(IRMABuffer*) pValue) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::SetStrByName - * Purpose: - * Modify a Property's STRING value in the registry given the - * Property's name "pName". If the value was set, it will return - * PNR_OK, otherwise it returns PNR_FAIL. - * - * pName - IN - name of the Property whose value is to be set - * pValue - IN - the new value of the Property which is going to be set - */ - STDMETHOD(SetStrByName) (THIS_ - const char* pName, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::SetStrById - * Purpose: - * Modify a Property's STRING value in the registry given the - * its id "ulId". If the value was set, it will return PNR_OK, - * otherwise it returns PNR_FAIL. - * - * ulId - IN - unique id of the Property whose value is to be set - * pValue - IN - the new value of the Property which is going to be set - */ - STDMETHOD(SetStrById) (THIS_ - const UINT32 ulId, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::AddBuf - * Purpose: - * Add an BUFFER property with name in "pName" and value in - * "pValue" to the registry. - * - * pName - IN - name of the Property that is going to be added to - * the registry - * pValue - IN - buffer value of the Property that is going to be - * added to the registry - */ - STDMETHOD_(UINT32, AddBuf) (THIS_ - const char* pName, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetBufByName - * Purpose: - * Retreive the BUFFER from the registry given its Property name - * "pName". If the Property is found, it will return PNR_OK, otherwise - * it returns PNR_FAIL. - * - * pName - IN - name of the Property whose value is to be retreived - * pValue - OUT - parameter into which the value of the Property is - * going to be returned - */ - STDMETHOD(GetBufByName) (THIS_ - const char* pName, - REF(IRMABuffer*) pValue) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetBufById - * Purpose: - * Retreive the BUFFER from the registry given its id "ulId". If the - * Property is found, it will return PNR_OK, otherwise it returns - * PNR_FAIL. - * - * ulId - IN - unique id of the Property whose value is to be retreived - * pValue - OUT - parameter into which the value of the Property is - * going to be returned - */ - STDMETHOD(GetBufById) (THIS_ - const UINT32 ulId, - REF(IRMABuffer*) pValue) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::SetBufByName - * Purpose: - * Modify a Property's BUFFER in the registry given the - * Property's name "pName". If the value was set, it will return - * PNR_OK, otherwise it returns PNR_FAIL. - * - * pName - IN - name of the Property whose value is to be set - * pValue - IN - the new value of the Property which is going to be set - */ - STDMETHOD(SetBufByName) (THIS_ - const char* pName, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::SetBufById - * Purpose: - * Modify a Property's BUFFER in the registry given its id "ulId". - * If the value was set, it will return PNR_OK, otherwise it returns - * PNR_FAIL. - * - * ulId - IN - unique id of the Property whose value is to be set - * pValue - IN - the new value of the Property which is going to be set - */ - STDMETHOD(SetBufById) (THIS_ - const UINT32 ulId, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::AddIntRef - * Purpose: - * Add an INTEGER REFERENCE property with name in "pName" and - * value in "iValue" to the registry. This property allows the user - * to modify its contents directly, without having to go through the - * registry. - * - * pName - IN - name of the Property that is going to be added to - * the registry - * pValue - IN - the pointer of the integer value is what gets stored - * in the registry as the Interger Reference Property's - * value - */ - STDMETHOD_(UINT32, AddIntRef) (THIS_ - const char* pName, - INT32* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::DeleteByName - * Purpose: - * Delete a Property from the registry using its name "pName". - * - * pName - IN - name of the Property that is going to be deleted - */ - STDMETHOD_(UINT32, DeleteByName) (THIS_ - const char* pName) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::DeleteById - * Purpose: - * Delete a Property from the registry using its id "ulId". - * - * ulId - IN - unique id of the Property that is going to be deleted - */ - STDMETHOD_(UINT32, DeleteById) (THIS_ - const UINT32 ulId) PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetTypeByName - * Purpose: - * Returns the datatype of the Property given its name "pName". - * - * pName - IN - name of the Property whose type is to be retreived - */ - STDMETHOD_(RMAPropType, GetTypeByName) (THIS_ - const char* pName) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetTypeById - * Purpose: - * Returns the datatype of the Property given its its id "ulId". - * - * ulId - IN - unique id of the Property whose type is to be retreived - */ - STDMETHOD_(RMAPropType, GetTypeById) (THIS_ - const UINT32 ulId) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::FindParentIdByName - * Purpose: - * Returns the id value of the parent node of the Property whose - * name "pName" has been passed in. If it fails, a ZERO value is - * returned. - * - * pName - IN - name of the Property whose parent's unique id is to be - * retreived - */ - STDMETHOD_(UINT32, FindParentIdByName) (THIS_ - const char* pName) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::FindParentIdById - * Purpose: - * Returns the id value of the parent node of the Property whose - * id "ulId" has been passed in. If it fails, a ZERO value is returned. - * - * ulId - IN - unique id of the Property whose parent's id is to be - * retreived - */ - STDMETHOD_(UINT32, FindParentIdById) (THIS_ - const UINT32 ulId) const PURE; - - /************************************************************************ - * Method: - * PNRegistry::GetPropName - * Purpose: - * Returns the Property name in the pName char buffer passed - * as a parameter, given the Property's id "ulId". - * - * ulId - IN - unique id of the Property whose name is to be retreived - * pName - OUT - parameter into which the Property name is going to be - * returned - */ - STDMETHOD(GetPropName) (THIS_ - const UINT32 ulId, - REF(IRMABuffer*) pName) const PURE; - - /************************************************************************ - * Method: - * PNRegistry::GetId - * Purpose: - * Returns the Property's id given the Property name. - * - * pName - IN - name of the Property whose unique id is to be - * retreived - */ - STDMETHOD_(UINT32, GetId) (THIS_ - const char* pName) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetPropListOfRoot - * Purpose: - * Returns an array of a Properties under the root level of the - * registry's hierarchy. - * - * pValues - OUT - list of property name and unique id at the - * highest level (root) in the registry - */ - STDMETHOD(GetPropListOfRoot) (THIS_ - REF(IRMAValues*) pValues) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetPropListByName - * Purpose: - * Returns an array of Properties immediately under the one whose - * name is passed in "pName". - * - * pName - IN - name of the Property whose child property list is to be - * retreived - * pValues - OUT - list of property name and unique id under the - * Property whose name is in "pName" - */ - STDMETHOD(GetPropListByName) (THIS_ - const char* pName, - REF(IRMAValues*) pValues) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetPropListById - * Purpose: - * Returns an array of Properties immediately under the one whose - * id is passed in "ulId". - * - * ulId - IN - unique id of the Property whose child property list is - * to be retreived - * pValues - OUT - list of property name and unique id under the - * Property whose is is in "ulId" - */ - STDMETHOD(GetPropListById) (THIS_ - const UINT32 ulId, - REF(IRMAValues*) pValues) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetNumPropsAtRoot - * Purpose: - * Returns the number of Properties at the root of the registry. - */ - STDMETHOD_(INT32, GetNumPropsAtRoot) (THIS) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetNumPropsByName - * Purpose: - * Returns the count of the number of Properties under the one - * whose name is specified in "pName". - * - * pName - IN - name of the Property whose number of children is to be - * retreived - */ - STDMETHOD_(INT32, GetNumPropsByName) (THIS_ - const char* pName) const PURE; - - /************************************************************************ - * Method: - * IRMAPNRegistry::GetNumPropsById - * Purpose: - * Returns the count of the number of Properties under the one - * whose unique id is specified in "ulId". - * - * ulId - IN - unique id of the Property whose number of children is - * to be retreived - */ - STDMETHOD_(INT32, GetNumPropsById) (THIS_ - const UINT32 ulId) const PURE; -}; - - -/* - * - * Interface: - * - * IRMAPropWatch - * - * Purpose: - * - * This interface allows the user to watch properties so that when - * changes happen to the properties the plugins receive notification via - * the IRMAPropWatchResponse API. - * - * IID_IRMAPropWatch: - * - * {00000601-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPropWatch, 0x00000601, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPropWatch - -DECLARE_INTERFACE_(IRMAPropWatch, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPropWatch methods - */ - - /************************************************************************ - * Method: - * IRMAPropWatch::Init - * Purpose: - * Initialize with the response object so that the Watch - * notifications can be sent back to the respective plugins. - * - * pResponse - IN - pointer to the response object which gets used to - * initialize the IRMAPropWatch object. the response - * object gets AddRef'd in the Init method. - */ - STDMETHOD(Init) (THIS_ - IRMAPropWatchResponse* pResponse) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatch::SetWatchOnRoot - * Purpose: - * The SetWatch method puts a watch at the highest level of - * the registry hierarchy. It notifies ONLY IF properties at THIS LEVEL - * get added/modified/deleted. - */ - STDMETHOD_(UINT32, SetWatchOnRoot) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatch::SetWatchByName - * Purpose: - * Sets a watch-point on the Property whose name is passed in. - * In case the mentioned Property gets modified or deleted a - * notification of that will be sent to the object which set the - * watch-point. - * - * pName - IN - name of Property on which a watch point is to be added - */ - STDMETHOD_(UINT32, SetWatchByName) (THIS_ - const char* pName) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatch::SetWatchById - * Purpose: - * Sets a watch-point on the Property whose name is passed in. - * In case the mentioned Property gets modified or deleted a - * notification of that will be sent to the object which set the - * watch-point. - * - * ulId - IN - unique id of Property on which a watch point is to be - * added - */ - STDMETHOD_(UINT32, SetWatchById) (THIS_ - const UINT32 ulId) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatch::ClearWatchOnRoot - * Purpose: - * It clears the watch on the root of the registry. - */ - STDMETHOD(ClearWatchOnRoot) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatch::ClearWatchByName - * Purpose: - * Clears a watch-point based on the Property's name. - * - * pName - IN - name of Property whose watch point is to be cleared - */ - STDMETHOD(ClearWatchByName) (THIS_ - const char* pName) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatch::ClearWatchById - * Purpose: - * Clears a watch-point based on the Property's id. - * - * ulId - IN - unique id of Property whose watch point is to be cleared - */ - STDMETHOD(ClearWatchById) (THIS_ - const UINT32 ulId) PURE; -}; - - -/* - * - * Interface: - * - * IRMAPropWatchResponse - * - * Purpose: - * - * Interface for notification of additions/modifications/deletions of - * properties in the registry which are being watched. - * - * IID_IRMAPropWatchResponse: - * - * {00000602-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPropWatchResponse, 0x00000602, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPropWatchResponse - -DECLARE_INTERFACE_(IRMAPropWatchResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPropWatchResponse methods - */ - - /************************************************************************ - * Method: - * IRMAPropWatchResponse::AddedProp - * Purpose: - * Gets called when a new Property gets added under the Property - * on which the Watch was set. It passes the id of the Property just - * added, its datatype and the id of its immediate parent COMPOSITE - * property. - */ - STDMETHOD(AddedProp) (THIS_ - const UINT32 ulId, - const RMAPropType propType, - const UINT32 ulParentID) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatchResponse::ModifiedProp - * Purpose: - * Gets called when a watched Property gets modified. It passes - * the id of the Property just modified, its datatype and the - * id of its immediate parent COMPOSITE property. - */ - STDMETHOD(ModifiedProp) (THIS_ - const UINT32 ulId, - const RMAPropType propType, - const UINT32 ulParentID) PURE; - - /************************************************************************ - * Method: - * IRMAPropWatchResponse::DeletedProp - * Purpose: - * Gets called when a watched Property gets deleted. As can be - * seen, it returns the id of the Property just deleted and - * its immediate parent COMPOSITE property. - */ - STDMETHOD(DeletedProp) (THIS_ - const UINT32 ulId, - const UINT32 ulParentID) PURE; -}; - -/* - * - * Interface: - * - * IRMAActiveRegistry - * - * Purpose: - * - * Interface to get IRMAActiveUser responsible for a particular property - * from the registry. - * - * IID_IRMAActiveRegistry: - * - * {00000603-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAActiveRegistry, 0x00000603, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAActiveRegistry - -DECLARE_INTERFACE_(IRMAActiveRegistry, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAActiveRegistry::SetAsActive - * - * Method to set prop pName to active and register pUser as - * the active prop user. - */ - STDMETHOD(SetAsActive) (THIS_ - const char* pName, - IRMAActivePropUser* pUser) PURE; - - /************************************************************************ - * IRMAActiveRegistry::SetAsInactive - * - * Method to remove an IRMAActiveUser from Prop activation. - */ - STDMETHOD(SetAsInactive) (THIS_ - const char* pName, - IRMAActivePropUser* pUser) PURE; - - /************************************************************************ - * IRMAActiveRegistry::IsActive - * - * Tells if prop pName has an active user that must be queried to - * change the value, or if it can just be set. - */ - STDMETHOD_(BOOL, IsActive) (THIS_ - const char* pName) PURE; - - /************************************************************************ - * IRMAActiveRegistry::SetActiveInt - * - * Async request to set int pName to ul. - */ - STDMETHOD(SetActiveInt) (THIS_ - const char* pName, - UINT32 ul, - IRMAActivePropUserResponse* pResponse) PURE; - - /************************************************************************ - * IRMAActiveRegistry::SetActiveStr - * - * Async request to set string pName to string in pBuffer. - */ - STDMETHOD(SetActiveStr) (THIS_ - const char* pName, - IRMABuffer* pBuffer, - IRMAActivePropUserResponse* pResponse) PURE; - - /************************************************************************ - * IRMAActiveRegistry::SetActiveBuf - * - * Async request to set buffer pName to buffer in pBuffer. - */ - STDMETHOD(SetActiveBuf) (THIS_ - const char* pName, - IRMABuffer* pBuffer, - IRMAActivePropUserResponse* pResponse) PURE; - - /************************************************************************ - * IRMAActiveRegistry::DeleteActiveProp - * - * Async request to delete the active property. - */ - STDMETHOD(DeleteActiveProp) (THIS_ - const char* pName, - IRMAActivePropUserResponse* pResponse) PURE; - - -}; - - -/* - * - * Interface: - * - * IRMAActivePropUser - * - * Purpose: - * - * An IRMAActivePropUser can be set as the active user of a property in - * an IRMAActiveRegistry. This causes the IRMAActivePropUser to be consulted - * everytime someone wants to change a property. The difference between this - * and a prop watch is that this is async, and can call a done method with - * failure to cause the prop to not be set, and this get called instead of - * calling into the IRMAPNReg. - * - * IID_IRMAActivePropUser: - * - * {00000604-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAActivePropUser, 0x00000604, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAActivePropUser - -DECLARE_INTERFACE_(IRMAActivePropUser, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAActivePropUser::SetActiveInt - * - * Async request to set int pName to ul. - */ - STDMETHOD(SetActiveInt) (THIS_ - const char* pName, - UINT32 ul, - IRMAActivePropUserResponse* pResponse) PURE; - - /************************************************************************ - * IRMAActivePropUser::SetActiveStr - * - * Async request to set string pName to string in pBuffer. - */ - STDMETHOD(SetActiveStr) (THIS_ - const char* pName, - IRMABuffer* pBuffer, - IRMAActivePropUserResponse* pResponse) PURE; - - /************************************************************************ - * IRMAActivePropUser::SetActiveBuf - * - * Async request to set buffer pName to buffer in pBuffer. - */ - STDMETHOD(SetActiveBuf) (THIS_ - const char* pName, - IRMABuffer* pBuffer, - IRMAActivePropUserResponse* pResponse) PURE; - - /************************************************************************ - * IRMAActivePropUser::DeleteActiveProp - * - * Async request to delete the active property. - */ - STDMETHOD(DeleteActiveProp) (THIS_ - const char* pName, - IRMAActivePropUserResponse* pResponse) PURE; - -}; - -/* - * - * Interface: - * - * IRMAActivePropUserResponse - * - * Purpose: - * - * Gets responses from IRMAActivePropUser for queries to set properties - * in the IRMAActiveRegistry. - * - * - * IID_IRMAActivePropUserResponse: - * - * {00000605-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAActivePropUserResponse, 0x00000605, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAActivePropUserResponse - -DECLARE_INTERFACE_(IRMAActivePropUserResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Called with status result on completion of set request. - */ - STDMETHOD(SetActiveIntDone) (THIS_ - PN_RESULT res, - const char* pName, - UINT32 ul, - IRMABuffer* pInfo[], - UINT32 ulNumInfo) PURE; - - STDMETHOD(SetActiveStrDone) (THIS_ - PN_RESULT res, - const char* pName, - IRMABuffer* pBuffer, - IRMABuffer* pInfo[], - UINT32 ulNumInfo) PURE; - - STDMETHOD(SetActiveBufDone) (THIS_ - PN_RESULT res, - const char* pName, - IRMABuffer* pBuffer, - IRMABuffer* pInfo[], - UINT32 ulNumInfo) PURE; - - STDMETHOD(DeleteActivePropDone) (THIS_ - PN_RESULT res, - const char* pName, - IRMABuffer* pInfo[], - UINT32 ulNumInfo) PURE; - -}; - -/* - * - * Interface: - * - * IRMACopyRegistry - * - * Purpose: - * - * Allows copying from one registry key to another. - * - * - * IID_IRMACopyRegistry - * - * {00000606-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMACopyRegistry, 0x00000606, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMACopyRegistry - -DECLARE_INTERFACE_(IRMACopyRegistry, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMACopyRegistry::Copy - * - * Here it is! The "Copy" method! - */ - STDMETHOD (CopyByName) (THIS_ - const char* pFrom, - const char* pTo) PURE; -}; - - -/* - * - * Interface: - * - * IRMAPNRegistryAltStringHandling - * - * Purpose: - * - * Tells the registry about alternate handling of PT_STRING types. - * - * - * IID_IRMAPNRegistryAltStringHandling - * - * {00000607-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPNRegistryAltStringHandling, 0x00000607, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPNRegistryAltStringHandling - -DECLARE_INTERFACE_(IRMAPNRegistryAltStringHandling, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAPNRegistryAltStringHandling::SetStringAccessAsBufferById - * - * For those times when you added a property as a buffer, but wish it - * were a string (and of course, people now rely on the fact that it's - * a buffer)... Create the property as a string and then pass this - * method it's ID. The property will now be accessible/setable as a, - * but it will still be a string! - */ - STDMETHOD (SetStringAccessAsBufferById) (THIS_ - UINT32 ulId) PURE; -}; - - -#endif /* _RMAMON_H_ */ diff --git a/include/realmedia/rmapckts.h b/include/realmedia/rmapckts.h deleted file mode 100644 index 42cbf57ff..000000000 --- a/include/realmedia/rmapckts.h +++ /dev/null @@ -1,449 +0,0 @@ -/**************************************************************************** - * - * $Id: rmapckts.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Packet and Header Interface. - * - */ - -#ifndef _RMAPCKTS_H_ -#define _RMAPCKTS_H_ - -// Define IRMAUtilities - -/* ASMFlags in IRMAPacket */ -#define RMA_ASM_SWITCH_ON 0x01 -#define RMA_ASM_SWITCH_OFF 0x02 - - -/**************************************************************************** - * - * Interface: - * - * IRMABuffer - * - * Purpose: - * - * Basic opaque data storage buffer. Used in interfaces where - * object ownership is best managed through COM style reference - * counting. - * - * IID_IRMABuffer: - * - * {00001300-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMABuffer, 0x00001300, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_IRMABuffer IID_IRMABuffer - -#undef INTERFACE -#define INTERFACE IRMABuffer - -DECLARE_INTERFACE_(IRMABuffer, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMABuffer methods - */ - STDMETHOD(Get) (THIS_ - REF(UCHAR*) pData, - REF(ULONG32) ulLength) PURE; - - STDMETHOD(Set) (THIS_ - const UCHAR* pData, - ULONG32 ulLength) PURE; - - STDMETHOD(SetSize) (THIS_ - ULONG32 ulLength) PURE; - - STDMETHOD_(ULONG32,GetSize) (THIS) PURE; - - STDMETHOD_(UCHAR*,GetBuffer)(THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPacket - * - * Purpose: - * - * Basic data packet in the RealMedia system. - * - * IID_IRMAPacket: - * - * {00001301-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPacket, 0x00001301, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_IRMAPacket IID_IRMAPacket - -#undef INTERFACE -#define INTERFACE IRMAPacket - -DECLARE_INTERFACE_(IRMAPacket, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacket methods - */ - STDMETHOD(Get) (THIS_ - REF(IRMABuffer*) pBuffer, - REF(UINT32) ulTime, - REF(UINT16) unStreamNumber, - REF(UINT8) unASMFlags, - REF(UINT16) unASMRuleNumber - ) PURE; - - STDMETHOD_(IRMABuffer*,GetBuffer) (THIS) PURE; - - STDMETHOD_(ULONG32,GetTime) (THIS) PURE; - - STDMETHOD_(UINT16,GetStreamNumber) (THIS) PURE; - - STDMETHOD_(UINT8,GetASMFlags) (THIS) PURE; - - STDMETHOD_(UINT16,GetASMRuleNumber) (THIS) PURE; - - STDMETHOD_(BOOL,IsLost) (THIS) PURE; - - STDMETHOD(SetAsLost) (THIS) PURE; - - STDMETHOD(Set) (THIS_ - IRMABuffer* pBuffer, - UINT32 ulTime, - UINT16 uStreamNumber, - UINT8 unASMFlags, - UINT16 unASMRuleNumber - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPacket - * - * Purpose: - * - * RTP data packet in the RealMedia system. - * - * IID_IRMARTPPacket: - * - * {0169A731-1ED0-11d4-952B-00902742C923} - * - */ -DEFINE_GUID(IID_IRMARTPPacket, 0x169a731, 0x1ed0, 0x11d4, 0x95, 0x2b, 0x0, - 0x90, 0x27, 0x42, 0xc9, 0x23); - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_IRMARTPPacket IID_IRMARTPPacket - -#undef INTERFACE -#define INTERFACE IRMARTPPacket - -DECLARE_INTERFACE_(IRMARTPPacket, IRMAPacket) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacket methods - */ - STDMETHOD(Get) (THIS_ - REF(IRMABuffer*) pBuffer, - REF(UINT32) ulTime, - REF(UINT16) unStreamNumber, - REF(UINT8) unASMFlags, - REF(UINT16) unASMRuleNumber - ) PURE; - - STDMETHOD_(IRMABuffer*,GetBuffer) (THIS) PURE; - - STDMETHOD_(ULONG32,GetTime) (THIS) PURE; - - STDMETHOD_(UINT16,GetStreamNumber) (THIS) PURE; - - STDMETHOD_(UINT8,GetASMFlags) (THIS) PURE; - - STDMETHOD_(UINT16,GetASMRuleNumber) (THIS) PURE; - - STDMETHOD_(BOOL,IsLost) (THIS) PURE; - - STDMETHOD(SetAsLost) (THIS) PURE; - - STDMETHOD(Set) (THIS_ - IRMABuffer* pBuffer, - UINT32 ulTime, - UINT16 uStreamNumber, - UINT8 unASMFlags, - UINT16 unASMRuleNumber - ) PURE; - - /* - * IRMARTPPacket methods - */ - STDMETHOD_(ULONG32,GetRTPTime) (THIS) PURE; - - STDMETHOD(GetRTP) (THIS_ - REF(IRMABuffer*) pBuffer, - REF(UINT32) ulTime, - REF(UINT32) ulRTPTime, - REF(UINT16) unStreamNumber, - REF(UINT8) unASMFlags, - REF(UINT16) unASMRuleNumber - ) PURE; - - STDMETHOD(SetRTP) (THIS_ - IRMABuffer* pBuffer, - UINT32 ulTime, - UINT32 ulRTPTime, - UINT16 uStreamNumber, - UINT8 unASMFlags, - UINT16 unASMRuleNumber - ) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAValues - * - * Purpose: - * - * This is an interface to a generic name-value pair facility. This - * is used in various places (such as stream headers). - * - * IID_IRMAValues: - * - * {00001302-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAValues, 0x00001302, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * The IRMACommonClassFactory supports creating an instance - * of this object. - */ -#define CLSID_IRMAValues IID_IRMAValues - -#undef INTERFACE -#define INTERFACE IRMAValues - -DECLARE_INTERFACE_(IRMAValues, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAValues methods - */ - - /* - * Note: That strings returned as references should be copied or - * used immediately because their lifetime is only as long as the - * IRMAValues's objects lifetime. - * - * Note: Your iterator will be reset once you give up control to the - * RMA core (i.e. you exit whatever function gave you a time slice). - */ - - STDMETHOD(SetPropertyULONG32) (THIS_ - const char* pPropertyName, - ULONG32 uPropertyValue) PURE; - - STDMETHOD(GetPropertyULONG32) (THIS_ - const char* pPropertyName, - REF(ULONG32) uPropertyName) PURE; - - STDMETHOD(GetFirstPropertyULONG32) (THIS_ - REF(const char*) pPropertyName, - REF(ULONG32) uPropertyValue) PURE; - - STDMETHOD(GetNextPropertyULONG32) (THIS_ - REF(const char*) pPropertyName, - REF(ULONG32) uPropertyValue) PURE; - - STDMETHOD(SetPropertyBuffer) (THIS_ - const char* pPropertyName, - IRMABuffer* pPropertyValue) PURE; - - STDMETHOD(GetPropertyBuffer) (THIS_ - const char* pPropertyName, - REF(IRMABuffer*) pPropertyValue) PURE; - - STDMETHOD(GetFirstPropertyBuffer) (THIS_ - REF(const char*) pPropertyName, - REF(IRMABuffer*) pPropertyValue) PURE; - - STDMETHOD(GetNextPropertyBuffer) (THIS_ - REF(const char*) pPropertyName, - REF(IRMABuffer*) pPropertyValue) PURE; - - STDMETHOD(SetPropertyCString) (THIS_ - const char* pPropertyName, - IRMABuffer* pPropertyValue) PURE; - - STDMETHOD(GetPropertyCString) (THIS_ - const char* pPropertyName, - REF(IRMABuffer*) pPropertyValue) PURE; - - STDMETHOD(GetFirstPropertyCString) (THIS_ - REF(const char*) pPropertyName, - REF(IRMABuffer*) pPropertyValue) PURE; - - STDMETHOD(GetNextPropertyCString) (THIS_ - REF(const char*) pPropertyName, - REF(IRMABuffer*) pPropertyValue) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAValuesRemove - * - * Purpose: - * - * This interface is to add Remove methods to a class that supports - * IRMAValues. All classes that support this interface will also - * support IRMAValues. - * - * - * - * IID_IRMAValuesRemove: - * - * {00001303-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAValuesRemove, 0x00001303, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -/* - * The IRMACommonClassFactory does not support creating an instance - * of this object. - */ - -#undef INTERFACE -#define INTERFACE IRMAValuesRemove - -DECLARE_INTERFACE_(IRMAValuesRemove, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAValuesRemove methods - */ - - /************************************************************************ - * Method: - * IRMAKeyValuesRemove::Remove - * Purpose: - * Remove all items matching pKey. (If you know what datatype you saved - * the key as, use the specific method.) - */ - STDMETHOD(Remove) (const char* pKey) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValuesRemove::RemoveULONG32 - * Purpose: - * Remove all ULONG32 items matching pKey. - */ - STDMETHOD(RemoveULONG32) (const char* pKey) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValuesRemove::RemoveBuffer - * Purpose: - * Remove all Buffer items matching pKey. - */ - STDMETHOD(RemoveBuffer) (const char* pKey) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValuesRemove::RemoveCString - * Purpose: - * Remove all CString items matching pKey. - */ - STDMETHOD(RemoveCString) (const char* pKey) PURE; -}; - -#endif /* _RMAPCKTS_H_ */ - diff --git a/include/realmedia/rmapends.h b/include/realmedia/rmapends.h deleted file mode 100644 index 1cc22856b..000000000 --- a/include/realmedia/rmapends.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * - * $Id: rmapends.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Pending Status interfaces - * - */ - -#ifndef _RMAPENDS_H_ -#define _RMAPENDS_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAPendingStatus IRMAPendingStatus; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPendingStatus - * - * Purpose: - * - * Interface to get the current pending status from an object - * - * IRMAPendingStatus: - * - * {00001100-0901-11d1-8B06-00A024406D59} - */ - -DEFINE_GUID(IID_IRMAPendingStatus, 0x00001100, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPendingStatus - -#define RMA_STATUS_INITIALIZING 0x01 -#define RMA_STATUS_BUFFERING 0x02 -#define RMA_STATUS_CONTACTING 0x03 -#define RMA_STATUS_READY 0x04 - -DECLARE_INTERFACE_(IRMAPendingStatus, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPendingStatus methods - */ - - /************************************************************************ - * Method: - * IRMAPendingStatus::GetStatus - * Purpose: - * Called by the user to get the current pending status from an object - */ - STDMETHOD(GetStatus) (THIS_ - REF(UINT16) uStatusCode, - REF(IRMABuffer*) pStatusDesc, - REF(UINT16) ulPercentDone) PURE; -}; - -#endif /* _RMAPENDS_H_ */ diff --git a/include/realmedia/rmaphook.h b/include/realmedia/rmaphook.h deleted file mode 100644 index 99722db01..000000000 --- a/include/realmedia/rmaphook.h +++ /dev/null @@ -1,302 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaphook.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Selective Record interface - * - */ - -#ifndef _RMAPHOOK_H_ -#define _RMAPHOOK_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMAPacket IRMAPacket; -typedef _INTERFACE IRMAPacketHook IRMAPacketHook; -typedef _INTERFACE IRMAPacketHookManager IRMAPacketHookManager; -typedef _INTERFACE IRMAPacketHookHelper IRMAPacketHookHelper; -typedef _INTERFACE IRMAPacketHookHelperResponse IRMAPacketHookHelperResponse; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketHook - * - * Purpose: - * - * Interface implemented by the top level client to support selective - * record - * - * IID_IRMAPacketHook: - * - * {00002000-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPacketHook, 0x00002000, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -DECLARE_INTERFACE_(IRMAPacketHook, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketHook methods - */ - - /************************************************************************ - * Method: - * IRMAPacketHook::OnStart - * Purpose: - * Called by the core to notify the start of this packet hook session - */ - STDMETHOD(OnStart) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHook::OnEnd - * Purpose: - * Called by the core to notify the end of this packet hook session - */ - STDMETHOD(OnEnd) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHook::OnFileHeader - * Purpose: - * Called by the core to send file header information - * - */ - STDMETHOD(OnFileHeader) (THIS_ - IRMAValues* pValues) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHook::OnStreamHeader - * Purpose: - * Called by the core to send stream header information - * - */ - STDMETHOD(OnStreamHeader) (THIS_ - IRMAValues* pValues) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHook:OnPacket - * Purpose: - * Called by the core to send packet information. - * - */ - STDMETHOD(OnPacket) (THIS_ - IRMAPacket* pPacket) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketHookManager - * - * Purpose: - * - * Interface to the selective record - * - * IID_IRMAPacketHookManager - * - * {00002001-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAPacketHookManager, 0x00002001, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPacketHookManager - -DECLARE_INTERFACE_(IRMAPacketHookManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketHookManager methods - */ - - /************************************************************************ - * Method: - * IRMAPacketHookManager::InitHook - * Purpose: - * called by the top level client to pass the IRMAPacketHook object - */ - STDMETHOD(InitHook) (THIS_ - IRMAPacketHook* pPacketHook) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHookManager::CloseHook - * Purpose: - * called by the top level client to close the hook connection - */ - STDMETHOD(CloseHook) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHookManager::StartHook - * Purpose: - * called by the top level client to start recording - */ - STDMETHOD(StartHook) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHookManager::StopHook - * Purpose: - * called by the top level client to stop recording - */ - STDMETHOD(StopHook) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketHookHelper - * - * Purpose: - * - * provide methods to prepare the packet for recording and send back the core - * - * IID_IRMAPacketHookHelper: - * - * {00002002-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPacketHookHelper, 0x00002002, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPacketHookHelper - -DECLARE_INTERFACE_(IRMAPacketHookHelper, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketHookHelper methods - */ - - /****************************************************************** - * Method: - * IRMAPacketHookHelper::StartHook - * - * Purpose: - * tell the renderer to start sending the record packets - * - */ - STDMETHOD(StartHook) (THIS_ - ULONG32 ulStreamNumber, - ULONG32 ulTimeOffset, - IRMAPacketHookHelperResponse* pPacketHookHelperResponse) PURE; - - - /****************************************************************** - * Method: - * IRMAPacketHookHelper::StopHook - * - * Purpose: - * tell the renderer to stop sending the record packets - */ - STDMETHOD(StopHook) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPacketHookHelperResponse - * - * Purpose: - * - * Response interface to the IRMAPacketHookHelper at renderer - * - * IID_IRMAPacketHookHelperResponse - * - * {00002003-0901-11d1-8B06-00A024406D59} - */ -DEFINE_GUID(IID_IRMAPacketHookHelperResponse, 0x00002003, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPacketHookHelperResponse - -DECLARE_INTERFACE_(IRMAPacketHookHelperResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPacketHookHelperResponse methods - */ - - /************************************************************************ - * Method: - * IRMAPacketHookHelperResponse::OnPacket - * Purpose: - * called by the renderer to pass the packet for recording - */ - STDMETHOD(OnPacket) (THIS_ - IRMAPacket* pPacket) PURE; - - /************************************************************************ - * Method: - * IRMAPacketHookManager::OnEndOfPackets - * Purpose: - * called by the renderer to notify the end of this stream - */ - STDMETHOD(OnEndOfPackets) (THIS) PURE; -}; - -#endif /* _RMAPHOOK_H_ */ diff --git a/include/realmedia/rmaplgns.h b/include/realmedia/rmaplgns.h deleted file mode 100644 index ec6e794c4..000000000 --- a/include/realmedia/rmaplgns.h +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaplgns.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Plug-in Interfaces. - * - */ - -#ifndef _RMAPLGNS_H_ -#define _RMAPLGNS_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAObjectConfiguration IRMAObjectConfiguration; -typedef _INTERFACE IRMAPluginProperties IRMAPluginProperties; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAValues IRMAValues; - -/**************************************************************************** - * - * Interface: - * - * IRMAObjectConfiguration - * - * Purpose: - * - * Interface for setting context and generic means of plugin - * Configuration. - * - * IRMAObjectConfiguration: - * - * {0x00002900-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAObjectConfiguration, 0x00002900, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAObjectConfiguration - -DECLARE_INTERFACE_(IRMAObjectConfiguration, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAObjectConfiguration::SetContext - * Purpose: - * This function is called to set the context for the plugin. - * Either IRMAPlugin::InitPlugin or this function must be called - * before calling any other function on the plugin. - * this is intended to be used as a shortcut for the plugin user. - * If one needs to use SetConfiguration they only need to query - * IRMAObjectConfiguration saving them from also querying for - * IRMAPlugin. - * - */ - STDMETHOD(SetContext) - ( - THIS_ - IUnknown* pIUnknownContext - ) PURE; - - /************************************************************************ - * Method: - * IRMAObjectConfiguration::SetConfiguration - * Purpose: - * This allows the user of a plugin to supply configuration - * information. This is often a set of CString properties - * extracted from a list in the config file. This allows - * each plugin within a class (auth plugin, database plugin, etc..) - * to require a different set of parameters. - * - */ - STDMETHOD(SetConfiguration) - ( - THIS_ - IRMAValues* pIRMAValuesConfiguration - ) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPluginProperties - * - * Purpose: - * - * This allows plugins to return whatever properties they want. - * - * IRMAPluginProperties: - * - * {0x00002901-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPluginProperties, 0x00002901, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPluginProperties - -DECLARE_INTERFACE_(IRMAPluginProperties, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPluginProperties::GetProperties - * Purpose: - * A plugin will implement this in order to return plugin properties - * that will allow it to be identified uniquely. (PluginID, - * AuthenticationProtocol, etc..) - * - */ - STDMETHOD(GetProperties) - ( - THIS_ - REF(IRMAValues*) pIRMAValuesProperties - ) PURE; - -}; - -#endif /* !_RMAPLGNS_H_ */ diff --git a/include/realmedia/rmaplugn.h b/include/realmedia/rmaplugn.h deleted file mode 100644 index cac1c90c2..000000000 --- a/include/realmedia/rmaplugn.h +++ /dev/null @@ -1,696 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaplugn.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Plugin init / inspector interfaces - * - */ - -#ifndef _RMAPLUGN_H_ -#define _RMAPLUGN_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMAPlugin IRMAPlugin; -typedef _INTERFACE IRMAPluginEnumerator IRMAPluginEnumerator; -typedef _INTERFACE IRMAPluginChallenger IRMAPluginChallenger; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAValues IRMAValues; - -/**************************************************************************** - * - * Function: - * - * RMACreateInstance() - * - * Purpose: - * - * Function implemented by all plugin DLL's to create an instance of - * any of the objects supported by the DLL. This method is similar to - * Window's CoCreateInstance() in its purpose, except that it only - * creates objects from this plugin DLL. - * - * NOTE: Aggregation is never used. Therefore an outer unknown is - * not passed to this function, and you do not need to code for this - * situation. - * - */ -#ifdef _MACINTOSH -#pragma export on -#endif - -STDAPI RMACreateInstance - ( - IUnknown** /*OUT*/ ppIUnknown - ); - -#ifdef _MACINTOSH -#pragma export off -#endif - - -/**************************************************************************** - * - * Function: - * - * RMAShutdown() - * - * Purpose: - * - * Function implemented by all plugin DLL's to free any *global* - * resources. This method is called just before the DLL is unloaded. - * - */ -#ifdef _MACINTOSH -#pragma export on -#endif - -STDAPI RMAShutdown(void); - -#ifdef _MACINTOSH -#pragma export off -#endif - - -/**************************************************************************** - * - * Interface: - * - * IRMAPlugin - * - * Purpose: - * - * Interface exposed by a plugin DLL to allow inspection of objects - * supported by the plugin DLL. - * - * IID_IRMAPlugin: - * - * {00000C00-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlugin, 0x00000C00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPlugin - -DECLARE_INTERFACE_(IRMAPlugin, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPlugin methods - */ - - /************************************************************************ - * Method: - * IRMAPlugin::GetPluginInfo - * Purpose: - * Returns the basic information about this plugin. Including: - * - * bMultipleLoad Whether or not this plugin can be instantiated - * multiple times. All File Formats must set - * this value to TRUE. The only other type of - * plugin that can specify bMultipleLoad=TRUE is - * a filesystem plugin. Any plugin that sets - * this flag to TRUE must not use global variables - * of any type. - * - * Setting this flag to TRUE implies that you - * accept that your plugin may be instantiated - * multiple times (possibly in different - * address spaces). Plugins are instantiated - * multiple times only in the server (for - * performance reasons). - * - * An example of a plugin, that must set this - * flag to FALSE is a filesystem plugin that - * uses a single TCP connection to communicate - * with a database. - * - * pDescription which is used in about UIs (can be NULL) - * pCopyright which is used in about UIs (can be NULL) - * pMoreInfoURL which is used in about UIs (can be NULL) - * ulVersionNumber The version of this plugin. - */ - STDMETHOD(GetPluginInfo) (THIS_ - REF(BOOL) /*OUT*/ bMultipleLoad, - REF(const char*) /*OUT*/ pDescription, - REF(const char*) /*OUT*/ pCopyright, - REF(const char*) /*OUT*/ pMoreInfoURL, - REF(ULONG32) /*OUT*/ ulVersionNumber) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin::InitPlugin - * Purpose: - * Initializes the plugin for use. This interface must always be - * called before any other method is called. This is primarily needed - * so that the plugin can have access to the context for creation of - * IRMABuffers and IMalloc. - */ - STDMETHOD(InitPlugin) (THIS_ - IUnknown* /*IN*/ pContext) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPluginEnumerator - * - * Purpose: - * - * provide methods to enumerate through all the plugins installed - * - * IID_IRMAPluginEnumerator: - * - * {00000C01-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPluginEnumerator, 0x00000C01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPluginEnumerator - -DECLARE_INTERFACE_(IRMAPluginEnumerator, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPluginEnumerator methods - */ - - /************************************************************************ - * Method: - * IRMAPluginEnumerator::GetNumOfPlugins - * - * Purpose: - * return the number of plugins available - * - */ - STDMETHOD_(ULONG32,GetNumOfPlugins) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPluginEnumerator::GetPlugin - * Purpose: - * Return an instance (IUnknown) of the plugin - * - */ - STDMETHOD(GetPlugin) (THIS_ - ULONG32 /*IN*/ ulIndex, - REF(IUnknown*) /*OUT*/ pPlugin) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPluginGroupEnumerator - * - * Purpose: - * - * Provide a way to enumerate through all of the plugins which - * implement a specific interface. - * - * IID_IRMAPluginGroupEnumerator: - * - * {00000C02-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPluginGroupEnumerator, 0x00000C02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPluginGroupEnumerator - -#define CLSID_IRMAPluginGroupEnumerator IID_IRMAPluginGroupEnumerator - -DECLARE_INTERFACE_(IRMAPluginGroupEnumerator, IUnknown) -{ - /* - * IUnknown methods - */ - - /* - * IRMAPluginGroupEnumerator methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /****************************************************************** - * Method: - * IRMAPluginGroupEnumerator::Init - * - * Purpose: - * tell the group enumerator which interface to group the plugins - * into, this method must be called before the other methods can - * be called. - * - */ - STDMETHOD(Init) (THIS_ - REFIID iid) PURE; - - - /****************************************************************** - * Method: - * IRMAPluginGroupEnumerator::GetNumOfPlugins - * - * Purpose: - * return the number of plugins available that support a -particular - * interface. - * - */ - STDMETHOD_(ULONG32,GetNumOfPlugins) (THIS) PURE; - - - /****************************************************************** - * Method: - * IRMAPluginGroupEnumerator::GetPlugin - * Purpose: - * Return an instance (IUnknown) of the plugin - * - */ - STDMETHOD(GetPlugin) (THIS_ - UINT32 /*IN*/ ulIndex, - REF(IUnknown*) /*OUT*/ pPlugin) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPluginReloader - * - * Purpose: - * - * Tells the client core to reload all plugins. - * - * IID_IRMAPluginReloader: - * - * {00000C03-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPluginReloader, 0x00000C03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPluginReloader - -DECLARE_INTERFACE_(IRMAPluginReloader, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPluginReloader methods - */ - - /************************************************************************ - * Method: - * IRMAPluginReloader::ReloadPlugins - * Purpose: - * Causes the client core to reload all plugins. - * - */ - STDMETHOD(ReloadPlugins) (THIS) PURE; -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMAPluginFactory - * - * Purpose: - * - * This interface is implemented by a plugin in order to have more then - * one "RMA plugin" in a single DLL. I.e., a plugin author could - * use this interface to have 3 different file format plugins in - * a single DLL. - * - * IID_IRMAPluginFactory: - * - * {00000C04-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPluginFactory, 0x00000C04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPluginFactory - -DECLARE_INTERFACE_(IRMAPluginFactory, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPluginFactory methods - */ - - /***************************************************************** - * Method: - * IRMAPluginFactory::GetNumPlugins - * Purpose: - * Report the number of Plugins within the DLL. - * - * Parameters: - */ - STDMETHOD_(UINT16, GetNumPlugins) (THIS) PURE; - - /***************************************************************** - * Method: - * IRMAPluginFactory::GetPlugin - * Purpose: - * Returns an IUnknown interface to the requested plugin. - * - * Parameters: - */ - - STDMETHOD(GetPlugin) (THIS_ - UINT16 uIndex, - IUnknown** pPlugin) PURE; -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMAGenericPlugin - * - * Purpose: - * - * Interface exposed by a plugin DLL to inform the client / server core - * that your plugin wishes to have InitPlugin called immediately. - * - * IID_IRMAGenericPlugin: - * - * {00000C09-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAGenericPlugin, 0x00000C09, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAGenericPlugin - -DECLARE_INTERFACE_(IRMAGenericPlugin, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAGenericPlugin methods - */ - - STDMETHOD(IsGeneric) (THIS_ - REF(BOOL) /*OUT*/ bIsGeneric) PURE; -}; - - -DEFINE_GUID(IID_IRMAPluginHandler, 0x00000200, 0xb4c8, 0x11d0, 0x99, 0x95, 0x0, 0xa0, 0x24, 0x8d, 0xa5, 0xf0); - -DEFINE_GUID(IID_IRMAPlugin2Handler, 0x00000201, 0xb4c8, 0x11d0, 0x99, 0x95, 0x0, 0xa0, 0x24, 0x8d, 0xa5, 0xf0); - -#undef INTERFACE -#define INTERFACE IRMAPlugin2Handler - -DECLARE_INTERFACE_(IRMAPlugin2Handler, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPlugin2Handler Methods - */ - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::Init - * - * Purpose: - * Specifies the context and sets the pluginhandler in motion. - * - */ - STDMETHOD(Init) (THIS_ IUnknown* pContext) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::GetNumPlugins2 - * - * Purpose: - * Gets the info of a particular plugin. - * - */ - STDMETHOD_(ULONG32,GetNumOfPlugins2) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::GetPluginInfo - * - * Purpose: - * Gets the info of a particular plugin. - * - */ - STDMETHOD(GetPluginInfo) (THIS_ - UINT32 unIndex, - REF(IRMAValues*) /*OUT*/ Values) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::FlushCache() - * - * Purpose: - * Flushes the LRU cache -- Unloads all DLLs from memory - * which currenltly have a refcount of 0. - */ - - STDMETHOD(FlushCache) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::SetCacheSize - * - * Purpose: - * This function sets the size of the Cache. The cache is - * initally set to 1000KB. To disable the cache simply set - * the size to 0.If the cache is disabled a DLL will be - * unloaded whenever it's refcount becomes zero. Which MAY - * cause performance problems. - */ - - STDMETHOD(SetCacheSize) (THIS_ ULONG32 nSizeKB) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::GetInstance - * - * Purpose: - * - * This function will return a plugin instance given a plugin index. - * - */ - - STDMETHOD(GetInstance) (THIS_ UINT32 index, REF(IUnknown*) pUnknown) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::FindIndexUsingValues - * - * Purpose: - * Finds a plugin which matches the set of values given. An index - * is returned which can be used to either get the values (using - * GetPluginInfo) or an instance can be created using GetPluing(). - * - */ - - STDMETHOD(FindIndexUsingValues) (THIS_ IRMAValues*, - REF(UINT32) unIndex) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::FindPluginUsingValues - * - * Purpose: - * Finds a plugin which matches the set of values given. A Plugin - * instance is returned. - * - */ - - STDMETHOD(FindPluginUsingValues) (THIS_ IRMAValues*, - REF(IUnknown*) pUnk) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::FindIndexUsingStrings - * - * Purpose: - * Finds a plugin which matches the set of values given. An index - * is returned which can be used to either get the values (using - * GetPluginInfo) or an instance can be created using GetPluing(). - * NOTE: that a max of two values may be given. - */ - - STDMETHOD(FindIndexUsingStrings) (THIS_ char* PropName1, - char* PropVal1, - char* PropName2, - char* PropVal2, - char* PropName3, - char* PropVal3, - REF(UINT32) unIndex) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::FindPluginUsingStrings - * - * Purpose: - * Finds a plugin which matches the set of values given. A Plugin - * instance is returned. - * NOTE: that a max of two values may be given. - */ - - STDMETHOD(FindPluginUsingStrings) (THIS_ char* PropName1, - char* PropVal1, - char* PropName2, - char* PropVal2, - char* PropName3, - char* PropVal3, - REF(IUnknown*) pUnk) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::FindImplementationFromClassID - * - * Purpose: - * Finds a CommonClassFactory plugin which supports the - * ClassID given. An instance of the Class is returned. - */ - - STDMETHOD(FindImplementationFromClassID) - ( - THIS_ - REFGUID GUIDClassID, - REF(IUnknown*) pIUnknownInstance - ) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::Close - * - * Purpose: - * A function which performs all of the functions of delete. - * - * - */ - - STDMETHOD(Close) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPlugin2Handler::SetRequiredPlugins - * - * Purpose: - * This function sets the required plugin list - * - * - */ - - STDMETHOD(SetRequiredPlugins) (THIS_ const char** ppszRequiredPlugins) PURE; - - -}; - - - - - - - - - -#endif /* _RMAPLUGN_H_ */ diff --git a/include/realmedia/rmappv.h b/include/realmedia/rmappv.h deleted file mode 100644 index 28c5744c4..000000000 --- a/include/realmedia/rmappv.h +++ /dev/null @@ -1,394 +0,0 @@ -/**************************************************************************** - * - * $Id: rmappv.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary information of RealNetworks, Inc., - * and is licensed subject to restrictions on use and distribution. - * - * RealMedia Architecture Interfaces for pay-per-view database plugins - * - */ - -#ifndef _RMAPPV_H_ -#define _RMAPPV_H_ - -#ifdef _MACINTOSH // Unsure whether this should be included on other platforms? -#include // Get definition of time_t. -#endif - -/* - * Structures and definitions for PPVPermission - */ - -#define PPV_MAX_URL_LEN 2048 - -typedef enum _PPVURLType { - PPV_URL_TYPE_FILE = 0, - PPV_URL_TYPE_DIRECTORY -} PPVURLType; - -typedef enum _PPVPermissionType { - PPV_PERMISSION_GENERAL = 0, - PPV_PERMISSION_EXPIRES, - PPV_PERMISSION_DEBIT, - PPV_PERMISSION_CREDIT, - PPV_PERMISSION_NONE -} PPVPermissionType; - -typedef struct _PPVPermission -{ - char pURL[PPV_MAX_URL_LEN]; - PPVURLType nURLType; - PPVPermissionType nPermissionType; - time_t tExpires; - UINT32 ulDebitTime; -} PPVPermission; - - -/* - * Structures and definitions for PPVAccessLog - */ - -typedef enum _PPVAccessPermissionOn { - PPV_PERMISSION_ON_FILE = 0, - PPV_PERMISSION_ON_DIRECTORY, - PPV_PERMISSION_ON_NONE -} PPVAccessPermissionOn; - -typedef enum _PPVAccessDisconnectType { - PPV_DISCONNECT_CLIENT = 0, - PPV_DISCONNECT_TIME_EXPIRED -} PPVAccessDisconnectType; - -typedef struct _PPVAccessLog -{ - BOOL bAccessGranted; - char* pUserid; - char* pGUID; - char* pIPAddress; - char* pURL; - PPVPermissionType nPermissionType; - PPVAccessPermissionOn nPermOn; - time_t tStartTime; - time_t tStopTime; - UINT32 lTotalTime; - PPVAccessDisconnectType nWhyDisconnect; -} PPVAccessLog; - - -/* - * Structures and definitions for PPVRegLog - */ - -typedef enum _PPVRegStatus -{ - PPV_GUID_REG_SUCCESS = 0, - PPV_GUID_REG_FAILED_LOCKED, - PPV_GUID_REG_FAILED_COLLISION, - PPV_GUID_REG_FAILED_OLD_PLAYER, - PPV_GUID_REG_FAILED_NO_USER, - PPV_GUID_REG_FAILED -} PPVRegStatus; - -typedef struct _PPVRegLog -{ - PPVRegStatus nStatus; - char* pUserid; - char* pGUID; - char* pIPAddress; - time_t tRequestTime; - char* pURLRedirect; -} PPVRegLog; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPPVDatabase - * - * Purpose: - * This interface provides access to a backend database used to store - * information related to the server's pay-per-view feature. - * - * IID_IRMAPPVDatabase: - * - * {00001d00-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPPVDatabase, 0x00001d00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPPVDatabase - -DECLARE_INTERFACE_(IRMAPPVDatabase, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPPVDatabase methods - */ - - /************************************************************************ - * Method: - * IRMAPPVDatabase::InitPPVDB - * Purpose: - * Open & Initialize the PPV Database. - * This function will called once per instance before any other - * methods are called. - * - * pDBName Name of the database (if supported) - * pUserID User ID to access database (if supported) - * pPassword Password to access database (if supported) - */ - STDMETHOD(InitPPVDB) (THIS_ - const char* pDBName, - const char* pUserID, - const char* pPassword) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::GetPPVDBInfo - * Purpose: - * Get this databases short name. - * This unique identifier is used to identify this database plugin. - * It should be unique enough that no other plugin will ever have - * the same plugin name. - */ - STDMETHOD(GetPPVDBInfo) (THIS_ - REF(const char*) /*OUT*/ pShortName) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::InsertUser - * Purpose: - * Inserts a user into the database (the user should not already - * exist). - * - * pUserid Userid key of the record to insert - * pPasswordCipher Optional Password to associate with this user; - * The password being passed in is already - * encrypted. - */ - STDMETHOD(InsertUser) (THIS_ - const char* pUserid, - const char* pPasswordCipher) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::RemoveUser - * Purpose: - * Removes a user from the database. - * - * pUserid Userid key of the record - */ - STDMETHOD(RemoveUser) (THIS_ - const char* pUserid) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::RegisterGUID - * Purpose: - * Registers a GUID to be associated with the pUserid - * - * pUserid Userid key of the record - * pGUID GUID to associate with user record - * bForce Forces registration of guid, even if - * the uuid_writeable flag is set to read only - */ - STDMETHOD(RegisterGUID) (THIS_ - const char* pUserid, - const char* pGUID, - BOOL bForce) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::SetPassword - * Purpose: - * Sets the password for the user associated with pUserid - * - * pUserid Userid key of the record - * pCipherPassword User's Password - */ - STDMETHOD(SetPassword) (THIS_ - const char* pUserid, - const char* pCipherPassword) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::ValidateUser - * Purpose: - * Sets the password for the user associated with pUserid - * - * pUserid Userid key of the record - * pPPVPermission Permission structure with URL to validate on - */ - STDMETHOD(ValidateUser) (THIS_ - const char* pUserid, - PPVPermission* pPPVPermission) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::GrantPermission - * Purpose: - * Adds a permission record. - * - * pUserid Userid key of the record - * pPPVPermission Permission structure with URL - */ - STDMETHOD(GrantPermission) (THIS_ - const char* pUserid, - const PPVPermission* pPPVPermission) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::RevokePermission - * Purpose: - * Removes a permission record. - * - * pUserid Userid key of the record - * pPPVPermission Permission structure with URL - */ - STDMETHOD(RevokePermission) (THIS_ - const char* pUserid, - const PPVPermission* pPPVPermission) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::RevokeAllPermissions - * Purpose: - * Removes all permission records for a user. - * - * pUserid Userid key of the record - */ - STDMETHOD(RevokeAllPermissions) (THIS_ - const char* pUserid) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::GetRedirect - * Purpose: - * Gets the redirection Url corresponding to the requested Url - * from the database. - * - * pURL Url key of redirect record (In) - * pURLRedirect Url to redirect to (Out) - * ulURLRedirectLen Maximum length of pURLRedirect (In) - */ - STDMETHOD(GetRedirect) (THIS_ - const char* pURL, - char* pURLRedirect, - UINT32 ulURLRedirectLen) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::PutRedirect - * Purpose: - * Adds a redirection Url to the database to correspond with - * the Url key. - * - * - * pURL Url key of redirect record (In) - * pURLRedirect Url to redirect to (In) - */ - STDMETHOD(PutRedirect) (THIS_ - const char* pURL, - const char* pURLRedirect) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::GrantTime - * Purpose: - * Grants a user time to view (specified by pPPVPermission). - * - * pUserid Userid key of the record - * pPPVPermission Permission structure with URL - * ulGrant Amount of time to grant - */ - STDMETHOD(GrantTime) (THIS_ - const char* pUserid, - const PPVPermission* pPPVPermission, - UINT32 ulGrant) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::DeductTime - * Purpose: - * Deducts a user time to view (specified by pPPVPermission). - * - * pUserid Userid key of the record - * pPPVPermission Permission structure with URL - * ulDeduct Amount of time to deduct - */ - STDMETHOD(DeductTime) (THIS_ - const char* pUserid, - const PPVPermission* pPPVPermission, - UINT32 ulDeduct) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::GetPasswordFromUserid - * Purpose: - * Get's a users password - * - * pUserid Userid key of the record (In) - * pCipherPassword Password to get (Out) - * ulCipherPasswordLen Maximum length of pCipherPassword - */ - STDMETHOD(GetPasswordFromUserid) (THIS_ - const char* pUserid, - char* pCipherPassword, - UINT32 ulCipherPasswordLen) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::GetUseridFromGUID - * Purpose: - * Get's a users id - * - * pGUID GUID of existing user (In) - * pUserid Userid key of the record (Out) - * ulUseridLen Maximum length of pUserid (In) - */ - STDMETHOD(GetUseridFromGUID) (THIS_ - const char* pGUID, - char* pUserid, - UINT32 ulUseridLen) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::LogReg - * Purpose: - * This function inserts a new record into the data with the logging - * information contained in pPPVRegLog - */ - STDMETHOD(LogReg) (THIS_ - PPVRegLog* pPPVRegLog) PURE; - - /************************************************************************ - * Method: - * IRMAPPVDatabase::LogAccess - * Purpose: - * This function inserts a new record into the data with the logging - * information contained in pPPVAccessLog - */ - STDMETHOD(LogAccess) (THIS_ - PPVAccessLog* pPPVAccessLog) PURE; - -}; - -#endif /*_RMAPPV_H_*/ diff --git a/include/realmedia/rmaprefs.h b/include/realmedia/rmaprefs.h deleted file mode 100644 index 024e67049..000000000 --- a/include/realmedia/rmaprefs.h +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaprefs.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * Persistent Preferences Interfaces - * - * Here are the preference entries set by the client core and renderers: - * KEY DEFAULT VALUES - * ================= ==================== - * AttemptMulticast 1 - * AttemptTCP 1 - * AttemptUDP 1 - * AudioQuality 0 - * AutoTransport 1 - * Bandwidth 28800 - * BitsPerSample 16 - * BroadcastPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple;type}{ ... } - * ClientLicenseKey 7FF7FF00 - * EndScan 10000 - * FactoryPluginInfo - * FileFormatPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple;mimetype1|mimetype2;extension1|extension2}{ ... } - * FileSystemPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple;protocol;shortname}{ ... } - * GeneralPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple}{ ... } - * PNAProxyHost - * PNAProxyPort 1090 - * RTSPProxyHost - * RTSPProxyPort 554 - * HTTPProxyHost - * HTTPProxyPort 1092 - * HurledURL 0 - * InfoandVolume 1 - * LastURL - * MaxClipCount 4 - * MetaFormatPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple;mimetype1|mimetype2;extension1|extension2}{ ... } - * MiscPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple}{ ... } - * MulticastTimeout 2000 - * NotProxy - * OnTop 0 - * PerfectPlayMode 0 - * PerfectPlayTime 60 - * PerfPlayEntireClip 1 - * PluginDirectory - * Presets# - * ProxySupport 0 - * RendererPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple;mimetype1|mimetype2}{ ... } - * SamplingRate 8000 - * SeekPage 40 - * SendStatistics 1 - * ServerTimeOut 90 - * ShowPresets 0 - * StatusBar 1 - * StreamDescriptionPluginInfo {dllpath;description;copyright;moreinfo;loadmultiple;mimetype}{ ... } - * SyncMultimedia 1 - * UDPPort 7070 - * UDPTimeout 10000 - * UpgradeAvailable 0 - * UseUDPPort 0 - * Volume 50 - * x:Pref_windowPositionX - * y:Pref_WindowPositionY - */ - -#ifndef _RMAPREFS_H_ -#define _RMAPREFS_H_ - -#define RMAPNREGISTRY_PREFPROPNAME "ApplicationData" -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMABuffer IRMABuffer; - -/**************************************************************************** - * - * Interface: - * - * IRMAPreferences - * - * Purpose: - * - * This interface allows you to store persistant preferences in the - * server or player's config / registry. - * - * IID_IRMAPreferences: - * - * {00000500-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPreferences, 0x00000500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPreferences - -DECLARE_INTERFACE_(IRMAPreferences, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPreferences methods - */ - - /************************************************************************ - * Method: - * IRMAPreferences::ReadPref - * Purpose: - * Read a preference from the registry or configuration. - */ - STDMETHOD(ReadPref) (THIS_ - const char* pPrekKey, REF(IRMABuffer*) pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMAPreferences::WritePref - * Purpose: - * TBD - */ - STDMETHOD(WritePref) (THIS_ - const char* pPrekKey, IRMABuffer* pBuffer) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPreferenceEnumerator - * - * Purpose: - * - * Allows preference Enumeration - * - * - * IRMAPreferenceEnumerator: - * - * {00000504-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPreferenceEnumerator, 0x00000504, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPreferenceEnumerator - -DECLARE_INTERFACE_(IRMAPreferenceEnumerator, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPreferenceEnumerator methods - */ - - /************************************************************************ - * Method: - * IRMAPreferenceEnumerator::EndSubPref - * Purpose: - * TBD - */ - - STDMETHOD(BeginSubPref) (THIS_ const char* szSubPref) PURE; - - - /************************************************************************ - * Method: - * IRMAPreferenceEnumerator::EndSubPref - * Purpose: - * TBD - */ - - STDMETHOD(EndSubPref) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAPreferenceEnumerator::GetPrefKey - * Purpose: - * TBD - */ - - STDMETHOD(GetPrefKey) (THIS_ UINT32 nIndex, REF(IRMABuffer*) pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMAPreferenceEnumerator::ReadPref - * Purpose: - * TBD - */ - STDMETHOD(ReadPref) (THIS_ - const char* pPrefKey, IRMABuffer*& pBuffer) PURE; - -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMAPreferences2 - * - * Purpose: - * - * New interface which gives sub-preference options abilities. - * - * - * IID_IRMAPreferences2: - * - * {00000503-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPreferences2, 0x00000503, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPreferences2 - -DECLARE_INTERFACE_(IRMAPreferences2, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPreferences2 methods - */ - - /************************************************************************ - * Method: - * IRMAPreferences2::GetPreferenceEnumerator - * Purpose: - * Read a preference from the registry or configuration. - */ - - STDMETHOD(GetPreferenceEnumerator)(THIS_ REF(IRMAPreferenceEnumerator*) /*OUT*/ pEnum) PURE; - - /************************************************************************ - * Method: - * IRMAPreferences2::ResetRoot - * Purpose: - * Reset the root of the preferences - */ - - STDMETHOD(ResetRoot)(THIS_ const char* pCompanyName, const char* pProductName, - int nProdMajorVer, int nProdMinorVer) PURE; -}; - - - -#endif /* _RMAPREFS_H_ */ diff --git a/include/realmedia/rmapsink.h b/include/realmedia/rmapsink.h deleted file mode 100644 index d22ae0c40..000000000 --- a/include/realmedia/rmapsink.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** - * - * $Id: rmapsink.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture player creation interfaces. - * - */ - -#ifndef _RMAPSINK_H_ -#define _RMAPSINK_H_ - -/* - * Forward declarations of some interfaces defined here-in. - */ -typedef _INTERFACE IRMAPlayer IRMAPlayer; -typedef _INTERFACE IRMAPlayerSinkControl IRMAPlayerSinkControl; -typedef _INTERFACE IRMAPlayerSinkControl IRMAPlayerSinkControl; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerCreationSink - * - * Purpose: - * - * PlayerCreation Sink Interface - * - * IID_IRMAPlayerCreationSink: - * - * {00002100-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPlayerCreationSink, 0x00002100, 0x901, 0x11d1, 0x8b, - 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAPlayerCreationSink - -DECLARE_INTERFACE_(IRMAPlayerCreationSink, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPlayerCreationSink Methods - */ - - /************************************************************************ - * Method: - * IRMAPlayerCreationSink::PlayerCreated - * Purpose: - * Notification when a new player is created - * - */ - STDMETHOD(PlayerCreated) (THIS_ - IRMAPlayer* pPlayer) PURE; - - /************************************************************************ - * Method: - * IRMAPlayerCreationSink::PlayerClosed - * Purpose: - * Notification when an exisitng player is closed - * - */ - STDMETHOD(PlayerClosed) (THIS_ - IRMAPlayer* pPlayer) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAPlayerSinkControl - * - * Purpose: - * - * Player SinkControl Interface - * - * IID_IRMAPlayerSinkControl: - * - * {00002101-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAPlayerSinkControl, 0x00002101, 0x901, 0x11d1, 0x8b, - 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#undef INTERFACE -#define INTERFACE IRMAPlayerSinkControl - -DECLARE_INTERFACE_(IRMAPlayerSinkControl, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPlayerSinkControl Methods - */ - - /************************************************************************ - * Method: - * IRMAPlayerSinkControl::AddSink - * Purpose: - * Add a new sink - * - */ - STDMETHOD(AddSink) (THIS_ - IRMAPlayerCreationSink* pSink) PURE; - - /************************************************************************ - * Method: - * IRMAPlayerSinkControl::RemoveSink - * Purpose: - * Remove an exisitng sink - * - */ - STDMETHOD(RemoveSink) (THIS_ - IRMAPlayerCreationSink* pSink) PURE; -}; - -#endif /* _RMAPSINK_H_ */ diff --git a/include/realmedia/rmarendr.h b/include/realmedia/rmarendr.h deleted file mode 100644 index 17784cd1b..000000000 --- a/include/realmedia/rmarendr.h +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************** - * - * $Id: rmarendr.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Rendering Interfaces. - * - */ - -#ifndef _RMARENDR_H_ -#define _RMARENDR_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMARenderer IRMARenderer; -typedef _INTERFACE IRMAStream IRMAStream; -typedef _INTERFACE IRMAStreamSource IRMAStreamSource; -typedef _INTERFACE IRMAPlayer IRMAPlayer; -typedef _INTERFACE IRMAClientEngine IRMAClientEngine; - - -/**************************************************************************** - * - * Interface: - * - * IRMARenderer - * - * Purpose: - * - * Interface implemented by all renderers. Parts of this interface are - * called by the client engine to provide data packets to the - * individual renderers. - * - * IID_IRMARenderer: - * - * {00000300-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARenderer, 0x00000300, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARenderer - -typedef ULONG32 RMA_DISPLAY_TYPE; - -#define RMA_DISPLAY_NONE 0x00000000 -#define RMA_DISPLAY_WINDOW 0x00000001 -#define RMA_DISPLAY_SUPPORTS_RESIZE 0x00000002 -#define RMA_DISPLAY_SUPPORTS_FULLSCREEN 0x00000004 -#define RMA_DISPLAY_SUPPORTS_VIDCONTROLS 0x00000008 - - -DECLARE_INTERFACE_(IRMARenderer, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMARenderer methods - */ - - /************************************************************************ - * Method: - * IRMARenderer::GetRendererInfo - * Purpose: - * Returns information vital to the instantiation of rendering - * plugins. - */ - STDMETHOD(GetRendererInfo) (THIS_ - REF(const char**)/*OUT*/ pStreamMimeTypes, - REF(UINT32) /*OUT*/ unInitialGranularity - ) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::StartStream - * Purpose: - * Called by client engine to inform the renderer of the stream it - * will be rendering. The stream interface can provide access to - * its source or player. This method also provides access to the - * primary client controller interface. - * - */ - STDMETHOD(StartStream) (THIS_ - IRMAStream* pStream, - IRMAPlayer* pPlayer) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::EndStream - * Purpose: - * Called by client engine to inform the renderer that the stream - * is was rendering is closed. - * - */ - STDMETHOD(EndStream) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnHeader - * Purpose: - * Called by client engine when a header for this renderer is - * available. The header will arrive before any packets. - * - */ - STDMETHOD(OnHeader) (THIS_ - IRMAValues* pHeader) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnPacket - * Purpose: - * Called by client engine when a packet for this renderer is - * due. - * - */ - STDMETHOD(OnPacket) (THIS_ - IRMAPacket* pPacket, - LONG32 lTimeOffset) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnTimeSync - * Purpose: - * Called by client engine to inform the renderer of the current - * time relative to the streams synchronized time-line. The - * renderer should use this time value to update its display or - * render it's stream data accordingly. - * - */ - STDMETHOD(OnTimeSync) (THIS_ - ULONG32 ulTime) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnPreSeek - * Purpose: - * Called by client engine to inform the renderer that a seek is - * about to occur. The render is informed the last time for the - * stream's time line before the seek, as well as the first new - * time for the stream's time line after the seek will be completed. - * - */ - STDMETHOD(OnPreSeek) (THIS_ - ULONG32 ulOldTime, - ULONG32 ulNewTime) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnPostSeek - * Purpose: - * Called by client engine to inform the renderer that a seek has - * just occurred. The render is informed the last time for the - * stream's time line before the seek, as well as the first new - * time for the stream's time line after the seek. - * - */ - STDMETHOD(OnPostSeek) (THIS_ - ULONG32 ulOldTime, - ULONG32 ulNewTime) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnPause - * Purpose: - * Called by client engine to inform the renderer that a pause has - * just occurred. The render is informed the last time for the - * stream's time line before the pause. - * - */ - STDMETHOD(OnPause) (THIS_ - ULONG32 ulTime) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnBegin - * Purpose: - * Called by client engine to inform the renderer that a begin or - * resume has just occurred. The render is informed the first time - * for the stream's time line after the resume. - * - */ - STDMETHOD(OnBegin) (THIS_ - ULONG32 ulTime) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnBuffering - * Purpose: - * Called by client engine to inform the renderer that buffering - * of data is occuring. The render is informed of the reason for - * the buffering (start-up of stream, seek has occurred, network - * congestion, etc.), as well as percentage complete of the - * buffering process. - * - */ - STDMETHOD(OnBuffering) (THIS_ - ULONG32 ulFlags, - UINT16 unPercentComplete) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::GetDisplayType - * Purpose: - * Called by client engine to ask the renderer for it's preferred - * display type. When layout information is not present, the - * renderer will be asked for it's prefered display type. Depending - * on the display type a buffer of additional information may be - * needed. This buffer could contain information about preferred - * window size. - * - */ - STDMETHOD(GetDisplayType) (THIS_ - REF(RMA_DISPLAY_TYPE) ulFlags, - REF(IRMABuffer*) pBuffer) PURE; - - /************************************************************************ - * Method: - * IRMARenderer::OnEndofPackets - * Purpose: - * Called by client engine to inform the renderer that all the - * packets have been delivered. However, if the user seeks before - * EndStream() is called, renderer may start getting packets again - * and the client engine will eventually call this function again. - */ - STDMETHOD(OnEndofPackets) (THIS) PURE; -}; - -#endif /* _RMARENDR_H_ */ diff --git a/include/realmedia/rmasite2.h b/include/realmedia/rmasite2.h deleted file mode 100644 index 00161108a..000000000 --- a/include/realmedia/rmasite2.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** - * - * $Id: rmasite2.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Simple Window Interfaces. - * - */ - -#ifndef _RMASITE2_H_ -#define _RMASITE2_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ - -//typedef _INTERFACE IRMASite2 IRMASite2; -typedef _INTERFACE IRMAVideoSurface IRMAVideoSurface; -typedef _INTERFACE IRMAPassiveSiteWatcher IRMAPassiveSiteWatcher; - -/**************************************************************************** - * - * Interface: - * - * IRMASite2 - * - * Purpose: - * - * Interface for IRMASite2 objects. - * - * IID_IRMASite: - * - * {0x00000D0A-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASite2, 0x00000D0A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASite - -DECLARE_INTERFACE_(IRMASite2, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASite2 method usually called by the "context" - * when window attributes (like the window handle) have changed. - */ - STDMETHOD(UpdateSiteWindow) (THIS_ - PNxWindow* /*IN*/ pWindow) PURE; - - /* - * IRMASite2 method usually called by the "context" to - * to hide/show a site. - */ - STDMETHOD(ShowSite) (THIS_ - BOOL bShow) PURE; - - STDMETHOD_(BOOL, IsSiteVisible) (THIS) PURE; - - /* - * IRMASite2 method usually called by the "context" to - * set the site's Z-order - */ - STDMETHOD(SetZOrder) (THIS_ - INT32 lZOrder - ) PURE; - - /* - * IRMASite2 method called to get the site's Z-order - */ - STDMETHOD(GetZOrder) (THIS_ - REF(INT32) lZOrder - ) PURE; - - /* - * IRMASite2 method called to set the site at the top - * of the Z-order - */ - STDMETHOD(MoveSiteToTop) (THIS) PURE; - - /* - * IRMASite2 method called to get the site's video surface - */ - STDMETHOD(GetVideoSurface) (THIS_ - REF(IRMAVideoSurface*) pSurface - ) PURE; - - /* - * IRMASite2 method called to get the number of child sites. - */ - STDMETHOD_(UINT32,GetNumberOfChildSites) (THIS) PURE; - - /* - * IRMASite2 method to add a watcher that does not affect the site - */ - STDMETHOD(AddPassiveSiteWatcher) (THIS_ - IRMAPassiveSiteWatcher* pWatcher - ) PURE; - - /* - * IRMASite2 method to remove a watcher that does not affect the site - */ - STDMETHOD(RemovePassiveSiteWatcher) (THIS_ - IRMAPassiveSiteWatcher* pWatcher - ) PURE; - - /* - * IRMASite2 method used to do cursor management - */ - STDMETHOD(SetCursor) (THIS_ - PNxCursor ulCursor, - REF(PNxCursor) ulOldCursor - ) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAPassiveSiteWatcher - * - * Purpose: - * - * Interface for IRMAPassiveSiteWatcher objects. - * - * IID_IRMAPassiveSiteWatcher: - * - * {0x00000D0F-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAPassiveSiteWatcher, 0x00000D0F, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAPassiveSiteWatcher - -DECLARE_INTERFACE_(IRMAPassiveSiteWatcher, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAPassiveSiteWatcher method used to notify - * about position updates - */ - STDMETHOD(PositionChanged) (THIS_ - PNxPoint* /*IN*/ pPoint) PURE; - - /* - * IRMAPassiveSiteWatcher method used to notify - * about size updates - */ - STDMETHOD(SizeChanged) (THIS_ - PNxSize* /*IN*/ pSize) PURE; - -}; - -#endif //_RMASITE2_H_ diff --git a/include/realmedia/rmaslta.h b/include/realmedia/rmaslta.h deleted file mode 100644 index ab412f37b..000000000 --- a/include/realmedia/rmaslta.h +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaslta.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary nformation of RealNetworks, Inc, - * and is licensed subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Interfaces for Simulated Live Transfer Agent. - * - */ - -#ifndef _RMASLTA_H -#define _RMASLTA_H - -/**************************************************************************** - * - * Interface: - * - * IRMASLTA - * - * Purpose: - * - * Slta that works with RMA. Simulates a live stream from a file. - * - * IID_IRMASLTA - * - * {00000D00-b4c8-11d0-9995-00a0248da5f0} - * - */ -DEFINE_GUID(IID_IRMASLTA, 0x00000D00, 0xb4c8, 0x11d0, 0x99, - 0x95, 0x0, 0xa0, 0x24, 0x8d, 0xa5, 0xf0); - -DECLARE_INTERFACE_(IRMASLTA, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASLTA methods - */ - - /************************************************************************ - * Method: - * IRMASLTA::Connect - * Purpose: - * Connects the slta to a server. - */ - STDMETHOD(Connect) (THIS_ - const char* host, - UINT16 uPort, - const char* username, - const char* passwd, - const char* livefile - ) PURE; - - /************************************************************************ - * Method: - * IRMASLTA::SetTAC - * Purpose: - * Set the TAC info for the stream. This method MUST be called - * before Encode to have any effect. - */ - STDMETHOD(SetTAC) (THIS_ - const char* Title, - const char* Author, - const char* Copyright) PURE; - - /************************************************************************ - * Method: - * IRMASLTA:Encode - * Purpose: - * Start encoding the file to the server. - */ - STDMETHOD(Encode) - (THIS_ - const char* filename - ) PURE; - - /************************************************************************ - * Method: - * IRMASLTA:Disconnect - * Purpose: - * Disconnect the slta from the server. - */ - STDMETHOD(Disconnect) (THIS) PURE; - - - /************************************************************************ - * Method: - * IRMASLTA::SetTargetBandwidth - * Purpose: - * Sets the target bw for rule subscription. - */ - STDMETHOD(SetTargetBandwidth) (THIS_ - UINT32 ulTargetBW) PURE; - - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMASltaEvent - * - * Purpose: - * - * Allows events to be sent through an SLTA stream - * - * IID_IRMASltaEvent - * - * {00000D01-b4c8-11d0-9995-00a0248da5f0} - * - */ -DEFINE_GUID(IID_IRMASltaEvent, 0x00000D01, 0xb4c8, 0x11d0, 0x99, - 0x95, 0x0, 0xa0, 0x24, 0x8d, 0xa5, 0xf0); - -/* - * Valid RMA event IDs. - */ - -#define RMA_EVENT_TITLE 0x0000 -#define RMA_EVENT_AUTHOR 0x0001 -#define RMA_EVENT_COPYRIGHT 0x0002 -#define RMA_EVENT_SERVER_ALERT 0x0003 -#define RMA_EVENT_PROGRESS_MESSAGE 0x0004 -#define RMA_EVENT_TEXT_SIZE 0x0010 -#define RMA_EVENT_TEXT 0x0011 -#define RMA_EVENT_TEXT_ANCHOR 0x0012 -#define RMA_EVENT_BROWSER_OPEN_URL 0x0020 -#define RMA_EVENT_TOPIC 0x0030 -#define RMA_EVENT_EMPTY 0x0200 -#define RMA_EVENT_CUSTOM_BEGIN 0x0400 - -DECLARE_INTERFACE_(IRMASltaEvent, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASltaEvent methods - */ - - /************************************************************************ - * Method: - * IRMASltaEvent::SetEvent - * Purpose: - * Sends an event to the slta stream. - * nEventID must be one of the valid event IDs defined above. - */ - STDMETHOD(SetEvent) (THIS_ - UINT16 nEventID, - const char* szEventText) PURE; - - /************************************************************************ - * Method: - * IRMASltaEvent::SetRepeatedEvent - * Purpose: - * Sets an event to be repeated every ulFrequency milliseconds. - * nEventID must be one of the valid event IDs defined above. - */ - - STDMETHOD(SetRepeatedEvent) (THIS_ - UINT16 nEventID, - const char* szEventText, - UINT32 ulFrequency) PURE; -}; - -#endif diff --git a/include/realmedia/rmasrc.h b/include/realmedia/rmasrc.h deleted file mode 100644 index 27256af94..000000000 --- a/include/realmedia/rmasrc.h +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** - * - * $Id: rmasrc.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary information of RealNetworks, Inc, - * and is licensed subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Packet Source Interfaces. - * - */ - -#ifndef _RMASRC_H_ -#define _RMASRC_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMARawSourceObject IRMARawSourceObject; -typedef _INTERFACE IRMARawSinkObject IRMARawSinkObject; -typedef _INTERFACE IRMASourceFinderObject IRMASourceFinderObject; -typedef _INTERFACE IRMASourceFinderResponse IRMASourceFinderResponse; -typedef _INTERFACE IRMARequest IRMARequest; - -/**************************************************************************** - * - * Interface: - * - * IRMARawSourceObject - * - * Purpose: - * - * Object that serves packets to sinks - * - * IID_IRMARawSourceObject: - * - * {00001000-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARawSourceObject, 0x00001000, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARawSourceObject - -DECLARE_INTERFACE_(IRMARawSourceObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMARawSourceObject methods - */ - - /************************************************************************ - * Method: - * IRMARawSourceObject::Init - * Purpose: - * Initializes the connection between the source and the sink - */ - STDMETHOD(Init) (THIS_ - IUnknown* pUnknown) PURE; - - STDMETHOD(Done) (THIS) PURE; - - STDMETHOD(GetFileHeader) (THIS) PURE; - - STDMETHOD(GetStreamHeader) (THIS_ - UINT16 unStreamNumber) PURE; - - STDMETHOD(StartPackets) (THIS_ - UINT16 unStreamNumber) PURE; - - STDMETHOD(StopPackets) (THIS_ - UINT16 unStreamNumber) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMARawSinkObject - * - * Purpose: - * - * Object that receives raw packets from a source - * - * IID_IRMARawSinkObject: - * - * {00001001-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMARawSinkObject, 0x00001001, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMARawSinkObject - -DECLARE_INTERFACE_(IRMARawSinkObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMARawSinkObject methods - */ - - /************************************************************************ - * Method: - * IRMARawSinkObject::InitDone - * Purpose: - * Callback after source object has initialized the connection - */ - STDMETHOD(InitDone) (THIS_ - PN_RESULT status) PURE; - - STDMETHOD(FileHeaderReady) (THIS_ - PN_RESULT status, - IRMAValues* pHeader) PURE; - - STDMETHOD(StreamHeaderReady) (THIS_ - PN_RESULT status, - IRMAValues* pHeader) PURE; - - STDMETHOD(PacketReady) (THIS_ - PN_RESULT status, - IRMAPacket* pPacket) PURE; - - STDMETHOD(StreamDone) (THIS_ - UINT16 unStreamNumber) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMASourceFinderObject - * - * Purpose: - * - * Object that allows a sink to search for a raw packet source - * - * IID_IRMASourceFinderObject: - * - * {00001002-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASourceFinderObject, 0x00001002, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMASourceFinderObject IID_IRMASourceFinderObject - -#undef INTERFACE -#define INTERFACE IRMASourceFinderObject - -#define CLSID_IRMASourceFinderObject IID_IRMASourceFinderObject - -DECLARE_INTERFACE_(IRMASourceFinderObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASourceFinderObject methods - */ - - STDMETHOD(Init) (THIS_ - IUnknown* pUnknown) PURE; - - STDMETHOD(Find) (THIS_ - IRMARequest* pRequest) PURE; - - STDMETHOD(Done) (THIS) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMASourceFinderResponse - * - * Purpose: - * - * Object that returns a raw packet source to a sink - * - * IID_IRMASourceFinderResponse: - * - * {00001003-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASourceFinderResponse, 0x00001003, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - - -#undef INTERFACE -#define INTERFACE IRMASourceFinderResponse - -DECLARE_INTERFACE_(IRMASourceFinderResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASourceFinderResponse methods - */ - - STDMETHOD(InitDone) (THIS_ - PN_RESULT status) PURE; - - STDMETHOD(FindDone) (THIS_ - PN_RESULT status, - IUnknown* pUnknown) PURE; - -}; - -#endif /* _RMASRC_H_ */ diff --git a/include/realmedia/rmaupgrd.h b/include/realmedia/rmaupgrd.h deleted file mode 100644 index 8240112a5..000000000 --- a/include/realmedia/rmaupgrd.h +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaupgrd.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * Auto Upgrade Interfaces - * - */ - -#ifndef _RMAUPGRD_H -#define _RMAUPGRD_H - - -typedef _INTERFACE IRMABuffer IRMABuffer; - - -/* Enumeration for the upgrade types */ -typedef enum _RMAUpgradeType -{ - eUT_Required, - eUT_Recommended, - eUT_Optional -} RMAUpgradeType; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUpgradeCollection - * - * Purpose: - * - * Interface provided by the Context. This interface allows collection - * of upgrade components by the client core and it's delegates - * (i.e. renderer plugins etc.) - * - * IID_IRMAUpgradeCollection - * - * {00002500-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAUpgradeCollection, - 0x00002500, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUpgradeCollection - -DECLARE_INTERFACE_(IRMAUpgradeCollection, IUnknown) -{ - /* - * IRMAUpgradeCollection methods - */ - - /************************************************************************ - * Method: - * IRMAUpgradeCollection::Add - * Purpose: - * Adds the specified upgrade information to the collection - * - */ - STDMETHOD_(UINT32, Add) (THIS_ - RMAUpgradeType upgradeType, - IRMABuffer* pPluginId, - UINT32 majorVersion, - UINT32 minorVersion) PURE; - - /************************************************************************ - * Method: - * IRMAUpgradeCollection::Remove - * Purpose: - * Remove the specified item from the collection - * - */ - STDMETHOD(Remove) (THIS_ - UINT32 index) PURE; - - /************************************************************************ - * Method: - * IRMAUpgradeCollection::RemoveAll - * Purpose: - * Remove all items from the collection - * - */ - STDMETHOD(RemoveAll) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAUpgradeCollection::GetCount - * Purpose: - * get the count of the collection - * - */ - STDMETHOD_(UINT32, GetCount)(THIS) PURE; - - /************************************************************************ - * Method: - * IRMAUpgradeCollection::GetAt - * Purpose: - * get the specified items upgrade information - * - */ - STDMETHOD(GetAt) (THIS_ - UINT32 index, - REF(RMAUpgradeType) upgradeType, - IRMABuffer* pPluginId, - REF(UINT32) majorVersion, - REF(UINT32) minorVersion) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAUpgradeHandler - * - * Purpose: - * - * Interface provided by the top-level client application. This - * interface allows the client core to request an upgrade. - * - * IID_IRMAUpgradeHandler: - * - * {00002501-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAUpgradeHandler, - 0x00002501, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAUpgradeHandler - -DECLARE_INTERFACE_(IRMAUpgradeHandler, IUnknown) -{ - /* - * IRMAUpgradeHandler methods - */ - - /************************************************************************ - * Method: - * IRMAUpgradeHandler::RequestUpgrade - * Purpose: - * Ask if user wants to do an upgrade and start an upgrade - * - */ - STDMETHOD(RequestUpgrade) (THIS_ IRMAUpgradeCollection* pComponents, - BOOL bBlocking) PURE; - - /************************************************************************ - * Method: - * IRMAUpgradeHandler::HasComponents - * Purpose: - * Check if required components are present on the system. - * Returns: - * PNR_OK - components are here, no upgrade required; - * all components are removed from pComponents. - * PNR_FAIL - some components are missing; - * pComponents contains only those components - * that need upgrade. - * - */ - STDMETHOD(HasComponents) (THIS_ IRMAUpgradeCollection* pComponents) PURE; -}; - - - -#endif /* _RMAUPGRD_H */ - diff --git a/include/realmedia/rmavalue.h b/include/realmedia/rmavalue.h deleted file mode 100644 index 764e133cc..000000000 --- a/include/realmedia/rmavalue.h +++ /dev/null @@ -1,381 +0,0 @@ -/**************************************************************************** - * - * $Id: rmavalue.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Plug-in Interfaces. - * - */ - -#ifndef _RMAVALUE_H_ -#define _RMAVALUE_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IUnknown IUnknown; -typedef _INTERFACE IRMABuffer IRMABuffer; -typedef _INTERFACE IRMAKeyValueList IRMAKeyValueList; -typedef _INTERFACE IRMAKeyValueListIter IRMAKeyValueListIter; -typedef _INTERFACE IRMAKeyValueListIterOneKey IRMAKeyValueListIterOneKey; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMAOptions IRMAOptions; - -/* Note : GUIDS 3101 - 3107 are deprecated. */ - -/**************************************************************************** - * - * Interface: - * - * IRMAKeyValueList - * - * Purpose: - * - * Stores a list of strings, where strings are keyed by not necessarily - * unique keys. - * - * - * IRMAKeyValueList: - * - * {0x00003108-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAKeyValueList, 0x00003108, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); -#define CLSID_IRMAKeyValueList IID_IRMAKeyValueList - -#undef INTERFACE -#define INTERFACE IRMAKeyValueList - -DECLARE_INTERFACE_(IRMAKeyValueList, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * Regular methods - */ - - /************************************************************************ - * Method: - * IRMAKeyValueList::AddKeyValue - * Purpose: - * Add a new key/value tuple to our list of strings. You can have - * multiple strings for the same key. - */ - STDMETHOD(AddKeyValue) (THIS_ - const char* pKey, - IRMABuffer* pStr) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValueList::GetIter - * Purpose: - * Return an iterator that allows you to iterate through all the - * key/value tuples in our list of strings. - */ - STDMETHOD(GetIter) (THIS_ - REF(IRMAKeyValueListIter*) pIter) PURE; - - - /************************************************************************ - * Method: - * IRMAKeyValueList::GetIterOneKey - * Purpose: - * Return an iterator that allows you to iterate through all the - * strings for a particular key. - */ - STDMETHOD(GetIterOneKey) (THIS_ - const char* pKey, - REF(IRMAKeyValueListIterOneKey*) pIter) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValueList::AppendAllListItems - * Purpose: - * Append all the key/string tuples from another list to this list. - * (You can have duplicate keys.) - */ - STDMETHOD(AppendAllListItems) (THIS_ - IRMAKeyValueList* pList) PURE; - /************************************************************************ - * Method: - * IRMAKeyValueList::KeyExists - * Purpose: - * See whether any strings exist for a particular key. - */ - STDMETHOD_(BOOL,KeyExists) (THIS_ - const char* pKey) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValueList::CreateObject - * Purpose: - * Create an empty object that is the same class as the current object. - */ - STDMETHOD(CreateObject) (THIS_ - REF(IRMAKeyValueList*) pNewList) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValueList::ImportValues. - * Purpose: - * Import all the strings from an IRMAValues object into this object. - * If this object also supports IRMAValues, it should also import the - * ULONGs and Buffers. You can have duplicate keys, and old data is - * left untouched. - */ - STDMETHOD(ImportValues) (THIS_ - IRMAValues* pValues) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAKeyValueListIter - * - * Purpose: - * - * Iterate over all the items in a CKeyValueList. - * Call IRMAKeyValueList::GetIter to create an iterator. - * - * - * IRMAKeyValueListIter: - * - * {0x00003109-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAKeyValueListIter, 0x00003109, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAKeyValueListIter IID_IRMAKeyValueListIter - -#undef INTERFACE -#define INTERFACE IRMAKeyValueListIter - -DECLARE_INTERFACE_(IRMAKeyValueListIter, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /* - * Regular methods - */ - - /************************************************************************ - * Method: - * IRMAKeyValueListIter::GetNextPair - * Purpose: - * Each call to this method returns one key/value tuple from your - * list of strings. Strings are returned in same order that they - * were inserted. - */ - STDMETHOD(GetNextPair) (THIS_ - REF(const char*) pKey, - REF(IRMABuffer*) pStr) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValueListIter::ReplaceCurr - * Purpose: - * Replaces the value in the key/value tuple that was returned - * in the last call to GetNextPair with a new string. - */ - STDMETHOD(ReplaceCurr) (THIS_ - IRMABuffer* pStr) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAKeyValueListIterOneKey - * - * Purpose: - * - * Iterate over all the items in a CKeyValueList that match a particular key. - * Call IRMAKeyValueList::GetIterOneKey to create an iterator. - * - * - * IRMAKeyValueListIterOneKey: - * - * {0x00003110-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAKeyValueListIterOneKey, 0x00003110, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAKeyValueListIterOneKey IID_IRMAKeyValueListIterOneKey - -#undef INTERFACE -#define INTERFACE IRMAKeyValueListIterOneKey - -DECLARE_INTERFACE_(IRMAKeyValueListIterOneKey, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /* - * Regular methods - */ - - /************************************************************************ - * Method: - * IRMAKeyValueListIterOneKey::GetNextString - * Purpose: - * Each call to this method returns one string that matches the - * key for this iterator. Strings are returned in same order that they - * were inserted. - * - */ - STDMETHOD(GetNextString) (THIS_ - REF(IRMABuffer*) pStr) PURE; - - /************************************************************************ - * Method: - * IRMAKeyValueListIterOneKey::ReplaceCurr - * Purpose: - * Replaces the value in the key/value tuple that was referenced - * in the last call to GetNextString with a new string. - * - */ - STDMETHOD(ReplaceCurr) (THIS_ - IRMABuffer* pStr) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAOptions - * - * Purpose: - * - * This is a generic options interface, implemented by any object to - * allow its options to be read and set by another component of the - * system. - * - * - * IRMAOptions: - * - * {0x00003111-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAOptions, 0x00003111, 0x901, 0x11d1, - 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAOptions IID_IRMAOptions - -#undef INTERFACE -#define INTERFACE IRMAOptions - -DECLARE_INTERFACE_(IRMAOptions, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - - /* - * Regular methods - */ - - /************************************************************************ - * Method: - * IRMAOptions::GetOptions - * Purpose: - * This method returns a list of the options supported by this - * particular object, along with the value currently set for each - * option. Enumerate the members of the returned IRMAValues object - * to discover what options a component supports and the type of - * each of those options. The value for each name-value pair is - * the current setting for that option. - * - */ - STDMETHOD(GetOptions) (THIS_ - REF(IRMAValues*) pOptions) PURE; - - /************************************************************************ - * Method: - * IRMAOptions::SetOptionULONG32 - * Purpose: - * Sets the value of a ULONG32 option. The return value indicates - * whether or not the SetOptionULONG32 call succeeded. - * - */ - STDMETHOD(SetOptionULONG32) (THIS_ - const char* pName, - ULONG32 ulValue) PURE; - - /************************************************************************ - * Method: - * IRMAOptions::SetOptionCString - * Purpose: - * Sets the value of a CString option. The return value indicates - * whether or not the SetOptionCString call succeeded. - * - */ - STDMETHOD(SetOptionCString) (THIS_ - const char* pName, - IRMABuffer* pValue) PURE; - - /************************************************************************ - * Method: - * IRMAOptions::SetOptionBuffer - * Purpose: - * Sets the value of a Buffer option. The return value indicates - * whether or not the SetOptionBuffer call succeeded. - * - */ - STDMETHOD(SetOptionBuffer) (THIS_ - const char* pName, - IRMABuffer* pValue) PURE; -}; - - -#endif /* !_RMAVALUE_H_ */ diff --git a/include/realmedia/rmavsrc.h b/include/realmedia/rmavsrc.h deleted file mode 100644 index b96ab6486..000000000 --- a/include/realmedia/rmavsrc.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef _RMAVSRC_H -#define _RMAVSRC_H -/**************************************************************************** - * - * $Id: rmavsrc.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1999 RealNetworks, Inc. All rights reserved.. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of RealNetworks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * RealMedia Architecture FileViewSource Interfaces. - * - */ - - -typedef _INTERFACE IRMAStreamSource IRMAStreamSource; -typedef _INTERFACE IRMAFileObject IRMAFileObject; - -// Interfaces definded in this file -typedef _INTERFACE IRMAFileViewSource IRMAFileViewSource; -typedef _INTERFACE IRMAFileViewSourceResponse IRMAFileViewSourceResponse; -typedef _INTERFACE IRMAViewSourceCommand IRMAViewSourceCommand; -typedef _INTERFACE IRMAViewSourceURLResponse IRMAViewSourceURLResponse; - - - - -/**************************************************************************** - * - * Interface: - * - * IRMAFileViewSource - * - * IID_IRMAFileViewSource: - * - * {00003500-0901-11d1-8B06-00A024406D59} - * - */ - -enum SOURCE_TYPE -{ - RAW_SOURCE, - HTML_SOURCE -}; - -DEFINE_GUID(IID_IRMAFileViewSource, 0x00003500, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileViewSource - -DECLARE_INTERFACE_(IRMAFileViewSource, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAFileViewSource - */ - STDMETHOD(InitViewSource) (THIS_ - IRMAFileObject* /*IN*/ pFileObject, - IRMAFileViewSourceResponse* /*IN*/ pResp, - SOURCE_TYPE /*IN*/ sourceType, - IRMAValues* /*IN*/ pOptions) PURE; - STDMETHOD(GetSource) (THIS) PURE; - STDMETHOD(Close) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAFileViewSourceResponse - * - * IID_IRMAFileViewSourceResponse: - * - * {00003501-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAFileViewSourceResponse, 0x00003501, 0x901, 0x11d1, 0x8b, - 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAFileViewSourceResponse - -DECLARE_INTERFACE_(IRMAFileViewSourceResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAFileViewSourceResoponse - */ - STDMETHOD(InitDone) (THIS_ PN_RESULT status ) PURE; - STDMETHOD(SourceReady) (THIS_ PN_RESULT status, - IRMABuffer* pSource ) PURE; - STDMETHOD(CloseDone) (THIS_ PN_RESULT) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAViewSourceCommand - * - * IID_IRMAViewSourceCommand: - * - * {00003504-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAViewSourceCommand, 0x00003504, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAViewSourceCommand - -DECLARE_INTERFACE_(IRMAViewSourceCommand, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAViewSourceCommand - */ - STDMETHOD_(BOOL, CanViewSource) (THIS_ - IRMAStreamSource* pStream) PURE; - STDMETHOD(DoViewSource) (THIS_ - IRMAStreamSource* pStream) PURE; - STDMETHOD(GetViewSourceURL) (THIS_ - IRMAStreamSource* pSource, - IRMAViewSourceURLResponse* pResp) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAViewSourceURLResponse - * - * IID_IRMAViewSourceURLResponse: - * - * {00003505-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAViewSourceURLResponse, 0x00003505, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAViewSourceURLResponse - -DECLARE_INTERFACE_(IRMAViewSourceURLResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAViewSourceURLResponse - */ - STDMETHOD(ViewSourceURLReady) (THIS_ - const char* /*out*/ pUrl) PURE; -}; - - -#endif diff --git a/include/realmedia/rmavsurf.h b/include/realmedia/rmavsurf.h deleted file mode 100644 index e3460126a..000000000 --- a/include/realmedia/rmavsurf.h +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** - * - * $Id: rmavsurf.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995,1996,1997 Progressive Networks. - * All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Video Surface Interfaces. - * - */ - -#ifndef _RMAVSURF_H_ -#define _RMAVSURF_H_ - -/**************************************************************************** - * - * Video Surface Data Structures and Constants - */ -typedef struct _RMABitmapInfoHeader -{ - UINT32 biSize; - INT32 biWidth; - INT32 biHeight; - UINT16 biPlanes; - UINT16 biBitCount; - UINT32 biCompression; - UINT32 biSizeImage; - INT32 biXPelsPerMeter; - INT32 biYPelsPerMeter; - UINT32 biClrUsed; - UINT32 biClrImportant; - UINT32 rcolor; - UINT32 gcolor; - UINT32 bcolor; - -} RMABitmapInfoHeader; - -/* - * RMABitmapInfo structure. - */ -typedef struct _RMABitmapInfo -{ - struct - { - UINT32 biSize; /* use OFFSETOF(dwBitMask) here */ - INT32 biWidth; /* image width (in pixels) */ - INT32 biHeight; /* image height */ - UINT16 biPlanes; /* # of bitplanes; always use 1 */ - UINT16 biBitCount; /* average # bits/pixel */ - UINT32 biCompression; /* one of the RMA_... FOURCC codes */ - UINT32 biSizeImage; /* = width * height * bitCount / 8 */ - INT32 biXPelsPerMeter;/* always 0 */ - INT32 biYPelsPerMeter;/* always 0 */ - UINT32 biClrUsed; /* !0, if 8-bit RGB; 0, otherwise */ - UINT32 biClrImportant; /* !0, if 8-bit RGB; 0, otherwise */ - - } bmiHeader; - - union - { - UINT32 dwBitMask[3]; /* color masks (for BI_BITFIELDS) */ - UINT32 dwPalette[256]; /* palette (for 8-bit RGB image) */ - } un; - -} RMABitmapInfo; - -typedef UINT32 RMA_COMPRESSION_TYPE; - -/* - * Windows DIB formats & MKFOURCC() macro: - */ -#ifndef BI_RGB -#define BI_RGB 0L /* RGB-8, 16, 24, or 32 */ -#define BI_RLE8 1L /* 8-bit RLE compressed image */ -#define BI_RLE4 2L /* 4-bit RLE compressed image */ -#define BI_BITFIELDS 3L /* RGB 555, 565, etc. */ -#endif -#ifndef MKFOURCC -#define MKFOURCC(c0,c1,c2,c3) \ - ((UINT32)(BYTE)(c0) | ((UINT32)(BYTE)(c1) << 8) | \ - ((UINT32)(BYTE)(c2) << 16) | ((UINT32)(BYTE)(c3) << 24)) -#endif - -/* - * RMA image formats: - */ -#define RMA_RGB BI_RGB /* Windows-compatible RGB formats: */ -#define RMA_RLE8 BI_RLE8 -#define RMA_RLE4 BI_RLE4 -#define RMA_BITFIELDS BI_BITFIELDS -#define RMA_I420 MKFOURCC('I','4','2','0') /* planar YCrCb */ -#define RMA_YV12 MKFOURCC('Y','V','1','2') /* planar YVU420 */ -#define RMA_YUY2 MKFOURCC('Y','U','Y','2') /* packed YUV422 */ -#define RMA_UYVY MKFOURCC('U','Y','V','Y') /* packed YUV422 */ -#define RMA_YVU9 MKFOURCC('Y','V','U','9') /* Intel YVU9 */ - -/* - * Non-standard FOURCC formats (these are just few aliases to what can be - * represented by the standard formats, and they are left for backward - * compatibility only). - */ -#define RMA_RGB3_ID MKFOURCC('3','B','G','R') /* RGB-32 ?? */ -#define RMA_RGB24_ID MKFOURCC('B','G','R',' ') /* top-down RGB-24*/ -#define RMA_RGB565_ID MKFOURCC('6','B','G','R') /* RGB-16 565 */ -#define RMA_RGB555_ID MKFOURCC('5','B','G','R') /* RGB-16 555 */ -#define RMA_8BIT_ID MKFOURCC('T','I','B','8') /* RGB-8 w. pal-e */ -#define RMA_YUV420_ID MKFOURCC('2','V','U','Y') /* planar YCrCb */ -#define RMA_YUV411_ID MKFOURCC('1','V','U','Y') /* ??? */ -#define RMA_YUVRAW_ID MKFOURCC('R','V','U','Y') /* ??? */ - - -/**************************************************************************** - * - * Interface: - * - * IRMAVideoSurface - * - * Purpose: - * - * Interface for IRMAVideoSurface objects. - * - * IID_IRMAVideoSurface: - * - * {00002200-0901-11d1-8B06-00A024406D59} - * - */ - -DEFINE_GUID(IID_IRMAVideoSurface, 0x00002200, 0x901, 0x11d1, 0x8b, - 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAVideoSurface - -DECLARE_INTERFACE_(IRMAVideoSurface, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAVideoSurface methods usually called by renderers to - * Draw on the surface - */ - STDMETHOD(Blt) (THIS_ - UCHAR* /*IN*/ pImageBits, - RMABitmapInfoHeader* /*IN*/ pBitmapInfo, - REF(PNxRect) /*IN*/ rDestRect, - REF(PNxRect) /*IN*/ rSrcRect) PURE; - - /************************************************************************ - * Method: - * IRMAVideoSurface::BeginOptimizedBlt - * Purpose: - * Called by renderer to commit to a bitmap format for all future - * OptimizedBlt calls. - */ - STDMETHOD(BeginOptimizedBlt)(THIS_ - RMABitmapInfoHeader* /*IN*/ pBitmapInfo) PURE; - - /************************************************************************ - * Method: - * IRMAVideoSurface::OptimizedBlt - * Purpose: - * Called by renderer to draw to the video surface, in the format - * previously specified by calling BeginOptimizedBlt. - */ - STDMETHOD(OptimizedBlt) (THIS_ - UCHAR* /*IN*/ pImageBits, - REF(PNxRect) /*IN*/ rDestRect, - REF(PNxRect) /*IN*/ rSrcRect) PURE; - - /************************************************************************ - * Method: - * IRMAVideoSurface::EndOptimizedBlt - * Purpose: - * Called by renderer allow the video surface to cleanup after all - * OptimizedBlt calls have been made. - */ - STDMETHOD(EndOptimizedBlt) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMAVideoSurface::GetOptimizedFormat - * Purpose: - * Called by the client to find out what compression type the - * renderer committed to when it called BeginOptimizedBlt. - */ - STDMETHOD(GetOptimizedFormat)(THIS_ - REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType) PURE; - - /************************************************************************ - * Method: - * IRMAVideoSurface::GetPreferredFormat - * Purpose: - * Called by renderer to find out what compression type the video - * surface would prefer to be given in BeginOptimizedBlt. - */ - STDMETHOD(GetPreferredFormat)(THIS_ - REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType) PURE; -}; - -#endif /* _RMAVSURF_H_ */ diff --git a/include/realmedia/rmawin.h b/include/realmedia/rmawin.h deleted file mode 100644 index 6bbcfb940..000000000 --- a/include/realmedia/rmawin.h +++ /dev/null @@ -1,811 +0,0 @@ -/**************************************************************************** - * - * $Id: rmawin.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture Simple Window Interfaces. - * - */ - -#ifndef _RMAWIN_H_ -#define _RMAWIN_H_ - -/* - * Forward declarations of some interfaces defined or used here-in. - */ -typedef _INTERFACE IRMASite IRMASite; -typedef _INTERFACE IRMASiteUser IRMASiteUser; -typedef _INTERFACE IRMASiteWindowed IRMASiteWindowed; -typedef _INTERFACE IRMASiteEventHandler IRMASiteEventHandler; -typedef _INTERFACE IRMASiteWindowless IRMASiteWindowless; -typedef _INTERFACE IRMASiteWatcher IRMASiteWatcher; -typedef _INTERFACE IRMAValues IRMAValues; -typedef _INTERFACE IRMASiteFullScreen IRMASiteFullScreen; -typedef _INTERFACE IRMALayoutSiteGroupManager IRMALayoutSiteGroupManager; -typedef _INTERFACE IRMAEventHook IRMAEventHook; - -typedef struct _PNxWindow PNxWindow; -typedef struct _PNxSize PNxSize; -typedef struct _PNxPoint PNxPoint; -typedef struct _PNxRect PNxRect; -typedef void* PNxRegion; - - -/**************************************************************************** - * - * Interface: - * - * IRMASiteWindowed - * - * Purpose: - * - * Interface for IRMASite objects which are associated with platform - * specific window objects on Microsoft Windows and X-Windows. - * - * IID_IRMASiteWindowed: - * - * {00000D01-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteWindowed, 0x00000D01, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMASiteWindowed IID_IRMASiteWindowed - - -#undef INTERFACE -#define INTERFACE IRMASiteWindowed - -DECLARE_INTERFACE_(IRMASiteWindowed, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteWindowed methods called by site suppliers - * when they want the site associated with a - * previously created (and externally managed) window. - * This method will "sub-class" that window (Win32). - * On Unix, the site supplier must pass events from - * the externally managed window to the core via - * IRMAClientEngine::EventOccurred(). Please note that - * The PNxWindow ptr must remain in scope for the life - * of Site. - * - */ - STDMETHOD(AttachWindow) (THIS_ - PNxWindow* /*IN*/ pWindow) PURE; - - STDMETHOD(DetachWindow) (THIS) PURE; - - /* - * IRMASiteWindowed methods called by Owners of the site - * in the event that want a default top level window created - * for the site. - */ - STDMETHOD(Create) (THIS_ - void* ParentWindow, - UINT32 style) PURE; - - STDMETHOD(Destroy) (THIS) PURE; - - /* - * IRMASiteWindowed method. Returns actual window of the site. - */ - STDMETHOD_(PNxWindow*,GetWindow)(THIS) PURE; -}; - - - -/**************************************************************************** - * - * Interface: - * - * IRMASiteWindowless - * - * Purpose: - * - * Interface for IRMASite objects which are "windowless" or not - * associated with platform specific window objects. - * - * IID_IRMASiteWindowless: - * - * {00000D02-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteWindowless, 0x00000D02, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteWindowless - -#define CLSID_IRMASiteWindowless IID_IRMASiteWindowless - -DECLARE_INTERFACE_(IRMASiteWindowless, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteWindowless methods called by owners of the site. - */ - STDMETHOD(EventOccurred) (THIS_ - PNxEvent* /*IN*/ pEvent) PURE; - - /* - * IRMASiteWindowless method. Returns some parent window that - * owns the windowless site. Useful for right-click menus and - * dialog box calls. - */ - STDMETHOD_(PNxWindow*,GetParentWindow)(THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMASite - * - * Purpose: - * - * Interface for IRMASite objects. - * - * IID_IRMASite: - * - * {00000D03-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASite, 0x00000D03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASite - -DECLARE_INTERFACE_(IRMASite, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASite methods usually called by the "context" to - * associate users with the site, and to create child sites - * as appropriate. - */ - STDMETHOD(AttachUser) (THIS_ - IRMASiteUser* /*IN*/ pUser) PURE; - - STDMETHOD(DetachUser) (THIS) PURE; - - - STDMETHOD(GetUser) (THIS_ - REF(IRMASiteUser*) /*OUT*/ pUser) PURE; - - STDMETHOD(CreateChild) (THIS_ - REF(IRMASite*) /*OUT*/ pChildSite) PURE; - - STDMETHOD(DestroyChild) (THIS_ - IRMASite* /*IN*/ pChildSite) PURE; - - /* - * IRMASite methods called by the the "context" in which the site - * is displayed in order to manage its position. Site users should - * not generally call these methods. - */ - STDMETHOD(AttachWatcher) (THIS_ - IRMASiteWatcher* /*IN*/ pWatcher) PURE; - - STDMETHOD(DetachWatcher) (THIS) PURE; - - STDMETHOD(SetPosition) (THIS_ - PNxPoint position) PURE; - - STDMETHOD(GetPosition) (THIS_ - REF(PNxPoint) position) PURE; - - /* - * IRMASite methods called by the user of the site to get - * information about the site, and to manipulate the site. - */ - STDMETHOD(SetSize) (THIS_ - PNxSize size) PURE; - - STDMETHOD(GetSize) (THIS_ - REF(PNxSize) size) PURE; - - STDMETHOD(DamageRect) (THIS_ - PNxRect rect) PURE; - - STDMETHOD(DamageRegion) (THIS_ - PNxRegion region) PURE; - - STDMETHOD(ForceRedraw) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMASiteUser - * - * Purpose: - * - * Interface for the user of the IRMASite objects. - * - * IID_IRMASiteUser: - * - * {00000D04-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteUser, 0x00000D04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteUser - -DECLARE_INTERFACE_(IRMASiteUser, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteUser methods usually called by the "context" to - * associate users with the site. - */ - STDMETHOD(AttachSite) (THIS_ - IRMASite* /*IN*/ pSite) PURE; - - STDMETHOD(DetachSite) (THIS) PURE; - - /* - * IRMASiteUser methods called to inform user of an event. - */ - STDMETHOD(HandleEvent) (THIS_ - PNxEvent* /*IN*/ pEvent) PURE; - - STDMETHOD_(BOOL,NeedsWindowedSites) (THIS) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMASiteWatcher - * - * Purpose: - * - * Interface for IRMASiteWatcher objects. - * - * IID_IRMASite: - * - * {00000D05-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteWatcher, 0x00000D05, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteWatcher - -DECLARE_INTERFACE_(IRMASiteWatcher, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteWatcher methods called by the site when a watcher - * is attached to or detached from it. - */ - STDMETHOD(AttachSite) (THIS_ - IRMASite* /*IN*/ pSite) PURE; - - STDMETHOD(DetachSite) (THIS) PURE; - - /* - * IRMASiteWatcher methods called by the site an attempt is - * made to change it's position or size. The site watcher must - * return PNR_OK for the change to occur. If the site watcher - * returns any value other than PNR_OK then the size or position - * will not change. The site watcher can also modify the new - * size of position. - */ - STDMETHOD(ChangingPosition) (THIS_ - PNxPoint posOld, - REF(PNxPoint)/*IN-OUT*/ posNew) PURE; - - STDMETHOD(ChangingSize) (THIS_ - PNxSize sizeOld, - REF(PNxSize) /*IN-OUT*/ sizeNew) PURE; -}; - -/**************************************************************************** - * - * Interface: - * - * IRMASiteUserSupplier - * - * Purpose: - * - * Interface implemented by renderers and objects with provide layouts to - * the client core. This interface is called by the core when it needs a - * new IRMASiteUser, or when it is done using an IRMASiteUser. - * - * IID_IRMASiteUserSupplier: - * - * {00000D06-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteUserSupplier, 0x00000D06, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteUserSupplier - -DECLARE_INTERFACE_(IRMASiteUserSupplier, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteUserSupplier methods usually called by the - * "context" to ask for additional or to release previously - * created site users. - */ - STDMETHOD(CreateSiteUser) (THIS_ - REF(IRMASiteUser*)/*OUT*/ pSiteUser) PURE; - - STDMETHOD(DestroySiteUser) (THIS_ - IRMASiteUser* /*IN*/ pSiteUser) PURE; - - STDMETHOD_(BOOL,NeedsWindowedSites) (THIS) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMASiteSupplier - * - * Purpose: - * - * Interface implemented by users of the client core. This interface is - * called by the core when it needs a new IRMASite, or when it is done - * using an IRMASite. - * - * IID_IRMASiteSupplier: - * - * {00000D07-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteSupplier, 0x00000D07, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteSupplier - -DECLARE_INTERFACE_(IRMASiteSupplier, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteSupplier methods - */ - - /************************************************************************ - * Method: - * IRMASiteSupplier::SitesNeeded - * Purpose: - * Called to inform the site supplier that a site with a particular - * set of characteristics is needed. If the site supplier can - * fulfill the request it should call the site manager and add one - * or more new sites. - * Note that the request for sites is associated with a Request ID - * the client core will inform the site supplier when this requested - * site is no longer needed. - */ - STDMETHOD(SitesNeeded) (THIS_ - UINT32 uReqestID, - IRMAValues* pSiteProps) PURE; - - /************************************************************************ - * Method: - * IRMASiteSupplier::SitesNotNeeded - * Purpose: - * Called to inform the site supplier that all sites from a previos - * site request are no longer needed. If the site supplier had - * previously created non-persistant sites (like popup windows) - * to fulfill a request for sites it should call the site manager - * and remove those sites. - */ - STDMETHOD(SitesNotNeeded) (THIS_ - UINT32 uReqestID) PURE; - - - /************************************************************************ - * Method: - * IRMASiteSupplier::BeginChangeLayout - * Purpose: - * Called to inform the site supplier a layout change has beginning - * it can expect to recieve SitesNeeded() and SitesNotNeeded() calls - * while a layout change is in progress, - */ - STDMETHOD(BeginChangeLayout) (THIS) PURE; - - /************************************************************************ - * Method: - * IRMASiteSupplier::DoneChangeLayout - * Purpose: - * Called to inform the site supplier the layout change has been - * completed. - */ - STDMETHOD(DoneChangeLayout) (THIS) PURE; - -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMASiteManager - * - * Purpose: - * - * Interface implemented by the client core. This interface is called - * by users of the client core to inform it of IRMASite's which are - * available for layout of renderers - * - * IID_IRMASiteManager: - * - * {00000D08-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteManager, 0x00000D08, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteManager - -DECLARE_INTERFACE_(IRMASiteManager, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteManager methods - */ - - /************************************************************************ - * Method: - * IRMASiteManager::AddSite - * Purpose: - * Called to inform the site manager of the existance of a site. - */ - STDMETHOD(AddSite) (THIS_ - IRMASite* pSite) PURE; - - /************************************************************************ - * Method: - * IRMASiteManager::RemoveSite - * Purpose: - * Called to inform the site manager that a site is no longer - * available. - */ - STDMETHOD(RemoveSite) (THIS_ - IRMASite* pSite) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * - * IRMAMultiInstanceSiteUserSupplier - * - * Purpose: - * - * This is the interface for a special default object which is available - * from the common class factory. This object will act as a site user - * supplier for any renderer (or other site user object) that wants - * default support for multiple instances. The site user must work as - * a windowless site for this default implementation to work. The - * default object also implements the IRMASite interfave to allow - * the site user object to control all the sites through a single - * interface instance. - * - * IID_IRMAMultiInstanceSiteUserSupplier: - * - * {00000D09-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAMultiInstanceSiteUserSupplier, 0x00000D09, 0x901, - 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#define CLSID_IRMAMultiInstanceSiteUserSupplier \ - IID_IRMAMultiInstanceSiteUserSupplier - -#undef INTERFACE -#define INTERFACE IRMAMultiInstanceSiteUserSupplier - -DECLARE_INTERFACE_(IRMAMultiInstanceSiteUserSupplier, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAMultiInstanceSiteUserSupplier methods called by site users. - */ - STDMETHOD(SetSingleSiteUser) (THIS_ - IUnknown* pUnknown) PURE; - - STDMETHOD(ReleaseSingleSiteUser) (THIS) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * IRMASiteFullScreen - * - * Purpose: - * - * This is the interface for turning on/off the full screen mode - * - * IID_IRMASiteFullScreen: - * - * {00000D0B-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMASiteFullScreen, 0x00000D0B, 0x901, - 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMASiteFullScreen - -DECLARE_INTERFACE_(IRMASiteFullScreen, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMASiteFullScreen methods - */ - STDMETHOD(EnterFullScreen) (THIS) PURE; - - STDMETHOD(ExitFullScreen) (THIS) PURE; - - STDMETHOD(TestFullScreen) (THIS_ - void* hTestBitmap,const char* pszStatusText) PURE; - - STDMETHOD_(BOOL, IsFullScreen) (THIS) PURE; -}; - - - - -/**************************************************************************** - * - * Interface: - * IRMAEventHookMgr - * - * Purpose: - * - * Add ability to hook events from a named region - * - * IID_IRMAEventHookMgr: - * - * {00000D0D-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAEventHookMgr, 0x00000D0D, 0x901, - 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAEventHookMgr - -DECLARE_INTERFACE_(IRMAEventHookMgr, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAEventHookMgr methods - */ - STDMETHOD(AddHook) (THIS_ - IRMAEventHook* pHook, - const char* pRegionName, - UINT16 uLayer) PURE; - - STDMETHOD(RemoveHook) (THIS_ - IRMAEventHook* pHook, - const char* pRegionName, - UINT16 uLayer) PURE; -}; - -/**************************************************************************** - * - * Interface: - * IRMAEventHook - * - * Purpose: - * - * Object that gets hooked events sent by IRMAEventHookMgr - * - * IID_IRMAEventHookMgr: - * - * {00000D0E-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAEventHook, 0x00000D0E, 0x901, - 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAEventHook - -DECLARE_INTERFACE_(IRMAEventHook, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAEventHook methods - */ - STDMETHOD(SiteAdded) (THIS_ - IRMASite* pSite) PURE; - STDMETHOD(HandleEvent) (THIS_ - IRMASite* pSite, - PNxEvent* pEvent) PURE; - STDMETHOD(SiteRemoved) (THIS_ - IRMASite* pSite) PURE; -}; - - -/**************************************************************************** - * - * Interface: - * IRMAStatusMessage - * - * Purpose: - * - * This is the interface for setting the status text. - * - * IID_IRMAStatusMessage: - * - * {00000D10-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAStatusMessage, 0x00000D10, 0x901, - 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAStatusMessage - -DECLARE_INTERFACE_(IRMAStatusMessage, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /* - * IRMAStatusMessage methods - */ - - STDMETHOD(SetStatus) (THIS_ const char* pText) PURE; -}; - - -#endif /* _RMAWIN_H_ */ diff --git a/include/realmedia/rmaxmltg.h b/include/realmedia/rmaxmltg.h deleted file mode 100644 index 00579c548..000000000 --- a/include/realmedia/rmaxmltg.h +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** - * - * $Id: rmaxmltg.h 7 2003-05-30 02:18:02Z gabest $ - * - * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.. - * - * http://www.real.com/devzone - * - * This program contains proprietary - * information of Progressive Networks, Inc, and is licensed - * subject to restrictions on use and distribution. - * - * - * RealMedia Architecture XMLTag Object Interfaces. - * - */ - - -#ifndef _RMAXMLTG_H -#define _RMAXMLTG_H - - -typedef _INTERFACE IRMAXMLTagObject IRMAXMLTagObject; -typedef _INTERFACE IRMAXMLTagObjectResponse IRMAXMLTagObjectResponse; - -/**************************************************************************** - * - * Interface: - * - * IRMAXMLTagObjectResponse - * - * IID_IRMAXMLTagObjectResponse: - * - * {00002C02-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAXMLTagObjectResponse, 0x00002C02, 0x901, 0x11d1, 0x8b, 0x6, - 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAXMLTagObjectResponse - -DECLARE_INTERFACE_(IRMAXMLTagObjectResponse, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAXMLTagObjectResponse - */ - STDMETHOD(OnTagDone) (THIS_ UINT32 ulInstance, IRMABuffer* pTag) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAXMLTagHandler - * - * IID_IRMAXMLTagHandler: - * - * {00002C00-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAXMLTagHandler, 0x00002C03, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAXMLTagHandler - -DECLARE_INTERFACE_(IRMAXMLTagHandler, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAXMLTagHandler - */ - STDMETHOD(InitTagHandler) (THIS_ IRMAValues* pOptions) PURE; - STDMETHOD(CreateTagObject) (THIS_ IRMAXMLTagObject** ppObj) PURE; - STDMETHOD(GetTagHandlerInfo) (THIS_ - REF(const char*) /*OUT*/ pShortName, - REF(const char**) /*OUT*/ pTag, - REF(BOOL) /*OUT*/ bCanHandleAsync) PURE; - -}; - -/**************************************************************************** - * - * Interface: - * - * IRMAXMLTagObject - * - * IID_IRMAXMLTagObject: - * - * {00002C01-0901-11d1-8B06-00A024406D59} - * - */ -DEFINE_GUID(IID_IRMAXMLTagObject, 0x00002C04, 0x901, 0x11d1, 0x8b, 0x6, 0x0, - 0xa0, 0x24, 0x40, 0x6d, 0x59); - -#undef INTERFACE -#define INTERFACE IRMAXMLTagObject - -DECLARE_INTERFACE_(IRMAXMLTagObject, IUnknown) -{ - /* - * IUnknown methods - */ - STDMETHOD(QueryInterface) (THIS_ - REFIID riid, - void** ppvObj) PURE; - - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - - STDMETHOD_(ULONG,Release) (THIS) PURE; - - /************************************************************************ - * IRMAXMLTagObject - */ - STDMETHOD(InitTagObject) (IRMAXMLTagObjectResponse* pResp) PURE; - STDMETHOD(OnTag) (THIS_ UINT32 ulInstance, IRMABuffer* pTag) PURE; - STDMETHOD(Close) (THIS) PURE; - -}; - - - -#endif diff --git a/lib/detours/detours.lib b/lib/detours/detours.lib deleted file mode 100644 index 56c6a8df6..000000000 Binary files a/lib/detours/detours.lib and /dev/null differ diff --git a/lib/detours/detours.pdb b/lib/detours/detours.pdb deleted file mode 100644 index 80bc1cb4c..000000000 Binary files a/lib/detours/detours.pdb and /dev/null differ diff --git a/lib/qt6/qtmlClient.lib b/lib/qt6/qtmlClient.lib deleted file mode 100644 index a2b4de075..000000000 Binary files a/lib/qt6/qtmlClient.lib and /dev/null differ diff --git a/lib/wm7/wmstub.lib b/lib/wm7/wmstub.lib deleted file mode 100644 index a542f8ee6..000000000 Binary files a/lib/wm7/wmstub.lib and /dev/null differ diff --git a/mpc_vs2005.sln b/mpc_vs2005.sln deleted file mode 100644 index b56eabe1f..000000000 --- a/mpc_vs2005.sln +++ /dev/null @@ -1,849 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asyncreader", "src\filters\reader\asyncreader\asyncreader_vs2005.vcproj", "{9F31D122-E84D-485A-A58D-09DAD01A56CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cddareader", "src\filters\reader\cddareader\cddareader_vs2005.vcproj", "{543D40E9-8CA6-4E4B-9936-90CBA562B268}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdxareader", "src\filters\reader\cdxareader\cdxareader_vs2005.vcproj", "{4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d2vsource", "src\filters\source\d2vsource\d2vsource_vs2005.vcproj", "{83CC6B88-A112-4192-BD5A-F2A249AF2277}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flicsource", "src\filters\source\flicsource\flicsource_vs2005.vcproj", "{431DD5B6-3F2F-47EE-A23F-514BC044B704}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audioswitcher", "src\filters\switcher\audioswitcher\audioswitcher_vs2005.vcproj", "{D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avi2ac3filter", "src\filters\transform\avi2ac3filter\avi2ac3filter_vs2005.vcproj", "{339A4575-E25B-45D6-94A1-D835891740B8}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bufferfilter", "src\filters\transform\bufferfilter\bufferfilter_vs2005.vcproj", "{9DCFD02A-16A0-4766-BC18-66163E21929D}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decssfilter", "src\filters\transform\decssfilter\decssfilter_vs2005.vcproj", "{F6B06383-3FFD-403B-9867-4AA82A20AA83}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesource", "src\filters\source\basesource\basesource_vs2005.vcproj", "{F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wavdest", "src\filters\muxer\wavdest\wavdest_vs2005.vcproj", "{EB202B68-8029-4985-B914-E94B44D2E230}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtsreader", "src\filters\reader\vtsreader\vtsreader_vs2005.vcproj", "{664E726B-EEEE-403A-AC15-345D9C9E1375}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "streamdrivethru", "src\filters\parser\streamdrivethru\streamdrivethru_vs2005.vcproj", "{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtsac3source", "src\filters\source\dtsac3source\dtsac3source_vs2005.vcproj", "{30D48874-899F-41C6-9B26-A40C96C91102}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shoutcastsource", "src\filters\source\shoutcastsource\shoutcastsource_vs2005.vcproj", "{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaSplitter", "src\filters\parser\matroskasplitter\MatroskaSplitter_vs2005.vcproj", "{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}" - ProjectSection(ProjectDependencies) = postProject - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaMuxer", "src\filters\muxer\matroskamuxer\MatroskaMuxer_vs2005.vcproj", "{67827491-8162-4039-9132-F934ABC836A0}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealMediaSplitter", "src\filters\parser\realmediasplitter\RealMediaSplitter_vs2005.vcproj", "{53CF9195-19DB-457D-8F55-8DB1706DFA84}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "src\filters\parser\basesplitter\basesplitter_vs2005.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AviSplitter", "src\filters\parser\avisplitter\AviSplitter_vs2005.vcproj", "{9738B023-FC46-48A2-953A-0035FD897678}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mpeg2DecFilter", "src\filters\transform\mpeg2decfilter\Mpeg2DecFilter_vs2005.vcproj", "{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaDecFilter", "src\filters\transform\mpadecfilter\MpaDecFilter_vs2005.vcproj", "{4421516D-10A6-41C1-ADF3-099573BBB0C6}" - ProjectSection(ProjectDependencies) = postProject - {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13} - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} = {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmad", "src\filters\transform\mpadecfilter\libmad-0.15.0b\msvc++\libmad_vs2005.vcproj", "{D8365C15-2166-4DB6-8A2D-1C8F0239EB18}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RoQSplitter", "src\filters\parser\roqsplitter\RoQSplitter_vs2005.vcproj", "{23E1898F-8262-435C-8848-D4D8824E6D71}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib\zlib_vs2005.vcproj", "{2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OggSplitter", "src\filters\parser\oggsplitter\OggSplitter_vs2005.vcproj", "{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liba52", "src\filters\transform\mpadecfilter\a52dec-0.7.4\vc++\liba52_vs2005.vcproj", "{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NutSplitter", "src\filters\parser\nutsplitter\NutSplitter_vs2005.vcproj", "{E776D3C2-5BFA-41B9-B998-A35B549AF737}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdts", "src\filters\transform\mpadecfilter\dtsdec-0.0.1\vc++\libdts_vs2005.vcproj", "{54F609FD-A8CE-43CF-94AD-23E877B97C13}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpegSplitter", "src\filters\parser\mpegsplitter\MpegSplitter_vs2005.vcproj", "{4628C665-EDE4-40D2-B525-32BE8B8551C8}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "src\filters\transform\mpadecfilter\faad2\libfaad\libfaad_vs2005.vcproj", "{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiracSplitter", "src\filters\parser\diracsplitter\DiracSplitter_vs2005.vcproj", "{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {12BE3440-A1F3-4C48-A229-30CB619EA276} = {12BE3440-A1F3-4C48-A229-30CB619EA276} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdirac", "src\filters\parser\diracsplitter\libdirac\libdirac_vs2005.vcproj", "{12BE3440-A1F3-4C48-A229-30CB619EA276}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaSplitter", "src\filters\parser\mpasplitter\MpaSplitter_vs2005.vcproj", "{C0F7A036-FC2D-40DF-9852-C37518DB6B3E}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basevideofilter", "src\filters\transform\basevideofilter\basevideofilter_vs2005.vcproj", "{54DDA60F-E528-4D07-A152-960A1E818680}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMSplitter", "src\filters\parser\dsmsplitter\DSMSplitter_vs2005.vcproj", "{1E91F58C-0BAE-4021-8087-D1864D8EC066}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMuxer", "src\filters\muxer\basemuxer\BaseMuxer_vs2005.vcproj", "{DB5F93B2-54D0-4474-A588-D259BE36C832}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMMuxer", "src\filters\muxer\dsmmuxer\DSMMuxer_vs2005.vcproj", "{65361C7C-83D6-42E4-870C-4DC85AE641FE}" - ProjectSection(ProjectDependencies) = postProject - {DB5F93B2-54D0-4474-A588-D259BE36C832} = {DB5F93B2-54D0-4474-A588-D259BE36C832} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitlesource", "src\filters\source\subtitlesource\subtitlesource_vs2005.vcproj", "{8F998497-9C51-4FAA-83E4-1D85B22CBA13}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MP4Splitter", "src\filters\parser\mp4splitter\MP4Splitter_vs2005.vcproj", "{9ED4B036-7399-4128-868D-6E71188E0277}" - ProjectSection(ProjectDependencies) = postProject - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udpreader", "src\filters\reader\udpreader\udpreader_vs2005.vcproj", "{3020FF9B-8202-488D-B137-11DECC510E6E}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filters", "src\filters\filters_vs2005.vcproj", "{273B3149-3192-4B75-A791-470320B90812}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FLVSplitter", "src\filters\parser\flvsplitter\FLVSplitter_vs2005.vcproj", "{E62223EF-8263-41EB-8174-CD78BBEEF368}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbisidec", "src\filters\transform\mpadecfilter\libvorbisidec\libvorbisidec_vs2005.vcproj", "{A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SSFSplitter", "src\filters\parser\ssfsplitter\SSFSplitter_vs2005.vcproj", "{CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Filters", "Filters", "{F127F305-5EF5-4B69-B35F-8B30021B175D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Muxer", "Muxer", "{49B5BAE3-749C-414C-80CC-A756DD548CE3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Parser", "Parser", "{D626CC4F-BFB1-4030-8DD8-1A3A1D41248E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{69C0E434-3B73-400A-A1B7-A887C10BECCA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reader", "Reader", "{4909B0ED-CC22-4509-ACD0-FB60C4FC73ED}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Transform", "Transform", "{F9F42BF2-3F13-4654-82C5-E27B8879EC4E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{02DAA1A6-31C8-4002-89FE-50BF53752244}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Switcher", "Switcher", "{683639C3-F209-4EF8-B6CC-8741C61EDECF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{A21F07E6-A891-479C-98EA-EDB58CE4EFAB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{D9A0529B-9EC4-4D30-9E05-A5D533739D95}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{2913B7E4-7A8B-43D5-A60B-345A0782816A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUI", "src\ui\CmdUI\CmdUI_vs2005.vcproj", "{03208025-D5C2-426A-B0FA-251D4338F30C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "src\ui\ResizableLib\ResizableLib_vs2005.vcproj", "{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sizecbar", "src\ui\sizecbar\sizecbar_vs2005.vcproj", "{61E6EB4D-2F1A-443B-94B0-E8200B26E99F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreePropSheet", "src\ui\TreePropSheet\TreePropSheet_vs2005.vcproj", "{AB494732-EF6D-44D0-BCF8-80FF04858D10}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "src\libpng\libpng_vs2005.vcproj", "{FC8080D1-603C-45EC-BCFA-7172E2F3D989}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libssf", "src\subtitles\libssf\libssf_vs2005.vcproj", "{DD9D2D92-2241-408A-859E-B85D444B7E3C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "src\subtitles\subtitles_vs2005.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "src\decss\decss_vs2005.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "src\dsutil\dsutil_vs2005.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mplayerc", "src\apps\mplayerc\mplayerc_vs2005.vcproj", "{8CE7E5D0-C821-47AC-A247-28EC95B34670}" - ProjectSection(ProjectDependencies) = postProject - {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13} - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} = {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} - {E62223EF-8263-41EB-8174-CD78BBEEF368} = {E62223EF-8263-41EB-8174-CD78BBEEF368} - {543D40E9-8CA6-4E4B-9936-90CBA562B268} = {543D40E9-8CA6-4E4B-9936-90CBA562B268} - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E} = {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E} - {FC8080D1-603C-45EC-BCFA-7172E2F3D989} = {FC8080D1-603C-45EC-BCFA-7172E2F3D989} - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} - {E776D3C2-5BFA-41B9-B998-A35B549AF737} = {E776D3C2-5BFA-41B9-B998-A35B549AF737} - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} = {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA} = {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA} - {431DD5B6-3F2F-47EE-A23F-514BC044B704} = {431DD5B6-3F2F-47EE-A23F-514BC044B704} - {DB5F93B2-54D0-4474-A588-D259BE36C832} = {DB5F93B2-54D0-4474-A588-D259BE36C832} - {3020FF9B-8202-488D-B137-11DECC510E6E} = {3020FF9B-8202-488D-B137-11DECC510E6E} - {8F998497-9C51-4FAA-83E4-1D85B22CBA13} = {8F998497-9C51-4FAA-83E4-1D85B22CBA13} - {53CF9195-19DB-457D-8F55-8DB1706DFA84} = {53CF9195-19DB-457D-8F55-8DB1706DFA84} - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} - {DD9D2D92-2241-408A-859E-B85D444B7E3C} = {DD9D2D92-2241-408A-859E-B85D444B7E3C} - {67827491-8162-4039-9132-F934ABC836A0} = {67827491-8162-4039-9132-F934ABC836A0} - {23E1898F-8262-435C-8848-D4D8824E6D71} = {23E1898F-8262-435C-8848-D4D8824E6D71} - {1E91F58C-0BAE-4021-8087-D1864D8EC066} = {1E91F58C-0BAE-4021-8087-D1864D8EC066} - {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42} - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} - {F6B06383-3FFD-403B-9867-4AA82A20AA83} = {F6B06383-3FFD-403B-9867-4AA82A20AA83} - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0} = {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0} - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466} = {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466} - {65361C7C-83D6-42E4-870C-4DC85AE641FE} = {65361C7C-83D6-42E4-870C-4DC85AE641FE} - {339A4575-E25B-45D6-94A1-D835891740B8} = {339A4575-E25B-45D6-94A1-D835891740B8} - {30D48874-899F-41C6-9B26-A40C96C91102} = {30D48874-899F-41C6-9B26-A40C96C91102} - {4421516D-10A6-41C1-ADF3-099573BBB0C6} = {4421516D-10A6-41C1-ADF3-099573BBB0C6} - {664E726B-EEEE-403A-AC15-345D9C9E1375} = {664E726B-EEEE-403A-AC15-345D9C9E1375} - {EB202B68-8029-4985-B914-E94B44D2E230} = {EB202B68-8029-4985-B914-E94B44D2E230} - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} - {4628C665-EDE4-40D2-B525-32BE8B8551C8} = {4628C665-EDE4-40D2-B525-32BE8B8551C8} - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} = {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} = {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} - {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {12BE3440-A1F3-4C48-A229-30CB619EA276} = {12BE3440-A1F3-4C48-A229-30CB619EA276} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {9ED4B036-7399-4128-868D-6E71188E0277} = {9ED4B036-7399-4128-868D-6E71188E0277} - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} = {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} - {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {AB494732-EF6D-44D0-BCF8-80FF04858D10} - {9DCFD02A-16A0-4766-BC18-66163E21929D} = {9DCFD02A-16A0-4766-BC18-66163E21929D} - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} = {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} - {03208025-D5C2-426A-B0FA-251D4338F30C} = {03208025-D5C2-426A-B0FA-251D4338F30C} - {9738B023-FC46-48A2-953A-0035FD897678} = {9738B023-FC46-48A2-953A-0035FD897678} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575} - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC} = {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC} - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475} = {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subpic", "src\subpic\subpic_vs2005.vcproj", "{D514EA4D-EAFB-47A9-A437-A582CA571251}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "src\filters\BaseClasses\baseclasses_vs2005.vcproj", "{E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug Unicode|Win32 = Debug Unicode|Win32 - Debug Unicode|x64 = Debug Unicode|x64 - Release Unicode|Win32 = Release Unicode|Win32 - Release Unicode|x64 = Release Unicode|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|x64.Build.0 = Debug|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|Win32.Build.0 = Release|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|x64.ActiveCfg = Release|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|x64.Build.0 = Release|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|x64.Build.0 = Debug|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|Win32.Build.0 = Release|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|x64.ActiveCfg = Release|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|x64.Build.0 = Release|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|x64.Build.0 = Debug|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|Win32.Build.0 = Release|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|x64.ActiveCfg = Release|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|x64.Build.0 = Release|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|x64.Build.0 = Debug|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|Win32.Build.0 = Release|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|x64.ActiveCfg = Release|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|x64.Build.0 = Release|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|x64.Build.0 = Debug|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|Win32.Build.0 = Release|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|x64.ActiveCfg = Release|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|x64.Build.0 = Release|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|x64.Build.0 = Debug|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|Win32.Build.0 = Release|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|x64.ActiveCfg = Release|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|x64.Build.0 = Release|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|x64.Build.0 = Debug|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|Win32.Build.0 = Release|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|x64.ActiveCfg = Release|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|x64.Build.0 = Release|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|x64.Build.0 = Debug|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|Win32.Build.0 = Release|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|x64.ActiveCfg = Release|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|x64.Build.0 = Release|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {02DAA1A6-31C8-4002-89FE-50BF53752244} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {683639C3-F209-4EF8-B6CC-8741C61EDECF} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {49B5BAE3-749C-414C-80CC-A756DD548CE3} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {69C0E434-3B73-400A-A1B7-A887C10BECCA} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {664E726B-EEEE-403A-AC15-345D9C9E1375} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {3020FF9B-8202-488D-B137-11DECC510E6E} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {543D40E9-8CA6-4E4B-9936-90CBA562B268} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {431DD5B6-3F2F-47EE-A23F-514BC044B704} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {30D48874-899F-41C6-9B26-A40C96C91102} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {8F998497-9C51-4FAA-83E4-1D85B22CBA13} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {83CC6B88-A112-4192-BD5A-F2A249AF2277} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466} = {683639C3-F209-4EF8-B6CC-8741C61EDECF} - {9DCFD02A-16A0-4766-BC18-66163E21929D} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {F6B06383-3FFD-403B-9867-4AA82A20AA83} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {4421516D-10A6-41C1-ADF3-099573BBB0C6} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {54DDA60F-E528-4D07-A152-960A1E818680} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {339A4575-E25B-45D6-94A1-D835891740B8} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {67827491-8162-4039-9132-F934ABC836A0} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {DB5F93B2-54D0-4474-A588-D259BE36C832} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {65361C7C-83D6-42E4-870C-4DC85AE641FE} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {EB202B68-8029-4985-B914-E94B44D2E230} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {53CF9195-19DB-457D-8F55-8DB1706DFA84} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {9738B023-FC46-48A2-953A-0035FD897678} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {23E1898F-8262-435C-8848-D4D8824E6D71} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {E776D3C2-5BFA-41B9-B998-A35B549AF737} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {4628C665-EDE4-40D2-B525-32BE8B8551C8} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {1E91F58C-0BAE-4021-8087-D1864D8EC066} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {9ED4B036-7399-4128-868D-6E71188E0277} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {E62223EF-8263-41EB-8174-CD78BBEEF368} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {12BE3440-A1F3-4C48-A229-30CB619EA276} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {273B3149-3192-4B75-A791-470320B90812} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {D9A0529B-9EC4-4D30-9E05-A5D533739D95} = {A21F07E6-A891-479C-98EA-EDB58CE4EFAB} - {2913B7E4-7A8B-43D5-A60B-345A0782816A} = {A21F07E6-A891-479C-98EA-EDB58CE4EFAB} - {8CE7E5D0-C821-47AC-A247-28EC95B34670} = {A21F07E6-A891-479C-98EA-EDB58CE4EFAB} - {FC8080D1-603C-45EC-BCFA-7172E2F3D989} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {DD9D2D92-2241-408A-859E-B85D444B7E3C} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {FC70988B-1AE5-4381-866D-4F405E28AC42} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {03208025-D5C2-426A-B0FA-251D4338F30C} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - EndGlobalSection -EndGlobal diff --git a/mpc_vs2008.sln b/mpc_vs2008.sln deleted file mode 100644 index cd28649fe..000000000 --- a/mpc_vs2008.sln +++ /dev/null @@ -1,849 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{A21F07E6-A891-479C-98EA-EDB58CE4EFAB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mplayerc", "src\apps\mplayerc\mplayerc_vs2008.vcproj", "{8CE7E5D0-C821-47AC-A247-28EC95B34670}" - ProjectSection(ProjectDependencies) = postProject - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475} = {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475} - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC} = {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC} - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} - {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - {9738B023-FC46-48A2-953A-0035FD897678} = {9738B023-FC46-48A2-953A-0035FD897678} - {03208025-D5C2-426A-B0FA-251D4338F30C} = {03208025-D5C2-426A-B0FA-251D4338F30C} - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} = {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} - {9DCFD02A-16A0-4766-BC18-66163E21929D} = {9DCFD02A-16A0-4766-BC18-66163E21929D} - {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {AB494732-EF6D-44D0-BCF8-80FF04858D10} - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} = {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} - {9ED4B036-7399-4128-868D-6E71188E0277} = {9ED4B036-7399-4128-868D-6E71188E0277} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {12BE3440-A1F3-4C48-A229-30CB619EA276} = {12BE3440-A1F3-4C48-A229-30CB619EA276} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251} - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} = {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} = {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} - {4628C665-EDE4-40D2-B525-32BE8B8551C8} = {4628C665-EDE4-40D2-B525-32BE8B8551C8} - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} - {EB202B68-8029-4985-B914-E94B44D2E230} = {EB202B68-8029-4985-B914-E94B44D2E230} - {664E726B-EEEE-403A-AC15-345D9C9E1375} = {664E726B-EEEE-403A-AC15-345D9C9E1375} - {4421516D-10A6-41C1-ADF3-099573BBB0C6} = {4421516D-10A6-41C1-ADF3-099573BBB0C6} - {30D48874-899F-41C6-9B26-A40C96C91102} = {30D48874-899F-41C6-9B26-A40C96C91102} - {339A4575-E25B-45D6-94A1-D835891740B8} = {339A4575-E25B-45D6-94A1-D835891740B8} - {65361C7C-83D6-42E4-870C-4DC85AE641FE} = {65361C7C-83D6-42E4-870C-4DC85AE641FE} - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466} = {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466} - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0} = {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0} - {F6B06383-3FFD-403B-9867-4AA82A20AA83} = {F6B06383-3FFD-403B-9867-4AA82A20AA83} - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} - {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42} - {1E91F58C-0BAE-4021-8087-D1864D8EC066} = {1E91F58C-0BAE-4021-8087-D1864D8EC066} - {23E1898F-8262-435C-8848-D4D8824E6D71} = {23E1898F-8262-435C-8848-D4D8824E6D71} - {67827491-8162-4039-9132-F934ABC836A0} = {67827491-8162-4039-9132-F934ABC836A0} - {DD9D2D92-2241-408A-859E-B85D444B7E3C} = {DD9D2D92-2241-408A-859E-B85D444B7E3C} - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} - {53CF9195-19DB-457D-8F55-8DB1706DFA84} = {53CF9195-19DB-457D-8F55-8DB1706DFA84} - {8F998497-9C51-4FAA-83E4-1D85B22CBA13} = {8F998497-9C51-4FAA-83E4-1D85B22CBA13} - {DB5F93B2-54D0-4474-A588-D259BE36C832} = {DB5F93B2-54D0-4474-A588-D259BE36C832} - {431DD5B6-3F2F-47EE-A23F-514BC044B704} = {431DD5B6-3F2F-47EE-A23F-514BC044B704} - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA} = {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA} - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} = {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} - {E776D3C2-5BFA-41B9-B998-A35B549AF737} = {E776D3C2-5BFA-41B9-B998-A35B549AF737} - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} - {FC8080D1-603C-45EC-BCFA-7172E2F3D989} = {FC8080D1-603C-45EC-BCFA-7172E2F3D989} - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E} = {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E} - {543D40E9-8CA6-4E4B-9936-90CBA562B268} = {543D40E9-8CA6-4E4B-9936-90CBA562B268} - {E62223EF-8263-41EB-8174-CD78BBEEF368} = {E62223EF-8263-41EB-8174-CD78BBEEF368} - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} = {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA} = {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA} - {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{D9A0529B-9EC4-4D30-9E05-A5D533739D95}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "src\decss\decss_vs2008.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "src\dsutil\dsutil_vs2008.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "src\libpng\libpng_vs2008.vcproj", "{FC8080D1-603C-45EC-BCFA-7172E2F3D989}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libssf", "src\subtitles\libssf\libssf_vs2008.vcproj", "{DD9D2D92-2241-408A-859E-B85D444B7E3C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subpic", "src\subpic\subpic_vs2008.vcproj", "{D514EA4D-EAFB-47A9-A437-A582CA571251}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "src\subtitles\subtitles_vs2008.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{2913B7E4-7A8B-43D5-A60B-345A0782816A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUI", "src\ui\CmdUI\CmdUI_vs2008.vcproj", "{03208025-D5C2-426A-B0FA-251D4338F30C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "src\ui\ResizableLib\ResizableLib_vs2008.vcproj", "{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sizecbar", "src\ui\sizecbar\sizecbar_vs2008.vcproj", "{61E6EB4D-2F1A-443B-94B0-E8200B26E99F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreePropSheet", "src\ui\TreePropSheet\TreePropSheet_vs2008.vcproj", "{AB494732-EF6D-44D0-BCF8-80FF04858D10}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Filters", "Filters", "{F127F305-5EF5-4B69-B35F-8B30021B175D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{69C0E434-3B73-400A-A1B7-A887C10BECCA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "src\filters\BaseClasses\baseclasses_vs2008.vcproj", "{E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filters", "src\filters\filters_vs2008.vcproj", "{273B3149-3192-4B75-A791-470320B90812}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liba52", "src\filters\transform\mpadecfilter\a52dec-0.7.4\vc++\liba52_vs2008.vcproj", "{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdirac", "src\filters\parser\diracsplitter\libdirac\libdirac_vs2008.vcproj", "{12BE3440-A1F3-4C48-A229-30CB619EA276}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdts", "src\filters\transform\mpadecfilter\dtsdec-0.0.1\vc++\libdts_vs2008.vcproj", "{54F609FD-A8CE-43CF-94AD-23E877B97C13}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "src\filters\transform\mpadecfilter\faad2\libfaad\libfaad_vs2008.vcproj", "{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmad", "src\filters\transform\mpadecfilter\libmad-0.15.0b\msvc++\libmad_vs2008.vcproj", "{D8365C15-2166-4DB6-8A2D-1C8F0239EB18}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbisidec", "src\filters\transform\mpadecfilter\libvorbisidec\libvorbisidec_vs2008.vcproj", "{A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib\zlib_vs2008.vcproj", "{2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Muxer", "Muxer", "{49B5BAE3-749C-414C-80CC-A756DD548CE3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMuxer", "src\filters\muxer\basemuxer\BaseMuxer_vs2008.vcproj", "{DB5F93B2-54D0-4474-A588-D259BE36C832}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMMuxer", "src\filters\muxer\dsmmuxer\DSMMuxer_vs2008.vcproj", "{65361C7C-83D6-42E4-870C-4DC85AE641FE}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {DB5F93B2-54D0-4474-A588-D259BE36C832} = {DB5F93B2-54D0-4474-A588-D259BE36C832} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaMuxer", "src\filters\muxer\matroskamuxer\MatroskaMuxer_vs2008.vcproj", "{67827491-8162-4039-9132-F934ABC836A0}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wavdest", "src\filters\muxer\wavdest\wavdest_vs2008.vcproj", "{EB202B68-8029-4985-B914-E94B44D2E230}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Parser", "Parser", "{D626CC4F-BFB1-4030-8DD8-1A3A1D41248E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AviSplitter", "src\filters\parser\avisplitter\AviSplitter_vs2008.vcproj", "{9738B023-FC46-48A2-953A-0035FD897678}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "src\filters\parser\basesplitter\basesplitter_vs2008.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiracSplitter", "src\filters\parser\diracsplitter\DiracSplitter_vs2008.vcproj", "{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {12BE3440-A1F3-4C48-A229-30CB619EA276} = {12BE3440-A1F3-4C48-A229-30CB619EA276} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMSplitter", "src\filters\parser\dsmsplitter\DSMSplitter_vs2008.vcproj", "{1E91F58C-0BAE-4021-8087-D1864D8EC066}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FLVSplitter", "src\filters\parser\flvsplitter\FLVSplitter_vs2008.vcproj", "{E62223EF-8263-41EB-8174-CD78BBEEF368}" - ProjectSection(ProjectDependencies) = postProject - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaSplitter", "src\filters\parser\matroskasplitter\MatroskaSplitter_vs2008.vcproj", "{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MP4Splitter", "src\filters\parser\mp4splitter\MP4Splitter_vs2008.vcproj", "{9ED4B036-7399-4128-868D-6E71188E0277}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaSplitter", "src\filters\parser\mpasplitter\MpaSplitter_vs2008.vcproj", "{C0F7A036-FC2D-40DF-9852-C37518DB6B3E}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpegSplitter", "src\filters\parser\mpegsplitter\MpegSplitter_vs2008.vcproj", "{4628C665-EDE4-40D2-B525-32BE8B8551C8}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NutSplitter", "src\filters\parser\nutsplitter\NutSplitter_vs2008.vcproj", "{E776D3C2-5BFA-41B9-B998-A35B549AF737}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OggSplitter", "src\filters\parser\oggsplitter\OggSplitter_vs2008.vcproj", "{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealMediaSplitter", "src\filters\parser\realmediasplitter\RealMediaSplitter_vs2008.vcproj", "{53CF9195-19DB-457D-8F55-8DB1706DFA84}" - ProjectSection(ProjectDependencies) = postProject - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RoQSplitter", "src\filters\parser\roqsplitter\RoQSplitter_vs2008.vcproj", "{23E1898F-8262-435C-8848-D4D8824E6D71}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SSFSplitter", "src\filters\parser\ssfsplitter\SSFSplitter_vs2008.vcproj", "{CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}" - ProjectSection(ProjectDependencies) = postProject - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "streamdrivethru", "src\filters\parser\streamdrivethru\streamdrivethru_vs2008.vcproj", "{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reader", "Reader", "{4909B0ED-CC22-4509-ACD0-FB60C4FC73ED}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asyncreader", "src\filters\reader\asyncreader\asyncreader_vs2008.vcproj", "{9F31D122-E84D-485A-A58D-09DAD01A56CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cddareader", "src\filters\reader\cddareader\cddareader_vs2008.vcproj", "{543D40E9-8CA6-4E4B-9936-90CBA562B268}" - ProjectSection(ProjectDependencies) = postProject - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdxareader", "src\filters\reader\cdxareader\cdxareader_vs2008.vcproj", "{4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}" - ProjectSection(ProjectDependencies) = postProject - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udpreader", "src\filters\reader\udpreader\udpreader_vs2008.vcproj", "{3020FF9B-8202-488D-B137-11DECC510E6E}" - ProjectSection(ProjectDependencies) = postProject - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtsreader", "src\filters\reader\vtsreader\vtsreader_vs2008.vcproj", "{664E726B-EEEE-403A-AC15-345D9C9E1375}" - ProjectSection(ProjectDependencies) = postProject - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{02DAA1A6-31C8-4002-89FE-50BF53752244}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesource", "src\filters\source\basesource\basesource_vs2008.vcproj", "{F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d2vsource", "src\filters\source\d2vsource\d2vsource_vs2008.vcproj", "{83CC6B88-A112-4192-BD5A-F2A249AF2277}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtsac3source", "src\filters\source\dtsac3source\dtsac3source_vs2008.vcproj", "{30D48874-899F-41C6-9B26-A40C96C91102}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flicsource", "src\filters\source\flicsource\flicsource_vs2008.vcproj", "{431DD5B6-3F2F-47EE-A23F-514BC044B704}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shoutcastsource", "src\filters\source\shoutcastsource\shoutcastsource_vs2008.vcproj", "{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitlesource", "src\filters\source\subtitlesource\subtitlesource_vs2008.vcproj", "{8F998497-9C51-4FAA-83E4-1D85B22CBA13}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Switcher", "Switcher", "{683639C3-F209-4EF8-B6CC-8741C61EDECF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audioswitcher", "src\filters\switcher\audioswitcher\audioswitcher_vs2008.vcproj", "{D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Transform", "Transform", "{F9F42BF2-3F13-4654-82C5-E27B8879EC4E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avi2ac3filter", "src\filters\transform\avi2ac3filter\avi2ac3filter_vs2008.vcproj", "{339A4575-E25B-45D6-94A1-D835891740B8}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basevideofilter", "src\filters\transform\basevideofilter\basevideofilter_vs2008.vcproj", "{54DDA60F-E528-4D07-A152-960A1E818680}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bufferfilter", "src\filters\transform\bufferfilter\bufferfilter_vs2008.vcproj", "{9DCFD02A-16A0-4766-BC18-66163E21929D}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decssfilter", "src\filters\transform\decssfilter\decssfilter_vs2008.vcproj", "{F6B06383-3FFD-403B-9867-4AA82A20AA83}" - ProjectSection(ProjectDependencies) = postProject - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaDecFilter", "src\filters\transform\mpadecfilter\MpaDecFilter_vs2008.vcproj", "{4421516D-10A6-41C1-ADF3-099573BBB0C6}" - ProjectSection(ProjectDependencies) = postProject - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} = {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} - {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mpeg2DecFilter", "src\filters\transform\mpeg2decfilter\Mpeg2DecFilter_vs2008.vcproj", "{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}" - ProjectSection(ProjectDependencies) = postProject - {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680} - {273B3149-3192-4B75-A791-470320B90812} = {273B3149-3192-4B75-A791-470320B90812} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug Unicode|Win32 = Debug Unicode|Win32 - Debug Unicode|x64 = Debug Unicode|x64 - Release Unicode|Win32 = Release Unicode|Win32 - Release Unicode|x64 = Release Unicode|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Debug Unicode|x64.Build.0 = Debug|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|Win32.Build.0 = Release|Win32 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|x64.ActiveCfg = Release|x64 - {FC8080D1-603C-45EC-BCFA-7172E2F3D989}.Release Unicode|x64.Build.0 = Release|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {273B3149-3192-4B75-A791-470320B90812}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode|x64.Build.0 = Debug|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|Win32.Build.0 = Release|Win32 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|x64.ActiveCfg = Release|x64 - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode|x64.Build.0 = Release|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode|x64.Build.0 = Debug|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|Win32.Build.0 = Release|Win32 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|x64.ActiveCfg = Release|x64 - {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode|x64.Build.0 = Release|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode|x64.Build.0 = Debug|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|Win32.Build.0 = Release|Win32 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|x64.ActiveCfg = Release|x64 - {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode|x64.Build.0 = Release|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode|x64.Build.0 = Debug|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|Win32.Build.0 = Release|Win32 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|x64.ActiveCfg = Release|x64 - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode|x64.Build.0 = Release|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode|x64.Build.0 = Debug|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|Win32.Build.0 = Release|Win32 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|x64.ActiveCfg = Release|x64 - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode|x64.Build.0 = Release|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Debug Unicode|x64.Build.0 = Debug|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|Win32.Build.0 = Release|Win32 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|x64.ActiveCfg = Release|x64 - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}.Release Unicode|x64.Build.0 = Release|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|x64.ActiveCfg = Debug|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode|x64.Build.0 = Debug|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|Win32.Build.0 = Release|Win32 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|x64.ActiveCfg = Release|x64 - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode|x64.Build.0 = Release|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {E62223EF-8263-41EB-8174-CD78BBEEF368}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 - {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode|x64.Build.0 = Release Unicode|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode|x64.Build.0 = Release Unicode lib|x64 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|x64.ActiveCfg = Debug Unicode lib|x64 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode|x64.Build.0 = Debug Unicode lib|x64 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32 - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode|x64.ActiveCfg = Release Unicode lib|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {8CE7E5D0-C821-47AC-A247-28EC95B34670} = {A21F07E6-A891-479C-98EA-EDB58CE4EFAB} - {D9A0529B-9EC4-4D30-9E05-A5D533739D95} = {A21F07E6-A891-479C-98EA-EDB58CE4EFAB} - {2913B7E4-7A8B-43D5-A60B-345A0782816A} = {A21F07E6-A891-479C-98EA-EDB58CE4EFAB} - {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {FC70988B-1AE5-4381-866D-4F405E28AC42} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {FC8080D1-603C-45EC-BCFA-7172E2F3D989} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {DD9D2D92-2241-408A-859E-B85D444B7E3C} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95} - {03208025-D5C2-426A-B0FA-251D4338F30C} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} - {69C0E434-3B73-400A-A1B7-A887C10BECCA} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {49B5BAE3-749C-414C-80CC-A756DD548CE3} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {02DAA1A6-31C8-4002-89FE-50BF53752244} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {683639C3-F209-4EF8-B6CC-8741C61EDECF} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} = {F127F305-5EF5-4B69-B35F-8B30021B175D} - {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {273B3149-3192-4B75-A791-470320B90812} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {12BE3440-A1F3-4C48-A229-30CB619EA276} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {69C0E434-3B73-400A-A1B7-A887C10BECCA} - {DB5F93B2-54D0-4474-A588-D259BE36C832} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {65361C7C-83D6-42E4-870C-4DC85AE641FE} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {67827491-8162-4039-9132-F934ABC836A0} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {EB202B68-8029-4985-B914-E94B44D2E230} = {49B5BAE3-749C-414C-80CC-A756DD548CE3} - {9738B023-FC46-48A2-953A-0035FD897678} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {1E91F58C-0BAE-4021-8087-D1864D8EC066} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {E62223EF-8263-41EB-8174-CD78BBEEF368} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {9ED4B036-7399-4128-868D-6E71188E0277} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {4628C665-EDE4-40D2-B525-32BE8B8551C8} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {E776D3C2-5BFA-41B9-B998-A35B549AF737} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {53CF9195-19DB-457D-8F55-8DB1706DFA84} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {23E1898F-8262-435C-8848-D4D8824E6D71} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {CC07B80F-D44F-41A9-9E37-5F2B47B46EDC} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0} = {D626CC4F-BFB1-4030-8DD8-1A3A1D41248E} - {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {543D40E9-8CA6-4E4B-9936-90CBA562B268} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {3020FF9B-8202-488D-B137-11DECC510E6E} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {664E726B-EEEE-403A-AC15-345D9C9E1375} = {4909B0ED-CC22-4509-ACD0-FB60C4FC73ED} - {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {83CC6B88-A112-4192-BD5A-F2A249AF2277} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {30D48874-899F-41C6-9B26-A40C96C91102} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {431DD5B6-3F2F-47EE-A23F-514BC044B704} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {8F998497-9C51-4FAA-83E4-1D85B22CBA13} = {02DAA1A6-31C8-4002-89FE-50BF53752244} - {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466} = {683639C3-F209-4EF8-B6CC-8741C61EDECF} - {339A4575-E25B-45D6-94A1-D835891740B8} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {54DDA60F-E528-4D07-A152-960A1E818680} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {9DCFD02A-16A0-4766-BC18-66163E21929D} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {F6B06383-3FFD-403B-9867-4AA82A20AA83} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {4421516D-10A6-41C1-ADF3-099573BBB0C6} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - {305BAB2D-0D75-4FBC-8BCD-A2917392B48C} = {F9F42BF2-3F13-4654-82C5-E27B8879EC4E} - EndGlobalSection -EndGlobal diff --git a/src/apps/mplayerc/AuthDlg.cpp b/src/apps/mplayerc/AuthDlg.cpp deleted file mode 100644 index 204d67816..000000000 --- a/src/apps/mplayerc/AuthDlg.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - - -// AuthDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "AuthDlg.h" - -// CAuthDlg dialog - -IMPLEMENT_DYNAMIC(CAuthDlg, CDialog) -CAuthDlg::CAuthDlg(CWnd* pParent /*=NULL*/) - : CDialog(CAuthDlg::IDD, pParent) - , m_username(_T("")) - , m_password(_T("")) - , m_remember(FALSE) -{ -} - -CAuthDlg::~CAuthDlg() -{ -} - -void CAuthDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_COMBO1, m_usernamectrl); - DDX_Text(pDX, IDC_COMBO1, m_username); - DDX_Text(pDX, IDC_EDIT3, m_password); - DDX_Check(pDX, IDC_CHECK1, m_remember); -} - -CString CAuthDlg::DEncrypt(CString str) -{ - for(int i = 0; i < str.GetLength(); i++) - str.SetAt(i, str[i]^5); - return str; -} - - -BEGIN_MESSAGE_MAP(CAuthDlg, CDialog) - ON_BN_CLICKED(IDOK, OnBnClickedOk) - ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1) - ON_EN_SETFOCUS(IDC_EDIT3, OnEnSetfocusEdit3) -END_MESSAGE_MAP() - - -// CAuthDlg message handlers - -BOOL CAuthDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - CWinApp* pApp = AfxGetApp(); - - if(pApp->m_pszRegistryKey) - { - CRegKey hSecKey(pApp->GetSectionKey(ResStr(IDS_R_LOGINS))); - if(hSecKey) - { - int i = 0; - TCHAR username[256], password[256]; - while(1) - { - DWORD unlen = countof(username); - DWORD pwlen = sizeof(password); - DWORD type = REG_SZ; - if(ERROR_SUCCESS == RegEnumValue( - hSecKey, i++, username, &unlen, 0, &type, (BYTE*)password, &pwlen)) - { - m_logins[username] = DEncrypt(password); - m_usernamectrl.AddString(username); - } - else - { - break; - } - } - } - } - else - { - CAutoVectorPtr buff; - buff.Allocate(32767/sizeof(TCHAR)); - - DWORD len = GetPrivateProfileSection( - ResStr(IDS_R_LOGINS), buff, 32767/sizeof(TCHAR), pApp->m_pszProfileName); - - TCHAR* p = buff; - while(*p && len > 0) - { - CString str = p; - p += str.GetLength()+1; - len -= str.GetLength()+1; - CAtlList sl; - Explode(str, sl, '=', 2); - if(sl.GetCount() == 2) - { - m_logins[sl.GetHead()] = DEncrypt(sl.GetTail()); - m_usernamectrl.AddString(sl.GetHead()); - } - } - } - - m_usernamectrl.SetFocus(); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CAuthDlg::OnBnClickedOk() -{ - UpdateData(); - - if(!m_username.IsEmpty()) - { - CWinApp* pApp = AfxGetApp(); - pApp->WriteProfileString(ResStr(IDS_R_LOGINS), m_username, m_remember ? DEncrypt(m_password) : _T("")); - } - - OnOK(); -} - - -void CAuthDlg::OnCbnSelchangeCombo1() -{ - CString username; - m_usernamectrl.GetLBText(m_usernamectrl.GetCurSel(), username); - - CString password; - if(m_logins.Lookup(username, password)) - { - m_password = password; - m_remember = TRUE; - UpdateData(FALSE); - } -} - -void CAuthDlg::OnEnSetfocusEdit3() -{ - UpdateData(); - - CString password; - if(m_logins.Lookup(m_username, password)) - { - m_password = password; - m_remember = TRUE; - UpdateData(FALSE); - } -} diff --git a/src/apps/mplayerc/AuthDlg.h b/src/apps/mplayerc/AuthDlg.h deleted file mode 100644 index 86e9b496c..000000000 --- a/src/apps/mplayerc/AuthDlg.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once -#include "afxwin.h" - - -// CAuthDlg dialog - -class CAuthDlg : public CDialog -{ - DECLARE_DYNAMIC(CAuthDlg) - -private: - CString DEncrypt(CString pw); - CMapStringToString m_logins; - -public: - CAuthDlg(CWnd* pParent = NULL); // standard constructor - virtual ~CAuthDlg(); - -// Dialog Data - enum { IDD = IDD_AUTH_DLG }; - CComboBox m_usernamectrl; - CString m_username; - CString m_password; - BOOL m_remember; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - - DECLARE_MESSAGE_MAP() - -public: - afx_msg void OnBnClickedOk(); - afx_msg void OnCbnSelchangeCombo1(); - afx_msg void OnEnSetfocusEdit3(); -}; diff --git a/src/apps/mplayerc/BaseGraph.cpp b/src/apps/mplayerc/BaseGraph.cpp deleted file mode 100644 index 87a63200a..000000000 --- a/src/apps/mplayerc/BaseGraph.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "basegraph.h" -#include "..\..\DSUtil\DSUtil.h" - -// -// CPlayerWindow -// - -BOOL CPlayerWindow::PreCreateWindow(CREATESTRUCT& cs) -{ - if(!CWnd::PreCreateWindow(cs)) - return FALSE; - - cs.style &= ~WS_BORDER; - cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, - ::LoadCursor(NULL, IDC_HAND), NULL, NULL); - - return TRUE; -} - -BEGIN_MESSAGE_MAP(CPlayerWindow, CWnd) - ON_WM_ERASEBKGND() -END_MESSAGE_MAP() - -BOOL CPlayerWindow::OnEraseBkgnd(CDC* pDC) -{ - for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) - { - if(!pChild->IsWindowVisible()) continue; - - CRect r; - pChild->GetClientRect(&r); - pChild->MapWindowPoints(this, &r); - pDC->ExcludeClipRect(&r); - } - - CRect r; - GetClientRect(&r); - pDC->FillSolidRect(&r, 0); - - return TRUE; -} - -// -// CBaseGraph -// - -CBaseGraph::CBaseGraph() - : CUnknown(NAME("CBaseGraph"), NULL) - , m_hNotifyWnd(NULL) -{ -} - -CBaseGraph::~CBaseGraph() -{ -} - -STDMETHODIMP CBaseGraph::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI(IFilterGraph) - QI(IGraphBuilder) - QI(IFilterGraph2) - QI(IGraphBuilder2) - QI(IMediaControl) - QI(IMediaSeeking) - QI(IMediaEventEx) - QI(IVideoWindow) - QI(IBasicVideo) - QI(IBasicAudio) - QI(IAMOpenProgress) - QI(IGraphEngine) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -void CBaseGraph::ClearMessageQueue() -{ - while(!m_msgqueue.IsEmpty()) - { - GMSG msg = m_msgqueue.RemoveHead(); - FreeEventParams(msg.m_lEventCode, msg.m_lParam1, msg.m_lParam2); - } -} - - -void CBaseGraph::NotifyEvent(long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2) -{ - if(!m_hNotifyWnd) return; - - GMSG msg; - msg.m_lEventCode = lEventCode; - msg.m_lParam1 = lParam1; - msg.m_lParam2 = lParam2; - m_msgqueue.AddTail(msg); - - PostMessage((HWND)m_hNotifyWnd, m_lNotifyMsg, 0, m_lNotifyInstData); -} - -// IDispatch -STDMETHODIMP CBaseGraph::GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) {return E_NOTIMPL;} - -// IFilterGraph -STDMETHODIMP CBaseGraph::AddFilter(IBaseFilter* pFilter, LPCWSTR pName) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::RemoveFilter(IBaseFilter* pFilter) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::EnumFilters(IEnumFilters** ppEnum) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ConnectDirect(IPin* ppinOut, IPin* ppinIn, const AM_MEDIA_TYPE* pmt) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Reconnect(IPin* ppin) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Disconnect(IPin* ppin) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetDefaultSyncSource() {return E_NOTIMPL;} - -// IGraphBuilder -STDMETHODIMP CBaseGraph::Connect(IPin* ppinOut, IPin* ppinIn) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Render(IPin* ppinOut) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) {*ppFilter = NULL; return RenderFile(lpcwstrFileName, NULL);}//E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetLogFile(DWORD_PTR hFile) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Abort() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ShouldOperationContinue() {return E_NOTIMPL;} - -// IFilterGraph2 -STDMETHODIMP CBaseGraph::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext) {return E_NOTIMPL;} - -// IGraphBuilder2 -STDMETHODIMP CBaseGraph::IsPinDirection(IPin* pPin, PIN_DIRECTION dir) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::IsPinConnected(IPin* pPin) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ConnectFilter(IPin* pPinOut, IBaseFilter* pBF) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::NukeDownstream(IUnknown* pUnk) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::FindInterface(REFIID iid, void** ppv, BOOL bRemove) {return QueryInterface(iid, ppv);} -STDMETHODIMP CBaseGraph::AddToROT() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::RemoveFromROT() {return E_NOTIMPL;} - -// IMediaControl -STDMETHODIMP CBaseGraph::Run() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Pause() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::Stop() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetState(LONG msTimeout, OAFilterState* pfs) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::RenderFile(BSTR strFilename) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::AddSourceFilter(BSTR strFilename, IDispatch** ppUnk) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_FilterCollection(IDispatch** ppUnk) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_RegFilterCollection(IDispatch** ppUnk) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::StopWhenReady() {return Stop();} - -// IMediaEvent -STDMETHODIMP CBaseGraph::GetEventHandle(OAEVENT* hEvent) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout) -{ - if(m_msgqueue.IsEmpty()) return E_FAIL; - - GMSG msg = m_msgqueue.RemoveHead(); - if(lEventCode) *lEventCode = msg.m_lEventCode; - if(lParam1) *lParam1 = msg.m_lParam1; - if(lParam2) *lParam2 = msg.m_lParam2; - - return S_OK; -} -STDMETHODIMP CBaseGraph::WaitForCompletion(long msTimeout, long* pEvCode) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::CancelDefaultHandling(long lEvCode) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::RestoreDefaultHandling(long lEvCode) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2) -{ - if(EC_BG_ERROR == lEvCode) - { - if(lParam1) CoTaskMemFree((void*)lParam1); - } - - return S_OK; -} - -// IMediaEventEx -STDMETHODIMP CBaseGraph::SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInstanceData) -{ - m_hNotifyWnd = hwnd; - m_lNotifyMsg = lMsg; - m_lNotifyInstData = lInstanceData; - - if(!IsWindow((HWND)m_hNotifyWnd)) - { - m_hNotifyWnd = NULL; - return E_FAIL; - } - - return S_OK; -} -STDMETHODIMP CBaseGraph::SetNotifyFlags(long lNoNotifyFlags) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetNotifyFlags(long* lplNoNotifyFlags) {return E_NOTIMPL;} - -// IMediaSeeking -STDMETHODIMP CBaseGraph::GetCapabilities(DWORD* pCapabilities) -{ - return pCapabilities ? *pCapabilities = AM_SEEKING_CanSeekAbsolute|AM_SEEKING_CanGetCurrentPos|AM_SEEKING_CanGetDuration, S_OK : E_POINTER; -} -STDMETHODIMP CBaseGraph::CheckCapabilities(DWORD* pCapabilities) -{ - CheckPointer(pCapabilities, E_POINTER); - - if(*pCapabilities == 0) return S_OK; - - DWORD caps; - GetCapabilities(&caps); - - DWORD caps2 = caps & *pCapabilities; - - return caps2 == 0 ? E_FAIL : caps2 == *pCapabilities ? S_OK : S_FALSE; -} -STDMETHODIMP CBaseGraph::IsFormatSupported(const GUID* pFormat) -{ - return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; -} -STDMETHODIMP CBaseGraph::QueryPreferredFormat(GUID* pFormat) -{ - return GetTimeFormat(pFormat); -} -STDMETHODIMP CBaseGraph::GetTimeFormat(GUID* pFormat) -{ - return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER; -} -STDMETHODIMP CBaseGraph::IsUsingTimeFormat(const GUID* pFormat) -{ - return IsFormatSupported(pFormat); -} -STDMETHODIMP CBaseGraph::SetTimeFormat(const GUID* pFormat) -{ - return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG; -} -STDMETHODIMP CBaseGraph::GetDuration(LONGLONG* pDuration) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetCurrentPosition(LONGLONG* pCurrent) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetRate(double dRate) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetRate(double* pdRate) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;} - -// IVideoWindow -STDMETHODIMP CBaseGraph::put_Caption(BSTR strCaption) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Caption(BSTR* strCaption) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_WindowStyle(long WindowStyle) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_WindowStyle(long* WindowStyle) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_WindowStyleEx(long WindowStyleEx) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_WindowStyleEx(long* WindowStyleEx) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_AutoShow(long AutoShow) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_AutoShow(long* AutoShow) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_WindowState(long WindowState) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_WindowState(long* WindowState) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_BackgroundPalette(long BackgroundPalette) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_BackgroundPalette(long* pBackgroundPalette) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Visible(long Visible) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Visible(long* pVisible) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Left(long Left) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Left(long* pLeft) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Width(long Width) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Width(long* pWidth) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Top(long Top) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Top(long* pTop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Height(long Height) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Height(long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Owner(OAHWND Owner) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Owner(OAHWND* Owner) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_MessageDrain(OAHWND Drain) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_MessageDrain(OAHWND* Drain) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_BorderColor(long* Color) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_BorderColor(long Color) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_FullScreenMode(long* FullScreenMode) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_FullScreenMode(long FullScreenMode) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetWindowForeground(long Focus) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetWindowPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetMinIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetMaxIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::HideCursor(long HideCursor) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::IsCursorHidden(long* CursorHidden) {return E_NOTIMPL;} - -// IBasicVideo -STDMETHODIMP CBaseGraph::get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_BitRate(long* pBitRate) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_BitErrorRate(long* pBitErrorRate) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_VideoWidth(long* pVideoWidth) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_VideoHeight(long* pVideoHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_SourceLeft(long SourceLeft) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_SourceLeft(long* pSourceLeft) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_SourceWidth(long SourceWidth) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_SourceWidth(long* pSourceWidth) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_SourceTop(long SourceTop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_SourceTop(long* pSourceTop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_SourceHeight(long SourceHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_SourceHeight(long* pSourceHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_DestinationLeft(long DestinationLeft) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_DestinationLeft(long* pDestinationLeft) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_DestinationWidth(long DestinationWidth) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_DestinationWidth(long* pDestinationWidth) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_DestinationTop(long DestinationTop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_DestinationTop(long* pDestinationTop) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_DestinationHeight(long DestinationHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_DestinationHeight(long* pDestinationHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetSourcePosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetDefaultSourcePosition() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetDestinationPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::SetDefaultDestinationPosition() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetVideoSize(long* pWidth, long* pHeight) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::GetCurrentImage(long* pBufferSize, long* pDIBImage) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::IsUsingDefaultSource() {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::IsUsingDefaultDestination() {return E_NOTIMPL;} - -// IBasicAudio -STDMETHODIMP CBaseGraph::put_Volume(long lVolume) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Volume(long* plVolume) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::put_Balance(long lBalance) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::get_Balance(long* plBalance) {return E_NOTIMPL;} - -// IAMOpenProgress -STDMETHODIMP CBaseGraph::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent) {return E_NOTIMPL;} -STDMETHODIMP CBaseGraph::AbortOperation() {return E_NOTIMPL;} - -// IGraphEngine -STDMETHODIMP_(engine_t) CBaseGraph::GetEngine() {return DirectShow;} - diff --git a/src/apps/mplayerc/BaseGraph.h b/src/apps/mplayerc/BaseGraph.h deleted file mode 100644 index fd56597be..000000000 --- a/src/apps/mplayerc/BaseGraph.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "IGraphBuilder2.h" - -class CPlayerWindow : public CWnd -{ -public: - CPlayerWindow() {} - -protected: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - DECLARE_MESSAGE_MAP() -}; - -typedef enum {DirectShow = 0, RealMedia, QuickTime, ShockWave} engine_t; - -[uuid("B110CDE5-6331-4118-8AAF-A870D6F7E2E4")] -interface IGraphEngine : public IUnknown -{ - STDMETHOD_(engine_t, GetEngine) () = 0; -}; - -enum -{ - EC_BG_AUDIO_CHANGED = EC_USER+1, - EC_BG_ERROR -}; - -class CBaseGraph - : public CUnknown - , public IGraphBuilder2 - , public IMediaControl - , public IMediaEventEx - , public IMediaSeeking - , public IVideoWindow - , public IBasicVideo - , public IBasicAudio - , public IAMOpenProgress - , public IGraphEngine -{ - OAHWND m_hNotifyWnd; - long m_lNotifyMsg; - LONG_PTR m_lNotifyInstData; - - typedef struct {long m_lEventCode; LONG_PTR m_lParam1, m_lParam2;} GMSG; - CList m_msgqueue; - -protected: - void ClearMessageQueue(); - -public: - CBaseGraph(); - virtual ~CBaseGraph(); - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - void NotifyEvent(long lEventCode, LONG_PTR lParam1 = 0, LONG_PTR lParam2 = 0); - -protected: - // IDispatch - STDMETHODIMP GetTypeInfoCount(UINT* pctinfo); - STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo); - STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId); - STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr); - - // IFilterGraph - STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName); - STDMETHODIMP RemoveFilter(IBaseFilter* pFilter); - STDMETHODIMP EnumFilters(IEnumFilters** ppEnum); - STDMETHODIMP FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter); - STDMETHODIMP ConnectDirect(IPin* ppinOut, IPin* ppinIn, const AM_MEDIA_TYPE* pmt); - STDMETHODIMP Reconnect(IPin* ppin); - STDMETHODIMP Disconnect(IPin* ppin); - STDMETHODIMP SetDefaultSyncSource(); - - // IGraphBuilder - STDMETHODIMP Connect(IPin* ppinOut, IPin* ppinIn); - STDMETHODIMP Render(IPin* ppinOut); - STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList); - STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter); - STDMETHODIMP SetLogFile(DWORD_PTR hFile); - STDMETHODIMP Abort(); - STDMETHODIMP ShouldOperationContinue(); - - // IFilterGraph2 - STDMETHODIMP AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter); - STDMETHODIMP ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt); - STDMETHODIMP RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext); - - // IGraphBuilder2 - STDMETHODIMP IsPinDirection(IPin* pPin, PIN_DIRECTION dir); - STDMETHODIMP IsPinConnected(IPin* pPin); - STDMETHODIMP ConnectFilter(IBaseFilter* pBF, IPin* pPinIn); - STDMETHODIMP ConnectFilter(IPin* pPinOut, IBaseFilter* pBF); - STDMETHODIMP ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt); - STDMETHODIMP NukeDownstream(IUnknown* pUnk); - STDMETHODIMP FindInterface(REFIID iid, void** ppv, BOOL bRemove); - STDMETHODIMP AddToROT(); - STDMETHODIMP RemoveFromROT(); - - // IMediaControl - STDMETHODIMP Run(); - STDMETHODIMP Pause(); - STDMETHODIMP Stop(); - STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs); - STDMETHODIMP RenderFile(BSTR strFilename); - STDMETHODIMP AddSourceFilter(BSTR strFilename, IDispatch** ppUnk); - STDMETHODIMP get_FilterCollection(IDispatch** ppUnk); - STDMETHODIMP get_RegFilterCollection(IDispatch** ppUnk); - STDMETHODIMP StopWhenReady(); - - // IMediaEvent - STDMETHODIMP GetEventHandle(OAEVENT* hEvent); - STDMETHODIMP GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout); - STDMETHODIMP WaitForCompletion(long msTimeout, long* pEvCode); - STDMETHODIMP CancelDefaultHandling(long lEvCode); - STDMETHODIMP RestoreDefaultHandling(long lEvCode); - STDMETHODIMP FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2); - - // IMediaEventEx - STDMETHODIMP SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInstanceData); - STDMETHODIMP SetNotifyFlags(long lNoNotifyFlags); - STDMETHODIMP GetNotifyFlags(long* lplNoNotifyFlags); - - // IMediaSeeking - STDMETHODIMP GetCapabilities(DWORD* pCapabilities); - STDMETHODIMP CheckCapabilities(DWORD* pCapabilities); - STDMETHODIMP IsFormatSupported(const GUID* pFormat); - STDMETHODIMP QueryPreferredFormat(GUID* pFormat); - STDMETHODIMP GetTimeFormat(GUID* pFormat); - STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat); - STDMETHODIMP SetTimeFormat(const GUID* pFormat); - STDMETHODIMP GetDuration(LONGLONG* pDuration); - STDMETHODIMP GetStopPosition(LONGLONG* pStop); - STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent); - STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat); - STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags); - STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop); - STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest); - STDMETHODIMP SetRate(double dRate); - STDMETHODIMP GetRate(double* pdRate); - STDMETHODIMP GetPreroll(LONGLONG* pllPreroll); - - // IVideoWindow - STDMETHODIMP put_Caption(BSTR strCaption); - STDMETHODIMP get_Caption(BSTR* strCaption); - STDMETHODIMP put_WindowStyle(long WindowStyle); - STDMETHODIMP get_WindowStyle(long* WindowStyle); - STDMETHODIMP put_WindowStyleEx(long WindowStyleEx); - STDMETHODIMP get_WindowStyleEx(long* WindowStyleEx); - STDMETHODIMP put_AutoShow(long AutoShow); - STDMETHODIMP get_AutoShow(long* AutoShow); - STDMETHODIMP put_WindowState(long WindowState); - STDMETHODIMP get_WindowState(long* WindowState); - STDMETHODIMP put_BackgroundPalette(long BackgroundPalette); - STDMETHODIMP get_BackgroundPalette(long* pBackgroundPalette); - STDMETHODIMP put_Visible(long Visible); - STDMETHODIMP get_Visible(long* pVisible); - STDMETHODIMP put_Left(long Left); - STDMETHODIMP get_Left(long* pLeft); - STDMETHODIMP put_Width(long Width); - STDMETHODIMP get_Width(long* pWidth); - STDMETHODIMP put_Top(long Top); - STDMETHODIMP get_Top(long* pTop); - STDMETHODIMP put_Height(long Height); - STDMETHODIMP get_Height(long* pHeight); - STDMETHODIMP put_Owner(OAHWND Owner); - STDMETHODIMP get_Owner(OAHWND* Owner); - STDMETHODIMP put_MessageDrain(OAHWND Drain); - STDMETHODIMP get_MessageDrain(OAHWND* Drain); - STDMETHODIMP get_BorderColor(long* Color); - STDMETHODIMP put_BorderColor(long Color); - STDMETHODIMP get_FullScreenMode(long* FullScreenMode); - STDMETHODIMP put_FullScreenMode(long FullScreenMode); - STDMETHODIMP SetWindowForeground(long Focus); - STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam); - STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height); - STDMETHODIMP GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight); - STDMETHODIMP GetMinIdealImageSize(long* pWidth, long* pHeight); - STDMETHODIMP GetMaxIdealImageSize(long* pWidth, long* pHeight); - STDMETHODIMP GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight); - STDMETHODIMP HideCursor(long HideCursor); - STDMETHODIMP IsCursorHidden(long* CursorHidden); - - // IBasicVideo - STDMETHODIMP get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame); - STDMETHODIMP get_BitRate(long* pBitRate); - STDMETHODIMP get_BitErrorRate(long* pBitErrorRate); - STDMETHODIMP get_VideoWidth(long* pVideoWidth); - STDMETHODIMP get_VideoHeight(long* pVideoHeight); - STDMETHODIMP put_SourceLeft(long SourceLeft); - STDMETHODIMP get_SourceLeft(long* pSourceLeft); - STDMETHODIMP put_SourceWidth(long SourceWidth); - STDMETHODIMP get_SourceWidth(long* pSourceWidth); - STDMETHODIMP put_SourceTop(long SourceTop); - STDMETHODIMP get_SourceTop(long* pSourceTop); - STDMETHODIMP put_SourceHeight(long SourceHeight); - STDMETHODIMP get_SourceHeight(long* pSourceHeight); - STDMETHODIMP put_DestinationLeft(long DestinationLeft); - STDMETHODIMP get_DestinationLeft(long* pDestinationLeft); - STDMETHODIMP put_DestinationWidth(long DestinationWidth); - STDMETHODIMP get_DestinationWidth(long* pDestinationWidth); - STDMETHODIMP put_DestinationTop(long DestinationTop); - STDMETHODIMP get_DestinationTop(long* pDestinationTop); - STDMETHODIMP put_DestinationHeight(long DestinationHeight); - STDMETHODIMP get_DestinationHeight(long* pDestinationHeight); - STDMETHODIMP SetSourcePosition(long Left, long Top, long Width, long Height); - STDMETHODIMP GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight); - STDMETHODIMP SetDefaultSourcePosition(); - STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height); - STDMETHODIMP GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight); - STDMETHODIMP SetDefaultDestinationPosition(); - STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight); - STDMETHODIMP GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette); - STDMETHODIMP GetCurrentImage(long* pBufferSize, long* pDIBImage); - STDMETHODIMP IsUsingDefaultSource(); - STDMETHODIMP IsUsingDefaultDestination(); - - // IBasicAudio - STDMETHODIMP put_Volume(long lVolume); - STDMETHODIMP get_Volume(long* plVolume); - STDMETHODIMP put_Balance(long lBalance); - STDMETHODIMP get_Balance(long* plBalance); - - // IAMOpenProgress - STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent); - STDMETHODIMP AbortOperation(); - - // IGraphEngine - STDMETHODIMP_(engine_t) GetEngine(); -}; - diff --git a/src/apps/mplayerc/CShockwaveFlash.cpp b/src/apps/mplayerc/CShockwaveFlash.cpp deleted file mode 100644 index 002a1249e..000000000 --- a/src/apps/mplayerc/CShockwaveFlash.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// CShockwaveFlash.cpp : Definition of ActiveX Control wrapper class(es) created by Microsoft Visual C++ - - -#include "stdafx.h" -#include "CShockwaveFlash.h" - -///////////////////////////////////////////////////////////////////////////// -// CShockwaveFlash - -IMPLEMENT_DYNCREATE(CShockwaveFlash, CWnd) - -// CShockwaveFlash properties - -// CShockwaveFlash operations diff --git a/src/apps/mplayerc/CShockwaveFlash.h b/src/apps/mplayerc/CShockwaveFlash.h deleted file mode 100644 index da084cffe..000000000 --- a/src/apps/mplayerc/CShockwaveFlash.h +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// CShockwaveFlash.h : Declaration of ActiveX Control wrapper class(es) created by Microsoft Visual C++ - -#pragma once - -///////////////////////////////////////////////////////////////////////////// -// CShockwaveFlash - -class CShockwaveFlash : public CWnd -{ -protected: - DECLARE_DYNCREATE(CShockwaveFlash) -public: - CLSID const& GetClsid() - { - static CLSID const clsid - = { 0xD27CDB6E, 0xAE6D, 0x11CF, { 0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } }; - return clsid; - } - virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, - const RECT& rect, CWnd* pParentWnd, UINT nID, - CCreateContext* pContext = NULL) - { - return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); - } - - BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, - UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, - BSTR bstrLicKey = NULL) - { - return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, - pPersist, bStorage, bstrLicKey); - } - -// Attributes -public: - -// Operations -public: - - long get_ReadyState() - { - long result; - InvokeHelper(DISPID_READYSTATE, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - long get_TotalFrames() - { - long result; - InvokeHelper(0x7c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - BOOL get_Playing() - { - BOOL result; - InvokeHelper(0x7d, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); - return result; - } - void put_Playing(BOOL newValue) - { - static BYTE parms[] = VTS_BOOL ; - InvokeHelper(0x7d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - long get_Quality() - { - long result; - InvokeHelper(0x69, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - void put_Quality(long newValue) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x69, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - long get_ScaleMode() - { - long result; - InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - void put_ScaleMode(long newValue) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - long get_AlignMode() - { - long result; - InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - void put_AlignMode(long newValue) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x79, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - long get_BackgroundColor() - { - long result; - InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - void put_BackgroundColor(long newValue) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x7b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - BOOL get_Loop() - { - BOOL result; - InvokeHelper(0x6a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); - return result; - } - void put_Loop(BOOL newValue) - { - static BYTE parms[] = VTS_BOOL ; - InvokeHelper(0x6a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_Movie() - { - CString result; - InvokeHelper(0x66, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_Movie(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x66, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - long get_FrameNum() - { - long result; - InvokeHelper(0x6b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); - return result; - } - void put_FrameNum(long newValue) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x6b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - void SetZoomRect(long left, long top, long right, long bottom) - { - static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_I4 ; - InvokeHelper(0x6d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, left, top, right, bottom); - } - void Zoom(long factor) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x76, DISPATCH_METHOD, VT_EMPTY, NULL, parms, factor); - } - void Pan(long x, long y, long mode) - { - static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 ; - InvokeHelper(0x77, DISPATCH_METHOD, VT_EMPTY, NULL, parms, x, y, mode); - } - void Play() - { - InvokeHelper(0x70, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); - } - void Stop() - { - InvokeHelper(0x71, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); - } - void Back() - { - InvokeHelper(0x72, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); - } - void Forward() - { - InvokeHelper(0x73, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); - } - void Rewind() - { - InvokeHelper(0x74, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); - } - void StopPlay() - { - InvokeHelper(0x7e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); - } - void GotoFrame(long FrameNum) - { - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x7f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, FrameNum); - } - long CurrentFrame() - { - long result; - InvokeHelper(0x80, DISPATCH_METHOD, VT_I4, (void*)&result, NULL); - return result; - } - BOOL IsPlaying() - { - BOOL result; - InvokeHelper(0x81, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL); - return result; - } - long PercentLoaded() - { - long result; - InvokeHelper(0x82, DISPATCH_METHOD, VT_I4, (void*)&result, NULL); - return result; - } - BOOL FrameLoaded(long FrameNum) - { - BOOL result; - static BYTE parms[] = VTS_I4 ; - InvokeHelper(0x83, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, FrameNum); - return result; - } - long FlashVersion() - { - long result; - InvokeHelper(0x84, DISPATCH_METHOD, VT_I4, (void*)&result, NULL); - return result; - } - CString get_WMode() - { - CString result; - InvokeHelper(0x85, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_WMode(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x85, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_SAlign() - { - CString result; - InvokeHelper(0x86, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_SAlign(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x86, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - BOOL get_Menu() - { - BOOL result; - InvokeHelper(0x87, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); - return result; - } - void put_Menu(BOOL newValue) - { - static BYTE parms[] = VTS_BOOL ; - InvokeHelper(0x87, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_Base() - { - CString result; - InvokeHelper(0x88, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_Base(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x88, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_Scale() - { - CString result; - InvokeHelper(0x89, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_Scale(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x89, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - BOOL get_DeviceFont() - { - BOOL result; - InvokeHelper(0x8a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); - return result; - } - void put_DeviceFont(BOOL newValue) - { - static BYTE parms[] = VTS_BOOL ; - InvokeHelper(0x8a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - BOOL get_EmbedMovie() - { - BOOL result; - InvokeHelper(0x8b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); - return result; - } - void put_EmbedMovie(BOOL newValue) - { - static BYTE parms[] = VTS_BOOL ; - InvokeHelper(0x8b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_BGColor() - { - CString result; - InvokeHelper(0x8c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_BGColor(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x8c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_Quality2() - { - CString result; - InvokeHelper(0x8d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_Quality2(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x8d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - void LoadMovie(long layer, LPCTSTR url) - { - static BYTE parms[] = VTS_I4 VTS_BSTR ; - InvokeHelper(0x8e, DISPATCH_METHOD, VT_EMPTY, NULL, parms, layer, url); - } - void TGotoFrame(LPCTSTR target, long FrameNum) - { - static BYTE parms[] = VTS_BSTR VTS_I4 ; - InvokeHelper(0x8f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, FrameNum); - } - void TGotoLabel(LPCTSTR target, LPCTSTR label) - { - static BYTE parms[] = VTS_BSTR VTS_BSTR ; - InvokeHelper(0x90, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, label); - } - long TCurrentFrame(LPCTSTR target) - { - long result; - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x91, DISPATCH_METHOD, VT_I4, (void*)&result, parms, target); - return result; - } - CString TCurrentLabel(LPCTSTR target) - { - CString result; - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x92, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, target); - return result; - } - void TPlay(LPCTSTR target) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x93, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target); - } - void TStopPlay(LPCTSTR target) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x94, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target); - } - void SetVariable(LPCTSTR name, LPCTSTR value) - { - static BYTE parms[] = VTS_BSTR VTS_BSTR ; - InvokeHelper(0x97, DISPATCH_METHOD, VT_EMPTY, NULL, parms, name, value); - } - CString GetVariable(LPCTSTR name) - { - CString result; - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x98, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, name); - return result; - } - void TSetProperty(LPCTSTR target, long property, LPCTSTR value) - { - static BYTE parms[] = VTS_BSTR VTS_I4 VTS_BSTR ; - InvokeHelper(0x99, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, property, value); - } - CString TGetProperty(LPCTSTR target, long property) - { - CString result; - static BYTE parms[] = VTS_BSTR VTS_I4 ; - InvokeHelper(0x9a, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, target, property); - return result; - } - void TCallFrame(LPCTSTR target, long FrameNum) - { - static BYTE parms[] = VTS_BSTR VTS_I4 ; - InvokeHelper(0x9b, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, FrameNum); - } - void TCallLabel(LPCTSTR target, LPCTSTR label) - { - static BYTE parms[] = VTS_BSTR VTS_BSTR ; - InvokeHelper(0x9c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, label); - } - void TSetPropertyNum(LPCTSTR target, long property, double value) - { - static BYTE parms[] = VTS_BSTR VTS_I4 VTS_R8 ; - InvokeHelper(0x9d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, property, value); - } - double TGetPropertyNum(LPCTSTR target, long property) - { - double result; - static BYTE parms[] = VTS_BSTR VTS_I4 ; - InvokeHelper(0x9e, DISPATCH_METHOD, VT_R8, (void*)&result, parms, target, property); - return result; - } - double TGetPropertyAsNumber(LPCTSTR target, long property) - { - double result; - static BYTE parms[] = VTS_BSTR VTS_I4 ; - InvokeHelper(0xac, DISPATCH_METHOD, VT_R8, (void*)&result, parms, target, property); - return result; - } - CString get_SWRemote() - { - CString result; - InvokeHelper(0x9f, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_SWRemote(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0x9f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_FlashVars() - { - CString result; - InvokeHelper(0xaa, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_FlashVars(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0xaa, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - CString get_AllowScriptAccess() - { - CString result; - InvokeHelper(0xab, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); - return result; - } - void put_AllowScriptAccess(LPCTSTR newValue) - { - static BYTE parms[] = VTS_BSTR ; - InvokeHelper(0xab, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); - } - - -}; diff --git a/src/apps/mplayerc/ChildView.cpp b/src/apps/mplayerc/ChildView.cpp deleted file mode 100644 index bec015bd6..000000000 --- a/src/apps/mplayerc/ChildView.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ChildView.cpp : implementation of the CChildView class -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "ChildView.h" -#include "MainFrm.h" -#include "libpng.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CChildView - -CChildView::CChildView() : m_vrect(0,0,0,0) -{ - m_lastlmdowntime = 0; - m_lastlmdownpoint.SetPoint(0, 0); - - LoadLogo(); -} - -CChildView::~CChildView() -{ -} - -BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) -{ - if(!CWnd::PreCreateWindow(cs)) - return FALSE; - - cs.style &= ~WS_BORDER; - cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, - ::LoadCursor(NULL, IDC_HAND), HBRUSH(COLOR_WINDOW+1), NULL); - - return TRUE; -} - -BOOL CChildView::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MYMOUSELAST) - { - CWnd* pParent = GetParent(); - CPoint p(pMsg->lParam); - ::MapWindowPoints(pMsg->hwnd, pParent->m_hWnd, &p, 1); - - bool fDblClick = false; - - bool fInteractiveVideo = ((CMainFrame*)AfxGetMainWnd())->IsInteractiveVideo(); -/* - if(fInteractiveVideo) - { - if(pMsg->message == WM_LBUTTONDOWN) - { - if((pMsg->time - m_lastlmdowntime) <= GetDoubleClickTime() - && abs(pMsg->pt.x - m_lastlmdownpoint.x) <= GetSystemMetrics(SM_CXDOUBLECLK) - && abs(pMsg->pt.y - m_lastlmdownpoint.y) <= GetSystemMetrics(SM_CYDOUBLECLK)) - { - fDblClick = true; - m_lastlmdowntime = 0; - m_lastlmdownpoint.SetPoint(0, 0); - } - else - { - m_lastlmdowntime = pMsg->time; - m_lastlmdownpoint = pMsg->pt; - } - } - else if(pMsg->message == WM_LBUTTONDBLCLK) - { - m_lastlmdowntime = pMsg->time; - m_lastlmdownpoint = pMsg->pt; - } - } -*/ - if((pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP || pMsg->message == WM_MOUSEMOVE) - && fInteractiveVideo) - { - if(pMsg->message == WM_MOUSEMOVE) - { - pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y)); - } - - if(fDblClick) - { - pParent->PostMessage(WM_LBUTTONDOWN, pMsg->wParam, MAKELPARAM(p.x, p.y)); - pParent->PostMessage(WM_LBUTTONDBLCLK, pMsg->wParam, MAKELPARAM(p.x, p.y)); - } - } - else - { - pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y)); - return TRUE; - } - } - - return CWnd::PreTranslateMessage(pMsg); -} - -void CChildView::SetVideoRect(CRect r) -{ - m_vrect = r; - - Invalidate(); -} - -void CChildView::LoadLogo() -{ - AppSettings& s = AfxGetAppSettings(); - - CAutoLock cAutoLock(&m_csLogo); - - m_logo.Destroy(); - - if(s.logoext) - { - if(AfxGetAppSettings().fXpOrBetter) - m_logo.Load(s.logofn); - else if(HANDLE h = LoadImage(NULL, s.logofn, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)) - m_logo.Attach((HBITMAP)h); // win9x bug: Inside Attach GetObject() will return all zeros in DIBSECTION and silly CImage uses that to init width, height, bpp, ... so we can't use CImage::Draw later - } - - if(m_logo.IsNull()) - { - m_logo.LoadFromResource(s.logoid); - // m_logo.LoadFromResource(AfxGetInstanceHandle(), s.logoid); - } - - if(m_hWnd) Invalidate(); -} - -CSize CChildView::GetLogoSize() -{ - CSize ret(0,0); - if(!m_logo.IsNull()) - ret.SetSize(m_logo.GetWidth(), m_logo.GetHeight()); - return ret; -} - -IMPLEMENT_DYNAMIC(CChildView, CWnd) - -BEGIN_MESSAGE_MAP(CChildView, CWnd) - //{{AFX_MSG_MAP(CChildView) - ON_WM_PAINT() - ON_WM_ERASEBKGND() - ON_WM_SIZE() - ON_WM_WINDOWPOSCHANGED() - ON_COMMAND_EX(ID_PLAY_PLAYPAUSE, OnPlayPlayPauseStop) - ON_COMMAND_EX(ID_PLAY_PLAY, OnPlayPlayPauseStop) - ON_COMMAND_EX(ID_PLAY_PAUSE, OnPlayPlayPauseStop) - ON_COMMAND_EX(ID_PLAY_STOP, OnPlayPlayPauseStop) - ON_WM_SETCURSOR() - ON_WM_NCCALCSIZE() - ON_WM_NCPAINT() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// CChildView message handlers - -void CChildView::OnPaint() -{ - CPaintDC dc(this); // device context for painting - - ((CMainFrame*)GetParentFrame())->RepaintVideo(); - - // Do not call CWnd::OnPaint() for painting messages -} - -BOOL CChildView::OnEraseBkgnd(CDC* pDC) -{ - CRect r; - - CAutoLock cAutoLock(&m_csLogo); - - if(((CMainFrame*)GetParentFrame())->IsSomethingLoaded()) - { - pDC->ExcludeClipRect(m_vrect); - } - else if(!m_logo.IsNull() /*&& ((CMainFrame*)GetParentFrame())->IsPlaylistEmpty()*/) - { - BITMAP bm; - GetObject(m_logo, sizeof(bm), &bm); - - GetClientRect(r); - int w = min(bm.bmWidth, r.Width()); - int h = min(abs(bm.bmHeight), r.Height()); -// int w = min(m_logo.GetWidth(), r.Width()); -// int h = min(m_logo.GetHeight(), r.Height()); - int x = (r.Width() - w) / 2; - int y = (r.Height() - h) / 2; - r = CRect(CPoint(x, y), CSize(w, h)); - - int oldmode = pDC->SetStretchBltMode(STRETCH_HALFTONE); - m_logo.StretchBlt(*pDC, r, CRect(0,0,bm.bmWidth,abs(bm.bmHeight))); -// m_logo.Draw(*pDC, r); - pDC->SetStretchBltMode(oldmode); - - pDC->ExcludeClipRect(r); - } - - GetClientRect(r); - pDC->FillSolidRect(r, 0); - - return TRUE; -} - -void CChildView::OnSize(UINT nType, int cx, int cy) -{ - CWnd::OnSize(nType, cx, cy); - - ((CMainFrame*)GetParentFrame())->MoveVideoWindow(); -} - -void CChildView::OnWindowPosChanged(WINDOWPOS* lpwndpos) -{ - CWnd::OnWindowPosChanged(lpwndpos); - - ((CMainFrame*)GetParentFrame())->MoveVideoWindow(); -} - -BOOL CChildView::OnPlayPlayPauseStop(UINT nID) -{ - if(nID == ID_PLAY_STOP) SetVideoRect(); - return FALSE; -} - -BOOL CChildView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) -{ - if(((CMainFrame*)GetParentFrame())->m_fHideCursor) - { - SetCursor(NULL); - return TRUE; - } - - return CWnd::OnSetCursor(pWnd, nHitTest, message); -} - -void CChildView::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp) -{ - if(!((CMainFrame*)GetParentFrame())->IsFrameLessWindow()) - { - InflateRect(&lpncsp->rgrc[0], -1, -1); - } - - CWnd::OnNcCalcSize(bCalcValidRects, lpncsp); -} - -void CChildView::OnNcPaint() -{ - if(!((CMainFrame*)GetParentFrame())->IsFrameLessWindow()) - { - CRect r; - GetWindowRect(r); - r.OffsetRect(-r.left, -r.top); - - CWindowDC(this).Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); - } -} - diff --git a/src/apps/mplayerc/ChildView.h b/src/apps/mplayerc/ChildView.h deleted file mode 100644 index 303747673..000000000 --- a/src/apps/mplayerc/ChildView.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "libpng.h" - -class CChildView : public CWnd -{ - CRect m_vrect; - - DWORD m_lastlmdowntime; - CPoint m_lastlmdownpoint; - - CCritSec m_csLogo; - CPngImage m_logo; - -public: - CChildView(); - virtual ~CChildView(); - - DECLARE_DYNAMIC(CChildView) - -public: - void SetVideoRect(CRect r = CRect(0,0,0,0)); - CRect GetVideoRect() {return(m_vrect);} - - void LoadLogo(); - CSize GetLogoSize(); - -protected: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual BOOL PreTranslateMessage(MSG* pMsg); - - afx_msg void OnPaint(); - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos); - afx_msg BOOL OnPlayPlayPauseStop(UINT nID); - afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); - afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp); - afx_msg void OnNcPaint(); - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnSetFocus(CWnd* pOldWnd); -}; diff --git a/src/apps/mplayerc/ComPropertyPage.cpp b/src/apps/mplayerc/ComPropertyPage.cpp deleted file mode 100644 index 23df655a2..000000000 --- a/src/apps/mplayerc/ComPropertyPage.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ComPropertyPage.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "ComPropertyPage.h" -#include "ComPropertySheet.h" - - -// CComPropertyPage dialog - -IMPLEMENT_DYNAMIC(CComPropertyPage, CPropertyPage) -CComPropertyPage::CComPropertyPage(IPropertyPage* pPage) - : CPropertyPage(CComPropertyPage::IDD), m_pPage(pPage) -{ - PROPPAGEINFO ppi; - m_pPage->GetPageInfo(&ppi); - m_pPSP->pszTitle = (m_strCaption = ppi.pszTitle); - m_psp.dwFlags |= PSP_USETITLE; -} - -CComPropertyPage::~CComPropertyPage() -{ -} - -void CComPropertyPage::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); -} - -BOOL CComPropertyPage::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - CRect r; - PROPPAGEINFO ppi; - m_pPage->GetPageInfo(&ppi); - r = CRect(CPoint(0,0), ppi.size); - m_pPage->Activate(m_hWnd, r, FALSE); - m_pPage->Show(SW_SHOW); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CComPropertyPage::OnDestroy() -{ - CPropertyPage::OnDestroy(); - - m_pPage->Deactivate(); -} - -BOOL CComPropertyPage::OnSetActive() -{ - SetModified(S_OK == m_pPage->IsPageDirty()); - - CWnd* pParent = GetParent(); - if(pParent->IsKindOf(RUNTIME_CLASS(CComPropertySheet))) - { - CComPropertySheet* pSheet = (CComPropertySheet*)pParent; - pSheet->OnActivated(this); - } - - return CPropertyPage::OnSetActive(); -} - -BOOL CComPropertyPage::OnKillActive() -{ - SetModified(FALSE); - - return CPropertyPage::OnKillActive(); -} - - -BEGIN_MESSAGE_MAP(CComPropertyPage, CPropertyPage) - ON_WM_DESTROY() -END_MESSAGE_MAP() - - -// CComPropertyPage message handlers - -void CComPropertyPage::OnOK() -{ - if(S_OK == m_pPage->IsPageDirty()) m_pPage->Apply(); - SetModified(FALSE); - - CPropertyPage::OnOK(); -} diff --git a/src/apps/mplayerc/ComPropertyPage.h b/src/apps/mplayerc/ComPropertyPage.h deleted file mode 100644 index e36ea6801..000000000 --- a/src/apps/mplayerc/ComPropertyPage.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - - -// CComPropertyPage dialog - -class CComPropertyPage : public CPropertyPage -{ - DECLARE_DYNAMIC(CComPropertyPage) - - CComPtr m_pPage; - -public: - CComPropertyPage(IPropertyPage* pPage); - virtual ~CComPropertyPage(); - -// Dialog Data - enum { IDD = IDD_COMPROPERTYPAGE }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnSetActive(); - virtual BOOL OnKillActive(); - - DECLARE_MESSAGE_MAP() - -public: - virtual BOOL OnInitDialog(); - afx_msg void OnDestroy(); - virtual void OnOK(); -}; - diff --git a/src/apps/mplayerc/ComPropertySheet.cpp b/src/apps/mplayerc/ComPropertySheet.cpp deleted file mode 100644 index 49cc664ed..000000000 --- a/src/apps/mplayerc/ComPropertySheet.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ComPropertySheet.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "ComPropertySheet.h" -#include "..\..\DSUtil\DSUtil.h" -#include "..\..\filters\InternalPropertyPage.h" - -// CComPropertyPageSite - -class CComPropertyPageSite : public CUnknown, public IPropertyPageSite -{ - IComPropertyPageDirty* m_pPPD; - -public: - CComPropertyPageSite(IComPropertyPageDirty* pPPD) : CUnknown(NAME("CComPropertyPageSite"), NULL), m_pPPD(pPPD) {} - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) - { - return - QI(IPropertyPageSite) - __super::NonDelegatingQueryInterface(riid, ppv); - } - - // IPropertyPageSite - STDMETHODIMP OnStatusChange(DWORD flags) - { - if(m_pPPD) - { - if(flags&PROPPAGESTATUS_DIRTY) m_pPPD->OnSetDirty(true); - if(flags&PROPPAGESTATUS_CLEAN) m_pPPD->OnSetDirty(false); - } - return S_OK; - } - STDMETHODIMP GetLocaleID(LCID* pLocaleID) - { - CheckPointer(pLocaleID, E_POINTER); - *pLocaleID = ::GetUserDefaultLCID(); - return S_OK; - } - STDMETHODIMP GetPageContainer(IUnknown** ppUnk) {return E_NOTIMPL;} - STDMETHODIMP TranslateAccelerator(LPMSG pMsg) {return E_NOTIMPL;} -}; - -// CComPropertySheet - -IMPLEMENT_DYNAMIC(CComPropertySheet, CPropertySheet) -CComPropertySheet::CComPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) - : CPropertySheet(nIDCaption, pParentWnd, iSelectPage) -{ - m_pSite = new CComPropertyPageSite(this); - m_size.SetSize(0, 0); -} - -CComPropertySheet::CComPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) - : CPropertySheet(pszCaption, pParentWnd, iSelectPage) -{ - m_pSite = new CComPropertyPageSite(this); - m_size.SetSize(0, 0); -} - -CComPropertySheet::~CComPropertySheet() -{ -} - -int CComPropertySheet::AddPages(CComPtr pSPP) -{ - if(!pSPP) return(0); - - CAUUID caGUID; - caGUID.pElems = NULL; - if(FAILED(pSPP->GetPages(&caGUID))) - return(0); - - IUnknown* lpUnk = NULL; - if(FAILED(pSPP.QueryInterface(&lpUnk))) - return(0); - - m_spp.AddTail(pSPP); - - CComQIPtr pSPP2 = pSPP; - CComQIPtr pPersist = pSPP; - - ULONG nPages = 0; - for(ULONG i = 0; i < caGUID.cElems; i++) - { - CComPtr pPage; - - HRESULT hr = E_FAIL; - - if(FAILED(hr) && !pPage && pSPP2) - { - hr = pSPP2->CreatePage(caGUID.pElems[i], &pPage); - } - - if(FAILED(hr) && !pPage) - { - hr = pPage.CoCreateInstance(caGUID.pElems[i]); - } - - if(FAILED(hr) && !pPage && pPersist) - { - hr = LoadExternalPropertyPage(pPersist, caGUID.pElems[i], &pPage); - } - - if(SUCCEEDED(hr)) - { - if(AddPage(pPage, lpUnk)) - nPages++; - } - } - - if(caGUID.pElems) CoTaskMemFree(caGUID.pElems); - lpUnk->Release(); - - return(nPages); -} - -bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk) -{ - if(!pPage || !pUnk) return false; - - HRESULT hr; - hr = pPage->SetPageSite(m_pSite); - hr = pPage->SetObjects(1, &pUnk); - PROPPAGEINFO ppi; - hr = pPage->GetPageInfo(&ppi); - m_size.cx = max(m_size.cx, ppi.size.cx); - m_size.cy = max(m_size.cy, ppi.size.cy); - CAutoPtr p(new CComPropertyPage(pPage)); - __super::AddPage(p); - m_pages.AddTail(p); - - return true; -} - -void CComPropertySheet::OnActivated(CPropertyPage* pPage) -{ - if(!pPage) return; - - CRect bounds(30000,30000,-30000,-30000); - - CRect wr, cr; - GetWindowRect(wr); - GetClientRect(cr); - CSize ws = wr.Size(), cs = cr.Size(); - - CRect twr, tcr; - CTabCtrl* pTC = (CTabCtrl*)GetDlgItem(AFX_IDC_TAB_CONTROL); - pTC->GetWindowRect(twr); - pTC->GetClientRect(tcr); - CSize tws = twr.Size(), tcs = tcr.Size(); - - if(CWnd* pChild = pPage->GetWindow(GW_CHILD)) - { - pChild->ModifyStyle(WS_CAPTION|WS_THICKFRAME, 0); - pChild->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT); - - for(CWnd* pGrandChild = pChild->GetWindow(GW_CHILD); pGrandChild; pGrandChild = pGrandChild->GetNextWindow()) - { - if(!(pGrandChild->GetStyle()&WS_VISIBLE)) continue; - - CRect r; - pGrandChild->GetWindowRect(&r); - pChild->ScreenToClient(r); - bounds |= r; - } - } - - bounds |= CRect(0,0,0,0); - bounds.SetRect(0, 0, bounds.right + max(bounds.left, 4), bounds.bottom + max(bounds.top, 4)); - - CRect r = CRect(CPoint(0,0), bounds.Size()); - pTC->AdjustRect(TRUE, r); - r.SetRect(twr.TopLeft(), twr.TopLeft() + r.Size()); - ScreenToClient(r); - pTC->MoveWindow(r); - pTC->ModifyStyle(TCS_MULTILINE, TCS_SINGLELINE); - - CSize diff = r.Size() - tws; - - if(!bounds.IsRectEmpty()) - { - if(CWnd* pChild = pPage->GetWindow(GW_CHILD)) - pChild->MoveWindow(bounds); - CRect r = twr; - pTC->AdjustRect(FALSE, r); - ScreenToClient(r); - pPage->MoveWindow(CRect(r.TopLeft(), bounds.Size())); - } - - int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP }; - for(int i = 0; i < countof(_afxPropSheetButtons); i++) - { - if(CWnd* pWnd = GetDlgItem(_afxPropSheetButtons[i])) - { - pWnd->GetWindowRect(r); - ScreenToClient(r); - pWnd->MoveWindow(CRect(r.TopLeft() + diff, r.Size())); - } - } - - MoveWindow(CRect(wr.TopLeft(), ws + diff)); - - Invalidate(); -} - - -BEGIN_MESSAGE_MAP(CComPropertySheet, CPropertySheet) -END_MESSAGE_MAP() - - -// CComPropertySheet message handlers - -BOOL CComPropertySheet::OnInitDialog() -{ - BOOL bResult = (BOOL)Default();//CPropertySheet::OnInitDialog(); - - if (!(GetStyle() & WS_CHILD)) - CenterWindow(); - - return bResult; -} diff --git a/src/apps/mplayerc/ComPropertySheet.h b/src/apps/mplayerc/ComPropertySheet.h deleted file mode 100644 index faef4c89f..000000000 --- a/src/apps/mplayerc/ComPropertySheet.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "ComPropertyPage.h" - -interface IComPropertyPageDirty -{ - virtual void OnSetDirty(bool fDirty) = 0; -}; - -// CComPropertySheet - -class CComPropertySheet : public CPropertySheet, public IComPropertyPageDirty -{ - DECLARE_DYNAMIC(CComPropertySheet) - - CComPtr m_pSite; - CInterfaceList m_spp; - CAutoPtrList m_pages; - CSize m_size; - -public: - CComPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); - CComPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); - virtual ~CComPropertySheet(); - - int AddPages(CComPtr pSPP); - bool AddPage(IPropertyPage* pPage, IUnknown* pUnk); - - void OnActivated(CPropertyPage* pPage); - - // IComPropertyPageDirty - void OnSetDirty(bool fDirty) {if(CPropertyPage* p = GetActivePage()) p->SetModified(fDirty);} - - virtual BOOL OnInitDialog(); - -protected: - DECLARE_MESSAGE_MAP() -}; - - diff --git a/src/apps/mplayerc/ConvertChapDlg.cpp b/src/apps/mplayerc/ConvertChapDlg.cpp deleted file mode 100644 index b77c35bed..000000000 --- a/src/apps/mplayerc/ConvertChapDlg.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ConvertChapDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "ConvertChapDlg.h" - -// CConvertChapDlg dialog - -CConvertChapDlg::CConvertChapDlg(CWnd* pParent /*=NULL*/) - : CResizableDialog(CConvertChapDlg::IDD, pParent) - , m_time(_T("")) - , m_name(_T("")) -{ -} - -CConvertChapDlg::~CConvertChapDlg() -{ -} - -void CConvertChapDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Text(pDX, IDC_EDIT1, m_time); - DDX_Text(pDX, IDC_EDIT2, m_name); -} - -BEGIN_MESSAGE_MAP(CConvertChapDlg, CResizableDialog) - ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK) -END_MESSAGE_MAP() - - -// CConvertChapDlg message handlers - -BOOL CConvertChapDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - AddAnchor(IDC_EDIT1, TOP_LEFT); - AddAnchor(IDC_EDIT2, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDOK, BOTTOM_CENTER); - AddAnchor(IDCANCEL, BOTTOM_CENTER); - - CRect r; - GetWindowRect(r); - CSize s = r.Size(); - SetMinTrackSize(s); - s.cx = 1000; - SetMaxTrackSize(s); - - UpdateData(FALSE); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CConvertChapDlg::OnOK() -{ - UpdateData(); - - __super::OnOK(); -} - -void CConvertChapDlg::OnUpdateOK(CCmdUI* pCmdUI) -{ - CString str; - GetDlgItem(IDC_EDIT1)->GetWindowText(str); - int i; - pCmdUI->Enable(3 == _stscanf(str, _T("%d:%d:%d"), &i, &i, &i) - && GetDlgItem(IDC_EDIT2)->GetWindowTextLength() > 0); -} diff --git a/src/apps/mplayerc/ConvertChapDlg.h b/src/apps/mplayerc/ConvertChapDlg.h deleted file mode 100644 index 71c989e89..000000000 --- a/src/apps/mplayerc/ConvertChapDlg.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -// CConvertChapDlg dialog - -class CConvertChapDlg : public CResizableDialog -{ -public: - CConvertChapDlg(CWnd* pParent = NULL); // standard constructor - virtual ~CConvertChapDlg(); - -// Dialog Data - enum { IDD = IDD_CONVERTCHAP_DLG }; - CString m_time; - CString m_name; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - virtual void OnOK(); - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnUpdateOK(CCmdUI* pCmdUI); -}; diff --git a/src/apps/mplayerc/ConvertDlg.cpp b/src/apps/mplayerc/ConvertDlg.cpp deleted file mode 100644 index 258854500..000000000 --- a/src/apps/mplayerc/ConvertDlg.cpp +++ /dev/null @@ -1,1366 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ConvertDlg.cpp : implementation file -// - -#include "stdafx.h" -#include -#include "mplayerc.h" -#include "..\..\filters\filters.h" -#include "..\..\..\include\moreuuids.h" -#include "FGManager.h" -#include "ConvertPropsDlg.h" -#include "ConvertResDlg.h" -#include "ConvertChapDlg.h" -#include "ConvertDlg.h" - -// TODO: subtitle source filter for vobsub - -// CConvertDlg dialog - -CConvertDlg::CConvertDlg(CWnd* pParent /*=NULL*/) - : CResizableDialog(CConvertDlg::IDD, pParent) - , m_fn(_T("")) -{ -} - -CConvertDlg::~CConvertDlg() -{ -} - -void CConvertDlg::AddFile(CString fn) -{ - CString protocol; - - int i = fn.Find(_T("://")); - if(i > 0) - { - CString url = fn.Mid(i); - CPath path(fn.Left(i)); - path.StripPath(); - protocol = (LPCTSTR)path; - fn = (LPCTSTR)path + url; - } - - CComPtr pBF; - if(FAILED(m_pGB->AddSourceFilter(CStringW(fn), CStringW(fn), &pBF))) - return; - - int nConnected = 0; - BeginEnumPins(pBF, pEP, pPin) - if(S_OK == m_pGB->ConnectFilter(pPin, m_pMux)) nConnected++; - EndEnumPins - if(!nConnected) {MessageBeep(-1); DeleteFilter(pBF); return;} - - if(m_tree.GetCount() == 0) - { - if(CComQIPtr pPB = m_pMux) - pPB->DelAllProperties(); - - CString ext(_T(".dsm")); - - if(!protocol.IsEmpty()) - { - m_fn = protocol + ext; - } - else - { - CPath p(fn); - if(ext.CompareNoCase(p.GetExtension()) == 0) - ext = _T(" (remuxed)") + ext; - p.RemoveExtension(); - m_fn = (LPCTSTR)p + ext; - } - - UpdateData(FALSE); - } - - CTreeItemFile* t = new CTreeItemFile(fn, pBF, m_tree, NULL); - - AddFilter(*t, pBF); - - m_tree.Expand(*t, TVE_EXPAND); - m_tree.EnsureVisible(*t); -} - -bool CConvertDlg::ConvertFile(LPCTSTR fn, IPin* pPin) -{ - OAFilterState fs; - if(!m_pMC || FAILED(m_pMC->GetState(0, &fs)) || fs != State_Stopped) - return false; - - m_pGB->NukeDownstream(m_pMux); - - CComPtr pFW; - pFW.CoCreateInstance(CLSID_FileWriter); - CComQIPtr pFSF = pFW; - - if(pPin) - { - CComQIPtr pRP = pPin; - if(!pRP) return false; - - pPin = pRP->GetRelatedPin(); - } - else - { - pPin = GetFirstPin(m_pMux, PINDIR_OUTPUT); - } - - if(!pPin || !pFSF - || FAILED(m_pGB->AddFilter(pFW, NULL)) - || FAILED(pFSF->SetFileName(CStringW(fn), NULL)) - || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE)) - || FAILED(m_pGB->ConnectDirect(pPin, GetFirstPin(pFW), NULL))) - { - m_pGB->RemoveFilter(pFW); - return false; - } - - if(m_pMS) - { - LONGLONG pos = 0; - m_pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); - } - - if(CComQIPtr pPB = m_pMux) - { - pPB->SetProperty(L"APPL", L"Media Player Classic"); - } - - if(CComQIPtr pRB = m_pMux) - { - pRB->ResRemoveAll(0); - POSITION pos = m_pTIs.GetHeadPosition(); - while(pos) - { - if(CTreeItemResource* t2 = dynamic_cast((CTreeItem*)m_pTIs.GetNext(pos))) - pRB->ResAppend( - t2->m_res.name, t2->m_res.desc, t2->m_res.mime, - t2->m_res.data.GetData(), t2->m_res.data.GetCount(), - NULL); - } - } - - if(CComQIPtr pCB = m_pMux) - { - pCB->ChapRemoveAll(); - POSITION pos = m_pTIs.GetHeadPosition(); - while(pos) - { - if(CTreeItemChapter* t2 = dynamic_cast((CTreeItem*)m_pTIs.GetNext(pos))) - pCB->ChapAppend(t2->m_chap.rt, t2->m_chap.name); - } - } - - if(FAILED(m_pMC->Run())) - return false; - - m_tree.EnableWindow(FALSE); - - return true; -} - -void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent) -{ - BeginEnumPins(pBFParent, pEP, pPin) - { - CComPtr pPinTo; - CComPtr pBF; - if(S_OK != m_pGB->IsPinDirection(pPin, PINDIR_OUTPUT) - || FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo - || !(pBF = GetFilterFromPin(pPinTo))) - continue; - - CTreeItem* t = NULL; - - if(pBF == m_pMux) - { - t = new CTreeItemPin(pPin, m_tree, hTIParent); - } - else - { - t = new CTreeItemFilter(pBF, m_tree, hTIParent); - AddFilter(*t, pBF); - } - } - EndEnumPins - - if(CComQIPtr pPB = pBFParent) - { - ULONG props; - if(FAILED(pPB->CountProperties(&props))) - props = 0; - - for(ULONG i = 0; i < props; i++) - { - PROPBAG2 PropBag; - memset(&PropBag, 0, sizeof(PropBag)); - ULONG cPropertiesReturned = 0; - if(FAILED(pPB->GetPropertyInfo(i, 1, &PropBag, &cPropertiesReturned))) - continue; - - HRESULT hr; - CComVariant var; - if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr)) - { - CComQIPtr pPBMux = m_pMux; - CComBSTR value; - if(pPBMux && FAILED(pPBMux->GetProperty(PropBag.pstrName, &value))) - pPBMux->SetProperty(PropBag.pstrName, var.bstrVal); - } - - CoTaskMemFree(PropBag.pstrName); - } - } - - CTreeItem* t2 = new CTreeItemResourceFolder(m_tree, hTIParent); - if(CComQIPtr pRB = pBFParent) - { - for(DWORD i = 0, cnt = pRB->ResGetCount(); i < cnt; i++) - { - CComBSTR name, mime, desc; - BYTE* pData = NULL; - DWORD len = 0; - if(FAILED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL))) - continue; - - if(len > 0) - { - m_pTIs.AddTail(new CTreeItemResource(CDSMResource(name, desc, mime, pData, len), m_tree, *t2)); - } - - CoTaskMemFree(pData); - } - } - m_tree.Expand(*t2, TVE_EXPAND); - - CTreeItem* t3 = new CTreeItemChapterFolder(m_tree, hTIParent); - if(CComQIPtr pCB = pBFParent) - { - for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++) - { - REFERENCE_TIME rt; - CComBSTR name; - if(FAILED(pCB->ChapGet(i, &rt, &name))) - continue; - - m_pTIs.AddTail(new CTreeItemChapter(CDSMChapter(rt, name), m_tree, *t3)); - } - } - m_tree.Expand(*t3, TVE_EXPAND); - - m_tree.Expand(hTIParent, TVE_EXPAND); -} - -void CConvertDlg::DeleteFilter(IBaseFilter* pBF) -{ - BeginEnumPins(pBF, pEP, pPin) - { - CComPtr pPinTo; - CComPtr pBF; - if(S_OK != m_pGB->IsPinDirection(pPin, PINDIR_OUTPUT) - || FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo - || !(pBF = GetFilterFromPin(pPinTo))) - continue; - - if(pBF != m_pMux) DeleteFilter(pBF); - } - EndEnumPins - - m_pGB->RemoveFilter(pBF); -} - -void CConvertDlg::DeleteItem(HTREEITEM hTI) -{ - if(!hTI) return; - - DeleteChildren(hTI); - - CTreeItem* t = (CTreeItem*)m_tree.GetItemData(hTI); - if(POSITION pos = m_pTIs.Find(t)) m_pTIs.RemoveAt(pos); - delete t; - m_tree.DeleteItem(hTI); -} - -void CConvertDlg::DeleteChildren(HTREEITEM hTI) -{ - if(!hTI) return; - - if(m_tree.ItemHasChildren(hTI)) - { - HTREEITEM hChildItem = m_tree.GetChildItem(hTI); - - while(hChildItem != NULL) - { - HTREEITEM hNextItem = m_tree.GetNextItem(hChildItem, TVGN_NEXT); - DeleteItem(hChildItem); - hChildItem = hNextItem; - } - } -} - -HTREEITEM CConvertDlg::HitTest(CPoint& sp, CPoint& cp) -{ - sp = CPoint((LPARAM)GetMessagePos()); - cp = sp; - m_tree.ScreenToClient(&cp); - UINT flags = 0; - HTREEITEM hTI = m_tree.HitTest(cp, &flags); - return hTI && (flags&TVHT_ONITEM) ? hTI : NULL; -} - -void CConvertDlg::ShowPopup(CPoint p) -{ - CMenu m; - m.CreatePopupMenu(); - - int i = 1; - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_ADDFILE)); - m.AppendMenu(MF_SEPARATOR); - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_PROPERTIES)); - - switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - { - CFileDialog fd(TRUE, NULL, m_fn, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_NOVALIDATE, - _T("Media files|*.*||"), this, 0); - if(fd.DoModal() == IDOK) AddFile(fd.GetPathName()); - } - break; - case 2: - EditProperties(CComQIPtr(m_pMux)); - break; - } -} - -void CConvertDlg::ShowFilePopup(HTREEITEM hTI, CPoint p) -{ - CTreeItemFile* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hTI)); - ASSERT(t); - - CMenu m; - m.CreatePopupMenu(); - - int i = 1; - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVE)); - - switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - DeleteFilter(t->m_pBF); - DeleteItem(hTI); - break; - } -} - -void CConvertDlg::ShowPinPopup(HTREEITEM hTI, CPoint p) -{ - CTreeItemPin* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hTI)); - ASSERT(t); - - if(!t->m_pPin) return; - - CComPtr pPinTo; - t->m_pPin->ConnectedTo(&pPinTo); - - CMediaType mt; - if(pPinTo) t->m_pPin->ConnectionMediaType(&mt); - - CAtlArray mts; - BeginEnumMediaTypes(t->m_pPin, pEMT, pmt) - mts.Add(*pmt); - EndEnumMediaTypes(pmt) - - CMenu m; - m.CreatePopupMenu(); - - int i = 1, mtbase = 1000, mti = mtbase; - - m.AppendMenu(MF_STRING, i++, !pPinTo ? ResStr(IDS_CONVERT_ENABLESTREAM) : ResStr(IDS_CONVERT_DISABLESTREAM)); - m.AppendMenu(MF_STRING | (!pPinTo ? MF_GRAYED : 0), i++, ResStr(IDS_CONVERT_DEMUXSTREAM)); - - if(mts.GetCount() > 1) - { - m.AppendMenu(MF_SEPARATOR); - for(int i = 0; i < mts.GetCount(); i++) - m.AppendMenu(MF_STRING | (mts[i] == mt ? MF_CHECKED : 0), mti++, CMediaTypeEx(mts[i]).ToString()); - } - - m.AppendMenu(MF_SEPARATOR); - m.AppendMenu(MF_STRING | (!pPinTo ? MF_GRAYED : 0), i++, ResStr(IDS_CONVERT_PINPROPERTIES)); - - switch(i = (int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - if(pPinTo) {m_pGB->Disconnect(pPinTo); m_pGB->Disconnect(t->m_pPin);} - else if(pPinTo = GetFirstDisconnectedPin(m_pMux, PINDIR_INPUT)) m_pGB->ConnectDirect(t->m_pPin, pPinTo, NULL); - t->Update(); - break; - case 2: - { - UpdateData(); - - CString ext = _T("raw"); - - if(mt.subtype == MEDIASUBTYPE_AAC) ext = _T("aac"); - else if(mt.subtype == MEDIASUBTYPE_MP3) ext = _T("mp3"); - else if(mt.subtype == FOURCCMap(WAVE_FORMAT_MPEG)) ext = _T("m1a"); - else if(mt.subtype == MEDIASUBTYPE_MPEG2_AUDIO) ext = _T("m2a"); - else if(mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 || mt.subtype == MEDIASUBTYPE_DOLBY_AC3) ext = _T("ac3"); - else if(mt.subtype == MEDIASUBTYPE_WAVE_DTS || mt.subtype == MEDIASUBTYPE_DTS) ext = _T("dts"); - else if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO) ext = _T("h264"); - else if(mt.subtype == FOURCCMap('GEPJ') || mt.subtype == FOURCCMap('gepj')) ext = _T("jpg"); - else if(mt.majortype == MEDIATYPE_Video && mt.subtype == MEDIASUBTYPE_MPEG2_VIDEO) ext = _T("m2v"); - else if(mt.majortype == MEDIATYPE_Video && mt.subtype == MEDIASUBTYPE_MPEG1Payload) ext = _T("m1v"); - else if(mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text) ext = _T("srt"); - else if(mt.subtype == MEDIASUBTYPE_SSA) ext = _T("ssa"); - else if(mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2) ext = _T("ass"); - else if(mt.subtype == MEDIASUBTYPE_SSF) ext = _T("ssf"); - else if(mt.subtype == MEDIASUBTYPE_VOBSUB) ext = _T("sub"); - else if(mt.subtype == MEDIASUBTYPE_PCM || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE) || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT)) ext = _T("wav"); - // TODO: else if... - - CPath path(m_fn); - path.RenameExtension('.' + ext); - - CFileDialog fd(FALSE, NULL, (LPCTSTR)path, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY, - _T("Media files|*.*||"), this, 0); - if(fd.DoModal() == IDOK) - { - if(!ConvertFile(fd.GetPathName(), pPinTo)) - { - AfxMessageBox(_T("Failed to start conversion")); - } - } - } - break; - case 3: - EditProperties(CComQIPtr(pPinTo)); - break; - default: - i -= mtbase; - if(i >= 0 && i < mts.GetCount()) - { - if(pPinTo) {m_pGB->Disconnect(pPinTo); m_pGB->Disconnect(t->m_pPin);} - else {pPinTo = GetFirstDisconnectedPin(m_pMux, PINDIR_INPUT);} - HRESULT hr = m_pGB->ConnectDirect(t->m_pPin, pPinTo, &mts[i]); - if(FAILED(hr)) - { - AfxMessageBox(_T("Reconnection attempt failed!")); - if(mt.majortype != GUID_NULL) - hr = m_pGB->ConnectDirect(t->m_pPin, pPinTo, &mt); - } - t->Update(); - } - break; - } -} - -void CConvertDlg::ShowResourceFolderPopup(HTREEITEM hTI, CPoint p) -{ - CTreeItemResourceFolder* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hTI)); - ASSERT(t); - - CMenu m; - m.CreatePopupMenu(); - - int i = 1; - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_ADDRESOURCE)); - if(m_tree.ItemHasChildren(*t)) - { - m.AppendMenu(MF_SEPARATOR); - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVEALL)); - } - - switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - { - CFileDialog fd(TRUE, NULL, NULL, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY, - _T("All files|*.*||"), this, 0); - if(fd.DoModal() == IDOK) - { - CString fn = fd.GetPathName(); - if(FILE* f = _tfopen(fn, _T("rb"))) - { - CDSMResource res; - - CPath path(fn); - path.StripPath(); - res.name = (LPCTSTR)path; - - CRegKey key; - TCHAR mime[256]; - ULONG len = countof(mime); - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, path.GetExtension().MakeLower(), KEY_READ) - && ERROR_SUCCESS == key.QueryStringValue(_T("Content Type"), mime, &len)) - res.mime = mime; - - CTreeItemResource* t = new CTreeItemResource(res, m_tree, hTI); - m_pTIs.AddTail(t); - - if(EditResource(t)) - { - fseek(f, 0, 2); - long size = ftell(f); - fseek(f, 0, 0); - t->m_res.data.SetCount(size); - for(BYTE* ptr = t->m_res.data.GetData(),* end = ptr + size; - size > 0 && end - ptr >= size && fread(ptr, min(size, 1024), 1, f) > 0; - ptr += 1024, size -= 1024); - fclose(f); - } - else - { - DeleteItem(*t); - } - } - else - { - AfxMessageBox(_T("Cannot open file!")); - } - } - } - break; - case 2: - DeleteChildren(hTI); - break; - } -} - -void CConvertDlg::ShowResourcePopup(HTREEITEM hTI, CPoint p) -{ - CTreeItemResource* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hTI)); - ASSERT(t); - - CMenu m; - m.CreatePopupMenu(); - - int i = 1; - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVE)); - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_SAVEAS)); - if(AfxGetAppSettings().fEnableWebServer) m.AppendMenu(MF_STRING, 1000, ResStr(IDS_CONVERT_LAUNCHINBROWSER)); - m.AppendMenu(MF_SEPARATOR); - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_RESOURCEPROPERTIES)); - - switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - DeleteItem(*t); - break; - case 2: - { - CFileDialog fd(FALSE, NULL, CString(t->m_res.name), - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, - _T("All files|*.*||"), this, 0); - if(fd.DoModal() == IDOK) - { - if(FILE* f = _tfopen(fd.GetPathName(), _T("wb"))) - { - fwrite(t->m_res.data.GetData(), 1, t->m_res.data.GetCount(), f); - fclose(f); - } - } - } - break; - case 3: - EditResource(t); - break; - case 1000: - { - CString url; - url.Format(_T("http://localhost:%d/convres.html?id=%x"), AfxGetAppSettings().nWebServerPort, (DWORD)&t->m_res); - ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT); - } - break; - } -} - -bool CConvertDlg::EditProperties(IDSMPropertyBag* pPB) -{ - CConvertPropsDlg dlg(!!CComQIPtr(pPB), this); - - ULONG props; - if(FAILED(pPB->CountProperties(&props))) - props = 0; - - for(ULONG i = 0; i < props; i++) - { - PROPBAG2 PropBag; - memset(&PropBag, 0, sizeof(PropBag)); - ULONG cPropertiesReturned = 0; - if(FAILED(pPB->GetPropertyInfo(i, 1, &PropBag, &cPropertiesReturned))) - continue; - - HRESULT hr; - CComVariant var; - if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr)) - dlg.m_props[CString(PropBag.pstrName)] = CString(var); - - CoTaskMemFree(PropBag.pstrName); - } - - if(IDOK != dlg.DoModal()) - return false; - - pPB->DelAllProperties(); - - POSITION pos = dlg.m_props.GetStartPosition(); - while(pos) - { - CString key, value; - dlg.m_props.GetNextAssoc(pos, key, value); - pPB->SetProperty(CStringW(key), CStringW(value)); - } - - return true; -} - -bool CConvertDlg::EditResource(CTreeItemResource* t) -{ - CConvertResDlg dlg(this); - - dlg.m_name = t->m_res.name; - dlg.m_mime = t->m_res.mime; - dlg.m_desc = t->m_res.desc; - - if(IDOK != dlg.DoModal()) - return false; - - t->m_res.name = dlg.m_name; - t->m_res.mime = dlg.m_mime; - t->m_res.desc = dlg.m_desc; - - t->Update(); - - return true; -} - -void CConvertDlg::ShowChapterFolderPopup(HTREEITEM hTI, CPoint p) -{ - CTreeItemChapterFolder* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hTI)); - ASSERT(t); - - CMenu m; - m.CreatePopupMenu(); - - int i = 1; - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_ADDCHAPTER)); - if(m_tree.ItemHasChildren(*t)) - { - m.AppendMenu(MF_SEPARATOR); - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVEALL)); - } - - switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - { - CDSMChapter chap; - CTreeItemChapter* t = new CTreeItemChapter(CDSMChapter(0, L""), m_tree, hTI); - m_pTIs.AddTail(t); - if(!EditChapter(t)) - DeleteItem(*t); - } - break; - case 2: - DeleteChildren(hTI); - break; - } -} - -void CConvertDlg::ShowChapterPopup(HTREEITEM hTI, CPoint p) -{ - CTreeItemChapter* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hTI)); - ASSERT(t); - - CMenu m; - m.CreatePopupMenu(); - - int i = 1; - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVE)); - m.AppendMenu(MF_SEPARATOR); - m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_CHAPTERPROPERTIES)); - - switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this)) - { - case 1: - DeleteItem(hTI); - break; - case 2: - EditChapter(t); - break; - } -} - -bool CConvertDlg::EditChapter(CTreeItemChapter* t) -{ - CConvertChapDlg dlg(this); - - int h = (int)(t->m_chap.rt/10000000/60/60); - int m = (int)(t->m_chap.rt/10000000/60%60); - int s = (int)(t->m_chap.rt/10000000%60); - int ms = (int)(t->m_chap.rt/10000%1000); - - dlg.m_name = t->m_chap.name; - dlg.m_time.Format(_T("%02d:%02d:%02d.%03d"), h, m, s, ms); - - if(IDOK != dlg.DoModal()) - return false; - - TCHAR c; - if(_stscanf(dlg.m_time, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms) != 7) - return false; - - t->m_chap.name = dlg.m_name; - t->m_chap.rt = ((((__int64)h*60+m)*60+s)*1000+ms)*10000; - - t->Update(); - - return true; -} - -void CConvertDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Control(pDX, IDC_TREE1, m_tree); - DDX_Text(pDX, IDC_EDIT1, m_fn); -} - -BOOL CConvertDlg::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) - return TRUE; - - return __super::PreTranslateMessage(pMsg); -} - -BOOL CConvertDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE); - SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE); - - AddAnchor(IDC_TREE1, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDC_EDIT1, BOTTOM_LEFT, BOTTOM_RIGHT); - AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT); - AddAnchor(IDC_HLINE, BOTTOM_LEFT, BOTTOM_RIGHT); - AddAnchor(IDC_BUTTON2, BOTTOM_CENTER); - AddAnchor(IDC_BUTTON3, BOTTOM_CENTER); - AddAnchor(IDC_BUTTON4, BOTTOM_CENTER); - - CSize s(400, 200); - SetMinTrackSize(s); - - m_streamtypesbm.LoadBitmap(IDB_STREAMTYPES); - m_streamtypes.Create(16, 18, ILC_MASK|ILC_COLOR32, 0, 4); - m_streamtypes.Add(&m_streamtypesbm, 0xffffff); - m_tree.SetImageList(&m_streamtypes, TVSIL_NORMAL); - - GetWindowText(m_title); - m_nIDEventStatus = SetTimer(1, 1000, NULL); - - HRESULT hr; - m_pMux = new CDSMMuxerFilter(NULL, &hr, false, false); - - m_pGB = new CFGManagerMuxer(_T("CFGManagerMuxer"), NULL); - m_pGB->AddToROT(); - - if(FAILED(m_pGB->AddFilter(m_pMux, L"Mux")) - || !(m_pMC = m_pGB) || !(m_pME = m_pGB) || !(m_pMS = m_pMux) - || FAILED(m_pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0))) - { - MessageBeep(-1); - SendMessage(WM_CLOSE); - return TRUE; - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CConvertDlg::OnOK() -{ -} - -BEGIN_MESSAGE_MAP(CConvertDlg, CResizableDialog) - ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify) - ON_WM_DROPFILES() - ON_WM_CLOSE() - ON_NOTIFY(NM_CLICK, IDC_TREE1, OnNMClickTree1) - ON_NOTIFY(NM_RCLICK, IDC_TREE1, OnNMRclickTree1) - ON_NOTIFY(NM_DBLCLK, IDC_TREE1, OnNMDblclkTree1) - ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1) - ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1) - ON_WM_TIMER() - ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2) - ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateButton2) - ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3) - ON_UPDATE_COMMAND_UI(IDC_BUTTON3, OnUpdateButton3) - ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4) - ON_UPDATE_COMMAND_UI(IDC_BUTTON4, OnUpdateButton4) -END_MESSAGE_MAP() - -// CConvertDlg message handlers - -LRESULT CConvertDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam) -{ - HRESULT hr = S_OK; - - LONG evCode, evParam1, evParam2; - while(m_pME && SUCCEEDED(m_pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0))) - { - hr = m_pME->FreeEventParams(evCode, evParam1, evParam2); - - bool fStop = false; - - if(EC_COMPLETE == evCode) - { - fStop = true; - } - else if(EC_ERRORABORT == evCode) - { - fStop = true; - - CString errmsg; - LPVOID lpMsgBuf; - if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL)) - { - errmsg = (LPCTSTR)lpMsgBuf; - LocalFree(lpMsgBuf); - } - - CString str; - str.Format(_T("Could not complete conversion, the output file is most likely unusable.\n\nError code: 0x%08x"), evParam1); - if(!errmsg.IsEmpty()) str += _T(" (") + errmsg + _T(")"); - AfxMessageBox(str, MB_OK); - } - - if(fStop && m_pMC) - { - m_pMC->Stop(); - m_tree.EnableWindow(TRUE); - } - } - - return hr; -} - -void CConvertDlg::OnDropFiles(HDROP hDropInfo) -{ - for(int i = 0, j = DragQueryFile(hDropInfo, 0xffffffff, 0, 0); i < j; i++) - { - CString fn; - fn.ReleaseBufferSetLength(DragQueryFile(hDropInfo, i, fn.GetBuffer(MAX_PATH), MAX_PATH)); - - AddFile(fn); - } - - __super::OnDropFiles(hDropInfo); -} - -void CConvertDlg::OnClose() -{ - HTREEITEM hTI = m_tree.GetRootItem(); - while(hTI) - { - HTREEITEM hTINext = m_tree.GetNextSiblingItem(hTI); - DeleteItem(hTI); - hTI = hTINext; - } - - m_pGB->RemoveFromROT(); - m_pGB = NULL; - - __super::OnClose(); -} - -void CConvertDlg::OnNMClickTree1(NMHDR* pNMHDR, LRESULT* pResult) -{ - CPoint sp, cp; - HTREEITEM hTI = HitTest(sp, cp); - if(!hTI) return; - m_tree.SelectItem(hTI); - - *pResult = 0; -} - -void CConvertDlg::OnNMRclickTree1(NMHDR* pNMHDR, LRESULT* pResult) -{ - CPoint sp, cp; - HTREEITEM hTI = HitTest(sp, cp); - - if(hTI) - { - m_tree.SelectItem(hTI); - - CTreeItem* t = (CTreeItem*)m_tree.GetItemData(hTI); - - if(dynamic_cast(t)) - ShowPinPopup(hTI, sp); - else if(dynamic_cast(t)) - ShowFilePopup(hTI, sp); - else if(dynamic_cast(t)) - ShowResourceFolderPopup(hTI, sp); - else if(dynamic_cast(t)) - ShowResourcePopup(hTI, sp); - else if(dynamic_cast(t)) - ShowChapterFolderPopup(hTI, sp); - else if(dynamic_cast(t)) - ShowChapterPopup(hTI, sp); - } - else - { - ShowPopup(sp); - } - - *pResult = 0; -} - -void CConvertDlg::OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult) -{ - CPoint sp, cp; - HTREEITEM hTI = HitTest(sp, cp); - - if(hTI) - { - CTreeItem* t = (CTreeItem*)m_tree.GetItemData(hTI); - - if(CTreeItemPin* t2 = dynamic_cast(t)) - { - CComPtr pPinTo; - t2->m_pPin->ConnectedTo(&pPinTo); - - if(CComQIPtr pPB = pPinTo) - EditProperties(pPB); - } - else if(CTreeItemResource* t2 = dynamic_cast(t)) - { - EditResource(t2); - } - else if(CTreeItemChapter* t2 = dynamic_cast(t)) - { - EditChapter(t2); - } - } - - *pResult = 0; -} - -void CConvertDlg::OnBnClickedButton1() -{ - UpdateData(); - - CFileDialog fd(FALSE, _T(".dsm"), m_fn, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, - _T("DirectShow Media file|*.dsm|All files|*.*|"), this, 0); - - if(fd.DoModal() == IDOK) - { - m_fn = fd.GetPathName(); - UpdateData(FALSE); - } -} - -void CConvertDlg::OnUpdateButton1(CCmdUI* pCmdUI) -{ - OAFilterState fs; - pCmdUI->Enable(m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs == State_Stopped); -} - -void CConvertDlg::OnTimer(UINT nIDEvent) -{ - if(nIDEvent == m_nIDEventStatus && m_pMS && m_pMC) - { - OAFilterState fs; - if(SUCCEEDED(m_pMC->GetState(0, &fs)) && fs != State_Stopped) - { - GUID tf; - m_pMS->GetTimeFormat(&tf); - - REFERENCE_TIME rtCur, rtDur; - HRESULT hr = m_pMS->GetDuration(&rtDur); - m_pMS->GetCurrentPosition(&rtCur); - - CString str; - if(hr == S_OK && rtDur != 0) str.Format(_T("%.2f%%"), 1.0 * (rtCur * 100) / rtDur); - else if(hr == S_OK && rtDur == 0) str = _T("Live"); - else if(tf == TIME_FORMAT_BYTE) str.Format(_T("%.2fKB"), 1.0 * rtCur / 1024); - else if(tf == TIME_FORMAT_MEDIA_TIME) str.Format(_T("%02d:%02d:%02d"), int(rtCur/3600000000)%60, int(rtCur/60000000)%60, int(rtCur/1000000)%60); - else str = _T("Please Wait"); - - SetWindowText(_T("Converting - ") + str); - } - else - { - SetWindowText(m_title); - } - } - - __super::OnTimer(nIDEvent); -} - -void CConvertDlg::OnBnClickedButton2() -{ - OAFilterState fs; - if(FAILED(m_pMC->GetState(0, &fs))) - return; - - if(fs != State_Stopped) - { - m_pMC->Run(); - return; - } - - UpdateData(); - - if(!ConvertFile(m_fn)) - { - AfxMessageBox(_T("Failed to start conversion")); - } -} - -void CConvertDlg::OnUpdateButton2(CCmdUI* pCmdUI) -{ - int nIn, nOut, nInC, nOutC; - CountPins(m_pMux, nIn, nOut, nInC, nOutC); - - OAFilterState fs; - pCmdUI->Enable(nInC > 0 && GetDlgItem(IDC_EDIT1)->GetWindowTextLength() > 0 - && m_pMS && m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs != State_Running); -} - -void CConvertDlg::OnBnClickedButton3() -{ - if(m_pMC) m_pMC->Pause(); -} - -void CConvertDlg::OnUpdateButton3(CCmdUI* pCmdUI) -{ - OAFilterState fs; - pCmdUI->Enable(m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs == State_Running); -} - -void CConvertDlg::OnBnClickedButton4() -{ - if(m_pMC) m_pMC->Stop(); - m_tree.EnableWindow(TRUE); -} - -void CConvertDlg::OnUpdateButton4(CCmdUI* pCmdUI) -{ - OAFilterState fs; - pCmdUI->Enable(m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs != State_Stopped); -} - -// -// CFilterTreeCtrl -// - -CFilterTreeCtrl::CFilterTreeCtrl() -{ -} - -void CFilterTreeCtrl::PreSubclassWindow() -{ - EnableToolTips(TRUE); - - __super::PreSubclassWindow(); -} - -INT_PTR CFilterTreeCtrl::OnToolHitTest(CPoint p, TOOLINFO* pTI) const -{ - UINT nFlags; - HTREEITEM hTI = HitTest(p, &nFlags); - if(nFlags & TVHT_ONITEM) - { - CRect r; - GetItemRect(hTI, r, TRUE); - pTI->hwnd = m_hWnd; - pTI->uId = (UINT)hTI; - pTI->lpszText = LPSTR_TEXTCALLBACK; - pTI->rect = r; - return pTI->uId; - } - - return -1; -} - -BEGIN_MESSAGE_MAP(CFilterTreeCtrl, CTreeCtrl) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText) -END_MESSAGE_MAP() - -BOOL CFilterTreeCtrl::OnToolTipText(UINT id, NMHDR* pNMHDR, LRESULT* pResult) -{ - TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; - TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; - - UINT nID = pNMHDR->idFrom; - - if(nID == (UINT)m_hWnd - && (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) - || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))) - return FALSE; - - ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT)1000); - - HTREEITEM hTI = (HTREEITEM)nID; - - CString str; - static CStringA m_strTipTextA; - static CStringW m_strTipTextW; - - CConvertDlg::CTreeItem* t = (CConvertDlg::CTreeItem*)GetItemData(hTI); - if(!t || !t->ToolTip(str)) return FALSE; - - m_strTipTextA = str; - m_strTipTextW = str; - - if(pNMHDR->code == TTN_NEEDTEXTA) pTTTA->lpszText = (LPSTR)(LPCSTR)m_strTipTextA; - else pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW; - - *pResult = 0; - - return TRUE; // message was handled -} - -// -// CConvertDlg::CTreeItem* -// - -CConvertDlg::CTreeItem::CTreeItem(CTreeCtrl& tree, HTREEITEM hTIParent) - : m_tree(tree) -{ - m_hTI = m_tree.InsertItem(_T(""), hTIParent); - m_tree.SetItemData(m_hTI, (DWORD_PTR)this); - Update(); -} - -CConvertDlg::CTreeItem::~CTreeItem() -{ -} - -void CConvertDlg::CTreeItem::SetLabel(LPCTSTR label) -{ - m_tree.SetItemText(m_hTI, label); -} - -void CConvertDlg::CTreeItem::SetImage(int nImage, int nSelectedImage) -{ - m_tree.SetItemImage(m_hTI, nImage, nSelectedImage); -} - -// - -CConvertDlg::CTreeItemFilter::CTreeItemFilter(IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItem(tree, hTIParent) - , m_pBF(pBF) -{ - Update(); -} - -void CConvertDlg::CTreeItemFilter::Update() -{ - SetLabel(CString(GetFilterName(m_pBF))); -} - -// - -CConvertDlg::CTreeItemFile::CTreeItemFile(CString fn, IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItemFilter(pBF, tree, hTIParent) - , m_fn(fn) -{ - Update(); -} - -void CConvertDlg::CTreeItemFile::Update() -{ - CPath path = m_fn; - path.StripPath(); - SetLabel(path); -} - -bool CConvertDlg::CTreeItemFile::ToolTip(CString& str) -{ - str = m_fn; - return true; -} - -// - -CConvertDlg::CTreeItemPin::CTreeItemPin(IPin* pPin, CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItem(tree, hTIParent) - , m_pPin(pPin) -{ - Update(); -} - -void CConvertDlg::CTreeItemPin::Update() -{ - if(!m_pPin) {ASSERT(0); return;} - - CString label = GetPinName(m_pPin); - if(!IsConnected()) label = _T("[D] ") + label; - SetLabel(label); - - CMediaType mt; - if(S_OK == m_pPin->ConnectionMediaType(&mt)) - { - if(mt.majortype == MEDIATYPE_Video) SetImage(1, 1); - else if(mt.majortype == MEDIATYPE_Audio) SetImage(2, 2); - else if(mt.majortype == MEDIATYPE_Text || mt.majortype == MEDIATYPE_Subtitle) SetImage(3, 3); - } -} - -bool CConvertDlg::CTreeItemPin::ToolTip(CString& str) -{ - CMediaTypeEx mt; - if(FAILED(m_pPin->ConnectionMediaType(&mt))) return false; - str = mt.ToString(m_pPin); - return true; -} - -bool CConvertDlg::CTreeItemPin::IsConnected() -{ - CComPtr pPinTo; - return m_pPin && SUCCEEDED(m_pPin->ConnectedTo(&pPinTo)) && pPinTo; -} - -// - -CConvertDlg::CTreeItemResourceFolder::CTreeItemResourceFolder(CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItem(tree, hTIParent) -{ - Update(); -} - -void CConvertDlg::CTreeItemResourceFolder::Update() -{ - SetLabel(_T("Resources")); -} - -bool CConvertDlg::CTreeItemResourceFolder::ToolTip(CString& str) -{ - if(!m_tree.ItemHasChildren(m_hTI)) - return false; - - int files = 0; - float size = 0; - - HTREEITEM hChildItem = m_tree.GetChildItem(m_hTI); - - while(hChildItem != NULL) - { - HTREEITEM hNextItem = m_tree.GetNextItem(hChildItem, TVGN_NEXT); - if(CTreeItemResource* t = dynamic_cast((CTreeItem*)m_tree.GetItemData(hChildItem))) - size += t->m_res.data.GetCount(), files++; - hChildItem = hNextItem; - } - - size /= 1024; - if(size < 1024) str.Format(_T("%d file(s), %.2f KB"), files, size); - else str.Format(_T("%d file(s), %.2f MB"), files, size/1024); - - return true; -} - -// - -CConvertDlg::CTreeItemResource::CTreeItemResource(const CDSMResource& res, CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItem(tree, hTIParent) -{ - m_res = res; - Update(); -} - -CConvertDlg::CTreeItemResource::~CTreeItemResource() -{ -} - -void CConvertDlg::CTreeItemResource::Update() -{ - SetLabel(CString(m_res.name)); - - CStringW mime = m_res.mime; - mime.Trim(); - mime.MakeLower(); - if(mime == L"application/x-truetype-font") SetImage(4, 4); - else if(mime.Find(L"text/") == 0) SetImage(5, 5); - else SetImage(6, 6); -} - -bool CConvertDlg::CTreeItemResource::ToolTip(CString& str) -{ - if(!m_res.mime.IsEmpty()) str = CString(m_res.mime) + _T("\r\n\r\n"); - if(!m_res.desc.IsEmpty()) str += CString(m_res.desc); - str.Trim(); - return true; -} - -// - -CConvertDlg::CTreeItemChapterFolder::CTreeItemChapterFolder(CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItem(tree, hTIParent) -{ - Update(); -} - -void CConvertDlg::CTreeItemChapterFolder::Update() -{ - SetLabel(_T("Chapters")); -} - -// - -CConvertDlg::CTreeItemChapter::CTreeItemChapter(const CDSMChapter& chap, CTreeCtrl& tree, HTREEITEM hTIParent) - : CTreeItem(tree, hTIParent) -{ - m_chap = chap; - Update(); -} - -void CConvertDlg::CTreeItemChapter::Update() -{ - REFERENCE_TIME rt = m_chap.rt; - rt /= 10000; - int ms = (int)(rt%1000); - rt /= 1000; - int s = (int)(rt%60); - rt /= 60; - int m = (int)(rt%60); - rt /= 60; - int h = (int)(rt); - - CString label; - label.Format(_T("%02d:%02d:%02d.%03d - %s"), h, m, s, ms, CString(m_chap.name)); - SetLabel(label); - - SetImage(7, 7); -} diff --git a/src/apps/mplayerc/ConvertDlg.h b/src/apps/mplayerc/ConvertDlg.h deleted file mode 100644 index 72bf7a271..000000000 --- a/src/apps/mplayerc/ConvertDlg.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once -#include "IGraphBuilder2.h" -#include "..\..\DSUtil\DSMPropertyBag.h" - -class CFilterTreeCtrl : public CTreeCtrl -{ -public: - CFilterTreeCtrl(); - -protected: - virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; - virtual void PreSubclassWindow(); - -public: - DECLARE_MESSAGE_MAP() - afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult); -}; - -// CConvertDlg dialog - -class CConvertDlg : public CResizableDialog -{ -public: - class CTreeItem - { - protected: - CTreeCtrl& m_tree; - HTREEITEM m_hTI; - - public: - CTreeItem(CTreeCtrl& tree, HTREEITEM hTIParent); - virtual ~CTreeItem(); - virtual void Update() {} - virtual bool ToolTip(CString& str) {return false;} - void SetLabel(LPCTSTR label); - void SetImage(int nImage, int nSelectedImage); - operator HTREEITEM() {return m_hTI;} - }; - - class CTreeItemFilter : public CTreeItem - { - public: - CComPtr m_pBF; - CTreeItemFilter(IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent); - void Update(); - }; - - class CTreeItemFile : public CTreeItemFilter - { - public: - CString m_fn; - CTreeItemFile(CString fn, IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent); - void Update(); - bool ToolTip(CString& str); - }; - - class CTreeItemPin : public CTreeItem - { - public: - CComPtr m_pPin; - CTreeItemPin(IPin* pPin, CTreeCtrl& tree, HTREEITEM hTIParent); - void Update(); - bool ToolTip(CString& str); - bool IsConnected(); - }; - - class CTreeItemResourceFolder : public CTreeItem - { - public: - CTreeItemResourceFolder(CTreeCtrl& tree, HTREEITEM hTIParent); - void Update(); - bool ToolTip(CString& str); - }; - - class CTreeItemResource : public CTreeItem - { - public: - CDSMResource m_res; - CTreeItemResource(const CDSMResource& res, CTreeCtrl& tree, HTREEITEM hTIParent); - ~CTreeItemResource(); - void Update(); - bool ToolTip(CString& str); - }; - - class CTreeItemChapterFolder : public CTreeItem - { - public: - CTreeItemChapterFolder(CTreeCtrl& tree, HTREEITEM hTIParent); - void Update(); - }; - - class CTreeItemChapter : public CTreeItem - { - public: - CDSMChapter m_chap; - CTreeItemChapter(const CDSMChapter& chap, CTreeCtrl& tree, HTREEITEM hTIParent); - void Update(); - }; - -private: - CComPtr m_pGB; - CComPtr m_pMux; - CComQIPtr m_pMC; - CComQIPtr m_pME; - CComQIPtr m_pMS; - - CString m_title; - UINT m_nIDEventStatus; - - CBitmap m_streamtypesbm; - CImageList m_streamtypes; - - CList m_pTIs; - - void AddFile(CString fn); - bool ConvertFile(LPCTSTR fn, IPin* pPin = NULL); - void AddFilter(HTREEITEM hTI, IBaseFilter* pBF); - void DeleteFilter(IBaseFilter* pBF); - void DeleteItem(HTREEITEM hTI); - void DeleteChildren(HTREEITEM hTI); - - HTREEITEM HitTest(CPoint& sp, CPoint& cp); - - void ShowPopup(CPoint p); - void ShowFilePopup(HTREEITEM hTI, CPoint p); - void ShowPinPopup(HTREEITEM hTI, CPoint p); - void ShowResourceFolderPopup(HTREEITEM hTI, CPoint p); - void ShowResourcePopup(HTREEITEM hTI, CPoint p); - void ShowChapterFolderPopup(HTREEITEM hTI, CPoint p); - void ShowChapterPopup(HTREEITEM hTI, CPoint p); - - bool EditProperties(IDSMPropertyBag* pPB); - bool EditResource(CTreeItemResource* t); - bool EditChapter(CTreeItemChapter* t); - -public: - CConvertDlg(CWnd* pParent = NULL); // standard constructor - virtual ~CConvertDlg(); - -// Dialog Data - enum { IDD = IDD_CONVERT_DLG }; - CFilterTreeCtrl m_tree; - CString m_fn; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual BOOL OnInitDialog(); - virtual void OnOK(); - - DECLARE_MESSAGE_MAP() - -public: - afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam); - afx_msg void OnDropFiles(HDROP hDropInfo); - afx_msg void OnClose(); - afx_msg void OnNMClickTree1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnBnClickedButton1(); - afx_msg void OnUpdateButton1(CCmdUI* pCmdUI); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg void OnBnClickedButton2(); - afx_msg void OnBnClickedButton3(); - afx_msg void OnBnClickedButton4(); - afx_msg void OnUpdateButton2(CCmdUI* pCmdUI); - afx_msg void OnUpdateButton3(CCmdUI* pCmdUI); - afx_msg void OnUpdateButton4(CCmdUI* pCmdUI); -}; diff --git a/src/apps/mplayerc/ConvertPropsDlg.cpp b/src/apps/mplayerc/ConvertPropsDlg.cpp deleted file mode 100644 index da420438f..000000000 --- a/src/apps/mplayerc/ConvertPropsDlg.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ConvertPropsDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "ConvertPropsDlg.h" - - -// CConvertPropsDlg dialog - -CConvertPropsDlg::CConvertPropsDlg(bool fPin, CWnd* pParent /*=NULL*/) - : CResizableDialog(CConvertPropsDlg::IDD, pParent) - , m_fPin(fPin) -{ -} - -CConvertPropsDlg::~CConvertPropsDlg() -{ -} - -void CConvertPropsDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Control(pDX, IDC_COMBO1, m_fcc); - DDX_Control(pDX, IDC_EDIT1, m_text); - DDX_Control(pDX, IDC_LIST1, m_list); -} - - -BEGIN_MESSAGE_MAP(CConvertPropsDlg, CResizableDialog) - ON_NOTIFY(NM_CLICK, IDC_LIST1, OnNMClickList1) - ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1) - ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1) - ON_CBN_EDITCHANGE(IDC_COMBO1, OnCbnEditchangeCombo1) - ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1) - ON_NOTIFY(LVN_KEYDOWN, IDC_LIST1, OnLvnKeydownList1) -END_MESSAGE_MAP() - - -// CConvertPropsDlg message handlers - -BOOL CConvertPropsDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - AddAnchor(IDC_COMBO1, TOP_LEFT); - AddAnchor(IDC_EDIT1, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_BUTTON1, TOP_RIGHT); - AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDOK, BOTTOM_CENTER); - AddAnchor(IDCANCEL, BOTTOM_CENTER); - - if(m_fPin) - { - m_fcc.AddString(_T("NAME")); - m_fcc.AddString(_T("LANG")); - m_fcc.AddString(_T("DESC")); - m_fcc.AddString(_T("SGRP")); - } - else - { - m_fcc.AddString(_T("TITL")); - m_fcc.AddString(_T("AUTH")); - m_fcc.AddString(_T("RTNG")); - m_fcc.AddString(_T("CPYR")); - m_fcc.AddString(_T("DESC")); - } - - m_list.InsertColumn(0, _T("ID"), LVCFMT_LEFT, 75); - m_list.InsertColumn(1, _T("Text"), LVCFMT_LEFT, 280); - - m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT); - - POSITION pos = m_props.GetStartPosition(); - while(pos) - { - CString key, value; - m_props.GetNextAssoc(pos, key, value); - SetItem(key, value); - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CConvertPropsDlg::SetItem(CString key, CString value) -{ - LVFINDINFO fi; - fi.flags = LVFI_STRING; - fi.psz = key; - - int i = m_list.FindItem(&fi); - if(i < 0) i = m_list.InsertItem(m_list.GetItemCount(), _T("")); - - key.Trim(); - value.Trim(); - - if(value.IsEmpty()) - { - m_list.DeleteItem(i); - return; - } - - if(key == _T("LANG") && value.GetLength() != 3) - { - m_list.DeleteItem(i); - AfxMessageBox(_T("LANG has to be a three letter ISO 639-2 language code."), MB_OK); - return; - } - - m_list.SetItemText(i, 0, key); - m_list.SetItemText(i, 1, value); -} - -void CConvertPropsDlg::OnOK() -{ - m_props.RemoveAll(); - - for(int i = 0; i < m_list.GetItemCount(); i++) - m_props[m_list.GetItemText(i, 0)] = m_list.GetItemText(i, 1); - - __super::OnOK(); -} - -void CConvertPropsDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR; - - if(lpnmlv->iItem >= 0) - { - m_fcc.SetWindowText(m_list.GetItemText(lpnmlv->iItem, 0)); - m_text.SetWindowText(m_list.GetItemText(lpnmlv->iItem, 1)); - } - - *pResult = 0; -} - -void CConvertPropsDlg::OnBnClickedButton1() -{ - CString key, value; - m_fcc.GetWindowText(key); - m_text.GetWindowText(value); - if(key.GetLength() != 4) {AfxMessageBox(_T("ID must be 4 characters long!"), MB_OK); return;} - SetItem(key, value); -} - -void CConvertPropsDlg::OnUpdateButton1(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(GetDlgItem(IDC_EDIT1)->GetWindowTextLength() > 0); -} - -void CConvertPropsDlg::OnCbnEditchangeCombo1() -{ - int i = m_fcc.GetCurSel(); - if(i < 0) return; - - CString key; - m_fcc.GetLBText(i, key); - - LVFINDINFO fi; - fi.flags = LVFI_STRING; - fi.psz = key; - - i = m_list.FindItem(&fi); - if(i > 0) m_text.SetWindowText(m_list.GetItemText(i, 1)); -} - -void CConvertPropsDlg::OnCbnSelchangeCombo1() -{ - OnCbnEditchangeCombo1(); -} - -void CConvertPropsDlg::OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast(pNMHDR); - - int i = m_fcc.GetCurSel(); - if(i >= 0) m_list.DeleteItem(i); - - *pResult = 0; -} diff --git a/src/apps/mplayerc/ConvertPropsDlg.h b/src/apps/mplayerc/ConvertPropsDlg.h deleted file mode 100644 index 53824eed6..000000000 --- a/src/apps/mplayerc/ConvertPropsDlg.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once -#include "..\..\DSUtil\DSMPropertyBag.h" -#include "afxwin.h" -#include "afxcmn.h" - -// CConvertPropsDlg dialog - -class CConvertPropsDlg : public CResizableDialog -{ -private: - bool m_fPin; - void SetItem(CString key, CString value); - -public: - CConvertPropsDlg(bool fPin, CWnd* pParent = NULL); // standard constructor - virtual ~CConvertPropsDlg(); - - CAtlStringMap<> m_props; - -// Dialog Data - enum { IDD = IDD_CONVERTPROPS_DLG }; - CComboBox m_fcc; - CEdit m_text; - CListCtrl m_list; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - virtual void OnOK(); - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnBnClickedButton1(); - afx_msg void OnUpdateButton1(CCmdUI* pCmdUI); - afx_msg void OnCbnEditchangeCombo1(); - afx_msg void OnCbnSelchangeCombo1(); - afx_msg void OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult); -}; diff --git a/src/apps/mplayerc/ConvertResDlg.cpp b/src/apps/mplayerc/ConvertResDlg.cpp deleted file mode 100644 index 37d632801..000000000 --- a/src/apps/mplayerc/ConvertResDlg.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// ConvertResDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "ConvertResDlg.h" - -// CConvertResDlg dialog - -CConvertResDlg::CConvertResDlg(CWnd* pParent /*=NULL*/) - : CResizableDialog(CConvertResDlg::IDD, pParent) - , m_name(_T("")) - , m_desc(_T("")) -{ -} - -CConvertResDlg::~CConvertResDlg() -{ -} - -void CConvertResDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Text(pDX, IDC_EDIT3, m_name); - DDX_Text(pDX, IDC_COMBO1, m_mime); - DDX_Control(pDX, IDC_COMBO1, m_mimectrl); - DDX_Text(pDX, IDC_EDIT2, m_desc); -} - -BOOL CConvertResDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - AddAnchor(IDC_EDIT3, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_EDIT2, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDOK, BOTTOM_CENTER); - AddAnchor(IDCANCEL, BOTTOM_CENTER); - - CRegKey key; - CString str(_T("MIME\\Database\\Content Type")); - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, str, KEY_READ)) - { - CAtlStringMap mimes; - - TCHAR buff[256]; - DWORD len = countof(buff); - for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++, len = countof(buff)) - { - CRegKey mime; - TCHAR ext[64]; - ULONG len = countof(ext); - if(ERROR_SUCCESS == mime.Open(HKEY_CLASSES_ROOT, str + _T("\\") + buff, KEY_READ) - && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len)) - { - CString mime = CString(buff).MakeLower(); - mimes[mime] = true; - m_mimectrl.AddString(mime); - } - } - - static TCHAR* moremimes[] = - { - _T("application/octet-stream"), - _T("application/zip"), - _T("application/rar"), - _T("application/x-truetype-font"), - }; - - for(int i = 0; i < countof(moremimes); i++) - if(!mimes.Lookup(moremimes[i])) - m_mimectrl.AddString(moremimes[i]); - } - - m_desc.Replace(_T("\n"), _T("\r\n")); - - UpdateData(FALSE); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CConvertResDlg::OnOK() -{ - UpdateData(); - - m_name.Trim(); - m_mime.Trim(); - m_desc.Replace(_T("\r\n"), _T("\r")); - m_desc.Trim(); - - __super::OnOK(); -} - -BEGIN_MESSAGE_MAP(CConvertResDlg, CResizableDialog) - ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK) -END_MESSAGE_MAP() - -// CConvertResDlg message handlers - -void CConvertResDlg::OnUpdateOK(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(GetDlgItem(IDC_EDIT3)->GetWindowTextLength() > 0 && GetDlgItem(IDC_COMBO1)->GetWindowTextLength() > 0); -} diff --git a/src/apps/mplayerc/ConvertResDlg.h b/src/apps/mplayerc/ConvertResDlg.h deleted file mode 100644 index 45d54b946..000000000 --- a/src/apps/mplayerc/ConvertResDlg.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once -#include "afxwin.h" - - -// CConvertResDlg dialog - -class CConvertResDlg : public CResizableDialog -{ -public: - CConvertResDlg(CWnd* pParent = NULL); // standard constructor - virtual ~CConvertResDlg(); - -// Dialog Data - enum { IDD = IDD_CONVERTRES_DLG }; - CString m_name; - CString m_mime; - CComboBox m_mimectrl; - CString m_desc; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - virtual void OnOK(); - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnUpdateOK(CCmdUI* pCmdUI); -}; diff --git a/src/apps/mplayerc/DX7AllocatorPresenter.cpp b/src/apps/mplayerc/DX7AllocatorPresenter.cpp deleted file mode 100644 index 9b57feee0..000000000 --- a/src/apps/mplayerc/DX7AllocatorPresenter.cpp +++ /dev/null @@ -1,1321 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "mplayerc.h" -#include -#include -#include "..\..\DSUtil\DSUtil.h" - -#include -#include "DX7AllocatorPresenter.h" -#include -#include -#include "..\..\SubPic\DX7SubPic.h" -#include "..\..\..\include\RealMedia\pntypes.h" -#include "..\..\..\include\RealMedia\pnwintyp.h" -#include "..\..\..\include\RealMedia\pncom.h" -#include "..\..\..\include\RealMedia\rmavsurf.h" -#include "IQTVideoSurface.h" - -#include "IPinHook.h" - -bool IsVMR7InGraph(IFilterGraph* pFG) -{ - BeginEnumFilters(pFG, pEF, pBF) - if(CComQIPtr(pBF)) return(true); - EndEnumFilters - return(false); -} - -namespace DSObjects -{ - -class CDX7AllocatorPresenter - : public ISubPicAllocatorPresenterImpl -{ -protected: - CSize m_ScreenSize; - - CComPtr m_pDD; - CComQIPtr m_pD3D; - CComPtr m_pD3DDev; - - CComPtr m_pPrimary, m_pBackBuffer; - CComPtr m_pVideoTexture, m_pVideoSurface; - - virtual HRESULT CreateDevice(); - virtual HRESULT AllocSurfaces(); - virtual void DeleteSurfaces(); - -public: - CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr); - - // ISubPicAllocatorPresenter - STDMETHODIMP CreateRenderer(IUnknown** ppRenderer); - STDMETHODIMP_(bool) Paint(bool fAll); - STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size); -}; - -class CVMR7AllocatorPresenter - : public CDX7AllocatorPresenter - , public IVMRSurfaceAllocator - , public IVMRImagePresenter - , public IVMRWindowlessControl -{ - CComPtr m_pIVMRSurfAllocNotify; - CComPtr m_pSA; - - HRESULT CreateDevice(); - void DeleteSurfaces(); - - bool m_fUseInternalTimer; - -public: - CVMR7AllocatorPresenter(HWND hWnd, HRESULT& hr); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // ISubPicAllocatorPresenter - STDMETHODIMP CreateRenderer(IUnknown** ppRenderer); - STDMETHODIMP_(void) SetTime(REFERENCE_TIME rtNow); - - // IVMRSurfaceAllocator - STDMETHODIMP AllocateSurface(DWORD_PTR dwUserID, VMRALLOCATIONINFO* lpAllocInfo, DWORD* lpdwBuffer, LPDIRECTDRAWSURFACE7* lplpSurface); - STDMETHODIMP FreeSurface(DWORD_PTR dwUserID); - STDMETHODIMP PrepareSurface(DWORD_PTR dwUserID, IDirectDrawSurface7* lpSurface, DWORD dwSurfaceFlags); - STDMETHODIMP AdviseNotify(IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify); - - // IVMRImagePresenter - STDMETHODIMP StartPresenting(DWORD_PTR dwUserID); - STDMETHODIMP StopPresenting(DWORD_PTR dwUserID); - STDMETHODIMP PresentImage(DWORD_PTR dwUserID, VMRPRESENTATIONINFO* lpPresInfo); - - // IVMRWindowlessControl - STDMETHODIMP GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight); - STDMETHODIMP GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight); - STDMETHODIMP GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight); - STDMETHODIMP SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect); - STDMETHODIMP GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect); - STDMETHODIMP GetAspectRatioMode(DWORD* lpAspectRatioMode); - STDMETHODIMP SetAspectRatioMode(DWORD AspectRatioMode); - STDMETHODIMP SetVideoClippingWindow(HWND hwnd); - STDMETHODIMP RepaintVideo(HWND hwnd, HDC hdc); - STDMETHODIMP DisplayModeChanged(); - STDMETHODIMP GetCurrentImage(BYTE** lpDib); - STDMETHODIMP SetBorderColor(COLORREF Clr); - STDMETHODIMP GetBorderColor(COLORREF* lpClr); - STDMETHODIMP SetColorKey(COLORREF Clr); - STDMETHODIMP GetColorKey(COLORREF* lpClr); -}; - -class CRM7AllocatorPresenter - : public CDX7AllocatorPresenter - , public IRMAVideoSurface -{ - CComPtr m_pVideoSurfaceOff; - CComPtr m_pVideoSurfaceYUY2; - - RMABitmapInfoHeader m_bitmapInfo; - RMABitmapInfoHeader m_lastBitmapInfo; - -protected: - HRESULT AllocSurfaces(); - void DeleteSurfaces(); - -public: - CRM7AllocatorPresenter(HWND hWnd, HRESULT& hr); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IRMAVideoSurface - STDMETHODIMP Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect); - STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo); - STDMETHODIMP OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect); - STDMETHODIMP EndOptimizedBlt(); - STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType); - STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType); -}; - -class CQT7AllocatorPresenter - : public CDX7AllocatorPresenter - , public IQTVideoSurface -{ - CComPtr m_pVideoSurfaceOff; - -protected: - HRESULT AllocSurfaces(); - void DeleteSurfaces(); - -public: - CQT7AllocatorPresenter(HWND hWnd, HRESULT& hr); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IQTVideoSurface - STDMETHODIMP BeginBlt(const BITMAP& bm); - STDMETHODIMP DoBlt(const BITMAP& bm); -}; - -} -using namespace DSObjects; - -// - -HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP) -{ - CheckPointer(ppAP, E_POINTER); - - *ppAP = NULL; - - HRESULT hr; - if(clsid == CLSID_VMR7AllocatorPresenter && !(*ppAP = new CVMR7AllocatorPresenter(hWnd, hr)) - || clsid == CLSID_RM7AllocatorPresenter && !(*ppAP = new CRM7AllocatorPresenter(hWnd, hr)) - || clsid == CLSID_QT7AllocatorPresenter && !(*ppAP = new CQT7AllocatorPresenter(hWnd, hr))) - return E_OUTOFMEMORY; - - if(*ppAP == NULL) - return E_FAIL; - - (*ppAP)->AddRef(); - - if(FAILED(hr)) - { - (*ppAP)->Release(); - *ppAP = NULL; - } - - return hr; -} - -// - -static HRESULT TextureBlt(CComPtr pD3DDev, CComPtr pTexture, Vector dst[4], CRect src) -{ - if(!pTexture) - return E_POINTER; - - HRESULT hr; - - do - { - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - if(FAILED(hr = pTexture->GetSurfaceDesc(&ddsd))) - break; - - float w = (float)ddsd.dwWidth; - float h = (float)ddsd.dwHeight; - - struct - { - float x, y, z, rhw; - float tu, tv; - } - pVertices[] = - { - {(float)dst[0].x, (float)dst[0].y, (float)dst[0].z, 1.0f/(float)dst[0].z, (float)src.left / w, (float)src.top / h}, - {(float)dst[1].x, (float)dst[1].y, (float)dst[1].z, 1.0f/(float)dst[1].z, (float)src.right / w, (float)src.top / h}, - {(float)dst[2].x, (float)dst[2].y, (float)dst[2].z, 1.0f/(float)dst[2].z, (float)src.left / w, (float)src.bottom / h}, - {(float)dst[3].x, (float)dst[3].y, (float)dst[3].z, 1.0f/(float)dst[3].z, (float)src.right / w, (float)src.bottom / h}, - }; - - for(int i = 0; i < countof(pVertices); i++) - { - pVertices[i].x -= 0.5; - pVertices[i].y -= 0.5; - } - - hr = pD3DDev->SetTexture(0, pTexture); - - pD3DDev->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); - pD3DDev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE); - pD3DDev->SetRenderState(D3DRENDERSTATE_BLENDENABLE, FALSE); - pD3DDev->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, FALSE); - - pD3DDev->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_LINEAR); - pD3DDev->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFN_LINEAR); - pD3DDev->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTFP_LINEAR); - - pD3DDev->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); - - // - - if(FAILED(hr = pD3DDev->BeginScene())) - break; - - hr = pD3DDev->DrawPrimitive(D3DPT_TRIANGLESTRIP, - D3DFVF_XYZRHW | D3DFVF_TEX1, - pVertices, 4, D3DDP_WAIT); - pD3DDev->EndScene(); - - // - - pD3DDev->SetTexture(0, NULL); - - return S_OK; - } - while(0); - - return E_FAIL; -} - -// -// CDX7AllocatorPresenter -// - -CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr) - : ISubPicAllocatorPresenterImpl(hWnd, hr) - , m_ScreenSize(0, 0) -{ - if(FAILED(hr)) return; - - if(FAILED(hr = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL)) - || FAILED(hr = m_pDD->SetCooperativeLevel(AfxGetMainWnd()->GetSafeHwnd(), DDSCL_NORMAL))) - return; - - if(!(m_pD3D = m_pDD)) {hr = E_NOINTERFACE; return;} - - hr = CreateDevice(); -} - -HRESULT CDX7AllocatorPresenter::CreateDevice() -{ - m_pD3DDev = NULL; - - m_pPrimary = NULL; - m_pBackBuffer = NULL; - - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - if(FAILED(m_pDD->GetDisplayMode(&ddsd)) - || ddsd.ddpfPixelFormat.dwRGBBitCount <= 8) - return DDERR_INVALIDMODE; - - m_ScreenSize.SetSize(ddsd.dwWidth, ddsd.dwHeight); - - HRESULT hr; - - // m_pPrimary - - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pPrimary, NULL))) - return hr; - - CComPtr pcClipper; - if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) - return hr; - pcClipper->SetHWnd(0, m_hWnd); - m_pPrimary->SetClipper(pcClipper); - - // m_pBackBuffer - - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = /*DDSCAPS_OFFSCREENPLAIN |*/ DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - ddsd.dwWidth = m_ScreenSize.cx; - ddsd.dwHeight = m_ScreenSize.cy; - if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pBackBuffer, NULL))) - return hr; - - pcClipper = NULL; - if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) - return hr; - BYTE rgnDataBuffer[1024]; - HRGN hrgn = CreateRectRgn(0, 0, ddsd.dwWidth, ddsd.dwHeight); - GetRegionData(hrgn, sizeof(rgnDataBuffer), (RGNDATA*)rgnDataBuffer); - DeleteObject(hrgn); - pcClipper->SetClipList((RGNDATA*)rgnDataBuffer, 0); - m_pBackBuffer->SetClipper(pcClipper); - - // m_pD3DDev - - if(FAILED(hr = m_pD3D->CreateDevice(IID_IDirect3DHALDevice, m_pBackBuffer, &m_pD3DDev))) // this seems to fail if the desktop size is too large (width or height >2048) - return hr; - - // - - CComPtr pSubPicProvider; - if(m_pSubPicQueue) m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider); - - CSize size; - switch(AfxGetAppSettings().nSPCMaxRes) - { - case 0: default: size = m_ScreenSize; break; - case 1: size.SetSize(1024, 768); break; - case 2: size.SetSize(800, 600); break; - case 3: size.SetSize(640, 480); break; - case 4: size.SetSize(512, 384); break; - case 5: size.SetSize(384, 288); break; - } - - if(m_pAllocator) - { - m_pAllocator->ChangeDevice(m_pD3DDev); - } - else - { - m_pAllocator = new CDX7SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex); - if(!m_pAllocator || FAILED(hr)) - return E_FAIL; - } - - hr = S_OK; - m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0 - ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr) - : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr); - if(!m_pSubPicQueue || FAILED(hr)) - return E_FAIL; - - if(pSubPicProvider) m_pSubPicQueue->SetSubPicProvider(pSubPicProvider); - - return S_OK; -} - -HRESULT CDX7AllocatorPresenter::AllocSurfaces() -{ - CAutoLock cAutoLock(this); - - AppSettings& s = AfxGetAppSettings(); - - m_pVideoTexture = NULL; - m_pVideoSurface = NULL; - - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY; - ddsd.dwWidth = m_NativeVideoSize.cx; - ddsd.dwHeight = m_NativeVideoSize.cy; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd.ddpfPixelFormat.dwRGBBitCount = 32; - ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF; - - if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) - { - ddsd.ddsCaps.dwCaps |= DDSCAPS_TEXTURE; -// ddsd.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS; -// ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000; - } - - HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL); - if(FAILED(hr)) - { - // FIXME: eh, dx9 has no problem creating a 32bpp surface under a 16bpp desktop, but dx7 fails here (textures are ok) - DDSURFACEDESC2 ddsd2; - INITDDSTRUCT(ddsd2); - if(!(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) - && SUCCEEDED(m_pDD->GetDisplayMode(&ddsd2)) - && ddsd2.ddpfPixelFormat.dwRGBBitCount == 16) - { - ddsd.ddpfPixelFormat.dwRGBBitCount = 16; - ddsd.ddpfPixelFormat.dwRBitMask = 0x0000F800; - ddsd.ddpfPixelFormat.dwGBitMask = 0x000007E0; - ddsd.ddpfPixelFormat.dwBBitMask = 0x0000001F; - hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL); - } - - if(FAILED(hr)) - return hr; - } - - if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) - m_pVideoTexture = m_pVideoSurface; - - DDBLTFX fx; - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - hr = m_pVideoSurface->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - return S_OK; -} - -void CDX7AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pVideoTexture = NULL; - m_pVideoSurface = NULL; -} - -// ISubPicAllocatorPresenter - -STDMETHODIMP CDX7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) -{ - return E_NOTIMPL; -} - -STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll) -{ - CAutoLock cAutoLock(this); - - if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top - || m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0 - || !m_pPrimary || !m_pBackBuffer || !m_pVideoSurface) - return(false); - - HRESULT hr; - - CRect rSrcVid(CPoint(0, 0), m_NativeVideoSize); - CRect rDstVid(m_VideoRect); - - CRect rSrcPri(CPoint(0, 0), m_WindowRect.Size()); - CRect rDstPri(m_WindowRect); - MapWindowRect(m_hWnd, HWND_DESKTOP, &rDstPri); - - if(fAll) - { - // clear the backbuffer - - CRect rl(0, 0, rDstVid.left, rSrcPri.bottom); - CRect rr(rDstVid.right, 0, rSrcPri.right, rSrcPri.bottom); - CRect rt(0, 0, rSrcPri.right, rDstVid.top); - CRect rb(0, rDstVid.bottom, rSrcPri.right, rSrcPri.bottom); - - DDBLTFX fx; - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - hr = m_pBackBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - // paint the video on the backbuffer - - if(!rDstVid.IsRectEmpty()) - { - if(m_pVideoTexture) - { - Vector v[4]; - Transform(rDstVid, v); - hr = TextureBlt(m_pD3DDev, m_pVideoTexture, v, rSrcVid); - } - else - { - hr = m_pBackBuffer->Blt(rDstVid, m_pVideoSurface, rSrcVid, DDBLT_WAIT, NULL); - } - } - - // paint the text on the backbuffer - - AlphaBltSubPic(rSrcPri.Size()); - } - - // wait vsync - - m_pDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL); - - // blt to the primary surface - - hr = m_pPrimary->Blt(rDstPri, m_pBackBuffer, rSrcPri, DDBLT_WAIT, NULL); - - if(hr == DDERR_SURFACELOST) - { - HRESULT hr = DDERR_WRONGMODE; // m_pDD->TestCooperativeLevel(); - - if(hr == DDERR_WRONGMODE) - { - DeleteSurfaces(); - if(SUCCEEDED(CreateDevice()) || FAILED(hr = AllocSurfaces())) - return(true); - } - - hr = S_OK; - } - - return(true); -} - -STDMETHODIMP CDX7AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size) -{ - CheckPointer(size, E_POINTER); - - HRESULT hr; - - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - if(FAILED(m_pVideoSurface->GetSurfaceDesc(&ddsd))) - return E_FAIL; - - if(ddsd.ddpfPixelFormat.dwRGBBitCount != 16 && ddsd.ddpfPixelFormat.dwRGBBitCount != 32) - return E_FAIL; - - DWORD required = sizeof(BITMAPINFOHEADER) + (ddsd.dwWidth*ddsd.dwHeight*32>>3); - if(!lpDib) {*size = required; return S_OK;} - if(*size < required) return E_OUTOFMEMORY; - *size = required; - - INITDDSTRUCT(ddsd); - if(FAILED(hr = m_pVideoSurface->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_NOSYSLOCK, NULL))) - { - // TODO - return hr; - } - - BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)lpDib; - memset(bih, 0, sizeof(BITMAPINFOHEADER)); - bih->biSize = sizeof(BITMAPINFOHEADER); - bih->biWidth = ddsd.dwWidth; - bih->biHeight = ddsd.dwHeight; - bih->biBitCount = 32; - bih->biPlanes = 1; - bih->biSizeImage = bih->biWidth*bih->biHeight*bih->biBitCount>>3; - - BitBltFromRGBToRGB( - bih->biWidth, bih->biHeight, - (BYTE*)(bih + 1), bih->biWidth*bih->biBitCount>>3, bih->biBitCount, - (BYTE*)ddsd.lpSurface + ddsd.lPitch*(ddsd.dwHeight-1), -(int)ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount); - - m_pVideoSurface->Unlock(NULL); - -/* - BitBltFromRGBToRGB( - w, h, - (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, - (BYTE*)bm.bmBits, bm.bmWidthBytes, bm.bmBitsPixel); - m_pVideoSurfaceOff->Unlock(NULL); - fOk = true; - } -*/ - - return S_OK; -} - -// -// CVMR7AllocatorPresenter -// - -#define MY_USER_ID 0x6ABE51 - -CVMR7AllocatorPresenter::CVMR7AllocatorPresenter(HWND hWnd, HRESULT& hr) - : CDX7AllocatorPresenter(hWnd, hr) - , m_fUseInternalTimer(false) -{ - if(FAILED(hr)) - return; - - if(FAILED(hr = m_pSA.CoCreateInstance(CLSID_AllocPresenter))) - { - hr = E_FAIL; - return; - } -} - -STDMETHODIMP CVMR7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI(IVMRSurfaceAllocator) - QI(IVMRImagePresenter) - QI(IVMRWindowlessControl) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CVMR7AllocatorPresenter::CreateDevice() -{ - HRESULT hr = __super::CreateDevice(); - if(FAILED(hr)) return hr; - - if(m_pIVMRSurfAllocNotify) - { - HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); - if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeDDrawDevice(m_pDD, hMonitor))) - return(false); - } - - return hr; -} - -void CVMR7AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pSA->FreeSurface(MY_USER_ID); - - __super::DeleteSurfaces(); -} - -// ISubPicAllocatorPresenter - -STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) -{ - CheckPointer(ppRenderer, E_POINTER); - - *ppRenderer = NULL; - - HRESULT hr; - - do - { - CComPtr pBF; - - if(FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer))) - break; - - CComQIPtr pConfig = pBF; - if(!pConfig) - break; - - if(FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless))) - break; - - CComQIPtr pSAN = pBF; - if(!pSAN) - break; - - if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast(this))) - || FAILED(hr = AdviseNotify(pSAN))) - break; - - CComPtr pPin = GetFirstPin(pBF); - CComQIPtr pMemInputPin = pPin; - m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin); - - *ppRenderer = (IUnknown*)pBF.Detach(); - - return S_OK; - } - while(0); - - return E_FAIL; -} - -STDMETHODIMP_(void) CVMR7AllocatorPresenter::SetTime(REFERENCE_TIME rtNow) -{ - __super::SetTime(rtNow); - m_fUseInternalTimer = false; -} - -// IVMRSurfaceAllocator - -STDMETHODIMP CVMR7AllocatorPresenter::AllocateSurface(DWORD_PTR dwUserID, VMRALLOCATIONINFO* lpAllocInfo, DWORD* lpdwBuffer, LPDIRECTDRAWSURFACE7* lplpSurface) -{ - if(!lpAllocInfo || !lpdwBuffer || !lplpSurface) - return E_POINTER; - - if(!m_pIVMRSurfAllocNotify) - return E_FAIL; - - HRESULT hr; - - DeleteSurfaces(); - - // HACK: yv12 will fail to blt onto the backbuffer anyway, but if we first - // allocate it and then let our FreeSurface callback call m_pSA->FreeSurface, - // then that might stall for about 30 seconds because of some unknown buggy code - // behind ->Release() - - if(lpAllocInfo->lpHdr->biBitCount < 16) - return E_FAIL; - - hr = m_pSA->AllocateSurface(dwUserID, lpAllocInfo, lpdwBuffer, lplpSurface); - if(FAILED(hr)) - return hr; - - m_NativeVideoSize = CSize(abs(lpAllocInfo->lpHdr->biWidth), abs(lpAllocInfo->lpHdr->biHeight)); - m_AspectRatio = m_NativeVideoSize; - int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy; - if(arx > 0 && ary > 0) m_AspectRatio.SetSize(arx, ary); - - if(FAILED(hr = AllocSurfaces())) - return hr; - - // test if the colorspace is acceptable - if(FAILED(hr = m_pVideoSurface->Blt(NULL, *lplpSurface, NULL, DDBLT_WAIT, NULL))) - { - DeleteSurfaces(); - return hr; - } - - DDBLTFX fx; - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - m_pVideoSurface->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - return hr; -} - -STDMETHODIMP CVMR7AllocatorPresenter::FreeSurface(DWORD_PTR dwUserID) -{ - DeleteSurfaces(); - return S_OK; -} - -STDMETHODIMP CVMR7AllocatorPresenter::PrepareSurface(DWORD_PTR dwUserID, IDirectDrawSurface7* lpSurface, DWORD dwSurfaceFlags) -{ - if(!lpSurface) - return E_POINTER; - - // FIXME: sometimes the msmpeg4/divx3/wmv decoder wants to reuse our - // surface (expects it to point to the same mem every time), and to avoid - // problems we can't call m_pSA->PrepareSurface (flips? clears?). - return S_OK; -/* - return m_pSA->PrepareSurface(dwUserID, lpSurface, dwSurfaceFlags); -*/ -} - -STDMETHODIMP CVMR7AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify) -{ - CAutoLock cAutoLock(this); - - m_pIVMRSurfAllocNotify = lpIVMRSurfAllocNotify; - - HRESULT hr; - HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); - if(FAILED(hr = m_pIVMRSurfAllocNotify->SetDDrawDevice(m_pDD, hMonitor))) - return hr; - - return m_pSA->AdviseNotify(lpIVMRSurfAllocNotify); -} - -// IVMRImagePresenter - -STDMETHODIMP CVMR7AllocatorPresenter::StartPresenting(DWORD_PTR dwUserID) -{ - CAutoLock cAutoLock(this); - - ASSERT(m_pD3DDev); - - return m_pD3DDev ? S_OK : E_FAIL; -} - -STDMETHODIMP CVMR7AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID) -{ - return S_OK; -} - -STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESENTATIONINFO* lpPresInfo) -{ - HRESULT hr; - - { - if(!lpPresInfo || !lpPresInfo->lpSurf) - return E_POINTER; - - CAutoLock cAutoLock(this); - - hr = m_pVideoSurface->Blt(NULL, lpPresInfo->lpSurf, NULL, DDBLT_WAIT, NULL); - - if(lpPresInfo->rtEnd > lpPresInfo->rtStart) - { - REFERENCE_TIME rtTimePerFrame = lpPresInfo->rtEnd - lpPresInfo->rtStart; - m_fps = 10000000.0 / rtTimePerFrame; - - if(m_pSubPicQueue) - { - m_pSubPicQueue->SetFPS(m_fps); - - if(m_fUseInternalTimer) - { - __super::SetTime(g_tSegmentStart + g_tSampleStart); - } - } - } - - CSize VideoSize = m_NativeVideoSize; - int arx = lpPresInfo->szAspectRatio.cx, ary = lpPresInfo->szAspectRatio.cy; - if(arx > 0 && ary > 0) VideoSize.cx = VideoSize.cy*arx/ary; - if(VideoSize != GetVideoSize()) - { - m_AspectRatio.SetSize(arx, ary); - AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS); - } - - Paint(true); - - hr = S_OK; - } - - return S_OK; -} - -// IVMRWindowlessControl -// -// It is only implemented (partially) for the dvd navigator's -// menu handling, which needs to know a few things about the -// location of our window. - -STDMETHODIMP CVMR7AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight) -{ - CSize vs = m_NativeVideoSize, ar = m_AspectRatio; - // DVD Nav. bug workaround fix - vs.cx = vs.cy * ar.cx / ar.cy; - if(lpWidth) *lpWidth = vs.cx; - if(lpHeight) *lpHeight = vs.cy; - if(lpARWidth) *lpARWidth = ar.cx; - if(lpARHeight) *lpARHeight = ar.cy; - return S_OK; -} - -STDMETHODIMP CVMR7AllocatorPresenter::GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect) {return E_NOTIMPL;} // we have our own method for this - -STDMETHODIMP CVMR7AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) -{ - CopyRect(lpSRCRect, CRect(CPoint(0, 0), m_NativeVideoSize)); - CopyRect(lpDSTRect, &m_VideoRect); - // DVD Nav. bug workaround fix - GetNativeVideoSize(&lpSRCRect->right, &lpSRCRect->bottom, NULL, NULL); - return S_OK; -} - -STDMETHODIMP CVMR7AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode) -{ - if(lpAspectRatioMode) *lpAspectRatioMode = AM_ARMODE_STRETCHED; - return S_OK; -} - -STDMETHODIMP CVMR7AllocatorPresenter::SetAspectRatioMode(DWORD AspectRatioMode) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::SetVideoClippingWindow(HWND hwnd) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::RepaintVideo(HWND hwnd, HDC hdc) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::DisplayModeChanged() {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::GetCurrentImage(BYTE** lpDib) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::SetBorderColor(COLORREF Clr) {return E_NOTIMPL;} - -STDMETHODIMP CVMR7AllocatorPresenter::GetBorderColor(COLORREF* lpClr) -{ - if(lpClr) *lpClr = 0; - return S_OK; -} - -STDMETHODIMP CVMR7AllocatorPresenter::SetColorKey(COLORREF Clr) {return E_NOTIMPL;} -STDMETHODIMP CVMR7AllocatorPresenter::GetColorKey(COLORREF* lpClr) {return E_NOTIMPL;} - -// - -static HRESULT AllocDX7Surface(IDirectDraw7* pDD, CSize size, DWORD compression, int bpp, IDirectDrawSurface7** pSurface) -{ - if(!pDD || !pSurface || size.cx <= 0 || size.cy <= 0) - return E_POINTER; - - *pSurface = NULL; - - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY; - ddsd.dwWidth = size.cx; - ddsd.dwHeight = size.cy; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - - if(compression >= 0x1000) - { - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwFourCC = compression; - } - else if((compression == 0 || compression == 3) && (bpp == 15 || bpp == 16 || bpp == 24 || bpp == 32)) - { - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd.ddpfPixelFormat.dwRGBBitCount = max(bpp, 16); - ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = (bpp == 16) ? 0x0000 : (bpp == 15) ? 0x8000 : 0xFF000000; - ddsd.ddpfPixelFormat.dwRBitMask = (bpp == 16) ? 0xf800 : (bpp == 15) ? 0x7c00 : 0x00FF0000; - ddsd.ddpfPixelFormat.dwGBitMask = (bpp == 16) ? 0x07e0 : (bpp == 15) ? 0x03e0 : 0x0000FF00; - ddsd.ddpfPixelFormat.dwBBitMask = (bpp == 16) ? 0x001F : (bpp == 15) ? 0x001F : 0x000000FF; - } - - return pDD->CreateSurface(&ddsd, pSurface, NULL); -} - -// -// CRM7AllocatorPresenter -// - -CRM7AllocatorPresenter::CRM7AllocatorPresenter(HWND hWnd, HRESULT& hr) - : CDX7AllocatorPresenter(hWnd, hr) -{ -} - -STDMETHODIMP CRM7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI2(IRMAVideoSurface) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CRM7AllocatorPresenter::AllocSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pVideoSurfaceOff = NULL; - m_pVideoSurfaceYUY2 = NULL; - - DDSURFACEDESC2 ddsd; - DDBLTFX fx; - - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = m_NativeVideoSize.cx; - ddsd.dwHeight = m_NativeVideoSize.cy; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd.ddpfPixelFormat.dwRGBBitCount = 32; - ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000; - ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF; - - HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL); - if(FAILED(hr)) return E_FAIL; - - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = m_NativeVideoSize.cx; - ddsd.dwHeight = m_NativeVideoSize.cy; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwYUVBitCount = 16; - ddsd.ddpfPixelFormat.dwFourCC = '2YUY'; - - hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceYUY2, NULL); - - if(FAILED(m_pVideoSurfaceOff->Blt(NULL, m_pVideoSurfaceYUY2, NULL, DDBLT_WAIT, NULL))) - m_pVideoSurfaceYUY2 = NULL; - - if(m_pVideoSurfaceYUY2) - { - INITDDSTRUCT(fx); - fx.dwFillColor = 0x80108010; - m_pVideoSurfaceYUY2->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - } - - return __super::AllocSurfaces(); -} - -void CRM7AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pVideoSurfaceOff = NULL; - m_pVideoSurfaceYUY2 = NULL; - - __super::DeleteSurfaces(); -} - -// IRMAVideoSurface - -STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect) -{ - if(!m_pVideoSurface || !m_pVideoSurfaceOff) - return E_FAIL; - - bool fRGB = false; - bool fYUY2 = false; - - CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size()); - if(src.Width() > dst.Width() || src.Height() > dst.Height()) - return E_FAIL; - - DDSURFACEDESC2 ddsd; - - if(pBitmapInfo->biCompression == '024I') - { - DWORD pitch = pBitmapInfo->biWidth; - DWORD size = pitch*abs(pBitmapInfo->biHeight); - - BYTE* y = pImageData + src.top*pitch + src.left; - BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2; - BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2; - - if(m_pVideoSurfaceYUY2) - { - INITDDSTRUCT(ddsd); - if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) - { - BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, y, u, v, pitch); - m_pVideoSurfaceYUY2->Unlock(src2); - fYUY2 = true; - } - } - else - { - INITDDSTRUCT(ddsd); - if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) - { - BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, y, u, v, pitch); - m_pVideoSurfaceOff->Unlock(src2); - fRGB = true; - } - } - } - else if(pBitmapInfo->biCompression == '2YUY') - { - DWORD w = pBitmapInfo->biWidth; - DWORD h = abs(pBitmapInfo->biHeight); - DWORD pitch = pBitmapInfo->biWidth*2; - - BYTE* yvyu = pImageData + src.top*pitch + src.left*2; - - if(m_pVideoSurfaceYUY2) - { - INITDDSTRUCT(ddsd); - if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) - { - BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, yvyu, pitch); - m_pVideoSurfaceYUY2->Unlock(src2); - fYUY2 = true; - } - } - else - { - INITDDSTRUCT(ddsd); - if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) - { - BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, yvyu, pitch); - m_pVideoSurfaceOff->Unlock(src2); - fRGB = true; - } - } - } - else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3 - || pBitmapInfo->biCompression == 'BGRA') - { - DWORD w = pBitmapInfo->biWidth; - DWORD h = abs(pBitmapInfo->biHeight); - DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3; - - BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3); - - INITDDSTRUCT(ddsd); - if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) - { - BYTE* lpSurface = (BYTE*)ddsd.lpSurface; - if(pBitmapInfo->biHeight > 0) {lpSurface += ddsd.lPitch*(src.Height()-1); ddsd.lPitch = -ddsd.lPitch;} - BitBltFromRGBToRGB(src.Width(), src.Height(), lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, rgb, pitch, pBitmapInfo->biBitCount); - fRGB = true; - m_pVideoSurfaceOff->Unlock(src2); - } - } - - if(!fRGB && !fYUY2) - { - DDBLTFX fx; - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - HDC hDC; - if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) - { - CString str; - str.Format(_T("Sorry, this format is not supported")); - - SetBkColor(hDC, 0); - SetTextColor(hDC, 0x404040); - TextOut(hDC, 10, 10, str, str.GetLength()); - - m_pVideoSurfaceOff->ReleaseDC(hDC); - - fRGB = true; - } - } - - - HRESULT hr; - - if(fRGB) - hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceOff, src2, DDBLT_WAIT, NULL); - if(fYUY2) - hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceYUY2, src2, DDBLT_WAIT, NULL); - - Paint(true); - - return PNR_OK; -} - -STDMETHODIMP CRM7AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo) -{ - CAutoLock cAutoLock(this); - DeleteSurfaces(); - m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight)); - if(FAILED(AllocSurfaces())) return E_FAIL; - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM7AllocatorPresenter::OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect) -{ - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM7AllocatorPresenter::EndOptimizedBlt() -{ - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM7AllocatorPresenter::GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType) -{ - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM7AllocatorPresenter::GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType) -{ - ulType = RMA_I420; - return PNR_OK; -} - -// -// CQT7AllocatorPresenter -// - -CQT7AllocatorPresenter::CQT7AllocatorPresenter(HWND hWnd, HRESULT& hr) - : CDX7AllocatorPresenter(hWnd, hr) -{ -} - -STDMETHODIMP CQT7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI(IQTVideoSurface) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CQT7AllocatorPresenter::AllocSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pVideoSurfaceOff = NULL; - - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = m_NativeVideoSize.cx; - ddsd.dwHeight = m_NativeVideoSize.cy; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd.ddpfPixelFormat.dwRGBBitCount = 32; - ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000; - ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF; - - HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL); - if(FAILED(hr)) return E_FAIL; - - DDBLTFX fx; - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - return __super::AllocSurfaces(); -} - -void CQT7AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pVideoSurfaceOff = NULL; - - __super::DeleteSurfaces(); -} - -// IQTVideoSurface - -STDMETHODIMP CQT7AllocatorPresenter::BeginBlt(const BITMAP& bm) -{ - CAutoLock cAutoLock(this); - - DeleteSurfaces(); - - m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight)); - - HRESULT hr; - if(FAILED(hr = AllocSurfaces())) - return hr; - - return S_OK; -} - -STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm) -{ - if(!m_pVideoSurface || !m_pVideoSurfaceOff) - return E_FAIL; - - bool fOk = false; - - DDSURFACEDESC2 ddsd; - INITDDSTRUCT(ddsd); - if(FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd))) - return E_FAIL; - - int w = bm.bmWidth; - int h = abs(bm.bmHeight); - int bpp = bm.bmBitsPixel; - - if((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight) - { - INITDDSTRUCT(ddsd); - if(SUCCEEDED(m_pVideoSurfaceOff->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) - { - BitBltFromRGBToRGB( - w, h, - (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, - (BYTE*)bm.bmBits, bm.bmWidthBytes, bm.bmBitsPixel); - m_pVideoSurfaceOff->Unlock(NULL); - fOk = true; - } - } - - if(!fOk) - { - DDBLTFX fx; - INITDDSTRUCT(fx); - fx.dwFillColor = 0; - m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx); - - HDC hDC; - if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) - { - CString str; - str.Format(_T("Sorry, this format is not supported")); - - SetBkColor(hDC, 0); - SetTextColor(hDC, 0x404040); - TextOut(hDC, 10, 10, str, str.GetLength()); - - m_pVideoSurfaceOff->ReleaseDC(hDC); - - } - } - - m_pVideoSurface->Blt(NULL, m_pVideoSurfaceOff, NULL, DDBLT_WAIT, NULL); - - Paint(true); - - return S_OK; -} diff --git a/src/apps/mplayerc/DX7AllocatorPresenter.h b/src/apps/mplayerc/DX7AllocatorPresenter.h deleted file mode 100644 index f209a257d..000000000 --- a/src/apps/mplayerc/DX7AllocatorPresenter.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "..\..\SubPic\ISubPic.h" - -// {495CF191-810D-44c7-92C5-E7D46AE00F44} -DEFINE_GUID(CLSID_VMR7AllocatorPresenter, -0x495cf191, 0x810d, 0x44c7, 0x92, 0xc5, 0xe7, 0xd4, 0x6a, 0xe0, 0xf, 0x44); - -// {97B3462E-1752-4dfb-A038-271060BC7A94} -DEFINE_GUID(CLSID_RM7AllocatorPresenter, -0x97b3462e, 0x1752, 0x4dfb, 0xa0, 0x38, 0x27, 0x10, 0x60, 0xbc, 0x7a, 0x94); - -// {36CC5A71-441C-462a-9D10-48A19485938D} -DEFINE_GUID(CLSID_QT7AllocatorPresenter, -0x36cc5a71, 0x441c, 0x462a, 0x9d, 0x10, 0x48, 0xa1, 0x94, 0x85, 0x93, 0x8d); - -extern HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP); - -extern bool IsVMR7InGraph(IFilterGraph* pFG); diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.cpp b/src/apps/mplayerc/DX9AllocatorPresenter.cpp deleted file mode 100644 index 79726b7c3..000000000 --- a/src/apps/mplayerc/DX9AllocatorPresenter.cpp +++ /dev/null @@ -1,2221 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "mplayerc.h" -#include -#include -#include "..\..\DSUtil\DSUtil.h" - -#include - -#include -#include "DX9AllocatorPresenter.h" -#include -#include -#include -#include "..\..\SubPic\DX9SubPic.h" -#include "..\..\..\include\RealMedia\pntypes.h" -#include "..\..\..\include\RealMedia\pnwintyp.h" -#include "..\..\..\include\RealMedia\pncom.h" -#include "..\..\..\include\RealMedia\rmavsurf.h" -#include "IQTVideoSurface.h" -#include "..\..\..\include\moreuuids.h" - -#include "MacrovisionKicker.h" -#include "IPinHook.h" - -#include "PixelShaderCompiler.h" - -CCritSec g_ffdshowReceive; -bool queueu_ffdshow_support = false; - -bool IsVMR9InGraph(IFilterGraph* pFG) -{ - BeginEnumFilters(pFG, pEF, pBF) - if(CComQIPtr(pBF)) return(true); - EndEnumFilters - return(false); -} - -namespace DSObjects -{ - -class CDX9AllocatorPresenter - : public ISubPicAllocatorPresenterImpl -{ -protected: - CSize m_ScreenSize; - bool m_fVMRSyncFix; - - CComPtr m_pD3D; - CComPtr m_pD3DDev; - CComPtr m_pVideoTexture[3]; - CComPtr m_pVideoSurface[3]; - CInterfaceList m_pPixelShaders; - CComPtr m_pResizerPixelShader[3]; // bl, bc1, bc2 - CComPtr m_pResizerBicubic1stPass; - D3DTEXTUREFILTERTYPE m_filter; - D3DCAPS9 m_caps; - - CAutoPtr m_pPSC; - - virtual HRESULT CreateDevice(); - virtual HRESULT AllocSurfaces(); - virtual void DeleteSurfaces(); - - UINT GetAdapter(IDirect3D9 *pD3D); - - float m_bicubicA; - HRESULT InitResizers(float bicubicA); - - HRESULT TextureCopy(CComPtr pTexture); - HRESULT TextureResize(CComPtr pTexture, Vector dst[4], D3DTEXTUREFILTERTYPE filter); - HRESULT TextureResizeBilinear(CComPtr pTexture, Vector dst[4]); - HRESULT TextureResizeBicubic1pass(CComPtr pTexture, Vector dst[4]); - HRESULT TextureResizeBicubic2pass(CComPtr pTexture, Vector dst[4]); - -public: - CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr); - - // ISubPicAllocatorPresenter - STDMETHODIMP CreateRenderer(IUnknown** ppRenderer); - STDMETHODIMP_(bool) Paint(bool fAll); - STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size); - STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget); -}; - -class CVMR9AllocatorPresenter - : public CDX9AllocatorPresenter - , public IVMRSurfaceAllocator9 - , public IVMRImagePresenter9 - , public IVMRWindowlessControl9 -{ -protected: - CComPtr m_pIVMRSurfAllocNotify; - CInterfaceArray m_pSurfaces; - - HRESULT CreateDevice(); - void DeleteSurfaces(); - - bool m_fUseInternalTimer; - REFERENCE_TIME m_rtPrevStart; - -public: - CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // ISubPicAllocatorPresenter - STDMETHODIMP CreateRenderer(IUnknown** ppRenderer); - STDMETHODIMP_(void) SetTime(REFERENCE_TIME rtNow); - - // IVMRSurfaceAllocator9 - STDMETHODIMP InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers); - STDMETHODIMP TerminateDevice(DWORD_PTR dwID); - STDMETHODIMP GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9** lplpSurface); - STDMETHODIMP AdviseNotify(IVMRSurfaceAllocatorNotify9* lpIVMRSurfAllocNotify); - - // IVMRImagePresenter9 - STDMETHODIMP StartPresenting(DWORD_PTR dwUserID); - STDMETHODIMP StopPresenting(DWORD_PTR dwUserID); - STDMETHODIMP PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo* lpPresInfo); - - // IVMRWindowlessControl9 - STDMETHODIMP GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight); - STDMETHODIMP GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight); - STDMETHODIMP GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight); - STDMETHODIMP SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect); - STDMETHODIMP GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect); - STDMETHODIMP GetAspectRatioMode(DWORD* lpAspectRatioMode); - STDMETHODIMP SetAspectRatioMode(DWORD AspectRatioMode); - STDMETHODIMP SetVideoClippingWindow(HWND hwnd); - STDMETHODIMP RepaintVideo(HWND hwnd, HDC hdc); - STDMETHODIMP DisplayModeChanged(); - STDMETHODIMP GetCurrentImage(BYTE** lpDib); - STDMETHODIMP SetBorderColor(COLORREF Clr); - STDMETHODIMP GetBorderColor(COLORREF* lpClr); -}; - -class CRM9AllocatorPresenter - : public CDX9AllocatorPresenter - , public IRMAVideoSurface -{ - CComPtr m_pVideoSurfaceOff; - CComPtr m_pVideoSurfaceYUY2; - - RMABitmapInfoHeader m_bitmapInfo; - RMABitmapInfoHeader m_lastBitmapInfo; - -protected: - HRESULT AllocSurfaces(); - void DeleteSurfaces(); - -public: - CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IRMAVideoSurface - STDMETHODIMP Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect); - STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo); - STDMETHODIMP OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect); - STDMETHODIMP EndOptimizedBlt(); - STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType); - STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType); -}; - -class CQT9AllocatorPresenter - : public CDX9AllocatorPresenter - , public IQTVideoSurface -{ - CComPtr m_pVideoSurfaceOff; - -protected: - HRESULT AllocSurfaces(); - void DeleteSurfaces(); - -public: - CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IQTVideoSurface - STDMETHODIMP BeginBlt(const BITMAP& bm); - STDMETHODIMP DoBlt(const BITMAP& bm); -}; - -class CDXRAllocatorPresenter - : public ISubPicAllocatorPresenterImpl -{ - class CSubRenderCallback : public CUnknown, public ISubRenderCallback, public CCritSec - { - CDXRAllocatorPresenter* m_pDXRAP; - - public: - CSubRenderCallback(CDXRAllocatorPresenter* pDXRAP) - : CUnknown(_T("CSubRender"), NULL) - , m_pDXRAP(pDXRAP) - { - } - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) - { - return - QI(ISubRenderCallback) - __super::NonDelegatingQueryInterface(riid, ppv); - } - - void SetDXRAP(CDXRAllocatorPresenter* pDXRAP) - { - CAutoLock cAutoLock(this); - m_pDXRAP = pDXRAP; - } - - // ISubRenderCallback - - STDMETHODIMP SetDevice(IDirect3DDevice9* pD3DDev) - { - CAutoLock cAutoLock(this); - return m_pDXRAP ? m_pDXRAP->SetDevice(pD3DDev) : E_UNEXPECTED; - } - - STDMETHODIMP Render(REFERENCE_TIME rtStart, int left, int top, int right, int bottom, int width, int height) - { - CAutoLock cAutoLock(this); - return m_pDXRAP ? m_pDXRAP->Render(rtStart, 0, 0, left, top, right, bottom, width, height) : E_UNEXPECTED; - } - - // ISubRendererCallback2 - - STDMETHODIMP RenderEx(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, REFERENCE_TIME AvgTimePerFrame, int left, int top, int right, int bottom, int width, int height) - { - CAutoLock cAutoLock(this); - return m_pDXRAP ? m_pDXRAP->Render(rtStart, rtStop, AvgTimePerFrame, left, top, right, bottom, width, height) : E_UNEXPECTED; - } - }; - - CComPtr m_pDXR; - CComPtr m_pSRCB; - -public: - CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr); - virtual ~CDXRAllocatorPresenter(); - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - HRESULT SetDevice(IDirect3DDevice9* pD3DDev); - HRESULT Render( - REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, REFERENCE_TIME atpf, - int left, int top, int bottom, int right, int width, int height); - - // ISubPicAllocatorPresenter - STDMETHODIMP CreateRenderer(IUnknown** ppRenderer); - STDMETHODIMP_(void) SetPosition(RECT w, RECT v); - STDMETHODIMP_(SIZE) GetVideoSize(bool fCorrectAR); - STDMETHODIMP_(bool) Paint(bool fAll); - STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size); - STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget); -}; - -} -using namespace DSObjects; - -// - -HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP) -{ - CheckPointer(ppAP, E_POINTER); - - *ppAP = NULL; - - HRESULT hr = E_FAIL; - if(clsid == CLSID_VMR9AllocatorPresenter && !(*ppAP = new CVMR9AllocatorPresenter(hWnd, hr)) - || clsid == CLSID_RM9AllocatorPresenter && !(*ppAP = new CRM9AllocatorPresenter(hWnd, hr)) - || clsid == CLSID_QT9AllocatorPresenter && !(*ppAP = new CQT9AllocatorPresenter(hWnd, hr)) - || clsid == CLSID_DXRAllocatorPresenter && !(*ppAP = new CDXRAllocatorPresenter(hWnd, hr))) - return E_OUTOFMEMORY; - - if(*ppAP == NULL) - return E_FAIL; - - (*ppAP)->AddRef(); - - if(FAILED(hr)) - { - (*ppAP)->Release(); - *ppAP = NULL; - } - - return hr; -} - -// - -#pragma pack(push, 1) -template -struct MYD3DVERTEX {float x, y, z, rhw; struct {float u, v;} t[texcoords];}; -#pragma pack(pop) - -template -static void AdjustQuad(MYD3DVERTEX* v, float dx, float dy) -{ - float offset = 0.5f; - - for(int i = 0; i < 4; i++) - { - v[i].x -= offset; - v[i].y -= offset; - - for(int j = 0; j < texcoords-1; j++) - { - v[i].t[j].u -= offset*dx; - v[i].t[j].v -= offset*dy; - } - - if(texcoords > 1) - { - v[i].t[texcoords-1].u -= offset; - v[i].t[texcoords-1].v -= offset; - } - } -} - -template -static HRESULT TextureBlt(CComPtr pD3DDev, MYD3DVERTEX v[4], D3DTEXTUREFILTERTYPE filter = D3DTEXF_LINEAR) -{ - if(!pD3DDev) - return E_POINTER; - - DWORD FVF = 0; - - switch(texcoords) - { - case 1: FVF = D3DFVF_TEX1; break; - case 2: FVF = D3DFVF_TEX2; break; - case 3: FVF = D3DFVF_TEX3; break; - case 4: FVF = D3DFVF_TEX4; break; - case 5: FVF = D3DFVF_TEX5; break; - case 6: FVF = D3DFVF_TEX6; break; - case 7: FVF = D3DFVF_TEX7; break; - case 8: FVF = D3DFVF_TEX8; break; - default: return E_FAIL; - } - - HRESULT hr; - - do - { - hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); - hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE); - hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE); - hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE); - hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); - hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); - hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); - hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED); - - for(int i = 0; i < texcoords; i++) - { - hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter); - hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter); - hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, filter); - - hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); - hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); - } - - // - - if(FAILED(hr = pD3DDev->BeginScene())) - break; - - hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF); - // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0])); - - MYD3DVERTEX tmp = v[2]; v[2] = v[3]; v[3] = tmp; - hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0])); - - hr = pD3DDev->EndScene(); - - // - - for(int i = 0; i < texcoords; i++) - { - pD3DDev->SetTexture(i, NULL); - } - - return S_OK; - } - while(0); - - return E_FAIL; -} - -// CDX9AllocatorPresenter - -CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr) - : ISubPicAllocatorPresenterImpl(hWnd, hr) - , m_ScreenSize(0, 0) - , m_bicubicA(0) -{ - if(FAILED(hr)) return; - m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION)); - if(!m_pD3D) m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION)); - if(!m_pD3D) {hr = E_FAIL; return;} - hr = CreateDevice(); -} - -HRESULT CDX9AllocatorPresenter::CreateDevice() -{ - m_pPSC.Free(); - m_pD3DDev = NULL; - - D3DDISPLAYMODE d3ddm; - ZeroMemory(&d3ddm, sizeof(d3ddm)); - if(FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) - return E_UNEXPECTED; - - m_ScreenSize.SetSize(d3ddm.Width, d3ddm.Height); - - D3DPRESENT_PARAMETERS pp; - ZeroMemory(&pp, sizeof(pp)); - pp.Windowed = TRUE; - pp.hDeviceWindow = m_hWnd; - pp.SwapEffect = D3DSWAPEFFECT_COPY; - pp.Flags = D3DPRESENTFLAG_VIDEO; - pp.BackBufferWidth = d3ddm.Width; - pp.BackBufferHeight = d3ddm.Height; - pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; - - if(m_fVMRSyncFix = AfxGetMyApp()->m_s.fVMRSyncFix) - pp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; - - HRESULT hr = m_pD3D->CreateDevice( - GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED - &pp, &m_pD3DDev); -/* - HRESULT hr = m_pD3D->CreateDevice( - m_pD3D->GetAdapterCount()-1, D3DDEVTYPE_REF, m_hWnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED - &pp, &m_pD3DDev); -*/ - if(FAILED(hr)) - return hr; - - m_pPSC.Attach(new CPixelShaderCompiler(m_pD3DDev, true)); - - // - - m_filter = D3DTEXF_NONE; - - ZeroMemory(&m_caps, sizeof(m_caps)); - m_pD3DDev->GetDeviceCaps(&m_caps); - - if((m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR) - && (m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR)) - m_filter = D3DTEXF_LINEAR; - - // - - m_bicubicA = 0; - - // - - CComPtr pSubPicProvider; - if(m_pSubPicQueue) m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider); - - CSize size; - switch(AfxGetAppSettings().nSPCMaxRes) - { - case 0: default: size = m_ScreenSize; break; - case 1: size.SetSize(1024, 768); break; - case 2: size.SetSize(800, 600); break; - case 3: size.SetSize(640, 480); break; - case 4: size.SetSize(512, 384); break; - case 5: size.SetSize(384, 288); break; - } - - if(m_pAllocator) - { - m_pAllocator->ChangeDevice(m_pD3DDev); - } - else - { - m_pAllocator = new CDX9SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex); - if(!m_pAllocator) - return E_FAIL; - } - - hr = S_OK; - m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0 - ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr) - : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr); - if(!m_pSubPicQueue || FAILED(hr)) - return E_FAIL; - - if(pSubPicProvider) m_pSubPicQueue->SetSubPicProvider(pSubPicProvider); - - return S_OK; -} - -HRESULT CDX9AllocatorPresenter::AllocSurfaces() -{ - CAutoLock cAutoLock(this); - - AppSettings& s = AfxGetAppSettings(); - - for(int i = 0; i < countof(m_pVideoTexture); i++) - { - m_pVideoTexture[i] = NULL; - m_pVideoSurface[i] = NULL; - } - - m_pResizerBicubic1stPass = NULL; - - HRESULT hr; - - if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) - { - int nTexturesNeeded = s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D ? countof(m_pVideoTexture) : 1; - - for(int i = 0; i < nTexturesNeeded; i++) - { - if(FAILED(hr = m_pD3DDev->CreateTexture( - m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1, - D3DUSAGE_RENDERTARGET, /*D3DFMT_X8R8G8B8*/D3DFMT_A8R8G8B8, - D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) - return hr; - - if(FAILED(hr = m_pVideoTexture[i]->GetSurfaceLevel(0, &m_pVideoSurface[i]))) - return hr; - } - - if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D) - { - for(int i = 0; i < countof(m_pVideoTexture); i++) - { - m_pVideoTexture[i] = NULL; - } - } - } - else - { - if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface( - m_NativeVideoSize.cx, m_NativeVideoSize.cy, - D3DFMT_X8R8G8B8/*D3DFMT_A8R8G8B8*/, - D3DPOOL_DEFAULT, &m_pVideoSurface[0], NULL))) - return hr; - } - - hr = m_pD3DDev->ColorFill(m_pVideoSurface[0], NULL, 0); - - return S_OK; -} - -void CDX9AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - - for(int i = 0; i < countof(m_pVideoTexture); i++) - { - m_pVideoTexture[i] = NULL; - m_pVideoSurface[i] = NULL; - } -} - -UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D) -{ - if(m_hWnd == NULL || pD3D == NULL) - return D3DADAPTER_DEFAULT; - - HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); - if(hMonitor == NULL) return D3DADAPTER_DEFAULT; - - for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) - { - HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp); - if(hAdpMon == hMonitor) return adp; - } - - return D3DADAPTER_DEFAULT; -} - -// ISubPicAllocatorPresenter - -STDMETHODIMP CDX9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) -{ - return E_NOTIMPL; -} - -static bool ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d) -{ - D3DSURFACE_DESC d3dsd; - ZeroMemory(&d3dsd, sizeof(d3dsd)); - if(FAILED(pSurface->GetDesc(&d3dsd))) - return(false); - - int w = d3dsd.Width, h = d3dsd.Height; - int sw = s.Width(), sh = s.Height(); - int dw = d.Width(), dh = d.Height(); - - if(d.left >= w || d.right < 0 || d.top >= h || d.bottom < 0 - || sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) - { - s.SetRectEmpty(); - d.SetRectEmpty(); - return(true); - } - - if(d.right > w) {s.right -= (d.right-w)*sw/dw; d.right = w;} - if(d.bottom > h) {s.bottom -= (d.bottom-h)*sh/dh; d.bottom = h;} - if(d.left < 0) {s.left += (0-d.left)*sw/dw; d.left = 0;} - if(d.top < 0) {s.top += (0-d.top)*sh/dh; d.top = 0;} - - return(true); -} - -HRESULT CDX9AllocatorPresenter::InitResizers(float bicubicA) -{ - HRESULT hr; - - if(m_pResizerPixelShader[0] && m_bicubicA == 0 && bicubicA == 0 - || m_pResizerPixelShader[1] && m_pResizerPixelShader[2] && m_bicubicA == bicubicA && m_pResizerBicubic1stPass) - return S_OK; - - m_bicubicA = bicubicA; - m_pResizerBicubic1stPass = NULL; - - for(int i = 0; i < countof(m_pResizerPixelShader); i++) - m_pResizerPixelShader[i] = NULL; - - if(m_caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) - return E_FAIL; - - LPCSTR pProfile = m_caps.PixelShaderVersion >= D3DPS_VERSION(3, 0) ? "ps_3_0" : "ps_2_0"; - - CStringA str; - if(!LoadResource(IDF_SHADER_RESIZER, str, _T("FILE"))) - return E_FAIL; - - CStringA A; - A.Format("(%f)", bicubicA); - str.Replace("_The_Value_Of_A_Is_Set_Here_", A); - - LPCSTR pEntries[] = {"main_bilinear", "main_bicubic1pass", "main_bicubic2pass"}; - - ASSERT(countof(pEntries) == countof(m_pResizerPixelShader)); - - for(int i = 0; i < countof(pEntries); i++) - { - hr = m_pPSC->CompileShader(str, pEntries[i], pProfile, 0, &m_pResizerPixelShader[i]); - if(FAILED(hr)) return hr; - } - - if(m_bicubicA) - { - if(FAILED(m_pD3DDev->CreateTexture( - min(max(2048, m_ScreenSize.cx), m_caps.MaxTextureWidth), m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, - D3DPOOL_DEFAULT, &m_pResizerBicubic1stPass, NULL))) - { - ASSERT(0); - m_pResizerBicubic1stPass = NULL; // will do 1 pass then - } - } - - return S_OK; -} - -HRESULT CDX9AllocatorPresenter::TextureCopy(CComPtr pTexture) -{ - HRESULT hr; - - D3DSURFACE_DESC desc; - if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) - return E_FAIL; - - float w = (float)desc.Width; - float h = (float)desc.Height; - - MYD3DVERTEX<1> v[] = - { - {0, 0, 0.5f, 2.0f, 0, 0}, - {w, 0, 0.5f, 2.0f, 1, 0}, - {0, h, 0.5f, 2.0f, 0, 1}, - {w, h, 0.5f, 2.0f, 1, 1}, - }; - - for(int i = 0; i < countof(v); i++) - { - v[i].x -= 0.5; - v[i].y -= 0.5; - } - - hr = m_pD3DDev->SetTexture(0, pTexture); - - return TextureBlt(m_pD3DDev, v, D3DTEXF_LINEAR); -} - -HRESULT CDX9AllocatorPresenter::TextureResize(CComPtr pTexture, Vector dst[4], D3DTEXTUREFILTERTYPE filter) -{ - HRESULT hr; - - D3DSURFACE_DESC desc; - if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) - return E_FAIL; - - float w = (float)desc.Width; - float h = (float)desc.Height; - - float dx = 0.98f/w; - float dy = 0.98f/h; - - MYD3DVERTEX<1> v[] = - { - {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0}, - {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, 1, 0}, - {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, 1}, - {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, 1, 1}, - }; - - AdjustQuad(v, dx, dy); - - hr = m_pD3DDev->SetTexture(0, pTexture); - - hr = m_pD3DDev->SetPixelShader(NULL); - - hr = TextureBlt(m_pD3DDev, v, filter); - - return hr; -} - -HRESULT CDX9AllocatorPresenter::TextureResizeBilinear(CComPtr pTexture, Vector dst[4]) -{ - HRESULT hr; - - D3DSURFACE_DESC desc; - if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) - return E_FAIL; - - float w = (float)desc.Width; - float h = (float)desc.Height; - - float dx = 0.98f/w; - float dy = 0.98f/h; - - MYD3DVERTEX<5> v[] = - { - {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0, 0+dx, 0, 0, 0+dy, 0+dx, 0+dy, 0, 0}, - {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, 1, 0, 1+dx, 0, 1, 0+dy, 1+dx, 0+dy, w, 0}, - {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, 1, 0+dx, 1, 0, 1+dy, 0+dx, 1+dy, 0, h}, - {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, 1, 1, 1+dx, 1, 1, 1+dy, 1+dx, 1+dy, w, h}, - }; - - AdjustQuad(v, dx, dy); - - hr = m_pD3DDev->SetTexture(0, pTexture); - hr = m_pD3DDev->SetTexture(1, pTexture); - hr = m_pD3DDev->SetTexture(2, pTexture); - hr = m_pD3DDev->SetTexture(3, pTexture); - - hr = m_pD3DDev->SetPixelShader(m_pResizerPixelShader[0]); - - hr = TextureBlt(m_pD3DDev, v, D3DTEXF_POINT); - - // - - m_pD3DDev->SetPixelShader(NULL); - - return hr; -} - -HRESULT CDX9AllocatorPresenter::TextureResizeBicubic1pass(CComPtr pTexture, Vector dst[4]) -{ - HRESULT hr; - - D3DSURFACE_DESC desc; - if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) - return E_FAIL; - - float w = (float)desc.Width; - float h = (float)desc.Height; - - float dx = 0.98f/w; - float dy = 0.98f/h; - - MYD3DVERTEX<2> v[] = - { - {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0, 0, 0}, - {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, 1, 0, w, 0}, - {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, 1, 0, h}, - {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, 1, 1, w, h}, - }; - - AdjustQuad(v, dx, dy); - - hr = m_pD3DDev->SetTexture(0, pTexture); - - float fConstData[][4] = {{w, h, 0, 0}, {1.0f / w, 1.0f / h, 0, 0}, {1.0f / w, 0, 0, 0}, {0, 1.0f / h, 0, 0}}; - hr = m_pD3DDev->SetPixelShaderConstantF(0, (float*)fConstData, countof(fConstData)); - - hr = m_pD3DDev->SetPixelShader(m_pResizerPixelShader[1]); - - hr = TextureBlt(m_pD3DDev, v, D3DTEXF_POINT); - - m_pD3DDev->SetPixelShader(NULL); - - return hr; -} - -HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(CComPtr pTexture, Vector dst[4]) -{ - // return TextureResizeBicubic1pass(pTexture, dst); - - HRESULT hr; - - // rotated? - if(dst[0].z != dst[1].z || dst[2].z != dst[3].z || dst[0].z != dst[3].z - || dst[0].y != dst[1].y || dst[0].x != dst[2].x || dst[2].y != dst[3].y || dst[1].x != dst[3].x) - return TextureResizeBicubic1pass(pTexture, dst); - - D3DSURFACE_DESC desc; - if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) - return E_FAIL; - - float dx = 0.98f/desc.Width; - - float w = (float)desc.Width; - float h = (float)desc.Height; - - CRect dst1(0, 0, (int)(dst[3].x - dst[0].x), (int)h); - - if(!m_pResizerBicubic1stPass || FAILED(m_pResizerBicubic1stPass->GetLevelDesc(0, &desc))) - return TextureResizeBicubic1pass(pTexture, dst); - - float dy = 0.98f/desc.Height; - - float dw = (float)dst1.Width() / desc.Width; - float dh = (float)dst1.Height() / desc.Height; - - ASSERT(dst1.Height() == desc.Height); - - if(dst1.Width() > desc.Width || dst1.Height() > desc.Height) - // if(dst1.Width() != desc.Width || dst1.Height() != desc.Height) - return TextureResizeBicubic1pass(pTexture, dst); - - MYD3DVERTEX<5> vx[] = - { - {(float)dst1.left, (float)dst1.top, 0.5f, 2.0f, 0-dx, 0, 0, 0, 0+dx, 0, 0+dx*2, 0, 0, 0}, - {(float)dst1.right, (float)dst1.top, 0.5f, 2.0f, 1-dx, 0, 1, 0, 1+dx, 0, 1+dx*2, 0, w, 0}, - {(float)dst1.left, (float)dst1.bottom, 0.5f, 2.0f, 0-dx, 1, 0, 1, 0+dx, 1, 0+dx*2, 1, 0, 0}, - {(float)dst1.right, (float)dst1.bottom, 0.5f, 2.0f, 1-dx, 1, 1, 1, 1+dx, 1, 1+dx*2, 1, w, 0}, - }; - - AdjustQuad(vx, dx, 0); - - MYD3DVERTEX<5> vy[] = - { - {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0-dy, 0, 0, 0, 0+dy, 0, 0+dy*2, 0, 0}, - {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, dw, 0-dy, dw, 0, dw, 0+dy, dw, 0+dy*2, 0, 0}, - {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, dh-dy, 0, dh, 0, dh+dy, 0, dh+dy*2, h, 0}, - {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, dw, dh-dy, dw, dh, dw, dh+dy, dw, dh+dy*2, h, 0}, - }; - - AdjustQuad(vy, 0, dy); - - hr = m_pD3DDev->SetPixelShader(m_pResizerPixelShader[2]); - - hr = m_pD3DDev->SetTexture(0, pTexture); - hr = m_pD3DDev->SetTexture(1, pTexture); - hr = m_pD3DDev->SetTexture(2, pTexture); - hr = m_pD3DDev->SetTexture(3, pTexture); - - CComPtr pRTOld; - hr = m_pD3DDev->GetRenderTarget(0, &pRTOld); - - CComPtr pRT; - hr = m_pResizerBicubic1stPass->GetSurfaceLevel(0, &pRT); - hr = m_pD3DDev->SetRenderTarget(0, pRT); - - hr = TextureBlt(m_pD3DDev, vx, D3DTEXF_POINT); - - hr = m_pD3DDev->SetTexture(0, m_pResizerBicubic1stPass); - hr = m_pD3DDev->SetTexture(1, m_pResizerBicubic1stPass); - hr = m_pD3DDev->SetTexture(2, m_pResizerBicubic1stPass); - hr = m_pD3DDev->SetTexture(3, m_pResizerBicubic1stPass); - - hr = m_pD3DDev->SetRenderTarget(0, pRTOld); - - hr = TextureBlt(m_pD3DDev, vy, D3DTEXF_POINT); - - m_pD3DDev->SetPixelShader(NULL); - - return hr; -} - -STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) -{ - CAutoLock cAutoLock(this); - - if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top - || m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0 - || !m_pVideoSurface) - return(false); - - HRESULT hr; - - CRect rSrcVid(CPoint(0, 0), m_NativeVideoSize); - CRect rDstVid(m_VideoRect); - - CRect rSrcPri(CPoint(0, 0), m_WindowRect.Size()); - CRect rDstPri(m_WindowRect); - - CComPtr pBackBuffer; - m_pD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer); - - m_pD3DDev->SetRenderTarget(0, pBackBuffer); - - if(fAll) - { - // clear the backbuffer - - hr = m_pD3DDev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0); - - // paint the video on the backbuffer - - if(!rDstVid.IsRectEmpty()) - { - if(m_pVideoTexture[0]) - { - CComPtr pVideoTexture = m_pVideoTexture[0]; - - if(m_pVideoTexture[1] && m_pVideoTexture[2] && !m_pPixelShaders.IsEmpty()) - { - static __int64 counter = 0; - static long start = clock(); - - long stop = clock(); - long diff = stop - start; - - if(diff >= 10*60*CLOCKS_PER_SEC) start = stop; // reset after 10 min (ps float has its limits in both range and accuracy) - - float fConstData[][4] = - { - {(float)m_NativeVideoSize.cx, (float)m_NativeVideoSize.cy, (float)(counter++), (float)diff / CLOCKS_PER_SEC}, - {1.0f / m_NativeVideoSize.cx, 1.0f / m_NativeVideoSize.cy, 0, 0}, - }; - - hr = m_pD3DDev->SetPixelShaderConstantF(0, (float*)fConstData, countof(fConstData)); - - CComPtr pRT; - hr = m_pD3DDev->GetRenderTarget(0, &pRT); - - int src = 0, dst = 1; - - POSITION pos = m_pPixelShaders.GetHeadPosition(); - while(pos) - { - pVideoTexture = m_pVideoTexture[dst]; - - hr = m_pD3DDev->SetRenderTarget(0, m_pVideoSurface[dst]); - hr = m_pD3DDev->SetPixelShader(m_pPixelShaders.GetNext(pos)); - TextureCopy(m_pVideoTexture[src]); - - if(++src > 2) src = 1; - if(++dst > 2) dst = 1; - } - - hr = m_pD3DDev->SetRenderTarget(0, pRT); - hr = m_pD3DDev->SetPixelShader(NULL); - } - - Vector dst[4]; - Transform(rDstVid, dst); - - DWORD iDX9Resizer = AfxGetAppSettings().iDX9Resizer; - - float A = 0; - - switch(iDX9Resizer) - { - case 3: A = -0.60f; break; - case 4: A = -0.751f; break; // FIXME : 0.75 crashes recent D3D, or eat CPU - case 5: A = -1.00f; break; - } - - hr = InitResizers(A); - - if(iDX9Resizer == 0 || iDX9Resizer == 1 || rSrcVid.Size() == rDstVid.Size() || FAILED(hr)) - { - hr = TextureResize(pVideoTexture, dst, iDX9Resizer == 0 ? D3DTEXF_POINT : D3DTEXF_LINEAR); - } - else if(iDX9Resizer == 2) - { - hr = TextureResizeBilinear(pVideoTexture, dst); - } - else if(iDX9Resizer >= 3) - { - hr = TextureResizeBicubic2pass(pVideoTexture, dst); - } - - } - else - { - if(pBackBuffer) - { - ClipToSurface(pBackBuffer, rSrcVid, rDstVid); // grrr - // IMPORTANT: rSrcVid has to be aligned on mod2 for yuy2->rgb conversion with StretchRect!!! - rSrcVid.left &= ~1; rSrcVid.right &= ~1; - rSrcVid.top &= ~1; rSrcVid.bottom &= ~1; - hr = m_pD3DDev->StretchRect(m_pVideoSurface[0], rSrcVid, pBackBuffer, rDstVid, m_filter); - - // Support ffdshow queueing - // m_pD3DDev->StretchRect may fail if ffdshow is using queue output samples. - // Here we don't want to show the black buffer. - if(FAILED(hr)) return false; - } - } - } - - // paint the text on the backbuffer - - AlphaBltSubPic(rSrcPri.Size()); - } - - if(m_fVMRSyncFix) - { - D3DLOCKED_RECT lr; - if(SUCCEEDED(pBackBuffer->LockRect(&lr, NULL, 0))) - pBackBuffer->UnlockRect(); - } - - hr = m_pD3DDev->Present(rSrcPri, rDstPri, NULL, NULL); - - bool fResetDevice = false; - - if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) - { - fResetDevice = true; - } - - D3DDEVICE_CREATION_PARAMETERS Parameters; - if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters)) - && m_pD3D->GetAdapterMonitor(Parameters.AdapterOrdinal) != m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D))) - { - fResetDevice = true; - } - - if(fResetDevice) - { - DeleteSurfaces(); - if(FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces())) - return false; - } - - return true; -} - -STDMETHODIMP CDX9AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size) -{ - CheckPointer(size, E_POINTER); - - HRESULT hr; - - D3DSURFACE_DESC desc; - memset(&desc, 0, sizeof(desc)); - m_pVideoSurface[0]->GetDesc(&desc); - - DWORD required = sizeof(BITMAPINFOHEADER) + (desc.Width * desc.Height * 32 >> 3); - if(!lpDib) {*size = required; return S_OK;} - if(*size < required) return E_OUTOFMEMORY; - *size = required; - - CComPtr pSurface = m_pVideoSurface[0]; - D3DLOCKED_RECT r; - if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) - { - pSurface = NULL; - if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL)) - || FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[0], pSurface)) - || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) - return hr; - } - - BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)lpDib; - memset(bih, 0, sizeof(BITMAPINFOHEADER)); - bih->biSize = sizeof(BITMAPINFOHEADER); - bih->biWidth = desc.Width; - bih->biHeight = desc.Height; - bih->biBitCount = 32; - bih->biPlanes = 1; - bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount >> 3; - - BitBltFromRGBToRGB( - bih->biWidth, bih->biHeight, - (BYTE*)(bih + 1), bih->biWidth*bih->biBitCount>>3, bih->biBitCount, - (BYTE*)r.pBits + r.Pitch*(desc.Height-1), -(int)r.Pitch, 32); - - pSurface->UnlockRect(); - - return S_OK; -} - -STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget) -{ - CAutoLock cAutoLock(this); - - if(!pSrcData && !pTarget) - { - m_pPixelShaders.RemoveAll(); - m_pD3DDev->SetPixelShader(NULL); - return S_OK; - } - - if(!pSrcData || !pTarget) - return E_INVALIDARG; - - CComPtr pPixelShader; - - HRESULT hr = m_pPSC->CompileShader(pSrcData, "main", pTarget, 0, &pPixelShader); - if(FAILED(hr)) return hr; - - m_pPixelShaders.AddTail(pPixelShader); - - Paint(true); - - return S_OK; -} - -// -// CVMR9AllocatorPresenter -// - -#define MY_USER_ID 0x6ABE51 - -CVMR9AllocatorPresenter::CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr) - : CDX9AllocatorPresenter(hWnd, hr) - , m_fUseInternalTimer(false) - , m_rtPrevStart(-1) -{ -} - -STDMETHODIMP CVMR9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI(IVMRSurfaceAllocator9) - QI(IVMRImagePresenter9) - QI(IVMRWindowlessControl9) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CVMR9AllocatorPresenter::CreateDevice() -{ - HRESULT hr = __super::CreateDevice(); - if(FAILED(hr)) return hr; - - if(m_pIVMRSurfAllocNotify) - { - HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D)); - if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor))) - return(false); - } - - return hr; -} - -void CVMR9AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pSurfaces.RemoveAll(); - - return __super::DeleteSurfaces(); -} - -// ISubPicAllocatorPresenter - -class COuterVMR9 - : public CUnknown - , public IVideoWindow - , public IBasicVideo2 - , public IVMRWindowlessControl - , public IVMRffdshow9 -{ - CComPtr m_pVMR; - -public: - - COuterVMR9(const TCHAR* pName, LPUNKNOWN pUnk) : CUnknown(pName, pUnk) - { - m_pVMR.CoCreateInstance(CLSID_VideoMixingRenderer9, GetOwner()); - } - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) - { - HRESULT hr = m_pVMR ? m_pVMR->QueryInterface(riid, ppv) : E_NOINTERFACE; - - if(m_pVMR && FAILED(hr)) - { - if(riid == __uuidof(IVideoWindow)) - return GetInterface((IVideoWindow*)this, ppv); - if(riid == __uuidof(IBasicVideo)) - return GetInterface((IBasicVideo*)this, ppv); - if(riid == __uuidof(IBasicVideo2)) - return GetInterface((IBasicVideo2*)this, ppv); - if(riid == __uuidof(IVMRffdshow9)) // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic. - return GetInterface((IVMRffdshow9*)this, ppv); -/* if(riid == __uuidof(IVMRWindowlessControl)) - return GetInterface((IVMRWindowlessControl*)this, ppv); -*/ } - - return SUCCEEDED(hr) ? hr : __super::NonDelegatingQueryInterface(riid, ppv); - } - - // IVMRWindowlessControl - - STDMETHODIMP GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight) - { - if(CComQIPtr pWC9 = m_pVMR) - { - return pWC9->GetNativeVideoSize(lpWidth, lpHeight, lpARWidth, lpARHeight); - } - - return E_NOTIMPL; - } - STDMETHODIMP GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;} - STDMETHODIMP GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;} - STDMETHODIMP SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect) {return E_NOTIMPL;} - STDMETHODIMP GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) - { - if(CComQIPtr pWC9 = m_pVMR) - { - return pWC9->GetVideoPosition(lpSRCRect, lpDSTRect); - } - - return E_NOTIMPL; - } - STDMETHODIMP GetAspectRatioMode(DWORD* lpAspectRatioMode) - { - if(CComQIPtr pWC9 = m_pVMR) - { - *lpAspectRatioMode = VMR_ARMODE_NONE; - return S_OK; - } - - return E_NOTIMPL; - } - STDMETHODIMP SetAspectRatioMode(DWORD AspectRatioMode) {return E_NOTIMPL;} - STDMETHODIMP SetVideoClippingWindow(HWND hwnd) {return E_NOTIMPL;} - STDMETHODIMP RepaintVideo(HWND hwnd, HDC hdc) {return E_NOTIMPL;} - STDMETHODIMP DisplayModeChanged() {return E_NOTIMPL;} - STDMETHODIMP GetCurrentImage(BYTE** lpDib) {return E_NOTIMPL;} - STDMETHODIMP SetBorderColor(COLORREF Clr) {return E_NOTIMPL;} - STDMETHODIMP GetBorderColor(COLORREF* lpClr) {return E_NOTIMPL;} - STDMETHODIMP SetColorKey(COLORREF Clr) {return E_NOTIMPL;} - STDMETHODIMP GetColorKey(COLORREF* lpClr) {return E_NOTIMPL;} - - // IVideoWindow - STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;} - STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {return E_NOTIMPL;} - STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) {return E_NOTIMPL;} - STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) {return E_NOTIMPL;} - STDMETHODIMP put_Caption(BSTR strCaption) {return E_NOTIMPL;} - STDMETHODIMP get_Caption(BSTR* strCaption) {return E_NOTIMPL;} - STDMETHODIMP put_WindowStyle(long WindowStyle) {return E_NOTIMPL;} - STDMETHODIMP get_WindowStyle(long* WindowStyle) {return E_NOTIMPL;} - STDMETHODIMP put_WindowStyleEx(long WindowStyleEx) {return E_NOTIMPL;} - STDMETHODIMP get_WindowStyleEx(long* WindowStyleEx) {return E_NOTIMPL;} - STDMETHODIMP put_AutoShow(long AutoShow) {return E_NOTIMPL;} - STDMETHODIMP get_AutoShow(long* AutoShow) {return E_NOTIMPL;} - STDMETHODIMP put_WindowState(long WindowState) {return E_NOTIMPL;} - STDMETHODIMP get_WindowState(long* WindowState) {return E_NOTIMPL;} - STDMETHODIMP put_BackgroundPalette(long BackgroundPalette) {return E_NOTIMPL;} - STDMETHODIMP get_BackgroundPalette(long* pBackgroundPalette) {return E_NOTIMPL;} - STDMETHODIMP put_Visible(long Visible) {return E_NOTIMPL;} - STDMETHODIMP get_Visible(long* pVisible) {return E_NOTIMPL;} - STDMETHODIMP put_Left(long Left) {return E_NOTIMPL;} - STDMETHODIMP get_Left(long* pLeft) {return E_NOTIMPL;} - STDMETHODIMP put_Width(long Width) {return E_NOTIMPL;} - STDMETHODIMP get_Width(long* pWidth) - { - if(CComQIPtr pWC9 = m_pVMR) - { - CRect s, d; - HRESULT hr = pWC9->GetVideoPosition(&s, &d); - *pWidth = d.Width(); - return hr; - } - - return E_NOTIMPL; - } - STDMETHODIMP put_Top(long Top) {return E_NOTIMPL;} - STDMETHODIMP get_Top(long* pTop) {return E_NOTIMPL;} - STDMETHODIMP put_Height(long Height) {return E_NOTIMPL;} - STDMETHODIMP get_Height(long* pHeight) - { - if(CComQIPtr pWC9 = m_pVMR) - { - CRect s, d; - HRESULT hr = pWC9->GetVideoPosition(&s, &d); - *pHeight = d.Height(); - return hr; - } - - return E_NOTIMPL; - } - STDMETHODIMP put_Owner(OAHWND Owner) {return E_NOTIMPL;} - STDMETHODIMP get_Owner(OAHWND* Owner) {return E_NOTIMPL;} - STDMETHODIMP put_MessageDrain(OAHWND Drain) {return E_NOTIMPL;} - STDMETHODIMP get_MessageDrain(OAHWND* Drain) {return E_NOTIMPL;} - STDMETHODIMP get_BorderColor(long* Color) {return E_NOTIMPL;} - STDMETHODIMP put_BorderColor(long Color) {return E_NOTIMPL;} - STDMETHODIMP get_FullScreenMode(long* FullScreenMode) {return E_NOTIMPL;} - STDMETHODIMP put_FullScreenMode(long FullScreenMode) {return E_NOTIMPL;} - STDMETHODIMP SetWindowForeground(long Focus) {return E_NOTIMPL;} - STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam) {return E_NOTIMPL;} - STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;} - STDMETHODIMP GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;} - STDMETHODIMP GetMinIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;} - STDMETHODIMP GetMaxIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;} - STDMETHODIMP GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;} - STDMETHODIMP HideCursor(long HideCursor) {return E_NOTIMPL;} - STDMETHODIMP IsCursorHidden(long* CursorHidden) {return E_NOTIMPL;} - - // IBasicVideo2 - STDMETHODIMP get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame) {return E_NOTIMPL;} - STDMETHODIMP get_BitRate(long* pBitRate) {return E_NOTIMPL;} - STDMETHODIMP get_BitErrorRate(long* pBitErrorRate) {return E_NOTIMPL;} - STDMETHODIMP get_VideoWidth(long* pVideoWidth) {return E_NOTIMPL;} - STDMETHODIMP get_VideoHeight(long* pVideoHeight) {return E_NOTIMPL;} - STDMETHODIMP put_SourceLeft(long SourceLeft) {return E_NOTIMPL;} - STDMETHODIMP get_SourceLeft(long* pSourceLeft) {return E_NOTIMPL;} - STDMETHODIMP put_SourceWidth(long SourceWidth) {return E_NOTIMPL;} - STDMETHODIMP get_SourceWidth(long* pSourceWidth) {return E_NOTIMPL;} - STDMETHODIMP put_SourceTop(long SourceTop) {return E_NOTIMPL;} - STDMETHODIMP get_SourceTop(long* pSourceTop) {return E_NOTIMPL;} - STDMETHODIMP put_SourceHeight(long SourceHeight) {return E_NOTIMPL;} - STDMETHODIMP get_SourceHeight(long* pSourceHeight) {return E_NOTIMPL;} - STDMETHODIMP put_DestinationLeft(long DestinationLeft) {return E_NOTIMPL;} - STDMETHODIMP get_DestinationLeft(long* pDestinationLeft) {return E_NOTIMPL;} - STDMETHODIMP put_DestinationWidth(long DestinationWidth) {return E_NOTIMPL;} - STDMETHODIMP get_DestinationWidth(long* pDestinationWidth) {return E_NOTIMPL;} - STDMETHODIMP put_DestinationTop(long DestinationTop) {return E_NOTIMPL;} - STDMETHODIMP get_DestinationTop(long* pDestinationTop) {return E_NOTIMPL;} - STDMETHODIMP put_DestinationHeight(long DestinationHeight) {return E_NOTIMPL;} - STDMETHODIMP get_DestinationHeight(long* pDestinationHeight) {return E_NOTIMPL;} - STDMETHODIMP SetSourcePosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;} - STDMETHODIMP GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) - { - // DVD Nav. bug workaround fix - { - *pLeft = *pTop = 0; - return GetVideoSize(pWidth, pHeight); - } -/* - if(CComQIPtr pWC9 = m_pVMR) - { - CRect s, d; - HRESULT hr = pWC9->GetVideoPosition(&s, &d); - *pLeft = s.left; - *pTop = s.top; - *pWidth = s.Width(); - *pHeight = s.Height(); - return hr; - } -*/ - return E_NOTIMPL; - } - STDMETHODIMP SetDefaultSourcePosition() {return E_NOTIMPL;} - STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;} - STDMETHODIMP GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) - { - if(CComQIPtr pWC9 = m_pVMR) - { - CRect s, d; - HRESULT hr = pWC9->GetVideoPosition(&s, &d); - *pLeft = d.left; - *pTop = d.top; - *pWidth = d.Width(); - *pHeight = d.Height(); - return hr; - } - - return E_NOTIMPL; - } - STDMETHODIMP SetDefaultDestinationPosition() {return E_NOTIMPL;} - STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight) - { - if(CComQIPtr pWC9 = m_pVMR) - { - LONG aw, ah; -// return pWC9->GetNativeVideoSize(pWidth, pHeight, &aw, &ah); - // DVD Nav. bug workaround fix - HRESULT hr = pWC9->GetNativeVideoSize(pWidth, pHeight, &aw, &ah); - *pWidth = *pHeight * aw / ah; - return hr; - } - - return E_NOTIMPL; - } - STDMETHODIMP GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette) {return E_NOTIMPL;} - STDMETHODIMP GetCurrentImage(long* pBufferSize, long* pDIBImage) {return E_NOTIMPL;} - STDMETHODIMP IsUsingDefaultSource() {return E_NOTIMPL;} - STDMETHODIMP IsUsingDefaultDestination() {return E_NOTIMPL;} - - STDMETHODIMP GetPreferredAspectRatio(long* plAspectX, long* plAspectY) - { - if(CComQIPtr pWC9 = m_pVMR) - { - LONG w, h; - return pWC9->GetNativeVideoSize(&w, &h, plAspectX, plAspectY); - } - - return E_NOTIMPL; - } - - // IVMRffdshow9 - STDMETHODIMP support_ffdshow() - { - queueu_ffdshow_support = true; - return S_OK; - } -}; - -STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) -{ - CheckPointer(ppRenderer, E_POINTER); - - *ppRenderer = NULL; - - HRESULT hr; - - do - { - CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL); - CComPtr pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK; - pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)new COuterVMR9(NAME("COuterVMR9"), pUnk)); - CComQIPtr pBF = pUnk; -/* - CComQIPtr pBF = (IUnknown*)(INonDelegatingUnknown*)new COuterVMR9(NAME("COuterVMR9"), NULL); - if(!pBF) pBF.CoCreateInstance(CLSID_VideoMixingRenderer9); -*/ - - CComPtr pPin = GetFirstPin(pBF); - CComQIPtr pMemInputPin = pPin; - m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin); -/* -if(CComQIPtr pAMVA = pPin) - HookAMVideoAccelerator((IAMVideoAcceleratorC*)(IAMVideoAccelerator*)pAMVA); -*/ - CComQIPtr pConfig = pBF; - if(!pConfig) - break; - - AppSettings& s = AfxGetAppSettings(); - - if(s.fVMR9MixerMode) - { - if(FAILED(hr = pConfig->SetNumberOfStreams(1))) - break; - - if(s.fVMR9MixerYUV && !AfxGetMyApp()->IsVistaOrAbove()) - { - if(CComQIPtr pMC = pBF) - { - DWORD dwPrefs; - pMC->GetMixingPrefs(&dwPrefs); - dwPrefs &= ~MixerPref9_RenderTargetMask; - dwPrefs |= MixerPref9_RenderTargetYUV; - pMC->SetMixingPrefs(dwPrefs); - } - } - } - - if(FAILED(hr = pConfig->SetRenderingMode(VMR9Mode_Renderless))) - break; - - CComQIPtr pSAN = pBF; - if(!pSAN) - break; - - if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast(this))) - || FAILED(hr = AdviseNotify(pSAN))) - break; - - *ppRenderer = (IUnknown*)pBF.Detach(); - - return S_OK; - } - while(0); - - return E_FAIL; -} - -STDMETHODIMP_(void) CVMR9AllocatorPresenter::SetTime(REFERENCE_TIME rtNow) -{ - __super::SetTime(rtNow); - m_fUseInternalTimer = false; -} - -// IVMRSurfaceAllocator9 - -STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers) -{ - if(!lpAllocInfo || !lpNumBuffers) - return E_POINTER; - - if(!m_pIVMRSurfAllocNotify) - return E_FAIL; - - if((GetAsyncKeyState(VK_CONTROL)&0x80000000)) - if(lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I') - return E_FAIL; - - DeleteSurfaces(); - - m_pSurfaces.SetCount(*lpNumBuffers); - - int w = lpAllocInfo->dwWidth; - int h = abs((int)lpAllocInfo->dwHeight); - - HRESULT hr; - - if(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget) - lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface; - - hr = m_pIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &m_pSurfaces[0]); - if(FAILED(hr)) return hr; - - m_NativeVideoSize = m_AspectRatio = CSize(w, h); - int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy; - if(arx > 0 && ary > 0) m_AspectRatio.SetSize(arx, ary); - - if(FAILED(hr = AllocSurfaces())) - return hr; - - if(!(lpAllocInfo->dwFlags & VMR9AllocFlag_TextureSurface)) - { - // test if the colorspace is acceptable - if(FAILED(hr = m_pD3DDev->StretchRect(m_pSurfaces[0], NULL, m_pVideoSurface[0], NULL, D3DTEXF_NONE))) - { - DeleteSurfaces(); - return E_FAIL; - } - } - - hr = m_pD3DDev->ColorFill(m_pVideoSurface[0], NULL, 0); - - return hr; -} - -STDMETHODIMP CVMR9AllocatorPresenter::TerminateDevice(DWORD_PTR dwUserID) -{ - DeleteSurfaces(); - return S_OK; -} - -STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9** lplpSurface) -{ - if(!lplpSurface) - return E_POINTER; - - if(SurfaceIndex >= m_pSurfaces.GetCount()) - return E_FAIL; - - CAutoLock cAutoLock(this); - - (*lplpSurface = m_pSurfaces[SurfaceIndex])->AddRef(); - - return S_OK; -} - -STDMETHODIMP CVMR9AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify9* lpIVMRSurfAllocNotify) -{ - CAutoLock cAutoLock(this); - - m_pIVMRSurfAllocNotify = lpIVMRSurfAllocNotify; - - HRESULT hr; - HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D)); - if(FAILED(hr = m_pIVMRSurfAllocNotify->SetD3DDevice(m_pD3DDev, hMonitor))) - return hr; - - return S_OK; -} - -// IVMRImagePresenter9 - -STDMETHODIMP CVMR9AllocatorPresenter::StartPresenting(DWORD_PTR dwUserID) -{ - CAutoLock cAutoLock(this); - - ASSERT(m_pD3DDev); - - return m_pD3DDev ? S_OK : E_FAIL; -} - -STDMETHODIMP CVMR9AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID) -{ - return S_OK; -} - -STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo* lpPresInfo) -{ - CheckPointer(m_pIVMRSurfAllocNotify, E_UNEXPECTED); - - HRESULT hr; - - if(!lpPresInfo || !lpPresInfo->lpSurf) - return E_POINTER; - - CAutoLock cAutoLock(this); - - CComPtr pTexture; - lpPresInfo->lpSurf->GetContainer(IID_IDirect3DTexture9, (void**)&pTexture); - - if(pTexture) - { - m_pVideoSurface[0] = lpPresInfo->lpSurf; - if(m_pVideoTexture[0]) m_pVideoTexture[0] = pTexture; - } - else - { - hr = m_pD3DDev->StretchRect(lpPresInfo->lpSurf, NULL, m_pVideoSurface[0], NULL, D3DTEXF_NONE); - } - - if(lpPresInfo->rtEnd > lpPresInfo->rtStart) - { - REFERENCE_TIME rtTimePerFrame = lpPresInfo->rtEnd - lpPresInfo->rtStart; - m_fps = 10000000.0 / rtTimePerFrame; - - if(m_pSubPicQueue) - { - m_pSubPicQueue->SetFPS(m_fps); - - if(m_fUseInternalTimer) - { - __super::SetTime(g_tSegmentStart + g_tSampleStart); - } - } - } - - CSize VideoSize = m_NativeVideoSize; - int arx = lpPresInfo->szAspectRatio.cx, ary = lpPresInfo->szAspectRatio.cy; - if(arx > 0 && ary > 0) VideoSize.cx = VideoSize.cy*arx/ary; - if(VideoSize != GetVideoSize()) - { - m_AspectRatio.SetSize(arx, ary); - AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS); - } - - Paint(true); - - return S_OK; -} - -// IVMRWindowlessControl9 -// -// It is only implemented (partially) for the dvd navigator's -// menu handling, which needs to know a few things about the -// location of our window. - -STDMETHODIMP CVMR9AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight) -{ - if(lpWidth) *lpWidth = m_NativeVideoSize.cx; - if(lpHeight) *lpHeight = m_NativeVideoSize.cy; - if(lpARWidth) *lpARWidth = m_AspectRatio.cx; - if(lpARHeight) *lpARHeight = m_AspectRatio.cy; - return S_OK; -} -STDMETHODIMP CVMR9AllocatorPresenter::GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect) {return E_NOTIMPL;} // we have our own method for this -STDMETHODIMP CVMR9AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) -{ - CopyRect(lpSRCRect, CRect(CPoint(0, 0), m_NativeVideoSize)); - CopyRect(lpDSTRect, &m_VideoRect); - return S_OK; -} -STDMETHODIMP CVMR9AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode) -{ - if(lpAspectRatioMode) *lpAspectRatioMode = AM_ARMODE_STRETCHED; - return S_OK; -} -STDMETHODIMP CVMR9AllocatorPresenter::SetAspectRatioMode(DWORD AspectRatioMode) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::SetVideoClippingWindow(HWND hwnd) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::RepaintVideo(HWND hwnd, HDC hdc) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::DisplayModeChanged() {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::GetCurrentImage(BYTE** lpDib) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::SetBorderColor(COLORREF Clr) {return E_NOTIMPL;} -STDMETHODIMP CVMR9AllocatorPresenter::GetBorderColor(COLORREF* lpClr) -{ - if(lpClr) *lpClr = 0; - return S_OK; -} - -// -// CRM9AllocatorPresenter -// - -CRM9AllocatorPresenter::CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr) - : CDX9AllocatorPresenter(hWnd, hr) -{ -} - -STDMETHODIMP CRM9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI2(IRMAVideoSurface) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CRM9AllocatorPresenter::AllocSurfaces() -{ - CAutoLock cAutoLock(this); - - m_pVideoSurfaceOff = NULL; - m_pVideoSurfaceYUY2 = NULL; - - HRESULT hr; - - if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface( - m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8, - D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) - return hr; - - m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0); - - if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface( - m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_YUY2, - D3DPOOL_DEFAULT, &m_pVideoSurfaceYUY2, NULL))) - m_pVideoSurfaceYUY2 = NULL; - - if(m_pVideoSurfaceYUY2) - { - m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0x80108010); - } - - return __super::AllocSurfaces(); -} - -void CRM9AllocatorPresenter::DeleteSurfaces() -{ - CAutoLock cAutoLock(this); - m_pVideoSurfaceOff = NULL; - m_pVideoSurfaceYUY2 = NULL; - __super::DeleteSurfaces(); -} - -// IRMAVideoSurface - -STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect) -{ - if(!m_pVideoSurface || !m_pVideoSurfaceOff) - return E_FAIL; - - bool fRGB = false; - bool fYUY2 = false; - - CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size()); - if(src.Width() > dst.Width() || src.Height() > dst.Height()) - return E_FAIL; - - D3DSURFACE_DESC d3dsd; - ZeroMemory(&d3dsd, sizeof(d3dsd)); - if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) - return E_FAIL; - - int dbpp = - d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 : - d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0; - - if(pBitmapInfo->biCompression == '024I') - { - DWORD pitch = pBitmapInfo->biWidth; - DWORD size = pitch*abs(pBitmapInfo->biHeight); - - BYTE* y = pImageData + src.top*pitch + src.left; - BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2; - BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2; - - if(m_pVideoSurfaceYUY2) - { - D3DLOCKED_RECT r; - if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) - { - BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, y, u, v, pitch); - m_pVideoSurfaceYUY2->UnlockRect(); - fYUY2 = true; - } - } - else - { - D3DLOCKED_RECT r; - if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) - { - BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, y, u, v, pitch); - m_pVideoSurfaceOff->UnlockRect(); - fRGB = true; - } - } - } - else if(pBitmapInfo->biCompression == '2YUY') - { - DWORD w = pBitmapInfo->biWidth; - DWORD h = abs(pBitmapInfo->biHeight); - DWORD pitch = pBitmapInfo->biWidth*2; - - BYTE* yvyu = pImageData + src.top*pitch + src.left*2; - - if(m_pVideoSurfaceYUY2) - { - D3DLOCKED_RECT r; - if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) - { - BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, yvyu, pitch); - m_pVideoSurfaceYUY2->UnlockRect(); - fYUY2 = true; - } - } - else - { - D3DLOCKED_RECT r; - if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) - { - BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, yvyu, pitch); - m_pVideoSurfaceOff->UnlockRect(); - fRGB = true; - } - } - } - else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3 - || pBitmapInfo->biCompression == 'BGRA') - { - DWORD w = pBitmapInfo->biWidth; - DWORD h = abs(pBitmapInfo->biHeight); - DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3; - - BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3); - - D3DLOCKED_RECT r; - if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) - { - BYTE* pBits = (BYTE*)r.pBits; - if(pBitmapInfo->biHeight > 0) {pBits += r.Pitch*(src.Height()-1); r.Pitch = -r.Pitch;} - BitBltFromRGBToRGB(src.Width(), src.Height(), pBits, r.Pitch, dbpp, rgb, pitch, pBitmapInfo->biBitCount); - m_pVideoSurfaceOff->UnlockRect(); - fRGB = true; - } - } - - if(!fRGB && !fYUY2) - { - m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0); - - HDC hDC; - if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) - { - CString str; - str.Format(_T("Sorry, this format is not supported")); - - SetBkColor(hDC, 0); - SetTextColor(hDC, 0x404040); - TextOut(hDC, 10, 10, str, str.GetLength()); - - m_pVideoSurfaceOff->ReleaseDC(hDC); - - fRGB = true; - } - } - - HRESULT hr; - - if(fRGB) - hr = m_pD3DDev->StretchRect(m_pVideoSurfaceOff, src2, m_pVideoSurface[0], dst, D3DTEXF_NONE); - if(fYUY2) - hr = m_pD3DDev->StretchRect(m_pVideoSurfaceYUY2, src2, m_pVideoSurface[0], dst, D3DTEXF_NONE); - - Paint(true); - - return PNR_OK; -} - -STDMETHODIMP CRM9AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo) -{ - CAutoLock cAutoLock(this); - DeleteSurfaces(); - m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight)); - if(FAILED(AllocSurfaces())) return E_FAIL; - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM9AllocatorPresenter::OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect) -{ - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM9AllocatorPresenter::EndOptimizedBlt() -{ - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM9AllocatorPresenter::GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType) -{ - return PNR_NOTIMPL; -} - -STDMETHODIMP CRM9AllocatorPresenter::GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType) -{ - ulType = RMA_I420; - return PNR_OK; -} - -// -// CQT9AllocatorPresenter -// - -CQT9AllocatorPresenter::CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr) - : CDX9AllocatorPresenter(hWnd, hr) -{ -} - -STDMETHODIMP CQT9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI(IQTVideoSurface) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CQT9AllocatorPresenter::AllocSurfaces() -{ - HRESULT hr; - - m_pVideoSurfaceOff = NULL; - - if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface( - m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8, - D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) - return hr; - - return __super::AllocSurfaces(); -} - -void CQT9AllocatorPresenter::DeleteSurfaces() -{ - m_pVideoSurfaceOff = NULL; - - __super::DeleteSurfaces(); -} - -// IQTVideoSurface - -STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm) -{ - CAutoLock cAutoLock(this); - DeleteSurfaces(); - m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight)); - if(FAILED(AllocSurfaces())) return E_FAIL; - return S_OK; -} - -STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm) -{ - if(!m_pVideoSurface || !m_pVideoSurfaceOff) - return E_FAIL; - - bool fOk = false; - - D3DSURFACE_DESC d3dsd; - ZeroMemory(&d3dsd, sizeof(d3dsd)); - if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) - return E_FAIL; - - int w = bm.bmWidth; - int h = abs(bm.bmHeight); - int bpp = bm.bmBitsPixel; - int dbpp = - d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 : - d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0; - - if((bpp == 16 || bpp == 24 || bpp == 32) && w == d3dsd.Width && h == d3dsd.Height) - { - D3DLOCKED_RECT r; - if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, NULL, 0))) - { - BitBltFromRGBToRGB( - w, h, - (BYTE*)r.pBits, r.Pitch, dbpp, - (BYTE*)bm.bmBits, bm.bmWidthBytes, bm.bmBitsPixel); - m_pVideoSurfaceOff->UnlockRect(); - fOk = true; - } - } - - if(!fOk) - { - m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0); - - HDC hDC; - if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) - { - CString str; - str.Format(_T("Sorry, this color format is not supported")); - - SetBkColor(hDC, 0); - SetTextColor(hDC, 0x404040); - TextOut(hDC, 10, 10, str, str.GetLength()); - - m_pVideoSurfaceOff->ReleaseDC(hDC); - } - } - - m_pD3DDev->StretchRect(m_pVideoSurfaceOff, NULL, m_pVideoSurface[0], NULL, D3DTEXF_NONE); - - Paint(true); - - return S_OK; -} - -// -// CDXRAllocatorPresenter -// - -CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr) - : ISubPicAllocatorPresenterImpl(hWnd, hr) -{ - if(FAILED(hr)) return; - - hr = S_OK; -} - -CDXRAllocatorPresenter::~CDXRAllocatorPresenter() -{ - if(m_pSRCB) - { - // nasty, but we have to let it know about our death somehow - ((CSubRenderCallback*)(ISubRenderCallback*)m_pSRCB)->SetDXRAP(NULL); - } - - // the order is important here - m_pSubPicQueue = NULL; - m_pAllocator = NULL; - m_pDXR = NULL; -} - -STDMETHODIMP CDXRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ -/* - if(riid == __uuidof(IVideoWindow)) - return GetInterface((IVideoWindow*)this, ppv); - if(riid == __uuidof(IBasicVideo)) - return GetInterface((IBasicVideo*)this, ppv); - if(riid == __uuidof(IBasicVideo2)) - return GetInterface((IBasicVideo2*)this, ppv); -*/ -/* - if(riid == __uuidof(IVMRWindowlessControl)) - return GetInterface((IVMRWindowlessControl*)this, ppv); -*/ - - if(riid != IID_IUnknown && m_pDXR) - { - if(SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) - return S_OK; - } - - return __super::NonDelegatingQueryInterface(riid, ppv); -} - -HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) -{ - CheckPointer(pD3DDev, E_POINTER); - - CSize size; - switch(AfxGetAppSettings().nSPCMaxRes) - { - // TODO: m_ScreenSize ? - // case 0: default: size = m_ScreenSize; break; - default: - case 1: size.SetSize(1024, 768); break; - case 2: size.SetSize(800, 600); break; - case 3: size.SetSize(640, 480); break; - case 4: size.SetSize(512, 384); break; - case 5: size.SetSize(384, 288); break; - } - - if(m_pAllocator) - { - m_pAllocator->ChangeDevice(pD3DDev); - } - else - { - m_pAllocator = new CDX9SubPicAllocator(pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex); - if(!m_pAllocator) - return E_FAIL; - } - - HRESULT hr = S_OK; - - m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0 - ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr) - : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr); - if(!m_pSubPicQueue || FAILED(hr)) - return E_FAIL; - - if(m_SubPicProvider) m_pSubPicQueue->SetSubPicProvider(m_SubPicProvider); - - return S_OK; -} - -HRESULT CDXRAllocatorPresenter::Render( - REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, REFERENCE_TIME atpf, - int left, int top, int right, int bottom, int width, int height) -{ - __super::SetPosition(CRect(0, 0, width, height), CRect(left, top, right, bottom)); // needed? should be already set by the player - SetTime(rtStart); - if(atpf > 0 && m_pSubPicQueue) m_pSubPicQueue->SetFPS(10000000.0 / atpf); - AlphaBltSubPic(CSize(width, height)); - return S_OK; -} - -// ISubPicAllocatorPresenter - -STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) -{ - CheckPointer(ppRenderer, E_POINTER); - - if(m_pDXR) return E_UNEXPECTED; - m_pDXR.CoCreateInstance(CLSID_DXR, GetOwner()); - if(!m_pDXR) return E_FAIL; - - CComQIPtr pSR = m_pDXR; - if(!pSR) {m_pDXR = NULL; return E_FAIL;} - - m_pSRCB = new CSubRenderCallback(this); - if(FAILED(pSR->SetCallback(m_pSRCB))) {m_pDXR = NULL; return E_FAIL;} - - (*ppRenderer = this)->AddRef(); - - return S_OK; -} - -STDMETHODIMP_(void) CDXRAllocatorPresenter::SetPosition(RECT w, RECT v) -{ - if(CComQIPtr pBV = m_pDXR) - { - pBV->SetDefaultSourcePosition(); - pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top); - } - - if(CComQIPtr pVW = m_pDXR) - { - pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top); - } -} - -STDMETHODIMP_(SIZE) CDXRAllocatorPresenter::GetVideoSize(bool fCorrectAR) -{ - SIZE size = {0, 0}; - - if(!fCorrectAR) - { - if(CComQIPtr pBV = m_pDXR) - pBV->GetVideoSize(&size.cx, &size.cy); - } - else - { - if(CComQIPtr pBV2 = m_pDXR) - pBV2->GetPreferredAspectRatio(&size.cx, &size.cy); - } - - return size; -} - -STDMETHODIMP_(bool) CDXRAllocatorPresenter::Paint(bool fAll) -{ - return false; // TODO -} - -STDMETHODIMP CDXRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size) -{ - HRESULT hr = E_NOTIMPL; - if(CComQIPtr pBV = m_pDXR) - hr = pBV->GetCurrentImage((long*)size, (long*)lpDib); - return hr; -} - -STDMETHODIMP CDXRAllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget) -{ - return E_NOTIMPL; // TODO -} diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.h b/src/apps/mplayerc/DX9AllocatorPresenter.h deleted file mode 100644 index 2ac4b1022..000000000 --- a/src/apps/mplayerc/DX9AllocatorPresenter.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "..\..\SubPic\ISubPic.h" - -// {4E4834FA-22C2-40e2-9446-F77DD05D245E} -DEFINE_GUID(CLSID_VMR9AllocatorPresenter, -0x4e4834fa, 0x22c2, 0x40e2, 0x94, 0x46, 0xf7, 0x7d, 0xd0, 0x5d, 0x24, 0x5e); - -// {A1542F93-EB53-4e11-8D34-05C57ABA9207} -DEFINE_GUID(CLSID_RM9AllocatorPresenter, -0xa1542f93, 0xeb53, 0x4e11, 0x8d, 0x34, 0x5, 0xc5, 0x7a, 0xba, 0x92, 0x7); - -// {622A4032-70CE-4040-8231-0F24F2886618} -DEFINE_GUID(CLSID_QT9AllocatorPresenter, -0x622a4032, 0x70ce, 0x4040, 0x82, 0x31, 0xf, 0x24, 0xf2, 0x88, 0x66, 0x18); - -// {B72EBDD4-831D-440f-A656-B48F5486CD82} -DEFINE_GUID(CLSID_DXRAllocatorPresenter, -0xb72ebdd4, 0x831d, 0x440f, 0xa6, 0x56, 0xb4, 0x8f, 0x54, 0x86, 0xcd, 0x82); - -extern HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP); - -extern bool IsVMR9InGraph(IFilterGraph* pFG); - -// Support ffdshow queueing. -// This interface is used to check version of Media Player Classic. -// {A273C7F6-25D4-46b0-B2C8-4F7FADC44E37} -DEFINE_GUID(IID_IVMRffdshow9, -0xa273c7f6, 0x25d4, 0x46b0, 0xb2, 0xc8, 0x4f, 0x7f, 0xad, 0xc4, 0x4e, 0x37); - -MIDL_INTERFACE("A273C7F6-25D4-46b0-B2C8-4F7FADC44E37") -IVMRffdshow9 : public IUnknown -{ -public: - virtual STDMETHODIMP support_ffdshow(void) = 0; -}; - -extern CCritSec g_ffdshowReceive; -extern bool queueu_ffdshow_support; diff --git a/src/apps/mplayerc/DeinterlacerFilter.cpp b/src/apps/mplayerc/DeinterlacerFilter.cpp deleted file mode 100644 index 972b071aa..000000000 --- a/src/apps/mplayerc/DeinterlacerFilter.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include "stdafx.h" -#include ".\deinterlacerfilter.h" -#include "..\..\DSUtil\MediaTypes.h" -#include "..\..\..\include\moreuuids.h" - -CDeinterlacerFilter::CDeinterlacerFilter(LPUNKNOWN punk, HRESULT* phr) - : CTransformFilter(NAME("CDeinterlacerFilter"), punk, __uuidof(CDeinterlacerFilter)) -{ - if(phr) *phr = S_OK; -} - -HRESULT CDeinterlacerFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin) -{ - return GetCLSID(pPin) == __uuidof(*this) ? E_FAIL : S_OK; -} - -HRESULT CDeinterlacerFilter::CheckInputType(const CMediaType* mtIn) -{ - BITMAPINFOHEADER bih; - if(!ExtractBIH(mtIn, &bih) /*|| bih.biHeight <= 0*/ || bih.biHeight <= 288) - return E_FAIL; - - return mtIn->subtype == MEDIASUBTYPE_YUY2 || mtIn->subtype == MEDIASUBTYPE_UYVY - || mtIn->subtype == MEDIASUBTYPE_I420 || mtIn->subtype == MEDIASUBTYPE_YV12 || mtIn->subtype == MEDIASUBTYPE_IYUV - ? S_OK - : E_FAIL; -} - -HRESULT CDeinterlacerFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut) -{ - return mtIn->subtype == mtOut->subtype ? S_OK : E_FAIL; -} - -HRESULT CDeinterlacerFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) -{ - HRESULT hr; - - AM_MEDIA_TYPE* pmt = NULL; - if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) - { - CMediaType mt = *pmt; - m_pOutput->SetMediaType(&mt); - DeleteMediaType(pmt); - } - - BYTE* pDataIn = NULL; - if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn) - return S_FALSE; - - BYTE* pDataOut = NULL; - if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) - return hr; - - const CMediaType& mtIn = m_pInput->CurrentMediaType(); - const CMediaType& mtOut = m_pOutput->CurrentMediaType(); - - BITMAPINFOHEADER bihIn, bihOut; - ExtractBIH(&mtIn, &bihIn); - ExtractBIH(&mtOut, &bihOut); - - bool fInputFlipped = bihIn.biHeight >= 0 && bihIn.biCompression <= 3; - bool fOutputFlipped = bihOut.biHeight >= 0 && bihOut.biCompression <= 3; - bool fFlip = fInputFlipped != fOutputFlipped; - - int bppIn = !(bihIn.biBitCount&7) ? bihIn.biBitCount : 8; - int bppOut = !(bihOut.biBitCount&7) ? bihOut.biBitCount : 8; - int pitchIn = bihIn.biWidth*bppIn>>3; - int pitchOut = bihOut.biWidth*bppOut>>3; - BYTE* pDataOut2 = pDataOut; - if(fFlip) {pDataOut2 += pitchOut*(bihIn.biHeight-1); pitchOut = -pitchOut;} - - if(mtIn.subtype == MEDIASUBTYPE_YUY2 || mtIn.subtype == MEDIASUBTYPE_UYVY) - { - DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn); - } - else if(mtIn.subtype == MEDIASUBTYPE_I420 || mtIn.subtype == MEDIASUBTYPE_YV12 || mtIn.subtype == MEDIASUBTYPE_IYUV) - { - DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn); - - int sizeIn = bihIn.biHeight*pitchIn, sizeOut = abs(bihOut.biHeight)*pitchOut; - pitchIn /= 2; pitchOut /= 2; - bihIn.biHeight /= 2; - pDataIn += sizeIn; pDataOut += sizeOut; - DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn); - - pDataIn += sizeIn/4; pDataOut += sizeOut/4; - DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn); - } - - return S_OK; -} - -HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties) -{ - if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED; - - BITMAPINFOHEADER bih; - ExtractBIH(&m_pOutput->CurrentMediaType(), &bih); - - pProperties->cBuffers = 1; - pProperties->cbBuffer = bih.biSizeImage; - pProperties->cbAlign = 1; - pProperties->cbPrefix = 0; - - HRESULT hr; - ALLOCATOR_PROPERTIES Actual; - if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) - return hr; - - return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer - ? E_FAIL - : NOERROR; -} - -HRESULT CDeinterlacerFilter::GetMediaType(int iPosition, CMediaType* pmt) -{ - if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED; - if(iPosition < 0) return E_INVALIDARG; - if(iPosition > 0) return VFW_S_NO_MORE_ITEMS; - *pmt = m_pInput->CurrentMediaType(); - CorrectMediaType(pmt); - return S_OK; -} \ No newline at end of file diff --git a/src/apps/mplayerc/DeinterlacerFilter.h b/src/apps/mplayerc/DeinterlacerFilter.h deleted file mode 100644 index d1c441ec6..000000000 --- a/src/apps/mplayerc/DeinterlacerFilter.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -[uuid("96F3E0BE-1BA4-4E79-973D-191FE425C86B")] -class CDeinterlacerFilter : public CTransformFilter -{ -protected: - HRESULT CDeinterlacerFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin); - HRESULT CheckInputType(const CMediaType* mtIn); - HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut); - HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut); - HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties); - HRESULT GetMediaType(int iPosition, CMediaType* pmt); - -public: - CDeinterlacerFilter(LPUNKNOWN punk, HRESULT* phr); -}; diff --git a/src/apps/mplayerc/FGFilter.cpp b/src/apps/mplayerc/FGFilter.cpp deleted file mode 100644 index 1ebae6cdc..000000000 --- a/src/apps/mplayerc/FGFilter.cpp +++ /dev/null @@ -1,621 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "FGFilter.h" -#include "..\..\DSUtil\DSUtil.h" -#include "DX7AllocatorPresenter.h" -#include "DX9AllocatorPresenter.h" -#include "..\..\..\include\moreuuids.h" - -// -// CFGFilter -// - -CFGFilter::CFGFilter(const CLSID& clsid, CStringW name, UINT64 merit) - : m_clsid(clsid) - , m_name(name) -{ - m_merit.val = merit; -} - -const CAtlList& CFGFilter::GetTypes() const -{ - return m_types; -} - -void CFGFilter::SetTypes(const CAtlList& types) -{ - m_types.RemoveAll(); - m_types.AddTailList(&types); -} - -void CFGFilter::AddType(const GUID& majortype, const GUID& subtype) -{ - m_types.AddTail(majortype); - m_types.AddTail(subtype); -} - -bool CFGFilter::CheckTypes(const CAtlArray& types, bool fExactMatch) -{ - POSITION pos = m_types.GetHeadPosition(); - while(pos) - { - const GUID& majortype = m_types.GetNext(pos); - if(!pos) {ASSERT(0); break;} - const GUID& subtype = m_types.GetNext(pos); - - for(int i = 0, len = types.GetCount() & ~1; i < len; i += 2) - { - if(fExactMatch) - { - if(majortype == types[i] && majortype != GUID_NULL - && subtype == types[i+1] && subtype != GUID_NULL) - return true; - } - else - { - if((majortype == GUID_NULL || types[i] == GUID_NULL || majortype == types[i]) - && (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1])) - return true; - } - } - } - - return false; -} - -// -// CFGFilterRegistry -// - -CFGFilterRegistry::CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit) - : CFGFilter(GUID_NULL, L"", merit) - , m_pMoniker(pMoniker) -{ - if(!m_pMoniker) return; - - LPOLESTR str = NULL; - if(FAILED(m_pMoniker->GetDisplayName(0, 0, &str))) return; - m_DisplayName = m_name = str; - CoTaskMemFree(str), str = NULL; - - CComPtr pPB; - if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) - { - CComVariant var; - if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) - { - m_name = var.bstrVal; - var.Clear(); - } - - if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL))) - { - CLSIDFromString(var.bstrVal, &m_clsid); - var.Clear(); - } - - if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) - { - BSTR* pstr; - if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr))) - { - ExtractFilterData((BYTE*)pstr, var.parray->cbElements*(var.parray->rgsabound[0].cElements)); - SafeArrayUnaccessData(var.parray); - } - - var.Clear(); - } - } - - if(merit != MERIT64_DO_USE) m_merit.val = merit; -} - -CFGFilterRegistry::CFGFilterRegistry(CStringW DisplayName, UINT64 merit) - : CFGFilter(GUID_NULL, L"", merit) - , m_DisplayName(DisplayName) -{ - if(m_DisplayName.IsEmpty()) return; - - CComPtr pBC; - CreateBindCtx(0, &pBC); - - ULONG chEaten; - if(S_OK != MkParseDisplayName(pBC, CComBSTR(m_DisplayName), &chEaten, &m_pMoniker)) - return; - - CComPtr pPB; - if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) - { - CComVariant var; - if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) - { - m_name = var.bstrVal; - var.Clear(); - } - - if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL))) - { - CLSIDFromString(var.bstrVal, &m_clsid); - var.Clear(); - } - - if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) - { - BSTR* pstr; - if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr))) - { - ExtractFilterData((BYTE*)pstr, var.parray->cbElements*(var.parray->rgsabound[0].cElements)); - SafeArrayUnaccessData(var.parray); - } - - var.Clear(); - } - } - - if(merit != MERIT64_DO_USE) m_merit.val = merit; -} - -CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit) - : CFGFilter(clsid, L"", merit) -{ - if(m_clsid == GUID_NULL) return; - - CString guid = CStringFromGUID(m_clsid); - - CRegKey key; - - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + guid, KEY_READ)) - { - ULONG nChars = 0; - if(ERROR_SUCCESS == key.QueryStringValue(NULL, NULL, &nChars)) - { - CString name; - if(ERROR_SUCCESS == key.QueryStringValue(NULL, name.GetBuffer(nChars), &nChars)) - { - name.ReleaseBuffer(nChars); - m_name = name; - } - } - - key.Close(); - } - - CRegKey catkey; - - if(ERROR_SUCCESS == catkey.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance"), KEY_READ)) - { - if(ERROR_SUCCESS != key.Open(catkey, guid, KEY_READ)) - { - // illiminable pack uses the name of the filter and not the clsid, have to enum all keys to find it... - - FILETIME ft; - TCHAR buff[256]; - DWORD len = countof(buff); - for(DWORD i = 0; ERROR_SUCCESS == catkey.EnumKey(i, buff, &len, &ft); i++, len = countof(buff)) - { - if(ERROR_SUCCESS == key.Open(catkey, buff, KEY_READ)) - { - TCHAR clsid[256]; - len = countof(clsid); - if(ERROR_SUCCESS == key.QueryStringValue(_T("CLSID"), clsid, &len) && GUIDFromCString(clsid) == m_clsid) - break; - - key.Close(); - } - } - } - - if(key) - { - ULONG nChars = 0; - if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), NULL, &nChars)) - { - CString name; - if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), name.GetBuffer(nChars), &nChars)) - { - name.ReleaseBuffer(nChars); - m_name = name; - } - } - - ULONG nBytes = 0; - if(ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), NULL, &nBytes)) - { - CAutoVectorPtr buff; - if(buff.Allocate(nBytes) && ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), buff, &nBytes)) - { - ExtractFilterData(buff, nBytes); - } - } - - key.Close(); - } - } - - if(merit != MERIT64_DO_USE) m_merit.val = merit; -} - -HRESULT CFGFilterRegistry::Create(IBaseFilter** ppBF, CInterfaceList& pUnks) -{ - CheckPointer(ppBF, E_POINTER); - - HRESULT hr = E_FAIL; - - if(m_pMoniker) - { - if(SUCCEEDED(hr = m_pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)ppBF))) - { - m_clsid = ::GetCLSID(*ppBF); - } - } - else if(m_clsid != GUID_NULL) - { - CComQIPtr pBF; - - if(FAILED(pBF.CoCreateInstance(m_clsid))) - return E_FAIL; - - *ppBF = pBF.Detach(); - - hr = S_OK; - } - - return hr; -}; - -[uuid("97f7c4d4-547b-4a5f-8332-536430ad2e4d")] -interface IAMFilterData : public IUnknown -{ - STDMETHOD (ParseFilterData) (BYTE* rgbFilterData, ULONG cb, BYTE** prgbRegFilter2) PURE; - STDMETHOD (CreateFilterData) (REGFILTER2* prf2, BYTE** prgbFilterData, ULONG* pcb) PURE; -}; - -void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) -{ - CComPtr pFD; - BYTE* ptr = NULL; - - if(SUCCEEDED(pFD.CoCreateInstance(CLSID_FilterMapper2)) - && SUCCEEDED(pFD->ParseFilterData(p, len, (BYTE**)&ptr))) - { - REGFILTER2* prf = (REGFILTER2*)*(DWORD*)ptr; // this is f*cked up - - m_merit.mid = prf->dwMerit; - - if(prf->dwVersion == 1) - { - for(UINT i = 0; i < prf->cPins; i++) - { - if(prf->rgPins[i].bOutput) - continue; - - for(UINT j = 0; j < prf->rgPins[i].nMediaTypes; j++) - { - if(!prf->rgPins[i].lpMediaType[j].clsMajorType || !prf->rgPins[i].lpMediaType[j].clsMinorType) - break; - - const REGPINTYPES& rpt = prf->rgPins[i].lpMediaType[j]; - AddType(*rpt.clsMajorType, *rpt.clsMinorType); - } - } - } - else if(prf->dwVersion == 2) - { - for(UINT i = 0; i < prf->cPins2; i++) - { - if(prf->rgPins2[i].dwFlags®_PINFLAG_B_OUTPUT) - continue; - - for(UINT j = 0; j < prf->rgPins2[i].nMediaTypes; j++) - { - if(!prf->rgPins2[i].lpMediaType[j].clsMajorType || !prf->rgPins2[i].lpMediaType[j].clsMinorType) - break; - - const REGPINTYPES& rpt = prf->rgPins2[i].lpMediaType[j]; - AddType(*rpt.clsMajorType, *rpt.clsMinorType); - } - } - } - - CoTaskMemFree(prf); - } - else - { - BYTE* base = p; - - #define ChkLen(size) if(p - base + size > (int)len) return; - - ChkLen(4) - if(*(DWORD*)p != 0x00000002) return; // only version 2 supported, no samples found for 1 - p += 4; - - ChkLen(4) - m_merit.mid = *(DWORD*)p; p += 4; - - m_types.RemoveAll(); - - ChkLen(8) - DWORD nPins = *(DWORD*)p; p += 8; - while(nPins-- > 0) - { - ChkLen(1) - BYTE n = *p-0x30; p++; - - ChkLen(2) - WORD pi = *(WORD*)p; p += 2; - ASSERT(pi == 'ip'); - - ChkLen(1) - BYTE x33 = *p; p++; - ASSERT(x33 == 0x33); - - ChkLen(8) - bool fOutput = !!(*p®_PINFLAG_B_OUTPUT); - p += 8; - - ChkLen(12) - DWORD nTypes = *(DWORD*)p; p += 12; - while(nTypes-- > 0) - { - ChkLen(1) - BYTE n = *p-0x30; p++; - - ChkLen(2) - WORD ty = *(WORD*)p; p += 2; - ASSERT(ty == 'yt'); - - ChkLen(5) - BYTE x33 = *p; p++; - ASSERT(x33 == 0x33); - p += 4; - - ChkLen(8) - if(*(DWORD*)p < (p-base+8) || *(DWORD*)p >= len - || *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len) - { - p += 8; - continue; - } - - GUID majortype, subtype; - memcpy(&majortype, &base[*(DWORD*)p], sizeof(GUID)); p += 4; - if(!fOutput) AddType(majortype, subtype); - } - } - - #undef ChkLen - } -} - -// -// CFGFilterFile -// - -CFGFilterFile::CFGFilterFile(const CLSID& clsid, CString path, CStringW name, UINT64 merit) - : CFGFilter(clsid, name, merit) - , m_path(path) - , m_hInst(NULL) -{ -} - -HRESULT CFGFilterFile::Create(IBaseFilter** ppBF, CInterfaceList& pUnks) -{ - CheckPointer(ppBF, E_POINTER); - - return LoadExternalFilter(m_path, m_clsid, ppBF); -} - -// -// CFGFilterVideoRenderer -// - -CFGFilterVideoRenderer::CFGFilterVideoRenderer(HWND hWnd, const CLSID& clsid, CStringW name, UINT64 merit) - : CFGFilter(clsid, name, merit) - , m_hWnd(hWnd) -{ - AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL); -} - -HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, CInterfaceList& pUnks) -{ - CheckPointer(ppBF, E_POINTER); - - HRESULT hr = S_OK; - - CComPtr pCAP; - - if(m_clsid == CLSID_VMR7AllocatorPresenter - || m_clsid == CLSID_VMR9AllocatorPresenter - || m_clsid == CLSID_DXRAllocatorPresenter) - { - if(SUCCEEDED(CreateAP7(m_clsid, m_hWnd, &pCAP)) - || SUCCEEDED(CreateAP9(m_clsid, m_hWnd, &pCAP))) - { - CComPtr pRenderer; - if(SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer))) - { - *ppBF = CComQIPtr(pRenderer).Detach(); - pUnks.AddTail(pCAP); - } - } - } - else - { - CComPtr pBF; - if(SUCCEEDED(pBF.CoCreateInstance(m_clsid))) - { - BeginEnumPins(pBF, pEP, pPin) - { - if(CComQIPtr pMPC = pPin) - { - pUnks.AddTail(pMPC); - break; - } - } - EndEnumPins - - *ppBF = pBF.Detach(); - } - } - - if(!*ppBF) hr = E_FAIL; - - return hr; -} - -// -// CFGFilterList -// - -CFGFilterList::CFGFilterList() -{ -} - -CFGFilterList::~CFGFilterList() -{ - RemoveAll(); -} - -void CFGFilterList::RemoveAll() -{ - while(!m_filters.IsEmpty()) - { - const filter_t& f = m_filters.RemoveHead(); - if(f.autodelete) delete f.pFGF; - } - - m_sortedfilters.RemoveAll(); -} - -void CFGFilterList::Insert(CFGFilter* pFGF, int group, bool exactmatch, bool autodelete) -{ - if(CFGFilterRegistry* f1r = dynamic_cast(pFGF)) - { - POSITION pos = m_filters.GetHeadPosition(); - while(pos) - { - filter_t& f2 = m_filters.GetNext(pos); - - if(group != f2.group) continue; - - if(CFGFilterRegistry* f2r = dynamic_cast(f2.pFGF)) - { - if(f1r->GetMoniker() && f2r->GetMoniker() && S_OK == f1r->GetMoniker()->IsEqual(f2r->GetMoniker()) - || f1r->GetCLSID() != GUID_NULL && f1r->GetCLSID() == f2r->GetCLSID()) - { - TRACE(_T("FGM: Inserting %d %d %016I64x '%s' NOT!\n"), - group, exactmatch, pFGF->GetMerit(), - pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName())); - - if(autodelete) delete pFGF; - return; - } - } - } - } - - POSITION pos = m_filters.GetHeadPosition(); - while(pos) - { - if(m_filters.GetNext(pos).pFGF == pFGF) - { - TRACE(_T("FGM: Inserting %d %d %016I64x '%s' DUP!\n"), - group, exactmatch, pFGF->GetMerit(), - pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName())); - - if(autodelete) delete pFGF; - return; - } - } - - TRACE(_T("FGM: Inserting %d %d %016I64x '%s'\n"), - group, exactmatch, pFGF->GetMerit(), - pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName())); - - filter_t f = {m_filters.GetCount(), pFGF, group, exactmatch, autodelete}; - m_filters.AddTail(f); - - m_sortedfilters.RemoveAll(); -} - -POSITION CFGFilterList::GetHeadPosition() -{ - if(m_sortedfilters.IsEmpty()) - { - CAtlArray sort; - sort.SetCount(m_filters.GetCount()); - POSITION pos = m_filters.GetHeadPosition(); - for(int i = 0; pos; i++) sort[i] = m_filters.GetNext(pos); - qsort(&sort[0], sort.GetCount(), sizeof(sort[0]), filter_cmp); - for(size_t i = 0; i < sort.GetCount(); i++) - if(sort[i].pFGF->GetMerit() >= MERIT64_DO_USE) - m_sortedfilters.AddTail(sort[i].pFGF); - } - - TRACE(_T("FGM: Sorting filters\n")); - - POSITION pos = m_sortedfilters.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_sortedfilters.GetNext(pos); - TRACE(_T("FGM: - %016I64x '%s'\n"), pFGF->GetMerit(), pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName())); - } - - return m_sortedfilters.GetHeadPosition(); -} - -CFGFilter* CFGFilterList::GetNext(POSITION& pos) -{ - return m_sortedfilters.GetNext(pos); -} - -int CFGFilterList::filter_cmp(const void* a, const void* b) -{ - filter_t* fa = (filter_t*)a; - filter_t* fb = (filter_t*)b; - - if(fa->group < fb->group) return -1; - if(fa->group > fb->group) return +1; - - if(fa->pFGF->GetCLSID() == fb->pFGF->GetCLSID()) - { - CFGFilterFile* fgfa = dynamic_cast(fa->pFGF); - CFGFilterFile* fgfb = dynamic_cast(fb->pFGF); - - if(fgfa && !fgfb) return -1; - if(!fgfa && fgfb) return +1; - } - - if(fa->pFGF->GetMerit() > fb->pFGF->GetMerit()) return -1; - if(fa->pFGF->GetMerit() < fb->pFGF->GetMerit()) return +1; - - if(fa->exactmatch && !fb->exactmatch) return -1; - if(!fa->exactmatch && fb->exactmatch) return +1; - - if(fa->index < fb->index) return -1; - if(fa->index > fb->index) return +1; - - return 0; -} - - diff --git a/src/apps/mplayerc/FGFilter.h b/src/apps/mplayerc/FGFilter.h deleted file mode 100644 index 0a8d025ef..000000000 --- a/src/apps/mplayerc/FGFilter.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#define MERIT64(merit) (((UINT64)(merit))<<16) -#define MERIT64_DO_NOT_USE MERIT64(MERIT_DO_NOT_USE) -#define MERIT64_DO_USE MERIT64(MERIT_DO_NOT_USE+1) -#define MERIT64_UNLIKELY (MERIT64(MERIT_UNLIKELY)) -#define MERIT64_NORMAL (MERIT64(MERIT_NORMAL)) -#define MERIT64_PREFERRED (MERIT64(MERIT_PREFERRED)) -#define MERIT64_ABOVE_DSHOW (MERIT64(1)<<32) - -class CFGFilter -{ -protected: - CLSID m_clsid; - CStringW m_name; - struct {union {UINT64 val; struct {UINT64 low:16, mid:32, high:16;};};} m_merit; - CAtlList m_types; - -public: - CFGFilter(const CLSID& clsid, CStringW name = L"", UINT64 merit = MERIT64_DO_USE); - virtual ~CFGFilter() {} - - CLSID GetCLSID() {return m_clsid;} - CStringW GetName() {return m_name;} - UINT64 GetMerit() {return m_merit.val;} - DWORD GetMeritForDirectShow() {return m_merit.mid;} - const CAtlList& GetTypes() const; - void SetTypes(const CAtlList& types); - void AddType(const GUID& majortype, const GUID& subtype); - bool CheckTypes(const CAtlArray& types, bool fExactMatch); - - CAtlList m_protocols, m_extensions, m_chkbytes; // TODO: subtype? - - virtual HRESULT Create(IBaseFilter** ppBF, CInterfaceList& pUnks) = 0; -}; - -class CFGFilterRegistry : public CFGFilter -{ -protected: - CStringW m_DisplayName; - CComPtr m_pMoniker; - - void ExtractFilterData(BYTE* p, UINT len); - -public: - CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit = MERIT64_DO_USE); - CFGFilterRegistry(CStringW DisplayName, UINT64 merit = MERIT64_DO_USE); - CFGFilterRegistry(const CLSID& clsid, UINT64 merit = MERIT64_DO_USE); - - CStringW GetDisplayName() {return m_DisplayName;} - IMoniker* GetMoniker() {return m_pMoniker;} - - HRESULT Create(IBaseFilter** ppBF, CInterfaceList& pUnks); -}; - -template -class CFGFilterInternal : public CFGFilter -{ -public: - CFGFilterInternal(CStringW name = L"", UINT64 merit = MERIT64_DO_USE) : CFGFilter(__uuidof(T), name, merit) {} - - HRESULT Create(IBaseFilter** ppBF, CInterfaceList& pUnks) - { - CheckPointer(ppBF, E_POINTER); - - HRESULT hr = S_OK; - CComPtr pBF = new T(NULL, &hr); - if(FAILED(hr)) return hr; - - *ppBF = pBF.Detach(); - - return hr; - } -}; - -class CFGFilterFile : public CFGFilter -{ -protected: - CString m_path; - HINSTANCE m_hInst; - -public: - CFGFilterFile(const CLSID& clsid, CString path, CStringW name = L"", UINT64 merit = MERIT64_DO_USE); - - HRESULT Create(IBaseFilter** ppBF, CInterfaceList& pUnks); -}; - -class CFGFilterVideoRenderer : public CFGFilter -{ -protected: - HWND m_hWnd; - -public: - CFGFilterVideoRenderer(HWND hWnd, const CLSID& clsid, CStringW name = L"", UINT64 merit = MERIT64_DO_USE); - - HRESULT Create(IBaseFilter** ppBF, CInterfaceList& pUnks); -}; - -class CFGFilterList -{ - struct filter_t {int index; CFGFilter* pFGF; int group; bool exactmatch, autodelete;}; - static int filter_cmp(const void* a, const void* b); - CAtlList m_filters; - CAtlList m_sortedfilters; - -public: - CFGFilterList(); - virtual ~CFGFilterList(); - - bool IsEmpty() {return m_filters.IsEmpty();} - void RemoveAll(); - void Insert(CFGFilter* pFGF, int group, bool exactmatch = false, bool autodelete = true); - - POSITION GetHeadPosition(); - CFGFilter* GetNext(POSITION& pos); -}; diff --git a/src/apps/mplayerc/FGManager.cpp b/src/apps/mplayerc/FGManager.cpp deleted file mode 100644 index a589ae337..000000000 --- a/src/apps/mplayerc/FGManager.cpp +++ /dev/null @@ -1,2067 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "mplayerc.h" -#include "FGManager.h" -#include "..\..\DSUtil\DSUtil.h" -#include "..\..\Filters\Filters.h" -#include "DX7AllocatorPresenter.h" -#include "DX9AllocatorPresenter.h" -#include "DeinterlacerFilter.h" -#include -#include "..\..\..\include\moreuuids.h" -#include -#include -#include - -// -// CFGManager -// - -CFGManager::CFGManager(LPCTSTR pName, LPUNKNOWN pUnk) - : CUnknown(pName, pUnk) - , m_dwRegister(0) -{ - m_pUnkInner.CoCreateInstance(CLSID_FilterGraph, GetOwner()); - m_pFM.CoCreateInstance(CLSID_FilterMapper2); -} - -CFGManager::~CFGManager() -{ - CAutoLock cAutoLock(this); - while(!m_source.IsEmpty()) delete m_source.RemoveHead(); - while(!m_transform.IsEmpty()) delete m_transform.RemoveHead(); - while(!m_override.IsEmpty()) delete m_override.RemoveHead(); - m_pUnks.RemoveAll(); - m_pUnkInner.Release(); -} - -STDMETHODIMP CFGManager::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - QI(IFilterGraph) - QI(IGraphBuilder) - QI(IFilterGraph2) - QI(IGraphBuilder2) - QI(IGraphBuilderDeadEnd) - m_pUnkInner && (riid != IID_IUnknown && SUCCEEDED(m_pUnkInner->QueryInterface(riid, ppv))) ? S_OK : - __super::NonDelegatingQueryInterface(riid, ppv); -} - -// - -void CFGManager::CStreamPath::Append(IBaseFilter* pBF, IPin* pPin) -{ - path_t p; - p.clsid = GetCLSID(pBF); - p.filter = GetFilterName(pBF); - p.pin = GetPinName(pPin); - AddTail(p); -} - -bool CFGManager::CStreamPath::Compare(const CStreamPath& path) -{ - POSITION pos1 = GetHeadPosition(); - POSITION pos2 = path.GetHeadPosition(); - - while(pos1 && pos2) - { - const path_t& p1 = GetNext(pos1); - const path_t& p2 = path.GetNext(pos2); - - if(p1.filter != p2.filter) return true; - else if(p1.pin != p2.pin) return false; - } - - return true; -} - -// - -bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes) -{ - CAtlList sl; - Explode(chkbytes, sl, ','); - - if(sl.GetCount() < 4) - return false; - - ASSERT(!(sl.GetCount()&3)); - - LARGE_INTEGER size = {0, 0}; - size.LowPart = GetFileSize(hFile, (DWORD*)&size.HighPart); - - POSITION pos = sl.GetHeadPosition(); - while(sl.GetCount() >= 4) - { - CString offsetstr = sl.RemoveHead(); - CString cbstr = sl.RemoveHead(); - CString maskstr = sl.RemoveHead(); - CString valstr = sl.RemoveHead(); - - long cb = _ttol(cbstr); - - if(offsetstr.IsEmpty() || cbstr.IsEmpty() - || valstr.IsEmpty() || (valstr.GetLength() & 1) - || cb*2 != valstr.GetLength()) - return false; - - LARGE_INTEGER offset; - offset.QuadPart = _ttoi64(offsetstr); - if(offset.QuadPart < 0) offset.QuadPart = size.QuadPart - offset.QuadPart; - SetFilePointer(hFile, offset.LowPart, &offset.HighPart, FILE_BEGIN); - - // LAME - while(maskstr.GetLength() < valstr.GetLength()) - maskstr += 'F'; - - CAtlArray mask, val; - CStringToBin(maskstr, mask); - CStringToBin(valstr, val); - - for(size_t i = 0; i < val.GetCount(); i++) - { - BYTE b; - DWORD r; - if(!ReadFile(hFile, &b, 1, &r, NULL) || (b & mask[i]) != val[i]) - return false; - } - } - - return sl.IsEmpty(); -} - -HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl) -{ - // TODO: use overrides - - CheckPointer(lpcwstrFileName, E_POINTER); - - fl.RemoveAll(); - - CStringW fn = CStringW(lpcwstrFileName).TrimLeft(); - CStringW protocol = fn.Left(fn.Find(':')+1).TrimRight(':').MakeLower(); - CStringW ext = CPathW(fn).GetExtension().MakeLower(); - - HANDLE hFile = INVALID_HANDLE_VALUE; - - if(protocol.GetLength() <= 1 || protocol == L"file") - { - hFile = CreateFile(CString(fn), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - return VFW_E_NOT_FOUND; - } - } - - // exceptions first - - if(ext == _T(".dvr-ms")) // doh, this is stupid - { - fl.Insert(new CFGFilterRegistry(CLSID_StreamBufferSource, MERIT64_PREFERRED), 0); - } - - TCHAR buff[256], buff2[256]; - ULONG len, len2; - - if(hFile == INVALID_HANDLE_VALUE) - { - // internal / protocol - - POSITION pos = m_source.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_source.GetNext(pos); - if(pFGF->m_protocols.Find(CString(protocol))) - fl.Insert(pFGF, 0, false, false); - } - } - else - { - // internal / check bytes - - POSITION pos = m_source.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_source.GetNext(pos); - - POSITION pos2 = pFGF->m_chkbytes.GetHeadPosition(); - while(pos2) - { - if(CheckBytes(hFile, pFGF->m_chkbytes.GetNext(pos2))) - { - fl.Insert(pFGF, 1, false, false); - break; - } - } - } - } - - if(!ext.IsEmpty()) - { - // internal / file extension - - POSITION pos = m_source.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_source.GetNext(pos); - if(pFGF->m_extensions.Find(CString(ext))) - fl.Insert(pFGF, 2, false, false); - } - } - - { - // internal / the rest - - POSITION pos = m_source.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_source.GetNext(pos); - if(pFGF->m_protocols.IsEmpty() && pFGF->m_chkbytes.IsEmpty() && pFGF->m_extensions.IsEmpty()) - fl.Insert(pFGF, 3, false, false); - } - } - - if(hFile == INVALID_HANDLE_VALUE) - { - // protocol - - CRegKey key; - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, CString(protocol), KEY_READ)) - { - CRegKey exts; - if(ERROR_SUCCESS == exts.Open(key, _T("Extensions"), KEY_READ)) - { - len = countof(buff); - if(ERROR_SUCCESS == exts.QueryStringValue(CString(ext), buff, &len)) - fl.Insert(new CFGFilterRegistry(GUIDFromCString(buff)), 4); - } - - len = countof(buff); - if(ERROR_SUCCESS == key.QueryStringValue(_T("Source Filter"), buff, &len)) - fl.Insert(new CFGFilterRegistry(GUIDFromCString(buff)), 5); - } - - fl.Insert(new CFGFilterRegistry(CLSID_URLReader), 6); - } - else - { - // check bytes - - CRegKey key; - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type"), KEY_READ)) - { - FILETIME ft; - len = countof(buff); - for(DWORD i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len, &ft); i++, len = countof(buff)) - { - GUID majortype; - if(FAILED(GUIDFromCString(buff, majortype))) - continue; - - CRegKey majorkey; - if(ERROR_SUCCESS == majorkey.Open(key, buff, KEY_READ)) - { - len = countof(buff); - for(DWORD j = 0; ERROR_SUCCESS == majorkey.EnumKey(j, buff, &len, &ft); j++, len = countof(buff)) - { - GUID subtype; - if(FAILED(GUIDFromCString(buff, subtype))) - continue; - - CRegKey subkey; - if(ERROR_SUCCESS == subkey.Open(majorkey, buff, KEY_READ)) - { - len = countof(buff); - if(ERROR_SUCCESS != subkey.QueryStringValue(_T("Source Filter"), buff, &len)) - continue; - - GUID clsid = GUIDFromCString(buff); - - len = countof(buff); - len2 = sizeof(buff2); - for(DWORD k = 0, type; - clsid != GUID_NULL && ERROR_SUCCESS == RegEnumValue(subkey, k, buff2, &len2, 0, &type, (BYTE*)buff, &len); - k++, len = countof(buff), len2 = sizeof(buff2)) - { - if(CheckBytes(hFile, CString(buff))) - { - CFGFilter* pFGF = new CFGFilterRegistry(clsid); - pFGF->AddType(majortype, subtype); - fl.Insert(pFGF, 9); - break; - } - } - } - } - } - } - } - } - - if(!ext.IsEmpty()) - { - // file extension - - CRegKey key; - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type\\Extensions\\") + CString(ext), KEY_READ)) - { - ULONG len = countof(buff); - memset(buff, 0, sizeof(buff)); - LONG ret = key.QueryStringValue(_T("Source Filter"), buff, &len); // QueryStringValue can return ERROR_INVALID_DATA on bogus strings (radlight mpc v1003, fixed in v1004) - if(ERROR_SUCCESS == ret || ERROR_INVALID_DATA == ret && GUIDFromCString(buff) != GUID_NULL) - { - GUID clsid = GUIDFromCString(buff); - GUID majortype = GUID_NULL; - GUID subtype = GUID_NULL; - - len = countof(buff); - if(ERROR_SUCCESS == key.QueryStringValue(_T("Media Type"), buff, &len)) - majortype = GUIDFromCString(buff); - - len = countof(buff); - if(ERROR_SUCCESS == key.QueryStringValue(_T("Subtype"), buff, &len)) - subtype = GUIDFromCString(buff); - - CFGFilter* pFGF = new CFGFilterRegistry(clsid); - pFGF->AddType(majortype, subtype); - fl.Insert(pFGF, 7); - } - } - } - - if(hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(hFile); - } - - CFGFilter* pFGF = new CFGFilterRegistry(CLSID_AsyncReader); - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_NULL); - fl.Insert(pFGF, 9); - - return S_OK; -} - -HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppBF) -{ - TRACE(_T("FGM: AddSourceFilter trying '%s'\n"), CStringFromGUID(pFGF->GetCLSID())); - - CheckPointer(lpcwstrFileName, E_POINTER); - CheckPointer(ppBF, E_POINTER); - - ASSERT(*ppBF == NULL); - - HRESULT hr; - - CComPtr pBF; - CInterfaceList pUnks; - if(FAILED(hr = pFGF->Create(&pBF, pUnks))) - return hr; - - CComQIPtr pFSF = pBF; - if(!pFSF) return E_NOINTERFACE; - - if(FAILED(hr = AddFilter(pBF, lpcwstrFilterName))) - return hr; - - const AM_MEDIA_TYPE* pmt = NULL; - - CMediaType mt; - const CAtlList& types = pFGF->GetTypes(); - if(types.GetCount() == 2 && (types.GetHead() != GUID_NULL || types.GetTail() != GUID_NULL)) - { - mt.majortype = types.GetHead(); - mt.subtype = types.GetTail(); - pmt = &mt; - } - - if(FAILED(hr = pFSF->Load(lpcwstrFileName, pmt))) - { - RemoveFilter(pBF); - return hr; - } - - // doh :P - BeginEnumMediaTypes(GetFirstPin(pBF, PINDIR_OUTPUT), pEMT, pmt) - { - if(pmt->subtype == GUIDFromCString(_T("{640999A0-A946-11D0-A520-000000000000}")) - || pmt->subtype == GUIDFromCString(_T("{640999A1-A946-11D0-A520-000000000000}")) - || pmt->subtype == GUIDFromCString(_T("{D51BD5AE-7548-11CF-A520-0080C77EF58A}"))) - { - RemoveFilter(pBF); - pFGF = new CFGFilterRegistry(CLSID_NetShowSource); - hr = AddSourceFilter(pFGF, lpcwstrFileName, lpcwstrFilterName, ppBF); - delete pFGF; - return hr; - } - } - EndEnumMediaTypes(pmt) - - *ppBF = pBF.Detach(); - - m_pUnks.AddTailList(&pUnks); - - return S_OK; -} - -// IFilterGraph - -STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - HRESULT hr; - - if(FAILED(hr = CComQIPtr(m_pUnkInner)->AddFilter(pFilter, pName))) - return hr; - - // TODO - hr = pFilter->JoinFilterGraph(NULL, NULL); - hr = pFilter->JoinFilterGraph(this, pName); - - return hr; -} - -STDMETHODIMP CFGManager::RemoveFilter(IBaseFilter* pFilter) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->RemoveFilter(pFilter); -} - -STDMETHODIMP CFGManager::EnumFilters(IEnumFilters** ppEnum) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->EnumFilters(ppEnum); -} - -STDMETHODIMP CFGManager::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->FindFilterByName(pName, ppFilter); -} - -STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - CComPtr pBF = GetFilterFromPin(pPinIn); - CLSID clsid = GetCLSID(pBF); - - // TODO: GetUpStreamFilter goes up on the first input pin only - for(CComPtr pBFUS = GetFilterFromPin(pPinOut); pBFUS; pBFUS = GetUpStreamFilter(pBFUS)) - { - if(pBFUS == pBF) return VFW_E_CIRCULAR_GRAPH; - if(GetCLSID(pBFUS) == clsid) return VFW_E_CANNOT_CONNECT; - } - - return CComQIPtr(m_pUnkInner)->ConnectDirect(pPinOut, pPinIn, pmt); -} - -STDMETHODIMP CFGManager::Reconnect(IPin* ppin) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->Reconnect(ppin); -} - -STDMETHODIMP CFGManager::Disconnect(IPin* ppin) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->Disconnect(ppin); -} - -STDMETHODIMP CFGManager::SetDefaultSyncSource() -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->SetDefaultSyncSource(); -} - -// IGraphBuilder - -STDMETHODIMP CFGManager::Connect(IPin* pPinOut, IPin* pPinIn) -{ - CAutoLock cAutoLock(this); - - CheckPointer(pPinOut, E_POINTER); - - HRESULT hr; - - if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT) - || pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT)) - return VFW_E_INVALID_DIRECTION; - - if(S_OK == IsPinConnected(pPinOut) - || pPinIn && S_OK == IsPinConnected(pPinIn)) - return VFW_E_ALREADY_CONNECTED; - - bool fDeadEnd = true; - - if(pPinIn) - { - // 1. Try a direct connection between the filters, with no intermediate filters - - if(SUCCEEDED(hr = ConnectDirect(pPinOut, pPinIn, NULL))) - return hr; - } - else - { - // 1. Use IStreamBuilder - - if(CComQIPtr pSB = pPinOut) - { - if(SUCCEEDED(hr = pSB->Render(pPinOut, this))) - return hr; - - pSB->Backout(pPinOut, this); - } - } - - // 2. Try cached filters - - if(CComQIPtr pGC = (IGraphBuilder2*)this) - { - BeginEnumCachedFilters(pGC, pEF, pBF) - { - if(pPinIn && GetFilterFromPin(pPinIn) == pBF) - continue; - - hr = pGC->RemoveFilterFromCache(pBF); - - // does RemoveFilterFromCache call AddFilter like AddFilterToCache calls RemoveFilter ? - - if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL))) - { - if(!IsStreamEnd(pBF)) fDeadEnd = false; - - if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn))) - return hr; - } - - hr = pGC->AddFilterToCache(pBF); - } - EndEnumCachedFilters - } - - // 3. Try filters in the graph - - { - CInterfaceList pBFs; - - BeginEnumFilters(this, pEF, pBF) - { - if(pPinIn && GetFilterFromPin(pPinIn) == pBF - || GetFilterFromPin(pPinOut) == pBF) - continue; - - // HACK: ffdshow - audio capture filter - if(GetCLSID(pPinOut) == GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}")) - && GetCLSID(pBF) == GUIDFromCString(_T("{E30629D2-27E5-11CE-875D-00608CB78066}"))) - continue; - - pBFs.AddTail(pBF); - } - EndEnumFilters - - POSITION pos = pBFs.GetHeadPosition(); - while(pos) - { - IBaseFilter* pBF = pBFs.GetNext(pos); - - if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL))) - { - if(!IsStreamEnd(pBF)) fDeadEnd = false; - - if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn))) - return hr; - } - - EXECUTE_ASSERT(Disconnect(pPinOut)); - } - } - - // 4. Look up filters in the registry - - { - CFGFilterList fl; - - CAtlArray types; - ExtractMediaTypes(pPinOut, types); - - POSITION pos = m_transform.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_transform.GetNext(pos); - if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false)) - fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true), false); - } - - pos = m_override.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = m_override.GetNext(pos); - if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false)) - fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true), false); - } - - CComPtr pEM; - if(types.GetCount() > 0 - && SUCCEEDED(m_pFM->EnumMatchingFilters( - &pEM, 0, FALSE, MERIT_DO_NOT_USE+1, - TRUE, types.GetCount()/2, types.GetData(), NULL, NULL, FALSE, - !!pPinIn, 0, NULL, NULL, NULL))) - { - for(CComPtr pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL) - { - CFGFilterRegistry* pFGF = new CFGFilterRegistry(pMoniker); - fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true)); - } - } - - pos = fl.GetHeadPosition(); - while(pos) - { - CFGFilter* pFGF = fl.GetNext(pos); - - TRACE(_T("FGM: Connecting '%s'\n"), pFGF->GetName()); - - CComPtr pBF; - CInterfaceList pUnks; - if(FAILED(pFGF->Create(&pBF, pUnks))) - continue; - - if(FAILED(hr = AddFilter(pBF, pFGF->GetName()))) - continue; - - hr = E_FAIL; - - if(FAILED(hr)) - { - hr = ConnectFilterDirect(pPinOut, pBF, NULL); - } -/* - if(FAILED(hr)) - { - if(types.GetCount() >= 2 && types[0] == MEDIATYPE_Stream && types[1] != GUID_NULL) - { - CMediaType mt; - - mt.majortype = types[0]; - mt.subtype = types[1]; - mt.formattype = FORMAT_None; - if(FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt); - - mt.formattype = GUID_NULL; - if(FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt); - } - } -*/ - if(SUCCEEDED(hr)) - { - if(!IsStreamEnd(pBF)) fDeadEnd = false; - - hr = ConnectFilter(pBF, pPinIn); - - if(SUCCEEDED(hr)) - { - m_pUnks.AddTailList(&pUnks); - - // maybe the application should do this... - - POSITION pos = pUnks.GetHeadPosition(); - while(pos) - { - if(CComQIPtr pMPC = pUnks.GetNext(pos)) - pMPC->SetAspectRatioMode(AM_ARMODE_STRETCHED); - } - - if(CComQIPtr pARC = pBF) - pARC->SetAspectRatioMode(VMR_ARMODE_NONE); - - if(CComQIPtr pARC = pBF) - pARC->SetAspectRatioMode(VMR_ARMODE_NONE); - - return hr; - } - } - - EXECUTE_ASSERT(SUCCEEDED(RemoveFilter(pBF))); - - TRACE(_T("FGM: Connecting '%s' FAILED!\n"), pFGF->GetName()); - } - } - - if(fDeadEnd) - { - CAutoPtr psde(new CStreamDeadEnd()); - psde->AddTailList(&m_streampath); - int skip = 0; - BeginEnumMediaTypes(pPinOut, pEM, pmt) - { - if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL) skip++; - psde->mts.AddTail(CMediaType(*pmt)); - } - EndEnumMediaTypes(pmt) - if(skip < psde->mts.GetCount()) - m_deadends.Add(psde); - } - - return pPinIn ? VFW_E_CANNOT_CONNECT : VFW_E_CANNOT_RENDER; -} - -STDMETHODIMP CFGManager::Render(IPin* pPinOut) -{ - CAutoLock cAutoLock(this); - - return RenderEx(pPinOut, 0, NULL); -} - -STDMETHODIMP CFGManager::RenderFile(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrPlayList) -{ - CAutoLock cAutoLock(this); - - m_streampath.RemoveAll(); - m_deadends.RemoveAll(); - - HRESULT hr; - -/* - CComPtr pBF; - if(FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF))) - return hr; - - return ConnectFilter(pBF, NULL); -*/ - - CFGFilterList fl; - if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl))) - return hr; - - CAutoPtrArray deadends; - - hr = VFW_E_CANNOT_RENDER; - - POSITION pos = fl.GetHeadPosition(); - while(pos) - { - CComPtr pBF; - - if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFileName, &pBF))) - { - m_streampath.RemoveAll(); - m_deadends.RemoveAll(); - - if(SUCCEEDED(hr = ConnectFilter(pBF, NULL))) - return hr; - - NukeDownstream(pBF); - RemoveFilter(pBF); - - deadends.Append(m_deadends); - } - } - - m_deadends.Copy(deadends); - - return hr; -} - -STDMETHODIMP CFGManager::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) -{ - CAutoLock cAutoLock(this); - - HRESULT hr; - - CFGFilterList fl; - if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl))) - return hr; - - POSITION pos = fl.GetHeadPosition(); - while(pos) - { - if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFilterName, ppFilter))) - return hr; - } - - return VFW_E_CANNOT_LOAD_SOURCE_FILTER; -} - -STDMETHODIMP CFGManager::SetLogFile(DWORD_PTR hFile) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->SetLogFile(hFile); -} - -STDMETHODIMP CFGManager::Abort() -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->Abort(); -} - -STDMETHODIMP CFGManager::ShouldOperationContinue() -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->ShouldOperationContinue(); -} - -// IFilterGraph2 - -STDMETHODIMP CFGManager::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->AddSourceFilterForMoniker(pMoniker, pCtx, lpcwstrFilterName, ppFilter); -} - -STDMETHODIMP CFGManager::ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt) -{ - if(!m_pUnkInner) return E_UNEXPECTED; - - CAutoLock cAutoLock(this); - - return CComQIPtr(m_pUnkInner)->ReconnectEx(ppin, pmt); -} - -STDMETHODIMP CFGManager::RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext) -{ - CAutoLock cAutoLock(this); - - m_streampath.RemoveAll(); - m_deadends.RemoveAll(); - - if(!pPinOut || dwFlags > AM_RENDEREX_RENDERTOEXISTINGRENDERERS || pvContext) - return E_INVALIDARG; - - HRESULT hr; - - if(dwFlags & AM_RENDEREX_RENDERTOEXISTINGRENDERERS) - { - CInterfaceList pBFs; - - BeginEnumFilters(this, pEF, pBF) - { - if(CComQIPtr pAMMF = pBF) - { - if(pAMMF->GetMiscFlags() & AM_FILTER_MISC_FLAGS_IS_RENDERER) - { - pBFs.AddTail(pBF); - } - } - else - { - BeginEnumPins(pBF, pEP, pPin) - { - CComPtr pPinIn; - DWORD size = 1; - if(SUCCEEDED(pPin->QueryInternalConnections(&pPinIn, &size)) && size == 0) - { - pBFs.AddTail(pBF); - break; - } - } - EndEnumPins - } - } - EndEnumFilters - - while(!pBFs.IsEmpty()) - { - if(SUCCEEDED(hr = ConnectFilter(pPinOut, pBFs.RemoveHead()))) - return hr; - } - - return VFW_E_CANNOT_RENDER; - } - - return Connect(pPinOut, (IPin*)NULL); -} - -// IGraphBuilder2 - -STDMETHODIMP CFGManager::IsPinDirection(IPin* pPin, PIN_DIRECTION dir1) -{ - CAutoLock cAutoLock(this); - - CheckPointer(pPin, E_POINTER); - - PIN_DIRECTION dir2; - if(FAILED(pPin->QueryDirection(&dir2))) - return E_FAIL; - - return dir1 == dir2 ? S_OK : S_FALSE; -} - -STDMETHODIMP CFGManager::IsPinConnected(IPin* pPin) -{ - CAutoLock cAutoLock(this); - - CheckPointer(pPin, E_POINTER); - - CComPtr pPinTo; - return SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo ? S_OK : S_FALSE; -} - -STDMETHODIMP CFGManager::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn) -{ - CAutoLock cAutoLock(this); - - CheckPointer(pBF, E_POINTER); - - if(pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT)) - return VFW_E_INVALID_DIRECTION; - - int nTotal = 0, nRendered = 0; - - BeginEnumPins(pBF, pEP, pPin) - { - if(GetPinName(pPin)[0] != '~' - && S_OK == IsPinDirection(pPin, PINDIR_OUTPUT) - && S_OK != IsPinConnected(pPin)) - { - m_streampath.Append(pBF, pPin); - - HRESULT hr = Connect(pPin, pPinIn); - - if(SUCCEEDED(hr)) - { - for(int i = m_deadends.GetCount()-1; i >= 0; i--) - if(m_deadends[i]->Compare(m_streampath)) - m_deadends.RemoveAt(i); - - nRendered++; - } - - nTotal++; - - m_streampath.RemoveTail(); - - if(SUCCEEDED(hr) && pPinIn) - return S_OK; - } - } - EndEnumPins - - return - nRendered == nTotal ? (nRendered > 0 ? S_OK : S_FALSE) : - nRendered > 0 ? VFW_S_PARTIAL_RENDER : - VFW_E_CANNOT_RENDER; -} - -STDMETHODIMP CFGManager::ConnectFilter(IPin* pPinOut, IBaseFilter* pBF) -{ - CAutoLock cAutoLock(this); - - CheckPointer(pPinOut, E_POINTER); - CheckPointer(pBF, E_POINTER); - - if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)) - return VFW_E_INVALID_DIRECTION; - - HRESULT hr; - - BeginEnumPins(pBF, pEP, pPin) - { - if(GetPinName(pPin)[0] != '~' - && S_OK == IsPinDirection(pPin, PINDIR_INPUT) - && S_OK != IsPinConnected(pPin) - && SUCCEEDED(hr = Connect(pPinOut, pPin))) - return hr; - } - EndEnumPins - - return VFW_E_CANNOT_CONNECT; -} - -STDMETHODIMP CFGManager::ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt) -{ - CAutoLock cAutoLock(this); - - CheckPointer(pPinOut, E_POINTER); - CheckPointer(pBF, E_POINTER); - - if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)) - return VFW_E_INVALID_DIRECTION; - - HRESULT hr; - - BeginEnumPins(pBF, pEP, pPin) - { - if(GetPinName(pPin)[0] != '~' - && S_OK == IsPinDirection(pPin, PINDIR_INPUT) - && S_OK != IsPinConnected(pPin) - && SUCCEEDED(hr = ConnectDirect(pPinOut, pPin, pmt))) - return hr; - } - EndEnumPins - - return VFW_E_CANNOT_CONNECT; -} - -STDMETHODIMP CFGManager::NukeDownstream(IUnknown* pUnk) -{ - CAutoLock cAutoLock(this); - - if(CComQIPtr pBF = pUnk) - { - BeginEnumPins(pBF, pEP, pPin) - { - NukeDownstream(pPin); - } - EndEnumPins - } - else if(CComQIPtr pPin = pUnk) - { - CComPtr pPinTo; - if(S_OK == IsPinDirection(pPin, PINDIR_OUTPUT) - && SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) - { - if(CComPtr pBF = GetFilterFromPin(pPinTo)) - { - NukeDownstream(pBF); - Disconnect(pPinTo); - Disconnect(pPin); - RemoveFilter(pBF); - } - } - } - else - { - return E_INVALIDARG; - } - - return S_OK; -} - -STDMETHODIMP CFGManager::FindInterface(REFIID iid, void** ppv, BOOL bRemove) -{ - CAutoLock cAutoLock(this); - - CheckPointer(ppv, E_POINTER); - - for(POSITION pos = m_pUnks.GetHeadPosition(); pos; m_pUnks.GetNext(pos)) - { - if(SUCCEEDED(m_pUnks.GetAt(pos)->QueryInterface(iid, ppv))) - { - if(bRemove) m_pUnks.RemoveAt(pos); - return S_OK; - } - } - - return E_NOINTERFACE; -} - -STDMETHODIMP CFGManager::AddToROT() -{ - CAutoLock cAutoLock(this); - - HRESULT hr; - - if(m_dwRegister) return S_FALSE; - - CComPtr pROT; - CComPtr pMoniker; - WCHAR wsz[256]; - swprintf(wsz, L"FilterGraph %08p pid %08x (MPC)", (DWORD_PTR)this, GetCurrentProcessId()); - if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT)) - && SUCCEEDED(hr = CreateItemMoniker(L"!", wsz, &pMoniker))) - hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, (IGraphBuilder2*)this, pMoniker, &m_dwRegister); - - return hr; -} - -STDMETHODIMP CFGManager::RemoveFromROT() -{ - CAutoLock cAutoLock(this); - - HRESULT hr; - - if(!m_dwRegister) return S_FALSE; - - CComPtr pROT; - if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT)) - && SUCCEEDED(hr = pROT->Revoke(m_dwRegister))) - m_dwRegister = 0; - - return hr; -} - -// IGraphBuilderDeadEnd - -STDMETHODIMP_(size_t) CFGManager::GetCount() -{ - CAutoLock cAutoLock(this); - - return m_deadends.GetCount(); -} - -STDMETHODIMP CFGManager::GetDeadEnd(int iIndex, CAtlList& path, CAtlList& mts) -{ - CAutoLock cAutoLock(this); - - if(iIndex < 0 || iIndex >= m_deadends.GetCount()) return E_FAIL; - - path.RemoveAll(); - mts.RemoveAll(); - - POSITION pos = m_deadends[iIndex]->GetHeadPosition(); - while(pos) - { - const path_t& p = m_deadends[iIndex]->GetNext(pos); - - CStringW str; - str.Format(L"%s::%s", p.filter, p.pin); - path.AddTail(str); - } - - mts.AddTailList(&m_deadends[iIndex]->mts); - - return S_OK; -} - -// -// CFGManagerCustom -// - -CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra) - : CFGManager(pName, pUnk) -{ - AppSettings& s = AfxGetAppSettings(); - - CFGFilter* pFGF; - - // Source filters - - if(src & SRC_SHOUTCAST) - { - pFGF = new CFGFilterInternal(); - pFGF->m_protocols.AddTail(_T("http")); - m_source.AddTail(pFGF); - } - -#if (_MSC_VER < 1500) - // if(src & SRC_UDP) - { - pFGF = new CFGFilterInternal(); - pFGF->m_protocols.AddTail(_T("udp")); - m_source.AddTail(pFGF); - } -#endif - - if(src & SRC_AVI) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920")); - pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958")); - m_source.AddTail(pFGF); - } - - if(src & SRC_MP4) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("4,4,,66747970")); // ftyp - pFGF->m_chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov - pFGF->m_chkbytes.AddTail(_T("4,4,,6d646174")); // mdat - pFGF->m_chkbytes.AddTail(_T("4,4,,736b6970")); // skip - pFGF->m_chkbytes.AddTail(_T("4,12,ffffffff00000000ffffffff,77696465027fe3706d646174")); // wide ? mdat - pFGF->m_chkbytes.AddTail(_T("3,3,,000001")); // raw mpeg4 video - pFGF->m_extensions.AddTail(_T(".mov")); - m_source.AddTail(pFGF); - } - - if(src & SRC_FLV) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,464C5601")); // FLV (v1) - m_source.AddTail(pFGF); - } - - if(src & SRC_MATROSKA) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,1A45DFA3")); - m_source.AddTail(pFGF); - } - - if(src & SRC_REALMEDIA) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,2E524D46")); - m_source.AddTail(pFGF); - } - - if(src & SRC_DSM) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,44534D53")); - m_source.AddTail(pFGF); - } - - if(src & SRC_FLIC) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("4,2,,11AF")); - pFGF->m_chkbytes.AddTail(_T("4,2,,12AF")); - pFGF->m_extensions.AddTail(_T(".fli")); - pFGF->m_extensions.AddTail(_T(".flc")); - m_source.AddTail(pFGF); - } - - if(src & SRC_CDDA) - { - pFGF = new CFGFilterInternal(); - pFGF->m_extensions.AddTail(_T(".cda")); - m_source.AddTail(pFGF); - } - - if(src & SRC_CDXA) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,43445841")); - m_source.AddTail(pFGF); - } - - if(src & SRC_VTS) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,12,,445644564944454F2D565453")); - m_source.AddTail(pFGF); - } - - __if_exists(CD2VSource) - { - if(src & SRC_D2V) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,18,,4456443241564950726F6A65637446696C65")); - pFGF->m_extensions.AddTail(_T(".d2v")); - m_source.AddTail(pFGF); - } - } - - __if_exists(CRadGtSourceFilter) - { - if(src & SRC_RADGT) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,3,,534D4B")); - pFGF->m_chkbytes.AddTail(_T("0,3,,42494B")); - pFGF->m_extensions.AddTail(_T(".smk")); - pFGF->m_extensions.AddTail(_T(".bik")); - m_source.AddTail(pFGF); - } - } - - if(src & SRC_ROQ) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,8,,8410FFFFFFFF1E00")); - m_source.AddTail(pFGF); - } - - if(src & SRC_OGG) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,4F676753")); - m_source.AddTail(pFGF); - } - - __if_exists(CNutSourceFilter) - { - if(src & SRC_NUT) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,8,,F9526A624E55544D")); - m_source.AddTail(pFGF); - } - } - - __if_exists(CDiracSourceFilter) - { - if(src & SRC_DIRAC) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,8,,4B572D4449524143")); - m_source.AddTail(pFGF); - } - } - - if(src & SRC_MPEG) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB")); - pFGF->m_chkbytes.AddTail(_T("0,5,FFFFFFFFC0,000001BA40")); - pFGF->m_chkbytes.AddTail(_T("0,1,,47,188,1,,47,376,1,,47")); - pFGF->m_chkbytes.AddTail(_T("4,1,,47,196,1,,47,388,1,,47")); - pFGF->m_chkbytes.AddTail(_T("0,4,,54467263,1660,1,,47")); - pFGF->m_chkbytes.AddTail(_T("0,8,fffffc00ffe00000,4156000055000000")); - m_source.AddTail(pFGF); - } - - if(src & SRC_DTSAC3) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,4,,7FFE8001")); - pFGF->m_chkbytes.AddTail(_T("0,2,,0B77")); - pFGF->m_chkbytes.AddTail(_T("0,2,,770B")); - pFGF->m_extensions.AddTail(_T(".ac3")); - pFGF->m_extensions.AddTail(_T(".dts")); - m_source.AddTail(pFGF); - } - - if(src & SRC_MPA) - { - pFGF = new CFGFilterInternal(); - pFGF->m_chkbytes.AddTail(_T("0,2,FFE0,FFE0")); - pFGF->m_chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000")); - m_source.AddTail(pFGF); - } - - if(AfxGetAppSettings().fUseWMASFReader) - { - pFGF = new CFGFilterRegistry(CLSID_WMAsfReader); - pFGF->m_chkbytes.AddTail(_T("0,4,,3026B275")); - pFGF->m_chkbytes.AddTail(_T("0,4,,D129E2D6")); - m_source.AddTail(pFGF); - } - - // Transform filters - - pFGF = new CFGFilterInternal(L"AVI<->AC3/DTS", MERIT64(0x00680000)+1); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DOLBY_AC3); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DTS); - m_transform.AddTail(pFGF); - - if(src & SRC_MATROSKA) { - pFGF = new CFGFilterInternal(L"Matroska Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Matroska Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Matroska); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - if(src & SRC_REALMEDIA) { - pFGF = new CFGFilterInternal(L"RealMedia Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"RealMedia Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RealMedia); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - if(src & SRC_AVI) { - pFGF = new CFGFilterInternal(L"Avi Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Avi Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Avi); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - __if_exists(CRadGtSplitterFilter) - { - if(src & SRC_RADGT) { - pFGF = new CFGFilterInternal(L"RadGt Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"RadGt Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Bink); - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Smacker); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - } - - if(src & SRC_ROQ) { - pFGF = new CFGFilterInternal(L"RoQ Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"RoQ Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RoQ); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - if(src & SRC_OGG) { - pFGF = new CFGFilterInternal(L"Ogg Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Ogg Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Ogg); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - __if_exists(CNutSplitterFilter) - { - if(src & SRC_NUT) { - pFGF = new CFGFilterInternal(L"Nut Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Nut Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Nut); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - } - - if(src & SRC_MPEG) { - pFGF = new CFGFilterInternal(L"Mpeg Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Mpeg Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1System); - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_PROGRAM); - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_TRANSPORT); - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_PVA); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - __if_exists(CDiracSplitterFilter) - { - if(src & SRC_DIRAC) { - pFGF = new CFGFilterInternal(L"Dirac Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Dirac Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Dirac); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - } - - if(src & SRC_MPA) { - pFGF = new CFGFilterInternal(L"Mpa Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"Mpa Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1Audio); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - if(src & SRC_DSM) { - pFGF = new CFGFilterInternal(L"DSM Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"DSM Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_DirectShowMedia); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - if(src & SRC_MP4) { - pFGF = new CFGFilterInternal(L"MP4 Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"MP4 Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MP4); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - if(src & SRC_FLV) { - pFGF = new CFGFilterInternal(L"FLV Splitter", MERIT64_ABOVE_DSHOW); - } else { - pFGF = new CFGFilterInternal(L"FLV Splitter (low merit)", MERIT64_DO_USE); - } - pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_FLV); - pFGF->AddType(MEDIATYPE_Stream, GUID_NULL); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_MPEG1) ? L"MPEG-1 Video Decoder" : L"MPEG-1 Video Decoder (low merit)", - (tra & TRA_MPEG1) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG1Packet); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG1Payload); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_MPEG2) ? L"MPEG-2 Video Decoder" : L"MPEG-2 Video Decoder (low merit)", - (tra & TRA_MPEG2) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_VIDEO); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MPEG2_VIDEO); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MPEG2_VIDEO); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG2_VIDEO); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_MPA) ? L"MPEG-1 Audio Decoder" : L"MPEG-1 Audio Decoder (low merit)", - (tra & TRA_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MP3); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1AudioPayload); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1Payload); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1Packet); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_MPA) ? L"MPEG-2 Audio Decoder" : L"MPEG-2 Audio Decoder (low merit)", - (tra & TRA_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_AUDIO); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MPEG2_AUDIO); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MPEG2_AUDIO); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG2_AUDIO); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_LPCM) ? L"LPCM Audio Decoder" : L"LPCM Audio Decoder (low merit)", - (tra & TRA_LPCM) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DVD_LPCM_AUDIO); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_DVD_LPCM_AUDIO); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DVD_LPCM_AUDIO); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DVD_LPCM_AUDIO); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_AC3) ? L"AC3 Audio Decoder" : L"AC3 Audio Decoder (low merit)", - (tra & TRA_AC3) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DOLBY_AC3); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_DOLBY_AC3); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DOLBY_AC3); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DOLBY_AC3); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DOLBY_AC3); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_DTS) ? L"DTS Decoder" : L"DTS Decoder (low merit)", - (tra & TRA_DTS) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DTS); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_DTS); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DTS); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DTS); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DTS); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_AAC) ? L"AAC Decoder" : L"AAC Decoder (low merit)", - (tra & TRA_AAC) ? MERIT64_ABOVE_DSHOW+1 : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_AAC); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_AAC); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_AAC); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_AAC); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MP4A); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MP4A); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MP4A); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MP4A); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_mp4a); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_mp4a); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_mp4a); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_mp4a); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_PS2AUD) ? L"PS2 Audio Decoder" : L"PS2 Audio Decoder (low merit)", - (tra & TRA_PS2AUD) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_PS2_PCM); - pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_PS2_PCM); - pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_PS2_PCM); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_PS2_PCM); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_RV) ? L"RealVideo Decoder" : L"RealVideo Decoder (low merit)", - (tra & TRA_RV) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV10); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV20); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV30); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV40); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_RA) ? L"RealAudio Decoder" : L"RealAudio Decoder (low merit)", - (tra & TRA_RA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_14_4); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_28_8); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_ATRC); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_COOK); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DNET); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_SIPR); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_RAAC); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_VORBIS) ? L"Vorbis Audio Decoder" : L"Vorbis Audio Decoder (low merit)", - (tra & TRA_VORBIS) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_Vorbis2); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_RV) ? L"RoQ Video Decoder" : L"RoQ Video Decoder (low merit)", - (tra & TRA_RV) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RoQV); - m_transform.AddTail(pFGF); - - pFGF = new CFGFilterInternal( - (tra & TRA_RA) ? L"RoQ Audio Decoder" : L"RoQ Audio Decoder (low merit)", - (tra & TRA_RA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_RoQA); - m_transform.AddTail(pFGF); - - __if_exists(CDiracVideoDecoder) - { - pFGF = new CFGFilterInternal( - (tra & TRA_DIRAC) ? L"Dirac Video Decoder" : L"Dirac Video Decoder (low merit)", - (tra & TRA_DIRAC) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DiracVideo); - m_transform.AddTail(pFGF); - } - - pFGF = new CFGFilterInternal(L"NullTextRenderer", MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Text, MEDIASUBTYPE_NULL); - pFGF->AddType(MEDIATYPE_ScriptCommand, MEDIASUBTYPE_NULL); - pFGF->AddType(MEDIATYPE_Subtitle, MEDIASUBTYPE_NULL); - pFGF->AddType(MEDIATYPE_Text, MEDIASUBTYPE_NULL); - pFGF->AddType(MEDIATYPE_NULL, MEDIASUBTYPE_DVD_SUBPICTURE); - pFGF->AddType(MEDIATYPE_NULL, MEDIASUBTYPE_CVD_SUBPICTURE); - pFGF->AddType(MEDIATYPE_NULL, MEDIASUBTYPE_SVCD_SUBPICTURE); - m_transform.AddTail(pFGF); - - __if_exists(CFLVVideoDecoder) - { - pFGF = new CFGFilterInternal(L"FLV4 Video Decoder (low merit)",MERIT64_DO_USE); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_FLV4); - m_transform.AddTail(pFGF); - } - - // Blocked filters - - // "Subtitle Mixer" makes an access violation around the - // 11-12th media type when enumerating them on its output. - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{00A95963-3BE5-48C0-AD9F-3356D67EA09D}")), MERIT64_DO_NOT_USE)); - - // ISCR suxx - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}")), MERIT64_DO_NOT_USE)); - - // Samsung's "mpeg-4 demultiplexor" can even open matroska files, amazing... - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{99EC0C72-4D1B-411B-AB1F-D561EE049D94}")), MERIT64_DO_NOT_USE)); - - // LG Video Renderer (lgvid.ax) just crashes when trying to connect it - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{9F711C60-0668-11D0-94D4-0000C02BA972}")), MERIT64_DO_NOT_USE)); - - // palm demuxer crashes (even crashes graphedit when dropping an .ac3 onto it) - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{BE2CF8A7-08CE-4A2C-9A25-FD726A999196}")), MERIT64_DO_NOT_USE)); - - // DCDSPFilter (early versions crash mpc) - { - CRegKey key; - - TCHAR buff[256]; - ULONG len = sizeof(buff); - memset(buff, 0, len); - - CString clsid = _T("{B38C58A0-1809-11D6-A458-EDAE78F1DF12}"); - - if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + clsid + _T("\\InprocServer32"), KEY_READ) - && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) - && GetFileVersion(buff) < 0x0001000000030000ui64) - { - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(clsid), MERIT64_DO_NOT_USE)); - } - } -/* - // NVIDIA Transport Demux crashed for someone, I could not reproduce it - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{735823C1-ACC4-11D3-85AC-006008376FB8}")), MERIT64_DO_NOT_USE)); -*/ - // mainconcept color space converter - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{272D77A0-A852-4851-ADA4-9091FEAD4C86}")), MERIT64_DO_NOT_USE)); - - - // Block VSFilter when internal subtitle renderer will get used - if(s.fAutoloadSubtitles && s.fBlockVSFilter) { - if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_DXR) { - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{9852A670-F845-491B-9BE6-EBD841B8A613}")), MERIT64_DO_NOT_USE)); - } - } - - - // Overrides - - WORD merit_low = 1; - - POSITION pos = s.filters.GetTailPosition(); - while(pos) - { - FilterOverride* fo = s.filters.GetPrev(pos); - - if(fo->fDisabled || fo->type == FilterOverride::EXTERNAL && !CPath(MakeFullPath(fo->path)).FileExists()) - continue; - - ULONGLONG merit = - fo->iLoadType == FilterOverride::PREFERRED ? MERIT64_ABOVE_DSHOW : - fo->iLoadType == FilterOverride::MERIT ? MERIT64(fo->dwMerit) : - MERIT64_DO_NOT_USE; // fo->iLoadType == FilterOverride::BLOCKED - - merit += merit_low++; - - CFGFilter* pFGF = NULL; - - if(fo->type == FilterOverride::REGISTERED) - { - pFGF = new CFGFilterRegistry(fo->dispname, merit); - } - else if(fo->type == FilterOverride::EXTERNAL) - { - pFGF = new CFGFilterFile(fo->clsid, fo->path, CStringW(fo->name), merit); - } - - if(pFGF) - { - pFGF->SetTypes(fo->guids); - m_override.AddTail(pFGF); - } - } -} - -STDMETHODIMP CFGManagerCustom::AddFilter(IBaseFilter* pBF, LPCWSTR pName) -{ - CAutoLock cAutoLock(this); - - HRESULT hr; - - if(FAILED(hr = __super::AddFilter(pBF, pName))) - return hr; - - AppSettings& s = AfxGetAppSettings(); - - if(GetCLSID(pBF) == CLSID_DMOWrapperFilter) - { - if(CComQIPtr pPB = pBF) - { - CComVariant var(true); - pPB->Write(CComBSTR(L"_HIRESOUTPUT"), &var); - } - } - - if(CComQIPtr pASF = pBF) - { - pASF->EnableDownSamplingTo441(s.fDownSampleTo441); - pASF->SetSpeakerConfig(s.fCustomChannelMapping, s.pSpeakerToChannelMap); - pASF->SetAudioTimeShift(s.fAudioTimeShift ? 10000i64*s.tAudioTimeShift : 0); - pASF->SetNormalizeBoost(s.fAudioNormalize, s.fAudioNormalizeRecover, s.AudioBoost); - } - - return hr; -} - -// -// CFGManagerPlayer -// - -CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd) - : CFGManagerCustom(pName, pUnk, src, tra) - , m_hWnd(hWnd) - , m_vrmerit(MERIT64(MERIT_PREFERRED)) - , m_armerit(MERIT64(MERIT_PREFERRED)) -{ - CFGFilter* pFGF; - - AppSettings& s = AfxGetAppSettings(); - - if(m_pFM) - { - CComPtr pEM; - - GUID guids[] = {MEDIATYPE_Video, MEDIASUBTYPE_NULL}; - - if(SUCCEEDED(m_pFM->EnumMatchingFilters(&pEM, 0, FALSE, MERIT_DO_NOT_USE+1, - TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL))) - { - for(CComPtr pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL) - { - CFGFilterRegistry f(pMoniker); - m_vrmerit = max(m_vrmerit, f.GetMerit()); - } - } - - m_vrmerit += 0x100; - } - - if(m_pFM) - { - CComPtr pEM; - - GUID guids[] = {MEDIATYPE_Audio, MEDIASUBTYPE_NULL}; - - if(SUCCEEDED(m_pFM->EnumMatchingFilters(&pEM, 0, FALSE, MERIT_DO_NOT_USE+1, - TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL))) - { - for(CComPtr pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL) - { - CFGFilterRegistry f(pMoniker); - m_armerit = max(m_armerit, f.GetMerit()); - } - } - - BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) - { - CFGFilterRegistry f(pMoniker); - m_armerit = max(m_armerit, f.GetMerit()); - } - EndEnumSysDev - - m_armerit += 0x100; - } - - // Switchers - - if(s.fEnableAudioSwitcher) - { - pFGF = new CFGFilterInternal(L"Audio Switcher", m_armerit + 0x100); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - - // morgan stream switcher - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE)); - } - - // Renderers - - if(s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER) - m_transform.AddTail(new CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7WINDOWED) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Render 7 (Windowed)", m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9WINDOWED) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Render 9 (Windowed)", m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Render 7 (Renderless)", m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Render 9 (Renderless)", m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_DXR) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit)); - else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_COMP) - { - pFGF = new CFGFilterInternal(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - } - else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_UNCOMP) - { - pFGF = new CFGFilterInternal(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - } - - if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP) - { - pFGF = new CFGFilterInternal(AUDRNDT_NULL_COMP, MERIT64_ABOVE_DSHOW+2); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - } - else if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP) - { - pFGF = new CFGFilterInternal(AUDRNDT_NULL_UNCOMP, MERIT64_ABOVE_DSHOW+2); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - } - else if(!s.AudioRendererDisplayName.IsEmpty()) - { - pFGF = new CFGFilterRegistry(s.AudioRendererDisplayName, m_armerit); - pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - } -} - -STDMETHODIMP CFGManagerPlayer::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt) -{ - CAutoLock cAutoLock(this); - - if(GetCLSID(pPinOut) == CLSID_MPEG2Demultiplexer) - { - CComQIPtr pMS = pPinOut; - REFERENCE_TIME rtDur = 0; - if(!pMS || FAILED(pMS->GetDuration(&rtDur)) || rtDur <= 0) - return E_FAIL; - } - - return __super::ConnectDirect(pPinOut, pPinIn, pmt); -} - -// -// CFGManagerDVD -// - -CFGManagerDVD::CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd) - : CFGManagerPlayer(pName, pUnk, src, tra, hWnd) -{ - AppSettings& s = AfxGetAppSettings(); - - // have to avoid the old video renderer - if(!s.fXpOrBetter && s.iDSVideoRendererType != VIDRNDT_DS_OVERLAYMIXER || s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER) - m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit-1)); - - // elecard's decoder isn't suited for dvd playback (atm) - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{F50B3F13-19C4-11CF-AA9A-02608C9BABA2}")), MERIT64_DO_NOT_USE)); -} - -#include "..\..\decss\VobFile.h" - -class CResetDVD : public CDVDSession -{ -public: - CResetDVD(LPCTSTR path) - { - if(Open(path)) - { - if(BeginSession()) {Authenticate(); /*GetDiscKey();*/ EndSession();} - Close(); - } - } -}; - -STDMETHODIMP CFGManagerDVD::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList) -{ - CAutoLock cAutoLock(this); - - HRESULT hr; - - CComPtr pBF; - if(FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF))) - return hr; - - return ConnectFilter(pBF, NULL); -} - -STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) -{ - CAutoLock cAutoLock(this); - - CheckPointer(lpcwstrFileName, E_POINTER); - CheckPointer(ppFilter, E_POINTER); - - HRESULT hr; - - CStringW fn = CStringW(lpcwstrFileName).TrimLeft(); - CStringW protocol = fn.Left(fn.Find(':')+1).TrimRight(':').MakeLower(); - CStringW ext = CPathW(fn).GetExtension().MakeLower(); - - GUID clsid = ext == L".ratdvd" ? GUIDFromCString(_T("{482d10b6-376e-4411-8a17-833800A065DB}")) : CLSID_DVDNavigator; - - CComPtr pBF; - if(FAILED(hr = pBF.CoCreateInstance(clsid)) - || FAILED(hr = AddFilter(pBF, L"DVD Navigator"))) - return VFW_E_CANNOT_LOAD_SOURCE_FILTER; - - CComQIPtr pDVDC; - CComQIPtr pDVDI; - - if(!((pDVDC = pBF) && (pDVDI = pBF))) - return E_NOINTERFACE; - - WCHAR buff[MAX_PATH]; - ULONG len; - if((!fn.IsEmpty() - && FAILED(hr = pDVDC->SetDVDDirectory(fn)) - && FAILED(hr = pDVDC->SetDVDDirectory(fn + L"VIDEO_TS")) - && FAILED(hr = pDVDC->SetDVDDirectory(fn + L"\\VIDEO_TS"))) - || FAILED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len)) || len == 0) - return E_INVALIDARG; - - pDVDC->SetOption(DVD_ResetOnStop, FALSE); - pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE); - - if(clsid == CLSID_DVDNavigator) - CResetDVD(CString(buff)); - - *ppFilter = pBF.Detach(); - - return S_OK; -} - -// -// CFGManagerCapture -// - -CFGManagerCapture::CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd) - : CFGManagerPlayer(pName, pUnk, src, tra, hWnd) -{ - AppSettings& s = AfxGetAppSettings(); - - CFGFilter* pFGF = new CFGFilterInternal(L"Deinterlacer", m_vrmerit + 0x100); - pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL); - m_transform.AddTail(pFGF); - - // morgan stream switcher - m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE)); -} - -// -// CFGManagerMuxer -// - -CFGManagerMuxer::CFGManagerMuxer(LPCTSTR pName, LPUNKNOWN pUnk) - : CFGManagerCustom(pName, pUnk, ~0, ~0) -{ - m_source.AddTail(new CFGFilterInternal()); - m_source.AddTail(new CFGFilterInternal()); -} - -// -// CFGAggregator -// - -CFGAggregator::CFGAggregator(const CLSID& clsid, LPCTSTR pName, LPUNKNOWN pUnk, HRESULT& hr) - : CUnknown(pName, pUnk) -{ - hr = m_pUnkInner.CoCreateInstance(clsid, GetOwner()); -} - -CFGAggregator::~CFGAggregator() -{ - m_pUnkInner.Release(); -} - -STDMETHODIMP CFGAggregator::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - CheckPointer(ppv, E_POINTER); - - return - m_pUnkInner && (riid != IID_IUnknown && SUCCEEDED(m_pUnkInner->QueryInterface(riid, ppv))) ? S_OK : - __super::NonDelegatingQueryInterface(riid, ppv); -} diff --git a/src/apps/mplayerc/FGManager.h b/src/apps/mplayerc/FGManager.h deleted file mode 100644 index 49579f6b3..000000000 --- a/src/apps/mplayerc/FGManager.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "FGFilter.h" -#include "IGraphBuilder2.h" - -class CFGManager - : public CUnknown - , public IGraphBuilder2 - , public IGraphBuilderDeadEnd - , public CCritSec -{ -public: - struct path_t {CLSID clsid; CString filter, pin;}; - - class CStreamPath : public CAtlList - { - public: - void Append(IBaseFilter* pBF, IPin* pPin); - bool Compare(const CStreamPath& path); - }; - - class CStreamDeadEnd : public CStreamPath - { - public: - CAtlList mts; - }; - -private: - CComPtr m_pUnkInner; - DWORD m_dwRegister; - - CStreamPath m_streampath; - CAutoPtrArray m_deadends; - -protected: - CComPtr m_pFM; - CInterfaceList m_pUnks; - CAtlList m_source, m_transform, m_override; - - static bool CheckBytes(HANDLE hFile, CString chkbytes); - - HRESULT EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl); - HRESULT AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppBF); - - // IFilterGraph - - STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName); - STDMETHODIMP RemoveFilter(IBaseFilter* pFilter); - STDMETHODIMP EnumFilters(IEnumFilters** ppEnum); - STDMETHODIMP FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter); - STDMETHODIMP ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt); - STDMETHODIMP Reconnect(IPin* ppin); - STDMETHODIMP Disconnect(IPin* ppin); - STDMETHODIMP SetDefaultSyncSource(); - - // IGraphBuilder - - STDMETHODIMP Connect(IPin* pPinOut, IPin* pPinIn); - STDMETHODIMP Render(IPin* pPinOut); - STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList); - STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter); - STDMETHODIMP SetLogFile(DWORD_PTR hFile); - STDMETHODIMP Abort(); - STDMETHODIMP ShouldOperationContinue(); - - // IFilterGraph2 - - STDMETHODIMP AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter); - STDMETHODIMP ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt); - STDMETHODIMP RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext); - - // IGraphBuilder2 - - STDMETHODIMP IsPinDirection(IPin* pPin, PIN_DIRECTION dir); - STDMETHODIMP IsPinConnected(IPin* pPin); - STDMETHODIMP ConnectFilter(IBaseFilter* pBF, IPin* pPinIn); - STDMETHODIMP ConnectFilter(IPin* pPinOut, IBaseFilter* pBF); - STDMETHODIMP ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt); - STDMETHODIMP NukeDownstream(IUnknown* pUnk); - STDMETHODIMP FindInterface(REFIID iid, void** ppv, BOOL bRemove); - STDMETHODIMP AddToROT(); - STDMETHODIMP RemoveFromROT(); - - // IGraphBuilderDeadEnd - - STDMETHODIMP_(size_t) GetCount(); - STDMETHODIMP GetDeadEnd(int iIndex, CAtlList& path, CAtlList& mts); - -public: - CFGManager(LPCTSTR pName, LPUNKNOWN pUnk); - virtual ~CFGManager(); - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); -}; - -class CFGManagerCustom : public CFGManager -{ -public: - // IFilterGraph - - STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName); - -public: - CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra); -}; - -class CFGManagerPlayer : public CFGManagerCustom -{ -protected: - HWND m_hWnd; - UINT64 m_vrmerit, m_armerit; - - // IFilterGraph - - STDMETHODIMP ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt); - -public: - CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd); -}; - -class CFGManagerDVD : public CFGManagerPlayer -{ -protected: - // IGraphBuilder - - STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList); - STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter); - -public: - CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd); -}; - -class CFGManagerCapture : public CFGManagerPlayer -{ -public: - CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd); -}; - -class CFGManagerMuxer : public CFGManagerCustom -{ -public: - CFGManagerMuxer(LPCTSTR pName, LPUNKNOWN pUnk); -}; - -// - -class CFGAggregator : public CUnknown -{ -protected: - CComPtr m_pUnkInner; - -public: - CFGAggregator(const CLSID& clsid, LPCTSTR pName, LPUNKNOWN pUnk, HRESULT& hr); - virtual ~CFGAggregator(); - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); -}; diff --git a/src/apps/mplayerc/FakeFilterMapper2.cpp b/src/apps/mplayerc/FakeFilterMapper2.cpp deleted file mode 100644 index 216c9b2d5..000000000 --- a/src/apps/mplayerc/FakeFilterMapper2.cpp +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "fakefiltermapper2.h" -#include "MacrovisionKicker.h" -#include "..\..\..\include\detours\detours.h" -#include "..\..\DSUtil\DSUtil.h" - -#include -#include - -DETOUR_TRAMPOLINE(HRESULT WINAPI Real_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv), CoCreateInstance); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCloseKey(HKEY a0), RegCloseKey); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegFlushKey(HKEY a0), RegFlushKey); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyA(HKEY a0, LPCSTR a1, PHKEY a2), RegCreateKeyA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyW(HKEY a0, LPCWSTR a1, PHKEY a2), RegCreateKeyW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyExA(HKEY a0, LPCSTR a1, DWORD a2, LPSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8), RegCreateKeyExA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, LPWSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8), RegCreateKeyExW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteKeyA(HKEY a0, LPCSTR a1), RegDeleteKeyA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteKeyW(HKEY a0, LPCWSTR a1), RegDeleteKeyW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteValueA(HKEY a0, LPCSTR a1), RegDeleteValueA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteValueW(HKEY a0, LPCWSTR a1), RegDeleteValueW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumKeyExA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPSTR a5, LPDWORD a6, struct _FILETIME* a7), RegEnumKeyExA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumKeyExW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPWSTR a5, LPDWORD a6, struct _FILETIME* a7), RegEnumKeyExW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumValueA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7), RegEnumValueA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumValueW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7), RegEnumValueW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyA(HKEY a0, LPCSTR a1, PHKEY a2), RegOpenKeyA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyW(HKEY a0, LPCWSTR a1, PHKEY a2), RegOpenKeyW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4), RegOpenKeyExA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, REGSAM a3, PHKEY a4), RegOpenKeyExW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryInfoKeyA(HKEY a0, LPSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11), RegQueryInfoKeyA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryInfoKeyW(HKEY a0, LPWSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11), RegQueryInfoKeyW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueA(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3), RegQueryValueA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueW(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3), RegQueryValueW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueExA(HKEY a0, LPCSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5), RegQueryValueExA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueExW(HKEY a0, LPCWSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5), RegQueryValueExW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueA(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD a4), RegSetValueA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueW(HKEY a0, LPCWSTR a1, DWORD a2, LPCWSTR a3, DWORD a4), RegSetValueW); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueExA(HKEY a0, LPCSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5), RegSetValueExA); -DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueExW(HKEY a0, LPCWSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5), RegSetValueExW); - -HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, - IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv) -{ - if(CFilterMapper2::m_pFilterMapper2) - { - CheckPointer(ppv, E_POINTER); - - if(rclsid == CLSID_FilterMapper) - { - ASSERT(0); - return REGDB_E_CLASSNOTREG; // sorry... - } - - if(rclsid == CLSID_FilterMapper2) - { - if(pUnkOuter) return CLASS_E_NOAGGREGATION; - - if(riid == __uuidof(IUnknown)) - { - CFilterMapper2::m_pFilterMapper2->AddRef(); - *ppv = (IUnknown*)CFilterMapper2::m_pFilterMapper2; - return S_OK; - } - else if(riid == __uuidof(IFilterMapper2)) - { - CFilterMapper2::m_pFilterMapper2->AddRef(); - *ppv = (IFilterMapper2*)CFilterMapper2::m_pFilterMapper2; - return S_OK; - } - else - { - return E_NOINTERFACE; - } - } - } -/* else - { - if(rclsid == CLSID_FilterMapper2) - { - CFilterMapper2* pFM2 = new CFilterMapper2(true, false, pUnkOuter); - CComPtr pUnk = (IUnknown*)pFM2; - return pUnk->QueryInterface(riid, ppv); - } - } -*/ - if(!pUnkOuter) - if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9 - || rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault - || rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?) - { - CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL); - CComPtr pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK; - CComPtr pInner; - HRESULT hr; - if(SUCCEEDED(hr = Real_CoCreateInstance(rclsid, pUnk, dwClsContext, __uuidof(IUnknown), (void**)&pInner))) - { - pMK->SetInner(pInner); - return pUnk->QueryInterface(riid, ppv); - } - } - - return Real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv); -} - -#define FAKEHKEY (HKEY)0x12345678 - -LONG WINAPI Mine_RegCloseKey(HKEY a0) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_SUCCESS;} - return Real_RegCloseKey(a0); -} -LONG WINAPI Mine_RegFlushKey(HKEY a0) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_SUCCESS;} - return Real_RegFlushKey(a0); -} -LONG WINAPI Mine_RegCreateKeyA(HKEY a0, LPCSTR a1, PHKEY a2) -{ - if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegCreateKeyA(a0, a1, a2); -} -LONG WINAPI Mine_RegCreateKeyW(HKEY a0, LPCWSTR a1, PHKEY a2) -{ - if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegCreateKeyW(a0, a1, a2); -} -LONG WINAPI Mine_RegCreateKeyExA(HKEY a0, LPCSTR a1, DWORD a2, LPSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8) -{ - if(CFilterMapper2::m_pFilterMapper2) {*a7 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegCreateKeyExA(a0, a1, a2, a3, a4, a5, a6, a7, a8); -} -LONG WINAPI Mine_RegCreateKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, LPWSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8) -{ - if(CFilterMapper2::m_pFilterMapper2) {*a7 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegCreateKeyExW(a0, a1, a2, a3, a4, a5, a6, a7, a8); -} -LONG WINAPI Mine_RegDeleteKeyA(HKEY a0, LPCSTR a1) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegDeleteKeyA(a0, a1); -} -LONG WINAPI Mine_RegDeleteKeyW(HKEY a0, LPCWSTR a1) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegDeleteKeyW(a0, a1); -} -LONG WINAPI Mine_RegDeleteValueA(HKEY a0, LPCSTR a1) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegDeleteValueA(a0, a1); -} -LONG WINAPI Mine_RegDeleteValueW(HKEY a0, LPCWSTR a1) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegDeleteValueW(a0, a1); -} -LONG WINAPI Mine_RegEnumKeyExA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPSTR a5, LPDWORD a6, struct _FILETIME* a7) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;} - return Real_RegEnumKeyExA(a0, a1, a2, a3, a4, a5, a6, a7); -} -LONG WINAPI Mine_RegEnumKeyExW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPWSTR a5, LPDWORD a6, struct _FILETIME* a7) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;} - return Real_RegEnumKeyExW(a0, a1, a2, a3, a4, a5, a6, a7); -} -LONG WINAPI Mine_RegEnumValueA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;} - return Real_RegEnumValueA(a0, a1, a2, a3, a4, a5, a6, a7); -} -LONG WINAPI Mine_RegEnumValueW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;} - return Real_RegEnumValueW(a0, a1, a2, a3, a4, a5, a6, a7); -} -LONG WINAPI Mine_RegOpenKeyA(HKEY a0, LPCSTR a1, PHKEY a2) -{ - if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegOpenKeyA(a0, a1, a2); -} -LONG WINAPI Mine_RegOpenKeyW(HKEY a0, LPCWSTR a1, PHKEY a2) -{ - if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegOpenKeyW(a0, a1, a2); -} -LONG WINAPI Mine_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {*a4 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegOpenKeyExA(a0, a1, a2, a3, a4); -} -LONG WINAPI Mine_RegOpenKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, REGSAM a3, PHKEY a4) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {*a4 = FAKEHKEY; return ERROR_SUCCESS;} - return Real_RegOpenKeyExW(a0, a1, a2, a3, a4); -} -LONG WINAPI Mine_RegQueryInfoKeyA(HKEY a0, LPSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_INVALID_HANDLE;} - return Real_RegQueryInfoKeyA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); -} -LONG WINAPI Mine_RegQueryInfoKeyW(HKEY a0, LPWSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_INVALID_HANDLE;} - return Real_RegQueryInfoKeyW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); -} -LONG WINAPI Mine_RegQueryValueA(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a3 = 0; return ERROR_SUCCESS;} - return Real_RegQueryValueA(a0, a1, a2, a3); -} -LONG WINAPI Mine_RegQueryValueW(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a3 = 0; return ERROR_SUCCESS;} - return Real_RegQueryValueW(a0, a1, a2, a3); -} -LONG WINAPI Mine_RegQueryValueExA(HKEY a0, LPCSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a5 = 0; return ERROR_SUCCESS;} - return Real_RegQueryValueExA(a0, a1, a2, a3, a4, a5); -} -LONG WINAPI Mine_RegQueryValueExW(HKEY a0, LPCWSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5) -{ - if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a5 = 0; return ERROR_SUCCESS;} - return Real_RegQueryValueExW(a0, a1, a2, a3, a4, a5); -} -LONG WINAPI Mine_RegSetValueA(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD a4) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegSetValueA(a0, a1, a2, a3, a4); -} -LONG WINAPI Mine_RegSetValueW(HKEY a0, LPCWSTR a1, DWORD a2, LPCWSTR a3, DWORD a4) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegSetValueW(a0, a1, a2, a3, a4); -} -LONG WINAPI Mine_RegSetValueExA(HKEY a0, LPCSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegSetValueExA(a0, a1, a2, a3, a4, a5); -} -LONG WINAPI Mine_RegSetValueExW(HKEY a0, LPCWSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5) -{ - if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;} - return Real_RegSetValueExW(a0, a1, a2, a3, a4, a5); -} - -// -// CFilterMapper2 -// - -IFilterMapper2* CFilterMapper2::m_pFilterMapper2 = NULL; - -bool CFilterMapper2::fInitialized = false; - -void CFilterMapper2::Init() -{ - if(!fInitialized) - { - DetourFunctionWithTrampoline((PBYTE)Real_CoCreateInstance, (PBYTE)Mine_CoCreateInstance); - DetourFunctionWithTrampoline((PBYTE)Real_RegCloseKey, (PBYTE)Mine_RegCloseKey); - DetourFunctionWithTrampoline((PBYTE)Real_RegFlushKey, (PBYTE)Mine_RegFlushKey); - DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyA, (PBYTE)Mine_RegCreateKeyA); - DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyW, (PBYTE)Mine_RegCreateKeyW); - DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyExA, (PBYTE)Mine_RegCreateKeyExA); - DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyExW, (PBYTE)Mine_RegCreateKeyExW); - DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteKeyA, (PBYTE)Mine_RegDeleteKeyA); - DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteKeyW, (PBYTE)Mine_RegDeleteKeyW); - DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteValueA, (PBYTE)Mine_RegDeleteValueA); - DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteValueW, (PBYTE)Mine_RegDeleteValueW); - DetourFunctionWithTrampoline((PBYTE)Real_RegEnumKeyExA, (PBYTE)Mine_RegEnumKeyExA); - DetourFunctionWithTrampoline((PBYTE)Real_RegEnumKeyExW, (PBYTE)Mine_RegEnumKeyExW); - DetourFunctionWithTrampoline((PBYTE)Real_RegEnumValueA, (PBYTE)Mine_RegEnumValueA); - DetourFunctionWithTrampoline((PBYTE)Real_RegEnumValueW, (PBYTE)Mine_RegEnumValueW); - DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyA, (PBYTE)Mine_RegOpenKeyA); - DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyW, (PBYTE)Mine_RegOpenKeyW); - DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyExA, (PBYTE)Mine_RegOpenKeyExA); - DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyExW, (PBYTE)Mine_RegOpenKeyExW); - DetourFunctionWithTrampoline((PBYTE)Real_RegQueryInfoKeyA, (PBYTE)Mine_RegQueryInfoKeyA); - DetourFunctionWithTrampoline((PBYTE)Real_RegQueryInfoKeyW, (PBYTE)Mine_RegQueryInfoKeyW); - DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueA, (PBYTE)Mine_RegQueryValueA); - DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueW, (PBYTE)Mine_RegQueryValueW); - DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueExA, (PBYTE)Mine_RegQueryValueExA); - DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueExW, (PBYTE)Mine_RegQueryValueExW); - DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueA, (PBYTE)Mine_RegSetValueA); - DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueW, (PBYTE)Mine_RegSetValueW); - DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueExA, (PBYTE)Mine_RegSetValueExA); - DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueExW, (PBYTE)Mine_RegSetValueExW); - - fInitialized = true; - } -} - -CFilterMapper2::CFilterMapper2(bool fRefCounted, bool fAllowUnreg, LPUNKNOWN pUnkOuter) - : CUnknown(NAME("CFilterMapper2"), pUnkOuter) - , m_fRefCounted(fRefCounted), m_fAllowUnreg(fAllowUnreg) -{ - m_cRef = fRefCounted ? 0 : 1; - - Init(); - - HRESULT hr = Real_CoCreateInstance( - CLSID_FilterMapper2, (IUnknown*)(INonDelegatingUnknown*)this, CLSCTX_ALL, - __uuidof(IUnknown), (void**)&m_pFM2); - if(FAILED(hr) || !m_pFM2) - { - ASSERT(0); - return; - } -} - -CFilterMapper2::~CFilterMapper2() -{ - POSITION pos = m_filters.GetHeadPosition(); - while(pos) delete m_filters.GetNext(pos); -} - -STDMETHODIMP CFilterMapper2::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - if(riid == __uuidof(IFilterMapper2)) - return GetInterface((IFilterMapper2*)this, ppv); - - HRESULT hr = m_pFM2 ? m_pFM2->QueryInterface(riid, ppv) : E_NOINTERFACE; - - return - SUCCEEDED(hr) ? hr : - __super::NonDelegatingQueryInterface(riid, ppv); -} - -void CFilterMapper2::Register(CString path) -{ - if(HMODULE h = LoadLibrary(path)) - { - typedef HRESULT (__stdcall * PDllRegisterServer)(); - if(PDllRegisterServer p = (PDllRegisterServer)GetProcAddress(h, "DllRegisterServer")) - { - ASSERT(CFilterMapper2::m_pFilterMapper2 == NULL); - - CFilterMapper2::m_pFilterMapper2 = this; - m_path = path; - p(); - m_path.Empty(); - CFilterMapper2::m_pFilterMapper2 = NULL; - } - - FreeLibrary(h); - } -} - -// IFilterMapper2 - -STDMETHODIMP CFilterMapper2::CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description) -{ - if(!m_path.IsEmpty()) - { - return S_OK; - } - else if(CComQIPtr pFM2 = m_pFM2) - { - return pFM2->CreateCategory(clsidCategory, dwCategoryMerit, Description); - } - - return E_NOTIMPL; -} - -STDMETHODIMP CFilterMapper2::UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter) -{ - if(!m_path.IsEmpty()) - { - return S_OK; - } - else if(CComQIPtr pFM2 = m_pFM2) - { - return m_fAllowUnreg - ? pFM2->UnregisterFilter(pclsidCategory, szInstance, Filter) - : S_OK; - } - - return E_NOTIMPL; -} - -STDMETHODIMP CFilterMapper2::RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2) -{ - if(!m_path.IsEmpty()) - { - if(FilterOverride* f = new FilterOverride) - { - f->fDisabled = false; - f->type = FilterOverride::EXTERNAL; - f->path = m_path; - f->name = CStringW(Name); - f->clsid = clsidFilter; - f->iLoadType = FilterOverride::MERIT; - f->dwMerit = prf2->dwMerit; - - if(prf2->dwVersion == 1) - { - for(ULONG i = 0; i < prf2->cPins; i++) - { - const REGFILTERPINS& rgPin = prf2->rgPins[i]; - if(rgPin.bOutput) continue; - - for(UINT i = 0; i < rgPin.nMediaTypes; i++) - { - if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) break; - f->guids.AddTail(*rgPin.lpMediaType[i].clsMajorType); - f->guids.AddTail(*rgPin.lpMediaType[i].clsMinorType); - } - } - } - else if(prf2->dwVersion == 2) - { - for(ULONG i = 0; i < prf2->cPins2; i++) - { - const REGFILTERPINS2& rgPin = prf2->rgPins2[i]; - if(rgPin.dwFlags®_PINFLAG_B_OUTPUT) continue; - - for(UINT i = 0; i < rgPin.nMediaTypes; i++) - { - if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) break; - f->guids.AddTail(*rgPin.lpMediaType[i].clsMajorType); - f->guids.AddTail(*rgPin.lpMediaType[i].clsMinorType); - } - } - } - - f->backup.AddTailList(&f->guids); - - m_filters.AddTail(f); - } - - return S_OK; - } - else if(CComQIPtr pFM2 = m_pFM2) - { - return pFM2->RegisterFilter(clsidFilter, Name, ppMoniker, pclsidCategory, szInstance, prf2); - } - - return E_NOTIMPL; -} - -STDMETHODIMP CFilterMapper2::EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit, - BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender, - BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut) -{ - if(CComQIPtr pFM2 = m_pFM2) - { - pFM2->EnumMatchingFilters(ppEnum, dwFlags, bExactMatch, dwMerit, - bInputNeeded, cInputTypes, pInputTypes, pMedIn, pPinCategoryIn, bRender, - bOutputNeeded, cOutputTypes, pOutputTypes, pMedOut, pPinCategoryOut); - } - - return E_NOTIMPL; -} diff --git a/src/apps/mplayerc/FakeFilterMapper2.h b/src/apps/mplayerc/FakeFilterMapper2.h deleted file mode 100644 index 88f071cb3..000000000 --- a/src/apps/mplayerc/FakeFilterMapper2.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include - -class FilterOverride -{ -public: - bool fDisabled, fTemporary; - enum {REGISTERED, EXTERNAL} type; - // REGISTERED - CStringW dispname; - // EXTERNAL - CString path, name; - CLSID clsid; - // props - CAtlList guids, backup; - enum {PREFERRED, BLOCK, MERIT}; - int iLoadType; - DWORD dwMerit; - - FilterOverride() {fTemporary = false;} - FilterOverride(FilterOverride* f) - { - fDisabled = f->fDisabled; - fTemporary = f->fTemporary; - type = f->type; - dispname = f->dispname; - path = f->path; - name = f->name; - clsid = f->clsid; - guids.AddTailList(&f->guids); - backup.AddTailList(&f->backup); - iLoadType = f->iLoadType; - dwMerit = f->dwMerit; - } -}; -/* -class CFilterMapper2 : protected CUnknown, protected IFilterMapper2 -{ - static bool fInitialized; - - CComPtr m_pFM2; - CString m_path; - -protected: - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IFilterMapper2 - - STDMETHODIMP CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description); - STDMETHODIMP UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter); - STDMETHODIMP RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2); - STDMETHODIMP EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit, - BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender, - BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut); - -public: - CFilterMapper2(); - virtual ~CFilterMapper2(); - - static void Init(); - - static IFilterMapper2* m_pFilterMapper2; - CList m_filters; - void Register(CString path); -}; -*/ - -class CFilterMapper2 : protected CUnknown, public IFilterMapper2 -{ - static bool fInitialized; - - CComPtr m_pFM2; - CString m_path; - - bool m_fRefCounted, m_fAllowUnreg; - -protected: - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IFilterMapper2 - - STDMETHODIMP CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description); - STDMETHODIMP UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter); - STDMETHODIMP RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2); - STDMETHODIMP EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit, - BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender, - BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut); - -public: - CFilterMapper2(bool fRefCounted, bool fAllowUnreg = false, LPUNKNOWN pUnkOuter = NULL); - virtual ~CFilterMapper2(); - - void SetInner(IUnknown* pUnk) {m_pFM2 = pUnk;} - - static void Init(); - - static IFilterMapper2* m_pFilterMapper2; - CList m_filters; - void Register(CString path); -}; diff --git a/src/apps/mplayerc/FavoriteAddDlg.cpp b/src/apps/mplayerc/FavoriteAddDlg.cpp deleted file mode 100644 index 9ecee1fac..000000000 --- a/src/apps/mplayerc/FavoriteAddDlg.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// FavoritAddDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "FavoriteAddDlg.h" - - -// CFavoriteAddDlg dialog - -IMPLEMENT_DYNAMIC(CFavoriteAddDlg, CCmdUIDialog) -CFavoriteAddDlg::CFavoriteAddDlg(CString shortname, CString fullname, CWnd* pParent /*=NULL*/) - : CCmdUIDialog(CFavoriteAddDlg::IDD, pParent) - , m_shortname(shortname) - , m_fullname(fullname) - , m_fRememberPos(TRUE) -{ -} - -CFavoriteAddDlg::~CFavoriteAddDlg() -{ -} - -void CFavoriteAddDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Control(pDX, IDC_COMBO1, m_namectrl); - DDX_CBString(pDX, IDC_COMBO1, m_name); - DDX_Check(pDX, IDC_CHECK1, m_fRememberPos); -} - -BOOL CFavoriteAddDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - if(!m_shortname.IsEmpty()) m_namectrl.AddString(m_shortname); - if(!m_fullname.IsEmpty()) m_namectrl.AddString(m_fullname); - m_namectrl.SetCurSel(0); - - ::CorrectComboListWidth(m_namectrl, GetFont()); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - - -BEGIN_MESSAGE_MAP(CFavoriteAddDlg, CCmdUIDialog) - ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOk) -END_MESSAGE_MAP() - - -// CFavoriteAddDlg message handlers - -void CFavoriteAddDlg::OnUpdateOk(CCmdUI* pCmdUI) -{ - UpdateData(); - pCmdUI->Enable(!m_name.IsEmpty()); -} diff --git a/src/apps/mplayerc/FavoriteAddDlg.h b/src/apps/mplayerc/FavoriteAddDlg.h deleted file mode 100644 index 20c1e953e..000000000 --- a/src/apps/mplayerc/FavoriteAddDlg.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -// CFavoriteAddDlg dialog - -class CFavoriteAddDlg : public CCmdUIDialog -{ - DECLARE_DYNAMIC(CFavoriteAddDlg) - -private: - CString m_shortname, m_fullname; - -public: - CFavoriteAddDlg(CString shortname, CString fullname, CWnd* pParent = NULL); // standard constructor - virtual ~CFavoriteAddDlg(); - -// Dialog Data - enum { IDD = IDD_FAVADD }; - - CComboBox m_namectrl; - CString m_name; - BOOL m_fRememberPos; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - - DECLARE_MESSAGE_MAP() - -public: - afx_msg void OnUpdateOk(CCmdUI* pCmdUI); -}; diff --git a/src/apps/mplayerc/FavoriteOrganizeDlg.cpp b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp deleted file mode 100644 index 01345f080..000000000 --- a/src/apps/mplayerc/FavoriteOrganizeDlg.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// FavoriteOrganizeDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "FavoriteOrganizeDlg.h" - - -// CFavoriteOrganizeDlg dialog - -//IMPLEMENT_DYNAMIC(CFavoriteOrganizeDlg, CResizableDialog) -CFavoriteOrganizeDlg::CFavoriteOrganizeDlg(CWnd* pParent /*=NULL*/) - : CResizableDialog(CFavoriteOrganizeDlg::IDD, pParent) -{ -} - -CFavoriteOrganizeDlg::~CFavoriteOrganizeDlg() -{ -} - -void CFavoriteOrganizeDlg::SetupList(bool fSave) -{ - int i = m_tab.GetCurSel(); - - if(fSave) - { - CAtlList sl; - - for(int j = 0; j < m_list.GetItemCount(); j++) - { - CString desc = m_list.GetItemText(j, 0); - desc.Remove(';'); - CString str = m_sl[i].GetAt((POSITION)m_list.GetItemData(j)); - sl.AddTail(desc + str.Mid(str.Find(';'))); - } - - m_sl[i].RemoveAll(); - m_sl[i].AddTailList(&sl); - } - else - { - m_list.DeleteAllItems(); - - POSITION pos = m_sl[i].GetHeadPosition(), tmp; - while(pos) - { - tmp = pos; - CString s = m_sl[i].GetNext(pos); - int i = s.Find(';'); - if(i >= 0) s = s.Left(i); - m_list.SetItemData(m_list.InsertItem(m_list.GetItemCount(), s), (DWORD_PTR)tmp); - } - - m_list.SetRedraw(FALSE); - - CRect r; - m_list.GetClientRect(r); - m_list.SetColumnWidth(0, -1); - m_list.SetColumnWidth(0, max(m_list.GetColumnWidth(0), r.Size().cx)); - - m_list.SetRedraw(TRUE); - } -} - -void CFavoriteOrganizeDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Control(pDX, IDC_TAB1, m_tab); - DDX_Control(pDX, IDC_LIST2, m_list); -} - - -BEGIN_MESSAGE_MAP(CFavoriteOrganizeDlg, CResizableDialog) - ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnTcnSelchangeTab1) - ON_WM_DRAWITEM() - ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1) - ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2) - ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3) - ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton7) - ON_NOTIFY(TCN_SELCHANGING, IDC_TAB1, OnTcnSelchangingTab1) - ON_BN_CLICKED(IDOK, OnBnClickedOk) - ON_WM_ACTIVATE() - ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST2, OnLvnEndlabeleditList2) - ON_WM_SIZE() -END_MESSAGE_MAP() - - -// CFavoriteOrganizeDlg message handlers - -BOOL CFavoriteOrganizeDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - m_tab.InsertItem(0, ResStr(IDS_FAVFILES)); - m_tab.InsertItem(1, ResStr(IDS_FAVDVDS)); -// m_tab.InsertItem(2, ResStr(IDS_FAVDEVICES)); - m_tab.SetCurSel(0); - - m_list.InsertColumn(0, _T("")); - m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT); - - AfxGetAppSettings().GetFav(FAV_FILE, m_sl[0]); - AfxGetAppSettings().GetFav(FAV_DVD, m_sl[1]); - AfxGetAppSettings().GetFav(FAV_DEVICE, m_sl[2]); - - SetupList(false); - - AddAnchor(IDC_TAB1, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDC_LIST2, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDC_BUTTON1, TOP_RIGHT); - AddAnchor(IDC_BUTTON2, TOP_RIGHT); - AddAnchor(IDC_BUTTON3, TOP_RIGHT); - AddAnchor(IDC_BUTTON4, TOP_RIGHT); - AddAnchor(IDOK, BOTTOM_RIGHT); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CFavoriteOrganizeDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) -{ - SetupList(false); - - m_list.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - - *pResult = 0; -} - -void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) -{ - if(nIDCtl != IDC_LIST2) return; - - int nItem = lpDrawItemStruct->itemID; - CRect rcItem = lpDrawItemStruct->rcItem; - - CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); - - if(!!m_list.GetItemState(nItem, LVIS_SELECTED)) - { - FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc)); - FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31)); - } - else - { - CBrush b; - b.CreateSysColorBrush(COLOR_WINDOW); - FillRect(pDC->m_hDC, rcItem, b); - } - - CString str = m_list.GetItemText(nItem, 0); - - pDC->SetTextColor(0); - pDC->TextOut(rcItem.left+3, (rcItem.top+rcItem.bottom - pDC->GetTextExtent(str).cy)/2, str); -} - -void CFavoriteOrganizeDlg::OnBnClickedButton1() -{ - if(POSITION pos = m_list.GetFirstSelectedItemPosition()) - { - m_list.SetFocus(); - m_list.EditLabel(m_list.GetNextSelectedItem(pos)); - } -} - -void CFavoriteOrganizeDlg::OnLvnEndlabeleditList2(NMHDR* pNMHDR, LRESULT* pResult) -{ - NMLVDISPINFO* pDispInfo = reinterpret_cast(pNMHDR); - if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText) - m_list.SetItemText(pDispInfo->item.iItem, 0, pDispInfo->item.pszText); - *pResult = 0; -} - -void CFavoriteOrganizeDlg::OnBnClickedButton2() -{ - if(POSITION pos = m_list.GetFirstSelectedItemPosition()) - { - int nItem = m_list.GetNextSelectedItem(pos); - if(nItem < 0 || nItem >= m_list.GetItemCount()) return; - - m_list.DeleteItem(nItem); - - nItem = min(nItem, m_list.GetItemCount()-1); - - m_list.SetSelectionMark(nItem); - m_list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED); - } -} - -void CFavoriteOrganizeDlg::OnBnClickedButton3() -{ - if(POSITION pos = m_list.GetFirstSelectedItemPosition()) - { - int nItem = m_list.GetNextSelectedItem(pos); - if(nItem <= 0) return; - - DWORD_PTR data = m_list.GetItemData(nItem); - CString str = m_list.GetItemText(nItem, 0); - - m_list.DeleteItem(nItem); - - nItem--; - - m_list.InsertItem(nItem, str); - m_list.SetItemData(nItem, data); - m_list.SetSelectionMark(nItem); - m_list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED); - } -} - -void CFavoriteOrganizeDlg::OnBnClickedButton7() -{ - if(POSITION pos = m_list.GetFirstSelectedItemPosition()) - { - int nItem = m_list.GetNextSelectedItem(pos); - if(nItem < 0 || nItem >= m_list.GetItemCount()-1) return; - - DWORD_PTR data = m_list.GetItemData(nItem); - CString str = m_list.GetItemText(nItem, 0); - - m_list.DeleteItem(nItem); - - nItem++; - - m_list.InsertItem(nItem, str); - m_list.SetItemData(nItem, data); - m_list.SetSelectionMark(nItem); - m_list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED); - } -} - -void CFavoriteOrganizeDlg::OnTcnSelchangingTab1(NMHDR *pNMHDR, LRESULT *pResult) -{ - SetupList(true); - - *pResult = 0; -} - -void CFavoriteOrganizeDlg::OnBnClickedOk() -{ - SetupList(true); - - AfxGetAppSettings().SetFav(FAV_FILE, m_sl[0]); - AfxGetAppSettings().SetFav(FAV_DVD, m_sl[1]); - AfxGetAppSettings().SetFav(FAV_DEVICE, m_sl[2]); - - OnOK(); -} - -void CFavoriteOrganizeDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) -{ - __super::OnActivate(nState, pWndOther, bMinimized); - - if(nState == WA_ACTIVE) - m_list.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); -} - -void CFavoriteOrganizeDlg::OnSize(UINT nType, int cx, int cy) -{ - __super::OnSize(nType, cx, cy); - - if(IsWindow(m_list)) - m_list.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER); -} diff --git a/src/apps/mplayerc/FavoriteOrganizeDlg.h b/src/apps/mplayerc/FavoriteOrganizeDlg.h deleted file mode 100644 index 59c1be17f..000000000 --- a/src/apps/mplayerc/FavoriteOrganizeDlg.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once -#include "afxcmn.h" -#include "afxwin.h" -#include "..\..\ui\ResizableLib\ResizableDialog.h" - - -// CFavoriteOrganizeDlg dialog - -class CFavoriteOrganizeDlg : public CResizableDialog -{ -// DECLARE_DYNAMIC(CFavoriteOrganizeDlg) - -private: - CAtlList m_sl[3]; - void SetupList(bool fSave); - -public: - CFavoriteOrganizeDlg(CWnd* pParent = NULL); // standard constructor - virtual ~CFavoriteOrganizeDlg(); - -// Dialog Data - enum { IDD = IDD_FAVORGANIZE }; - - CTabCtrl m_tab; - CListCtrl m_list; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct); - afx_msg void OnBnClickedButton1(); - afx_msg void OnBnClickedButton2(); - afx_msg void OnBnClickedButton3(); - afx_msg void OnBnClickedButton7(); - afx_msg void OnTcnSelchangingTab1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnBnClickedOk(); - afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); - afx_msg void OnLvnEndlabeleditList2(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnSize(UINT nType, int cx, int cy); -}; diff --git a/src/apps/mplayerc/FileDropTarget.cpp b/src/apps/mplayerc/FileDropTarget.cpp deleted file mode 100644 index 4243d82eb..000000000 --- a/src/apps/mplayerc/FileDropTarget.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// FileDropTarget.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "FileDropTarget.h" - - -// CFileDropTarget - -//IMPLEMENT_DYNAMIC(CFileDropTarget, COleDropTarget) -CFileDropTarget::CFileDropTarget(CDropTarget* pDropTarget) - : m_pDropTarget(pDropTarget) -{ - ASSERT(m_pDropTarget); -} - -CFileDropTarget::~CFileDropTarget() -{ -} - -DROPEFFECT CFileDropTarget::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) -{ - return m_pDropTarget ? m_pDropTarget->OnDragEnter(pDataObject, dwKeyState, point) : DROPEFFECT_NONE; -} - -DROPEFFECT CFileDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) -{ - return m_pDropTarget ? m_pDropTarget->OnDragOver(pDataObject, dwKeyState, point) : DROPEFFECT_NONE; -} - -BOOL CFileDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) -{ - return m_pDropTarget ? m_pDropTarget->OnDrop(pDataObject, dropEffect, point) : DROPEFFECT_NONE; -} - -DROPEFFECT CFileDropTarget::OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point) -{ - return m_pDropTarget ? m_pDropTarget->OnDropEx(pDataObject, dropDefault, dropList, point) : DROPEFFECT_NONE; -} - -void CFileDropTarget::OnDragLeave(CWnd* pWnd) -{ - if(m_pDropTarget) m_pDropTarget->OnDragLeave(); -} - -DROPEFFECT CFileDropTarget::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point) -{ - return m_pDropTarget ? m_pDropTarget->OnDragScroll(dwKeyState, point) : DROPEFFECT_NONE; -} - -BEGIN_MESSAGE_MAP(CFileDropTarget, COleDropTarget) -END_MESSAGE_MAP() - - - -// CFileDropTarget message handlers diff --git a/src/apps/mplayerc/FileDropTarget.h b/src/apps/mplayerc/FileDropTarget.h deleted file mode 100644 index 79db45449..000000000 --- a/src/apps/mplayerc/FileDropTarget.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include - -class CDropTarget -{ -public: - CDropTarget() {} - - virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) {return DROPEFFECT_NONE;} - virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) {return DROPEFFECT_NONE;} - virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) {return FALSE;} - virtual DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point) {return (DROPEFFECT)-1;} - virtual void OnDragLeave() {} - virtual DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point) {return DROPEFFECT_NONE;} -}; - -// CFileDropTarget command target - -class CFileDropTarget : public COleDropTarget -{ -// DECLARE_DYNAMIC(CFileDropTarget) - -private: - CDropTarget* m_pDropTarget; - -public: - CFileDropTarget(CDropTarget* pDropTarget); - virtual ~CFileDropTarget(); - -protected: - DECLARE_MESSAGE_MAP() - - DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point); - DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point); - BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point); - DROPEFFECT OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point); - void OnDragLeave(CWnd* pWnd); - DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point); -}; - - diff --git a/src/apps/mplayerc/FloatEdit.cpp b/src/apps/mplayerc/FloatEdit.cpp deleted file mode 100644 index f437d89ea..000000000 --- a/src/apps/mplayerc/FloatEdit.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "floatedit.h" - -// CFloatEdit - -IMPLEMENT_DYNAMIC(CFloatEdit, CEdit) - -bool CFloatEdit::GetFloat(float& f) -{ - CString s; - GetWindowText(s); - return(_stscanf(s, _T("%f"), &f) == 1); -} - -double CFloatEdit::operator = (double d) -{ - CString s; - s.Format(_T("%.4f"), d); - SetWindowText(s); - return(d); -} - -CFloatEdit::operator double() -{ - CString s; - GetWindowText(s); - float f; - return(_stscanf(s, _T("%f"), &f) == 1 ? f : 0); -} - -BEGIN_MESSAGE_MAP(CFloatEdit, CEdit) - ON_WM_CHAR() -END_MESSAGE_MAP() - -void CFloatEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -{ - if(!(nChar >= '0' && nChar <= '9' || nChar == '.' || nChar == '\b')) - return; - - CString str; - GetWindowText(str); - - if(nChar == '.' && (str.Find('.') >= 0 || str.IsEmpty())) - return; - - int nStartChar, nEndChar; - GetSel(nStartChar, nEndChar); - - if(nChar == '\b' && nStartChar <= 0) - return; - - CEdit::OnChar(nChar, nRepCnt, nFlags); -} - -// CIntEdit - -IMPLEMENT_DYNAMIC(CIntEdit, CEdit) - -BEGIN_MESSAGE_MAP(CIntEdit, CEdit) - ON_WM_CHAR() -END_MESSAGE_MAP() - -void CIntEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -{ - if(!(nChar >= '0' && nChar <= '9' || nChar == '-' || nChar == '\b')) - return; - - CString str; - GetWindowText(str); - - if(nChar == '-' && !str.IsEmpty() && str[0] == '-') - return; - - int nStartChar, nEndChar; - GetSel(nStartChar, nEndChar); - - if(nChar == '\b' && nStartChar <= 0) - return; - - if(nChar == '-' && (nStartChar != 0 || nEndChar != 0)) - return; - - CEdit::OnChar(nChar, nRepCnt, nFlags); -} - -// CHexEdit - -IMPLEMENT_DYNAMIC(CHexEdit, CEdit) - -bool CHexEdit::GetDWORD(DWORD& dw) -{ - CString s; - GetWindowText(s); - return(_stscanf(s, _T("%x"), &dw) == 1); -} - -DWORD CHexEdit::operator = (DWORD dw) -{ - CString s; - s.Format(_T("%08x"), dw); - SetWindowText(s); - return(dw); -} - -CHexEdit::operator DWORD() -{ - CString s; - GetWindowText(s); - DWORD dw; - return(_stscanf(s, _T("%x"), &dw) == 1 ? dw : 0); -} - -BEGIN_MESSAGE_MAP(CHexEdit, CEdit) - ON_WM_CHAR() -END_MESSAGE_MAP() - -void CHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -{ - if(!(nChar >= 'A' && nChar <= 'F' || nChar >= 'a' && nChar <= 'f' - || nChar >= '0' && nChar <= '9' || nChar == '\b')) - return; - - CString str; - GetWindowText(str); - - int nStartChar, nEndChar; - GetSel(nStartChar, nEndChar); - - if(nChar == '\b' && nStartChar <= 0) - return; - - if(nChar != '\b' && nEndChar - nStartChar == 0 && str.GetLength() >= 8) - return; - - CEdit::OnChar(nChar, nRepCnt, nFlags); -} diff --git a/src/apps/mplayerc/FloatEdit.h b/src/apps/mplayerc/FloatEdit.h deleted file mode 100644 index 8abb97582..000000000 --- a/src/apps/mplayerc/FloatEdit.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -// CFloatEdit - -class CFloatEdit : public CEdit -{ -public: - bool GetFloat(float& f); - double operator = (double d); - operator double(); - - DECLARE_DYNAMIC(CFloatEdit) - DECLARE_MESSAGE_MAP() - -public: - afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); -}; - -// CIntEdit - -class CIntEdit : public CEdit -{ -public: - DECLARE_DYNAMIC(CIntEdit) - DECLARE_MESSAGE_MAP() - -public: - afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); -}; - -// CHexEdit - -class CHexEdit : public CEdit -{ -public: - bool GetDWORD(DWORD& dw); - DWORD operator = (DWORD dw); - operator DWORD(); - - DECLARE_DYNAMIC(CHexEdit) - DECLARE_MESSAGE_MAP() - -public: - afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); -}; diff --git a/src/apps/mplayerc/GoToDlg.cpp b/src/apps/mplayerc/GoToDlg.cpp deleted file mode 100644 index aebe09d46..000000000 --- a/src/apps/mplayerc/GoToDlg.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// GoToDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "GoToDlg.h" - -#include - - -// CGoToDlg dialog - -IMPLEMENT_DYNAMIC(CGoToDlg, CDialog) -CGoToDlg::CGoToDlg(int time, float fps, CWnd* pParent /*=NULL*/) - : CDialog(CGoToDlg::IDD, pParent) - , m_timestr(_T("")) - , m_framestr(_T("")) - , m_time(time) - , m_fps(fps) -{ - if(m_fps == 0) - { - CString str = AfxGetApp()->GetProfileString(ResStr(IDS_R_SETTINGS), _T("fps"), _T("0")); - if(_stscanf(str, _T("%f"), &m_fps) != 1) m_fps = 0; - } -} - -CGoToDlg::~CGoToDlg() -{ -} - -void CGoToDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_EDIT1, m_timestr); - DDX_Text(pDX, IDC_EDIT2, m_framestr); - DDX_Control(pDX, IDC_EDIT1, m_timeedit); - DDX_Control(pDX, IDC_EDIT2, m_frameedit); -} - -BOOL CGoToDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - if(m_time >= 0) - { - m_timestr.Format(_T("%02d:%02d:%02d.%03d"), - (m_time/(1000*60*60))%60, (m_time/(1000*60))%60, (m_time/1000)%60, m_time%1000); - - if(m_fps > 0) - { - m_framestr.Format(_T("%d, %.3f"), (int)(m_fps*m_time/1000), m_fps); - } - - UpdateData(FALSE); - - switch(AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("gotoluf"), 0)) - { - default: - case 0: m_timeedit.SetFocus(); m_timeedit.SetSel(0, 0); break; - case 1: m_frameedit.SetFocus(); m_frameedit.SetSel(0, m_framestr.Find(',')); break; - } - - } - - return FALSE; - -// return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - - -BEGIN_MESSAGE_MAP(CGoToDlg, CDialog) - ON_BN_CLICKED(IDC_OK1, OnBnClickedOk1) - ON_BN_CLICKED(IDC_OK2, OnBnClickedOk2) -END_MESSAGE_MAP() - - -// CGoToDlg message handlers - -void CGoToDlg::OnBnClickedOk1() -{ - UpdateData(); - - int hh, mm, ss, ms; - hh = mm = ss = ms = 0; - - CAtlRegExp<> re; - - REParseError status = re.Parse(_T("{\\z}"), FALSE); - if(REPARSE_ERROR_OK == status) - { - CAtlREMatchContext<> mc; - const CAtlREMatchContext<>::RECHAR* s = m_timestr.GetBuffer(); - const CAtlREMatchContext<>::RECHAR* e = NULL; - while(s && re.Match(s, &mc, &e)) - { - const CAtlREMatchContext<>::RECHAR* szStart = 0; - const CAtlREMatchContext<>::RECHAR* szEnd = 0; - mc.GetMatch(0, &szStart, &szEnd); - - if(hh != 0 || hh > 59 || mm > 59 || ss > 59) - { - AfxMessageBox(_T("Error parsing entered time!")); - return; - } - - hh = mm; - mm = ss; - ss = ms; - ms = _tcstol(szStart, (TCHAR**)&szStart, 10); - - s = e; - } - - m_time = ((hh*60+mm)*60+ss)*1000+ms; - - AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("gotoluf"), 0); - - OnOK(); - } -} - - -void CGoToDlg::OnBnClickedOk2() -{ - UpdateData(); - - int frame = 0; - float fps = 0; - - CAtlRegExp<> re; - - REParseError status = re.Parse(_T("{\\z}[^0-9\\.]+{[0-9\\.]+}"), FALSE); - if(REPARSE_ERROR_OK == status) - { - CAtlREMatchContext<> mc; - const CAtlREMatchContext<>::RECHAR* s = m_framestr.GetBuffer(); - const CAtlREMatchContext<>::RECHAR* e = NULL; - if(re.Match(s, &mc, &e)) - { - const CAtlREMatchContext<>::RECHAR* szStart = 0; - const CAtlREMatchContext<>::RECHAR* szEnd = 0; - - mc.GetMatch(0, &szStart, &szEnd); - frame = _tcstol(szStart, (TCHAR**)&szStart, 10); - - mc.GetMatch(1, &szStart, &szEnd); - if(_stscanf(szStart, _T("%f"), &fps) != 1) fps = 0; - else AfxGetApp()->WriteProfileString(ResStr(IDS_R_SETTINGS), _T("fps"), szStart); - } - else - { - AfxMessageBox(_T("Error parsing entered text!")); - return; - } - - if(fps == 0) - { - AfxMessageBox(_T("Error parsing entered frame-rate!")); - return; - } - - m_time = (int)(1000.0*frame/fps) + 1; - - AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("gotoluf"), 1); - - OnOK(); - } -} - -BOOL CGoToDlg::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) - { - if(*GetFocus() == m_timeedit) OnBnClickedOk1(); - else if(*GetFocus() == m_frameedit) OnBnClickedOk2(); - - return TRUE; - } - - return __super::PreTranslateMessage(pMsg); -} diff --git a/src/apps/mplayerc/GoToDlg.h b/src/apps/mplayerc/GoToDlg.h deleted file mode 100644 index c0a653344..000000000 --- a/src/apps/mplayerc/GoToDlg.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once -#include "afxwin.h" - -// CGoToDlg dialog - -class CGoToDlg : public CDialog -{ - DECLARE_DYNAMIC(CGoToDlg) - -public: - CGoToDlg(int time = -1, float fps = 0, CWnd* pParent = NULL); // standard constructor - virtual ~CGoToDlg(); - - CString m_timestr; - CString m_framestr; - CEdit m_timeedit; - CEdit m_frameedit; - - int m_time; - float m_fps; - -// Dialog Data - enum { IDD = IDD_GOTO_DLG }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - virtual BOOL PreTranslateMessage(MSG* pMsg); - - DECLARE_MESSAGE_MAP() - -public: - afx_msg void OnBnClickedOk1(); - afx_msg void OnBnClickedOk2(); -}; diff --git a/src/apps/mplayerc/IGraphBuilder2.h b/src/apps/mplayerc/IGraphBuilder2.h deleted file mode 100644 index 5da815ef2..000000000 --- a/src/apps/mplayerc/IGraphBuilder2.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -[uuid("165BE9D6-0929-4363-9BA3-580D735AA0F6")] -interface IGraphBuilder2 : public IFilterGraph2 -{ - STDMETHOD(IsPinDirection) (IPin* pPin, PIN_DIRECTION dir) = 0; - STDMETHOD(IsPinConnected) (IPin* pPin) = 0; - STDMETHOD(ConnectFilter) (IBaseFilter* pBF, IPin* pPinIn) = 0; - STDMETHOD(ConnectFilter) (IPin* pPinOut, IBaseFilter* pBF) = 0; - STDMETHOD(ConnectFilterDirect) (IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt) = 0; - STDMETHOD(NukeDownstream) (IUnknown* pUnk) = 0; - STDMETHOD(FindInterface) (REFIID iid, void** ppv, BOOL bRemove) = 0; - STDMETHOD(AddToROT) () = 0; - STDMETHOD(RemoveFromROT) () = 0; -}; - -// private use only -[uuid("43CDA93D-6A4E-4A07-BD3E-49D161073EE7")] -interface IGraphBuilderDeadEnd : public IUnknown -{ - STDMETHOD_(size_t, GetCount)() = 0; - STDMETHOD(GetDeadEnd) (int iIndex, CAtlList& path, CAtlList& mts) = 0; -}; \ No newline at end of file diff --git a/src/apps/mplayerc/IPinHook.cpp b/src/apps/mplayerc/IPinHook.cpp deleted file mode 100644 index bde5d8e2a..000000000 --- a/src/apps/mplayerc/IPinHook.cpp +++ /dev/null @@ -1,493 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "IPinHook.h" -#include "DX9AllocatorPresenter.h" - -REFERENCE_TIME g_tSegmentStart = 0; -REFERENCE_TIME g_tSampleStart = 0; - -static HRESULT (STDMETHODCALLTYPE * NewSegmentOrg)(IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) = NULL; - -static HRESULT STDMETHODCALLTYPE NewSegmentMine(IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) -{ - g_tSegmentStart = tStart; - return NewSegmentOrg(This, tStart, tStop, dRate); -} - -static HRESULT ( STDMETHODCALLTYPE *ReceiveOrg )( IMemInputPinC * This, IMediaSample *pSample) = NULL; - -static HRESULT STDMETHODCALLTYPE ReceiveMineI(IMemInputPinC * This, IMediaSample *pSample) -{ - REFERENCE_TIME rtStart, rtStop; - if(pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop))) - g_tSampleStart = rtStart; - return ReceiveOrg(This, pSample); -} - -static HRESULT STDMETHODCALLTYPE ReceiveMine(IMemInputPinC * This, IMediaSample *pSample) -{ - // Support ffdshow queueing. - // To avoid black out on pause, we have to lock g_ffdshowReceive to synchronize with CMainFrame::OnPlayPause. - if(queueu_ffdshow_support) - { - CAutoLock lck(&g_ffdshowReceive); - return ReceiveMineI(This,pSample); - } - return ReceiveMineI(This,pSample); -} - -bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC) -{ - if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000)) - return false; - - g_tSegmentStart = 0; - g_tSampleStart = 0; - - BOOL res; - DWORD flOldProtect = 0; - DWORD flSetProtect = 0; - - res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl /*IPinC*/), PAGE_WRITECOPY, &flOldProtect); - flSetProtect = flOldProtect; - if(NewSegmentOrg == NULL) NewSegmentOrg = pPinC->lpVtbl->NewSegment; - pPinC->lpVtbl->NewSegment = NewSegmentMine; - res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl /*IPinC*/), flSetProtect /* PAGE_EXECUTE */, &flOldProtect); - - flOldProtect = 0; - res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl /*IMemInputPinC*/), PAGE_WRITECOPY, &flOldProtect); - flSetProtect = flOldProtect; - - if(ReceiveOrg == NULL) ReceiveOrg = pMemInputPinC->lpVtbl->Receive; - pMemInputPinC->lpVtbl->Receive = ReceiveMine; - res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl /*IMemInputPinC*/), flSetProtect /*PAGE_EXECUTE*/, &flOldProtect); - - return true; -} - -static HRESULT ( STDMETHODCALLTYPE *GetVideoAcceleratorGUIDsOrg )( IAMVideoAcceleratorC * This,/* [out][in] */ LPDWORD pdwNumGuidsSupported,/* [out][in] */ LPGUID pGuidsSupported) = NULL; -static HRESULT ( STDMETHODCALLTYPE *GetUncompFormatsSupportedOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [out][in] */ LPDWORD pdwNumFormatsSupported,/* [out][in] */ LPDDPIXELFORMAT pFormatsSupported) = NULL; -static HRESULT ( STDMETHODCALLTYPE *GetInternalMemInfoOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,/* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo) = NULL; -static HRESULT ( STDMETHODCALLTYPE *GetCompBufferInfoOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,/* [out][in] */ LPDWORD pdwNumTypesCompBuffers,/* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) = NULL; -static HRESULT ( STDMETHODCALLTYPE *GetInternalCompBufferInfoOrg )( IAMVideoAcceleratorC * This,/* [out][in] */ LPDWORD pdwNumTypesCompBuffers,/* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) = NULL; -static HRESULT ( STDMETHODCALLTYPE *BeginFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo) = NULL; -static HRESULT ( STDMETHODCALLTYPE *EndFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ const AMVAEndFrameInfo *pEndFrameInfo) = NULL; -static HRESULT ( STDMETHODCALLTYPE *GetBufferOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex,/* [in] */ BOOL bReadOnly,/* [out] */ LPVOID *ppBuffer,/* [out] */ LONG *lpStride) = NULL; -static HRESULT ( STDMETHODCALLTYPE *ReleaseBufferOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex) = NULL; -static HRESULT ( STDMETHODCALLTYPE *ExecuteOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwFunction,/* [in] */ LPVOID lpPrivateInputData,/* [in] */ DWORD cbPrivateInputData,/* [in] */ LPVOID lpPrivateOutputDat,/* [in] */ DWORD cbPrivateOutputData,/* [in] */ DWORD dwNumBuffers,/* [in] */ const AMVABUFFERINFO *pamvaBufferInfo) = NULL; -static HRESULT ( STDMETHODCALLTYPE *QueryRenderStatusOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex,/* [in] */ DWORD dwFlags) = NULL; -static HRESULT ( STDMETHODCALLTYPE *DisplayFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwFlipToIndex,/* [in] */ IMediaSample *pMediaSample) = NULL; - -static void LOG(LPCTSTR fmt, ...) -{ - va_list args; - va_start(args, fmt); - if(TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1]) - { - _vstprintf(buff, fmt, args); - if(FILE* f = _tfopen(_T("c:\\dxva.log"), _T("at"))) - { - fseek(f, 0, 2); - _ftprintf(f, _T("%s\n"), buff); - fclose(f); - } - delete [] buff; - } - va_end(args); -} - -static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n) -{ - for(int i = 0; i < n; i++) - { - LOG(_T("%s[%d].dwSize = %d"), prefix, i, p[i].dwSize); - LOG(_T("%s[%d].dwFlags = %08x"), prefix, i, p[i].dwFlags); - LOG(_T("%s[%d].dwFourCC = %4.4hs"), prefix, i, &p[i].dwFourCC); - LOG(_T("%s[%d].dwRGBBitCount = %08x"), prefix, i, &p[i].dwRGBBitCount); - LOG(_T("%s[%d].dwRBitMask = %08x"), prefix, i, &p[i].dwRBitMask); - LOG(_T("%s[%d].dwGBitMask = %08x"), prefix, i, &p[i].dwGBitMask); - LOG(_T("%s[%d].dwBBitMask = %08x"), prefix, i, &p[i].dwBBitMask); - LOG(_T("%s[%d].dwRGBAlphaBitMask = %08x"), prefix, i, &p[i].dwRGBAlphaBitMask); - } -} - -static void LOGUDI(LPCTSTR prefix, const AMVAUncompDataInfo* p, int n) -{ - for(int i = 0; i < n; i++) - { - LOG(_T("%s[%d].dwUncompWidth = %d"), prefix, i, p[i].dwUncompWidth); - LOG(_T("%s[%d].dwUncompHeight = %d"), prefix, i, p[i].dwUncompHeight); - - CString prefix2; - prefix2.Format(_T("%s[%d]"), prefix, i); - LOGPF(prefix2, &p[i].ddUncompPixelFormat, 1); - } -} - -static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine( - IAMVideoAcceleratorC * This, - /* [out][in] */ LPDWORD pdwNumGuidsSupported, - /* [out][in] */ LPGUID pGuidsSupported) -{ - LOG(_T("\nGetVideoAcceleratorGUIDs")); - - if(pdwNumGuidsSupported) - { - LOG(_T("[in] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported); - } - - HRESULT hr = GetVideoAcceleratorGUIDsOrg(This, pdwNumGuidsSupported, pGuidsSupported); - - LOG(_T("hr = %08x"), hr); - - if(pdwNumGuidsSupported) - { - LOG(_T("[out] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported); - - if(pGuidsSupported) - { - for(int i = 0; i < *pdwNumGuidsSupported; i++) - { - LOG(_T("[out] pGuidsSupported[%d] = %s"), i, CStringFromGUID(pGuidsSupported[i])); - } - } - } - - return hr; -} - -static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine( - IAMVideoAcceleratorC * This, - /* [in] */ const GUID *pGuid, - /* [out][in] */ LPDWORD pdwNumFormatsSupported, - /* [out][in] */ LPDDPIXELFORMAT pFormatsSupported) -{ - LOG(_T("\nGetUncompFormatsSupported")); - - if(pGuid) - { - LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid)); - } - - if(pdwNumFormatsSupported) - { - LOG(_T("[in] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported); - } - - HRESULT hr = GetUncompFormatsSupportedOrg(This, pGuid, pdwNumFormatsSupported, pFormatsSupported); - - LOG(_T("hr = %08x"), hr); - - if(pdwNumFormatsSupported) - { - LOG(_T("[out] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported); - - if(pFormatsSupported) - { - LOGPF(_T("[out] pFormatsSupported"), pFormatsSupported, *pdwNumFormatsSupported); - } - } - - return hr; -} - -static HRESULT STDMETHODCALLTYPE GetInternalMemInfoMine( - IAMVideoAcceleratorC * This, - /* [in] */ const GUID *pGuid, - /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo, - /* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo) -{ - LOG(_T("\nGetInternalMemInfo")); - - HRESULT hr = GetInternalMemInfoOrg(This, pGuid, pamvaUncompDataInfo, pamvaInternalMemInfo); - - LOG(_T("hr = %08x"), hr); - - return hr; -} - -static HRESULT STDMETHODCALLTYPE GetCompBufferInfoMine( - IAMVideoAcceleratorC * This, - /* [in] */ const GUID *pGuid, - /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo, - /* [out][in] */ LPDWORD pdwNumTypesCompBuffers, - /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) -{ - LOG(_T("\nGetCompBufferInfo")); - - if(pGuid) - { - LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid)); - - if(pdwNumTypesCompBuffers) - { - LOG(_T("[in] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers); - } - } - - HRESULT hr = GetCompBufferInfoOrg(This, pGuid, pamvaUncompDataInfo, pdwNumTypesCompBuffers, pamvaCompBufferInfo); - - LOG(_T("hr = %08x"), hr); - - if(pdwNumTypesCompBuffers) - { - LOG(_T("[out] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers); - - if(pamvaUncompDataInfo) - { - LOGUDI(_T("[out] pamvaUncompDataInfo"), pamvaUncompDataInfo, *pdwNumTypesCompBuffers); - } - } - - return hr; -} - -static HRESULT STDMETHODCALLTYPE GetInternalCompBufferInfoMine( - IAMVideoAcceleratorC * This, - /* [out][in] */ LPDWORD pdwNumTypesCompBuffers, - /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) -{ - LOG(_T("\nGetInternalCompBufferInfo")); - - HRESULT hr = GetInternalCompBufferInfoOrg(This, pdwNumTypesCompBuffers, pamvaCompBufferInfo); - - LOG(_T("hr = %08x"), hr); - - return hr; -} - -static HRESULT STDMETHODCALLTYPE BeginFrameMine( - IAMVideoAcceleratorC * This, - /* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo) -{ - LOG(_T("\nBeginFrame")); - - if(amvaBeginFrameInfo) - { - LOG(_T("[in] amvaBeginFrameInfo->dwDestSurfaceIndex = %08x"), amvaBeginFrameInfo->dwDestSurfaceIndex); - LOG(_T("[in] amvaBeginFrameInfo->pInputData = %08x"), amvaBeginFrameInfo->pInputData); - LOG(_T("[in] amvaBeginFrameInfo->dwSizeInputData = %08x"), amvaBeginFrameInfo->dwSizeInputData); - LOG(_T("[in] amvaBeginFrameInfo->pOutputData = %08x"), amvaBeginFrameInfo->pOutputData); - LOG(_T("[in] amvaBeginFrameInfo->dwSizeOutputData = %08x"), amvaBeginFrameInfo->dwSizeOutputData); - } - - HRESULT hr = BeginFrameOrg(This, amvaBeginFrameInfo); - - LOG(_T("hr = %08x"), hr); - - if(amvaBeginFrameInfo && amvaBeginFrameInfo->pOutputData) - { - LOG(_T("[out] amvaBeginFrameInfo->pOutputData = %02x %02x %02x %02x..."), - ((BYTE*)amvaBeginFrameInfo->pOutputData)[0], - ((BYTE*)amvaBeginFrameInfo->pOutputData)[1], - ((BYTE*)amvaBeginFrameInfo->pOutputData)[2], - ((BYTE*)amvaBeginFrameInfo->pOutputData)[3]); - } - - return hr; -} - -static HRESULT STDMETHODCALLTYPE EndFrameMine( - IAMVideoAcceleratorC * This, - /* [in] */ const AMVAEndFrameInfo *pEndFrameInfo) -{ - LOG(_T("\nEndFrame")); - - if(pEndFrameInfo) - { - LOG(_T("[in] pEndFrameInfo->dwSizeMiscData = %08x"), pEndFrameInfo->dwSizeMiscData); - LOG(_T("[in] pEndFrameInfo->pMiscData = %08x"), pEndFrameInfo->pMiscData); - } - - HRESULT hr = EndFrameOrg(This, pEndFrameInfo); - - LOG(_T("hr = %08x"), hr); - - return hr; -} - -static HRESULT STDMETHODCALLTYPE GetBufferMine( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwTypeIndex, - /* [in] */ DWORD dwBufferIndex, - /* [in] */ BOOL bReadOnly, - /* [out] */ LPVOID *ppBuffer, - /* [out] */ LONG *lpStride) -{ - LOG(_T("\nGetBuffer")); - - LOG(_T("[in] dwTypeIndex = %08x"), dwTypeIndex); - LOG(_T("[in] dwBufferIndex = %08x"), dwBufferIndex); - LOG(_T("[in] bReadOnly = %08x"), bReadOnly); - LOG(_T("[in] ppBuffer = %08x"), ppBuffer); - LOG(_T("[in] lpStride = %08x"), lpStride); - - HRESULT hr = GetBufferOrg(This, dwTypeIndex, dwBufferIndex, bReadOnly, ppBuffer, lpStride); - - LOG(_T("hr = %08x"), hr); - - LOG(_T("[out] *ppBuffer = %02x %02x %02x %02x ..."), ((BYTE*)*ppBuffer)[0], ((BYTE*)*ppBuffer)[1], ((BYTE*)*ppBuffer)[2], ((BYTE*)*ppBuffer)[3]); - LOG(_T("[out] *lpStride = %08x"), *lpStride); - - return hr; -} - -static HRESULT STDMETHODCALLTYPE ReleaseBufferMine( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwTypeIndex, - /* [in] */ DWORD dwBufferIndex) -{ - LOG(_T("\nReleaseBuffer")); - - LOG(_T("[in] dwTypeIndex = %08x"), dwTypeIndex); - LOG(_T("[in] dwBufferIndex = %08x"), dwBufferIndex); - - HRESULT hr = ReleaseBufferOrg(This, dwTypeIndex, dwBufferIndex); - - LOG(_T("hr = %08x"), hr); - - return hr; -} - -static HRESULT STDMETHODCALLTYPE ExecuteMine( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwFunction, - /* [in] */ LPVOID lpPrivateInputData, - /* [in] */ DWORD cbPrivateInputData, - /* [in] */ LPVOID lpPrivateOutputData, - /* [in] */ DWORD cbPrivateOutputData, - /* [in] */ DWORD dwNumBuffers, - /* [in] */ const AMVABUFFERINFO *pamvaBufferInfo) -{ - LOG(_T("\nExecute")); - - LOG(_T("[in] dwFunction = %08x"), dwFunction); - if(lpPrivateInputData) - { - LOG(_T("[in] lpPrivateInputData = %02x %02x %02x %02x ..."), - ((BYTE*)lpPrivateInputData)[0], - ((BYTE*)lpPrivateInputData)[1], - ((BYTE*)lpPrivateInputData)[2], - ((BYTE*)lpPrivateInputData)[3]); - } - LOG(_T("[in] cbPrivateInputData = %08x"), cbPrivateInputData); - LOG(_T("[in] lpPrivateOutputData = %08"), lpPrivateOutputData); - LOG(_T("[in] cbPrivateOutputData = %08x"), cbPrivateOutputData); - LOG(_T("[in] dwNumBuffers = %08x"), dwNumBuffers); - if(pamvaBufferInfo) - { - LOG(_T("[in] pamvaBufferInfo->dwTypeIndex = %08x"), pamvaBufferInfo->dwTypeIndex); - LOG(_T("[in] pamvaBufferInfo->dwBufferIndex = %08x"), pamvaBufferInfo->dwBufferIndex); - LOG(_T("[in] pamvaBufferInfo->dwDataOffset = %08x"), pamvaBufferInfo->dwDataOffset); - LOG(_T("[in] pamvaBufferInfo->dwDataSize = %08x"), pamvaBufferInfo->dwDataSize); - } - - HRESULT hr = ExecuteOrg(This, dwFunction, lpPrivateInputData, cbPrivateInputData, lpPrivateOutputData, cbPrivateOutputData, dwNumBuffers, pamvaBufferInfo); - - LOG(_T("hr = %08x"), hr); - - if(lpPrivateOutputData) - { - LOG(_T("[out] *lpPrivateOutputData = %08"), lpPrivateOutputData); - - if(cbPrivateOutputData) - { - LOG(_T("[out] cbPrivateOutputData = %02x %02x %02x %02x ..."), - ((BYTE*)lpPrivateOutputData)[0], - ((BYTE*)lpPrivateOutputData)[1], - ((BYTE*)lpPrivateOutputData)[2], - ((BYTE*)lpPrivateOutputData)[3]); - } - } - - return hr; -} - -static HRESULT STDMETHODCALLTYPE QueryRenderStatusMine( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwTypeIndex, - /* [in] */ DWORD dwBufferIndex, - /* [in] */ DWORD dwFlags) -{ - LOG(_T("\nQueryRenderStatus")); - - HRESULT hr = QueryRenderStatusOrg(This, dwTypeIndex, dwBufferIndex, dwFlags); - - LOG(_T("hr = %08x"), hr); - - return hr; -} - -static HRESULT STDMETHODCALLTYPE DisplayFrameMine( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwFlipToIndex, - /* [in] */ IMediaSample *pMediaSample) -{ - LOG(_T("\nDisplayFrame")); - - HRESULT hr = DisplayFrameOrg(This, dwFlipToIndex, pMediaSample); - - LOG(_T("hr = %08x"), hr); - - return hr; -} - -void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC) -{ - BOOL res; - DWORD flOldProtect = 0; - res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_WRITECOPY, &flOldProtect); -/* -*/ - if(GetVideoAcceleratorGUIDsOrg == NULL) GetVideoAcceleratorGUIDsOrg = pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs; - if(GetUncompFormatsSupportedOrg == NULL) GetUncompFormatsSupportedOrg = pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported; - if(GetInternalMemInfoOrg == NULL) GetInternalMemInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo; - if(GetCompBufferInfoOrg == NULL) GetCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo; - if(GetInternalCompBufferInfoOrg == NULL) GetInternalCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo; - if(BeginFrameOrg == NULL) BeginFrameOrg = pAMVideoAcceleratorC->lpVtbl->BeginFrame; - if(EndFrameOrg == NULL) EndFrameOrg = pAMVideoAcceleratorC->lpVtbl->EndFrame; - if(GetBufferOrg == NULL) GetBufferOrg = pAMVideoAcceleratorC->lpVtbl->GetBuffer; - if(ReleaseBufferOrg == NULL) ReleaseBufferOrg = pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer; - if(ExecuteOrg == NULL) ExecuteOrg = pAMVideoAcceleratorC->lpVtbl->Execute; - if(QueryRenderStatusOrg == NULL) QueryRenderStatusOrg = pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus; - if(DisplayFrameOrg == NULL) DisplayFrameOrg = pAMVideoAcceleratorC->lpVtbl->DisplayFrame; -/* -*/ -/* -*/ - pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs = GetVideoAcceleratorGUIDsMine; - pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported = GetUncompFormatsSupportedMine; - pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo = GetInternalMemInfoMine; - pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo = GetCompBufferInfoMine; - pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo = GetInternalCompBufferInfoMine; - pAMVideoAcceleratorC->lpVtbl->BeginFrame = BeginFrameMine; - pAMVideoAcceleratorC->lpVtbl->EndFrame = EndFrameMine; - pAMVideoAcceleratorC->lpVtbl->GetBuffer = GetBufferMine; - pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer = ReleaseBufferMine; - pAMVideoAcceleratorC->lpVtbl->Execute = ExecuteMine; - pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus = QueryRenderStatusMine; - pAMVideoAcceleratorC->lpVtbl->DisplayFrame = DisplayFrameMine; -/* -*/ - res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_EXECUTE, &flOldProtect); -} diff --git a/src/apps/mplayerc/IPinHook.h b/src/apps/mplayerc/IPinHook.h deleted file mode 100644 index 82ab189a2..000000000 --- a/src/apps/mplayerc/IPinHook.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -interface IPinC; - -typedef struct IPinCVtbl -{ - BEGIN_INTERFACE - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IPinC * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject ); - ULONG ( STDMETHODCALLTYPE *AddRef )( IPinC * This ); - ULONG ( STDMETHODCALLTYPE *Release )( IPinC * This ); - HRESULT ( STDMETHODCALLTYPE *Connect )( IPinC * This, /* [in] */ IPinC *pReceivePin, /* [in] */ const AM_MEDIA_TYPE *pmt ); - HRESULT ( STDMETHODCALLTYPE *ReceiveConnection )( IPinC * This, /* [in] */ IPinC *pConnector, /* [in] */ const AM_MEDIA_TYPE *pmt ); - HRESULT ( STDMETHODCALLTYPE *Disconnect )( IPinC * This ); - HRESULT ( STDMETHODCALLTYPE *ConnectedTo )( IPinC * This, /* [out] */ IPinC **pPin ); - HRESULT ( STDMETHODCALLTYPE *ConnectionMediaType )( IPinC * This, /* [out] */ AM_MEDIA_TYPE *pmt ); - HRESULT ( STDMETHODCALLTYPE *QueryPinInfo )( IPinC * This, /* [out] */ PIN_INFO *pInfo ); - HRESULT ( STDMETHODCALLTYPE *QueryDirection )( IPinC * This, /* [out] */ PIN_DIRECTION *pPinDir ); - HRESULT ( STDMETHODCALLTYPE *QueryId )( IPinC * This, /* [out] */ LPWSTR *Id ); - HRESULT ( STDMETHODCALLTYPE *QueryAccept )( IPinC * This, /* [in] */ const AM_MEDIA_TYPE *pmt ); - HRESULT ( STDMETHODCALLTYPE *EnumMediaTypes )( IPinC * This, /* [out] */ IEnumMediaTypes **ppEnum ); - HRESULT ( STDMETHODCALLTYPE *QueryInternalConnections )( IPinC * This, /* [out] */ IPinC **apPin, /* [out][in] */ ULONG *nPin ); - HRESULT ( STDMETHODCALLTYPE *EndOfStream )( IPinC * This ); - HRESULT ( STDMETHODCALLTYPE *BeginFlush )( IPinC * This ); - HRESULT ( STDMETHODCALLTYPE *EndFlush )( IPinC * This ); - HRESULT ( STDMETHODCALLTYPE *NewSegment )( IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate ); - END_INTERFACE -} IPinCVtbl; - -interface IPinC -{ - CONST_VTBL struct IPinCVtbl *lpVtbl; -}; - -interface IMemInputPinC; - -typedef struct IMemInputPinCVtbl -{ - BEGIN_INTERFACE - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IPinC * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject ); - ULONG ( STDMETHODCALLTYPE *AddRef )( IPinC * This ); - ULONG ( STDMETHODCALLTYPE *Release )( IPinC * This ); - HRESULT ( STDMETHODCALLTYPE *GetAllocator )( IMemInputPinC * This, IMemAllocator **ppAllocator); - HRESULT ( STDMETHODCALLTYPE *NotifyAllocator )( IMemInputPinC * This, IMemAllocator *pAllocator, BOOL bReadOnly); - HRESULT ( STDMETHODCALLTYPE *GetAllocatorRequirements )( IMemInputPinC * This, ALLOCATOR_PROPERTIES *pProps); - HRESULT ( STDMETHODCALLTYPE *Receive )( IMemInputPinC * This, IMediaSample *pSample); - HRESULT ( STDMETHODCALLTYPE *ReceiveMultiple )( IMemInputPinC * This, IMediaSample **pSamples, long nSamples, long *nSamplesProcessed); - HRESULT ( STDMETHODCALLTYPE *ReceiveCanBlock )( IMemInputPinC * This); - END_INTERFACE -} IMemInputPinCVtbl; - -interface IMemInputPinC -{ - CONST_VTBL struct IMemInputPinCVtbl *lpVtbl; -}; - -extern bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPin); -extern REFERENCE_TIME g_tSegmentStart, g_tSampleStart; - -// - -#include - -interface IAMVideoAcceleratorC; - -typedef struct IAMVideoAcceleratorCVtbl -{ - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAMVideoAcceleratorC * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAMVideoAcceleratorC * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAMVideoAcceleratorC * This); - - HRESULT ( STDMETHODCALLTYPE *GetVideoAcceleratorGUIDs )( - IAMVideoAcceleratorC * This, - /* [out][in] */ LPDWORD pdwNumGuidsSupported, - /* [out][in] */ LPGUID pGuidsSupported); - - HRESULT ( STDMETHODCALLTYPE *GetUncompFormatsSupported )( - IAMVideoAcceleratorC * This, - /* [in] */ const GUID *pGuid, - /* [out][in] */ LPDWORD pdwNumFormatsSupported, - /* [out][in] */ LPDDPIXELFORMAT pFormatsSupported); - - HRESULT ( STDMETHODCALLTYPE *GetInternalMemInfo )( - IAMVideoAcceleratorC * This, - /* [in] */ const GUID *pGuid, - /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo, - /* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo); - - HRESULT ( STDMETHODCALLTYPE *GetCompBufferInfo )( - IAMVideoAcceleratorC * This, - /* [in] */ const GUID *pGuid, - /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo, - /* [out][in] */ LPDWORD pdwNumTypesCompBuffers, - /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo); - - HRESULT ( STDMETHODCALLTYPE *GetInternalCompBufferInfo )( - IAMVideoAcceleratorC * This, - /* [out][in] */ LPDWORD pdwNumTypesCompBuffers, - /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo); - - HRESULT ( STDMETHODCALLTYPE *BeginFrame )( - IAMVideoAcceleratorC * This, - /* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo); - - HRESULT ( STDMETHODCALLTYPE *EndFrame )( - IAMVideoAcceleratorC * This, - /* [in] */ const AMVAEndFrameInfo *pEndFrameInfo); - - HRESULT ( STDMETHODCALLTYPE *GetBuffer )( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwTypeIndex, - /* [in] */ DWORD dwBufferIndex, - /* [in] */ BOOL bReadOnly, - /* [out] */ LPVOID *ppBuffer, - /* [out] */ LONG *lpStride); - - HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwTypeIndex, - /* [in] */ DWORD dwBufferIndex); - - HRESULT ( STDMETHODCALLTYPE *Execute )( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwFunction, - /* [in] */ LPVOID lpPrivateInputData, - /* [in] */ DWORD cbPrivateInputData, - /* [in] */ LPVOID lpPrivateOutputDat, - /* [in] */ DWORD cbPrivateOutputData, - /* [in] */ DWORD dwNumBuffers, - /* [in] */ const AMVABUFFERINFO *pamvaBufferInfo); - - HRESULT ( STDMETHODCALLTYPE *QueryRenderStatus )( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwTypeIndex, - /* [in] */ DWORD dwBufferIndex, - /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *DisplayFrame )( - IAMVideoAcceleratorC * This, - /* [in] */ DWORD dwFlipToIndex, - /* [in] */ IMediaSample *pMediaSample); - - END_INTERFACE -} IAMVideoAcceleratorCVtbl; - -interface IAMVideoAcceleratorC -{ - CONST_VTBL struct IAMVideoAcceleratorCVtbl *lpVtbl; -}; - -extern void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC); diff --git a/src/apps/mplayerc/IQTVideoSurface.h b/src/apps/mplayerc/IQTVideoSurface.h deleted file mode 100644 index 4b6adf6fe..000000000 --- a/src/apps/mplayerc/IQTVideoSurface.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -// -// IQTVideoSurface -// - -[uuid("A6AE36F7-A6F2-4157-AF54-6599857E4E20")] -interface IQTVideoSurface : public IUnknown -{ - STDMETHOD (BeginBlt) (const BITMAP& bm) PURE; - STDMETHOD (DoBlt) (const BITMAP& bm) PURE; -}; diff --git a/src/apps/mplayerc/ISDb.cpp b/src/apps/mplayerc/ISDb.cpp deleted file mode 100644 index df00ab9c6..000000000 --- a/src/apps/mplayerc/ISDb.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "stdafx.h" -#include "ISDb.h" -#include "mplayerc.h" - -bool hash(LPCTSTR fn, filehash& fh) -{ - CFile f; - CFileException fe; - if(!f.Open(fn, CFile::modeRead|CFile::osSequentialScan|CFile::shareDenyNone, &fe)) - return false; - - CPath p(fn); - p.StripPath(); - fh.name = (LPCTSTR)p; - - fh.size = f.GetLength(); - - fh.hash = fh.size; - for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++); - f.Seek(max(0, (INT64)fh.size - 65536), CFile::begin); - for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++); - - return true; -} - -void hash(CPlaylist& pl, CList& fhs) -{ - fhs.RemoveAll(); - - POSITION pos = pl.GetHeadPosition(); - while(pos) - { - CString fn = pl.GetNext(pos).m_fns.GetHead(); - if(AfxGetAppSettings().Formats.FindExt(CPath(fn).GetExtension().MakeLower(), true)) - continue; - - filehash fh; - if(!hash(fn, fh)) - continue; - - fhs.AddTail(fh); - } -} - -CStringA makeargs(CPlaylist& pl) -{ - CList fhs; - hash(pl, fhs); - - CAtlList args; - - POSITION pos = fhs.GetHeadPosition(); - for(int i = 0; pos; i++) - { - filehash& fh = fhs.GetNext(pos); - - CStringA str; - str.Format("name[%d]=%s&size[%d]=%016I64x&hash[%d]=%016I64x", - i, UrlEncode(CStringA(fh.name)), - i, fh.size, - i, fh.hash); - - args.AddTail(str); - } - - return Implode(args, '&'); -} - -bool OpenUrl(CInternetSession& is, CString url, CStringA& str) -{ - str.Empty(); - - try - { - CAutoPtr f(is.OpenURL(url, 1, INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_EXISTING_CONNECT)); - - char buff[1024]; - for(int len; (len = f->Read(buff, sizeof(buff))) > 0; str += CStringA(buff, len)); - - f->Close(); // must close it because the desctructor doesn't seem to do it and we will get an exception when "is" is destroying - } - catch(CInternetException* ie) - { - ie->Delete(); - return false; - } - - return true; -} diff --git a/src/apps/mplayerc/ISDb.h b/src/apps/mplayerc/ISDb.h deleted file mode 100644 index 97ee0bc9a..000000000 --- a/src/apps/mplayerc/ISDb.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include -#include "Playlist.h" - -#define ISDb_PROTOCOL_VERSION 1 - -struct isdb_subtitle -{ - int id, discs, disc_no; - CStringA name, format, language, iso639_2, nick, email; - struct isdb_subtitle() {reset();} - void reset() {id = discs = disc_no = 0; format = language = nick = email = "";} -}; - -struct isdb_movie -{ - CAtlList titles; - CAtlList subs; - void reset() {titles.RemoveAll(); subs.RemoveAll();} - void operator = (const struct isdb_movie& m) - { - titles.RemoveAll(); - titles.AddTailList(&m.titles); - subs.RemoveAll(); - subs.AddTailList(&m.subs); - } -}; - -struct filehash {CString name; UINT64 size, hash;}; - -extern bool hash(LPCTSTR fn, filehash& fh); -extern void hash(CPlaylist& pl, CList& fhs); -extern CStringA makeargs(CPlaylist& pl); -extern bool OpenUrl(CInternetSession& is, CString url, CStringA& str); - diff --git a/src/apps/mplayerc/KeyProvider.cpp b/src/apps/mplayerc/KeyProvider.cpp deleted file mode 100644 index 298f10fc8..000000000 --- a/src/apps/mplayerc/KeyProvider.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "keyprovider.h" -#include "..\..\DSUtil\DSUtil.h" -//#include "c:\WMSDK\WMFSDK9\include\wmsdk.h" - -CKeyProvider::CKeyProvider() - : CUnknown(NAME("CKeyProvider"), NULL) -{ -} - -STDMETHODIMP CKeyProvider::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - return - QI(IServiceProvider) - __super::NonDelegatingQueryInterface(riid, ppv); -} - -STDMETHODIMP CKeyProvider::QueryService(REFIID siid, REFIID riid, void **ppv) -{ - /* - if(siid == __uuidof(IWMReader) && riid == IID_IUnknown) - { - CComPtr punkCert; - HRESULT hr = WMCreateCertificate(&punkCert); - if(SUCCEEDED(hr)) - *ppv = (void*)punkCert.Detach(); - return hr; - } - */ - - return E_NOINTERFACE; -} diff --git a/src/apps/mplayerc/KeyProvider.h b/src/apps/mplayerc/KeyProvider.h deleted file mode 100644 index 51f68010f..000000000 --- a/src/apps/mplayerc/KeyProvider.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include - -// Declare and implement a key provider class derived from IServiceProvider. - -class CKeyProvider - : public CUnknown - , public IServiceProvider -{ -public: - CKeyProvider(); - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IServiceProvider - STDMETHODIMP QueryService(REFIID siid, REFIID riid, void **ppv); -}; diff --git a/src/apps/mplayerc/LineNumberEdit.cpp b/src/apps/mplayerc/LineNumberEdit.cpp deleted file mode 100644 index 563bd4a15..000000000 --- a/src/apps/mplayerc/LineNumberEdit.cpp +++ /dev/null @@ -1,971 +0,0 @@ -/* ========================================================================== - CLineNumberEdit - Author : Johan Rosengren, Abstrakt Mekanik AB - Date : 2004-03-09 - Purpose : CLineNumberEdit is a CEdit-derived class that displays - line numbers to the left of the text. - Description : The class uses the edit rect to make space for the line - numbers. The line numbers are relized through a special - CStatic-derived class, CLineNumberStatic. As soon as the - text is updated, the CLineNumberStatic is updated as - well. - Usage : The control can be dynamically created, or created from - a dialog template. The formatting string for the line - numbers can be set by calling SetLineNumberFormat (the - same format string as for CString::Format). By calling - SetMarginForegroundColor or SetMarginBackgroundColor - the fore- and background colors for the line number - display is set. - ======================================================================== - Update : Keith Bowes - Date : 2004-04-13 - Purpose : 1. To allow CLineNumberEdit to properly change colour when - Enabled/Disabled or when system colours change. - Changing system colours only has a noticable effect when - a scheme such as Marine or Plum is chosen. - 2. To allow a line number delta to be applied to the first - line number so the index does not have to start at zero. - 3. To allow a max value to be specified to stop the line - count and to allow smarter size formatting. - Description : 1. Added OnEnable and OnSysColorChange to detect when - a colour change is required. This allows the line number - area and CEdit area to update colours properly. - Added colour ref variables to hold enabled/disabled states - of the background/foreground colours. - In an attempt to allow previous functionality to take - precedence, if the colours are changed explicitly, the - system colours are no longer queried. - 2. Added m_LineDelta, applied when line numbers are formatted. - 3. Using m_maxval when > 0 to limit the max values and when - formatting colomn width. - JRO: Added m_lineDelta as well. - Usage : 1. Default behaviour is to change colours to reflect CEdit. - manually changing the colour will cause the colours to - only change to the specified colours. - 2. SetLineNumberRange sets both min and max values. - 3. SetLineNumberRange sets both min and max values. - - Comments : - Perhaps line values should be stored as UINT's as negative - values may have unexpected results. - - CLineNumberEdit::m_format creates a duplicate of - CLineNumberStatic::m_format, is this needed? - JRO: Even though the the two classes are thightly coupled, - this duplication of data makes it easier to decouple them. - A small matter, but code reuse is Politically Correct, - and as such A Desirable Feature. - - Added options could allow different system colours to be - chosen and updated as system attributes are changed. - - if m_maxval is exceeded in the edit box, new lines - are added without line numbers. This might not be the - desired behaviour. - JRO: I think this is rather nifty, actually. If I, as a - developer, sets the max number of lines to be numbered, - I also expect this to be the case :-))) - - It's not spelled wrong, just differently. ;0) - ======================================================================== - Update : Johan Rosengren - Date : 2004-04-14 - Purpose : 1. Allow deriving of CLineNumberEdit. - Description : 1. Made the message handlers virtual. - Usage : 1. Declare message handlers as virtual in derived - classes. Note that CLineNumberEdit is not built to - be derived from, however. - ======================================================================== - Update : Keith Bowes - Date : 2004-04-22 - Purpose : To allow processing of WM_LINESCROLL messages. - Description : Added OnLineScroll to handle the message. - Usage : Now will call UpdateTopAndBottom if the message is - received. - ======================================================================== - Update : Johan Rosengren - Date : 2004-05-02 - Purpose : Select complete line when a line-number is clicked - Description : Added registered user message, sent when the line- - number static is clicked. - Usage : See urm_SELECTLINE in the code. - ========================================================================*/ - -#include "stdafx.h" -#include "LineNumberEdit.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -// Registered message to allow selection of complete -// lines by clicking the line number -UINT urm_SELECTLINE = ::RegisterWindowMessage( _T("_LINE_NUMBER_EDIT_SELECTLINE_") ); - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberEdit -CLineNumberEdit::CLineNumberEdit() -/* ============================================================ - Function : CLineNumberEdit::CLineNumberEdit - Description : constructor - - Return : void - Parameters : none - - Usage : - - ============================================================*/ -{ - - m_hWnd = NULL; - m_line.m_hWnd = NULL; - m_zero.cx = 0; - m_zero.cy = 0; - m_format = _T( "%03i" ); - m_LineDelta = 1; - - // Could default m_maxval to 99,999, but may cause problems - // if m_format is changed and m_maxval is not... - m_maxval = 998; - - // Setting up so by defult the original hard-coded colour - // scheme is used when enabled and the system colours are - // used when disabled. - m_bUseEnabledSystemColours = FALSE; - m_bUseDisabledSystemColours = TRUE; - m_EnabledFgCol = RGB( 0, 0, 0 ); - m_EnabledBgCol = RGB( 200, 200, 200 ); - m_DisabledFgCol = GetSysColor( COLOR_GRAYTEXT ); - m_DisabledBgCol = GetSysColor( COLOR_3DFACE ); - - SetWindowColour(); - -} - -CLineNumberEdit::~CLineNumberEdit() -/* ============================================================ - Function : CLineNumberEdit::~CLineNumberEdit - Description : destructor - - Return : void - Parameters : none - - Usage : - - ============================================================*/ -{ -} - -BEGIN_MESSAGE_MAP(CLineNumberEdit, CEdit) - ON_CONTROL_REFLECT(EN_CHANGE, OnChange) - ON_WM_VSCROLL() - ON_CONTROL_REFLECT(EN_VSCROLL, OnVscroll) - ON_MESSAGE(WM_SETFONT, OnSetFont) - ON_WM_SIZE() - ON_MESSAGE(WM_SETTEXT, OnSetText) - ON_WM_SYSCOLORCHANGE() - ON_WM_ENABLE() - ON_MESSAGE(EM_LINESCROLL, OnLineScroll) - ON_REGISTERED_MESSAGE(urm_SELECTLINE, OnSelectLine) -END_MESSAGE_MAP() - -void CLineNumberEdit::PreSubclassWindow() -/* ============================================================ - Function : CLineNumberEdit::PreSubclassWindow - Description : This function is called before the control - is subclassed for a control on a dialog - template, and during creation for - dynamically created controls. - - Return : void - Parameters : none - - Usage : Called from MFC - - ============================================================*/ -{ - - // Unfortunately, we can't change to ES_MULTILINE - // during run-time. - ASSERT( GetStyle() & ES_MULTILINE ); - - // Creating the line number control - SetLineNumberFormat( m_format ); - -} - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberEdit message handlers - -void CLineNumberEdit::OnSysColorChange() -/* ============================================================ - Function : CLineNumberEdit::OnSysColorChange - Description : Handles WM_SYSCOLORCHANGE. User has changed - the system colours, want to refresh. - - Return : void - Parameters : void - - Usage : Called from Windows - - ============================================================*/ -{ - - CEdit::OnSysColorChange(); - - // update the CStatic with the new colours - SetWindowColour( IsWindowEnabled() ); - -} - -LRESULT CLineNumberEdit::OnSetText( WPARAM wParam, LPARAM lParam ) -/* ============================================================ - Function : CLineNumberEdit::OnSetText - Description : Handles WM_SETTEXT. We must update the line - numbers in the line number control as well. - - Return : LRESULT - From Def proc - Parameters : WPARAM wParam - From Windows - LPARAM lParam - From Windows - - Usage : Called from Windows - - ============================================================*/ -{ - - // Default processing - LRESULT retval = DefWindowProc( WM_SETTEXT, wParam, lParam ); - UpdateTopAndBottom(); - return retval; - -} - -void CLineNumberEdit::OnChange() -/* ============================================================ - Function : CLineNumberEdit::OnChange - Description : Mapped to EN_CHANGE. We must handle - EN_CHANGE to let the line-number control - reflect changes to the edit box content. - - Return : void - Parameters : none - - Usage : Called from Windows - - ============================================================*/ -{ - - UpdateTopAndBottom(); - -} - -void CLineNumberEdit::OnVscroll() -/* ============================================================ - Function : CLineNumberEdit::OnVscroll - Description : Mapped to EN_VSCROLL. We update the line - numbers in the line number control - - Return : void - Parameters : none - - Usage : Called from Windows - - ============================================================*/ -{ - - UpdateTopAndBottom(); - -} - -void CLineNumberEdit::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) -/* ============================================================ - Function : CLineNumberEdit::OnVScroll - Description : Handles WM_VSCROLL. We handle WM_VSCROLL - in addition to the notification EN_VSCROLL, - to handle scrollbar dragging as well - - Return : void - Parameters : UINT nSBCode - From Windows - UINT nPos - From Windows - CScrollBar* pScrollBar - From Windows - - Usage : Called from Windows - - ============================================================*/ -{ - - CEdit::OnVScroll( nSBCode, nPos, pScrollBar ); - UpdateTopAndBottom(); - -} - -LRESULT CLineNumberEdit::OnLineScroll( WPARAM wParam, LPARAM lParam ) -/* ============================================================ - Function : CLineNumberEdit::OnLineScroll - Description : Mapped to EM_LINESCROLL. We update the line - numbers in the line number control. - - Return : void - Parameters : none - Usage : Called from Windows - ============================================================*/ -{ - - // Default processing - LRESULT retval = DefWindowProc( EM_LINESCROLL, wParam, lParam ); - UpdateTopAndBottom(); - return retval; - -} - -LRESULT CLineNumberEdit::OnSetFont( WPARAM wParam, LPARAM lParam ) -/* ============================================================ - Function : CLineNumberEdit::OnSetFont - Description : Mapped to WM_SETFONT. We must recalculate - the line number control size as well. - - Return : LRESULT - Always 0 - Parameters : WPARAM wParam - From Windows - LPARAM lParam - From Windows - - Usage : Called from Windows - - ============================================================*/ -{ - - DefWindowProc( WM_SETFONT, wParam, lParam ); - // We resize the line-number - // field - Prepare(); - return 0; - -} - -void CLineNumberEdit::OnSize( UINT nType, int cx, int cy ) -/* ============================================================ - Function : CLineNumberEdit::OnSize - Description : Handles WM_SIZE. Recalculates the line - number control size as well. - - Return : void - Parameters : UINT nType - From Windows - int cx - From Windows - int cy - From Windows - - Usage : Called from Windows - - ============================================================*/ -{ - - CEdit::OnSize( nType, cx, cy ); - - // If we have the line-number - // control, it must be resized - // as well. - if( m_line.m_hWnd ) - Prepare(); - -} - -void CLineNumberEdit::OnEnable( BOOL bEnable ) -/* ============================================================ - Function : CLineNumberEdit::OnEnable - Description : Handles WM_ENABLE. Calls to set colours. - - Return : void - Parameters : BOOL bEnable - From Windows - - Usage : Called from Windows. - - ============================================================*/ -{ - - CEdit::OnEnable( bEnable ); - SetWindowColour( bEnable ); - -} - -LRESULT CLineNumberEdit::OnSelectLine(WPARAM wParam, LPARAM /*lParam*/ ) -/* ============================================================ - Function : CLineNumberEdit::OnSelectLine - Description : Handler for the urm_SELECTLINE registered - message. Will select the line in wParam. - - Return : LRESULT - Not used - Parameters : WPARAM wParam - The line to select - LPARAM lParam - Not used - - Usage : Called from MFC. Use - SendMessage( urm_SELECTLINE, line ) from - code. - - ============================================================*/ -{ - - // Calc start and end position of the line - int lineno = wParam + GetScrollPos( SB_VERT ); - int start = LineIndex( lineno ); - int end = LineIndex( lineno + 1 ); - SetSel( start, end - 1 ); - return 0; - -} - -void CLineNumberEdit::SetWindowColour( BOOL bEnable /*= TRUE*/ ) -/* ============================================================ - Function : CLineNumberEdit::SetWindowColour - Description : Handles changing window colours. - - Return : void - Parameters : BOOL bEnable - flag if set enabled/disabled - colours - - Usage : Called to change colours in the edit box. - - ============================================================*/ -{ - - if (m_bUseEnabledSystemColours) - { - // re-query the system colours in case they have changed. - m_EnabledFgCol = GetSysColor( COLOR_WINDOWTEXT ); - m_EnabledBgCol = GetSysColor( COLOR_WINDOW ); - } - - if (m_bUseDisabledSystemColours) - { - // re-query the system colours in case they have changed. - m_DisabledFgCol = GetSysColor( COLOR_GRAYTEXT ); - m_DisabledBgCol = GetSysColor( COLOR_3DFACE ); - } - - // change the colour based on bEnable - if (bEnable) - { - m_line.SetFgColor( m_EnabledFgCol, TRUE ); - m_line.SetBgColor( m_EnabledBgCol, TRUE ); - } else { - m_line.SetFgColor( m_DisabledFgCol, TRUE ); - m_line.SetBgColor( m_DisabledBgCol, TRUE ); - } - -} - -void CLineNumberEdit::UseSystemColours( BOOL bUseEnabled /*= TRUE*/, BOOL bUseDisabled /*= TRUE*/ ) -/* ============================================================ - Function : CLineNumberEdit::UseSystemColours - Description : Sets the Use*SystemColours flags. - - Return : void - Parameters : BOOL bEnabled - flag if to use enabled - system colours - BOOL bDisabled - flag if to use disabled - system colours - - Usage : Called to change colours in the edit box - - ============================================================*/ -{ - - m_bUseEnabledSystemColours = bUseEnabled; - m_bUseDisabledSystemColours = bUseDisabled; - BOOL bEnable = TRUE; - if (::IsWindow(m_hWnd)) - bEnable = IsWindowEnabled(); - - SetWindowColour( bEnable ); - -} - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberEdit private implementation - -void CLineNumberEdit::Prepare() -/* ============================================================ - Function : CLineNumberEdit::Prepare - Description : Setting the edit rect for the control and - either create or move the line number - control. Also sets the top- and bottom - line numbers. - - Return : void - Parameters : none - - Usage : Must be called to (re)establish the edit - rect, must also be called as soon as the - control changes size. - - ============================================================*/ -{ - - // Calc sizes - int width = CalcLineNumberWidth(); - CRect rect; - GetClientRect( &rect ); - CRect rectEdit( rect ); - rect.right = width; - rectEdit.left = rect.right + 3; - - // Setting the edit rect and - // creating or moving child control - SetRect( &rectEdit ); - if( m_line.m_hWnd ) - m_line.MoveWindow( 0, 0, width, rect.Height() ); - else - m_line.Create(NULL,WS_CHILD | WS_VISIBLE | SS_NOTIFY, rect, this, 1 ); - - GetRect( &rectEdit ); - - // Update line number control data - m_line.SetTopMargin( rectEdit.top ); - UpdateTopAndBottom(); - -} - -int CLineNumberEdit::CalcLineNumberWidth() -/* ============================================================ - Function : CLineNumberEdit::CalcLineNumberWidth - Description : Calculates the desired width of the line - number control, using the current format - string and the max number of chars allowed - (pessimistic - assumes one character per - line). - - Return : int - The width in pixels - Parameters : none - - Usage : Called as soon as the format string is - changed. - - ============================================================*/ -{ - - CClientDC dc( this ); - - // If a new font is set during runtime, - // we must explicitly select the font into - // the CClientDC to measure it. - CFont* font = GetFont(); - CFont* oldFont = dc.SelectObject( font ); - - m_zero=dc.GetTextExtent( _T( "0" ) ); - CString format; - - // GetLimitText returns the number of bytes the edit box may contain, - // not the max number of lines... - //... which is the max number of lines, given one character per d:o :-) - int maxval = GetLimitText(); - if (m_maxval > 0) - maxval = m_maxval + m_LineDelta; - - format.Format( m_format, maxval ); - CSize fmt = dc.GetTextExtent( format ); - dc.SelectObject( oldFont ); - - // Calculate the size of the line- - // number field. We add a 5 pixel margin - // to the max size of the format string - return fmt.cx + 5; - -} - -void CLineNumberEdit::UpdateTopAndBottom() -/* ============================================================ - Function : CLineNumberEdit::UpdateTopAndBottom - Description : Updates the top- and bottom line number - for the line number control. - - Return : void - Parameters : none - Usage : Should be called as soon as the contents of - the control is changed. - - ============================================================*/ -{ - - CRect rect; - GetClientRect( &rect ); - int maxline = GetLineCount() + m_LineDelta; - - // Height for individual lines - int lineheight = m_zero.cy; - - // Calculate the number of lines to draw - int topline = GetFirstVisibleLine() + m_LineDelta; - if( ( topline + ( rect.Height() / lineheight ) ) < maxline ) - maxline = topline + ( rect.Height() / lineheight ); - - if ( m_maxval > 0 && maxline > m_maxval + m_LineDelta ) - maxline = m_maxval + m_LineDelta; - - m_line.SetTopAndBottom( topline, maxline ); - -} - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberEdit public implementation - -void CLineNumberEdit::SetMarginForegroundColor( COLORREF col, BOOL redraw, BOOL bEnabled /*= TRUE*/ ) -/* ============================================================ - Function : CLineNumberEdit::SetMarginForegroundColor - Description : Sets the text color for the number - margin. - - Return : void - Parameters : COLORREF col - The new text color - BOOL redraw - TRUE if the control - should be redrawn - (default) - - Usage : Call to set a new text color for the line - number margin. The control will be redrawn - if it exists. - - ============================================================*/ -{ - - m_line.SetFgColor( col, redraw ); - if (bEnabled) - { - m_bUseEnabledSystemColours = FALSE; - m_EnabledFgCol = col; - } else { - m_bUseDisabledSystemColours = FALSE; - m_DisabledFgCol = col; - } - -} - -void CLineNumberEdit::SetMarginBackgroundColor( COLORREF col, BOOL redraw, BOOL bEnabled /*= TRUE*/ ) -/* ============================================================ - Function : CLineNumberEdit::SetMarginBackgroundColor - Description : Sets the background color for the number - margin. - - Return : void - Parameters : COLORREF col - The new background color - BOOL redraw - TRUE if the control - should be redrawn - (default) - - Usage : Call to set a new background color for the - line number margin. The control will be - redrawn if it exists. - - ============================================================*/ -{ - - m_line.SetBgColor( col, redraw ); - if (bEnabled) - { - m_bUseEnabledSystemColours = FALSE; - m_EnabledBgCol = col; - } else { - m_bUseDisabledSystemColours = FALSE; - m_DisabledBgCol = col; - } - -} - -void CLineNumberEdit::SetLineNumberFormat( CString format ) -/* ============================================================ - Function : CLineNumberEdit::SetLineNumberFormat - Description : Changes the way line numbers are presented - on screen. - - Return : void - Parameters : CString format - The new format string - - Usage : Call with a format string using the same - format as CString::Format. It should contain - one and only one numeric type. - - ============================================================*/ -{ - - m_format = format; - m_line.SetLineNumberFormat( format ); - if( m_hWnd ) - Prepare(); - -} - -void CLineNumberEdit::SetLineNumberRange( UINT nMin, UINT nMax /*= 0*/ ) -/* ============================================================ - Function : CLineNumberEdit::SetLineNumberRange - Description : Changes the default min and max line numbers. - - Return : void - Parameters : int nMin - changes the line offset - int nMax - changes the max line number - - Usage : Call to set up the min and max line numbers. - - ============================================================*/ -{ - - m_LineDelta = ( int ) nMin; - m_maxval = ( int ) nMax; - -} - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberStatic - -CLineNumberStatic::CLineNumberStatic() -/* ============================================================ - Function : CLineNumberStatic::CLineNumberStatic - Description : constructor - - Return : void - Parameters : none - - Usage : - - ============================================================*/ -{ - - m_bgcol = RGB( 255, 255, 248 ); - m_fgcol = RGB( 0, 0, 0 ); - m_format = _T( "%05i" ); - m_topline = 0; - m_bottomline = 0; -} - -CLineNumberStatic::~CLineNumberStatic() -/* ============================================================ - Function : CLineNumberStatic::~CLineNumberStatic - Description : destructor - - Return : void - Parameters : none - - Usage : - - ============================================================*/ -{ -} - -BEGIN_MESSAGE_MAP(CLineNumberStatic, CStatic) - ON_WM_PAINT() - ON_WM_ERASEBKGND() - ON_WM_LBUTTONDOWN() -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberStatic message handlers - -void CLineNumberStatic::OnPaint() -/* ============================================================ - Function : CLineNumberStatic::OnPaint - Description : Handler for WM_PAINT. - - Return : void - Parameters : none - - Usage : Called from Windows. - - ============================================================*/ -{ - - CPaintDC dcPaint( this ); - - CRect rect; - GetClientRect( &rect ); - - // We double buffer the drawing - - // preparing the memory CDC - CDC dc; - dc.CreateCompatibleDC( &dcPaint ); - int saved = dc.SaveDC(); - - // Create GDI and select objects - CBitmap bmp; - CPen pen; - bmp.CreateCompatibleBitmap( &dcPaint, rect.Width(), rect.Height() ); - pen.CreatePen( PS_SOLID, 1, m_fgcol ); - dc.SelectObject( &bmp ); - dc.SelectObject( &pen ); - - // Painting the background - dc.FillSolidRect( &rect, m_bgcol ); - dc.MoveTo( rect.right - 1, 0 ); - dc.LineTo( rect.right - 1, rect.bottom ); - - // Setting other attributes - dc.SetTextColor( m_fgcol ); - dc.SetBkColor( m_bgcol ); - dc.SelectObject( GetParent()->GetFont() ); - - // Output the line numbers - if( m_bottomline ) - { - int lineheight = dc.GetTextExtent( _T( "0" ) ).cy; - for( int t = m_topline ; t < m_bottomline ; t++ ) - { - CString output; - output.Format( m_format, t ); - int topposition = m_topmargin + lineheight * ( t - m_topline ); - dc.TextOut( 2, topposition, output ); - } - } - - dcPaint.BitBlt( 0, 0, rect. right, rect.bottom, &dc, 0, 0, SRCCOPY ); - dc.RestoreDC( saved ); - -} - -BOOL CLineNumberStatic::OnEraseBkgnd( CDC* ) -/* ============================================================ - Function : CLineNumberStatic::OnEraseBkgnd - Description : Mapped to WM_ERASEBKGND. Handled to avoid - flicker, as we redraw the complete control - in OnPaint - - Return : BOOL - Always TRUE - Parameters : CDC* - From Windows - - Usage : Called from Windows. - - ============================================================*/ -{ - - return TRUE; - -} - -void CLineNumberStatic::OnLButtonDown( UINT nFlags, CPoint point ) -/* ============================================================ - Function : CLineNumberStatic::OnLButtonDown - Description : Called when the control is clicked. Will - send the urm_SELECTLINE registered message - to the parent to select the line clicked on. - - Return : void - Parameters : UINT nFlags - Not used - CPoint point - Position of cursor - - Usage : Called from Windows. - - ============================================================*/ -{ - - // Find the line clicked on - CClientDC dc( this ); - dc.SelectObject( GetParent()->GetFont() ); - int lineheight = dc.GetTextExtent( _T( "0" ) ).cy; - int lineno = ( int ) ( ( double ) point.y / ( double ) lineheight ); - - // Select this line in the edit control - GetParent()->SendMessage( urm_SELECTLINE, lineno ); - - CStatic::OnLButtonDown( nFlags, point ); - -} - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberStatic public implementation - -void CLineNumberStatic::SetBgColor( COLORREF col, BOOL redraw ) -/* ============================================================ - Function : CLineNumberStatic::SetBgColor - Description : This function sets the panel background - color - - Return : void - Parameters : COLORREF col - New background color - BOOL redraw - TRUE if the control - should be redrawn - (default) - - Usage : Called from the parent. - - ============================================================*/ -{ - - m_bgcol = col; - if( m_hWnd && redraw ) - RedrawWindow(); - -} - -void CLineNumberStatic::SetFgColor( COLORREF col, BOOL redraw ) -/* ============================================================ - Function : CLineNumberStatic::SetFgColor - Description : This function sets the panel foreground - color - - Return : void - Parameters : COLORREF col - New text color - BOOL redraw - TRUE if the control - should be redrawn - (default) - - Usage : Called from the parent. - - ============================================================*/ -{ - - m_fgcol = col; - if( m_hWnd && redraw ) - RedrawWindow(); - -} - -void CLineNumberStatic::SetTopAndBottom( int topline, int bottomline ) -/* ============================================================ - Function : CLineNumberStatic::SetTopAndBottom - Description : Sets the top- and bottom line and redraw - the control (if it exists) - - Return : void - Parameters : int topline - The top line number - int bottomline - The bottom line number - - Usage : Called when the top and bottom line is - changed in the parent. - - ============================================================*/ -{ - - m_topline = topline; - m_bottomline = bottomline; - if( m_hWnd ) - RedrawWindow(); - -} - -void CLineNumberStatic::SetTopMargin( int topmargin ) -/* ============================================================ - Function : CLineNumberStatic::SetTopMargin - Description : Sets the top margin for painting. - - Return : void - Parameters : int topmargin - The top margin to set - - Usage : Will be called with the value of GetRect - from the parent. - - ============================================================*/ -{ - - m_topmargin = topmargin; - -} - -void CLineNumberStatic::SetLineNumberFormat( CString format ) -/* ============================================================ - Function : CLineNumberStatic::SetLineNumberFormat - Description : Sets the format string of the control - - Return : void - Parameters : CString format - Format string to use - - Usage : Called from the parent when the format - string is changed. - - ============================================================*/ -{ - - m_format = format; - if( m_hWnd ) - RedrawWindow(); - -} diff --git a/src/apps/mplayerc/LineNumberEdit.h b/src/apps/mplayerc/LineNumberEdit.h deleted file mode 100644 index 4794ead44..000000000 --- a/src/apps/mplayerc/LineNumberEdit.h +++ /dev/null @@ -1,99 +0,0 @@ -#if !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_) -#define AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_ - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberStatic window - -class CLineNumberStatic : public CStatic -{ -// Construction/destruction -public: - CLineNumberStatic(); - virtual ~CLineNumberStatic(); - -// Operations -public: - void SetFgColor( COLORREF col, BOOL redraw ); - void SetBgColor( COLORREF col, BOOL redraw ); - void SetTopAndBottom( int topline, int bottomline ); - void SetTopMargin( int topmargin ); - void SetLineNumberFormat( CString format ); - -protected: - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - afx_msg void OnPaint(); - afx_msg void OnLButtonDown( UINT nFlags, CPoint point ); - DECLARE_MESSAGE_MAP() - -private: -// Attributes - COLORREF m_fgcol; - COLORREF m_bgcol; - CString m_format; - - int m_topmargin; // Current top margin - int m_topline; // Current top line number - int m_bottomline; // Current bottom line number -}; - - -///////////////////////////////////////////////////////////////////////////// -// CLineNumberEdit window - -class CLineNumberEdit : public CEdit -{ -// Construction/destruction -public: - CLineNumberEdit(); - virtual ~CLineNumberEdit(); - -// Operations -public: - void SetMarginForegroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE ); - void SetMarginBackgroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE ); - void SetLineNumberFormat( CString format ); - void SetLineNumberRange( UINT nMin, UINT nMax = 0 ); - void UseSystemColours( BOOL bUseEnabled = TRUE, BOOL bUseDisabled = TRUE ); - - int GetLineHeight() {return m_zero.cy;} - -protected: - virtual void PreSubclassWindow(); - - virtual afx_msg void OnEnable( BOOL bEnable ); - virtual afx_msg void OnSysColorChange(); - virtual afx_msg void OnChange(); - virtual afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - virtual afx_msg void OnVscroll(); - virtual afx_msg void OnSize(UINT nType, int cx, int cy); - virtual afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam); // Maps to WM_SETFONT - virtual afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); // Maps to WM_SETTEXT - virtual afx_msg LRESULT OnLineScroll(WPARAM wParam, LPARAM lParam); // Maps to EM_LINESCROLL - virtual afx_msg LRESULT OnSelectLine(WPARAM wParam, LPARAM lParam); - DECLARE_MESSAGE_MAP() - -private: - void Prepare(); - int CalcLineNumberWidth(); - void UpdateTopAndBottom(); - - // Method to set window colour only - void SetWindowColour( BOOL bEnable = TRUE ); - -// Attributes - BOOL m_bUseEnabledSystemColours; - COLORREF m_EnabledFgCol; - COLORREF m_EnabledBgCol; - BOOL m_bUseDisabledSystemColours; - COLORREF m_DisabledFgCol; - COLORREF m_DisabledBgCol; - - CLineNumberStatic m_line; - CSize m_zero; - int m_maxval; - CString m_format; - int m_LineDelta; // Introduced to provide an offset to the first line number - -}; - -#endif // !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_) diff --git a/src/apps/mplayerc/MacrovisionKicker.cpp b/src/apps/mplayerc/MacrovisionKicker.cpp deleted file mode 100644 index 2f3e423cb..000000000 --- a/src/apps/mplayerc/MacrovisionKicker.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "MacrovisionKicker.h" - -// -// CMacrovisionKicker -// - -CMacrovisionKicker::CMacrovisionKicker(const TCHAR* pName, LPUNKNOWN pUnk) - : CUnknown(pName, pUnk) -{ -} - -CMacrovisionKicker::~CMacrovisionKicker() -{ -} - -void CMacrovisionKicker::SetInner(CComPtr pUnk) -{ - m_pInner = pUnk; -} - -STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** ppv) -{ - if(riid == __uuidof(IUnknown)) - return __super::NonDelegatingQueryInterface(riid, ppv); - if(riid == __uuidof(IKsPropertySet) && CComQIPtr(m_pInner)) - return GetInterface((IKsPropertySet*)this, ppv); - - HRESULT hr = m_pInner ? m_pInner->QueryInterface(riid, ppv) : E_NOINTERFACE; - - return SUCCEEDED(hr) ? hr : __super::NonDelegatingQueryInterface(riid, ppv); -} - -// IKsPropertySet - -STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength) -{ - if(CComQIPtr pKsPS = m_pInner) - { - if(PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION - /*&& DataLength == 4 && *(DWORD*)pPropertyData*/) - { - TRACE(_T("Oops, no-no-no, no macrovision please\n")); - return S_OK; - } - - return pKsPS->Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength); - } - - return E_UNEXPECTED; -} - -STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned) -{ - if(CComQIPtr pKsPS = m_pInner) - { - return pKsPS->Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned); - } - - return E_UNEXPECTED; -} - -STDMETHODIMP CMacrovisionKicker::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport) -{ - if(CComQIPtr pKsPS = m_pInner) - { - return pKsPS->QuerySupported(PropSet, Id, pTypeSupport); - } - - return E_UNEXPECTED; -} diff --git a/src/apps/mplayerc/MacrovisionKicker.h b/src/apps/mplayerc/MacrovisionKicker.h deleted file mode 100644 index 72b465cf3..000000000 --- a/src/apps/mplayerc/MacrovisionKicker.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -class CMacrovisionKicker - : public CUnknown - , public IKsPropertySet -{ - CComPtr m_pInner; - -public: - CMacrovisionKicker(const TCHAR* pName, LPUNKNOWN pUnk); - virtual ~CMacrovisionKicker(); - - void SetInner(CComPtr pUnk); - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv); - - // IKsPropertySet - STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength); - STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned); - STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport); -}; - diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp deleted file mode 100644 index 1b3c28377..000000000 --- a/src/apps/mplayerc/MainFrm.cpp +++ /dev/null @@ -1,10066 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "mplayerc.h" - -#include "MainFrm.h" - -#include - -#include - -#include -#include -#include - -#include "OpenFileDlg.h" -#include "OpenDlg.h" -#include "SaveDlg.h" -#include "GoToDlg.h" -#include "PnSPresetsDlg.h" -#include "MediaTypesDlg.h" -#include "SaveTextFileDialog.h" -#include "SaveThumbnailsDialog.h" -#include "FavoriteAddDlg.h" -#include "FavoriteOrganizeDlg.h" -#include "ConvertDlg.h" -#include "ShaderCombineDlg.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include "..\..\..\include\moreuuids.h" -#include -//#include - -#include "..\..\DSUtil\DSUtil.h" -#include "FGManager.h" - -#include "textpassthrufilter.h" -#include "..\..\filters\filters.h" -#include "..\..\filters\PinInfoWnd.h" - -#include "DX7AllocatorPresenter.h" -#include "DX9AllocatorPresenter.h" - -#include "..\..\subtitles\SSF.h" - -#define DEFCLIENTW 292 -#define DEFCLIENTH 200 - -static UINT s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); -static UINT WM_NOTIFYICON = RegisterWindowMessage(TEXT("MYWM_NOTIFYICON")); - -#include "..\..\filters\transform\vsfilter\IDirectVobSub.h" - -class CSubClock : public CUnknown, public ISubClock -{ - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) - { - return - QI(ISubClock) - CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - - REFERENCE_TIME m_rt; - -public: - CSubClock() : CUnknown(NAME("CSubClock"), NULL) {m_rt = 0;} - - DECLARE_IUNKNOWN; - - // ISubClock - STDMETHODIMP SetTime(REFERENCE_TIME rt) {m_rt = rt; return S_OK;} - STDMETHODIMP_(REFERENCE_TIME) GetTime() {return(m_rt);} -}; - -// - -#define SaveMediaState \ - OAFilterState __fs = GetMediaState(); \ - \ - REFERENCE_TIME __rt = 0; \ - if(m_iMediaLoadState == MLS_LOADED) __rt = GetPos(); \ - \ - if(__fs != State_Stopped) \ - SendMessage(WM_COMMAND, ID_PLAY_STOP); \ - - -#define RestoreMediaState \ - if(m_iMediaLoadState == MLS_LOADED) \ - { \ - SeekTo(__rt); \ - \ - if(__fs == State_Stopped) \ - SendMessage(WM_COMMAND, ID_PLAY_STOP); \ - else if(__fs == State_Paused) \ - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); \ - else if(__fs == State_Running) \ - SendMessage(WM_COMMAND, ID_PLAY_PLAY); \ - } \ - -/* -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif -*/ -///////////////////////////////////////////////////////////////////////////// -// CMainFrame - -IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) - ON_WM_CREATE() - ON_WM_DESTROY() - ON_WM_CLOSE() - - ON_REGISTERED_MESSAGE(s_uTaskbarRestart, OnTaskBarRestart) - ON_REGISTERED_MESSAGE(WM_NOTIFYICON, OnNotifyIcon) - - ON_WM_SETFOCUS() - ON_WM_GETMINMAXINFO() - ON_WM_MOVE() - ON_WM_MOVING() - ON_WM_SIZE() - ON_WM_SIZING() - ON_MESSAGE_VOID(WM_DISPLAYCHANGE, OnDisplayChange) - - ON_WM_SYSCOMMAND() - ON_WM_ACTIVATEAPP() - ON_MESSAGE(WM_APPCOMMAND, OnAppCommand) - - ON_WM_TIMER() - - ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify) - ON_MESSAGE(WM_REARRANGERENDERLESS, OnRepaintRenderLess) - ON_MESSAGE(WM_RESUMEFROMSTATE, OnResumeFromState) - - ON_WM_LBUTTONDOWN() - ON_WM_LBUTTONUP() - ON_WM_LBUTTONDBLCLK() - ON_WM_MBUTTONDOWN() - ON_WM_MBUTTONUP() - ON_WM_MBUTTONDBLCLK() - ON_WM_RBUTTONDOWN() - ON_WM_RBUTTONUP() - ON_WM_RBUTTONDBLCLK() - ON_MESSAGE(WM_XBUTTONDOWN, OnXButtonDown) - ON_MESSAGE(WM_XBUTTONUP, OnXButtonUp) - ON_MESSAGE(WM_XBUTTONDBLCLK, OnXButtonDblClk) - ON_WM_MOUSEWHEEL() - ON_WM_MOUSEMOVE() - - ON_WM_NCHITTEST() - - ON_WM_HSCROLL() - - ON_WM_INITMENU() - ON_WM_INITMENUPOPUP() - - ON_COMMAND(ID_MENU_PLAYER_SHORT, OnMenuPlayerShort) - ON_COMMAND(ID_MENU_PLAYER_LONG, OnMenuPlayerLong) - ON_COMMAND(ID_MENU_FILTERS, OnMenuFilters) - - ON_UPDATE_COMMAND_UI(IDC_PLAYERSTATUS, OnUpdatePlayerStatus) - - ON_COMMAND(ID_FILE_POST_OPENMEDIA, OnFilePostOpenmedia) - ON_UPDATE_COMMAND_UI(ID_FILE_POST_OPENMEDIA, OnUpdateFilePostOpenmedia) - ON_COMMAND(ID_FILE_POST_CLOSEMEDIA, OnFilePostClosemedia) - ON_UPDATE_COMMAND_UI(ID_FILE_POST_CLOSEMEDIA, OnUpdateFilePostClosemedia) - - ON_COMMAND(ID_BOSS, OnBossKey) - - ON_COMMAND_RANGE(ID_STREAM_AUDIO_NEXT, ID_STREAM_AUDIO_PREV, OnStreamAudio) - ON_COMMAND_RANGE(ID_STREAM_SUB_NEXT, ID_STREAM_SUB_PREV, OnStreamSub) - ON_COMMAND(ID_STREAM_SUB_ONOFF, OnStreamSubOnOff) - ON_COMMAND_RANGE(ID_OGM_AUDIO_NEXT, ID_OGM_AUDIO_PREV, OnOgmAudio) - ON_COMMAND_RANGE(ID_OGM_SUB_NEXT, ID_OGM_SUB_PREV, OnOgmSub) - ON_COMMAND_RANGE(ID_DVD_ANGLE_NEXT, ID_DVD_ANGLE_PREV, OnDvdAngle) - ON_COMMAND_RANGE(ID_DVD_AUDIO_NEXT, ID_DVD_AUDIO_PREV, OnDvdAudio) - ON_COMMAND_RANGE(ID_DVD_SUB_NEXT, ID_DVD_SUB_PREV, OnDvdSub) - ON_COMMAND(ID_DVD_SUB_ONOFF, OnDvdSubOnOff) - - - ON_COMMAND(ID_FILE_OPENQUICK, OnFileOpenQuick) - ON_UPDATE_COMMAND_UI(ID_FILE_OPENMEDIA, OnUpdateFileOpen) - ON_COMMAND(ID_FILE_OPENMEDIA, OnFileOpenmedia) - ON_UPDATE_COMMAND_UI(ID_FILE_OPENMEDIA, OnUpdateFileOpen) - ON_WM_COPYDATA() - ON_COMMAND(ID_FILE_OPENDVD, OnFileOpendvd) - ON_UPDATE_COMMAND_UI(ID_FILE_OPENDVD, OnUpdateFileOpen) - ON_COMMAND(ID_FILE_OPENDEVICE, OnFileOpendevice) - ON_UPDATE_COMMAND_UI(ID_FILE_OPENDEVICE, OnUpdateFileOpen) - ON_COMMAND_RANGE(ID_FILE_OPEN_CD_START, ID_FILE_OPEN_CD_END, OnFileOpenCD) - ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_OPEN_CD_START, ID_FILE_OPEN_CD_END, OnUpdateFileOpen) - ON_WM_DROPFILES() - ON_COMMAND(ID_FILE_SAVE_COPY, OnFileSaveAs) - ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_COPY, OnUpdateFileSaveAs) - ON_COMMAND(ID_FILE_SAVE_IMAGE, OnFileSaveImage) - ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_IMAGE, OnUpdateFileSaveImage) - ON_COMMAND(ID_FILE_SAVE_IMAGE_AUTO, OnFileSaveImageAuto) - ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_IMAGE_AUTO, OnUpdateFileSaveImage) - ON_COMMAND(ID_FILE_SAVE_THUMBNAILS, OnFileSaveThumbnails) - ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_THUMBNAILS, OnUpdateFileSaveThumbnails) - ON_COMMAND(ID_FILE_CONVERT, OnFileConvert) - ON_UPDATE_COMMAND_UI(ID_FILE_CONVERT, OnUpdateFileConvert) - ON_COMMAND(ID_FILE_LOAD_SUBTITLE, OnFileLoadsubtitle) - ON_UPDATE_COMMAND_UI(ID_FILE_LOAD_SUBTITLE, OnUpdateFileLoadsubtitle) - ON_COMMAND(ID_FILE_SAVE_SUBTITLE, OnFileSavesubtitle) - ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_SUBTITLE, OnUpdateFileSavesubtitle) - ON_COMMAND(ID_FILE_ISDB_SEARCH, OnFileISDBSearch) - ON_UPDATE_COMMAND_UI(ID_FILE_ISDB_SEARCH, OnUpdateFileISDBSearch) - ON_COMMAND(ID_FILE_ISDB_UPLOAD, OnFileISDBUpload) - ON_UPDATE_COMMAND_UI(ID_FILE_ISDB_UPLOAD, OnUpdateFileISDBUpload) - ON_COMMAND(ID_FILE_ISDB_DOWNLOAD, OnFileISDBDownload) - ON_UPDATE_COMMAND_UI(ID_FILE_ISDB_DOWNLOAD, OnUpdateFileISDBDownload) - ON_COMMAND(ID_FILE_PROPERTIES, OnFileProperties) - ON_UPDATE_COMMAND_UI(ID_FILE_PROPERTIES, OnUpdateFileProperties) - ON_COMMAND(ID_FILE_CLOSEPLAYLIST, OnFileClosePlaylist) - ON_COMMAND(ID_FILE_CLOSEMEDIA, OnFileCloseMedia) - ON_UPDATE_COMMAND_UI(ID_FILE_CLOSEMEDIA, OnUpdateFileClose) - - ON_COMMAND(ID_VIEW_CAPTIONMENU, OnViewCaptionmenu) - ON_UPDATE_COMMAND_UI(ID_VIEW_CAPTIONMENU, OnUpdateViewCaptionmenu) - ON_COMMAND_RANGE(ID_VIEW_SEEKER, ID_VIEW_STATUS, OnViewControlBar) - ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_SEEKER, ID_VIEW_STATUS, OnUpdateViewControlBar) - ON_COMMAND(ID_VIEW_SUBRESYNC, OnViewSubresync) - ON_UPDATE_COMMAND_UI(ID_VIEW_SUBRESYNC, OnUpdateViewSubresync) - ON_COMMAND(ID_VIEW_PLAYLIST, OnViewPlaylist) - ON_UPDATE_COMMAND_UI(ID_VIEW_PLAYLIST, OnUpdateViewPlaylist) - ON_COMMAND(ID_VIEW_CAPTURE, OnViewCapture) - ON_UPDATE_COMMAND_UI(ID_VIEW_CAPTURE, OnUpdateViewCapture) - ON_COMMAND(ID_VIEW_SHADEREDITOR, OnViewShaderEditor) - ON_UPDATE_COMMAND_UI(ID_VIEW_SHADEREDITOR, OnUpdateViewShaderEditor) - ON_COMMAND(ID_VIEW_PRESETS_MINIMAL, OnViewMinimal) - ON_UPDATE_COMMAND_UI(ID_VIEW_PRESETS_MINIMAL, OnUpdateViewMinimal) - ON_COMMAND(ID_VIEW_PRESETS_COMPACT, OnViewCompact) - ON_UPDATE_COMMAND_UI(ID_VIEW_PRESETS_COMPACT, OnUpdateViewCompact) - ON_COMMAND(ID_VIEW_PRESETS_NORMAL, OnViewNormal) - ON_UPDATE_COMMAND_UI(ID_VIEW_PRESETS_NORMAL, OnUpdateViewNormal) - ON_COMMAND(ID_VIEW_FULLSCREEN, OnViewFullscreen) - ON_COMMAND(ID_VIEW_FULLSCREEN_SECONDARY, OnViewFullscreenSecondary) - ON_UPDATE_COMMAND_UI(ID_VIEW_FULLSCREEN, OnUpdateViewFullscreen) - ON_COMMAND_RANGE(ID_VIEW_ZOOM_50, ID_VIEW_ZOOM_200, OnViewZoom) - ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_ZOOM_50, ID_VIEW_ZOOM_200, OnUpdateViewZoom) - ON_COMMAND(ID_VIEW_ZOOM_AUTOFIT, OnViewZoomAutoFit) - ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOM_AUTOFIT, OnUpdateViewZoom) - ON_COMMAND_RANGE(ID_VIEW_VF_HALF, ID_VIEW_VF_FROMOUTSIDE, OnViewDefaultVideoFrame) - ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_VF_HALF, ID_VIEW_VF_FROMOUTSIDE, OnUpdateViewDefaultVideoFrame) - ON_COMMAND(ID_VIEW_VF_KEEPASPECTRATIO, OnViewKeepaspectratio) - ON_UPDATE_COMMAND_UI(ID_VIEW_VF_KEEPASPECTRATIO, OnUpdateViewKeepaspectratio) - ON_COMMAND(ID_VIEW_VF_COMPMONDESKARDIFF, OnViewCompMonDeskARDiff) - ON_UPDATE_COMMAND_UI(ID_VIEW_VF_COMPMONDESKARDIFF, OnUpdateViewCompMonDeskARDiff) - ON_COMMAND_RANGE(ID_VIEW_RESET, ID_PANSCAN_CENTER, OnViewPanNScan) - ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_RESET, ID_PANSCAN_CENTER, OnUpdateViewPanNScan) - ON_COMMAND_RANGE(ID_PANNSCAN_PRESETS_START, ID_PANNSCAN_PRESETS_END, OnViewPanNScanPresets) - ON_UPDATE_COMMAND_UI_RANGE(ID_PANNSCAN_PRESETS_START, ID_PANNSCAN_PRESETS_END, OnUpdateViewPanNScanPresets) - ON_COMMAND_RANGE(ID_PANSCAN_ROTATEXP, ID_PANSCAN_ROTATEZM, OnViewRotate) - ON_UPDATE_COMMAND_UI_RANGE(ID_PANSCAN_ROTATEXP, ID_PANSCAN_ROTATEZM, OnUpdateViewRotate) - ON_COMMAND_RANGE(ID_ASPECTRATIO_START, ID_ASPECTRATIO_END, OnViewAspectRatio) - ON_UPDATE_COMMAND_UI_RANGE(ID_ASPECTRATIO_START, ID_ASPECTRATIO_END, OnUpdateViewAspectRatio) - ON_COMMAND(ID_ASPECTRATIO_NEXT, OnViewAspectRatioNext) - ON_COMMAND_RANGE(ID_ONTOP_NEVER, ID_ONTOP_WHILEPLAYING, OnViewOntop) - ON_UPDATE_COMMAND_UI_RANGE(ID_ONTOP_NEVER, ID_ONTOP_WHILEPLAYING, OnUpdateViewOntop) - ON_COMMAND(ID_VIEW_OPTIONS, OnViewOptions) - - ON_COMMAND_RANGE(ID_SUB_DELAY_DOWN, ID_SUB_DELAY_UP, OnSubtitleDelay) - - ON_COMMAND(ID_PLAY_PLAY, OnPlayPlay) - ON_COMMAND(ID_PLAY_PAUSE, OnPlayPause) - ON_COMMAND(ID_PLAY_PLAYPAUSE, OnPlayPlaypause) - ON_COMMAND(ID_PLAY_STOP, OnPlayStop) - ON_UPDATE_COMMAND_UI(ID_PLAY_PLAY, OnUpdatePlayPauseStop) - ON_UPDATE_COMMAND_UI(ID_PLAY_PAUSE, OnUpdatePlayPauseStop) - ON_UPDATE_COMMAND_UI(ID_PLAY_PLAYPAUSE, OnUpdatePlayPauseStop) - ON_UPDATE_COMMAND_UI(ID_PLAY_STOP, OnUpdatePlayPauseStop) - ON_COMMAND_RANGE(ID_PLAY_FRAMESTEP, ID_PLAY_FRAMESTEPCANCEL, OnPlayFramestep) - ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_FRAMESTEP, ID_PLAY_FRAMESTEPCANCEL, OnUpdatePlayFramestep) - ON_COMMAND_RANGE(ID_PLAY_SEEKBACKWARDSMALL, ID_PLAY_SEEKFORWARDLARGE, OnPlaySeek) - ON_COMMAND_RANGE(ID_PLAY_SEEKKEYBACKWARD, ID_PLAY_SEEKKEYFORWARD, OnPlaySeekKey) - ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_SEEKBACKWARDSMALL, ID_PLAY_SEEKFORWARDLARGE, OnUpdatePlaySeek) - ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_SEEKKEYBACKWARD, ID_PLAY_SEEKKEYFORWARD, OnUpdatePlaySeek) - ON_COMMAND(ID_PLAY_GOTO, OnPlayGoto) - ON_UPDATE_COMMAND_UI(ID_PLAY_GOTO, OnUpdateGoto) - ON_COMMAND_RANGE(ID_PLAY_DECRATE, ID_PLAY_INCRATE, OnPlayChangeRate) - ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_DECRATE, ID_PLAY_INCRATE, OnUpdatePlayChangeRate) - ON_COMMAND(ID_PLAY_RESETRATE, OnPlayResetRate) - ON_UPDATE_COMMAND_UI(ID_PLAY_RESETRATE, OnUpdatePlayResetRate) - ON_COMMAND_RANGE(ID_PLAY_INCAUDDELAY, ID_PLAY_DECAUDDELAY, OnPlayChangeAudDelay) - ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_INCAUDDELAY, ID_PLAY_DECAUDDELAY, OnUpdatePlayChangeAudDelay) - ON_COMMAND_RANGE(ID_FILTERS_SUBITEM_START, ID_FILTERS_SUBITEM_END, OnPlayFilters) - ON_UPDATE_COMMAND_UI_RANGE(ID_FILTERS_SUBITEM_START, ID_FILTERS_SUBITEM_END, OnUpdatePlayFilters) - ON_COMMAND_RANGE(ID_SHADERS_START, ID_SHADERS_END, OnPlayShaders) - ON_UPDATE_COMMAND_UI_RANGE(ID_SHADERS_START, ID_SHADERS_END, OnUpdatePlayShaders) - ON_COMMAND_RANGE(ID_AUDIO_SUBITEM_START, ID_AUDIO_SUBITEM_END, OnPlayAudio) - ON_UPDATE_COMMAND_UI_RANGE(ID_AUDIO_SUBITEM_START, ID_AUDIO_SUBITEM_END, OnUpdatePlayAudio) - ON_COMMAND_RANGE(ID_SUBTITLES_SUBITEM_START, ID_SUBTITLES_SUBITEM_END, OnPlaySubtitles) - ON_UPDATE_COMMAND_UI_RANGE(ID_SUBTITLES_SUBITEM_START, ID_SUBTITLES_SUBITEM_END, OnUpdatePlaySubtitles) - ON_COMMAND_RANGE(ID_FILTERSTREAMS_SUBITEM_START, ID_FILTERSTREAMS_SUBITEM_END, OnPlayLanguage) - ON_UPDATE_COMMAND_UI_RANGE(ID_FILTERSTREAMS_SUBITEM_START, ID_FILTERSTREAMS_SUBITEM_END, OnUpdatePlayLanguage) - ON_COMMAND_RANGE(ID_VOLUME_UP, ID_VOLUME_MUTE, OnPlayVolume) - ON_COMMAND_RANGE(ID_VOLUME_BOOST_INC, ID_VOLUME_BOOST_MAX, OnPlayVolumeBoost) - ON_UPDATE_COMMAND_UI_RANGE(ID_VOLUME_BOOST_INC, ID_VOLUME_BOOST_MAX, OnUpdatePlayVolumeBoost) - ON_COMMAND_RANGE(ID_AFTERPLAYBACK_CLOSE, ID_AFTERPLAYBACK_DONOTHING, OnAfterplayback) - ON_UPDATE_COMMAND_UI_RANGE(ID_AFTERPLAYBACK_CLOSE, ID_AFTERPLAYBACK_DONOTHING, OnUpdateAfterplayback) - - ON_COMMAND_RANGE(ID_NAVIGATE_SKIPBACK, ID_NAVIGATE_SKIPFORWARD, OnNavigateSkip) - ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_SKIPBACK, ID_NAVIGATE_SKIPFORWARD, OnUpdateNavigateSkip) - ON_COMMAND_RANGE(ID_NAVIGATE_SKIPBACKPLITEM, ID_NAVIGATE_SKIPFORWARDPLITEM, OnNavigateSkipPlaylistItem) - ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_SKIPBACKPLITEM, ID_NAVIGATE_SKIPFORWARDPLITEM, OnUpdateNavigateSkipPlaylistItem) - ON_COMMAND_RANGE(ID_NAVIGATE_TITLEMENU, ID_NAVIGATE_CHAPTERMENU, OnNavigateMenu) - ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_TITLEMENU, ID_NAVIGATE_CHAPTERMENU, OnUpdateNavigateMenu) - ON_COMMAND_RANGE(ID_NAVIGATE_AUDIO_SUBITEM_START, ID_NAVIGATE_AUDIO_SUBITEM_END, OnNavigateAudio) - ON_COMMAND_RANGE(ID_NAVIGATE_SUBP_SUBITEM_START, ID_NAVIGATE_SUBP_SUBITEM_END, OnNavigateSubpic) - ON_COMMAND_RANGE(ID_NAVIGATE_ANGLE_SUBITEM_START, ID_NAVIGATE_ANGLE_SUBITEM_END, OnNavigateAngle) - ON_COMMAND_RANGE(ID_NAVIGATE_CHAP_SUBITEM_START, ID_NAVIGATE_CHAP_SUBITEM_END, OnNavigateChapters) - ON_COMMAND_RANGE(ID_NAVIGATE_MENU_LEFT, ID_NAVIGATE_MENU_LEAVE, OnNavigateMenuItem) - ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_MENU_LEFT, ID_NAVIGATE_MENU_LEAVE, OnUpdateNavigateMenuItem) - - ON_COMMAND(ID_FAVORITES_ADD, OnFavoritesAdd) - ON_UPDATE_COMMAND_UI(ID_FAVORITES_ADD, OnUpdateFavoritesAdd) - ON_COMMAND(ID_FAVORITES_ORGANIZE, OnFavoritesOrganize) - ON_UPDATE_COMMAND_UI(ID_FAVORITES_ORGANIZE, OnUpdateFavoritesOrganize) - ON_COMMAND_RANGE(ID_FAVORITES_FILE_START, ID_FAVORITES_FILE_END, OnFavoritesFile) - ON_UPDATE_COMMAND_UI_RANGE(ID_FAVORITES_FILE_START, ID_FAVORITES_FILE_END, OnUpdateFavoritesFile) - ON_COMMAND_RANGE(ID_FAVORITES_DVD_START, ID_FAVORITES_DVD_END, OnFavoritesDVD) - ON_UPDATE_COMMAND_UI_RANGE(ID_FAVORITES_DVD_START, ID_FAVORITES_DVD_END, OnUpdateFavoritesDVD) - ON_COMMAND_RANGE(ID_FAVORITES_DEVICE_START, ID_FAVORITES_DEVICE_END, OnFavoritesDevice) - ON_UPDATE_COMMAND_UI_RANGE(ID_FAVORITES_DEVICE_START, ID_FAVORITES_DEVICE_END, OnUpdateFavoritesDevice) - - ON_COMMAND(ID_HELP_HOMEPAGE, OnHelpHomepage) - ON_COMMAND(ID_HELP_DOCUMENTATION, OnHelpDocumentation) - - END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame construction/destruction - -#pragma warning(disable : 4355) - -CMainFrame::CMainFrame() : - m_dwRegister(0), - m_iMediaLoadState(MLS_CLOSED), - m_iPlaybackMode(PM_NONE), - m_iSpeedLevel(0), - m_rtDurationOverride(-1), - m_fFullScreen(false), - m_fHideCursor(false), - m_lastMouseMove(-1, -1), - m_pLastBar(NULL), - m_nLoops(0), - m_iSubtitleSel(-1), - m_ZoomX(1), m_ZoomY(1), m_PosX(0.5), m_PosY(0.5), - m_AngleX(0), m_AngleY(0), m_AngleZ(0), - m_fCustomGraph(false), - m_fRealMediaGraph(false), m_fShockwaveGraph(false), m_fQuicktimeGraph(false), - m_fFrameSteppingActive(false), - m_fEndOfStream(false), - m_fCapturing(false), - m_fLiveWM(false), - m_fOpeningAborted(false), - m_fBuffering(false), - m_fileDropTarget(this), - m_fTrayIcon(false) -{ -} - -CMainFrame::~CMainFrame() -{ -// m_owner.DestroyWindow(); -} - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if(__super::OnCreate(lpCreateStruct) == -1) - return -1; - - m_popup.LoadMenu(IDR_POPUP); - m_popupmain.LoadMenu(IDR_POPUPMAIN); - - GetMenu()->ModifyMenu(ID_FAVORITES, MF_BYCOMMAND|MF_STRING, IDR_MAINFRAME, ResStr(IDS_FAVORITES_POPUP)); - - // create a view to occupy the client area of the frame - if(!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, - CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) - { - TRACE0("Failed to create view window\n"); - return -1; - } - - // static bars - - if(!m_wndStatusBar.Create(this) - || !m_wndStatsBar.Create(this) - || !m_wndInfoBar.Create(this) - || !m_wndToolBar.Create(this) - || !m_wndSeekBar.Create(this)) - { - TRACE0("Failed to create all control bars\n"); - return -1; // fail to create - } - - m_bars.AddTail(&m_wndSeekBar); - m_bars.AddTail(&m_wndToolBar); - m_bars.AddTail(&m_wndInfoBar); - m_bars.AddTail(&m_wndStatsBar); - m_bars.AddTail(&m_wndStatusBar); - - m_wndSeekBar.Enable(false); - - // dockable bars - - EnableDocking(CBRS_ALIGN_ANY); - - m_dockingbars.RemoveAll(); - - m_wndSubresyncBar.Create(this, &m_csSubLock); - m_wndSubresyncBar.SetBarStyle(m_wndSubresyncBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); - m_wndSubresyncBar.EnableDocking(CBRS_ALIGN_ANY); - m_wndSubresyncBar.SetHeight(200); - LoadControlBar(&m_wndSubresyncBar, AFX_IDW_DOCKBAR_TOP); - - m_wndPlaylistBar.Create(this); - m_wndPlaylistBar.SetBarStyle(m_wndPlaylistBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); - m_wndPlaylistBar.EnableDocking(CBRS_ALIGN_ANY); - m_wndPlaylistBar.SetHeight(100); - LoadControlBar(&m_wndPlaylistBar, AFX_IDW_DOCKBAR_BOTTOM); - m_wndPlaylistBar.LoadPlaylist(); - - m_wndCaptureBar.Create(this); - m_wndCaptureBar.SetBarStyle(m_wndCaptureBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); - m_wndCaptureBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT); - LoadControlBar(&m_wndCaptureBar, AFX_IDW_DOCKBAR_LEFT); - - m_wndShaderEditorBar.Create(this); - m_wndShaderEditorBar.SetBarStyle(m_wndShaderEditorBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); - m_wndShaderEditorBar.EnableDocking(CBRS_ALIGN_ANY); - LoadControlBar(&m_wndShaderEditorBar, AFX_IDW_DOCKBAR_TOP); - - m_fileDropTarget.Register(this); - - GetDesktopWindow()->GetWindowRect(&m_rcDesktop); - - AppSettings& s = AfxGetAppSettings(); - - ShowControls(s.nCS); - - SetAlwaysOnTop(s.iOnTop); - - ShowTrayIcon(s.fTrayIcon); - - SetFocus(); - - m_pGraphThread = (CGraphThread*)AfxBeginThread(RUNTIME_CLASS(CGraphThread)); - - if(m_pGraphThread) - m_pGraphThread->SetMainFrame(this); - - if(s.fEnableWebServer) - StartWebServer(s.nWebServerPort); - - // load shaders - CString strList = AfxGetAppSettings().strShaderList; - CString strRes; - int curPos= 0; - - strRes = strList.Tokenize (_T("|"), curPos); - while (strRes != _T("")) - { - m_shaderlabels.AddTail (strRes); - strRes = strList.Tokenize(_T("|"),curPos); - }; - // end - - - return 0; -} - -void CMainFrame::OnDestroy() -{ - ShowTrayIcon(false); - - m_fileDropTarget.Revoke(); - - if(m_pGraphThread) - { - CAMEvent e; - m_pGraphThread->PostThreadMessage(CGraphThread::TM_EXIT, 0, (LPARAM)&e); - if(!e.Wait(5000)) - { - TRACE(_T("ERROR: Must call TerminateThread() on CMainFrame::m_pGraphThread->m_hThread\n")); - TerminateThread(m_pGraphThread->m_hThread, -1); - } - } - - __super::OnDestroy(); -} - -void CMainFrame::OnClose() -{ - // save shader list - POSITION pos; - CString strList = ""; - - pos = m_shaderlabels.GetHeadPosition(); - while(pos) - { - strList += m_shaderlabels.GetAt (pos) + "|"; - m_dockingbars.GetNext(pos); - } - AfxGetAppSettings().strShaderList = strList; - // end - - m_wndPlaylistBar.SavePlaylist(); - - SaveControlBars(); - - ShowWindow(SW_HIDE); - - CloseMedia(); - - __super::OnClose(); -} - -DROPEFFECT CMainFrame::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) -{ - return DROPEFFECT_NONE; -} -DROPEFFECT CMainFrame::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) -{ - UINT CF_URL = RegisterClipboardFormat(_T("UniformResourceLocator")); - return pDataObject->IsDataAvailable(CF_URL) ? DROPEFFECT_COPY : DROPEFFECT_NONE; -} -BOOL CMainFrame::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) -{ - UINT CF_URL = RegisterClipboardFormat(_T("UniformResourceLocator")); - - BOOL bResult = FALSE; - - if(pDataObject->IsDataAvailable(CF_URL)) - { - FORMATETC fmt = {CF_URL, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; - if(HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_URL, &fmt)) - { - LPCSTR pText = (LPCSTR)GlobalLock(hGlobal); - if(AfxIsValidString(pText)) - { - CStringA url(pText); - - SetForegroundWindow(); - - CAtlList sl; - sl.AddTail(CString(url)); - - if(m_wndPlaylistBar.IsWindowVisible()) - { - m_wndPlaylistBar.Append(sl, true); - } - else - { - m_wndPlaylistBar.Open(sl, true); - OpenCurPlaylistItem(); - } - - GlobalUnlock(hGlobal); - bResult = TRUE; - } - } - } - - return bResult; -} -DROPEFFECT CMainFrame::OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point) -{ - return (DROPEFFECT)-1; -} -void CMainFrame::OnDragLeave() -{ -} -DROPEFFECT CMainFrame::OnDragScroll(DWORD dwKeyState, CPoint point) -{ - return DROPEFFECT_NONE; -} - -void CMainFrame::LoadControlBar(CControlBar* pBar, UINT defDockBarID) -{ - if(!pBar) return; - - CString str; - pBar->GetWindowText(str); - if(str.IsEmpty()) return; - CString section = _T("ToolBars\\") + str; - - CWinApp* pApp = AfxGetApp(); - - UINT nID = pApp->GetProfileInt(section, _T("DockState"), defDockBarID); - - if(nID != AFX_IDW_DOCKBAR_FLOAT) - { - DockControlBar(pBar, nID); - } - - pBar->ShowWindow( - pApp->GetProfileInt(section, _T("Visible"), FALSE) - && pBar != &m_wndSubresyncBar - && pBar != &m_wndCaptureBar - && pBar != &m_wndShaderEditorBar - ? SW_SHOW - : SW_HIDE); - - if(CSizingControlBar* pSCB = dynamic_cast(pBar)) - { - pSCB->LoadState(section + _T("\\State")); - m_dockingbars.AddTail(pSCB); - } -} - -void CMainFrame::RestoreFloatingControlBars() -{ - CWinApp* pApp = AfxGetApp(); - - CRect r; - GetWindowRect(r); - - POSITION pos = m_dockingbars.GetHeadPosition(); - while(pos) - { - CSizingControlBar* pBar = m_dockingbars.GetNext(pos); - - CString str; - pBar->GetWindowText(str); - if(str.IsEmpty()) return; - CString section = _T("ToolBars\\") + str; - - if(pApp->GetProfileInt(section, _T("DockState"), AFX_IDW_DOCKBAR_FLOAT) == AFX_IDW_DOCKBAR_FLOAT) - { - CPoint p; - p.x = pApp->GetProfileInt(section, _T("DockPosX"), 100); - p.y = pApp->GetProfileInt(section, _T("DockPosY"), 100); - if(p.x < m_rcDesktop.left) p.x = m_rcDesktop.left; - if(p.y < m_rcDesktop.top) p.y = m_rcDesktop.top; - if(p.x >= m_rcDesktop.right) p.x = m_rcDesktop.right-1; - if(p.y >= m_rcDesktop.bottom) p.y = m_rcDesktop.bottom-1; - FloatControlBar(pBar, p); - } - } -} - -void CMainFrame::SaveControlBars() -{ - CWinApp* pApp = AfxGetApp(); - - POSITION pos = m_dockingbars.GetHeadPosition(); - while(pos) - { - CSizingControlBar* pBar = m_dockingbars.GetNext(pos); - - CString str; - pBar->GetWindowText(str); - if(str.IsEmpty()) return; - CString section = _T("ToolBars\\") + str; - - pApp->WriteProfileInt(section, _T("Visible"), pBar->IsWindowVisible()); - - if(CSizingControlBar* pSCB = dynamic_cast(pBar)) - { - pSCB->SaveState(section + _T("\\State")); - } - - UINT nID = pBar->GetParent()->GetDlgCtrlID(); - - if(nID == AFX_IDW_DOCKBAR_FLOAT) - { - CRect r; - pBar->GetParent()->GetParent()->GetWindowRect(r); - pApp->WriteProfileInt(section, _T("DockPosX"), r.left); - pApp->WriteProfileInt(section, _T("DockPosY"), r.top); - } - - pApp->WriteProfileInt(section, _T("DockState"), nID); - } -} - -LRESULT CMainFrame::OnTaskBarRestart(WPARAM, LPARAM) -{ - m_fTrayIcon = false; - ShowTrayIcon(AfxGetAppSettings().fTrayIcon); - - return 0; -} - -LRESULT CMainFrame::OnNotifyIcon(WPARAM wParam, LPARAM lParam) -{ - if((UINT)wParam != IDR_MAINFRAME) - return -1; - - switch((UINT)lParam) - { - case WM_LBUTTONDOWN: - ShowWindow(SW_SHOW); - MoveVideoWindow(); - SetForegroundWindow(); - break; - - case WM_LBUTTONDBLCLK: - PostMessage(WM_COMMAND, ID_FILE_OPENMEDIA); - break; - - case WM_RBUTTONDOWN: - { - POINT p; - GetCursorPos(&p); - SetForegroundWindow(); - m_popupmain.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, p.x, p.y, this); - PostMessage(WM_NULL); - break; - } - - case WM_MOUSEMOVE: - { - CString str; - GetWindowText(str); - SetTrayTip(str); - break; - } - - default: - break; - } - - return 0; -} - -void CMainFrame::ShowTrayIcon(bool fShow) -{ - BOOL bWasVisible = ShowWindow(SW_HIDE); - NOTIFYICONDATA tnid; - - ZeroMemory(&tnid, sizeof(NOTIFYICONDATA)); - tnid.cbSize = sizeof(NOTIFYICONDATA); - tnid.hWnd = m_hWnd; - tnid.uID = IDR_MAINFRAME; - - if(fShow) - { - if(!m_fTrayIcon) - { - tnid.hIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - tnid.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; - tnid.uCallbackMessage = WM_NOTIFYICON; - lstrcpyn(tnid.szTip, TEXT("Media Player Classic"), sizeof(tnid.szTip)); - Shell_NotifyIcon(NIM_ADD, &tnid); - - m_fTrayIcon = true; - } - } - else - { - if(m_fTrayIcon) - { - Shell_NotifyIcon(NIM_DELETE, &tnid); - - m_fTrayIcon = false; - } - } - - if(bWasVisible) - ShowWindow(SW_SHOW); -} - -void CMainFrame::SetTrayTip(CString str) -{ - NOTIFYICONDATA tnid; - tnid.cbSize = sizeof(NOTIFYICONDATA); - tnid.hWnd = m_hWnd; - tnid.uID = IDR_MAINFRAME; - tnid.uFlags = NIF_TIP; - lstrcpyn(tnid.szTip, str, sizeof(tnid.szTip)); - Shell_NotifyIcon(NIM_MODIFY, &tnid); -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - if(!__super::PreCreateWindow(cs)) - return FALSE; - - cs.dwExStyle &= ~WS_EX_CLIENTEDGE; - cs.lpszClass = MPC_WND_CLASS_NAME; //AfxRegisterWndClass(0); - - return TRUE; -} - -BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message == WM_KEYDOWN) - { -/* if(m_fShockwaveGraph - && (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT - || pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN)) - return FALSE; -*/ - if(pMsg->wParam == VK_ESCAPE && m_iMediaLoadState == MLS_LOADED && m_fFullScreen) - { - OnViewFullscreen(); - PostMessage(WM_COMMAND, ID_PLAY_PAUSE); - return TRUE; - } - else if(pMsg->wParam == VK_ESCAPE && (IsCaptionMenuHidden())) - { - PostMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU); - return TRUE; - } - else if(pMsg->wParam == VK_LEFT && pAMTuner) - { - PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACK); - return TRUE; - } - else if(pMsg->wParam == VK_RIGHT && pAMTuner) - { - PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD); - return TRUE; - } - } - - return __super::PreTranslateMessage(pMsg); -} - -void CMainFrame::RecalcLayout(BOOL bNotify) -{ - __super::RecalcLayout(bNotify); - - CRect r; - GetWindowRect(&r); - MINMAXINFO mmi; - memset(&mmi, 0, sizeof(mmi)); - SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmi); - r |= CRect(r.TopLeft(), CSize(r.Width(), mmi.ptMinTrackSize.y)); - MoveWindow(&r); -} - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const -{ - __super::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext& dc) const -{ - __super::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame message handlers -void CMainFrame::OnSetFocus(CWnd* pOldWnd) -{ - SetAlwaysOnTop(AfxGetAppSettings().iOnTop); - - // forward focus to the view window - if(IsWindow(m_wndView.m_hWnd)) - m_wndView.SetFocus(); -} - -BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) -{ - // let the view have first crack at the command - if(m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) - return TRUE; - - POSITION pos = m_bars.GetHeadPosition(); - while(pos) - { - if(m_bars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) - return TRUE; - } - - pos = m_dockingbars.GetHeadPosition(); - while(pos) - { - if(m_dockingbars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) - return TRUE; - } - - // otherwise, do default handling - return __super::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); -} - -void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI) -{ - DWORD style = GetStyle(); - - MENUBARINFO mbi; - memset(&mbi, 0, sizeof(mbi)); - mbi.cbSize = sizeof(mbi); - ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi); - - lpMMI->ptMinTrackSize.x = 0; - if(!IsCaptionMenuHidden()) - { - lpMMI->ptMinTrackSize.x = 10; - CRect r; - for(int i = 0; ::GetMenuItemRect(m_hWnd, mbi.hMenu, i, &r); i++) - lpMMI->ptMinTrackSize.x += r.Width(); - lpMMI->ptMinTrackSize.x = max(DEFCLIENTW, lpMMI->ptMinTrackSize.x); - } - if(style&WS_THICKFRAME) lpMMI->ptMinTrackSize.x += GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2; - - memset(&mbi, 0, sizeof(mbi)); - mbi.cbSize = sizeof(mbi); - ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi); - - lpMMI->ptMinTrackSize.y = 0; - if(style&WS_CAPTION) lpMMI->ptMinTrackSize.y += GetSystemMetrics(SM_CYCAPTION); - if(style&WS_THICKFRAME) lpMMI->ptMinTrackSize.y += GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2; - lpMMI->ptMinTrackSize.y += (mbi.rcBar.bottom - mbi.rcBar.top); - if(!AfxGetAppSettings().fHideCaptionMenu) lpMMI->ptMinTrackSize.y += 3; - - POSITION pos = m_bars.GetHeadPosition(); - while(pos) - { - CControlBar* pCB = m_bars.GetNext(pos); - if(!IsWindow(pCB->m_hWnd) || !pCB->IsVisible()) continue; - - lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy; - } - - pos = m_dockingbars.GetHeadPosition(); - while(pos) - { - CSizingControlBar* pCB = m_dockingbars.GetNext(pos); - if(IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible() && !pCB->IsFloating()) - lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy-2; - } - - __super::OnGetMinMaxInfo(lpMMI); -} - -void CMainFrame::OnMove(int x, int y) -{ - __super::OnMove(x, y); - - MoveVideoWindow(); - - WINDOWPLACEMENT wp; - GetWindowPlacement(&wp); - if(!m_fFullScreen && wp.flags != WPF_RESTORETOMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED) - GetWindowRect(AfxGetAppSettings().rcLastWindowPos); -} - -void CMainFrame::OnMoving(UINT fwSide, LPRECT pRect) -{ - __super::OnMoving(fwSide, pRect); - - if(AfxGetAppSettings().fSnapToDesktopEdges) - { - const CPoint threshold(3, 3); - - CRect r0 = m_rcDesktop; - CRect r1 = r0 + threshold; - CRect r2 = r0 - threshold; - - RECT& wr = *pRect; - CSize ws = CRect(wr).Size(); - - if(wr.left < r1.left && wr.left > r2.left) - wr.right = (wr.left = r0.left) + ws.cx; - - if(wr.top < r1.top && wr.top > r2.top) - wr.bottom = (wr.top = r0.top) + ws.cy; - - if(wr.right < r1.right && wr.right > r2.right) - wr.left = (wr.right = r0.right) - ws.cx; - - if(wr.bottom < r1.bottom && wr.bottom > r2.bottom) - wr.top = (wr.bottom = r0.bottom) - ws.cy; - } -} - -void CMainFrame::OnSize(UINT nType, int cx, int cy) -{ - __super::OnSize(nType, cx, cy); - - if(nType == SIZE_RESTORED && m_fTrayIcon) - { - ShowWindow(SW_SHOW); - } - - if(!m_fFullScreen) - { - AppSettings& s = AfxGetAppSettings(); - if(nType != SIZE_MAXIMIZED && nType != SIZE_MINIMIZED) - GetWindowRect(s.rcLastWindowPos); - s.lastWindowType = nType; - } -} - -void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect) -{ - __super::OnSizing(fwSide, pRect); - - AppSettings& s = AfxGetAppSettings(); - - bool fCtrl = !!(GetAsyncKeyState(VK_CONTROL)&0x80000000); - - if(m_iMediaLoadState != MLS_LOADED || m_fFullScreen - || s.iDefaultVideoSize == DVS_STRETCH - || (fCtrl ^ s.fFreeWindowResizing)) - return; - - CSize wsize(pRect->right - pRect->left, pRect->bottom - pRect->top); - CSize vsize = GetVideoSize(); - CSize fsize(0, 0); - - if(!vsize.cx || !vsize.cy) - return; - - // TODO - { - DWORD style = GetStyle(); - - MENUBARINFO mbi; - memset(&mbi, 0, sizeof(mbi)); - mbi.cbSize = sizeof(mbi); - ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi); - - fsize.cx += GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2; - - if(style&WS_CAPTION) fsize.cy += GetSystemMetrics(SM_CYCAPTION); - if(style&WS_THICKFRAME) fsize.cy += GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2; - fsize.cy += mbi.rcBar.bottom - mbi.rcBar.top; - if(!AfxGetAppSettings().fHideCaptionMenu) fsize.cy += 3; - - POSITION pos = m_bars.GetHeadPosition(); - while(pos) - { - CControlBar* pCB = m_bars.GetNext(pos); - if(IsWindow(pCB->m_hWnd) && pCB->IsVisible()) - fsize.cy += pCB->CalcFixedLayout(TRUE, TRUE).cy; - } - - pos = m_dockingbars.GetHeadPosition(); - while(pos) - { - CSizingControlBar* pCB = m_dockingbars.GetNext(pos); - - if(IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible()) - { - if(pCB->IsHorzDocked()) fsize.cy += pCB->CalcFixedLayout(TRUE, TRUE).cy-2; - else if(pCB->IsVertDocked()) fsize.cx += pCB->CalcFixedLayout(TRUE, FALSE).cx; - } - } - } - - wsize -= fsize; - - bool fWider = wsize.cy < wsize.cx; - - wsize.SetSize( - wsize.cy * vsize.cx / vsize.cy, - wsize.cx * vsize.cy / vsize.cx); - - wsize += fsize; - - if(fwSide == WMSZ_TOP || fwSide == WMSZ_BOTTOM || !fWider && (fwSide == WMSZ_TOPRIGHT || fwSide == WMSZ_BOTTOMRIGHT)) - { - pRect->right = pRect->left + wsize.cx; - } - else if(fwSide == WMSZ_LEFT || fwSide == WMSZ_RIGHT || fWider && (fwSide == WMSZ_BOTTOMLEFT || fwSide == WMSZ_BOTTOMRIGHT)) - { - pRect->bottom = pRect->top + wsize.cy; - } - else if(!fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT)) - { - pRect->left = pRect->right - wsize.cx; - } - else if(fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT)) - { - pRect->top = pRect->bottom - wsize.cy; - } -} - -void CMainFrame::OnDisplayChange() // untested, not sure if it's working... -{ - TRACE(_T("*** CMainFrame::OnDisplayChange()\n")); -/* - if(m_iMediaLoadState == MLS_LOADED && m_pCAP) - m_pCAP->OnDisplayChange(); -*/ - - GetDesktopWindow()->GetWindowRect(&m_rcDesktop); -} - -#include - -void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) -{ - if( (GetMediaState() == State_Running) && (((nID & 0xFFF0) == SC_SCREENSAVE) || ((nID & 0xFFF0) == SC_MONITORPOWER)) ) - { - TRACE(_T("SC_SCREENSAVE, nID = %d, lParam = %d\n"), nID, lParam); - return; - } - else if((nID & 0xFFF0) == SC_MINIMIZE && m_fTrayIcon) - { - ShowWindow(SW_HIDE); - return; - } - - __super::OnSysCommand(nID, lParam); -} - -void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) -{ - __super::OnActivateApp(bActive, dwThreadID); - - MONITORINFO mi; - mi.cbSize = sizeof(MONITORINFO); - GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi); - - if(!bActive && (mi.dwFlags&MONITORINFOF_PRIMARY) && m_fFullScreen && m_iMediaLoadState == MLS_LOADED) - { - bool fExitFullscreen = true; - - if(CWnd* pWnd = GetForegroundWindow()) - { - HMONITOR hMonitor1 = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); - HMONITOR hMonitor2 = MonitorFromWindow(pWnd->m_hWnd, MONITOR_DEFAULTTONEAREST); - if(hMonitor1 && hMonitor2 && hMonitor1 != hMonitor2) fExitFullscreen = false; - - CString title; - pWnd->GetWindowText(title); - - CString module; - - if(GetVersion()&0x80000000) - { - module.ReleaseBufferSetLength(GetWindowModuleFileName(pWnd->m_hWnd, module.GetBuffer(MAX_PATH), MAX_PATH)); - } - else - { - DWORD pid; - GetWindowThreadProcessId(pWnd->m_hWnd, &pid); - - if(HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid)) - { - HMODULE hMod; - DWORD cbNeeded; - - if(EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) - { - module.ReleaseBufferSetLength(GetModuleFileNameEx(hProcess, hMod, module.GetBuffer(MAX_PATH), MAX_PATH)); - } - - CloseHandle(hProcess); - } - } - - CPath p(module); - p.StripPath(); - module = (LPCTSTR)p; - module.MakeLower(); - - CString str; - str.Format(_T("Focus lost to: %s - %s"), module, title); - SendStatusMessage(str, 5000); - } - - if(fExitFullscreen) OnViewFullscreen(); - } -} - -LRESULT CMainFrame::OnAppCommand(WPARAM wParam, LPARAM lParam) -{ - UINT cmd = GET_APPCOMMAND_LPARAM(lParam); - UINT uDevice = GET_DEVICE_LPARAM(lParam); - UINT dwKeys = GET_KEYSTATE_LPARAM(lParam); - - if(uDevice != FAPPCOMMAND_OEM) - { - AppSettings& s = AfxGetAppSettings(); - - BOOL fRet = FALSE; - - POSITION pos = s.wmcmds.GetHeadPosition(); - while(pos) - { - wmcmd& wc = s.wmcmds.GetNext(pos); - if(wc.appcmd == cmd && TRUE == SendMessage(WM_COMMAND, wc.cmd)) - fRet = TRUE; - } - - if(fRet) return TRUE; - } - - return Default(); -} - -void CMainFrame::OnTimer(UINT nIDEvent) -{ - if(nIDEvent == TIMER_STREAMPOSPOLLER && m_iMediaLoadState == MLS_LOADED) - { - REFERENCE_TIME rtNow = 0, rtDur = 0; - - if(m_iPlaybackMode == PM_FILE) - { - pMS->GetCurrentPosition(&rtNow); - pMS->GetDuration(&rtDur); - - if(m_rtDurationOverride >= 0) rtDur = m_rtDurationOverride; - - m_wndSeekBar.Enable(rtDur > 0); - m_wndSeekBar.SetRange(0, rtDur); - m_wndSeekBar.SetPos(rtNow); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - if(m_fCapturing && m_wndCaptureBar.m_capdlg.m_pMux) - { - CComQIPtr pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux; - if(!pMuxMS || FAILED(pMuxMS->GetCurrentPosition(&rtNow))) rtNow = 0; - } - - if(m_rtDurationOverride >= 0) rtDur = m_rtDurationOverride; - - m_wndSeekBar.Enable(false); - m_wndSeekBar.SetRange(0, rtDur); - m_wndSeekBar.SetPos(rtNow); -/* - if(m_fCapturing) - { - if(rtNow > 10000i64*1000*60*60*3) - { - m_wndCaptureBar.m_capdlg.OnRecord(); - } - } -*/ - } - - if(m_pCAP && m_iPlaybackMode != PM_FILE) m_pCAP->SetTime(/*rtNow*/m_wndSeekBar.GetPos()); - } - else if(nIDEvent == TIMER_STREAMPOSPOLLER2 && m_iMediaLoadState == MLS_LOADED) - { - __int64 start, stop, pos; - m_wndSeekBar.GetRange(start, stop); - pos = m_wndSeekBar.GetPosReal(); - - GUID tf; - pMS->GetTimeFormat(&tf); - - if(m_iPlaybackMode == PM_CAPTURE && !m_fCapturing) - { - CString str = _T("Live"); - - long lChannel = 0, lVivSub = 0, lAudSub = 0; - if(pAMTuner - && m_wndCaptureBar.m_capdlg.IsTunerActive() - && SUCCEEDED(pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub))) - { - CString ch; - ch.Format(_T(" (ch%d)"), lChannel); - str += ch; - } - - m_wndStatusBar.SetStatusTimer(str); - } - else - { - m_wndStatusBar.SetStatusTimer(pos, stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf); - } - - m_wndSubresyncBar.SetTime(pos); - - if(m_pCAP && GetMediaState() == State_Paused) m_pCAP->Paint(true); - } - else if(nIDEvent == TIMER_FULLSCREENCONTROLBARHIDER) - { - CPoint p; - GetCursorPos(&p); - - CRect r; - GetWindowRect(r); - bool fCursorOutside = !r.PtInRect(p); - - CWnd* pWnd = WindowFromPoint(p); - if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) - { - if(AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut >= 0) - ShowControls(CS_NONE, false); - } - } - else if(nIDEvent == TIMER_FULLSCREENMOUSEHIDER) - { - CPoint p; - GetCursorPos(&p); - - CRect r; - GetWindowRect(r); - bool fCursorOutside = !r.PtInRect(p); - - CWnd* pWnd = WindowFromPoint(p); - if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) - { - m_fHideCursor = true; - SetCursor(NULL); - } - } - else if(nIDEvent == TIMER_STATS) - { - if(pQP) - { - CString rate; - if(m_iSpeedLevel >= -11 && m_iSpeedLevel <= 3 && m_iSpeedLevel != -4) - { - CString speeds[] = {_T("1/8"),_T("1/4"),_T("1/2"),_T("1"),_T("2"),_T("4"),_T("8")}; - rate = speeds[(m_iSpeedLevel >= -3 ? m_iSpeedLevel : (-m_iSpeedLevel - 8)) + 3]; - if(m_iSpeedLevel < -4) rate = _T("-") + rate; - if(!rate.IsEmpty()) rate = _T("(") + rate + _T("X)"); - } - - CString info; - int val; - - pQP->get_AvgFrameRate(&val); - info.Format(_T("%d.%02d %s"), val/100, val%100, rate); - m_wndStatsBar.SetLine(_T("Frame-rate"), info); - - int avg, dev; - pQP->get_AvgSyncOffset(&avg); - pQP->get_DevSyncOffset(&dev); - info.Format(_T("avg: %d ms, dev: %d ms"), avg, dev); - m_wndStatsBar.SetLine(_T("Sync Offset"), info); - - int drawn, dropped; - pQP->get_FramesDrawn(&drawn); - pQP->get_FramesDroppedInRenderer(&dropped); - info.Format(_T("drawn: %d, dropped: %d"), drawn, dropped); - m_wndStatsBar.SetLine(_T("Frames"), info); - - pQP->get_Jitter(&val); - info.Format(_T("%d ms"), val); - m_wndStatsBar.SetLine(_T("Jitter"), info); - } - - if(pBI) - { - CAtlList sl; - - for(int i = 0, j = pBI->GetCount(); i < j; i++) - { - int samples, size; - if(S_OK == pBI->GetStatus(i, samples, size)) - { - CString str; - str.Format(_T("[%d]: %03d/%d KB"), i, samples, size / 1024); - sl.AddTail(str); - } - } - - if(!sl.IsEmpty()) - { - CString str; - str.Format(_T("%s (p%d)"), Implode(sl, ' '), pBI->GetPriority()); - - m_wndStatsBar.SetLine(_T("Buffers"), str); - } - } - - CInterfaceList pBRIs; - - BeginEnumFilters(pGB, pEF, pBF) - { - BeginEnumPins(pBF, pEP, pPin) - { - if(CComQIPtr pBRI = pPin) - { - pBRIs.AddTail(pBRI); - } - } - EndEnumPins - - if(!pBRIs.IsEmpty()) - { - CAtlList sl; - - POSITION pos = pBRIs.GetHeadPosition(); - for(int i = 0; pos; i++) - { - IBitRateInfo* pBRI = pBRIs.GetNext(pos); - - DWORD cur = pBRI->GetCurrentBitRate() / 1000; - DWORD avg = pBRI->GetAverageBitRate() / 1000; - - if(avg == 0) continue; - - CString str; - if(cur != avg) str.Format(_T("[%d]: %d/%d Kb/s"), i, avg, cur); - else str.Format(_T("[%d]: %d Kb/s"), i, avg); - sl.AddTail(str); - } - - if(!sl.IsEmpty()) - { - m_wndStatsBar.SetLine(_T("Bitrate"), Implode(sl, ' ') + _T(" (avg/cur)")); - } - - break; - } - } - EndEnumFilters - - if(m_iPlaybackMode == PM_FILE) - { - SetupChapters(); - } - - if(m_iPlaybackMode == PM_DVD) // we also use this timer to update the info panel for dvd playback - { - ULONG ulAvailable, ulCurrent; - - // Location - - CString Location('-'); - - DVD_PLAYBACK_LOCATION2 loc; - ULONG ulNumOfVolumes, ulVolume; - DVD_DISC_SIDE Side; - ULONG ulNumOfTitles; - ULONG ulNumOfChapters; - - if(SUCCEEDED(pDVDI->GetCurrentLocation(&loc)) - && SUCCEEDED(pDVDI->GetNumberOfChapters(loc.TitleNum, &ulNumOfChapters)) - && SUCCEEDED(pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles))) - { - Location.Format(_T("Volume: %02d/%02d, Title: %02d/%02d, Chapter: %02d/%02d"), - ulVolume, ulNumOfVolumes, - loc.TitleNum, ulNumOfTitles, - loc.ChapterNum, ulNumOfChapters); - } - - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), Location); - - // Video - - CString Video('-'); - - DVD_VideoAttributes VATR; - - if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAvailable, &ulCurrent)) - && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) - { - Video.Format(_T("Angle: %02d/%02d, %dx%d %dHz %d:%d"), - ulAvailable, ulCurrent, - VATR.ulSourceResolutionX, VATR.ulSourceResolutionY, VATR.ulFrameRate, - VATR.ulAspectX, VATR.ulAspectY); - } - - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_VIDEO), Video); - - // Audio - - CString Audio('-'); - - DVD_AudioAttributes AATR; - - if(SUCCEEDED(pDVDI->GetCurrentAudio(&ulAvailable, &ulCurrent)) - && SUCCEEDED(pDVDI->GetAudioAttributes(ulCurrent, &AATR))) - { - CString lang; - int len = GetLocaleInfo(AATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64); - lang.ReleaseBufferSetLength(max(len-1, 0)); - - switch(AATR.LanguageExtension) - { - case DVD_AUD_EXT_NotSpecified: - default: break; - case DVD_AUD_EXT_Captions: lang += _T(" (Captions)"); break; - case DVD_AUD_EXT_VisuallyImpaired: lang += _T(" (Visually Impaired)"); break; - case DVD_AUD_EXT_DirectorComments1: lang += _T(" (Director Comments 1)"); break; - case DVD_AUD_EXT_DirectorComments2: lang += _T(" (Director Comments 2)"); break; - } - - CString format; - switch(AATR.AudioFormat) - { - case DVD_AudioFormat_AC3: format = _T("AC3"); break; - case DVD_AudioFormat_MPEG1: - case DVD_AudioFormat_MPEG1_DRC: format = _T("MPEG1"); break; - case DVD_AudioFormat_MPEG2: - case DVD_AudioFormat_MPEG2_DRC: format = _T("MPEG2"); break; - case DVD_AudioFormat_LPCM: format = _T("LPCM"); break; - case DVD_AudioFormat_DTS: format = _T("DTS"); break; - case DVD_AudioFormat_SDDS: format = _T("SDDS"); break; - case DVD_AudioFormat_Other: - default: format = _T("Unknown format"); break; - } - - Audio.Format(_T("%s, %s %dHz %dbits %d channel(s)"), - lang, - format, - AATR.dwFrequency, - AATR.bQuantization, - AATR.bNumberOfChannels); - - m_wndStatusBar.SetStatusBitmap( - AATR.bNumberOfChannels == 1 ? IDB_MONO - : AATR.bNumberOfChannels >= 2 ? IDB_STEREO - : IDB_NOAUDIO); - } - - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUDIO), Audio); - - // Subtitles - - CString Subtitles('-'); - - BOOL bIsDisabled; - DVD_SubpictureAttributes SATR; - - if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulAvailable, &ulCurrent, &bIsDisabled)) - && SUCCEEDED(pDVDI->GetSubpictureAttributes(ulCurrent, &SATR))) - { - CString lang; - int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64); - lang.ReleaseBufferSetLength(max(len-1, 0)); - - switch(SATR.LanguageExtension) - { - case DVD_SP_EXT_NotSpecified: - default: break; - case DVD_SP_EXT_Caption_Normal: lang += _T(""); break; - case DVD_SP_EXT_Caption_Big: lang += _T(" (Big)"); break; - case DVD_SP_EXT_Caption_Children: lang += _T(" (Children)"); break; - case DVD_SP_EXT_CC_Normal: lang += _T(" (CC)"); break; - case DVD_SP_EXT_CC_Big: lang += _T(" (CC Big)"); break; - case DVD_SP_EXT_CC_Children: lang += _T(" (CC Children)"); break; - case DVD_SP_EXT_Forced: lang += _T(" (Forced)"); break; - case DVD_SP_EXT_DirectorComments_Normal: lang += _T(" (Director Comments)"); break; - case DVD_SP_EXT_DirectorComments_Big: lang += _T(" (Director Comments, Big)"); break; - case DVD_SP_EXT_DirectorComments_Children: lang += _T(" (Director Comments, Children)"); break; - } - - if(bIsDisabled) lang = _T("-"); - - Subtitles.Format(_T("%s"), - lang); - } - - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), Subtitles); - } - - if(GetMediaState() == State_Running) - { - UINT fSaverActive = 0; - if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fSaverActive, 0)) - { - SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all... - SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE); - } - - fSaverActive = 0; - if(SystemParametersInfo(SPI_GETPOWEROFFACTIVE, 0, (PVOID)&fSaverActive, 0)) - { - SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all... - SystemParametersInfo(SPI_SETPOWEROFFACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE); - } - } - } - else if(nIDEvent == TIMER_STATUSERASER) - { - KillTimer(TIMER_STATUSERASER); - m_playingmsg.Empty(); - } - - __super::OnTimer(nIDEvent); -} - -static bool SetShutdownPrivilege() -{ - HANDLE hToken; - TOKEN_PRIVILEGES tkp; - - // Get a token for this process. - - if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) - return(false); - - // Get the LUID for the shutdown privilege. - - LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); - - tkp.PrivilegeCount = 1; // one privilege to set - tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - - // Get the shutdown privilege for this process. - - AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); - - if(GetLastError() != ERROR_SUCCESS) - return false; - - return true; -} - -bool CMainFrame::DoAfterPlaybackEvent() -{ - AppSettings& s = AfxGetAppSettings(); - - bool fExit = false; - - if(s.nCLSwitches&CLSW_CLOSE) - { - fExit = true; - } - - if(s.nCLSwitches&CLSW_STANDBY) - { - SetShutdownPrivilege(); - SetSystemPowerState(TRUE, TRUE); - fExit = true; // TODO: unless the app closes, it will call standby or hibernate once again forever, how to avoid that? - } - else if(s.nCLSwitches&CLSW_HIBERNATE) - { - SetShutdownPrivilege(); - SetSystemPowerState(FALSE, TRUE); - fExit = true; // TODO: unless the app closes, it will call standby or hibernate once again forever, how to avoid that? - } - else if(s.nCLSwitches&CLSW_SHUTDOWN) - { - SetShutdownPrivilege(); - ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF|EWX_FORCEIFHUNG, 0); - fExit = true; - } - else if(s.nCLSwitches&CLSW_LOGOFF) - { - SetShutdownPrivilege(); - ExitWindowsEx(EWX_LOGOFF|EWX_FORCEIFHUNG, 0); - fExit = true; - } - - if(!fExit) return false; - - SendMessage(WM_COMMAND, ID_FILE_EXIT); - - return true; -} - -// -// our WM_GRAPHNOTIFY handler -// -#include -LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam) -{ - HRESULT hr = S_OK; - - LONG evCode, evParam1, evParam2; - while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0))) - { - CString str; - - if(m_fCustomGraph) - { - if(EC_BG_ERROR == evCode) - { - str = CString((char*)evParam1); - } - } - - hr = pME->FreeEventParams(evCode, evParam1, evParam2); - - if(EC_COMPLETE == evCode) - { - AppSettings& s = AfxGetAppSettings(); - - if(m_wndPlaylistBar.GetCount() <= 1) - { - m_nLoops++; - - if(DoAfterPlaybackEvent()) return hr; - - if(s.fLoopForever || m_nLoops < s.nLoops) - { - if(GetMediaState() == State_Stopped) - { - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - } - else - { - LONGLONG pos = 0; - pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); - - if(GetMediaState() == State_Paused) - { - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - } - } - } - else - { - if(s.fRewind) SendMessage(WM_COMMAND, ID_PLAY_STOP); - else m_fEndOfStream = true; - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - if(m_fFullScreen && s.fExitFullScreenAtTheEnd) - OnViewFullscreen(); - } - } - else if(m_wndPlaylistBar.GetCount() > 1) - { - if(m_wndPlaylistBar.IsAtEnd()) - { - if(DoAfterPlaybackEvent()) return hr; - - m_nLoops++; - } - - if(s.fLoopForever || m_nLoops < s.nLoops) - { - int nLoops = m_nLoops; - PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD); - m_nLoops = nLoops; - } - else - { - if(m_fFullScreen && s.fExitFullScreenAtTheEnd) - OnViewFullscreen(); - - if(s.fRewind) - { - AfxGetAppSettings().nCLSwitches |= CLSW_OPEN; // HACK - PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD); - } - else - { - m_fEndOfStream = true; - PostMessage(WM_COMMAND, ID_PLAY_PAUSE); - } - } - } - } - else if(EC_ERRORABORT == evCode) - { - TRACE(_T("EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1); -// SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); -// m_closingmsg = _com_error((HRESULT)evParam1).ErrorMessage(); - } - else if(EC_REPAINT == evCode) - { - TRACE(_T("EC_REPAINT\n")); - } - else if(EC_BUFFERING_DATA == evCode) - { - TRACE(_T("EC_BUFFERING_DATA, %d, %d\n"), (HRESULT)evParam1, evParam2); - - m_fBuffering = ((HRESULT)evParam1 != S_OK); - } - else if(EC_STEP_COMPLETE == evCode) - { - if(m_fFrameSteppingActive) - { - m_fFrameSteppingActive = false; - pBA->put_Volume(m_VolumeBeforeFrameStepping); - } - } - else if(EC_DEVICE_LOST == evCode) - { - CComQIPtr pBF; - if(m_iPlaybackMode == PM_CAPTURE - && (!pVidCap && pVidCap == (pBF = (IUnknown*)evParam1) - || !pAudCap && pAudCap == (pBF = (IUnknown*)evParam1)) - && evParam2 == 0) - { - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - } - } - else if(EC_DVD_TITLE_CHANGE == evCode) - { - if(m_iPlaybackMode == PM_FILE) - { - SetupChapters(); - } - else if(m_iPlaybackMode == PM_DVD) - { - m_iDVDTitle = (DWORD)evParam1; - - if(m_iDVDDomain == DVD_DOMAIN_Title) - { - CString Domain; - Domain.Format(_T("Title %d"), m_iDVDTitle); - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain); - } - } - } - else if(EC_DVD_DOMAIN_CHANGE == evCode) - { - m_iDVDDomain = (DVD_DOMAIN)evParam1; - - CString Domain('-'); - - switch(m_iDVDDomain) - { - case DVD_DOMAIN_FirstPlay: Domain = _T("First Play"); break; - case DVD_DOMAIN_VideoManagerMenu: Domain = _T("Video Manager Menu"); break; - case DVD_DOMAIN_VideoTitleSetMenu: Domain = _T("Video Title Set Menu"); break; - case DVD_DOMAIN_Title: Domain.Format(_T("Title %d"), m_iDVDTitle); break; - case DVD_DOMAIN_Stop: Domain = _T("Stop"); break; - default: Domain = _T("-"); break; - } - - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain); - - MoveVideoWindow(); // AR might have changed - } - else if(EC_DVD_CURRENT_HMSF_TIME == evCode) - { - double fps = evParam2 == DVD_TC_FLAG_25fps ? 25.0 - : evParam2 == DVD_TC_FLAG_30fps ? 30.0 - : evParam2 == DVD_TC_FLAG_DropFrame ? 29.97 - : 25.0; - - REFERENCE_TIME rtDur = 0; - - DVD_HMSF_TIMECODE tcDur; - ULONG ulFlags; - if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags))) - rtDur = HMSF2RT(tcDur, fps); - - m_wndSeekBar.Enable(rtDur > 0); - m_wndSeekBar.SetRange(0, rtDur); - - REFERENCE_TIME rtNow = HMSF2RT(*((DVD_HMSF_TIMECODE*)&evParam1), fps); - - m_wndSeekBar.SetPos(rtNow); - - if(m_pSubClock) m_pSubClock->SetTime(rtNow); - } - else if(EC_DVD_ERROR == evCode) - { - TRACE(_T("EC_DVD_ERROR %d %d\n"), evParam1, evParam2); - - CString err; - - switch(evParam1) - { - case DVD_ERROR_Unexpected: default: err = _T("DVD: Unexpected error"); break; - case DVD_ERROR_CopyProtectFail: err = _T("DVD: Copy-Protect Fail"); break; - case DVD_ERROR_InvalidDVD1_0Disc: err = _T("DVD: Invalid DVD 1.x Disc"); break; - case DVD_ERROR_InvalidDiscRegion: err = _T("DVD: Invalid Disc Region"); break; - case DVD_ERROR_LowParentalLevel: err = _T("DVD: Low Parental Level"); break; - case DVD_ERROR_MacrovisionFail: err = _T("DVD: Macrovision Fail"); break; - case DVD_ERROR_IncompatibleSystemAndDecoderRegions: err = _T("DVD: Incompatible System And Decoder Regions"); break; - case DVD_ERROR_IncompatibleDiscAndDecoderRegions: err = _T("DVD: Incompatible Disc And Decoder Regions"); break; - } - - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - - m_closingmsg = err; - } - else if(EC_DVD_WARNING == evCode) - { - TRACE(_T("EC_DVD_WARNING %d %d\n"), evParam1, evParam2); - } - else if(EC_VIDEO_SIZE_CHANGED == evCode) - { - TRACE(_T("EC_VIDEO_SIZE_CHANGED %dx%d\n"), CSize(evParam1)); - - WINDOWPLACEMENT wp; - wp.length = sizeof(wp); - GetWindowPlacement(&wp); - - CSize size(evParam1); - m_fAudioOnly = (size.cx <= 0 || size.cy <= 0); - - if(AfxGetAppSettings().fRememberZoomLevel - && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) - { - ZoomVideoWindow(); - } - else - { - MoveVideoWindow(); - } - - if(m_iMediaLoadState == MLS_LOADED - && !m_fAudioOnly && (AfxGetAppSettings().nCLSwitches&CLSW_FULLSCREEN)) - { - PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN); - AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN; - } - } - else if(EC_LENGTH_CHANGED == evCode) - { - __int64 rtDur = 0; - pMS->GetDuration(&rtDur); - m_wndPlaylistBar.SetCurTime(rtDur); - } - else if(!m_fCustomGraph) - { - TRACE(_T("evCode: %d\n"), evCode); - } - else if(EC_BG_AUDIO_CHANGED == evCode) - { - int nAudioChannels = evParam1; - - m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO - : nAudioChannels >= 2 ? IDB_STEREO - : IDB_NOAUDIO); - } - else if(EC_BG_ERROR == evCode) - { - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error"); - m_wndPlaylistBar.SetCurValid(false); - break; - } - } - - return hr; -} - -LRESULT CMainFrame::OnRepaintRenderLess(WPARAM wParam, LPARAM lParam) -{ - MoveVideoWindow(); - return TRUE; -} - -LRESULT CMainFrame::OnResumeFromState(WPARAM wParam, LPARAM lParam) -{ - int iPlaybackMode = (int)wParam; - - if(iPlaybackMode == PM_FILE) - { - SeekTo(10000i64*int(lParam)); - } - else if(iPlaybackMode == PM_DVD) - { - CComPtr pDvdState; - pDvdState.Attach((IDvdState*)lParam); - if(pDVDC) pDVDC->SetState(pDvdState, DVD_CMD_FLAG_Block, NULL); - } - else if(iPlaybackMode == PM_CAPTURE) - { - // not implemented - } - else - { - ASSERT(0); - return FALSE; - } - - return TRUE; -} - -BOOL CMainFrame::OnButton(UINT id, UINT nFlags, CPoint point) -{ - SetFocus(); - - CRect r; - m_wndView.GetClientRect(r); - m_wndView.MapWindowPoints(this, &r); - - if(id != wmcmd::WDOWN && id != wmcmd::WUP && !r.PtInRect(point)) return FALSE; - - BOOL ret = FALSE; - - AppSettings& s = AfxGetAppSettings(); - POSITION pos = s.wmcmds.GetHeadPosition(); - while(pos) - { - wmcmd& wc = s.wmcmds.GetNext(pos); - if(wc.mouse == id) - { - SendMessage(WM_COMMAND, wc.cmd); - ret = true; - } - } - - return ret; -} - -static bool s_fLDown = false; - -void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point) -{ - SetFocus(); - - bool fClicked = false; - - if(m_iPlaybackMode == PM_DVD) - { - CPoint p = point - m_wndView.GetVideoRect().TopLeft(); - - if(SUCCEEDED(pDVDC->ActivateAtPosition(p)) - || m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu - || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu) - fClicked = true; - } - - if(!fClicked) - { - bool fLeftMouseBtnUnassigned = true; - AppSettings& s = AfxGetAppSettings(); - POSITION pos = s.wmcmds.GetHeadPosition(); - while(pos && fLeftMouseBtnUnassigned) - if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN) - fLeftMouseBtnUnassigned = false; - - if(!m_fFullScreen && (IsCaptionMenuHidden() || fLeftMouseBtnUnassigned)) - { - PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y)); - } - else -{ -s_fLDown = true; - if(OnButton(wmcmd::LDOWN, nFlags, point)) - return; -} - } - - __super::OnLButtonDown(nFlags, point); -} - -void CMainFrame::OnLButtonUp(UINT nFlags, CPoint point) -{ - if(!OnButton(wmcmd::LUP, nFlags, point)) - __super::OnLButtonUp(nFlags, point); -} - -void CMainFrame::OnLButtonDblClk(UINT nFlags, CPoint point) -{ -if(s_fLDown) -{ - SendMessage(WM_LBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y)); -s_fLDown = false; -} - if(!OnButton(wmcmd::LDBLCLK, nFlags, point)) - __super::OnLButtonDblClk(nFlags, point); -} - -void CMainFrame::OnMButtonDown(UINT nFlags, CPoint point) -{ - SendMessage(WM_CANCELMODE); - if(!OnButton(wmcmd::MDOWN, nFlags, point)) - __super::OnMButtonDown(nFlags, point); -} - -void CMainFrame::OnMButtonUp(UINT nFlags, CPoint point) -{ - if(!OnButton(wmcmd::MUP, nFlags, point)) - __super::OnMButtonUp(nFlags, point); -} - -void CMainFrame::OnMButtonDblClk(UINT nFlags, CPoint point) -{ - SendMessage(WM_MBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y)); - if(!OnButton(wmcmd::MDBLCLK, nFlags, point)) - __super::OnMButtonDblClk(nFlags, point); -} - -void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point) -{ - if(!OnButton(wmcmd::RDOWN, nFlags, point)) - __super::OnRButtonDown(nFlags, point); -} - -void CMainFrame::OnRButtonUp(UINT nFlags, CPoint point) -{ - if(!OnButton(wmcmd::RUP, nFlags, point)) - __super::OnRButtonUp(nFlags, point); -} - -void CMainFrame::OnRButtonDblClk(UINT nFlags, CPoint point) -{ - SendMessage(WM_RBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y)); - if(!OnButton(wmcmd::RDBLCLK, nFlags, point)) - __super::OnRButtonDblClk(nFlags, point); -} - -LRESULT CMainFrame::OnXButtonDown(WPARAM wParam, LPARAM lParam) -{ - SendMessage(WM_CANCELMODE); - UINT fwButton = GET_XBUTTON_WPARAM(wParam); - return OnButton(fwButton == XBUTTON1 ? wmcmd::X1DOWN : fwButton == XBUTTON2 ? wmcmd::X2DOWN : wmcmd::NONE, - GET_KEYSTATE_WPARAM(wParam), CPoint(lParam)); -} - -LRESULT CMainFrame::OnXButtonUp(WPARAM wParam, LPARAM lParam) -{ - UINT fwButton = GET_XBUTTON_WPARAM(wParam); - return OnButton(fwButton == XBUTTON1 ? wmcmd::X1UP : fwButton == XBUTTON2 ? wmcmd::X2UP : wmcmd::NONE, - GET_KEYSTATE_WPARAM(wParam), CPoint(lParam)); -} - -LRESULT CMainFrame::OnXButtonDblClk(WPARAM wParam, LPARAM lParam) -{ - SendMessage(WM_XBUTTONDOWN, wParam, lParam); - UINT fwButton = GET_XBUTTON_WPARAM(wParam); - return OnButton(fwButton == XBUTTON1 ? wmcmd::X1DBLCLK : fwButton == XBUTTON2 ? wmcmd::X2DBLCLK : wmcmd::NONE, - GET_KEYSTATE_WPARAM(wParam), CPoint(lParam)); -} - -BOOL CMainFrame::OnMouseWheel(UINT nFlags, short zDelta, CPoint point) -{ - ScreenToClient(&point); - - BOOL fRet = - zDelta > 0 ? OnButton(wmcmd::WUP, nFlags, point) : - zDelta < 0 ? OnButton(wmcmd::WDOWN, nFlags, point) : - FALSE; - - return fRet; -} - -void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) -{ - if(m_iPlaybackMode == PM_DVD) - { - CPoint vp = point - m_wndView.GetVideoRect().TopLeft(); - pDVDC->SelectAtPosition(vp); - } - - CSize diff = m_lastMouseMove - point; - - if(m_fFullScreen && (abs(diff.cx)+abs(diff.cy)) >= 1) - { - int nTimeOut = AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut; - - if(nTimeOut < 0) - { - m_fHideCursor = false; - if(AfxGetAppSettings().fShowBarsWhenFullScreen) - ShowControls(AfxGetAppSettings().nCS); - - KillTimer(TIMER_FULLSCREENCONTROLBARHIDER); - SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL); - } - else if(nTimeOut == 0) - { - CRect r; - GetClientRect(r); - r.top = r.bottom; - - POSITION pos = m_bars.GetHeadPosition(); - for(int i = 1; pos; i <<= 1) - { - CControlBar* pNext = m_bars.GetNext(pos); - CSize s = pNext->CalcFixedLayout(FALSE, TRUE); - if(AfxGetAppSettings().nCS&i) r.top -= s.cy; - } - - // HACK: the controls would cover the menu too early hiding some buttons - if(m_iPlaybackMode == PM_DVD - && (m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu - || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu)) - r.top = r.bottom - 10; - - m_fHideCursor = false; - - if(r.PtInRect(point)) - { - if(AfxGetAppSettings().fShowBarsWhenFullScreen) - ShowControls(AfxGetAppSettings().nCS); - } - else - { - if(AfxGetAppSettings().fShowBarsWhenFullScreen) - ShowControls(CS_NONE, false); - } - - SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL); - } - else - { - m_fHideCursor = false; - if(AfxGetAppSettings().fShowBarsWhenFullScreen) - ShowControls(AfxGetAppSettings().nCS); - - SetTimer(TIMER_FULLSCREENCONTROLBARHIDER, nTimeOut*1000, NULL); - SetTimer(TIMER_FULLSCREENMOUSEHIDER, max(nTimeOut*1000, 2000), NULL); - } - } - - m_lastMouseMove = point; - - __super::OnMouseMove(nFlags, point); -} - -LRESULT CMainFrame::OnNcHitTest(CPoint point) -{ - LRESULT nHitTest = __super::OnNcHitTest(point); - return ((IsCaptionMenuHidden()) && nHitTest == HTCLIENT) ? HTCAPTION : nHitTest; -} - -void CMainFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - if(pScrollBar->IsKindOf(RUNTIME_CLASS(CVolumeCtrl))) - { - OnPlayVolume(0); - } - else if(pScrollBar->IsKindOf(RUNTIME_CLASS(CPlayerSeekBar)) && m_iMediaLoadState == MLS_LOADED) - { - SeekTo(m_wndSeekBar.GetPos(), !!(::GetKeyState(VK_SHIFT)&0x8000)); - } - - __super::OnHScroll(nSBCode, nPos, pScrollBar); -} - -void CMainFrame::OnInitMenu(CMenu* pMenu) -{ - __super::OnInitMenu(pMenu); - - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - - for(UINT i = 0, j = pMenu->GetMenuItemCount(); i < j; i++) - { - CString str; - pMenu->GetMenuString(i, str, MF_BYPOSITION); - - CMenu* pSubMenu = NULL; - - if(str == ResStr(IDS_FAVORITES_POPUP)) - { - SetupFavoritesSubMenu(); - pSubMenu = &m_favorites; - } - - if(pSubMenu) - { - mii.fMask = MIIM_STATE|MIIM_SUBMENU; - mii.fType = MF_POPUP; - mii.hSubMenu = pSubMenu->m_hMenu; - mii.fState = (pSubMenu->GetMenuItemCount() > 0 ? MF_ENABLED : (MF_DISABLED|MF_GRAYED)); - pMenu->SetMenuItemInfo(i, &mii, TRUE); - } - } -} - -void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) -{ - __super::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); - - static CAtlStringMap transl; - - if(transl.IsEmpty()) - { - transl[_T("Navigate")] = IDS_NAVIGATE_POPUP; - transl[_T("Open Disc")] = IDS_OPENCDROM_POPUP; - transl[_T("Filters")] = IDS_FILTERS_POPUP; - transl[_T("Audio")] = IDS_AUDIO_POPUP; - transl[_T("Subtitles")] = IDS_SUBTITLES_POPUP; - transl[_T("Audio Language")] = IDS_AUDIOLANGUAGE_POPUP; - transl[_T("Subtitle Language")] = IDS_SUBTITLELANGUAGE_POPUP; - transl[_T("Video Angle")] = IDS_VIDEOANGLE_POPUP; - transl[_T("Jump To...")] = IDS_JUMPTO_POPUP; - transl[_T("Favorites")] = IDS_FAVORITES_POPUP; - transl[_T("Shaders")] = IDS_SHADER_POPUP; - transl[_T("Video Frame")] = IDS_VIDEOFRAME_POPUP; - transl[_T("PanScan")] = IDS_PANSCAN_POPUP; - transl[_T("Aspect Ratio")] = IDS_ASPECTRATIO_POPUP; - transl[_T("Zoom")] = IDS_ZOOM_POPUP; - } - - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - - for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++) - { - CString str; - pPopupMenu->GetMenuString(i, str, MF_BYPOSITION); - - CString lookupstr = str; - lookupstr.Remove('&'); - - CMenu* pSubMenu = NULL; - - UINT id; - if(transl.Lookup(lookupstr, id)) - { - str = ResStr(id); - // pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, 0, str); - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STRING; - mii.dwTypeData = (LPTSTR)(LPCTSTR)str; - pPopupMenu->SetMenuItemInfo(i, &mii, TRUE); - } - - if(str == ResStr(IDS_NAVIGATE_POPUP)) - { - UINT fState = (m_iMediaLoadState == MLS_LOADED - && (1/*m_iPlaybackMode == PM_DVD *//*|| (m_iPlaybackMode == PM_FILE && m_PlayList.GetCount() > 0)*/)) - ? MF_ENABLED - : (MF_DISABLED|MF_GRAYED); - - pPopupMenu->EnableMenuItem(i, MF_BYPOSITION|fState); - } - else if(str == ResStr(IDS_VIDEOFRAME_POPUP) - || str == ResStr(IDS_PANSCAN_POPUP) - || str == ResStr(IDS_ASPECTRATIO_POPUP) - || str == ResStr(IDS_ZOOM_POPUP)) - { - UINT fState = (m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly) - ? MF_ENABLED - : (MF_DISABLED|MF_GRAYED); - - pPopupMenu->EnableMenuItem(i, MF_BYPOSITION|fState); - } - else if(str == ResStr(IDS_OPENCDROM_POPUP)) - { - SetupOpenCDSubMenu(); - pSubMenu = &m_opencds; - } - else if(str == ResStr(IDS_FILTERS_POPUP)) - { - SetupFiltersSubMenu(); - pSubMenu = &m_filters; - } - else if(str == ResStr(IDS_AUDIO_POPUP)) - { - SetupAudioSwitcherSubMenu(); - pSubMenu = &m_audios; - } - else if(str == ResStr(IDS_SUBTITLES_POPUP)) - { - SetupSubtitlesSubMenu(); - pSubMenu = &m_subtitles; - } - else if(str == ResStr(IDS_AUDIOLANGUAGE_POPUP)) - { - SetupNavAudioSubMenu(); - pSubMenu = &m_navaudio; - } - else if(str == ResStr(IDS_SUBTITLELANGUAGE_POPUP)) - { - SetupNavSubtitleSubMenu(); - pSubMenu = &m_navsubtitle; - } - else if(str == ResStr(IDS_VIDEOANGLE_POPUP)) - { - SetupNavAngleSubMenu(); - pSubMenu = &m_navangle; - } - else if(str == ResStr(IDS_JUMPTO_POPUP)) - { - SetupNavChaptersSubMenu(); - pSubMenu = &m_navchapters; - } - else if(str == ResStr(IDS_FAVORITES_POPUP)) - { - SetupFavoritesSubMenu(); - pSubMenu = &m_favorites; - } - else if(str == ResStr(IDS_SHADER_POPUP)) - { - SetupShadersSubMenu(); - pSubMenu = &m_shaders; - } - - if(pSubMenu) - { - mii.fMask = MIIM_STATE|MIIM_SUBMENU; - mii.fType = MF_POPUP; - mii.hSubMenu = pSubMenu->m_hMenu; - mii.fState = (pSubMenu->GetMenuItemCount() > 0 ? MF_ENABLED : (MF_DISABLED|MF_GRAYED)); - pPopupMenu->SetMenuItemInfo(i, &mii, TRUE); - } - } - - // - - for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++) - { - UINT nID = pPopupMenu->GetMenuItemID(i); - if(nID == ID_SEPARATOR || nID == -1 - || nID >= ID_FAVORITES_FILE_START && nID <= ID_FAVORITES_FILE_END - || nID >= ID_NAVIGATE_CHAP_SUBITEM_START && nID <= ID_NAVIGATE_CHAP_SUBITEM_END) - continue; - - CString str; - pPopupMenu->GetMenuString(i, str, MF_BYPOSITION); - int k = str.Find('\t'); - if(k > 0) str = str.Left(k); - - CString key = CPPageAccelTbl::MakeAccelShortcutLabel(nID); - if(!key.IsEmpty()) str += _T("\t") + key; - - if(key.IsEmpty() && i < 0) continue; - - // BUG(?): this disables menu item update ui calls for some reason... -// pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, nID, str); - - // this works fine - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STRING; - mii.dwTypeData = (LPTSTR)(LPCTSTR)str; - pPopupMenu->SetMenuItemInfo(i, &mii, TRUE); - - } - - // - - bool fPnSPresets = false; - - for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++) - { - UINT nID = pPopupMenu->GetMenuItemID(i); - - if(nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END) - { - do - { - nID = pPopupMenu->GetMenuItemID(i); - pPopupMenu->DeleteMenu(i, MF_BYPOSITION); - j--; - } - while(i < j && nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END); - - nID = pPopupMenu->GetMenuItemID(i); - } - - if(nID == ID_VIEW_RESET) - { - fPnSPresets = true; - } - } - - if(fPnSPresets) - { - AppSettings& s = AfxGetAppSettings(); - int i = 0, j = s.m_pnspresets.GetCount(); - for(; i < j; i++) - { - int k = 0; - CString label = s.m_pnspresets[i].Tokenize(_T(","), k); - pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND, ID_PANNSCAN_PRESETS_START+i, label); - } -// if(j > 0) - { - pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND, ID_PANNSCAN_PRESETS_START+i, ResStr(IDS_PANSCAN_EDIT)); - pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND|MF_SEPARATOR); - } - } -} - -BOOL CMainFrame::OnMenu(CMenu* pMenu) -{ - if(!pMenu) return FALSE; - - KillTimer(TIMER_FULLSCREENMOUSEHIDER); - m_fHideCursor = false; - - CPoint point; - GetCursorPos(&point); - - pMenu->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, point.x+1, point.y+1, this); - - return TRUE; -} - -void CMainFrame::OnMenuPlayerShort() -{ - if(IsCaptionMenuHidden()) - { - OnMenu(m_popupmain.GetSubMenu(0)); - } - else - { - OnMenu(m_popup.GetSubMenu(0)); - } -} - -void CMainFrame::OnMenuPlayerLong() -{ - OnMenu(m_popupmain.GetSubMenu(0)); -} - -void CMainFrame::OnMenuFilters() -{ - SetupFiltersSubMenu(); - OnMenu(&m_filters); -} - -void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI) -{ - if(m_iMediaLoadState == MLS_LOADING) - { - pCmdUI->SetText(ResStr(IDS_CONTROLS_OPENING)); - } - else if(m_iMediaLoadState == MLS_LOADED) - { - CString msg; - - if(!m_playingmsg.IsEmpty()) - { - msg = m_playingmsg; - } - else if(m_fCapturing) - { - msg = ResStr(IDS_CONTROLS_CAPTURING); - - if(pAMDF) - { - long lDropped = 0; - pAMDF->GetNumDropped(&lDropped); - long lNotDropped = 0; - pAMDF->GetNumNotDropped(&lNotDropped); - - if((lDropped + lNotDropped) > 0) - { - CString str; - str.Format(_T(", Total: %d, Dropped: %d"), lDropped + lNotDropped, lDropped); - msg += str; - } - } - - CComPtr pPin; - if(SUCCEEDED(pCGB->FindPin(m_wndCaptureBar.m_capdlg.m_pDst, PINDIR_INPUT, NULL, NULL, FALSE, 0, &pPin))) - { - LONGLONG size = 0; - if(CComQIPtr pStream = pPin) - { - pStream->Commit(STGC_DEFAULT); - - WIN32_FIND_DATA findFileData; - HANDLE h = FindFirstFile(m_wndCaptureBar.m_capdlg.m_file, &findFileData); - if(h != INVALID_HANDLE_VALUE) - { - size = ((LONGLONG)findFileData.nFileSizeHigh << 32) | findFileData.nFileSizeLow; - - CString str; - if(size < 1024i64*1024) - str.Format(_T(", Size: %I64dKB"), size/1024); - else //if(size < 1024i64*1024*1024) - str.Format(_T(", Size: %I64dMB"), size/1024/1024); - msg += str; - - FindClose(h); - } - } - - ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes; - if(GetDiskFreeSpaceEx( - m_wndCaptureBar.m_capdlg.m_file.Left(m_wndCaptureBar.m_capdlg.m_file.ReverseFind('\\')+1), - &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) - { - CString str; - if(FreeBytesAvailable.QuadPart < 1024i64*1024) - str.Format(_T(", Free: %I64dKB"), FreeBytesAvailable.QuadPart/1024); - else //if(FreeBytesAvailable.QuadPart < 1024i64*1024*1024) - str.Format(_T(", Free: %I64dMB"), FreeBytesAvailable.QuadPart/1024/1024); - msg += str; - } - - if(m_wndCaptureBar.m_capdlg.m_pMux) - { - __int64 pos = 0; - CComQIPtr pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux; - if(pMuxMS && SUCCEEDED(pMuxMS->GetCurrentPosition(&pos)) && pos > 0) - { - double bytepersec = 10000000.0 * size / pos; - if(bytepersec > 0) - m_rtDurationOverride = __int64(10000000.0 * (FreeBytesAvailable.QuadPart+size) / bytepersec); - } - } - - if(m_wndCaptureBar.m_capdlg.m_pVidBuffer - || m_wndCaptureBar.m_capdlg.m_pAudBuffer) - { - int nFreeVidBuffers = 0, nFreeAudBuffers = 0; - if(CComQIPtr pVB = m_wndCaptureBar.m_capdlg.m_pVidBuffer) - nFreeVidBuffers = pVB->GetFreeBuffers(); - if(CComQIPtr pAB = m_wndCaptureBar.m_capdlg.m_pAudBuffer) - nFreeAudBuffers = pAB->GetFreeBuffers(); - - CString str; - str.Format(_T(", Free V/A Buffers: %03d/%03d"), nFreeVidBuffers, nFreeAudBuffers); - msg += str; - } - } - } - else if(m_fBuffering) - { - BeginEnumFilters(pGB, pEF, pBF) - { - if(CComQIPtr pAMNS = pBF) - { - long BufferingProgress = 0; - if(SUCCEEDED(pAMNS->get_BufferingProgress(&BufferingProgress)) && BufferingProgress > 0) - { - msg.Format(ResStr(IDS_CONTROLS_BUFFERING), BufferingProgress); - - __int64 start = 0, stop = 0; - m_wndSeekBar.GetRange(start, stop); - m_fLiveWM = (stop == start); - } - break; - } - } - EndEnumFilters - } - else if(pAMOP) - { - __int64 t = 0, c = 0; - if(SUCCEEDED(pAMOP->QueryProgress(&t, &c)) && t > 0 && c < t) - msg.Format(ResStr(IDS_CONTROLS_BUFFERING), c*100/t); - - if(m_fUpdateInfoBar) - OpenSetupInfoBar(); - } - - OAFilterState fs = GetMediaState(); - pCmdUI->SetText( - !msg.IsEmpty() ? msg : - fs == State_Stopped ? ResStr(IDS_CONTROLS_STOPPED) : - (fs == State_Paused || m_fFrameSteppingActive) ? ResStr(IDS_CONTROLS_PAUSED) : - fs == State_Running ? ResStr(IDS_CONTROLS_PLAYING) : - _T("")); - } - else if(m_iMediaLoadState == MLS_CLOSING) - { - pCmdUI->SetText(ResStr(IDS_CONTROLS_CLOSING)); - } - else - { - pCmdUI->SetText(m_closingmsg); - } -} - -void CMainFrame::OnFilePostOpenmedia() -{ - OpenSetupInfoBar(); - - OpenSetupStatsBar(); - - OpenSetupStatusBar(); - - // OpenSetupToolBar(); - - OpenSetupCaptureBar(); - - __int64 rtDur = 0; - pMS->GetDuration(&rtDur); - m_wndPlaylistBar.SetCurTime(rtDur); - - if(m_iPlaybackMode == PM_CAPTURE) - { - ShowControlBar(&m_wndSubresyncBar, FALSE, TRUE); -// ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE); -// ShowControlBar(&m_wndCaptureBar, TRUE, TRUE); - } - - if(m_pCAP) m_pCAP->SetSubtitleDelay(0); - m_iMediaLoadState = MLS_LOADED; - - // IMPORTANT: must not call any windowing msgs before - // this point, it will deadlock when OpenMediaPrivate is - // still running and the renderer window was created on - // the same worker-thread - - { - WINDOWPLACEMENT wp; - wp.length = sizeof(wp); - GetWindowPlacement(&wp); - - // restore magnification - if(IsWindowVisible() && AfxGetAppSettings().fRememberZoomLevel - && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) - { - ZoomVideoWindow(); - } - } - - if(!m_fAudioOnly && (AfxGetAppSettings().nCLSwitches&CLSW_FULLSCREEN)) - { - SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN); - AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN; - } - - SendNowPlayingToMSN(); - SendNowPlayingTomIRC(); -} - -void CMainFrame::OnUpdateFilePostOpenmedia(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADING); -} - -void CMainFrame::OnFilePostClosemedia() -{ - m_wndView.SetVideoRect(); - m_wndSeekBar.Enable(false); - m_wndSeekBar.SetPos(0); - m_wndInfoBar.RemoveAllLines(); - m_wndStatsBar.RemoveAllLines(); - m_wndStatusBar.Clear(); - m_wndStatusBar.ShowTimer(false); - - if(IsWindow(m_wndSubresyncBar.m_hWnd)) - { - ShowControlBar(&m_wndSubresyncBar, FALSE, TRUE); - SetSubtitle(NULL); - } - - if(IsWindow(m_wndCaptureBar.m_hWnd)) - { - ShowControlBar(&m_wndCaptureBar, FALSE, TRUE); - m_wndCaptureBar.m_capdlg.SetupVideoControls(_T(""), NULL, NULL, NULL); - m_wndCaptureBar.m_capdlg.SetupAudioControls(_T(""), NULL, CInterfaceArray()); - } - - RecalcLayout(); - - SetWindowText(ResStr(IDR_MAINFRAME)); - - SetAlwaysOnTop(AfxGetAppSettings().iOnTop); - - // this will prevent any further UI updates on the dynamically added menu items - SetupFiltersSubMenu(); - SetupAudioSwitcherSubMenu(); - SetupSubtitlesSubMenu(); - SetupNavAudioSubMenu(); - SetupNavSubtitleSubMenu(); - SetupNavAngleSubMenu(); - SetupNavChaptersSubMenu(); - SetupFavoritesSubMenu(); - - SendNowPlayingToMSN(); -} - -void CMainFrame::OnUpdateFilePostClosemedia(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(!!m_hWnd && m_iMediaLoadState == MLS_CLOSING); -} - -void CMainFrame::OnBossKey() -{ - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - if(m_fFullScreen) SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN); - SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, -1); -} - -void CMainFrame::OnStreamAudio(UINT nID) -{ - nID -= ID_STREAM_AUDIO_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - CComQIPtr pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB); - if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher - - DWORD cStreams = 0; - if(pSS && SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1) - { - for(int i = 0; i < (int)cStreams; i++) - { - AM_MEDIA_TYPE* pmt = NULL; - DWORD dwFlags = 0; - LCID lcid = 0; - DWORD dwGroup = 0; - WCHAR* pszName = NULL; - if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) - return; - if(pmt) DeleteMediaType(pmt); - if(pszName) CoTaskMemFree(pszName); - - if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE)) - { - pSS->Enable((i+(nID==0?1:cStreams-1))%cStreams, AMSTREAMSELECTENABLE_ENABLE); - break; - } - } - } - else if(m_iPlaybackMode == PM_FILE) SendMessage(WM_COMMAND, ID_OGM_AUDIO_NEXT+nID); - else if(m_iPlaybackMode == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_AUDIO_NEXT+nID); -} - -void CMainFrame::OnStreamSub(UINT nID) -{ - nID -= ID_STREAM_SUB_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - int cnt = 0; - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos) cnt += m_pSubStreams.GetNext(pos)->GetStreamCount(); - - if(cnt > 1) - { - int i = ((m_iSubtitleSel&0x7fffffff)+(nID==0?1:cnt-1))%cnt; - m_iSubtitleSel = i | (m_iSubtitleSel&0x80000000); - UpdateSubtitle(); - SetFocus(); - } - else if(m_iPlaybackMode == PM_FILE) SendMessage(WM_COMMAND, ID_OGM_SUB_NEXT+nID); - else if(m_iPlaybackMode == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_SUB_NEXT+nID); -} - -void CMainFrame::OnStreamSubOnOff() -{ - if(m_iMediaLoadState != MLS_LOADED) return; - - int cnt = 0; - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos) cnt += m_pSubStreams.GetNext(pos)->GetStreamCount(); - - if(cnt > 0) - { - m_iSubtitleSel ^= 0x80000000; - UpdateSubtitle(); - SetFocus(); - } - else if(m_iPlaybackMode == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_SUB_ONOFF); -} - -void CMainFrame::OnOgmAudio(UINT nID) -{ - nID -= ID_OGM_AUDIO_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - CComQIPtr pSS = FindFilter(CLSID_OggSplitter, pGB); - if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB); - if(!pSS) return; - - CAtlArray snds; - int iSel = -1; - - DWORD cStreams = 0; - if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1) - { - for(int i = 0; i < (int)cStreams; i++) - { - AM_MEDIA_TYPE* pmt = NULL; - DWORD dwFlags = 0; - LCID lcid = 0; - DWORD dwGroup = 0; - WCHAR* pszName = NULL; - if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) - return; - - if(dwGroup == 1) - { - if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE)) - iSel = snds.GetCount(); - snds.Add(i); - } - - if(pmt) DeleteMediaType(pmt); - if(pszName) CoTaskMemFree(pszName); - - } - - int cnt = snds.GetCount(); - if(cnt > 1 && iSel >= 0) - pSS->Enable(snds[(iSel+(nID==0?1:cnt-1))%cnt], AMSTREAMSELECTENABLE_ENABLE); - } -} - -void CMainFrame::OnOgmSub(UINT nID) -{ - nID -= ID_OGM_SUB_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - CComQIPtr pSS = FindFilter(CLSID_OggSplitter, pGB); - if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB); - if(!pSS) return; - - CAtlArray subs; - int iSel = -1; - - DWORD cStreams = 0; - if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1) - { - for(int i = 0; i < (int)cStreams; i++) - { - AM_MEDIA_TYPE* pmt = NULL; - DWORD dwFlags = 0; - LCID lcid = 0; - DWORD dwGroup = 0; - WCHAR* pszName = NULL; - if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) - return; - - if(dwGroup == 2) - { - if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE)) - iSel = subs.GetCount(); - subs.Add(i); - } - - if(pmt) DeleteMediaType(pmt); - if(pszName) CoTaskMemFree(pszName); - - } - - int cnt = subs.GetCount(); - if(cnt > 1 && iSel >= 0) - pSS->Enable(subs[(iSel+(nID==0?1:cnt-1))%cnt], AMSTREAMSELECTENABLE_ENABLE); - } -} - -void CMainFrame::OnDvdAngle(UINT nID) -{ - nID -= ID_DVD_ANGLE_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - if(pDVDI && pDVDC) - { - ULONG ulAnglesAvailable, ulCurrentAngle; - if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAnglesAvailable, &ulCurrentAngle)) && ulAnglesAvailable > 1) - { - ulCurrentAngle += nID==0 ? 1 : ulAnglesAvailable-1; - if(ulCurrentAngle > ulAnglesAvailable) ulCurrentAngle = 1; - else if(ulCurrentAngle < 1) ulCurrentAngle = ulAnglesAvailable; - pDVDC->SelectAngle(ulCurrentAngle, DVD_CMD_FLAG_Block, NULL); - } - } -} - -void CMainFrame::OnDvdAudio(UINT nID) -{ - nID -= ID_DVD_AUDIO_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - if(pDVDI && pDVDC) - { - ULONG nStreamsAvailable, nCurrentStream; - if(SUCCEEDED(pDVDI->GetCurrentAudio(&nStreamsAvailable, &nCurrentStream)) && nStreamsAvailable > 1) - pDVDC->SelectAudioStream((nCurrentStream+(nID==0?1:nStreamsAvailable-1))%nStreamsAvailable, DVD_CMD_FLAG_Block, NULL); - } -} - -void CMainFrame::OnDvdSub(UINT nID) -{ - nID -= ID_DVD_SUB_NEXT; - - if(m_iMediaLoadState != MLS_LOADED) return; - - if(pDVDI && pDVDC) - { - ULONG ulStreamsAvailable, ulCurrentStream; - BOOL bIsDisabled; - if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)) - && ulStreamsAvailable > 1) - { - pDVDC->SelectSubpictureStream( - (ulCurrentStream+(nID==0?1:ulStreamsAvailable-1))%ulStreamsAvailable, - DVD_CMD_FLAG_Block, NULL); - } - } -} - -void CMainFrame::OnDvdSubOnOff() -{ - if(m_iMediaLoadState != MLS_LOADED) return; - - if(pDVDI && pDVDC) - { - ULONG ulStreamsAvailable, ulCurrentStream; - BOOL bIsDisabled; - if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))) - { - pDVDC->SetSubpictureState(bIsDisabled, DVD_CMD_FLAG_Block, NULL); - } - } -} - -// -// menu item handlers -// - -// file - -void CMainFrame::OnFileOpenQuick() -{ - if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) return; - - CString filter; - CAtlArray mask; - AfxGetAppSettings().Formats.GetFilter(filter, mask); - - COpenFileDlg fd(mask, true, NULL, NULL, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY, - filter, this); - if(fd.DoModal() != IDOK) return; - - CAtlList fns; - - POSITION pos = fd.GetStartPosition(); - while(pos) fns.AddTail(fd.GetNextPathName(pos)); - - bool fMultipleFiles = false; - - if(fns.GetCount() > 1 - || fns.GetCount() == 1 - && (fns.GetHead()[fns.GetHead().GetLength()-1] == '\\' - || fns.GetHead()[fns.GetHead().GetLength()-1] == '*')) - { - fMultipleFiles = true; - } - - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - - ShowWindow(SW_SHOW); - SetForegroundWindow(); - - m_wndPlaylistBar.Open(fns, fMultipleFiles); - - if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating()) - { - ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE); - } - - OpenCurPlaylistItem(); -} - -void CMainFrame::OnFileOpenmedia() -{ - if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) return; - - COpenDlg dlg; - if(dlg.DoModal() != IDOK || dlg.m_fns.GetCount() == 0) return; - - if(dlg.m_fAppendPlaylist) - { - m_wndPlaylistBar.Append(dlg.m_fns, dlg.m_fMultipleFiles); - return; - } - - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - - ShowWindow(SW_SHOW); - SetForegroundWindow(); - - m_wndPlaylistBar.Open(dlg.m_fns, dlg.m_fMultipleFiles); - - if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating()) - { - ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE); - } - - OpenCurPlaylistItem(); -} - -void CMainFrame::OnUpdateFileOpen(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState != MLS_LOADING); -} - -BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) -{ - if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) - return FALSE; - - if(pCDS->dwData != 0x6ABE51 || pCDS->cbData < sizeof(DWORD)) - return FALSE; - - DWORD len = *((DWORD*)pCDS->lpData); - TCHAR* pBuff = (TCHAR*)((DWORD*)pCDS->lpData + 1); - TCHAR* pBuffEnd = (TCHAR*)((BYTE*)pBuff + pCDS->cbData - sizeof(DWORD)); - - CAtlList cmdln; - - while(len-- > 0) - { - CString str; - while(pBuff < pBuffEnd && *pBuff) str += *pBuff++; - pBuff++; - cmdln.AddTail(str); - } - - AppSettings& s = AfxGetAppSettings(); - - s.ParseCommandLine(cmdln); - - POSITION pos = s.slFilters.GetHeadPosition(); - while(pos) - { - CString fullpath = MakeFullPath(s.slFilters.GetNext(pos)); - - CPath tmp(fullpath); - tmp.RemoveFileSpec(); - tmp.AddBackslash(); - CString path = tmp; - - WIN32_FIND_DATA fd = {0}; - HANDLE hFind = FindFirstFile(fullpath, &fd); - if(hFind != INVALID_HANDLE_VALUE) - { - do - { - if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue; - - CFilterMapper2 fm2(false); - fm2.Register(path + fd.cFileName); - while(!fm2.m_filters.IsEmpty()) - { - if(FilterOverride* f = fm2.m_filters.RemoveTail()) - { - f->fTemporary = true; - - bool fFound = false; - - POSITION pos2 = s.filters.GetHeadPosition(); - while(pos2) - { - FilterOverride* f2 = s.filters.GetNext(pos2); - if(f2->type == FilterOverride::EXTERNAL && !f2->path.CompareNoCase(f->path)) - { - fFound = true; - break; - } - } - - if(!fFound) - { - CAutoPtr p(f); - s.filters.AddHead(p); - } - } - } - } - while(FindNextFile(hFind, &fd)); - - FindClose(hFind); - } - } - - bool fSetForegroundWindow = false; - - if((s.nCLSwitches&CLSW_DVD) && !s.slFiles.IsEmpty()) - { - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - fSetForegroundWindow = true; - - CAutoPtr p(new OpenDVDData()); - if(p) {p->path = s.slFiles.GetHead(); p->subs.AddTailList(&s.slSubs);} - OpenMedia(p); - } - else if(s.nCLSwitches&CLSW_CD) - { - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - fSetForegroundWindow = true; - - CAtlList sl; - - if(!s.slFiles.IsEmpty()) - { - GetCDROMType(s.slFiles.GetHead()[0], sl); - } - else - { - CString dir; - dir.ReleaseBufferSetLength(GetCurrentDirectory(MAX_PATH, dir.GetBuffer(MAX_PATH))); - - GetCDROMType(dir[0], sl); - - for(TCHAR drive = 'C'; sl.IsEmpty() && drive <= 'Z'; drive++) - { - GetCDROMType(drive, sl); - } - } - - m_wndPlaylistBar.Open(sl, true); - OpenCurPlaylistItem(); - } - else if(!s.slFiles.IsEmpty()) - { - bool fMulti = s.slFiles.GetCount() > 1; - - CAtlList sl; - sl.AddTailList(&s.slFiles); - if(!fMulti) sl.AddTailList(&s.slDubs); - - if((s.nCLSwitches&CLSW_ADD) && m_wndPlaylistBar.GetCount() > 0) - { - m_wndPlaylistBar.Append(sl, fMulti, &s.slSubs); - - if(s.nCLSwitches&(CLSW_OPEN|CLSW_PLAY)) - { - m_wndPlaylistBar.SetLast(); - OpenCurPlaylistItem(); - } - } - else - { - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - fSetForegroundWindow = true; - - m_wndPlaylistBar.Open(sl, fMulti, &s.slSubs); - OpenCurPlaylistItem((s.nCLSwitches&CLSW_STARTVALID) ? s.rtStart : 0); - - s.nCLSwitches &= ~CLSW_STARTVALID; - s.rtStart = 0; - } - } - else - { - s.nCLSwitches = CLSW_NONE; - } - - if(fSetForegroundWindow && !(s.nCLSwitches&CLSW_NOFOCUS)) - SetForegroundWindow(); - - s.nCLSwitches &= ~CLSW_NOFOCUS; - - return TRUE; -} - -void CMainFrame::OnFileOpendvd() -{ - if(m_iMediaLoadState == MLS_LOADING) return; - - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - SetForegroundWindow(); - - ShowWindow(SW_SHOW); - - CAutoPtr p(new OpenDVDData()); - if(p) - { - AppSettings& s = AfxGetAppSettings(); - if(s.fUseDVDPath && !s.sDVDPath.IsEmpty()) - { - p->path = s.sDVDPath; - p->path.Replace('/', '\\'); - if(p->path[p->path.GetLength()-1] != '\\') p->path += '\\'; - } - } - OpenMedia(p); -} - -void CMainFrame::OnFileOpendevice() -{ - if(m_iMediaLoadState == MLS_LOADING) return; - - COpenCapDeviceDlg capdlg; - if(capdlg.DoModal() != IDOK) - return; - - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - SetForegroundWindow(); - - ShowWindow(SW_SHOW); - - m_wndPlaylistBar.Empty(); - - CAutoPtr p(new OpenDeviceData()); - if(p) {p->DisplayName[0] = capdlg.m_vidstr; p->DisplayName[1] = capdlg.m_audstr;} - OpenMedia(p); -} - -void CMainFrame::OnFileOpenCD(UINT nID) -{ - nID -= ID_FILE_OPEN_CD_START; - - nID++; - for(TCHAR drive = 'C'; drive <= 'Z'; drive++) - { - CAtlList sl; - - switch(GetCDROMType(drive, sl)) - { - case CDROM_Audio: - case CDROM_VideoCD: - case CDROM_DVDVideo: - nID--; - break; - default: - break; - } - - if(nID == 0) - { - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - SetForegroundWindow(); - - ShowWindow(SW_SHOW); - - m_wndPlaylistBar.Open(sl, true); - OpenCurPlaylistItem(); - - break; - } - } -} - -void CMainFrame::OnDropFiles(HDROP hDropInfo) -{ - SetForegroundWindow(); - - if(m_wndPlaylistBar.IsWindowVisible()) - { - m_wndPlaylistBar.OnDropFiles(hDropInfo); - return; - } - - CAtlList sl; - - UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0); - - for(UINT iFile = 0; iFile < nFiles; iFile++) - { - CString fn; - fn.ReleaseBuffer(::DragQueryFile(hDropInfo, iFile, fn.GetBuffer(MAX_PATH), MAX_PATH)); - sl.AddTail(fn); - } - - ::DragFinish(hDropInfo); - - if(sl.IsEmpty()) return; - - if(sl.GetCount() == 1 && m_iMediaLoadState == MLS_LOADED && m_pCAP) - { - if(LoadSubtitle(sl.GetHead())) - { - SetSubtitle(m_pSubStreams.GetTail()); - CPath p(sl.GetHead()); - p.StripPath(); - SendStatusMessage(CString((LPCTSTR)p) + _T(" loaded successfully"), 3000); - return; - } - } - - m_wndPlaylistBar.Open(sl, true); - OpenCurPlaylistItem(); -} - -void CMainFrame::OnFileSaveAs() -{ - CString ext, in = m_wndPlaylistBar.GetCur(), out = in; - - if(out.Find(_T("://")) < 0) - { - ext = CString(CPath(out).GetExtension()).MakeLower(); - if(ext == _T(".cda")) out = out.Left(out.GetLength()-4) + _T(".wav"); - else if(ext == _T(".ifo")) out = out.Left(out.GetLength()-4) + _T(".vob"); - } - else - { - out.Empty(); - } - - CFileDialog fd(FALSE, 0, out, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST, - _T("All files (*.*)|*.*||"), this, 0); - if(fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) return; - - CPath p(fd.GetPathName()); - if(!ext.IsEmpty()) p.AddExtension(ext); - - OAFilterState fs = State_Stopped; - pMC->GetState(0, &fs); - if(fs == State_Running) pMC->Pause(); - - CSaveDlg dlg(in, p); - dlg.DoModal(); - - if(fs == State_Running) pMC->Run(); -} - -void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI) -{ - if(m_iMediaLoadState != MLS_LOADED || m_iPlaybackMode != PM_FILE) - { - pCmdUI->Enable(FALSE); - return; - } - - CString fn = m_wndPlaylistBar.GetCur(); - CString ext = fn.Mid(fn.ReverseFind('.')+1).MakeLower(); - - int i = fn.Find(_T("://")); - if(i >= 0) - { - CString protocol = fn.Left(i).MakeLower(); - if(protocol != _T("http")) - { - pCmdUI->Enable(FALSE); - return; - } - } - - if((GetVersion()&0x80000000) && (ext == _T("cda") || ext == _T("ifo"))) - { - pCmdUI->Enable(FALSE); - return; - } - - pCmdUI->Enable(TRUE); -} - -bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent) -{ - if(!ppData) return false; - - *ppData = NULL; - size = 0; - - bool fNeedsToPause = !m_pCAP; - if(fNeedsToPause) fNeedsToPause = !IsVMR7InGraph(pGB); - if(fNeedsToPause) fNeedsToPause = !IsVMR9InGraph(pGB); - - OAFilterState fs = GetMediaState(); - - if(!(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (fs == State_Paused || fs == State_Running))) - return false; - - if(fs == State_Running && fNeedsToPause) - { - pMC->Pause(); - GetMediaState(); // wait for completion of the pause command - } - - HRESULT hr = S_OK; - CString errmsg; - - do - { - if(m_pCAP) - { - hr = m_pCAP->GetDIB(NULL, (DWORD*)&size); - if(FAILED(hr)) - { - OnPlayPause();GetMediaState(); // Pause and retry to support ffdshow queueing. - int retry = 0; - while(FAILED(hr) && retry < 20) - { - hr = m_pCAP->GetDIB(*ppData, (DWORD*)&size); - if(SUCCEEDED(hr)) break; - Sleep(1); - retry++; - } - if(FAILED(hr)) - {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;} - } - - if(!(*ppData = new BYTE[size])) return false; - - hr = m_pCAP->GetDIB(*ppData, (DWORD*)&size); - if(FAILED(hr)) {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;} - } - else - { - hr = pBV->GetCurrentImage(&size, NULL); - if(FAILED(hr) || size == 0) {errmsg.Format(_T("GetCurrentImage failed, hr = %08x"), hr); break;} - - if(!(*ppData = new BYTE[size])) return false; - - hr = pBV->GetCurrentImage(&size, (long*)*ppData); - if(FAILED(hr)) {errmsg.Format(_T("GetCurrentImage failed, hr = %08x"), hr); break;} - } - } - while(0); - - if(!fSilent) - { - if(!errmsg.IsEmpty()) - { - AfxMessageBox(errmsg, MB_OK); - } - } - - if(fs == State_Running && GetMediaState() != State_Running) - { - pMC->Run(); - } - - if(FAILED(hr)) - { - if(*ppData) {ASSERT(0); delete [] *ppData; *ppData = NULL;} // huh? - return false; - } - - return true; -} - -#include "jpeg.h" -#include "pngdib.h" - -void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) -{ - CString ext = CString(CPath(fn).GetExtension()).MakeLower(); - - if(ext == _T(".bmp")) - { - if(FILE* f = _tfopen(fn, _T("wb"))) - { - BITMAPINFO* bi = (BITMAPINFO*)pData; - - BITMAPFILEHEADER bfh; - bfh.bfType = 'MB'; - bfh.bfOffBits = sizeof(bfh) + sizeof(bi->bmiHeader); - bfh.bfSize = sizeof(bfh) + size; - bfh.bfReserved1 = bfh.bfReserved2 = 0; - - if(bi->bmiHeader.biBitCount <= 8) - { - if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]); - else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]); - } - - fwrite(&bfh, 1, sizeof(bfh), f); - fwrite(pData, 1, size, f); - - fclose(f); - } - else - { - AfxMessageBox(_T("Cannot create file"), MB_OK); - } - } - else if(ext == _T(".png")) - { - DWORD bmpsize = size; - LPBITMAPINFOHEADER pdib; - LPBITMAPFILEHEADER pbmfh; - void *pbits; - PNGDIB *pngdib; - int ret; - - BITMAPINFO* bi = (BITMAPINFO*)pData; - - BITMAPFILEHEADER bfh; - bfh.bfType = 'MB'; - bfh.bfOffBits = sizeof(bfh) + sizeof(bi->bmiHeader); - bfh.bfSize = sizeof(bfh) + size; - bfh.bfReserved1 = bfh.bfReserved2 = 0; - - if(bi->bmiHeader.biBitCount <= 8) - { - if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]); - else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]); - } - pbmfh = (LPBITMAPFILEHEADER)&bfh; - pbits = &pData[pbmfh->bfOffBits-sizeof(bfh)]; - pdib = (LPBITMAPINFOHEADER)pData; - pngdib = pngdib_d2p_init(); - pngdib_d2p_set_dib(pngdib,pdib,bmpsize,pbits,0); - pngdib_d2p_set_png_filename(pngdib, fn); - pngdib_d2p_set_gamma_label(pngdib, 1, PNGDIB_DEFAULT_FILE_GAMMA); - ret = pngdib_d2p_run(pngdib); - pngdib_done(pngdib); - if(ret) { - CString err_str; - err_str.Format(_T("%s\n%s (%d)"), "Cannot create file", pngdib_get_error_msg(pngdib), ret); - AfxMessageBox(err_str, MB_OK); - } - } - else if(ext == _T(".jpg")) - { - CJpegEncoderFile(fn).Encode(pData); - } - - CPath p(fn); - - if(CDC* pDC = m_wndStatusBar.m_status.GetDC()) - { - CRect r; - m_wndStatusBar.m_status.GetClientRect(r); - p.CompactPath(pDC->m_hDC, r.Width()); - m_wndStatusBar.m_status.ReleaseDC(pDC); - } - - SendStatusMessage((LPCTSTR)p, 3000); -} - -void CMainFrame::SaveImage(LPCTSTR fn) -{ - BYTE* pData = NULL; - long size = 0; - - if(GetDIB(&pData, size)) - { - SaveDIB(fn, pData, size); - delete [] pData; - } -} - -void CMainFrame::SaveThumbnails(LPCTSTR fn) -{ - if(!pMC || !pMS || m_iPlaybackMode != PM_FILE /*&& m_iPlaybackMode != PM_DVD*/) - return; - - REFERENCE_TIME rtPos = GetPos(); - REFERENCE_TIME rtDur = GetDur(); - - if(rtDur <= 0) - { - AfxMessageBox(_T("Cannot create thumbnails for files with no duration")); - return; - } - - pMC->Pause(); - GetMediaState(); // wait for completion of the pause command - - // - - CSize video, wh(0, 0), arxy(0, 0); - - if(m_pCAP) - { - wh = m_pCAP->GetVideoSize(false); - arxy = m_pCAP->GetVideoSize(true); - } - else - { - pBV->GetVideoSize(&wh.cx, &wh.cy); - - long arx = 0, ary = 0; - CComQIPtr pBV2 = pBV; - if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0) - arxy.SetSize(arx, ary); - } - - if(wh.cx <= 0 || wh.cy <= 0) - { - AfxMessageBox(_T("Failed to get video frame size")); - return; - } - - // with the overlay mixer IBasicVideo2 won't tell the new AR when changed dynamically - DVD_VideoAttributes VATR; - if(m_iPlaybackMode == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) - arxy.SetSize(VATR.ulAspectX, VATR.ulAspectY); - - video = (arxy.cx <= 0 || arxy.cy <= 0) ? wh : CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy); - - // - - AppSettings& s = AfxGetAppSettings(); - - int cols = max(1, min(8, s.ThumbCols)); - int rows = max(1, min(8, s.ThumbRows)); - - int margin = 5; - int infoheight = 70; - int width = max(256, min(2048, s.ThumbWidth)); - int height = width * video.cy / video.cx * rows / cols + infoheight; - - int dibsize = sizeof(BITMAPINFOHEADER) + width*height*4; - - CAutoVectorPtr dib; - if(!dib.Allocate(dibsize)) - { - AfxMessageBox(_T("Out of memory, go buy some more!")); - return; - } - - BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)(BYTE*)dib; - memset(bih, 0, sizeof(BITMAPINFOHEADER)); - bih->biSize = sizeof(BITMAPINFOHEADER); - bih->biWidth = width; - bih->biHeight = height; - bih->biPlanes = 1; - bih->biBitCount = 32; - bih->biCompression = BI_RGB; - bih->biSizeImage = width*height*4; - memsetd(bih + 1, 0xffffff, bih->biSizeImage); - - SubPicDesc spd; - spd.w = width; - spd.h = height; - spd.bpp = 32; - spd.pitch = -width*4; - spd.bits = (BYTE*)(bih + 1) + (width*4)*(height-1); - - { - BYTE* p = (BYTE*)spd.bits; - for(int y = 0; y < spd.h; y++, p += spd.pitch) - for(int x = 0; x < spd.w; x++) - ((DWORD*)p)[x] = 0x010101 * (0xe0 + 0x08*y/spd.h + 0x18*(spd.w-x)/spd.w); - } - - CCritSec csSubLock; - RECT bbox; - - for(int i = 1, pics = cols*rows; i <= pics; i++) - { - REFERENCE_TIME rt = rtDur * i / (pics+1); - DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt, 25); - - SeekTo(rt); - - m_VolumeBeforeFrameStepping = m_wndToolBar.Volume; - pBA->put_Volume(-10000); - - HRESULT hr = pFS ? pFS->Step(1, NULL) : E_FAIL; - - if(FAILED(hr)) - { - pBA->put_Volume(m_VolumeBeforeFrameStepping); - AfxMessageBox(_T("Cannot frame step, try a different video renderer.")); - return; - } - - HANDLE hGraphEvent = NULL; - pME->GetEventHandle((OAEVENT*)&hGraphEvent); - - while(hGraphEvent && WaitForSingleObject(hGraphEvent, INFINITE) == WAIT_OBJECT_0) - { - LONG evCode = 0, evParam1, evParam2; - while(SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0))) - { - pME->FreeEventParams(evCode, evParam1, evParam2); - if(EC_STEP_COMPLETE == evCode) hGraphEvent = NULL; - } - } - - pBA->put_Volume(m_VolumeBeforeFrameStepping); - - int col = (i-1)%cols; - int row = (i-1)/cols; - - CSize s((width-margin*2)/cols, (height-margin*2-infoheight)/rows); - CPoint p(margin+col*s.cx, margin+row*s.cy+infoheight); - CRect r(p, s); - r.DeflateRect(margin, margin); - - CRenderedTextSubtitle rts(&csSubLock); - rts.CreateDefaultStyle(0); - rts.m_dstScreenSize.SetSize(width, height); - STSStyle* style = new STSStyle(); - style->marginRect.SetRectEmpty(); - rts.AddStyle(_T("thumbs"), style); - - CStringW str; - str.Format(L"{\\an7\\1c&Hffffff&\\4a&Hb0&\\bord1\\shad4\\be1}{\\p1}m %d %d l %d %d %d %d %d %d{\\p}", - r.left, r.top, r.right, r.top, r.right, r.bottom, r.left, r.bottom); - rts.Add(str, true, 0, 1, _T("thumbs")); - str.Format(L"{\\an3\\1c&Hffffff&\\3c&H000000&\\alpha&H80&\\fs16\\b1\\bord2\\shad0\\pos(%d,%d)}%02d:%02d:%02d", - r.right-5, r.bottom-3, hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds); - rts.Add(str, true, 1, 2, _T("thumbs")); - - rts.Render(spd, 0, 25, bbox); - - BYTE* pData = NULL; - long size = 0; - if(!GetDIB(&pData, size)) return; - - BITMAPINFO* bi = (BITMAPINFO*)pData; - - if(bi->bmiHeader.biBitCount != 32) - { - delete [] pData; - CString str; - str.Format(_T("Invalid image format, cannot create thumbnails out of %d bpp dibs."), bi->bmiHeader.biBitCount); - AfxMessageBox(str); - return; - } - - int sw = bi->bmiHeader.biWidth; - int sh = abs(bi->bmiHeader.biHeight); - int sp = sw*4; - const BYTE* src = pData + sizeof(bi->bmiHeader); - if(bi->bmiHeader.biHeight >= 0) {src += sp*(sh-1); sp = -sp;} - - int dw = spd.w; - int dh = spd.h; - int dp = spd.pitch; - BYTE* dst = (BYTE*)spd.bits + spd.pitch*r.top + r.left*4; - - for(DWORD h = r.bottom - r.top, y = 0, yd = (sh<<8)/h; h > 0; y += yd, h--) - { - DWORD yf = y&0xff; - DWORD yi = y>>8; - - DWORD* s0 = (DWORD*)(src + yi*sp); - DWORD* s1 = (DWORD*)(src + yi*sp + sp); - DWORD* d = (DWORD*)dst; - - for(DWORD w = r.right - r.left, x = 0, xd = (sw<<8)/w; w > 0; x += xd, w--) - { - DWORD xf = x&0xff; - DWORD xi = x>>8; - - DWORD c0 = s0[xi]; - DWORD c1 = s0[xi+1]; - DWORD c2 = s1[xi]; - DWORD c3 = s1[xi+1]; - - c0 = ((c0&0xff00ff) + ((((c1&0xff00ff) - (c0&0xff00ff)) * xf) >> 8)) & 0xff00ff - | ((c0&0x00ff00) + ((((c1&0x00ff00) - (c0&0x00ff00)) * xf) >> 8)) & 0x00ff00; - - c2 = ((c2&0xff00ff) + ((((c3&0xff00ff) - (c2&0xff00ff)) * xf) >> 8)) & 0xff00ff - | ((c2&0x00ff00) + ((((c3&0x00ff00) - (c2&0x00ff00)) * xf) >> 8)) & 0x00ff00; - - c0 = ((c0&0xff00ff) + ((((c2&0xff00ff) - (c0&0xff00ff)) * yf) >> 8)) & 0xff00ff - | ((c0&0x00ff00) + ((((c2&0x00ff00) - (c0&0x00ff00)) * yf) >> 8)) & 0x00ff00; - - *d++ = c0; - } - - dst += dp; - } - - rts.Render(spd, 10000, 25, bbox); - - delete [] pData; - } - - { - CRenderedTextSubtitle rts(&csSubLock); - rts.CreateDefaultStyle(0); - rts.m_dstScreenSize.SetSize(width, height); - STSStyle* style = new STSStyle(); - style->marginRect.SetRect(margin*2, margin*2, margin*2, height-infoheight-margin); - rts.AddStyle(_T("thumbs"), style); - - CStringW str; - str.Format(L"{\\an9\\fs%d\\b1\\bord0\\shad0\\1c&Hffffff&}%s", infoheight-10, width >= 550 ? L"Media Player Classic" : L"MPC"); - - rts.Add(str, true, 0, 1, _T("thumbs"), _T(""), _T(""), CRect(0,0,0,0), -1); - - DVD_HMSF_TIMECODE hmsf = RT2HMSF(rtDur, 25); - - CPath path(m_wndPlaylistBar.GetCur()); - path.StripPath(); - CStringW fn = (LPCTSTR)path; - - CStringW fs; - WIN32_FIND_DATA wfd; - HANDLE hFind = FindFirstFile(m_wndPlaylistBar.GetCur(), &wfd); - if(hFind != INVALID_HANDLE_VALUE) - { - FindClose(hFind); - - __int64 size = (__int64(wfd.nFileSizeHigh)<<32)|wfd.nFileSizeLow; - __int64 shortsize = size; - CStringW measure = _T("B"); - if(shortsize > 10240) shortsize /= 1024, measure = L"KB"; - if(shortsize > 10240) shortsize /= 1024, measure = L"MB"; - if(shortsize > 10240) shortsize /= 1024, measure = L"GB"; - fs.Format(L"File Size: %I64d%s (%I64d bytes)\\N", shortsize, measure, size); - } - - CStringW ar; - if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx != wh.cx && arxy.cy != wh.cy) - ar.Format(L"(%d:%d)", arxy.cx, arxy.cy); - - str.Format(L"{\\an7\\1c&H000000&\\fs16\\b0\\bord0\\shad0}File Name: %s\\N%sResolution: %dx%d %s\\NDuration: %02d:%02d:%02d", - fn, fs, wh.cx, wh.cy, ar, hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds); - rts.Add(str, true, 0, 1, _T("thumbs")); - - rts.Render(spd, 0, 25, bbox); - } - - SaveDIB(fn, (BYTE*)dib, dibsize); - - SeekTo(rtPos); -} - -static CString MakeSnapshotFileName(LPCTSTR prefix) -{ - CTime t = CTime::GetCurrentTime(); - CString fn; - fn.Format(_T("%s%s%s"), prefix, t.Format(_T("%Y%m%d%H%M%S")), AfxGetAppSettings().SnapShotExt); - return fn; -} - -BOOL CMainFrame::IsRendererCompatibleWithSaveImage() -{ - BOOL result = TRUE; - AppSettings& s = AfxGetAppSettings(); - - if(m_fRealMediaGraph) { - if(s.iRMVideoRendererType == VIDRNDT_RM_DEFAULT) { - AfxMessageBox(_T("The 'Save Image' and 'Save Thumbnails' functions do not work with the default video renderer for RealMedia.\nSelect one of the DirectX renderers for RealMedia in MPC's output options and reopen the file.")); - result = FALSE; - } - } else { - if(m_fQuicktimeGraph) { - if(s.iQTVideoRendererType == VIDRNDT_QT_DEFAULT) { - AfxMessageBox(_T("The 'Save Image and 'Save Thumbnails' functions do not work with the default video renderer for QuickTime.\nSelect one of the DirectX renderers for QuickTime in MPC's output options and reopen the file.")); - result = FALSE; - } - } else { - if(m_fShockwaveGraph) { - AfxMessageBox(_T("The 'Save Image' and 'Save Thumbnails' functions do not work for Shockwave files.")); - result = FALSE; - } else { - if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER) { - AfxMessageBox(_T("The 'Save Image' and 'Save Thumbnails' functions do not work with the Overlay Mixer video renderer.\nChange the video renderer in MPC's output options and reopen the file.")); - result = FALSE; - } - } - } - } - return result; -} - -void CMainFrame::OnFileSaveImage() -{ - AppSettings& s = AfxGetAppSettings(); - - /* Check if a compatible renderer is being used */ - if(!IsRendererCompatibleWithSaveImage()) { - return; - } - - CPath psrc(s.SnapShotPath); - psrc.Combine(s.SnapShotPath, MakeSnapshotFileName(_T("snapshot"))); - - CFileDialog fd(FALSE, 0, (LPCTSTR)psrc, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST, - _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png||"), this, 0); - - if(s.SnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1; - else if(s.SnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2; - else if(s.SnapShotExt == _T(".png")) fd.m_pOFN->nFilterIndex = 3; - - if(fd.DoModal() != IDOK) return; - - if(fd.m_pOFN->nFilterIndex == 1) s.SnapShotExt = _T(".bmp"); - else if(fd.m_pOFN->nFilterIndex == 2) s.SnapShotExt = _T(".jpg"); - else if(fd.m_pOFN->nFilterIndex = 3) s.SnapShotExt = _T(".png"); - - CPath pdst(fd.GetPathName()); - if(pdst.GetExtension().MakeLower() != s.SnapShotExt) pdst = CPath((LPCTSTR)pdst + s.SnapShotExt); - CString path = (LPCTSTR)pdst; - pdst.RemoveFileSpec(); - s.SnapShotPath = (LPCTSTR)pdst; - - SaveImage(path); -} - -void CMainFrame::OnFileSaveImageAuto() -{ - AppSettings& s = AfxGetAppSettings(); - - /* Check if a compatible renderer is being used */ - if(!IsRendererCompatibleWithSaveImage()) { - return; - } - - CString fn; - fn.Format(_T("%s\\%s"), AfxGetAppSettings().SnapShotPath, MakeSnapshotFileName(_T("snapshot"))); - SaveImage(fn); -} - -void CMainFrame::OnUpdateFileSaveImage(CCmdUI* pCmdUI) -{ - OAFilterState fs = GetMediaState(); - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (fs == State_Paused || fs == State_Running)); -} - -void CMainFrame::OnFileSaveThumbnails() -{ - AppSettings& s = AfxGetAppSettings(); - - /* Check if a compatible renderer is being used */ - if(!IsRendererCompatibleWithSaveImage()) { - return; - } - - CPath psrc(s.SnapShotPath); - psrc.Combine(s.SnapShotPath, MakeSnapshotFileName(_T("thumbs"))); - - CSaveThumbnailsDialog fd( - s.ThumbRows, s.ThumbCols, s.ThumbWidth, - 0, (LPCTSTR)psrc, - _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png||"), this); - - if(s.SnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1; - else if(s.SnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2; - else if(s.SnapShotExt == _T(".png")) fd.m_pOFN->nFilterIndex = 3; - - if(fd.DoModal() != IDOK) return; - - if(fd.m_pOFN->nFilterIndex == 1) s.SnapShotExt = _T(".bmp"); - else if(fd.m_pOFN->nFilterIndex == 2) s.SnapShotExt = _T(".jpg"); - else if(fd.m_pOFN->nFilterIndex = 3) s.SnapShotExt = _T(".png"); - - s.ThumbRows = fd.m_rows; - s.ThumbCols = fd.m_cols; - s.ThumbWidth = fd.m_width; - - CPath pdst(fd.GetPathName()); - if(pdst.GetExtension().MakeLower() != s.SnapShotExt) pdst = CPath((LPCTSTR)pdst + s.SnapShotExt); - CString path = (LPCTSTR)pdst; - pdst.RemoveFileSpec(); - s.SnapShotPath = (LPCTSTR)pdst; - - SaveThumbnails(path); -} - -void CMainFrame::OnUpdateFileSaveThumbnails(CCmdUI* pCmdUI) -{ - OAFilterState fs = GetMediaState(); - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (m_iPlaybackMode == PM_FILE /*|| m_iPlaybackMode == PM_DVD*/)); -} - -void CMainFrame::OnFileConvert() -{ - CConvertDlg().DoModal(); -} - -void CMainFrame::OnUpdateFileConvert(CCmdUI* pCmdUI) -{ - // TODO: Add your command update UI handler code here -} - -void CMainFrame::OnFileLoadsubtitle() -{ -#ifndef DEBUG - if(!m_pCAP) - { - AfxMessageBox(_T("To load subtitles you have change the video renderer and reopen the file.\n") - _T("- DirectShow: VMR7/VMR9(renderless) or Haali Video Renderer\n") - _T("- RealMedia: Special renderer for RealMedia, or open it through DirectShow\n") - _T("- Quicktime: DX7 or DX9 renderer for QuickTime\n") - , MB_OK); - return; - } -#endif - static TCHAR BASED_CODE szFilter[] = - _T(".srt .sub .ssa .ass .smi .psb .txt .idx .usf .xss .ssf|") - _T("*.srt;*.sub;*.ssa;*.ass;*smi;*.psb;*.txt;*.idx;*.usf;*.xss;*.ssf|") - _T("All files (*.*)|") - _T("*.*||"); - - CFileDialog fd(TRUE, NULL, NULL, - OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY, - szFilter, this, 0); - - if(fd.DoModal() != IDOK) return; - - if(LoadSubtitle(fd.GetPathName())) - SetSubtitle(m_pSubStreams.GetTail()); -} - -void CMainFrame::OnUpdateFileLoadsubtitle(CCmdUI *pCmdUI) -{ -#ifdef DEBUG - pCmdUI->Enable(); -#else - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && /*m_pCAP &&*/ !m_fAudioOnly); -#endif -} - -void CMainFrame::OnFileSavesubtitle() -{ - int i = m_iSubtitleSel; - - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos && i >= 0) - { - CComPtr pSubStream = m_pSubStreams.GetNext(pos); - - if(i < pSubStream->GetStreamCount()) - { - CLSID clsid; - if(FAILED(pSubStream->GetClassID(&clsid))) - continue; - - if(clsid == __uuidof(CVobSubFile)) - { - CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubStream; - - CFileDialog fd(FALSE, NULL, NULL, - OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST, - _T("VobSub (*.idx, *.sub)|*.idx;*.sub||"), this, 0); - - if(fd.DoModal() == IDOK) - { - CAutoLock cAutoLock(&m_csSubLock); - pVSF->Save(fd.GetPathName()); - } - - return; - } - else if(clsid == __uuidof(CRenderedTextSubtitle)) - { - CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream; - - CString filter; - filter += _T("Subripper (*.srt)|*.srt|"); - filter += _T("Microdvd (*.sub)|*.sub|"); - filter += _T("Sami (*.smi)|*.smi|"); - filter += _T("Psb (*.psb)|*.psb|"); - filter += _T("Sub Station Alpha (*.ssa)|*.ssa|"); - filter += _T("Advanced Sub Station Alpha (*.ass)|*.ass|"); - filter += _T("|"); - - CSaveTextFileDialog fd(pRTS->m_encoding, NULL, NULL, filter, this); - - if(fd.DoModal() == IDOK) - { - CAutoLock cAutoLock(&m_csSubLock); - pRTS->SaveAs(fd.GetPathName(), (exttype)(fd.m_ofn.nFilterIndex-1), m_pCAP->GetFPS(), fd.GetEncoding()); - } - - return; - } - } - - i -= pSubStream->GetStreamCount(); - } -} - -void CMainFrame::OnUpdateFileSavesubtitle(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iSubtitleSel >= 0); -} - -/////////////// - -#include "SubtitleDlDlg.h" -#include "ISDb.h" - -void CMainFrame::OnFileISDBSearch() -{ - CStringA url = "http://" + AfxGetAppSettings().ISDb + "/index.php?"; - CStringA args = makeargs(m_wndPlaylistBar.m_pl); - ShellExecute(m_hWnd, _T("open"), CString(url+args), NULL, NULL, SW_SHOWDEFAULT); -} - -void CMainFrame::OnUpdateFileISDBSearch(CCmdUI *pCmdUI) -{ - pCmdUI->Enable(TRUE); -} - -void CMainFrame::OnFileISDBUpload() -{ - CStringA url = "http://" + AfxGetAppSettings().ISDb + "/ul.php?"; - CStringA args = makeargs(m_wndPlaylistBar.m_pl); - ShellExecute(m_hWnd, _T("open"), CString(url+args), NULL, NULL, SW_SHOWDEFAULT); -} - -void CMainFrame::OnUpdateFileISDBUpload(CCmdUI *pCmdUI) -{ - pCmdUI->Enable(m_wndPlaylistBar.GetCount() > 0); -} - -void CMainFrame::OnFileISDBDownload() -{ - filehash fh; - if(!hash(m_wndPlaylistBar.GetCur(), fh)) - { - MessageBeep(-1); - return; - } - - // TODO: put this on a worker thread - - CStringA url = "http://" + AfxGetAppSettings().ISDb + "/index.php?"; - CStringA args; - args.Format("player=mpc&name[0]=%s&size[0]=%016I64x&hash[0]=%016I64x", - UrlEncode(CStringA(fh.name)), fh.size, fh.hash); - - try - { - CInternetSession is; - - CStringA str; - if(!OpenUrl(is, CString(url+args), str)) - { - MessageBeep(-1); - return; - } - - CStringA ticket; - CList movies; - isdb_movie m; - isdb_subtitle s; - - CAtlList sl; - Explode(str, sl, '\n'); - - POSITION pos = sl.GetHeadPosition(); - while(pos) - { - str = sl.GetNext(pos); - - CStringA param = str.Left(max(0, str.Find('='))); - CStringA value = str.Mid(str.Find('=')+1); - - if(param == "ticket") ticket = value; - else if(param == "movie") {m.reset(); Explode(value, m.titles, '|');} - else if(param == "subtitle") {s.reset(); s.id = atoi(value);} - else if(param == "name") s.name = value; - else if(param == "discs") s.discs = atoi(value); - else if(param == "disc_no") s.disc_no = atoi(value); - else if(param == "format") s.format = value; - else if(param == "iso639_2") s.iso639_2 = value; - else if(param == "language") s.language = value; - else if(param == "nick") s.nick = value; - else if(param == "email") s.email = value; - else if(param == "" && value == "endsubtitle") {m.subs.AddTail(s);} - else if(param == "" && value == "endmovie") {movies.AddTail(m);} - else if(param == "" && value == "end") break; - } - - CSubtitleDlDlg dlg(movies, this); - if(IDOK == dlg.DoModal()) - { - if(dlg.m_fReplaceSubs) - m_pSubStreams.RemoveAll(); - - CComPtr pSubStreamToSet; - - POSITION pos = dlg.m_selsubs.GetHeadPosition(); - while(pos) - { - isdb_subtitle& s = dlg.m_selsubs.GetNext(pos); - - CStringA url = "http://" + AfxGetAppSettings().ISDb + "/dl.php?"; - CStringA args; - args.Format("id=%d&ticket=%s", s.id, UrlEncode(ticket)); - - if(OpenUrl(is, CString(url+args), str)) - { - CAutoPtr pRTS(new CRenderedTextSubtitle(&m_csSubLock)); - if(pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(s.name)) && pRTS->GetStreamCount() > 0) - { - CComPtr pSubStream = pRTS.Detach(); - m_pSubStreams.AddTail(pSubStream); - if(!pSubStreamToSet) pSubStreamToSet = pSubStream; - } - } - } - - if(pSubStreamToSet) - SetSubtitle(pSubStreamToSet); - } - } - catch(CInternetException* ie) - { - ie->Delete(); - return; - } -} - -void CMainFrame::OnUpdateFileISDBDownload(CCmdUI *pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_pCAP && !m_fAudioOnly); -} - -void CMainFrame::OnFileProperties() -{ - CPPageFileInfoSheet m_fileinfo(m_wndPlaylistBar.GetCur(), this); - m_fileinfo.DoModal(); -} - -void CMainFrame::OnUpdateFileProperties(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_iPlaybackMode == PM_FILE); -} - -void CMainFrame::OnFileCloseMedia() -{ - CloseMedia(); -} - -void CMainFrame::OnFileClosePlaylist() -{ - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - RestoreDefaultWindowRect(); -} - -void CMainFrame::OnUpdateFileClose(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED || m_iMediaLoadState == MLS_LOADING); -} - -// view - -void CMainFrame::OnViewCaptionmenu() -{ - bool fHideCaptionMenu = AfxGetAppSettings().fHideCaptionMenu; - - AfxGetAppSettings().fHideCaptionMenu = !fHideCaptionMenu; - - if(m_fFullScreen) return; - - DWORD dwRemove = 0, dwAdd = 0; - HMENU hMenu; - - if(!fHideCaptionMenu) - { - dwRemove = WS_CAPTION; - hMenu = NULL; - } - else - { - dwAdd = WS_CAPTION; - hMenu = m_hMenuDefault; - } - - ModifyStyle(dwRemove, dwAdd, SWP_NOZORDER); - ::SetMenu(m_hWnd, hMenu); - SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER); - - MoveVideoWindow(); -} - -void CMainFrame::OnUpdateViewCaptionmenu(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck(!AfxGetAppSettings().fHideCaptionMenu); -} - -void CMainFrame::OnViewControlBar(UINT nID) -{ - nID -= ID_VIEW_SEEKER; - ShowControls(AfxGetAppSettings().nCS ^ (1<m_nID - ID_VIEW_SEEKER; - pCmdUI->SetCheck(!!(AfxGetAppSettings().nCS & (1<SetCheck(m_wndSubresyncBar.IsWindowVisible()); - pCmdUI->Enable(m_pCAP && m_iSubtitleSel >= 0); -} - -void CMainFrame::OnViewPlaylist() -{ - ShowControlBar(&m_wndPlaylistBar, !m_wndPlaylistBar.IsWindowVisible(), TRUE); -} - -void CMainFrame::OnUpdateViewPlaylist(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck(m_wndPlaylistBar.IsWindowVisible()); - pCmdUI->Enable(m_iMediaLoadState == MLS_CLOSED && m_iMediaLoadState != MLS_LOADED - || m_iMediaLoadState == MLS_LOADED /*&& (m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE)*/); -} - -void CMainFrame::OnViewCapture() -{ - ShowControlBar(&m_wndCaptureBar, !m_wndCaptureBar.IsWindowVisible(), TRUE); -} - -void CMainFrame::OnUpdateViewCapture(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck(m_wndCaptureBar.IsWindowVisible()); - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_iPlaybackMode == PM_CAPTURE); -} - -void CMainFrame::OnViewShaderEditor() -{ - ShowControlBar(&m_wndShaderEditorBar, !m_wndShaderEditorBar.IsWindowVisible(), TRUE); -} - -void CMainFrame::OnUpdateViewShaderEditor(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck(m_wndShaderEditorBar.IsWindowVisible()); - pCmdUI->Enable(TRUE); -} - -void CMainFrame::OnViewMinimal() -{ - if(!AfxGetAppSettings().fHideCaptionMenu) - SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU); - ShowControls(0); -} - -void CMainFrame::OnUpdateViewMinimal(CCmdUI* pCmdUI) -{ -} - -void CMainFrame::OnViewCompact() -{ - if(AfxGetAppSettings().fHideCaptionMenu) - SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU); - ShowControls(CS_TOOLBAR); -} - -void CMainFrame::OnUpdateViewCompact(CCmdUI* pCmdUI) -{ -} - -void CMainFrame::OnViewNormal() -{ - if(AfxGetAppSettings().fHideCaptionMenu) - SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU); - ShowControls(CS_SEEKBAR|CS_TOOLBAR|CS_STATUSBAR|CS_INFOBAR); -} - -void CMainFrame::OnUpdateViewNormal(CCmdUI* pCmdUI) -{ -} - -void CMainFrame::OnViewFullscreen() -{ - ToggleFullscreen(true, true); -} - -void CMainFrame::OnViewFullscreenSecondary() -{ - ToggleFullscreen(true, false); -} - -void CMainFrame::OnUpdateViewFullscreen(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly || m_fFullScreen); - pCmdUI->SetCheck(m_fFullScreen); -} - -void CMainFrame::OnViewZoom(UINT nID) -{ - ZoomVideoWindow(nID == ID_VIEW_ZOOM_50 ? 0.5 : nID == ID_VIEW_ZOOM_200 ? 2.0 : 1.0); -} - -void CMainFrame::OnUpdateViewZoom(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly); -} - -void CMainFrame::OnViewZoomAutoFit() -{ - ZoomVideoWindow(GetZoomAutoFitScale()); -} - -void CMainFrame::OnViewDefaultVideoFrame(UINT nID) -{ - AfxGetAppSettings().iDefaultVideoSize = nID - ID_VIEW_VF_HALF; - m_ZoomX = m_ZoomY = 1; - m_PosX = m_PosY = 0.5; - MoveVideoWindow(); -} - -void CMainFrame::OnUpdateViewDefaultVideoFrame(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly); - pCmdUI->SetRadio(AfxGetAppSettings().iDefaultVideoSize == (pCmdUI->m_nID - ID_VIEW_VF_HALF)); -} - -void CMainFrame::OnViewKeepaspectratio() -{ - AfxGetAppSettings().fKeepAspectRatio = !AfxGetAppSettings().fKeepAspectRatio; - MoveVideoWindow(); -} - -void CMainFrame::OnUpdateViewKeepaspectratio(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly); - pCmdUI->SetCheck(AfxGetAppSettings().fKeepAspectRatio); -} - -void CMainFrame::OnViewCompMonDeskARDiff() -{ - AfxGetAppSettings().fCompMonDeskARDiff = !AfxGetAppSettings().fCompMonDeskARDiff; - MoveVideoWindow(); -} - -void CMainFrame::OnUpdateViewCompMonDeskARDiff(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly); - pCmdUI->SetCheck(AfxGetAppSettings().fCompMonDeskARDiff); -} - -void CMainFrame::OnViewPanNScan(UINT nID) -{ - if(m_iMediaLoadState != MLS_LOADED) return; - - int x = 0, y = 0; - int dx = 0, dy = 0; - - switch(nID) - { - case ID_VIEW_RESET: m_ZoomX = m_ZoomY = 1.0; m_PosX = m_PosY = 0.5; m_AngleX = m_AngleY = m_AngleZ = 0; break; - case ID_VIEW_INCSIZE: x = y = 1; break; - case ID_VIEW_DECSIZE: x = y = -1; break; - case ID_VIEW_INCWIDTH: x = 1; break; - case ID_VIEW_DECWIDTH: x = -1; break; - case ID_VIEW_INCHEIGHT: y = 1; break; - case ID_VIEW_DECHEIGHT: y = -1; break; - case ID_PANSCAN_CENTER: m_PosX = m_PosY = 0.5; break; - case ID_PANSCAN_MOVELEFT: dx = -1; break; - case ID_PANSCAN_MOVERIGHT: dx = 1; break; - case ID_PANSCAN_MOVEUP: dy = -1; break; - case ID_PANSCAN_MOVEDOWN: dy = 1; break; - case ID_PANSCAN_MOVEUPLEFT: dx = dy = -1; break; - case ID_PANSCAN_MOVEUPRIGHT: dx = 1; dy = -1; break; - case ID_PANSCAN_MOVEDOWNLEFT: dx = -1; dy = 1; break; - case ID_PANSCAN_MOVEDOWNRIGHT: dx = dy = 1; break; - default: break; - } - - if(x > 0 && m_ZoomX < 3) m_ZoomX *= 1.02; - if(x < 0 && m_ZoomX > 0.2) m_ZoomX /= 1.02; - if(y > 0 && m_ZoomY < 3) m_ZoomY *= 1.02; - if(y < 0 && m_ZoomY > 0.2) m_ZoomY /= 1.02; - - if(dx < 0 && m_PosX > 0) m_PosX = max(m_PosX - 0.005*m_ZoomX, 0); - if(dx > 0 && m_PosX < 1) m_PosX = min(m_PosX + 0.005*m_ZoomX, 1); - if(dy < 0 && m_PosY > 0) m_PosY = max(m_PosY - 0.005*m_ZoomY, 0); - if(dy > 0 && m_PosY < 1) m_PosY = min(m_PosY + 0.005*m_ZoomY, 1); - - MoveVideoWindow(true); -} - -void CMainFrame::OnUpdateViewPanNScan(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly); -} - -void CMainFrame::OnViewPanNScanPresets(UINT nID) -{ - if(m_iMediaLoadState != MLS_LOADED) return; - - AppSettings& s = AfxGetAppSettings(); - - nID -= ID_PANNSCAN_PRESETS_START; - - if(nID == s.m_pnspresets.GetCount()) - { - CPnSPresetsDlg dlg; - dlg.m_pnspresets.Copy(s.m_pnspresets); - if(dlg.DoModal() == IDOK) - { - s.m_pnspresets.Copy(dlg.m_pnspresets); - s.UpdateData(true); - } - return; - } - - m_PosX = 0.5; - m_PosY = 0.5; - m_ZoomX = 1.0; - m_ZoomY = 1.0; - - CString str = s.m_pnspresets[nID]; - - int i = 0, j = 0; - for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++) - { - float f = 0; - if(_stscanf(token, _T("%f"), &f) != 1) continue; - - switch(j) - { - case 0: break; - case 1: m_PosX = f; break; - case 2: m_PosY = f; break; - case 3: m_ZoomX = f; break; - case 4: m_ZoomY = f; break; - default: break; - } - } - - if(j != 5) return; - - m_PosX = min(max(m_PosX, 0), 1); - m_PosY = min(max(m_PosY, 0), 1); - m_ZoomX = min(max(m_ZoomX, 0.2), 3); - m_ZoomY = min(max(m_ZoomY, 0.2), 3); - - MoveVideoWindow(true); -} - -void CMainFrame::OnUpdateViewPanNScanPresets(CCmdUI* pCmdUI) -{ - int nID = pCmdUI->m_nID - ID_PANNSCAN_PRESETS_START; - AppSettings& s = AfxGetAppSettings(); - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && nID >= 0 && nID <= s.m_pnspresets.GetCount()); -} - -void CMainFrame::OnViewRotate(UINT nID) -{ - if(!m_pCAP) return; - - switch(nID) - { - case ID_PANSCAN_ROTATEXP: m_AngleX += 2; break; - case ID_PANSCAN_ROTATEXM: m_AngleX -= 2; break; - case ID_PANSCAN_ROTATEYP: m_AngleY += 2; break; - case ID_PANSCAN_ROTATEYM: m_AngleY -= 2; break; - case ID_PANSCAN_ROTATEZP: m_AngleZ += 2; break; - case ID_PANSCAN_ROTATEZM: m_AngleZ -= 2; break; - default: return; - } - - m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ))); - - CString info; - info.Format(_T("x: %d, y: %d, z: %d"), m_AngleX, m_AngleY, m_AngleZ); - SendStatusMessage(info, 3000); -} - -void CMainFrame::OnUpdateViewRotate(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && m_pCAP); -} - -// FIXME -const static SIZE s_ar[] = {{0,0}, {4,3}, {5,4}, {16,9}}; - -void CMainFrame::OnViewAspectRatio(UINT nID) -{ - CSize& ar = AfxGetAppSettings().AspectRatio; - - ar = s_ar[nID - ID_ASPECTRATIO_START]; - - CString info; - if(ar.cx && ar.cy) info.Format(_T("Aspect Ratio: %d:%d"), ar.cx, ar.cy); - else info.Format(_T("Aspect Ratio: Default")); - SendStatusMessage(info, 3000); - - MoveVideoWindow(); -} - -void CMainFrame::OnUpdateViewAspectRatio(CCmdUI* pCmdUI) -{ - pCmdUI->SetRadio(AfxGetAppSettings().AspectRatio == s_ar[pCmdUI->m_nID - ID_ASPECTRATIO_START]); - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly); -} - -void CMainFrame::OnViewAspectRatioNext() -{ - CSize& ar = AfxGetAppSettings().AspectRatio; - - UINT nID = ID_ASPECTRATIO_START; - - for(int i = 0; i < countof(s_ar); i++) - { - if(ar == s_ar[i]) - { - nID += (i + 1) % countof(s_ar); - break; - } - } - - OnViewAspectRatio(nID); -} - -void CMainFrame::OnViewOntop(UINT nID) -{ - nID -= ID_ONTOP_NEVER; - if(AfxGetAppSettings().iOnTop == nID) - nID = !nID; - SetAlwaysOnTop(nID); -} - -void CMainFrame::OnUpdateViewOntop(CCmdUI* pCmdUI) -{ - pCmdUI->SetRadio(AfxGetAppSettings().iOnTop == (pCmdUI->m_nID - ID_ONTOP_NEVER)); -} - -void CMainFrame::OnViewOptions() -{ - ShowOptions(); -} - -// play - -void CMainFrame::OnPlayPlay() -{ - if(m_iMediaLoadState == MLS_LOADED) - { - if(GetMediaState() == State_Stopped) m_iSpeedLevel = 0; - - if(m_iPlaybackMode == PM_FILE) - { - if(m_fEndOfStream) SendMessage(WM_COMMAND, ID_PLAY_STOP); - pMC->Run(); - } - else if(m_iPlaybackMode == PM_DVD) - { - double dRate = 1.0; - if(m_iSpeedLevel != -4 && m_iSpeedLevel != 0) - dRate = pow(2.0, m_iSpeedLevel >= -3 ? m_iSpeedLevel : (-m_iSpeedLevel - 8)); - - pDVDC->PlayForwards(dRate, DVD_CMD_FLAG_Block, NULL); - pDVDC->Pause(FALSE); - pMC->Run(); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - pMC->Stop(); // audio preview won't be in sync if we run it from paused state - pMC->Run(); - } - - SetTimer(TIMER_STREAMPOSPOLLER, 40, NULL); - SetTimer(TIMER_STREAMPOSPOLLER2, 500, NULL); - SetTimer(TIMER_STATS, 1000, NULL); - - if(m_fFrameSteppingActive) // FIXME - { - m_fFrameSteppingActive = false; - pBA->put_Volume(m_VolumeBeforeFrameStepping); - } - - SetAlwaysOnTop(AfxGetAppSettings().iOnTop); - } - - MoveVideoWindow(); -} - -void CMainFrame::OnPlayPauseI() -{ - if(m_iMediaLoadState == MLS_LOADED) - { - SetAlwaysOnTop(AfxGetAppSettings().iOnTop); - - if(m_iPlaybackMode == PM_FILE) - { - pMC->Pause(); - } - else if(m_iPlaybackMode == PM_DVD) - { - pMC->Pause(); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - pMC->Pause(); - } - - SetTimer(TIMER_STREAMPOSPOLLER, 40, NULL); - SetTimer(TIMER_STREAMPOSPOLLER2, 500, NULL); - SetTimer(TIMER_STATS, 1000, NULL); - } - - MoveVideoWindow(); -} - -void CMainFrame::OnPlayPause() -{ - // Support ffdshow queueing. - // To avoid black out on pause, we have to lock g_ffdshowReceive to synchronize with ReceiveMine. - if(queueu_ffdshow_support) - { - CAutoLock lck(&g_ffdshowReceive); - return OnPlayPauseI(); - } - OnPlayPauseI(); -} - -void CMainFrame::OnPlayPlaypause() -{ - OAFilterState fs = GetMediaState(); - if(fs == State_Running) SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - else if(fs == State_Stopped || fs == State_Paused) SendMessage(WM_COMMAND, ID_PLAY_PLAY); -} - -void CMainFrame::OnPlayStop() -{ - if(m_iMediaLoadState == MLS_LOADED) - { - if(m_iPlaybackMode == PM_FILE) - { - LONGLONG pos = 0; - pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); - pMC->Stop(); - - // BUG: after pause or stop the netshow url source filter won't continue - // on the next play command, unless we cheat it by setting the file name again. - // - // Note: WMPx may be using some undocumented interface to restart streaming. - - BeginEnumFilters(pGB, pEF, pBF) - { - CComQIPtr pAMNS = pBF; - CComQIPtr pFSF = pBF; - if(pAMNS && pFSF) - { - WCHAR* pFN = NULL; - AM_MEDIA_TYPE mt; - if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN) - { - pFSF->Load(pFN, NULL); - CoTaskMemFree(pFN); - } - break; - } - } - EndEnumFilters - } - else if(m_iPlaybackMode == PM_DVD) - { - pDVDC->SetOption(DVD_ResetOnStop, TRUE); - pMC->Stop(); - pDVDC->SetOption(DVD_ResetOnStop, FALSE); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - pMC->Stop(); - } - - m_iSpeedLevel = 0; - - if(m_fFrameSteppingActive) // FIXME - { - m_fFrameSteppingActive = false; - pBA->put_Volume(m_VolumeBeforeFrameStepping); - } - - m_fEndOfStream = false; - } - - m_nLoops = 0; - - if(m_hWnd) - { - KillTimer(TIMER_STREAMPOSPOLLER2); - KillTimer(TIMER_STREAMPOSPOLLER); - KillTimer(TIMER_STATS); - - MoveVideoWindow(); - - if(m_iMediaLoadState == MLS_LOADED) - { - __int64 start, stop; - m_wndSeekBar.GetRange(start, stop); - GUID tf; - pMS->GetTimeFormat(&tf); - m_wndStatusBar.SetStatusTimer(m_wndSeekBar.GetPosReal(), stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf); - - SetAlwaysOnTop(AfxGetAppSettings().iOnTop); - } - } -} - -void CMainFrame::OnUpdatePlayPauseStop(CCmdUI* pCmdUI) -{ - OAFilterState fs = m_fFrameSteppingActive ? State_Paused : GetMediaState(); - - pCmdUI->SetCheck(fs == State_Running && pCmdUI->m_nID == ID_PLAY_PLAY - || fs == State_Paused && pCmdUI->m_nID == ID_PLAY_PAUSE - || fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_STOP - || (fs == State_Paused || fs == State_Running) && pCmdUI->m_nID == ID_PLAY_PLAYPAUSE); - - bool fEnable = false; - - if(fs >= 0) - { - if(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE) - { - fEnable = true; - - if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE && m_fRealMediaGraph) fEnable = false; // can't go into paused state from stopped with rm - else if(m_fCapturing) fEnable = false; - else if(m_fLiveWM && pCmdUI->m_nID == ID_PLAY_PAUSE) fEnable = false; - } - else if(m_iPlaybackMode == PM_DVD) - { - fEnable = m_iDVDDomain != DVD_DOMAIN_VideoManagerMenu - && m_iDVDDomain != DVD_DOMAIN_VideoTitleSetMenu; - - if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE) fEnable = false; - } - } - - pCmdUI->Enable(fEnable); -} - -void CMainFrame::OnPlayFramestep(UINT nID) -{ - REFERENCE_TIME rt; - - if(pFS && m_fQuicktimeGraph) - { - if(GetMediaState() != State_Paused && !queueu_ffdshow_support) - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - pFS->Step(nID == ID_PLAY_FRAMESTEP ? 1 : -1, NULL); - } - else if(pFS && nID == ID_PLAY_FRAMESTEP) - { - if(GetMediaState() != State_Paused) - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - m_fFrameSteppingActive = true; - - m_VolumeBeforeFrameStepping = m_wndToolBar.Volume; - pBA->put_Volume(-10000); - - pFS->Step(1, NULL); - } - else if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME)) - { - if(GetMediaState() != State_Paused) - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - pMS->SetTimeFormat(&TIME_FORMAT_FRAME); - pMS->GetCurrentPosition(&rt); - if(nID == ID_PLAY_FRAMESTEP) rt++; - else if(nID == ID_PLAY_FRAMESTEPCANCEL) rt--; - pMS->SetPositions(&rt, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); - pMS->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME); - } -} - -void CMainFrame::OnUpdatePlayFramestep(CCmdUI* pCmdUI) -{ - bool fEnable = false; - - if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly - && (m_iPlaybackMode != PM_DVD || m_iDVDDomain == DVD_DOMAIN_Title) - && m_iPlaybackMode != PM_CAPTURE - && !m_fLiveWM) - { - REFTIME AvgTimePerFrame = 0; - if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME) - || pCmdUI->m_nID == ID_PLAY_FRAMESTEP && pFS && pFS->CanStep(0, NULL) == S_OK - || m_fQuicktimeGraph && pFS) - { - fEnable = true; - } - } - - pCmdUI->Enable(fEnable); -} - -void CMainFrame::OnPlaySeek(UINT nID) -{ - AppSettings& s = AfxGetAppSettings(); - - REFERENCE_TIME dt = - nID == ID_PLAY_SEEKBACKWARDSMALL ? -10000i64*s.nJumpDistS : - nID == ID_PLAY_SEEKFORWARDSMALL ? +10000i64*s.nJumpDistS : - nID == ID_PLAY_SEEKBACKWARDMED ? -10000i64*s.nJumpDistM : - nID == ID_PLAY_SEEKFORWARDMED ? +10000i64*s.nJumpDistM : - nID == ID_PLAY_SEEKBACKWARDLARGE ? -10000i64*s.nJumpDistL : - nID == ID_PLAY_SEEKFORWARDLARGE ? +10000i64*s.nJumpDistL : - 0; - - if(!dt) return; - - // HACK: the custom graph should support frame based seeking instead - if(m_fShockwaveGraph) dt /= 10000i64*100; - - SeekTo(m_wndSeekBar.GetPos() + dt); -} - -static int rangebsearch(REFERENCE_TIME val, CAtlArray& rta) -{ - int i = 0, j = rta.GetCount() - 1, ret = -1; - - if(j >= 0 && val >= rta[j]) return(j); - - while(i < j) - { - int mid = (i + j) >> 1; - REFERENCE_TIME midt = rta[mid]; - if(val == midt) {ret = mid; break;} - else if(val < midt) {ret = -1; if(j == mid) mid--; j = mid;} - else if(val > midt) {ret = mid; if(i == mid) mid++; i = mid;} - } - - return(ret); -} - -void CMainFrame::OnPlaySeekKey(UINT nID) -{ - if(m_kfs.GetCount() > 0) - { - HRESULT hr; - - if(GetMediaState() == State_Stopped) - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - REFERENCE_TIME rtCurrent, rtDur; - hr = pMS->GetCurrentPosition(&rtCurrent); - hr = pMS->GetDuration(&rtDur); - - int dec = 1; - int i = rangebsearch(rtCurrent, m_kfs); - if(i > 0) dec = (UINT)max(min(rtCurrent - m_kfs[i-1], 10000000), 0); - - rtCurrent = - nID == ID_PLAY_SEEKKEYBACKWARD ? max(rtCurrent - dec, 0) : - nID == ID_PLAY_SEEKKEYFORWARD ? rtCurrent : 0; - - i = rangebsearch(rtCurrent, m_kfs); - - if(nID == ID_PLAY_SEEKKEYBACKWARD) - rtCurrent = m_kfs[max(i, 0)]; - else if(nID == ID_PLAY_SEEKKEYFORWARD && i < m_kfs.GetCount()-1) - rtCurrent = m_kfs[i+1]; - else - return; - - // HACK: if d3d or something changes fpu control word the values of - // m_kfs may be different now (if it was asked again), adding a little - // to the seek position eliminates this error usually. - - rtCurrent += 10; - - hr = pMS->SetPositions( - &rtCurrent, AM_SEEKING_AbsolutePositioning|AM_SEEKING_SeekToKeyFrame, - NULL, AM_SEEKING_NoPositioning); - } -} - -void CMainFrame::OnUpdatePlaySeek(CCmdUI* pCmdUI) -{ - bool fEnable = false; - - OAFilterState fs = GetMediaState(); - - if(m_iMediaLoadState == MLS_LOADED && (fs == State_Paused || fs == State_Running)) - { - fEnable = true; - if(m_iPlaybackMode == PM_DVD && (m_iDVDDomain != DVD_DOMAIN_Title || fs != State_Running)) fEnable = false; - else if(m_iPlaybackMode == PM_CAPTURE) fEnable = false; - } - - pCmdUI->Enable(fEnable); -} - -void CMainFrame::OnPlayGoto() -{ - if(m_iMediaLoadState != MLS_LOADED) - return; - - REFTIME atpf = 0; - if(FAILED(pBV->get_AvgTimePerFrame(&atpf)) || atpf < 0) - { - atpf = 0; - - BeginEnumFilters(pGB, pEF, pBF) - { - if(atpf > 0) break; - - BeginEnumPins(pBF, pEP, pPin) - { - if(atpf > 0) break; - - AM_MEDIA_TYPE mt; - pPin->ConnectionMediaType(&mt); - - if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo) - { - atpf = (REFTIME)((VIDEOINFOHEADER*)mt.pbFormat)->AvgTimePerFrame / 10000000i64; - } - else if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo2) - { - atpf = (REFTIME)((VIDEOINFOHEADER2*)mt.pbFormat)->AvgTimePerFrame / 10000000i64; - } - } - EndEnumPins - } - EndEnumFilters - } - - CGoToDlg dlg((int)(m_wndSeekBar.GetPos()/10000), atpf > 0 ? (float)(1.0/atpf) : 0); - if(IDOK != dlg.DoModal() || dlg.m_time < 0) return; - - SeekTo(10000i64 * dlg.m_time); -} - -void CMainFrame::OnUpdateGoto(CCmdUI* pCmdUI) -{ - bool fEnable = false; - - if(m_iMediaLoadState == MLS_LOADED) - { - fEnable = true; - if(m_iPlaybackMode == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) fEnable = false; - else if(m_iPlaybackMode == PM_CAPTURE) fEnable = false; - } - - pCmdUI->Enable(fEnable); -} - -void CMainFrame::OnPlayChangeRate(UINT nID) -{ - if(m_iMediaLoadState != MLS_LOADED) - return; - - if(m_iPlaybackMode == PM_CAPTURE) - { - if(GetMediaState() != State_Running) - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - long lChannelMin = 0, lChannelMax = 0; - pAMTuner->ChannelMinMax(&lChannelMin, &lChannelMax); - long lChannel = 0, lVivSub = 0, lAudSub = 0; - pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub); - - long lFreqOrg = 0, lFreqNew = -1; - pAMTuner->get_VideoFrequency(&lFreqOrg); - -// long lSignalStrength; - do - { - if(nID == ID_PLAY_DECRATE) lChannel--; - else if(nID == ID_PLAY_INCRATE) lChannel++; - -// if(lChannel < lChannelMin) lChannel = lChannelMax; -// if(lChannel > lChannelMax) lChannel = lChannelMin; - - if(lChannel < lChannelMin || lChannel > lChannelMax) - break; - - if(FAILED(pAMTuner->put_Channel(lChannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT))) - break; - - long flFoundSignal; - pAMTuner->AutoTune(lChannel, &flFoundSignal); - - pAMTuner->get_VideoFrequency(&lFreqNew); - } - while(FALSE); -/* SUCCEEDED(pAMTuner->SignalPresent(&lSignalStrength)) - && (lSignalStrength != AMTUNER_SIGNALPRESENT || lFreqNew == lFreqOrg));*/ - - } - else - { - int iNewSpeedLevel; - - if(nID == ID_PLAY_INCRATE) iNewSpeedLevel = m_iSpeedLevel+1; - else if(nID == ID_PLAY_DECRATE) iNewSpeedLevel = m_iSpeedLevel-1; - else return; - - HRESULT hr = E_FAIL; - - if(iNewSpeedLevel == -4) - { - if(GetMediaState() != State_Paused) - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - if(GetMediaState() == State_Paused) hr = S_OK; - } - else - { - double dRate = pow(2.0, iNewSpeedLevel >= -3 ? iNewSpeedLevel : (-iNewSpeedLevel - 8)); - if(fabs(dRate - 1.0) < 0.01) dRate = 1.0; - - if(GetMediaState() != State_Running) - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - if(m_iPlaybackMode == PM_FILE) - { - hr = pMS->SetRate(dRate); - } - else if(m_iPlaybackMode == PM_DVD) - { - if(iNewSpeedLevel >= -3) - hr = pDVDC->PlayForwards(dRate, DVD_CMD_FLAG_Block, NULL); - else - hr = pDVDC->PlayBackwards(dRate, DVD_CMD_FLAG_Block, NULL); - } - } - - if(SUCCEEDED(hr)) - m_iSpeedLevel = iNewSpeedLevel; - } -} - -void CMainFrame::OnUpdatePlayChangeRate(CCmdUI* pCmdUI) -{ - bool fEnable = false; - - if(m_iMediaLoadState == MLS_LOADED) - { - bool fInc = pCmdUI->m_nID == ID_PLAY_INCRATE; - - fEnable = true; - if(fInc && m_iSpeedLevel >= 3) fEnable = false; - else if(!fInc && m_iPlaybackMode == PM_FILE && m_iSpeedLevel <= -4) fEnable = false; - else if(!fInc && m_iPlaybackMode == PM_DVD && m_iSpeedLevel <= -11) fEnable = false; - else if(m_iPlaybackMode == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) fEnable = false; - else if(m_fRealMediaGraph || m_fShockwaveGraph) fEnable = false; - else if(m_iPlaybackMode == PM_CAPTURE && (!m_wndCaptureBar.m_capdlg.IsTunerActive() || m_fCapturing)) fEnable = false; - else if(m_fLiveWM) fEnable = false; - } - - pCmdUI->Enable(fEnable); -} - -void CMainFrame::OnPlayResetRate() -{ - if(m_iMediaLoadState != MLS_LOADED) - return; - - HRESULT hr = E_FAIL; - - if(GetMediaState() != State_Running) - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - if(m_iPlaybackMode == PM_FILE) - { - hr = pMS->SetRate(1.0); - } - else if(m_iPlaybackMode == PM_DVD) - { - hr = pDVDC->PlayForwards(1.0, DVD_CMD_FLAG_Block, NULL); - } - - if(SUCCEEDED(hr)) - m_iSpeedLevel = 0; -} - -void CMainFrame::OnUpdatePlayResetRate(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED); -} - -void CMainFrame::SetSubtitleDelay(int delay_ms) -{ - if(m_pCAP) { - m_pCAP->SetSubtitleDelay(delay_ms); - } -} - -void CMainFrame::OnPlayChangeAudDelay(UINT nID) -{ - if(CComQIPtr pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB)) - { - REFERENCE_TIME rtShift = pASF->GetAudioTimeShift(); - rtShift += - nID == ID_PLAY_INCAUDDELAY ? 100000 : - nID == ID_PLAY_DECAUDDELAY ? -100000 : - 0; - pASF->SetAudioTimeShift(rtShift); - - CString str; - str.Format(_T("Audio Delay: %I64dms"), rtShift/10000); - SendStatusMessage(str, 3000); - } -} - -void CMainFrame::OnUpdatePlayChangeAudDelay(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(!!pGB /*&& !!FindFilter(__uuidof(CAudioSwitcherFilter), pGB)*/); -} - -#include "ComPropertySheet.h" - -void CMainFrame::OnPlayFilters(UINT nID) -{ -// ShowPPage(m_spparray[nID - ID_FILTERS_SUBITEM_START], m_hWnd); - - CComPtr pUnk = m_pparray[nID - ID_FILTERS_SUBITEM_START]; - - CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), this); - - if(CComQIPtr pSPP = pUnk) - { - ps.AddPages(pSPP); - } - - if(CComQIPtr pBF = pUnk) - { - HRESULT hr; - CComPtr pPP = new CInternalPropertyPageTempl(NULL, &hr); - ps.AddPage(pPP, pBF); - } - - if(ps.GetPageCount() > 0) - { - ps.DoModal(); - OpenSetupStatusBar(); - } -} - -void CMainFrame::OnUpdatePlayFilters(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(!m_fCapturing); -} - -void CMainFrame::OnPlayShaders(UINT nID) -{ - if(nID == ID_SHADERS_START+2) - { - ShowControlBar(&m_wndShaderEditorBar, TRUE, TRUE); - return; - } - - if(!m_pCAP) return; - - if(nID == ID_SHADERS_START) - { - m_shaderlabels.RemoveAll(); - } - else if(nID == ID_SHADERS_START+1) - { - if(IDOK != CShaderCombineDlg(m_shaderlabels, this).DoModal()) - return; - } - else if(nID >= ID_SHADERS_START+3) - { - MENUITEMINFO mii; - memset(&mii, 0, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA; - m_shaders.GetMenuItemInfo(nID, &mii); - - m_shaderlabels.RemoveAll(); - m_shaderlabels.AddTail(((const AppSettings::Shader*)mii.dwItemData)->label); - } - - SetShaders(); -} - -void CMainFrame::OnUpdatePlayShaders(CCmdUI* pCmdUI) -{ - if(pCmdUI->m_nID >= ID_SHADERS_START) - { - pCmdUI->Enable(!!m_pCAP); - - if(pCmdUI->m_nID == ID_SHADERS_START) - { - pCmdUI->SetRadio(m_shaderlabels.IsEmpty()); - } - else if(pCmdUI->m_nID == ID_SHADERS_START+1) - { - pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1); - } - else if(pCmdUI->m_nID == ID_SHADERS_START+2) - { - pCmdUI->Enable(TRUE); - } - else - { - MENUITEMINFO mii; - memset(&mii, 0, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA; - m_shaders.GetMenuItemInfo(pCmdUI->m_nID, &mii); - - pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1 - && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label); - } - } -} - -void CMainFrame::OnPlayAudio(UINT nID) -{ - int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START); - - CComQIPtr pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB); - if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); - - if(i == -1) - { - ShowOptions(CPPageAudioSwitcher::IDD); - } - else if(i >= 0 && pSS) - { - pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE); - } -} - -void CMainFrame::OnUpdatePlayAudio(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID; - int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START); - - CComQIPtr pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB); - if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); - - /*if(i == -1) - { - // TODO**** - } - else*/ if(i >= 0 && pSS) - { - DWORD flags = 0; - - if(SUCCEEDED(pSS->Info(i, NULL, &flags, NULL, NULL, NULL, NULL, NULL))) - { - if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) pCmdUI->SetRadio(TRUE); - else if(flags&AMSTREAMSELECTINFO_ENABLED) pCmdUI->SetCheck(TRUE); - else pCmdUI->SetCheck(FALSE); - } - else - { - pCmdUI->Enable(FALSE); - } - } -} - -void CMainFrame::OnPlaySubtitles(UINT nID) -{ - int i = (int)nID - (4 + ID_SUBTITLES_SUBITEM_START); - - if(i == -4) - { - ShowOptions(CPPageSubtitles::IDD); - } - else if(i == -3) - { - int i = m_iSubtitleSel; - - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos && i >= 0) - { - CComPtr pSubStream = m_pSubStreams.GetNext(pos); - - if(i < pSubStream->GetStreamCount()) - { - CLSID clsid; - if(FAILED(pSubStream->GetClassID(&clsid))) - continue; - - if(clsid == __uuidof(CRenderedTextSubtitle)) - { - CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream; - - CAutoPtrArray pages; - CAtlArray styles; - - POSITION pos = pRTS->m_styles.GetStartPosition(); - for(int i = 0; pos; i++) - { - CString key; - STSStyle* val; - pRTS->m_styles.GetNextAssoc(pos, key, val); - - CAutoPtr page(new CPPageSubStyle()); - page->InitStyle(key, *val); - pages.Add(page); - styles.Add(val); - } - - CPropertySheet dlg(_T("Styles..."), this); - for(int i = 0; i < (int)pages.GetCount(); i++) - dlg.AddPage(pages[i]); - - if(dlg.DoModal() == IDOK) - { - for(int j = 0; j < (int)pages.GetCount(); j++) - pages[j]->GetStyle(*styles[j]); - UpdateSubtitle(false); - } - - return; - } - } - - i -= pSubStream->GetStreamCount(); - } - } - else if(i == -2) - { - ReloadSubtitle(); - } - else if(i == -1) - { - if(m_iSubtitleSel == -1) m_iSubtitleSel = 0; - else m_iSubtitleSel ^= (1<<31); - UpdateSubtitle(); - } - else if(i >= 0) - { - m_iSubtitleSel = i; - UpdateSubtitle(); - } - - AfxGetAppSettings().fEnableSubtitles = !(m_iSubtitleSel & 0x80000000); -} - -void CMainFrame::OnUpdatePlaySubtitles(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID; - int i = (int)nID - (4 + ID_SUBTITLES_SUBITEM_START); - - pCmdUI->Enable(m_pCAP && !m_fAudioOnly); - - if(i == -3) - { - pCmdUI->Enable(FALSE); - - int i = m_iSubtitleSel; - - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos && i >= 0) - { - CComPtr pSubStream = m_pSubStreams.GetNext(pos); - - if(i < pSubStream->GetStreamCount()) - { - CLSID clsid; - if(FAILED(pSubStream->GetClassID(&clsid))) - continue; - - if(clsid == __uuidof(CRenderedTextSubtitle)) - { - pCmdUI->Enable(TRUE); - break; - } - } - - i -= pSubStream->GetStreamCount(); - } - } - else if(i == -1) - { - pCmdUI->SetCheck(m_iSubtitleSel >= 0); - } - else if(i >= 0) - { - pCmdUI->SetRadio(i == abs(m_iSubtitleSel)); - } -} - -void CMainFrame::OnPlayLanguage(UINT nID) -{ - nID -= ID_FILTERSTREAMS_SUBITEM_START; - CComPtr pAMSS = m_ssarray[nID]; - UINT i = nID; - while(i > 0 && pAMSS == m_ssarray[i-1]) i--; - if(FAILED(pAMSS->Enable(nID-i, AMSTREAMSELECTENABLE_ENABLE))) - MessageBeep(-1); - - OpenSetupStatusBar(); -} - -void CMainFrame::OnUpdatePlayLanguage(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID; - nID -= ID_FILTERSTREAMS_SUBITEM_START; - CComPtr pAMSS = m_ssarray[nID]; - UINT i = nID; - while(i > 0 && pAMSS == m_ssarray[i-1]) i--; - DWORD flags = 0; - pAMSS->Info(nID-i, NULL, &flags, NULL, NULL, NULL, NULL, NULL); - if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) pCmdUI->SetRadio(TRUE); - else if(flags&AMSTREAMSELECTINFO_ENABLED) pCmdUI->SetCheck(TRUE); - else pCmdUI->SetCheck(FALSE); -} - -void CMainFrame::OnPlayVolume(UINT nID) -{ - if(m_iMediaLoadState == MLS_LOADED) - { - pBA->put_Volume(m_wndToolBar.Volume); - } -} - -void CMainFrame::OnPlayVolumeBoost(UINT nID) -{ - AppSettings& s = AfxGetAppSettings(); - - int i = (int)(50.0f*log10(s.AudioBoost)); - - switch(nID) - { - case ID_VOLUME_BOOST_INC: i = min(i+10, 100); break; - case ID_VOLUME_BOOST_DEC: i = max(i-10, 0); break; - case ID_VOLUME_BOOST_MIN: i = 0; break; - case ID_VOLUME_BOOST_MAX: i = 100; break; - } - - s.AudioBoost = pow(10.0f, (float)i/50); - - if(CComQIPtr pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB)) - { - bool fNormalize, fNormalizeRecover; - float boost; - pASF->GetNormalizeBoost(fNormalize, fNormalizeRecover, boost); - pASF->SetNormalizeBoost(fNormalize, fNormalizeRecover, s.AudioBoost); - } -} - -void CMainFrame::OnUpdatePlayVolumeBoost(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(); -} - -void CMainFrame::OnAfterplayback(UINT nID) -{ - AppSettings& s = AfxGetAppSettings(); - - s.nCLSwitches &= ~CLSW_AFTERPLAYBACK_MASK; - - switch(nID) - { - case ID_AFTERPLAYBACK_CLOSE: s.nCLSwitches |= CLSW_CLOSE; break; - case ID_AFTERPLAYBACK_STANDBY: s.nCLSwitches |= CLSW_STANDBY; break; - case ID_AFTERPLAYBACK_HIBERNATE: s.nCLSwitches |= CLSW_HIBERNATE; break; - case ID_AFTERPLAYBACK_SHUTDOWN: s.nCLSwitches |= CLSW_SHUTDOWN; break; - case ID_AFTERPLAYBACK_LOGOFF: s.nCLSwitches |= CLSW_LOGOFF; break; - } -} - -void CMainFrame::OnUpdateAfterplayback(CCmdUI* pCmdUI) -{ - AppSettings& s = AfxGetAppSettings(); - - bool fChecked = false; - - switch(pCmdUI->m_nID) - { - case ID_AFTERPLAYBACK_CLOSE: fChecked = !!(s.nCLSwitches & CLSW_CLOSE); break; - case ID_AFTERPLAYBACK_STANDBY: fChecked = !!(s.nCLSwitches & CLSW_STANDBY); break; - case ID_AFTERPLAYBACK_HIBERNATE: fChecked = !!(s.nCLSwitches & CLSW_HIBERNATE); break; - case ID_AFTERPLAYBACK_SHUTDOWN: fChecked = !!(s.nCLSwitches & CLSW_SHUTDOWN); break; - case ID_AFTERPLAYBACK_LOGOFF: fChecked = !!(s.nCLSwitches & CLSW_LOGOFF); break; - case ID_AFTERPLAYBACK_DONOTHING: fChecked = !(s.nCLSwitches & CLSW_AFTERPLAYBACK_MASK); break; - } - - pCmdUI->SetRadio(fChecked); -} - -// navigate - -void CMainFrame::OnNavigateSkip(UINT nID) -{ - if(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE) - { - if(m_iPlaybackMode == PM_FILE) SetupChapters(); - - if(DWORD nChapters = m_pCB->ChapGetCount()) - { - REFERENCE_TIME rtCur; - pMS->GetCurrentPosition(&rtCur); - - REFERENCE_TIME rt = rtCur; - CComBSTR name; - long i; - - if(nID == ID_NAVIGATE_SKIPBACK) - { - rt -= 30000000; - i = m_pCB->ChapLookup(&rt, &name); - } - else if(nID == ID_NAVIGATE_SKIPFORWARD) - { - i = m_pCB->ChapLookup(&rt, &name) + 1; - name.Empty(); - if(i < nChapters) m_pCB->ChapGet(i, &rt, &name); - } - - if(i >= 0 && i < nChapters) - { - SeekTo(rt); - SendStatusMessage(_T("Chapter: ") + CString(name), 3000); - return; - } - } - - if(nID == ID_NAVIGATE_SKIPBACK) - { - SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACKPLITEM); - } - else if(nID == ID_NAVIGATE_SKIPFORWARD) - { - SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARDPLITEM); - } - } - else if(m_iPlaybackMode == PM_DVD) - { - m_iSpeedLevel = 0; - - if(GetMediaState() != State_Running) - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - ULONG ulNumOfVolumes, ulVolume; - DVD_DISC_SIDE Side; - ULONG ulNumOfTitles = 0; - pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles); - - DVD_PLAYBACK_LOCATION2 Location; - pDVDI->GetCurrentLocation(&Location); - - ULONG ulNumOfChapters = 0; - pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters); - - if(nID == ID_NAVIGATE_SKIPBACK) - { - if(Location.ChapterNum == 1 && Location.TitleNum > 1) - { - pDVDI->GetNumberOfChapters(Location.TitleNum-1, &ulNumOfChapters); - pDVDC->PlayChapterInTitle(Location.TitleNum-1, ulNumOfChapters, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); - } - else - { - pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); - } - } - else if(nID == ID_NAVIGATE_SKIPFORWARD) - { - if(Location.ChapterNum == ulNumOfChapters && Location.TitleNum < ulNumOfTitles) - { - pDVDC->PlayChapterInTitle(Location.TitleNum+1, 1, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); - } - else - { - pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); - } - } -/* - if(nID == ID_NAVIGATE_SKIPBACK) - pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block, NULL); - else if(nID == ID_NAVIGATE_SKIPFORWARD) - pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block, NULL); -*/ - } -} - -void CMainFrame::OnUpdateNavigateSkip(CCmdUI* pCmdUI) -{ - // moved to the timer callback function, that runs less frequent -// if(m_iPlaybackMode == PM_FILE) SetupChapters(); - - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED - && ((m_iPlaybackMode == PM_DVD - && m_iDVDDomain != DVD_DOMAIN_VideoManagerMenu - && m_iDVDDomain != DVD_DOMAIN_VideoTitleSetMenu) - || (m_iPlaybackMode == PM_FILE && (m_wndPlaylistBar.GetCount() > 1/*0*/ || m_pCB->ChapGetCount() > 1)) - || (m_iPlaybackMode == PM_CAPTURE && !m_fCapturing))); // TODO -} - -void CMainFrame::OnNavigateSkipPlaylistItem(UINT nID) -{ - if(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE) - { - if(m_wndPlaylistBar.GetCount() == 1) - { - SendMessage(WM_COMMAND, ID_PLAY_STOP); // do not remove this, unless you want a circular call with OnPlayPlay() - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - } - else - { - if(nID == ID_NAVIGATE_SKIPBACKPLITEM) - { - m_wndPlaylistBar.SetPrev(); - } - else if(nID == ID_NAVIGATE_SKIPFORWARDPLITEM) - { - m_wndPlaylistBar.SetNext(); - } - - OpenCurPlaylistItem(); - } - } -} - -void CMainFrame::OnUpdateNavigateSkipPlaylistItem(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED - && ((m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE && !m_fCapturing) && m_wndPlaylistBar.GetCount() > 1/*0*/)); -} - -void CMainFrame::OnNavigateMenu(UINT nID) -{ - nID -= ID_NAVIGATE_TITLEMENU; - - if(m_iMediaLoadState != MLS_LOADED || m_iPlaybackMode != PM_DVD) - return; - - m_iSpeedLevel = 0; - - if(GetMediaState() != State_Running) - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - pDVDC->ShowMenu((DVD_MENU_ID)(nID+2), DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); -} - -void CMainFrame::OnUpdateNavigateMenu(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID - ID_NAVIGATE_TITLEMENU; - ULONG ulUOPs; - - if(m_iMediaLoadState != MLS_LOADED || m_iPlaybackMode != PM_DVD - || FAILED(pDVDI->GetCurrentUOPS(&ulUOPs))) - { - pCmdUI->Enable(FALSE); - return; - } - - pCmdUI->Enable(!(ulUOPs & (UOP_FLAG_ShowMenu_Title << nID))); -} - -void CMainFrame::OnNavigateAudio(UINT nID) -{ - nID -= ID_NAVIGATE_AUDIO_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - OnNavStreamSelectSubMenu(nID, 1); - } - else if(m_iPlaybackMode == PM_DVD) - { - pDVDC->SelectAudioStream(nID, DVD_CMD_FLAG_Block, NULL); - } -} - -void CMainFrame::OnNavigateSubpic(UINT nID) -{ - if(m_iPlaybackMode == PM_FILE) - { - OnNavStreamSelectSubMenu(nID - ID_NAVIGATE_SUBP_SUBITEM_START, 2); - } - else if(m_iPlaybackMode == PM_DVD) - { - int i = (int)nID - (1 + ID_NAVIGATE_SUBP_SUBITEM_START); - - if(i == -1) - { - ULONG ulStreamsAvailable, ulCurrentStream; - BOOL bIsDisabled; - if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))) - pDVDC->SetSubpictureState(bIsDisabled, DVD_CMD_FLAG_Block, NULL); - } - else - { - pDVDC->SelectSubpictureStream(i, DVD_CMD_FLAG_Block, NULL); - pDVDC->SetSubpictureState(TRUE, DVD_CMD_FLAG_Block, NULL); - } - } -} - -void CMainFrame::OnNavigateAngle(UINT nID) -{ - nID -= ID_NAVIGATE_ANGLE_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - OnNavStreamSelectSubMenu(nID, 0); - } - else if(m_iPlaybackMode == PM_DVD) - { - pDVDC->SelectAngle(nID+1, DVD_CMD_FLAG_Block, NULL); - } -} - -void CMainFrame::OnNavigateChapters(UINT nID) -{ - nID -= ID_NAVIGATE_CHAP_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - if((int)nID >= 0 && nID < m_pCB->ChapGetCount()) - { - REFERENCE_TIME rt; - CComBSTR name; - if(SUCCEEDED(m_pCB->ChapGet(nID, &rt, &name))) - { - SeekTo(rt); - SendStatusMessage(_T("Chapter: ") + CString(name), 3000); - } - return; - } - - nID -= m_pCB->ChapGetCount(); - - if((int)nID >= 0 && (int)nID < m_wndPlaylistBar.GetCount() - && m_wndPlaylistBar.GetSelIdx() != (int)nID) - { - m_wndPlaylistBar.SetSelIdx(nID); - OpenCurPlaylistItem(); - } - } - else if(m_iPlaybackMode == PM_DVD) - { - ULONG ulNumOfVolumes, ulVolume; - DVD_DISC_SIDE Side; - ULONG ulNumOfTitles = 0; - pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles); - - DVD_PLAYBACK_LOCATION2 Location; - pDVDI->GetCurrentLocation(&Location); - - ULONG ulNumOfChapters = 0; - pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters); - - nID++; - - if(nID > 0 && nID <= ulNumOfTitles) - { - pDVDC->PlayTitle(nID, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); // sometimes this does not do anything ... - pDVDC->PlayChapterInTitle(nID, 1, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); // ... but this does! - return; - } - - nID -= ulNumOfTitles; - - if(nID > 0 && nID <= ulNumOfChapters) - { - pDVDC->PlayChapter(nID, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); - return; - } - } -} - -void CMainFrame::OnNavigateMenuItem(UINT nID) -{ - nID -= ID_NAVIGATE_MENU_LEFT; - - if(m_iPlaybackMode == PM_DVD) - { - switch(nID) - { - case 0: pDVDC->SelectRelativeButton(DVD_Relative_Left); break; - case 1: pDVDC->SelectRelativeButton(DVD_Relative_Right); break; - case 2: pDVDC->SelectRelativeButton(DVD_Relative_Upper); break; - case 3: pDVDC->SelectRelativeButton(DVD_Relative_Lower); break; - case 4: pDVDC->ActivateButton(); break; - case 5: pDVDC->ReturnFromSubmenu(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); break; - case 6: pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); break; - default: break; - } - } -} - -void CMainFrame::OnUpdateNavigateMenuItem(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID - ID_NAVIGATE_MENU_LEFT; - pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_iPlaybackMode == PM_DVD); -} - -// favorites - -class CDVDStateStream : public CUnknown, public IStream -{ - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) - { - return - QI(IStream) - CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - - __int64 m_pos; - -public: - CDVDStateStream() : CUnknown(NAME("CDVDStateStream"), NULL) {m_pos = 0;} - - DECLARE_IUNKNOWN; - - CAtlArray m_data; - - // ISequentialStream - STDMETHODIMP Read(void* pv, ULONG cb, ULONG* pcbRead) - { - __int64 cbRead = min(m_data.GetCount() - m_pos, (__int64)cb); - cbRead = max(cbRead, 0); - memcpy(pv, &m_data[(INT_PTR)m_pos], (int)cbRead); - if(pcbRead) *pcbRead = (ULONG)cbRead; - m_pos += cbRead; - return S_OK; - } - STDMETHODIMP Write(const void* pv, ULONG cb, ULONG* pcbWritten) - { - BYTE* p = (BYTE*)pv; - ULONG cbWritten = -1; - while(++cbWritten < cb) - m_data.Add(*p++); - if(pcbWritten) *pcbWritten = cbWritten; - return S_OK; - } - - // IStream - STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) {return E_NOTIMPL;} - STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) {return E_NOTIMPL;} - STDMETHODIMP CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) {return E_NOTIMPL;} - STDMETHODIMP Commit(DWORD grfCommitFlags) {return E_NOTIMPL;} - STDMETHODIMP Revert() {return E_NOTIMPL;} - STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;} - STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;} - STDMETHODIMP Stat(STATSTG* pstatstg, DWORD grfStatFlag) {return E_NOTIMPL;} - STDMETHODIMP Clone(IStream** ppstm) {return E_NOTIMPL;} -}; - - -void CMainFrame::OnFavoritesAdd() -{ - AppSettings& s = AfxGetAppSettings(); - - if(m_iPlaybackMode == PM_FILE) - { - CString fn = m_wndPlaylistBar.GetCur(); - if(fn.IsEmpty()) return; - - CString desc = fn; - desc.Replace('\\', '/'); - int i = desc.Find(_T("://")), j = desc.Find(_T("?")), k = desc.ReverseFind('/'); - if(i >= 0) desc = j >= 0 ? desc.Left(j) : desc; - else if(k >= 0) desc = desc.Mid(k+1); - - CFavoriteAddDlg dlg(desc, fn); - if(dlg.DoModal() != IDOK) return; - - CString str = dlg.m_name; - str.Remove(';'); - - CString pos(_T("0")); - if(dlg.m_fRememberPos) - pos.Format(_T("%I64d"), GetPos()); - - str += ';'; - str += pos; - - CPlaylistItem pli; - if(m_wndPlaylistBar.GetCur(pli)) - { - POSITION pos = pli.m_fns.GetHeadPosition(); - while(pos) str += _T(";") + pli.m_fns.GetNext(pos); - } - - s.AddFav(FAV_FILE, str); - } - else if(m_iPlaybackMode == PM_DVD) - { - WCHAR path[MAX_PATH]; - ULONG len = 0; - pDVDI->GetDVDDirectory(path, MAX_PATH, &len); - CString fn = path; - fn.TrimRight(_T("/\\")); - - DVD_PLAYBACK_LOCATION2 Location; - pDVDI->GetCurrentLocation(&Location); - CString desc; - desc.Format(_T("%s - T%02d C%02d - %02d:%02d:%02d"), fn, Location.TitleNum, Location.ChapterNum, - Location.TimeCode.bHours, Location.TimeCode.bMinutes, Location.TimeCode.bSeconds); - - CFavoriteAddDlg dlg(fn, desc); - if(dlg.DoModal() != IDOK) return; - - CString str = dlg.m_name; - str.Remove(';'); - - CString pos(_T("0")); - if(dlg.m_fRememberPos) - { - CDVDStateStream stream; - stream.AddRef(); - - CComPtr pStateData; - CComQIPtr pPersistStream; - if(SUCCEEDED(pDVDI->GetState(&pStateData)) - && (pPersistStream = pStateData) - && SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream))) - { - pos = BinToCString(stream.m_data.GetData(), stream.m_data.GetCount()); - } - } - - str += ';'; - str += pos; - - str += ';'; - str += fn; - - s.AddFav(FAV_DVD, str); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - // TODO - } -} - -void CMainFrame::OnUpdateFavoritesAdd(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_DVD); -} - -void CMainFrame::OnFavoritesOrganize() -{ - CFavoriteOrganizeDlg dlg; - dlg.DoModal(); -} - -void CMainFrame::OnUpdateFavoritesOrganize(CCmdUI* pCmdUI) -{ - // TODO: Add your command update UI handler code here -} - -void CMainFrame::OnFavoritesFile(UINT nID) -{ - nID -= ID_FAVORITES_FILE_START; - - CAtlList sl; - AfxGetAppSettings().GetFav(FAV_FILE, sl); - - if(POSITION pos = sl.FindIndex(nID)) - { - CAtlList fns; - REFERENCE_TIME rtStart = 0; - - int i = 0, j = 0; - for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i); - !s2.IsEmpty(); - s2 = s1.Tokenize(_T(";"), i), j++) - { - if(j == 0) ; // desc - else if(j == 1) _stscanf(s2, _T("%I64d"), &rtStart); // pos - else fns.AddTail(s2); // subs - } - - m_wndPlaylistBar.Open(fns, false); - OpenCurPlaylistItem(max(rtStart, 0)); - } -} - -void CMainFrame::OnUpdateFavoritesFile(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID - ID_FAVORITES_FILE_START; -} - -void CMainFrame::OnFavoritesDVD(UINT nID) -{ - nID -= ID_FAVORITES_DVD_START; - - CAtlList sl; - AfxGetAppSettings().GetFav(FAV_DVD, sl); - - if(POSITION pos = sl.FindIndex(nID)) - { - CString fn; - - CDVDStateStream stream; - stream.AddRef(); - - int i = 0, j = 0; - for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i); - !s2.IsEmpty(); - s2 = s1.Tokenize(_T(";"), i), j++) - { - if(j == 0) ; // desc - else if(j == 1 && s2 != _T("0")) // state - { - CStringToBin(s2, stream.m_data); - } - else if(j == 2) fn = s2; // path - } - - SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA); - - CComPtr pDvdState; - HRESULT hr = OleLoadFromStream((IStream*)&stream, IID_IDvdState, (void**)&pDvdState); - - CAutoPtr p(new OpenDVDData()); - if(p) {p->path = fn; p->pDvdState = pDvdState;} - OpenMedia(p); - } -} - -void CMainFrame::OnUpdateFavoritesDVD(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID - ID_FAVORITES_DVD_START; -} - -void CMainFrame::OnFavoritesDevice(UINT nID) -{ - nID -= ID_FAVORITES_DEVICE_START; -} - -void CMainFrame::OnUpdateFavoritesDevice(CCmdUI* pCmdUI) -{ - UINT nID = pCmdUI->m_nID - ID_FAVORITES_DEVICE_START; -} - -// help - -void CMainFrame::OnHelpHomepage() -{ - ShellExecute(m_hWnd, _T("open"), _T("http://sourceforge.net/projects/guliverkli2/"), NULL, NULL, SW_SHOWDEFAULT); -} - -void CMainFrame::OnHelpDocumentation() -{ - ShellExecute(m_hWnd, _T("open"), _T("http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=144472"), NULL, NULL, SW_SHOWDEFAULT); -} - -////////////////////////////////// - -static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) -{ - CAtlArray* ml = (CAtlArray*)dwData; - ml->Add(hMonitor); - return TRUE; -} - -void CMainFrame::SetDefaultWindowRect(int iMonitor) -{ - AppSettings& s = AfxGetAppSettings(); - - { - CRect r1, r2; - GetClientRect(&r1); - m_wndView.GetClientRect(&r2); - - CSize logosize = m_wndView.GetLogoSize(); - int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW); - int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH); - - if(GetSystemMetrics(SM_REMOTESESSION)) - _DEFCLIENTH = 0; - - DWORD style = GetStyle(); - - MENUBARINFO mbi; - memset(&mbi, 0, sizeof(mbi)); - mbi.cbSize = sizeof(mbi); - ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi); - - int w = _DEFCLIENTW + GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2 - + r1.Width() - r2.Width(); - int h = _DEFCLIENTH + GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2 - + (mbi.rcBar.bottom - mbi.rcBar.top) - + r1.Height() - r2.Height() - + 1; // ??? -// + 2; // ??? - if(style&WS_CAPTION) h += GetSystemMetrics(SM_CYCAPTION); - - if(s.HasFixedWindowSize()) - { - w = s.fixedWindowSize.cx; - h = s.fixedWindowSize.cy; - } - else if(s.fRememberWindowSize) - { - w = s.rcLastWindowPos.Width(); - h = s.rcLastWindowPos.Height(); - } - - HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); - - if(iMonitor > 0) - { - iMonitor--; - CAtlArray ml; - EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&ml); - if(iMonitor < ml.GetCount()) hMonitor = ml[iMonitor]; - } - - MONITORINFO mi; - mi.cbSize = sizeof(MONITORINFO); - GetMonitorInfo(hMonitor, &mi); - - int x = (mi.rcWork.left+mi.rcWork.right-w)/2; - int y = (mi.rcWork.top+mi.rcWork.bottom-h)/2; - - if(s.fRememberWindowPos) - { - CRect r = s.rcLastWindowPos; -// x = r.CenterPoint().x - w/2; -// y = r.CenterPoint().y - h/2; - x = r.TopLeft().x; - y = r.TopLeft().y; - } - - UINT lastWindowType = s.lastWindowType; - - MoveWindow(x, y, w, h); - - if(s.fRememberWindowSize && s.fRememberWindowPos) - { - WINDOWPLACEMENT wp; - memset(&wp, 0, sizeof(wp)); - wp.length = sizeof(WINDOWPLACEMENT); - if(lastWindowType == SIZE_MAXIMIZED) - ShowWindow(SW_MAXIMIZE); - else if(lastWindowType == SIZE_MINIMIZED) - ShowWindow(SW_MINIMIZE); - } - } - - if(s.fHideCaptionMenu) - { - ModifyStyle(WS_CAPTION, 0, SWP_NOZORDER); - ::SetMenu(m_hWnd, NULL); - SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER); - } -} - -void CMainFrame::RestoreDefaultWindowRect() -{ - AppSettings& s = AfxGetAppSettings(); - - WINDOWPLACEMENT wp; - GetWindowPlacement(&wp); - if(!m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED -// && (GetExStyle()&WS_EX_APPWINDOW) - && !s.fRememberWindowSize) - { - CRect r1, r2; - GetClientRect(&r1); - m_wndView.GetClientRect(&r2); - - CSize logosize = m_wndView.GetLogoSize(); - int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW); - int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH); - - DWORD style = GetStyle(); - - MENUBARINFO mbi; - memset(&mbi, 0, sizeof(mbi)); - mbi.cbSize = sizeof(mbi); - ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi); - - int w = _DEFCLIENTW + GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2 - + r1.Width() - r2.Width(); - int h = _DEFCLIENTH + GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2 - + (mbi.rcBar.bottom - mbi.rcBar.top) - + r1.Height() - r2.Height() - + 1; // ??? -// + 2; // ??? - if(style&WS_CAPTION) h += GetSystemMetrics(SM_CYCAPTION); - - if(s.HasFixedWindowSize()) - { - w = s.fixedWindowSize.cx; - h = s.fixedWindowSize.cy; - } - - CRect r; - GetWindowRect(r); - - int x = r.CenterPoint().x - w/2; - int y = r.CenterPoint().y - h/2; - - if(s.fRememberWindowPos) - { - CRect r = s.rcLastWindowPos; - - x = r.TopLeft().x; - y = r.TopLeft().y; - } - - MoveWindow(x, y, w, h); - } -} - -OAFilterState CMainFrame::GetMediaState() -{ - OAFilterState ret = -1; - if(m_iMediaLoadState == MLS_LOADED) pMC->GetState(0, &ret); - return(ret); -} - -CSize CMainFrame::GetVideoSize() -{ - bool fKeepAspectRatio = AfxGetAppSettings().fKeepAspectRatio; - bool fCompMonDeskARDiff = AfxGetAppSettings().fCompMonDeskARDiff; - - CSize ret(0,0); - if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly) - return ret; - - CSize wh(0, 0), arxy(0, 0); - - if(m_pCAP) - { - wh = m_pCAP->GetVideoSize(false); - arxy = m_pCAP->GetVideoSize(fKeepAspectRatio); - } - else - { - pBV->GetVideoSize(&wh.cx, &wh.cy); - - long arx = 0, ary = 0; - CComQIPtr pBV2 = pBV; - if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0) - arxy.SetSize(arx, ary); - } - - if(wh.cx <= 0 || wh.cy <= 0) - return ret; - - // with the overlay mixer IBasicVideo2 won't tell the new AR when changed dynamically - DVD_VideoAttributes VATR; - if(m_iPlaybackMode == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) - arxy.SetSize(VATR.ulAspectX, VATR.ulAspectY); - - CSize& ar = AfxGetAppSettings().AspectRatio; - if(ar.cx && ar.cy) arxy = ar; - - ret = (!fKeepAspectRatio || arxy.cx <= 0 || arxy.cy <= 0) - ? wh - : CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy); - - if(fCompMonDeskARDiff) - if(HDC hDC = ::GetDC(0)) - { - int _HORZSIZE = GetDeviceCaps(hDC, HORZSIZE); - int _VERTSIZE = GetDeviceCaps(hDC, VERTSIZE); - int _HORZRES = GetDeviceCaps(hDC, HORZRES); - int _VERTRES = GetDeviceCaps(hDC, VERTRES); - - if(_HORZSIZE > 0 && _VERTSIZE > 0 && _HORZRES > 0 && _VERTRES > 0) - { - double a = 1.0*_HORZSIZE/_VERTSIZE; - double b = 1.0*_HORZRES/_VERTRES; - - if(b < a) - ret.cy = (DWORD)(1.0*ret.cy * a / b); - else if(a < b) - ret.cx = (DWORD)(1.0*ret.cx * b / a); - } - - ::ReleaseDC(0, hDC); - } - - return ret; -} - -void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasTo) -{ - CRect r; -// const CWnd* pWndInsertAfter; - DWORD dwRemove = 0, dwAdd = 0; - DWORD dwRemoveEx = 0, dwAddEx = 0; - HMENU hMenu; - - if(!m_fFullScreen) - { - GetWindowRect(&m_lastWindowRect); - - dispmode& dm = AfxGetAppSettings().dmFullscreenRes; - m_dmBeforeFullscreen.fValid = false; - if(dm.fValid && fSwitchScreenResWhenHasTo) - { - GetCurDispMode(m_dmBeforeFullscreen); - SetDispMode(dm); - } - - MONITORINFO mi; - mi.cbSize = sizeof(MONITORINFO); - GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi); - - dwRemove = WS_CAPTION|WS_THICKFRAME; - if(fToNearest) r = mi.rcMonitor; - else GetDesktopWindow()->GetWindowRect(&r); - hMenu = NULL; - } - else - { - if(m_dmBeforeFullscreen.fValid) - SetDispMode(m_dmBeforeFullscreen); - - dwAdd = (AfxGetAppSettings().fHideCaptionMenu ? 0 : WS_CAPTION) | WS_THICKFRAME; - r = m_lastWindowRect; - hMenu = AfxGetAppSettings().fHideCaptionMenu ? NULL : m_hMenuDefault; - } - - m_lastMouseMove.x = m_lastMouseMove.y = -1; - - bool fAudioOnly = m_fAudioOnly; - m_fAudioOnly = true; - - m_fFullScreen = !m_fFullScreen; - - SetAlwaysOnTop(AfxGetAppSettings().iOnTop); - - ModifyStyle(dwRemove, dwAdd, SWP_NOZORDER); - ModifyStyleEx(dwRemoveEx, dwAddEx, SWP_NOZORDER); - ::SetMenu(m_hWnd, hMenu); - SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER|SWP_NOSENDCHANGING /*SWP_FRAMECHANGED*/); - - if(m_fFullScreen) - { - m_fHideCursor = true; - ShowControls(CS_NONE, false); - } - else - { - KillTimer(TIMER_FULLSCREENCONTROLBARHIDER); - KillTimer(TIMER_FULLSCREENMOUSEHIDER); - m_fHideCursor = false; - ShowControls(AfxGetAppSettings().nCS); - } - - m_wndView.SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER); - - m_fAudioOnly = fAudioOnly; - - MoveVideoWindow(); -} - -void CMainFrame::MoveVideoWindow(bool fShowStats) -{ - if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && IsWindowVisible()) - { - CRect wr; - if(!m_fFullScreen) - { - m_wndView.GetClientRect(wr); - if(!AfxGetAppSettings().fHideCaptionMenu) - wr.DeflateRect(2, 2); - } - else - { - GetWindowRect(&wr); - - // HACK - CRect r; - m_wndView.GetWindowRect(&r); - wr -= r.TopLeft(); - } - - CRect vr = CRect(0,0,0,0); - - OAFilterState fs = GetMediaState(); - if(fs == State_Paused || fs == State_Running || fs == State_Stopped && (m_fShockwaveGraph || m_fQuicktimeGraph)) - { - CSize arxy = GetVideoSize(); - - int iDefaultVideoSize = AfxGetAppSettings().iDefaultVideoSize; - - CSize ws = - iDefaultVideoSize == DVS_HALF ? CSize(arxy.cx/2, arxy.cy/2) : - iDefaultVideoSize == DVS_NORMAL ? arxy : - iDefaultVideoSize == DVS_DOUBLE ? CSize(arxy.cx*2, arxy.cy*2) : - wr.Size(); - - int w = ws.cx; - int h = ws.cy; - - if(!m_fShockwaveGraph) //&& !m_fQuicktimeGraph) - { - if(iDefaultVideoSize == DVS_FROMINSIDE || iDefaultVideoSize == DVS_FROMOUTSIDE) - { - h = ws.cy; - w = MulDiv(h, arxy.cx, arxy.cy); - - if(iDefaultVideoSize == DVS_FROMINSIDE && w > ws.cx - || iDefaultVideoSize == DVS_FROMOUTSIDE && w < ws.cx) - { - w = ws.cx; - h = MulDiv(w, arxy.cy, arxy.cx); - } - } - } - - CSize size( - (int)(m_ZoomX*w), - (int)(m_ZoomY*h)); - - CPoint pos( - (int)(m_PosX*(wr.Width()*3 - m_ZoomX*w) - wr.Width()), - (int)(m_PosY*(wr.Height()*3 - m_ZoomY*h) - wr.Height())); - -/* CPoint pos( - (int)(m_PosX*(wr.Width() - size.cx)), - (int)(m_PosY*(wr.Height() - size.cy))); - -*/ - vr = CRect(pos, size); - } - - wr |= CRect(0,0,0,0); - vr |= CRect(0,0,0,0); - - if(m_pCAP) - { - m_pCAP->SetPosition(wr, vr); - m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ))); - } - else - { - HRESULT hr; - hr = pBV->SetDefaultSourcePosition(); - hr = pBV->SetDestinationPosition(vr.left, vr.top, vr.Width(), vr.Height()); - hr = pVW->SetWindowPosition(wr.left, wr.top, wr.Width(), wr.Height()); - } - - m_wndView.SetVideoRect(wr); - - if(fShowStats && vr.Height() > 0) - { - CString info; - info.Format(_T("Pos %.2f %.2f, Zoom %.2f %.2f, AR %.2f"), m_PosX, m_PosY, m_ZoomX, m_ZoomY, (float)vr.Width()/vr.Height()); - SendStatusMessage(info, 3000); - } - } - else - { - m_wndView.SetVideoRect(); - } -} - -void CMainFrame::ZoomVideoWindow(double scale) -{ - if(m_iMediaLoadState != MLS_LOADED) - return; - - AppSettings& s = AfxGetAppSettings(); - - if(scale <= 0) - { - scale = - s.iZoomLevel == 0 ? 0.5 : - s.iZoomLevel == 1 ? 1.0 : - s.iZoomLevel == 2 ? 2.0 : - s.iZoomLevel == 3 ? GetZoomAutoFitScale() : - 1.0; - } - - if(m_fFullScreen) - { - OnViewFullscreen(); - } - - MINMAXINFO mmi; - OnGetMinMaxInfo(&mmi); - - CRect r; - int w = 0, h = 0; - - if(!m_fAudioOnly) - { - CSize arxy = GetVideoSize(); - - long lWidth = int(arxy.cx * scale + 0.5); - long lHeight = int(arxy.cy * scale + 0.5); - - DWORD style = GetStyle(); - - CRect r1, r2; - GetClientRect(&r1); - m_wndView.GetClientRect(&r2); - - w = GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2 - + r1.Width() - r2.Width() - + lWidth; - - MENUBARINFO mbi; - memset(&mbi, 0, sizeof(mbi)); - mbi.cbSize = sizeof(mbi); - ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi); - - h = GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2 - + (mbi.rcBar.bottom - mbi.rcBar.top) - + r1.Height() - r2.Height() - + lHeight; - - if(style&WS_CAPTION) - { - h += GetSystemMetrics(SM_CYCAPTION); - w += 2; h += 2; // for the 1 pixel wide sunken frame - w += 2; h += 3; // for the inner black border - } - - GetWindowRect(r); - - w = max(w, mmi.ptMinTrackSize.x); - h = max(h, mmi.ptMinTrackSize.y); - } - else - { - GetWindowRect(r); - - w = r.Width(); // mmi.ptMinTrackSize.x; - h = mmi.ptMinTrackSize.y; - } - - // center window - if(!s.fRememberWindowPos) - { - CPoint cp = r.CenterPoint(); - r.left = cp.x - w/2; - r.top = cp.y - h/2; - } - - r.right = r.left + w; - r.bottom = r.top + h; - - MONITORINFO mi; - mi.cbSize = sizeof(MONITORINFO); - GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi); - if(r.right > mi.rcWork.right) r.OffsetRect(mi.rcWork.right-r.right, 0); - if(r.left < mi.rcWork.left) r.OffsetRect(mi.rcWork.left-r.left, 0); - if(r.bottom > mi.rcWork.bottom) r.OffsetRect(0, mi.rcWork.bottom-r.bottom); - if(r.top < mi.rcWork.top) r.OffsetRect(0, mi.rcWork.top-r.top); - - if(m_fFullScreen || !s.HasFixedWindowSize()) - { - MoveWindow(r); - } - -// ShowWindow(SW_SHOWNORMAL); - - MoveVideoWindow(); -} - -double CMainFrame::GetZoomAutoFitScale() -{ - if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly) - return 1.0; - - CSize arxy = GetVideoSize(); - - double sx = 2.0/3 * m_rcDesktop.Width() / arxy.cx; - double sy = 2.0/3 * m_rcDesktop.Height() / arxy.cy; - - return sx < sy ? sx : sy; -} - -void CMainFrame::RepaintVideo() -{ - if(m_pCAP) m_pCAP->Paint(false); -} - -void CMainFrame::SetShaders() -{ - if(!m_pCAP) return; - - AppSettings& s = AfxGetAppSettings(); - - CAtlStringMap s2s; - - POSITION pos = s.m_shaders.GetHeadPosition(); - while(pos) - { - const AppSettings::Shader* pShader = &s.m_shaders.GetNext(pos); - s2s[pShader->label] = pShader; - } - - m_pCAP->SetPixelShader(NULL, NULL); - - CAtlList labels; - - pos = m_shaderlabels.GetHeadPosition(); - while(pos) - { - const AppSettings::Shader* pShader = NULL; - if(s2s.Lookup(m_shaderlabels.GetNext(pos), pShader)) - { - CStringA target = pShader->target; - CStringA srcdata = pShader->srcdata; - - HRESULT hr = m_pCAP->SetPixelShader(srcdata, target); - - if(FAILED(hr)) - { - m_pCAP->SetPixelShader(NULL, NULL); - SendStatusMessage(_T("Could not load shader: ") + pShader->label, 3000); - return; - } - - labels.AddTail(pShader->label); - } - } - - if(m_iMediaLoadState == MLS_LOADED) - { - CString str = Implode(labels, '|'); - str.Replace(_T("|"), _T(", ")); - SendStatusMessage(_T("Shader: ") + str, 3000); - } -} - -void CMainFrame::UpdateShaders(CString label) -{ - if(!m_pCAP) return; - - if(m_shaderlabels.GetCount() <= 1) - m_shaderlabels.RemoveAll(); - - if(m_shaderlabels.IsEmpty() && !label.IsEmpty()) - m_shaderlabels.AddTail(label); - - bool fUpdate = m_shaderlabels.IsEmpty(); - - POSITION pos = m_shaderlabels.GetHeadPosition(); - while(pos) - { - if(label == m_shaderlabels.GetNext(pos)) - { - fUpdate = true; - break; - } - } - - if(fUpdate) SetShaders(); - -} - -void CMainFrame::SetBalance(int balance) -{ - AfxGetAppSettings().nBalance = balance; - - int sign = balance>0?-1:1; - balance = max(100-abs(balance), 1); - balance = (int)((log10(1.0*balance)-2)*5000*sign); - balance = max(min(balance, 10000), -10000); - - if(m_iMediaLoadState == MLS_LOADED) - pBA->put_Balance(balance); -} - -void CMainFrame::SetupIViAudReg() -{ - if(!AfxGetAppSettings().fAutoSpeakerConf) return; - - DWORD spc = 0, defchnum = 0; - - if(AfxGetAppSettings().fAutoSpeakerConf) - { - CComPtr pDS; - if(SUCCEEDED(DirectSoundCreate(NULL, &pDS, NULL)) - && SUCCEEDED(pDS->SetCooperativeLevel(m_hWnd, DSSCL_NORMAL))) - { - if(SUCCEEDED(pDS->GetSpeakerConfig(&spc))) - { - switch(spc) - { - case DSSPEAKER_DIRECTOUT: defchnum = 6; break; - case DSSPEAKER_HEADPHONE: defchnum = 2; break; - case DSSPEAKER_MONO: defchnum = 1; break; - case DSSPEAKER_QUAD: defchnum = 4; break; - default: - case DSSPEAKER_STEREO: defchnum = 2; break; - case DSSPEAKER_SURROUND: defchnum = 2; break; - case DSSPEAKER_5POINT1: defchnum = 5; break; - case DSSPEAKER_7POINT1: defchnum = 5; break; - } - } - } - } - else - { - defchnum = 2; - } - - CRegKey iviaud; - if(ERROR_SUCCESS == iviaud.Create(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\InterVideo\\Common\\AudioDec"))) - { - DWORD chnum = 0; - if(FAILED(iviaud.QueryDWORDValue(_T("AUDIO"), chnum))) chnum = 0; - if(chnum <= defchnum) // check if the user has already set it..., but we won't skip if it's lower than sensible :P - iviaud.SetDWORDValue(_T("AUDIO"), defchnum); - } -} - -// -// Open/Close -// - - -void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) -{ - ASSERT(pGB == NULL); - - m_fCustomGraph = false; - m_fRealMediaGraph = m_fShockwaveGraph = m_fQuicktimeGraph = false; - - AppSettings& s = AfxGetAppSettings(); - - if(OpenFileData* p = dynamic_cast(pOMD)) - { - engine_t engine = s.Formats.GetEngine(p->fns.GetHead()); - - CStringA ct = GetContentType(p->fns.GetHead()); - - if(ct == "video/x-ms-asf") - { - // TODO: put something here to make the windows media source filter load later - } - else if(ct == "audio/x-pn-realaudio" - || ct == "audio/x-pn-realaudio-plugin" - || ct == "audio/x-realaudio-secure" - || ct == "video/vnd.rn-realvideo-secure" - || ct == "application/vnd.rn-realmedia" - || ct.Find("vnd.rn-") >= 0 - || ct.Find("realaudio") >= 0 - || ct.Find("realvideo") >= 0) - { - engine = RealMedia; - } - else if(ct == "application/x-shockwave-flash") - { - engine = ShockWave; - } - else if(ct == "video/quicktime" - || ct == "application/x-quicktimeplayer") - { - engine = QuickTime; - } - - HRESULT hr; - CComPtr pUnk; - - if(engine == RealMedia) - { - if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CRealMediaGraph(m_wndView.m_hWnd, hr))) - throw _T("Out of memory"); - - if(SUCCEEDED(hr) && !!(pGB = CComQIPtr(pUnk))) - m_fRealMediaGraph = true; - } - else if(engine == ShockWave) - { - if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CShockwaveGraph(m_wndView.m_hWnd, hr))) - throw _T("Out of memory"); - - if(FAILED(hr) || !(pGB = CComQIPtr(pUnk))) - throw _T("Can't create shockwave control"); - - m_fShockwaveGraph = true; - } - else if(engine == QuickTime) - { - if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CQuicktimeGraph(m_wndView.m_hWnd, hr))) - throw _T("Out of memory"); - - if(SUCCEEDED(hr) && !!(pGB = CComQIPtr(pUnk))) - m_fQuicktimeGraph = true; - } - - m_fCustomGraph = m_fRealMediaGraph || m_fShockwaveGraph || m_fQuicktimeGraph; - - if(!m_fCustomGraph) - { - pGB = new CFGManagerPlayer(_T("CFGManagerPlayer"), NULL, s.SrcFilters, s.TraFilters, m_wndView.m_hWnd); - } - } - else if(OpenDVDData* p = dynamic_cast(pOMD)) - { - pGB = new CFGManagerDVD(_T("CFGManagerDVD"), NULL, s.SrcFilters, s.TraFilters, m_wndView.m_hWnd); - } - else if(OpenDeviceData* p = dynamic_cast(pOMD)) - { - pGB = new CFGManagerCapture(_T("CFGManagerCapture"), NULL, s.SrcFilters, s.TraFilters, m_wndView.m_hWnd); - } - - if(!pGB) - { - throw _T("Failed to create the filter graph object"); - } - - pGB->AddToROT(); - - pMC = pGB; pME = pGB; pMS = pGB; // general - pVW = pGB; pBV = pGB; // video - pBA = pGB; // audio - pFS = pGB; - - if(!(pMC && pME && pMS) - || !(pVW && pBV) - || !(pBA)) - { - throw _T("Failed to query the needed interfaces for playback"); - } - - if(FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0))) - { - throw _T("Could not set target window for graph notification"); - } - - m_pProv = (IUnknown*)new CKeyProvider(); - - if(CComQIPtr pObjectWithSite = pGB) - pObjectWithSite->SetSite(m_pProv); - - m_pCB = new CDSMChapterBag(NULL, NULL); -} - -void CMainFrame::OpenFile(OpenFileData* pOFD) -{ - if(pOFD->fns.IsEmpty()) - throw _T("Invalid argument"); - - AppSettings& s = AfxGetAppSettings(); - - bool fFirst = true; - - POSITION pos = pOFD->fns.GetHeadPosition(); - while(pos) - { - CString fn = pOFD->fns.GetNext(pos); - - fn.Trim(); - if(fn.IsEmpty() && !fFirst) - break; - - HRESULT hr = pGB->RenderFile(CStringW(fn), NULL); - - if(FAILED(hr)) - { - if(fFirst) - { - if(s.fReportFailedPins) - { - CComQIPtr pGBDE = pGB; - if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal(); - } - - CString err; - - switch(hr) - { - case E_ABORT: err = _T("Opening aborted"); break; - case E_FAIL: case E_POINTER: default: err = _T("Failed to render the file"); break; - case E_INVALIDARG: err = _T("Invalid file name"); break; - case E_OUTOFMEMORY: err = _T("Out of memory"); break; - case VFW_E_CANNOT_CONNECT: err = _T("Cannot connect the filters"); break; - case VFW_E_CANNOT_LOAD_SOURCE_FILTER: err = _T("Cannot load any source filter"); break; - case VFW_E_CANNOT_RENDER: err = _T("Cannot render the file"); break; - case VFW_E_INVALID_FILE_FORMAT: err = _T("Invalid file format"); break; - case VFW_E_NOT_FOUND: err = _T("File not found"); break; - case VFW_E_UNKNOWN_FILE_TYPE: err = _T("Unknown file type"); break; - case VFW_E_UNSUPPORTED_STREAM: err = _T("Unsupported stream"); break; - } - - throw err; - } - } - - if(s.fKeepHistory) - { - CRecentFileList* pMRU = fFirst ? &s.MRU : &s.MRUDub; - pMRU->ReadList(); - pMRU->Add(fn); - pMRU->WriteList(); - } - - if(fFirst) - { - pOFD->title = fn; - } - - fFirst = false; - - if(m_fCustomGraph) break; - } - - if(s.fReportFailedPins) - { - CComQIPtr pGBDE = pGB; - if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal(); - } - - if(!(pAMOP = pGB)) - { - BeginEnumFilters(pGB, pEF, pBF) - if(pAMOP = pBF) break; - EndEnumFilters - } - - if(FindFilter(__uuidof(CShoutcastSource), pGB)) - m_fUpdateInfoBar = true; - - SetupChapters(); - - CComQIPtr pKFI; - BeginEnumFilters(pGB, pEF, pBF) - if(pKFI = pBF) break; - EndEnumFilters - UINT nKFs = 0, nKFsTmp = 0; - if(pKFI && S_OK == pKFI->GetKeyFrameCount(nKFs) && nKFs > 0) - { - m_kfs.SetCount(nKFsTmp = nKFs); - if(S_OK != pKFI->GetKeyFrames(&TIME_FORMAT_MEDIA_TIME, m_kfs.GetData(), nKFsTmp) || nKFsTmp != nKFs) - m_kfs.RemoveAll(); - } - - m_iPlaybackMode = PM_FILE; -} - -void CMainFrame::SetupChapters() -{ - ASSERT(m_pCB); - - m_pCB->ChapRemoveAll(); - - CInterfaceList pBFs; - BeginEnumFilters(pGB, pEF, pBF) - pBFs.AddTail(pBF); - EndEnumFilters - - POSITION pos; - - pos = pBFs.GetHeadPosition(); - while(pos && !m_pCB->ChapGetCount()) - { - IBaseFilter* pBF = pBFs.GetNext(pos); - - CComQIPtr pCB = pBF; - if(!pCB) continue; - - for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++) - { - REFERENCE_TIME rt; - CComBSTR name; - if(SUCCEEDED(pCB->ChapGet(i, &rt, &name))) - m_pCB->ChapAppend(rt, name); - } - } - - pos = pBFs.GetHeadPosition(); - while(pos && !m_pCB->ChapGetCount()) - { - IBaseFilter* pBF = pBFs.GetNext(pos); - - CComQIPtr pCI = pBF; - if(!pCI) continue; - - CHAR iso6391[3]; - ::GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, iso6391, 3); - CStringA iso6392 = ISO6391To6392(iso6391); - if(iso6392.GetLength() < 3) iso6392 = "eng"; - - UINT cnt = pCI->GetChapterCount(CHAPTER_ROOT_ID); - for(UINT i = 1; i <= cnt; i++) - { - UINT cid = pCI->GetChapterId(CHAPTER_ROOT_ID, i); - - ChapterElement ce; - if(pCI->GetChapterInfo(cid, &ce)) - { - char pl[3] = {iso6392[0], iso6392[1], iso6392[2]}; - char cc[] = " "; - CComBSTR name; - name.Attach(pCI->GetChapterStringInfo(cid, pl, cc)); - m_pCB->ChapAppend(ce.rtStart, name); - } - } - } - - pos = pBFs.GetHeadPosition(); - while(pos && !m_pCB->ChapGetCount()) - { - IBaseFilter* pBF = pBFs.GetNext(pos); - - CComQIPtr pES = pBF; - if(!pES) continue; - - long MarkerCount = 0; - if(SUCCEEDED(pES->get_MarkerCount(&MarkerCount))) - { - for(long i = 1; i <= MarkerCount; i++) - { - double MarkerTime = 0; - if(SUCCEEDED(pES->GetMarkerTime(i, &MarkerTime))) - { - CStringW name; - name.Format(L"Chapter %d", i); - - CComBSTR bstr; - if(S_OK == pES->GetMarkerName(i, &bstr)) - name = bstr; - - m_pCB->ChapAppend(REFERENCE_TIME(MarkerTime*10000000), name); - } - } - } - } - - pos = pBFs.GetHeadPosition(); - while(pos && !m_pCB->ChapGetCount()) - { - IBaseFilter* pBF = pBFs.GetNext(pos); - - if(GetCLSID(pBF) != CLSID_OggSplitter) - continue; - - BeginEnumPins(pBF, pEP, pPin) - { - if(m_pCB->ChapGetCount()) break; - - if(CComQIPtr pPB = pPin) - { - for(int i = 1; ; i++) - { - CStringW str; - CComVariant var; - - var.Clear(); - str.Format(L"CHAPTER%02d", i); - if(S_OK != pPB->Read(str, &var, NULL)) - break; - - int h, m, s, ms; - WCHAR wc; - if(7 != swscanf(CStringW(var), L"%d%c%d%c%d%c%d", &h, &wc, &m, &wc, &s, &wc, &ms)) - break; - - CStringW name; - name.Format(L"Chapter %d", i); - var.Clear(); - str += L"NAME"; - if(S_OK == pPB->Read(str, &var, NULL)) - name = var; - - m_pCB->ChapAppend(10000i64*(((h*60 + m)*60 + s)*1000 + ms), name); - } - } - } - EndEnumPins - } - - m_pCB->ChapSort(); -} - -void CMainFrame::OpenDVD(OpenDVDData* pODD) -{ - HRESULT hr = pGB->RenderFile(CStringW(pODD->path), NULL); - - AppSettings& s = AfxGetAppSettings(); - - if(s.fReportFailedPins) - { - CComQIPtr pGBDE = pGB; - if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal(); - } - - BeginEnumFilters(pGB, pEF, pBF) - { - if((pDVDC = pBF) && (pDVDI = pBF)) - break; - } - EndEnumFilters - - if(hr == E_INVALIDARG) - throw _T("Cannot find DVD directory"); - else if(hr == VFW_E_CANNOT_RENDER) - throw _T("Failed to render all pins of the DVD Navigator filter"); - else if(hr == VFW_S_PARTIAL_RENDER) - throw _T("Failed to render some of the pins of the DVD Navigator filter"); - else if(hr == E_NOINTERFACE || !pDVDC || !pDVDI) - throw _T("Failed to query the needed interfaces for DVD playback"); - else if(hr == VFW_E_CANNOT_LOAD_SOURCE_FILTER) - throw _T("Can't create the DVD Navigator filter"); - else if(FAILED(hr)) - throw _T("Failed"); - - WCHAR buff[MAX_PATH]; - ULONG len = 0; - if(SUCCEEDED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len))) - pODD->title = CString(CStringW(buff)); - - // TODO: resetdvd - - pDVDC->SetOption(DVD_ResetOnStop, FALSE); - pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE); - - if(s.idMenuLang) pDVDC->SelectDefaultMenuLanguage(s.idMenuLang); - if(s.idAudioLang) pDVDC->SelectDefaultAudioLanguage(s.idAudioLang, DVD_AUD_EXT_NotSpecified); - if(s.idSubtitlesLang) pDVDC->SelectDefaultSubpictureLanguage(s.idSubtitlesLang, DVD_SP_EXT_NotSpecified); - - m_iDVDDomain = DVD_DOMAIN_Stop; - - m_iPlaybackMode = PM_DVD; -} - -void CMainFrame::OpenCapture(OpenDeviceData* pODD) -{ - CStringW vidfrname, audfrname; - CComPtr pVidCapTmp, pAudCapTmp; - - m_VidDispName = pODD->DisplayName[0]; - - if(!m_VidDispName.IsEmpty()) - { - if(!CreateFilter(m_VidDispName, &pVidCapTmp, vidfrname)) - throw _T("Can't create video capture filter"); - } - - m_AudDispName = pODD->DisplayName[1]; - - if(!m_AudDispName.IsEmpty()) - { - if(!CreateFilter(m_AudDispName, &pAudCapTmp, audfrname)) - throw _T("Can't create video capture filter"); - } - - if(!pVidCapTmp && !pAudCapTmp) - { - throw _T("No capture filters"); - } - - pCGB = NULL; - pVidCap = NULL; - pAudCap = NULL; - - if(FAILED(pCGB.CoCreateInstance(CLSID_CaptureGraphBuilder2))) - { - throw _T("Can't create capture graph builder object"); - } - - HRESULT hr; - - pCGB->SetFiltergraph(pGB); - - if(pVidCapTmp) - { - if(FAILED(hr = pGB->AddFilter(pVidCapTmp, vidfrname))) - { - throw _T("Can't add video capture filter to the graph"); - } - - pVidCap = pVidCapTmp; - - if(!pAudCapTmp) - { - if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap)) - && FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))) - TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture")); - - if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev)) - && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))) - TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture")); - - if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC)) - && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC))) - { - TRACE(_T("Warning: No IAMStreamConfig interface for vidcap")); - } - else - { - pAudCap = pVidCap; - } - } - else - { - if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))) - TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture")); - - if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))) - TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture")); - } - - if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMCrossbar, (void**)&pAMXBar))) - TRACE(_T("Warning: No IAMCrossbar interface was found\n")); - - if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMTVTuner, (void**)&pAMTuner))) - TRACE(_T("Warning: No IAMTVTuner interface was found\n")); -/* - if(pAMVSCCap) - { -//DumpStreamConfig(_T("c:\\mpclog.txt"), pAMVSCCap); - CComQIPtr pVfwCD = pVidCap; - if(!pAMXBar && pVfwCD) - { - m_wndCaptureBar.m_capdlg.SetupVideoControls(viddispname, pAMVSCCap, pVfwCD); - } - else - { - m_wndCaptureBar.m_capdlg.SetupVideoControls(viddispname, pAMVSCCap, pAMXBar, pAMTuner); - } - } -*/ - // TODO: init pAMXBar - - if(pAMTuner) // load saved channel - { - pAMTuner->put_CountryCode(AfxGetApp()->GetProfileInt(_T("Capture"), _T("Country"), 1)); - - int vchannel = pODD->vchannel; - if(vchannel < 0) vchannel = AfxGetApp()->GetProfileInt(_T("Capture\\") + CString(m_VidDispName), _T("Channel"), -1); - if(vchannel >= 0) - { - OAFilterState fs = State_Stopped; - pMC->GetState(0, &fs); - if(fs == State_Running) pMC->Pause(); - pAMTuner->put_Channel(vchannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT); - if(fs == State_Running) pMC->Run(); - } - } - } - - if(pAudCapTmp) - { - if(FAILED(hr = pGB->AddFilter(pAudCapTmp, CStringW(audfrname)))) - { - throw _T("Can't add audio capture filter to the graph"); - } - - pAudCap = pAudCapTmp; - - if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC)) - && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC))) - { - TRACE(_T("Warning: No IAMStreamConfig interface for vidcap")); - } -/* - CInterfaceArray pAMAIM; - - BeginEnumPins(pAudCap, pEP, pPin) - { - PIN_DIRECTION dir; - if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_INPUT) - continue; - - if(CComQIPtr pAIM = pPin) - pAMAIM.Add(pAIM); - } - EndEnumPins - - if(pAMASC) - { - m_wndCaptureBar.m_capdlg.SetupAudioControls(auddispname, pAMASC, pAMAIM); - } -*/ - } - - if(!(pVidCap || pAudCap)) - { - throw _T("Couldn't open any device"); - } - - pODD->title = _T("Live"); - - m_iPlaybackMode = PM_CAPTURE; -} - -void CMainFrame::OpenCustomizeGraph() -{ - if(m_iPlaybackMode == PM_CAPTURE) - return; - - CleanGraph(); - - if(m_iPlaybackMode == PM_FILE) - { - if(m_pCAP) { - if(AfxGetAppSettings().fAutoloadSubtitles) { - AddTextPassThruFilter(); - } - } - } - - if(m_iPlaybackMode == PM_DVD) - { - BeginEnumFilters(pGB, pEF, pBF) - { - if(CComQIPtr pDVS2 = pBF) - { -// pDVS2->AdviseSubClock(m_pSubClock = new CSubClock); -// break; - - // TODO: test multiple dvobsub instances with one clock - if(!m_pSubClock) m_pSubClock = new CSubClock; - pDVS2->AdviseSubClock(m_pSubClock); - } - } - EndEnumFilters - } - - BeginEnumFilters(pGB, pEF, pBF) - { - if(GetCLSID(pBF) == CLSID_OggSplitter) - { - if(CComQIPtr pSS = pBF) - { - LCID idAudio = AfxGetAppSettings().idAudioLang; - if(!idAudio) idAudio = GetUserDefaultLCID(); - LCID idSub = AfxGetAppSettings().idSubtitlesLang; - if(!idSub) idSub = GetUserDefaultLCID(); - - DWORD cnt = 0; - pSS->Count(&cnt); - for(DWORD i = 0; i < cnt; i++) - { - AM_MEDIA_TYPE* pmt = NULL; - DWORD dwFlags = 0; - LCID lcid = 0; - DWORD dwGroup = 0; - WCHAR* pszName = NULL; - if(SUCCEEDED(pSS->Info((long)i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) - { - CStringW name(pszName), sound(L"Sound"), subtitle(L"Subtitle"); - - if(idAudio != -1 && (idAudio&0x3ff) == (lcid&0x3ff) // sublang seems to be zeroed out in ogm... - && name.GetLength() > sound.GetLength() - && !name.Left(sound.GetLength()).CompareNoCase(sound)) - { - if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE))) - idAudio = -1; - } - - if(idSub != -1 && (idSub&0x3ff) == (lcid&0x3ff) // sublang seems to be zeroed out in ogm... - && name.GetLength() > subtitle.GetLength() - && !name.Left(subtitle.GetLength()).CompareNoCase(subtitle) - && name.Mid(subtitle.GetLength()).Trim().CompareNoCase(L"off")) - { - if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE))) - idSub = -1; - } - - if(pmt) DeleteMediaType(pmt); - if(pszName) CoTaskMemFree(pszName); - } - } - } - } - } - EndEnumFilters - - CleanGraph(); -} - -void CMainFrame::OpenSetupVideo() -{ - m_fAudioOnly = true; - - if(m_pCAP) - { - CSize vs = m_pCAP->GetVideoSize(); - m_fAudioOnly = (vs.cx <= 0 || vs.cy <= 0); - } - else - { - { - long w = 0, h = 0; - - if(CComQIPtr pBV = pGB) - { - pBV->GetVideoSize(&w, &h); - } - - if(w > 0 && h > 0) - { - m_fAudioOnly = false; - } - } - - if(m_fAudioOnly) - { - BeginEnumFilters(pGB, pEF, pBF) - { - long w = 0, h = 0; - - if(CComQIPtr pVW = pBF) - { - long lVisible; - if(FAILED(pVW->get_Visible(&lVisible))) - continue; - - pVW->get_Width(&w); - pVW->get_Height(&h); - } - - if(w > 0 && h > 0) - { - m_fAudioOnly = false; - break; - } - } - EndEnumFilters - } - } - - if(m_fShockwaveGraph) - { - m_fAudioOnly = false; - } - - if(m_pCAP) - { - SetShaders(); - } - // else - { - // TESTME - - pVW->put_Owner((OAHWND)m_wndView.m_hWnd); - pVW->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN); - pVW->put_MessageDrain((OAHWND)m_hWnd); - - for(CWnd* pWnd = m_wndView.GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) - pWnd->EnableWindow(FALSE); // little trick to let WM_SETCURSOR thru - } -} - -void CMainFrame::OpenSetupAudio() -{ - pBA->put_Volume(m_wndToolBar.Volume); - - // FIXME - int balance = AfxGetAppSettings().nBalance; - int sign = balance>0?-1:1; - balance = max(100-abs(balance), 1); - balance = (int)((log10(1.0*balance)-2)*5000*sign); - balance = max(min(balance, 10000), -10000); - pBA->put_Balance(balance); -} -/* -void CMainFrame::OpenSetupToolBar() -{ -// m_wndToolBar.Volume = AfxGetAppSettings().nVolume; -// SetBalance(AfxGetAppSettings().nBalance); -} -*/ -void CMainFrame::OpenSetupCaptureBar() -{ - if(m_iPlaybackMode == PM_CAPTURE) - { - if(pVidCap && pAMVSCCap) - { - CComQIPtr pVfwCD = pVidCap; - - if(!pAMXBar && pVfwCD) - { - m_wndCaptureBar.m_capdlg.SetupVideoControls(m_VidDispName, pAMVSCCap, pVfwCD); - } - else - { - m_wndCaptureBar.m_capdlg.SetupVideoControls(m_VidDispName, pAMVSCCap, pAMXBar, pAMTuner); - } - } - - if(pAudCap && pAMASC) - { - CInterfaceArray pAMAIM; - - BeginEnumPins(pAudCap, pEP, pPin) - { - if(CComQIPtr pAIM = pPin) - pAMAIM.Add(pAIM); - } - EndEnumPins - - m_wndCaptureBar.m_capdlg.SetupAudioControls(m_AudDispName, pAMASC, pAMAIM); - } - } - - BuildGraphVideoAudio( - m_wndCaptureBar.m_capdlg.m_fVidPreview, false, - m_wndCaptureBar.m_capdlg.m_fAudPreview, false); -} - -void CMainFrame::OpenSetupInfoBar() -{ - if(m_iPlaybackMode == PM_FILE) - { - bool fEmpty = true; - BeginEnumFilters(pGB, pEF, pBF) - { - if(CComQIPtr pAMMC = pBF) - { - CComBSTR bstr; - if(SUCCEEDED(pAMMC->get_Title(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_TITLE), bstr.m_str); if(bstr.Length()) fEmpty = false;} - if(SUCCEEDED(pAMMC->get_AuthorName(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUTHOR), bstr.m_str); if(bstr.Length()) fEmpty = false;} - if(SUCCEEDED(pAMMC->get_Copyright(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_COPYRIGHT), bstr.m_str); if(bstr.Length()) fEmpty = false;} - if(SUCCEEDED(pAMMC->get_Rating(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_RATING), bstr.m_str); if(bstr.Length()) fEmpty = false;} - if(SUCCEEDED(pAMMC->get_Description(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DESCRIPTION), bstr.m_str); if(bstr.Length()) fEmpty = false;} - if(!fEmpty) - { - RecalcLayout(); - break; - } - } - } - EndEnumFilters - } - else if(m_iPlaybackMode == PM_DVD) - { - CString info('-'); - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), info); - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), info); - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_VIDEO), info); - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUDIO), info); - m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), info); - RecalcLayout(); - } -} - -void CMainFrame::OpenSetupStatsBar() -{ - CString info('-'); - - BeginEnumFilters(pGB, pEF, pBF) - { - if(!pQP && (pQP = pBF)) - { - m_wndStatsBar.SetLine(_T("Frame-rate"), info); - m_wndStatsBar.SetLine(_T("Sync Offset"), info); - m_wndStatsBar.SetLine(_T("Frames"), info); - m_wndStatsBar.SetLine(_T("Jitter"), info); - m_wndStatsBar.SetLine(_T("Buffers"), info); - m_wndStatsBar.SetLine(_T("Bitrate"), info); - RecalcLayout(); - } - - if(!pBI && (pBI = pBF)) - { - m_wndStatsBar.SetLine(_T("Buffers"), info); - m_wndStatsBar.SetLine(_T("Bitrate"), info); // FIXME: shouldn't be here - RecalcLayout(); - } - } - EndEnumFilters -} - -void CMainFrame::OpenSetupStatusBar() -{ - m_wndStatusBar.ShowTimer(true); - - // - - if(!m_fCustomGraph) - { - UINT id = IDB_NOAUDIO; - - BeginEnumFilters(pGB, pEF, pBF) - { - CComQIPtr pBA = pBF; - if(!pBA) continue; - - BeginEnumPins(pBF, pEP, pPin) - { - if(S_OK == pGB->IsPinDirection(pPin, PINDIR_INPUT) - && S_OK == pGB->IsPinConnected(pPin)) - { - AM_MEDIA_TYPE mt; - memset(&mt, 0, sizeof(mt)); - pPin->ConnectionMediaType(&mt); - - if(mt.majortype == MEDIATYPE_Audio && mt.formattype == FORMAT_WaveFormatEx) - { - switch(((WAVEFORMATEX*)mt.pbFormat)->nChannels) - { - case 1: id = IDB_MONO; break; - case 2: default: id = IDB_STEREO; break; - } - break; - } - else if(mt.majortype == MEDIATYPE_Midi) - { - id = NULL; - break; - } - } - } - EndEnumPins - - if(id != IDB_NOAUDIO) - { - break; - } - } - EndEnumFilters - - m_wndStatusBar.SetStatusBitmap(id); - } - - // - - HICON hIcon = NULL; - - if(m_iPlaybackMode == PM_FILE) - { - CString fn = m_wndPlaylistBar.GetCur(); - CString ext = fn.Mid(fn.ReverseFind('.')+1); - hIcon = LoadIcon(ext, true); - } - else if(m_iPlaybackMode == PM_DVD) - { - hIcon = LoadIcon(_T(".ifo"), true); - } - else if(m_iPlaybackMode == PM_DVD) - { - // hIcon = ; // TODO - } - - m_wndStatusBar.SetStatusTypeIcon(hIcon); -} - -void CMainFrame::OpenSetupWindowTitle(CString fn) -{ - CString title(MAKEINTRESOURCE(IDR_MAINFRAME)); - - AppSettings& s = AfxGetAppSettings(); - - int i = s.iTitleBarTextStyle; - - if(!fn.IsEmpty() && (i == 0 || i == 1)) - { - if(i == 1) - { - if(m_iPlaybackMode == PM_FILE) - { - fn.Replace('\\', '/'); - CString fn2 = fn.Mid(fn.ReverseFind('/')+1); - if(!fn2.IsEmpty()) fn = fn2; - - if(s.fTitleBarTextTitle) - { - BeginEnumFilters(pGB, pEF, pBF) - { - if(CComQIPtr pAMMC = pBF) - { - CComBSTR bstr; - if(SUCCEEDED(pAMMC->get_Title(&bstr)) && bstr.Length()) - { - fn = CString(bstr.m_str); - break; - } - } - } - EndEnumFilters - } - } - else if(m_iPlaybackMode == PM_DVD) - { - fn = _T("DVD"); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - fn = _T("Live"); - } - } - - title = fn + _T(" - ") + title; - } - - SetWindowText(title); -} - -bool CMainFrame::OpenMediaPrivate(CAutoPtr pOMD) -{ - if(m_iMediaLoadState != MLS_CLOSED && m_iMediaLoadState != MLS_LOADING) - { - ASSERT(0); - return(false); - } - - m_iMediaLoadState = MLS_LOADING; - - // FIXME: Don't show "Closed" initially - PostMessage(WM_KICKIDLE); - - CString err, aborted(_T("Aborted")); - - m_fUpdateInfoBar = false; - - try - { - if(m_fOpeningAborted) throw aborted; - - if(OpenFileData* pOFD = dynamic_cast(pOMD.m_p)) - { - if(pOFD->fns.IsEmpty()) throw _T("File not found"); - - CString fn = pOFD->fns.GetHead(); - - int i = fn.Find(_T(":\\")); - if(i > 0) - { - CString drive = fn.Left(i+2); - UINT type = GetDriveType(drive); - CAtlList sl; - if(type == DRIVE_REMOVABLE || type == DRIVE_CDROM && GetCDROMType(drive[0], sl) != CDROM_Audio) - { - int ret = IDRETRY; - while(ret == IDRETRY) - { - WIN32_FIND_DATA findFileData; - HANDLE h = FindFirstFile(fn, &findFileData); - if(h != INVALID_HANDLE_VALUE) - { - FindClose(h); - ret = IDOK; - } - else - { - CString msg; - msg.Format(_T("%s was not found, please insert media containing this file."), fn); - ret = AfxMessageBox(msg, MB_RETRYCANCEL); - } - } - - if(ret != IDOK) throw aborted; - } - } - } - - if(m_fOpeningAborted) throw aborted; - - OpenCreateGraphObject(pOMD); - - if(m_fOpeningAborted) throw aborted; - - SetupIViAudReg(); - - if(m_fOpeningAborted) throw aborted; - - if(OpenFileData* p = dynamic_cast(pOMD.m_p)) OpenFile(p); - else if(OpenDVDData* p = dynamic_cast(pOMD.m_p)) OpenDVD(p); - else if(OpenDeviceData* p = dynamic_cast(pOMD.m_p)) OpenCapture(p); - else throw _T("Can't open, invalid input parameters"); - - pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter), (void**)&m_pCAP, TRUE); - - if(m_fOpeningAborted) throw aborted; - - OpenCustomizeGraph(); - - if(m_fOpeningAborted) throw aborted; - - OpenSetupVideo(); - - if(m_fOpeningAborted) throw aborted; - - OpenSetupAudio(); - - if(m_fOpeningAborted) throw aborted; - - if(m_pCAP && (!m_fAudioOnly || m_fRealMediaGraph)) - { - POSITION pos = pOMD->subs.GetHeadPosition(); - while(pos) LoadSubtitle(pOMD->subs.GetNext(pos)); - - if(AfxGetAppSettings().fEnableSubtitles && m_pSubStreams.GetCount() > 0) - SetSubtitle(m_pSubStreams.GetHead()); - } - - if(m_fOpeningAborted) throw aborted; - - OpenSetupWindowTitle(pOMD->title); - - if(::GetCurrentThreadId() == AfxGetApp()->m_nThreadID) - { - OnFilePostOpenmedia(); - } - else - { - PostMessage(WM_COMMAND, ID_FILE_POST_OPENMEDIA); - } - - while(m_iMediaLoadState != MLS_LOADED - && m_iMediaLoadState != MLS_CLOSING // FIXME - ) - { - Sleep(50); - } - - // PostMessage instead of SendMessage because the user might call CloseMedia and then we would deadlock - - PostMessage(WM_COMMAND, ID_PLAY_PAUSE); - - if(!(AfxGetAppSettings().nCLSwitches&CLSW_OPEN)) - PostMessage(WM_COMMAND, ID_PLAY_PLAY); - - AfxGetAppSettings().nCLSwitches &= ~CLSW_OPEN; - - if(OpenFileData* p = dynamic_cast(pOMD.m_p)) - { - if(p->rtStart > 0) - PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_FILE, (LPARAM)(p->rtStart/10000)); // REFERENCE_TIME doesn't fit in LPARAM under a 32bit env. - } - else if(OpenDVDData* p = dynamic_cast(pOMD.m_p)) - { - if(p->pDvdState) - PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_DVD, (LPARAM)(CComPtr(p->pDvdState).Detach())); // must be released by the called message handler - } - else if(OpenDeviceData* p = dynamic_cast(pOMD.m_p)) - { - m_wndCaptureBar.m_capdlg.SetVideoInput(p->vinput); - m_wndCaptureBar.m_capdlg.SetVideoChannel(p->vchannel); - m_wndCaptureBar.m_capdlg.SetAudioInput(p->ainput); - } - } - catch(LPCTSTR msg) - { - err = msg; - } - catch(CString msg) - { - err = msg; - } - - if(!err.IsEmpty()) - { - CloseMediaPrivate(); - m_closingmsg = err; - - OpenFileData* p = dynamic_cast(pOMD.m_p); - if(p && err != aborted) - { - m_wndPlaylistBar.SetCurValid(false); - if(m_wndPlaylistBar.GetCount() > 1) - { - CPlaylistItem pli[2]; - m_wndPlaylistBar.GetCur(pli[0]); - m_wndPlaylistBar.SetNext(); - m_wndPlaylistBar.GetCur(pli[1]); - if(pli[0].m_id != pli[1].m_id) - { - CAutoPtr p(m_wndPlaylistBar.GetCurOMD()); - if(p) OpenMediaPrivate(p); - } - } - } - } - else - { - m_wndPlaylistBar.SetCurValid(true); - } - - PostMessage(WM_KICKIDLE); // calls main thread to update things - - return(err.IsEmpty()); -} - -void CMainFrame::CloseMediaPrivate() -{ - m_iMediaLoadState = MLS_CLOSING; - - OnPlayStop(); // SendMessage(WM_COMMAND, ID_PLAY_STOP); - - m_iPlaybackMode = PM_NONE; - m_iSpeedLevel = 0; - - m_fLiveWM = false; - - m_fEndOfStream = false; - - m_rtDurationOverride = -1; - - m_kfs.RemoveAll(); - - m_pCB = NULL; - -// if(pVW) pVW->put_Visible(OAFALSE); -// if(pVW) pVW->put_MessageDrain((OAHWND)NULL), pVW->put_Owner((OAHWND)NULL); - - m_pCAP = NULL; // IMPORTANT: IVMRSurfaceAllocatorNotify/IVMRSurfaceAllocatorNotify9 has to be released before the VMR/VMR9, otherwise it will crash in Release() - - pAMXBar.Release(); pAMTuner.Release(); pAMDF.Release(); - pAMVCCap.Release(); pAMVCPrev.Release(); pAMVSCCap.Release(); pAMVSCPrev.Release(); pAMASC.Release(); - pVidCap.Release(); pAudCap.Release(); - pCGB.Release(); - pDVDC.Release(); pDVDI.Release(); - pQP.Release(); pBI.Release(); pAMOP.Release(); pFS.Release(); - pMC.Release(); pME.Release(); pMS.Release(); - pVW.Release(); pBV.Release(); - pBA.Release(); - - if(pGB) pGB->RemoveFromROT(); - pGB.Release(); - - m_fRealMediaGraph = m_fShockwaveGraph = m_fQuicktimeGraph = false; - - m_pSubClock = NULL; - - m_pProv.Release(); - - { - CAutoLock cAutoLock(&m_csSubLock); - m_pSubStreams.RemoveAll(); - } - - m_VidDispName.Empty(); - m_AudDispName.Empty(); - - m_closingmsg = ResStr(IDS_CONTROLS_CLOSED); - - AfxGetAppSettings().nCLSwitches &= CLSW_OPEN|CLSW_PLAY|CLSW_AFTERPLAYBACK_MASK|CLSW_NOFOCUS; - - m_iMediaLoadState = MLS_CLOSED; -} - -// msn - -void CMainFrame::SendNowPlayingToMSN() -{ - if(!AfxGetAppSettings().fNotifyMSN) - return; - - CString title, author; - - if(m_iMediaLoadState == MLS_LOADED) - { - m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_TITLE), title); - m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_AUTHOR), author); - - if(title.IsEmpty()) - { - CPlaylistItem pli; - m_wndPlaylistBar.GetCur(pli); - - if(!pli.m_fns.IsEmpty()) - { - CString label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead(); - - if(m_iPlaybackMode == PM_FILE) - { - CString fn = label; - if(fn.Find(_T("://")) >= 0) {int i = fn.Find('?'); if(i >= 0) fn = fn.Left(i);} - CPath path(fn); - path.StripPath(); - path.MakePretty(); - path.RemoveExtension(); - title = (LPCTSTR)path; - author.Empty(); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - title = label != pli.m_fns.GetHead() ? label : _T("Live"); - author.Empty(); - } - else if(m_iPlaybackMode == PM_DVD) - { - title = _T("DVD"); - author.Empty(); - } - } - } - } - - CStringW buff; - buff += L"\\0Music\\0"; - buff += title.IsEmpty() ? L"0" : L"1"; - buff += L"\\0"; - buff += author.IsEmpty() ? L"{0}" : L"{0} - {1}"; - buff += L"\\0"; - if(!author.IsEmpty()) {buff += CStringW(author) + L"\\0";} - buff += CStringW(title) + L"\\0"; - buff += L"\\0\\0"; - - COPYDATASTRUCT data; - data.dwData = 0x0547; - data.lpData = (PVOID)(LPCWSTR)buff; - data.cbData = buff.GetLength() * 2 + 2; - - HWND hWnd = NULL; - while(hWnd = ::FindWindowEx(NULL, hWnd, _T("MsnMsgrUIManager"), NULL)) - ::SendMessage(hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&data); -} - -// mIRC - -void CMainFrame::SendNowPlayingTomIRC() -{ - if(!AfxGetAppSettings().fNotifyGTSdll) - return; - - for(int i = 0; i < 20; i++) - { - HANDLE hFMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 1024, _T("mIRC")); - if(!hFMap) return; - - if(GetLastError() == ERROR_ALREADY_EXISTS) - { - CloseHandle(hFMap); - Sleep(50); - continue; - } - - if(LPVOID lpMappingAddress = MapViewOfFile(hFMap, FILE_MAP_WRITE, 0, 0, 0)) - { - LPCSTR cmd = m_fAudioOnly ? "/.timerAUDGTS 1 5 mpcaud" : "/.timerVIDGTS 1 5 mpcvid"; - strcpy((char*)lpMappingAddress, cmd); - - if(HWND hWnd = ::FindWindow(_T("mIRC"), NULL)) - ::SendMessage(hWnd, (WM_USER + 200), (WPARAM)1, (LPARAM)0); - - UnmapViewOfFile(lpMappingAddress); - } - - CloseHandle(hFMap); - - break; - } -} - -// dynamic menus - -void CMainFrame::SetupOpenCDSubMenu() -{ - CMenu* pSub = &m_opencds; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState == MLS_LOADING) return; - - if(AfxGetAppSettings().fHideCDROMsSubMenu) return; - - UINT id = ID_FILE_OPEN_CD_START; - - for(TCHAR drive = 'C'; drive <= 'Z'; drive++) - { - CString label = GetDriveLabel(drive), str; - - CAtlList files; - switch(GetCDROMType(drive, files)) - { - case CDROM_Audio: - if(label.IsEmpty()) label = _T("Audio CD"); - str.Format(_T("%s (%c:)"), label, drive); - break; - case CDROM_VideoCD: - if(label.IsEmpty()) label = _T("(S)VCD"); - str.Format(_T("%s (%c:)"), label, drive); - break; - case CDROM_DVDVideo: - if(label.IsEmpty()) label = _T("DVD Video"); - str.Format(_T("%s (%c:)"), label, drive); - break; - default: - break; - } - - if(!str.IsEmpty()) - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, str); - } -} - -void CMainFrame::SetupFiltersSubMenu() -{ - CMenu* pSub = &m_filters; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - m_filterpopups.RemoveAll(); - - m_pparray.RemoveAll(); - m_ssarray.RemoveAll(); - - if(m_iMediaLoadState == MLS_LOADED) - { - UINT idf = 0; - UINT ids = ID_FILTERS_SUBITEM_START; - UINT idl = ID_FILTERSTREAMS_SUBITEM_START; - - BeginEnumFilters(pGB, pEF, pBF) - { - CString name(GetFilterName(pBF)); - if(name.GetLength() >= 43) name = name.Left(40) + _T("..."); - - CLSID clsid = GetCLSID(pBF); - if(clsid == CLSID_AVIDec) - { - CComPtr pPin = GetFirstPin(pBF); - AM_MEDIA_TYPE mt; - if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt))) - { - DWORD c = ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression; - switch(c) - { - case BI_RGB: name += _T(" (RGB)"); break; - case BI_RLE4: name += _T(" (RLE4)"); break; - case BI_RLE8: name += _T(" (RLE8)"); break; - case BI_BITFIELDS: name += _T(" (BITF)"); break; - default: name.Format(_T("%s (%c%c%c%c)"), - CString(name), (TCHAR)((c>>0)&0xff), (TCHAR)((c>>8)&0xff), (TCHAR)((c>>16)&0xff), (TCHAR)((c>>24)&0xff)); break; - } - } - } - else if(clsid == CLSID_ACMWrapper) - { - CComPtr pPin = GetFirstPin(pBF); - AM_MEDIA_TYPE mt; - if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt))) - { - WORD c = ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag; - name.Format(_T("%s (0x%04x)"), CString(name), (int)c); - } - } - else if(clsid == __uuidof(CTextPassThruFilter) || clsid == __uuidof(CNullTextRenderer) - || clsid == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR - { - // hide these - continue; - } - - CAutoPtr pSubSub(new CMenu); - pSubSub->CreatePopupMenu(); - - int nPPages = 0; - - CComQIPtr pSPP = pBF; - -/* if(pSPP) - { - CAUUID caGUID; - caGUID.pElems = NULL; - if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0) - { -*/ m_pparray.Add(pBF); - pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, _T("&Properties...")); -/* - if(caGUID.pElems) CoTaskMemFree(caGUID.pElems); -*/ - nPPages++; -/* } - } -*/ - BeginEnumPins(pBF, pEP, pPin) - { - CString name = GetPinName(pPin); - name.Replace(_T("&"), _T("&&")); - - if(pSPP = pPin) - { - CAUUID caGUID; - caGUID.pElems = NULL; - if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0) - { - m_pparray.Add(pPin); - pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids+nPPages, name + _T(" (pin) properties...")); - - if(caGUID.pElems) CoTaskMemFree(caGUID.pElems); - - nPPages++; - } - } - } - EndEnumPins - - CComQIPtr pSS = pBF; - if(pSS) - { - DWORD nStreams = 0, flags, group, prevgroup = -1; - LCID lcid; - WCHAR* wname = NULL; - CComPtr pObj, pUnk; - - pSS->Count(&nStreams); - - if(nStreams > 0 && nPPages > 0) pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED); - - UINT idlstart = idl; - - for(DWORD i = 0; i < nStreams; i++, pObj = NULL, pUnk = NULL) - { - m_ssarray.Add(pSS); - - flags = group = 0; - wname = NULL; - pSS->Info(i, NULL, &flags, &lcid, &group, &wname, &pObj, &pUnk); - - if(group != prevgroup && idl > idlstart) - pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED); - prevgroup = group; - - if(flags & AMSTREAMSELECTINFO_EXCLUSIVE) - { - } - else if(flags & AMSTREAMSELECTINFO_ENABLED) - { - } - - if(!wname) - { - CStringW stream(L"Unknown Stream"); - wname = (WCHAR*)CoTaskMemAlloc((stream.GetLength()+3+1)*sizeof(WCHAR)); - swprintf(wname, L"%s %d", stream, min(i+1,999)); - } - - CString name(wname); - name.Replace(_T("&"), _T("&&")); - - pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, idl++, name); - - CoTaskMemFree(wname); - } - - if(nStreams == 0) pSS.Release(); - } - - if(nPPages == 1 && !pSS) - { - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, name); - } - else - { - pSub->AppendMenu(MF_BYPOSITION|MF_STRING|MF_DISABLED|MF_GRAYED, idf, name); - - if(nPPages > 0 || pSS) - { - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STATE|MIIM_SUBMENU; - mii.fType = MF_POPUP; - mii.hSubMenu = pSubSub->m_hMenu; - mii.fState = (pSPP || pSS) ? MF_ENABLED : (MF_DISABLED|MF_GRAYED); - pSub->SetMenuItemInfo(idf, &mii, TRUE); - - m_filterpopups.Add(pSubSub); - } - } - - ids += nPPages; - idf++; - } - EndEnumFilters - } -} - -void CMainFrame::SetupAudioSwitcherSubMenu() -{ - CMenu* pSub = &m_audios; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState == MLS_LOADED) - { - UINT id = ID_AUDIO_SUBITEM_START; - - CComQIPtr pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB); - if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); - - if(pSS) - { - DWORD cStreams = 0; - if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 0) - { - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_OPTIONS)); - pSub->AppendMenu(MF_SEPARATOR|MF_ENABLED); - - for(int i = 0; i < (int)cStreams; i++) - { - WCHAR* pName = NULL; - if(FAILED(pSS->Info(i, NULL, NULL, NULL, NULL, &pName, NULL, NULL))) - break; - - CString name(pName); - name.Replace(_T("&"), _T("&&")); - - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, name); - - CoTaskMemFree(pName); - } - } - } - } -} - -void CMainFrame::SetupSubtitlesSubMenu() -{ - CMenu* pSub = &m_subtitles; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly || !m_pCAP) - return; - - UINT id = ID_SUBTITLES_SUBITEM_START; - - POSITION pos = m_pSubStreams.GetHeadPosition(); - - if(pos) - { - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_OPTIONS)); - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_STYLES)); - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_RELOAD)); - pSub->AppendMenu(MF_SEPARATOR); - - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_ENABLE)); - pSub->AppendMenu(MF_SEPARATOR); - } - - while(pos) - { - CComPtr pSubStream = m_pSubStreams.GetNext(pos); - if(!pSubStream) continue; - - for(int i = 0, j = pSubStream->GetStreamCount(); i < j; i++) - { - WCHAR* pName = NULL; - if(SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, NULL))) - { - CString name(pName); - name.Replace(_T("&"), _T("&&")); - - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, name); - CoTaskMemFree(pName); - } - else - { - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, _T("")); - } - } - - // TODO: find a better way to group these entries - if(pos && m_pSubStreams.GetAt(pos)) - { - CLSID cur, next; - pSubStream->GetClassID(&cur); - m_pSubStreams.GetAt(pos)->GetClassID(&next); - - if(cur != next) - pSub->AppendMenu(MF_SEPARATOR); - } - } -} - -void CMainFrame::SetupNavAudioSubMenu() -{ - CMenu* pSub = &m_navaudio; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState != MLS_LOADED) return; - - UINT id = ID_NAVIGATE_AUDIO_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - SetupNavStreamSelectSubMenu(pSub, id, 1); - } - else if(m_iPlaybackMode == PM_DVD) - { - ULONG ulStreamsAvailable, ulCurrentStream; - if(FAILED(pDVDI->GetCurrentAudio(&ulStreamsAvailable, &ulCurrentStream))) - return; - - LCID DefLanguage; - DVD_AUDIO_LANG_EXT ext; - if(FAILED(pDVDI->GetDefaultAudioLanguage(&DefLanguage, &ext))) - return; - - for(ULONG i = 0; i < ulStreamsAvailable; i++) - { - LCID Language; - if(FAILED(pDVDI->GetAudioLanguage(i, &Language))) - continue; - - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(Language == DefLanguage) flags |= MF_DEFAULT; - if(i == ulCurrentStream) flags |= MF_CHECKED; - - CString str(_T("Unknown")); - if(Language) - { - int len = GetLocaleInfo(Language, LOCALE_SENGLANGUAGE, str.GetBuffer(256), 256); - str.ReleaseBufferSetLength(max(len-1, 0)); - } - - DVD_AudioAttributes ATR; - if(SUCCEEDED(pDVDI->GetAudioAttributes(i, &ATR))) - { - switch(ATR.LanguageExtension) - { - case DVD_AUD_EXT_NotSpecified: - default: break; - case DVD_AUD_EXT_Captions: str += _T(" (Captions)"); break; - case DVD_AUD_EXT_VisuallyImpaired: str += _T(" (Visually Impaired)"); break; - case DVD_AUD_EXT_DirectorComments1: str += _T(" (Director Comments 1)"); break; - case DVD_AUD_EXT_DirectorComments2: str += _T(" (Director Comments 2)"); break; - } - - CString format; - switch(ATR.AudioFormat) - { - case DVD_AudioFormat_AC3: format = _T("AC3"); break; - case DVD_AudioFormat_MPEG1: - case DVD_AudioFormat_MPEG1_DRC: format = _T("MPEG1"); break; - case DVD_AudioFormat_MPEG2: - case DVD_AudioFormat_MPEG2_DRC: format = _T("MPEG2"); break; - case DVD_AudioFormat_LPCM: format = _T("LPCM"); break; - case DVD_AudioFormat_DTS: format = _T("DTS"); break; - case DVD_AudioFormat_SDDS: format = _T("SDDS"); break; - } - - if(!format.IsEmpty()) - { - str.Format(_T("%s, %s %dHz %dbits %d channel(s)"), - CString(str), - format, - ATR.dwFrequency, - ATR.bQuantization, - ATR.bNumberOfChannels); - } - } - - str.Replace(_T("&"), _T("&&")); - - pSub->AppendMenu(flags, id++, str); - } - } -} - -void CMainFrame::SetupNavSubtitleSubMenu() -{ - CMenu* pSub = &m_navsubtitle; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState != MLS_LOADED) return; - - UINT id = ID_NAVIGATE_SUBP_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - SetupNavStreamSelectSubMenu(pSub, id, 2); - } - else if(m_iPlaybackMode == PM_DVD) - { - ULONG ulStreamsAvailable, ulCurrentStream; - BOOL bIsDisabled; - if(FAILED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)) - || ulStreamsAvailable == 0) - return; - - LCID DefLanguage; - DVD_SUBPICTURE_LANG_EXT ext; - if(FAILED(pDVDI->GetDefaultSubpictureLanguage(&DefLanguage, &ext))) - return; - - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|(bIsDisabled?0:MF_CHECKED), id++, _T("Enabled")); - pSub->AppendMenu(MF_BYCOMMAND|MF_SEPARATOR|MF_ENABLED); - - for(ULONG i = 0; i < ulStreamsAvailable; i++) - { - LCID Language; - if(FAILED(pDVDI->GetSubpictureLanguage(i, &Language))) - continue; - - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(Language == DefLanguage) flags |= MF_DEFAULT; - if(i == ulCurrentStream) flags |= MF_CHECKED; - - CString str(_T("Unknown")); - if(Language) - { - int len = GetLocaleInfo(Language, LOCALE_SENGLANGUAGE, str.GetBuffer(256), 256); - str.ReleaseBufferSetLength(max(len-1, 0)); - } - - DVD_SubpictureAttributes ATR; - if(SUCCEEDED(pDVDI->GetSubpictureAttributes(i, &ATR))) - { - switch(ATR.LanguageExtension) - { - case DVD_SP_EXT_NotSpecified: - default: break; - case DVD_SP_EXT_Caption_Normal: str += _T(""); break; - case DVD_SP_EXT_Caption_Big: str += _T(" (Big)"); break; - case DVD_SP_EXT_Caption_Children: str += _T(" (Children)"); break; - case DVD_SP_EXT_CC_Normal: str += _T(" (CC)"); break; - case DVD_SP_EXT_CC_Big: str += _T(" (CC Big)"); break; - case DVD_SP_EXT_CC_Children: str += _T(" (CC Children)"); break; - case DVD_SP_EXT_Forced: str += _T(" (Forced)"); break; - case DVD_SP_EXT_DirectorComments_Normal: str += _T(" (Director Comments)"); break; - case DVD_SP_EXT_DirectorComments_Big: str += _T(" (Director Comments, Big)"); break; - case DVD_SP_EXT_DirectorComments_Children: str += _T(" (Director Comments, Children)"); break; - } - } - - str.Replace(_T("&"), _T("&&")); - - pSub->AppendMenu(flags, id++, str); - } - } -} - -void CMainFrame::SetupNavAngleSubMenu() -{ - CMenu* pSub = &m_navangle; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState != MLS_LOADED) return; - - UINT id = ID_NAVIGATE_ANGLE_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - SetupNavStreamSelectSubMenu(pSub, id, 0); - } - else if(m_iPlaybackMode == PM_DVD) - { - ULONG ulStreamsAvailable, ulCurrentStream; - if(FAILED(pDVDI->GetCurrentAngle(&ulStreamsAvailable, &ulCurrentStream))) - return; - - if(ulStreamsAvailable < 2) return; // one choice is not a choice... - - for(ULONG i = 1; i <= ulStreamsAvailable; i++) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(i == ulCurrentStream) flags |= MF_CHECKED; - - CString str; - str.Format(_T("Angle %d"), i); - - pSub->AppendMenu(flags, id++, str); - } - } -} - -void CMainFrame::SetupNavChaptersSubMenu() -{ - CMenu* pSub = &m_navchapters; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - if(m_iMediaLoadState != MLS_LOADED) - return; - - UINT id = ID_NAVIGATE_CHAP_SUBITEM_START; - - if(m_iPlaybackMode == PM_FILE) - { - SetupChapters(); - - REFERENCE_TIME rt = GetPos(); - DWORD j = m_pCB->ChapLookup(&rt, NULL); - - for(DWORD i = 0; i < m_pCB->ChapGetCount(); i++, id++) - { - rt = 0; - CComBSTR bstr; - if(FAILED(m_pCB->ChapGet(i, &rt, &bstr))) - continue; - - int s = (int)((rt/10000000)%60); - int m = (int)((rt/10000000/60)%60); - int h = (int)((rt/10000000/60/60)); - - CString time; - time.Format(_T("[%02d:%02d:%02d] "), h, m, s); - - CString name = CString(bstr); - name.Replace(_T("&"), _T("&&")); - name.Replace(_T("\t"), _T(" ")); - - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(i == j) flags |= MF_CHECKED; - if(id != ID_NAVIGATE_CHAP_SUBITEM_START && i == 0) pSub->AppendMenu(MF_SEPARATOR); - pSub->AppendMenu(flags, id, name + '\t' + time); - } - - if(m_wndPlaylistBar.GetCount() > 1) - { - POSITION pos = m_wndPlaylistBar.m_pl.GetHeadPosition(); - while(pos) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(pos == m_wndPlaylistBar.m_pl.GetPos()) flags |= MF_CHECKED; - if(id != ID_NAVIGATE_CHAP_SUBITEM_START && pos == m_wndPlaylistBar.m_pl.GetHeadPosition()) - pSub->AppendMenu(MF_SEPARATOR); - CPlaylistItem& pli = m_wndPlaylistBar.m_pl.GetNext(pos); - CString name = pli.GetLabel(); - name.Replace(_T("&"), _T("&&")); - pSub->AppendMenu(flags, id++, name); - } - } - } - else if(m_iPlaybackMode == PM_DVD) - { - ULONG ulNumOfVolumes, ulVolume; - DVD_DISC_SIDE Side; - ULONG ulNumOfTitles = 0; - pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles); - - DVD_PLAYBACK_LOCATION2 Location; - pDVDI->GetCurrentLocation(&Location); - - ULONG ulNumOfChapters = 0; - pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters); - - ULONG ulUOPs = 0; - pDVDI->GetCurrentUOPS(&ulUOPs); - - for(ULONG i = 1; i <= ulNumOfTitles; i++) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(i == Location.TitleNum) flags |= MF_CHECKED; - if(ulUOPs&UOP_FLAG_Play_Title) flags |= MF_DISABLED|MF_GRAYED; - - CString str; - str.Format(_T("Title %d"), i); - - pSub->AppendMenu(flags, id++, str); - } - - for(ULONG i = 1; i <= ulNumOfChapters; i++) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(i == Location.ChapterNum) flags |= MF_CHECKED; - if(ulUOPs&UOP_FLAG_Play_Chapter) flags |= MF_DISABLED|MF_GRAYED; - if(i == 1) flags |= MF_MENUBARBREAK; - - CString str; - str.Format(_T("Chapter %d"), i); - - pSub->AppendMenu(flags, id++, str); - } - } -} - -void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGroup) -{ - UINT baseid = id; - - CComQIPtr pSS = FindFilter(CLSID_OggSplitter, pGB); - if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB); - if(!pSS) return; - - DWORD cStreams; - if(FAILED(pSS->Count(&cStreams))) - return; - - DWORD dwPrevGroup = -1; - - for(int i = 0, j = cStreams; i < j; i++) - { - DWORD dwFlags, dwGroup; - LCID lcid; - WCHAR* pszName = NULL; - - if(FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)) - || !pszName) - continue; - - CString name(pszName); - CString lcname = CString(name).MakeLower(); - - if(pszName) CoTaskMemFree(pszName); - - if(dwGroup != dwSelGroup) - continue; - - if(dwPrevGroup != -1 && dwPrevGroup != dwGroup) - pSub->AppendMenu(MF_SEPARATOR); - dwPrevGroup = dwGroup; - - CString str; - - if(lcname.Find(_T(" off")) >= 0) - { - str = _T("Disabled"); - } - else - { - if(lcid == 0) - { - str.Format(_T("Unknown %d"), id - baseid); - } - else - { - int len = GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, str.GetBuffer(64), 64); - str.ReleaseBufferSetLength(max(len-1, 0)); - } - - CString lcstr = CString(str).MakeLower(); - - if(str.IsEmpty() || lcname.Find(lcstr) >= 0) str = name; - else if(!name.IsEmpty()) str = CString(name) + _T(" (") + str + _T(")"); - } - - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - if(dwFlags) flags |= MF_CHECKED; - - str.Replace(_T("&"), _T("&&")); - pSub->AppendMenu(flags, id++, str); - } -} - -void CMainFrame::OnNavStreamSelectSubMenu(UINT id, DWORD dwSelGroup) -{ - CComQIPtr pSS = FindFilter(CLSID_OggSplitter, pGB); - if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB); - if(!pSS) return; - - DWORD cStreams; - if(FAILED(pSS->Count(&cStreams))) - return; - - for(int i = 0, j = cStreams; i < j; i++) - { - DWORD dwFlags, dwGroup; - LCID lcid; - WCHAR* pszName = NULL; - - if(FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)) - || !pszName) - continue; - - if(pszName) CoTaskMemFree(pszName); - - if(dwGroup != dwSelGroup) - continue; - - if(id == 0) - { - pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE); - break; - } - - id--; - } -} - -void CMainFrame::SetupFavoritesSubMenu() -{ - CMenu* pSub = &m_favorites; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - AppSettings& s = AfxGetAppSettings(); - - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_FAVORITES_ADD, ResStr(IDS_FAVORITES_ADD)); - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_FAVORITES_ORGANIZE, ResStr(IDS_FAVORITES_ORGANIZE)); - - int nLastGroupStart = pSub->GetMenuItemCount(); - - UINT id = ID_FAVORITES_FILE_START; - - CAtlList sl; - AfxGetAppSettings().GetFav(FAV_FILE, sl); - - POSITION pos = sl.GetHeadPosition(); - while(pos) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - - CString str = sl.GetNext(pos); - str.Replace(_T("&"), _T("&&")); - str.Replace(_T("\t"), _T(" ")); - - CAtlList sl; - Explode(str, sl, ';', 2); - - str = sl.RemoveHead(); - - if(!sl.IsEmpty()) - { - REFERENCE_TIME rt = 0; - if(1 == _stscanf(sl.GetHead(), _T("%I64d"), &rt) && rt > 0) - { - DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt, 0); - str.Format(_T("%s\t[%02d:%02d:%02d]"), CString(str), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds); - } - } - - if(!str.IsEmpty()) - pSub->AppendMenu(flags, id, str); - - id++; - } - - if(id > ID_FAVORITES_FILE_START) - pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION); - - nLastGroupStart = pSub->GetMenuItemCount(); - - id = ID_FAVORITES_DVD_START; - - AfxGetAppSettings().GetFav(FAV_DVD, sl); - - pos = sl.GetHeadPosition(); - while(pos) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - - CString str = sl.GetNext(pos); - str.Replace(_T("&"), _T("&&")); - - CAtlList sl; - Explode(str, sl, ';', 2); - - str = sl.RemoveHead(); - - if(!sl.IsEmpty()) - { - // TODO - } - - if(!str.IsEmpty()) - pSub->AppendMenu(flags, id, str); - - id++; - } - - if(id > ID_FAVORITES_DVD_START) - pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION); - - nLastGroupStart = pSub->GetMenuItemCount(); - - id = ID_FAVORITES_DEVICE_START; - - AfxGetAppSettings().GetFav(FAV_DEVICE, sl); - - pos = sl.GetHeadPosition(); - while(pos) - { - UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED; - - CString str = sl.GetNext(pos); - str.Replace(_T("&"), _T("&&")); - - CAtlList sl; - Explode(str, sl, ';', 2); - - str = sl.RemoveHead(); - - if(!str.IsEmpty()) - pSub->AppendMenu(flags, id, str); - - id++; - } -} - -void CMainFrame::SetupShadersSubMenu() -{ - CMenu* pSub = &m_shaders; - - if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu(); - else while(pSub->RemoveMenu(0, MF_BYPOSITION)); - - CWinApp* pApp = AfxGetApp(); - - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_START, ResStr(IDS_SHADER_OFF)); - - UINT id = ID_SHADERS_START+1; - - if(POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition()) - { - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SHADER_COMBINE)); - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SHADER_EDIT)); - pSub->AppendMenu(MF_SEPARATOR); - - MENUITEMINFO mii; - memset(&mii, 0, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask |= MIIM_DATA; - - while(pos) - { - const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos); - CString label = s.label; - label.Replace(_T("&"), _T("&&")); - pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id, label); - mii.dwItemData = (ULONG_PTR)&s; - pSub->SetMenuItemInfo(id, &mii); - id++; - } - } -} - -///////////// - -void CMainFrame::ShowControls(int nCS, bool fSave) -{ - int nCSprev = AfxGetAppSettings().nCS; - int hbefore = 0, hafter = 0; - - m_pLastBar = NULL; - - POSITION pos = m_bars.GetHeadPosition(); - for(int i = 1; pos; i <<= 1) - { - CControlBar* pNext = m_bars.GetNext(pos); - ShowControlBar(pNext, !!(nCS&i), TRUE); - if(nCS&i) m_pLastBar = pNext; - - CSize s = pNext->CalcFixedLayout(FALSE, TRUE); - if(nCSprev&i) hbefore += s.cy; - if(nCS&i) hafter += s.cy; - } - - WINDOWPLACEMENT wp; - wp.length = sizeof(wp); - GetWindowPlacement(&wp); - - if(wp.showCmd != SW_SHOWMAXIMIZED && !m_fFullScreen) - { - CRect r; - GetWindowRect(r); - MoveWindow(r.left, r.top, r.Width(), r.Height()+(hafter-hbefore)); - } - - if(fSave) - AfxGetAppSettings().nCS = nCS; - - RecalcLayout(); -} - -void CMainFrame::SetAlwaysOnTop(int i) -{ - AfxGetAppSettings().iOnTop = i; - - if(!m_fFullScreen) - { - const CWnd* pInsertAfter = NULL; - - if(i == 0) - pInsertAfter = &wndNoTopMost; - else if(i == 1) - pInsertAfter = &wndTopMost; - else // if(i == 2) - pInsertAfter = GetMediaState() == State_Running ? &wndTopMost : &wndNoTopMost; - - SetWindowPos(pInsertAfter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); - } - else if(!(GetWindowLong(m_hWnd, GWL_EXSTYLE)&WS_EX_TOPMOST)) - { - SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); - } -} - -void CMainFrame::AddTextPassThruFilter() -{ - BeginEnumFilters(pGB, pEF, pBF) - { - if(!IsSplitter(pBF)) continue; - - BeginEnumPins(pBF, pEP, pPin) - { - CComPtr pPinTo; - AM_MEDIA_TYPE mt; - if(FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo - || FAILED(pPin->ConnectionMediaType(&mt)) - || mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) - continue; - - CComQIPtr pTPTF = new CTextPassThruFilter(this); - CStringW name; - name.Format(L"TextPassThru%08x", pTPTF); - if(FAILED(pGB->AddFilter(pTPTF, name))) - continue; - - HRESULT hr; - - hr = pPinTo->Disconnect(); - hr = pPin->Disconnect(); - - if(FAILED(hr = pGB->ConnectDirect(pPin, GetFirstPin(pTPTF, PINDIR_INPUT), NULL)) - || FAILED(hr = pGB->ConnectDirect(GetFirstPin(pTPTF, PINDIR_OUTPUT), pPinTo, NULL))) - hr = pGB->ConnectDirect(pPin, pPinTo, NULL); - else - m_pSubStreams.AddTail(CComQIPtr(pTPTF)); - } - EndEnumPins - } - EndEnumFilters -} - -bool CMainFrame::LoadSubtitle(CString fn) -{ - CComPtr pSubStream; - - // TMP: maybe this will catch something for those who get a runtime error dialog when opening subtitles from cds - try - { - if(!pSubStream) - { - CAutoPtr p(new CVobSubFile(&m_csSubLock)); - if(CString(CPath(fn).GetExtension()).MakeLower() == _T(".idx") && p && p->Open(fn) && p->GetStreamCount() > 0) - pSubStream = p.Detach(); - } - - if(!pSubStream) - { - CAutoPtr p(new ssf::CRenderer(&m_csSubLock)); - if(p && p->Open(fn) && p->GetStreamCount() > 0) - pSubStream = p.Detach(); - } - - if(!pSubStream) - { - CAutoPtr p(new CRenderedTextSubtitle(&m_csSubLock)); - if(p && p->Open(fn, DEFAULT_CHARSET) && p->GetStreamCount() > 0) - pSubStream = p.Detach(); - } - } - catch(CException* e) - { - e->Delete(); - } - - if(pSubStream) - { - m_pSubStreams.AddTail(pSubStream); - } - - return(!!pSubStream); -} - -void CMainFrame::UpdateSubtitle(bool fApplyDefStyle) -{ - if(!m_pCAP) return; - - int i = m_iSubtitleSel; - - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos && i >= 0) - { - CComPtr pSubStream = m_pSubStreams.GetNext(pos); - - if(i < pSubStream->GetStreamCount()) - { - CAutoLock cAutoLock(&m_csSubLock); - pSubStream->SetStream(i); - SetSubtitle(pSubStream, fApplyDefStyle); - return; - } - - i -= pSubStream->GetStreamCount(); - } - - m_pCAP->SetSubPicProvider(NULL); -} - -void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle) -{ - AppSettings& s = AfxGetAppSettings(); - - if(pSubStream) - { - CLSID clsid; - pSubStream->GetClassID(&clsid); - - if(clsid == __uuidof(CVobSubFile)) - { - CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubStream; - - if(fApplyDefStyle) - { - pVSF->SetAlignment(s.fOverridePlacement, s.nHorPos, s.nVerPos, 1, 1); - } - } - else if(clsid == __uuidof(CVobSubStream)) - { - CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)pSubStream; - - if(fApplyDefStyle) - { - pVSS->SetAlignment(s.fOverridePlacement, s.nHorPos, s.nVerPos, 1, 1); - } - } - else if(clsid == __uuidof(CRenderedTextSubtitle)) - { - CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream; - - STSStyle style; - - if(fApplyDefStyle || !pRTS->m_fUsingDefaultStyleFromScript) - { - style = s.subdefstyle; - - if(s.fOverridePlacement) - { - style.scrAlignment = 2; - int w = pRTS->m_dstScreenSize.cx; - int h = pRTS->m_dstScreenSize.cy; - int mw = w - style.marginRect.left - style.marginRect.right; - style.marginRect.bottom = h - MulDiv(h, s.nVerPos, 100); - style.marginRect.left = MulDiv(w, s.nHorPos, 100) - mw/2; - style.marginRect.right = w - (style.marginRect.left + mw); - } - - pRTS->SetDefaultStyle(style); - } - - if(pRTS->GetDefaultStyle(style) && style.relativeTo == 2) - { - style.relativeTo = s.subdefstyle.relativeTo; - pRTS->SetDefaultStyle(style); - } - - pRTS->Deinit(); - } - } - - if(!fApplyDefStyle) - { - m_iSubtitleSel = -1; - - if(pSubStream) - { - - int i = 0; - - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos) - { - CComPtr pSubStream2 = m_pSubStreams.GetNext(pos); - - if(pSubStream == pSubStream2) - { - m_iSubtitleSel = i + pSubStream2->GetStream(); - break; - } - - i += pSubStream2->GetStreamCount(); - } - - } - } - - m_nSubtitleId = (DWORD_PTR)pSubStream; - - if(m_pCAP) - { - m_pCAP->SetSubPicProvider(CComQIPtr(pSubStream)); - m_wndSubresyncBar.SetSubtitle(pSubStream, m_pCAP->GetFPS()); - } -} - -void CMainFrame::ReplaceSubtitle(ISubStream* pSubStreamOld, ISubStream* pSubStreamNew) -{ - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos) - { - POSITION cur = pos; - if(pSubStreamOld == m_pSubStreams.GetNext(pos)) - { - m_pSubStreams.SetAt(cur, pSubStreamNew); - UpdateSubtitle(); - break; - } - } -} - -void CMainFrame::InvalidateSubtitle(DWORD_PTR nSubtitleId, REFERENCE_TIME rtInvalidate) -{ - if(m_pCAP) - { - if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId) - m_pCAP->Invalidate(rtInvalidate); - } -} - -void CMainFrame::ReloadSubtitle() -{ - POSITION pos = m_pSubStreams.GetHeadPosition(); - while(pos) m_pSubStreams.GetNext(pos)->Reload(); - UpdateSubtitle(); -} - -REFERENCE_TIME CMainFrame::GetPos() -{ - return(m_iMediaLoadState == MLS_LOADED ? m_wndSeekBar.GetPos() : 0); -} - -REFERENCE_TIME CMainFrame::GetDur() -{ - __int64 start, stop; - m_wndSeekBar.GetRange(start, stop); - return(m_iMediaLoadState == MLS_LOADED ? stop : 0); -} - -void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame) -{ - OAFilterState fs = GetMediaState(); - - if(rtPos < 0) rtPos = 0; - - if(m_iPlaybackMode == PM_FILE) - { - if(fs == State_Stopped) - SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - - HRESULT hr; - - if(fSeekToKeyFrame) - { - if(!m_kfs.IsEmpty()) - { - int i = rangebsearch(rtPos, m_kfs); - if(i >= 0 && i < m_kfs.GetCount()) - rtPos = m_kfs[i]; - } - } - - hr = pMS->SetPositions(&rtPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); - } - else if(m_iPlaybackMode == PM_DVD && m_iDVDDomain == DVD_DOMAIN_Title) - { - if(fs != State_Running) - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - DVD_HMSF_TIMECODE tc = RT2HMSF(rtPos); - pDVDC->PlayAtTime(&tc, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); - -// if(fs != State_Running) -// SendMessage(WM_COMMAND, ID_PLAY_PAUSE); - } - else if(m_iPlaybackMode == PM_CAPTURE) - { - TRACE(_T("Warning (CMainFrame::SeekTo): Trying to seek in capture mode")); - } - - m_fEndOfStream = false; -} - -void CMainFrame::CleanGraph() -{ - if(!pGB) return; - - BeginEnumFilters(pGB, pEF, pBF) - { - CComQIPtr pAMMF(pBF); - if(pAMMF && (pAMMF->GetMiscFlags()&AM_FILTER_MISC_FLAGS_IS_SOURCE)) - continue; - - // some capture filters forget to set AM_FILTER_MISC_FLAGS_IS_SOURCE - // or to implement the IAMFilterMiscFlags interface - if(pBF == pVidCap || pBF == pAudCap) - continue; - - if(CComQIPtr(pBF)) - continue; - - int nIn, nOut, nInC, nOutC; - if(CountPins(pBF, nIn, nOut, nInC, nOutC) > 0 && (nInC+nOutC) == 0) - { - TRACE(CStringW(L"Removing: ") + GetFilterName(pBF) + '\n'); - - pGB->RemoveFilter(pBF); - pEF->Reset(); - } - } - EndEnumFilters -} - -#define AUDIOBUFFERLEN 500 - -static void SetLatency(IBaseFilter* pBF, int cbBuffer) -{ - BeginEnumPins(pBF, pEP, pPin) - { - if(CComQIPtr pAMBN = pPin) - { - ALLOCATOR_PROPERTIES ap; - ap.cbAlign = -1; // -1 means no preference. - ap.cbBuffer = cbBuffer; - ap.cbPrefix = -1; - ap.cBuffers = -1; - pAMBN->SuggestAllocatorProperties(&ap); - } - } - EndEnumPins -} - -HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& majortype, AM_MEDIA_TYPE* pmt) -{ - IBaseFilter* pBuff = pBF[0]; - IBaseFilter* pEnc = pBF[1]; - IBaseFilter* pMux = pBF[2]; - - if(!pPin || !pMux) return E_FAIL; - - CString err; - - HRESULT hr = S_OK; - - CFilterInfo fi; - if(FAILED(pMux->QueryFilterInfo(&fi)) || !fi.pGraph) - pGB->AddFilter(pMux, L"Multiplexer"); - - CStringW prefix, prefixl; - if(majortype == MEDIATYPE_Video) prefix = L"Video "; - else if(majortype == MEDIATYPE_Audio) prefix = L"Audio "; - prefixl = prefix; - prefixl.MakeLower(); - - if(pBuff) - { - hr = pGB->AddFilter(pBuff, prefix + L"Buffer"); - if(FAILED(hr)) - { - err = _T("Can't add ") + CString(prefixl) + _T("buffer filter"); - AfxMessageBox(err); - return hr; - } - - hr = pGB->ConnectFilter(pPin, pBuff); - if(FAILED(hr)) - { - err = _T("Error connecting the ") + CString(prefixl) + _T("buffer filter"); - AfxMessageBox(err); - return(hr); - } - - pPin = GetFirstPin(pBuff, PINDIR_OUTPUT); - } - - if(pEnc) - { - hr = pGB->AddFilter(pEnc, prefix + L"Encoder"); - if(FAILED(hr)) - { - err = _T("Can't add ") + CString(prefixl) + _T("encoder filter"); - AfxMessageBox(err); - return hr; - } - - hr = pGB->ConnectFilter(pPin, pEnc); - if(FAILED(hr)) - { - err = _T("Error connecting the ") + CString(prefixl) + _T("encoder filter"); - AfxMessageBox(err); - return(hr); - } - - pPin = GetFirstPin(pEnc, PINDIR_OUTPUT); - - if(CComQIPtr pAMSC = pPin) - { - if(pmt->majortype == majortype) - { - hr = pAMSC->SetFormat(pmt); - if(FAILED(hr)) - { - err = _T("Can't set compression format on the ") + CString(prefixl) + _T("encoder filter"); - AfxMessageBox(err); - return(hr); - } - } - } - - } - -// if(pMux) - { - hr = pGB->ConnectFilter(pPin, pMux); - if(FAILED(hr)) - { - err = _T("Error connecting ") + CString(prefixl) + _T(" to the muliplexer filter"); - AfxMessageBox(err); - return(hr); - } - } - - CleanGraph(); - - return S_OK; -} - -bool CMainFrame::BuildToCapturePreviewPin( - IBaseFilter* pVidCap, IPin** ppVidCapPin, IPin** ppVidPrevPin, - IBaseFilter* pAudCap, IPin** ppAudCapPin, IPin** ppAudPrevPin) -{ - HRESULT hr; - - *ppVidCapPin = *ppVidPrevPin = NULL; - *ppAudCapPin = *ppAudPrevPin = NULL; - - CComPtr pDVAudPin; - - if(pVidCap) - { - CComPtr pPin; - if(!pAudCap // only look for interleaved stream when we don't use any other audio capture source - && SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, TRUE, 0, &pPin))) - { - CComPtr pDVSplitter; - hr = pDVSplitter.CoCreateInstance(CLSID_DVSplitter); - hr = pGB->AddFilter(pDVSplitter, L"DV Splitter"); - - hr = pCGB->RenderStream(NULL, &MEDIATYPE_Interleaved, pPin, NULL, pDVSplitter); - - pPin = NULL; - hr = pCGB->FindPin(pDVSplitter, PINDIR_OUTPUT, NULL, &MEDIATYPE_Video, TRUE, 0, &pPin); - hr = pCGB->FindPin(pDVSplitter, PINDIR_OUTPUT, NULL, &MEDIATYPE_Audio, TRUE, 0, &pDVAudPin); - - CComPtr pDVDec; - hr = pDVDec.CoCreateInstance(CLSID_DVVideoCodec); - hr = pGB->AddFilter(pDVDec, L"DV Video Decoder"); - - hr = pGB->ConnectFilter(pPin, pDVDec); - - pPin = NULL; - hr = pCGB->FindPin(pDVDec, PINDIR_OUTPUT, NULL, &MEDIATYPE_Video, TRUE, 0, &pPin); - } - else if(SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, TRUE, 0, &pPin))) - { - } - else - { - AfxMessageBox(_T("No video capture pin was found")); - return(false); - } - - CComPtr pSmartTee; - hr = pSmartTee.CoCreateInstance(CLSID_SmartTee); - hr = pGB->AddFilter(pSmartTee, L"Smart Tee (video)"); - - hr = pGB->ConnectFilter(pPin, pSmartTee); - - hr = pSmartTee->FindPin(L"Preview", ppVidPrevPin); - hr = pSmartTee->FindPin(L"Capture", ppVidCapPin); - } - - if(pAudCap || pDVAudPin) - { - CComPtr pPin; - if(pDVAudPin) - { - pPin = pDVAudPin; - } - else if(SUCCEEDED(pCGB->FindPin(pAudCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, TRUE, 0, &pPin))) - { - } - else - { - AfxMessageBox(_T("No audio capture pin was found")); - return(false); - } - - CComPtr pSmartTee; - hr = pSmartTee.CoCreateInstance(CLSID_SmartTee); - hr = pGB->AddFilter(pSmartTee, L"Smart Tee (audio)"); - - hr = pGB->ConnectFilter(pPin, pSmartTee); - - hr = pSmartTee->FindPin(L"Preview", ppAudPrevPin); - hr = pSmartTee->FindPin(L"Capture", ppAudCapPin); - } - - return(true); -} - -bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPreview, bool fACapture) -{ - if(!pCGB) return(false); - - SaveMediaState; - - HRESULT hr; - - pGB->NukeDownstream(pVidCap); - pGB->NukeDownstream(pAudCap); - - CleanGraph(); - - if(pAMVSCCap) hr = pAMVSCCap->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv); - if(pAMVSCPrev) hr = pAMVSCPrev->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv); - if(pAMASC) hr = pAMASC->SetFormat(&m_wndCaptureBar.m_capdlg.m_mta); - - CComPtr pVidBuffer = m_wndCaptureBar.m_capdlg.m_pVidBuffer; - CComPtr pAudBuffer = m_wndCaptureBar.m_capdlg.m_pAudBuffer; - CComPtr pVidEnc = m_wndCaptureBar.m_capdlg.m_pVidEnc; - CComPtr pAudEnc = m_wndCaptureBar.m_capdlg.m_pAudEnc; - CComPtr pMux = m_wndCaptureBar.m_capdlg.m_pMux; - CComPtr pDst = m_wndCaptureBar.m_capdlg.m_pDst; - CComPtr pAudMux = m_wndCaptureBar.m_capdlg.m_pAudMux; - CComPtr pAudDst = m_wndCaptureBar.m_capdlg.m_pAudDst; - - bool fFileOutput = (pMux && pDst) || (pAudMux && pAudDst); - bool fCapture = (fVCapture || fACapture); - - if(pAudCap) - { - AM_MEDIA_TYPE* pmt = &m_wndCaptureBar.m_capdlg.m_mta; - int ms = (fACapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fAudOutput) ? AUDIOBUFFERLEN : 60; - if(pMux != pAudMux && fACapture) SetLatency(pAudCap, -1); - else if(pmt->pbFormat) SetLatency(pAudCap, ((WAVEFORMATEX*)pmt->pbFormat)->nAvgBytesPerSec * ms / 1000); - } - - CComPtr pVidCapPin, pVidPrevPin, pAudCapPin, pAudPrevPin; - BuildToCapturePreviewPin(pVidCap, &pVidCapPin, &pVidPrevPin, pAudCap, &pAudCapPin, &pAudPrevPin); - -// if(pVidCap) - { - bool fVidPrev = pVidPrevPin && fVPreview; - bool fVidCap = pVidCapPin && fVCapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fVidOutput; - - if(fVPreview == 2 && !fVidCap && pVidCapPin) - { - pVidPrevPin = pVidCapPin; - pVidCapPin = NULL; - } - - if(fVidPrev) - { - m_pCAP = NULL; - pGB->Render(pVidPrevPin); - pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter), (void**)&m_pCAP, TRUE); - } - - if(fVidCap) - { - IBaseFilter* pBF[3] = {pVidBuffer, pVidEnc, pMux}; - HRESULT hr = BuildCapture(pVidCapPin, pBF, MEDIATYPE_Video, &m_wndCaptureBar.m_capdlg.m_mtcv); - } - - pAMDF = NULL; - pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMDroppedFrames, (void**)&pAMDF); - } - -// if(pAudCap) - { - bool fAudPrev = pAudPrevPin && fAPreview; - bool fAudCap = pAudCapPin && fACapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fAudOutput; - - if(fAPreview == 2 && !fAudCap && pAudCapPin) - { - pAudPrevPin = pAudCapPin; - pAudCapPin = NULL; - } - - if(fAudPrev) - { - pGB->Render(pAudPrevPin); - } - - if(fAudCap) - { - IBaseFilter* pBF[3] = {pAudBuffer, pAudEnc, pAudMux ? pAudMux : pMux}; - HRESULT hr = BuildCapture(pAudCapPin, pBF, MEDIATYPE_Audio, &m_wndCaptureBar.m_capdlg.m_mtca); - } - } - - if((pVidCap || pAudCap) && fCapture && fFileOutput) - { - if(pMux != pDst) - { - hr = pGB->AddFilter(pDst, L"File Writer V/A"); - hr = pGB->ConnectFilter(GetFirstPin(pMux, PINDIR_OUTPUT), pDst); - } - - if(CComQIPtr pCAM = pMux) - { - int nIn, nOut, nInC, nOutC; - CountPins(pMux, nIn, nOut, nInC, nOutC); - pCAM->SetMasterStream(nInC-1); -// pCAM->SetMasterStream(-1); - pCAM->SetOutputCompatibilityIndex(FALSE); - } - - if(CComQIPtr pCI = pMux) - { -// if(FAILED(pCI->put_Mode(INTERLEAVE_CAPTURE))) - if(FAILED(pCI->put_Mode(INTERLEAVE_NONE_BUFFERED))) - pCI->put_Mode(INTERLEAVE_NONE); - - REFERENCE_TIME rtInterleave = 10000i64*AUDIOBUFFERLEN, rtPreroll = 0;//10000i64*500 - pCI->put_Interleaving(&rtInterleave, &rtPreroll); - } - - if(pMux != pAudMux && pAudMux != pAudDst) - { - hr = pGB->AddFilter(pAudDst, L"File Writer A"); - hr = pGB->ConnectFilter(GetFirstPin(pAudMux, PINDIR_OUTPUT), pAudDst); - } - } - - REFERENCE_TIME stop = MAX_TIME; - hr = pCGB->ControlStream(&PIN_CATEGORY_CAPTURE, NULL, NULL, NULL, &stop, 0, 0); // stop in the infinite - - CleanGraph(); - - OpenSetupVideo(); - OpenSetupAudio(); - OpenSetupStatsBar(); - OpenSetupStatusBar(); - - RestoreMediaState; - - return(true); -} - -bool CMainFrame::StartCapture() -{ - if(!pCGB || m_fCapturing) return(false); - - if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) return(false); - - HRESULT hr; - - ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); - - // rare to see two capture filters to support IAMPushSource at the same time... -// hr = CComQIPtr(pGB)->SyncUsingStreamOffset(TRUE); // TODO: - - BuildGraphVideoAudio( - m_wndCaptureBar.m_capdlg.m_fVidPreview, true, - m_wndCaptureBar.m_capdlg.m_fAudPreview, true); - - hr = pME->CancelDefaultHandling(EC_REPAINT); - - SendMessage(WM_COMMAND, ID_PLAY_PLAY); - - m_fCapturing = true; - - return(true); -} - -bool CMainFrame::StopCapture() -{ - if(!pCGB || !m_fCapturing) return(false); - - if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) return(false); - - HRESULT hr; - - m_wndStatusBar.SetStatusMessage(ResStr(IDS_CONTROLS_COMPLETING)); - - m_fCapturing = false; - - BuildGraphVideoAudio( - m_wndCaptureBar.m_capdlg.m_fVidPreview, false, - m_wndCaptureBar.m_capdlg.m_fAudPreview, false); - - hr = pME->RestoreDefaultHandling(EC_REPAINT); - - ::SetPriorityClass(::GetCurrentProcess(), AfxGetAppSettings().priority); - - m_rtDurationOverride = -1; - - return(true); -} - -// - -void CMainFrame::ShowOptions(int idPage) -{ - AppSettings& s = AfxGetAppSettings(); - - CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), pGB, this, idPage); - - if(options.DoModal() == IDOK) - { - if(!m_fFullScreen) - SetAlwaysOnTop(s.iOnTop); - - m_wndView.LoadLogo(); - - s.UpdateData(true); - } -} - -void CMainFrame::StartWebServer(int nPort) -{ - if(!m_pWebServer) - m_pWebServer.Attach(new CWebServer(this, nPort)); -} - -void CMainFrame::StopWebServer() -{ - if(m_pWebServer) - m_pWebServer.Free(); -} - -CString CMainFrame::GetStatusMessage() -{ - CString str; - m_wndStatusBar.m_status.GetWindowText(str); - return str; -} - -void CMainFrame::SendStatusMessage(CString msg, int nTimeOut) -{ - KillTimer(TIMER_STATUSERASER); - - m_playingmsg.Empty(); - if(nTimeOut <= 0) return; - - m_playingmsg = msg; - SetTimer(TIMER_STATUSERASER, nTimeOut, NULL); -} - -void CMainFrame::OpenCurPlaylistItem(REFERENCE_TIME rtStart) -{ - if(m_wndPlaylistBar.GetCount() == 0) - return; - - CPlaylistItem pli; - if(!m_wndPlaylistBar.GetCur(pli)) m_wndPlaylistBar.SetFirst(); - if(!m_wndPlaylistBar.GetCur(pli)) return; - - CAutoPtr p(m_wndPlaylistBar.GetCurOMD(rtStart)); - if(p) OpenMedia(p); -} - -void CMainFrame::AddCurDevToPlaylist() -{ - if(m_iPlaybackMode == PM_CAPTURE) - { - m_wndPlaylistBar.Append( - m_VidDispName, - m_AudDispName, - m_wndCaptureBar.m_capdlg.GetVideoInput(), - m_wndCaptureBar.m_capdlg.GetVideoChannel(), - m_wndCaptureBar.m_capdlg.GetAudioInput() - ); - } -} - -static int s_fOpenedThruThread = false; - -void CMainFrame::OpenMedia(CAutoPtr pOMD) -{ - // shortcut - if(OpenDeviceData* p = dynamic_cast(pOMD.m_p)) - { - if(m_iMediaLoadState == MLS_LOADED && pAMTuner - && m_VidDispName == p->DisplayName[0] && m_AudDispName == p->DisplayName[1]) - { - m_wndCaptureBar.m_capdlg.SetVideoInput(p->vinput); - m_wndCaptureBar.m_capdlg.SetVideoChannel(p->vchannel); - m_wndCaptureBar.m_capdlg.SetAudioInput(p->ainput); - SendNowPlayingToMSN(); - SendNowPlayingTomIRC(); - return; - } - } - - if(m_iMediaLoadState != MLS_CLOSED) - CloseMedia(); - - m_iMediaLoadState = MLS_LOADING; // HACK: hides the logo - - AppSettings& s = AfxGetAppSettings(); - - bool fUseThread = true; - - if(OpenFileData* p = dynamic_cast(pOMD.m_p)) - { - if(p->fns.GetCount() > 0) - { - engine_t e = s.Formats.GetEngine(p->fns.GetHead()); - fUseThread = e == DirectShow /*|| e == RealMedia || e == QuickTime*/; - } - } - else if(OpenDeviceData* p = dynamic_cast(pOMD.m_p)) - { - fUseThread = false; - } - - if(m_pGraphThread && fUseThread - && AfxGetAppSettings().fEnableWorkerThreadForOpening) - { - m_pGraphThread->PostThreadMessage(CGraphThread::TM_OPEN, 0, (LPARAM)pOMD.Detach()); - s_fOpenedThruThread = true; - } - else - { - OpenMediaPrivate(pOMD); - s_fOpenedThruThread = false; - } -} - -void CMainFrame::CloseMedia() -{ - if(m_iMediaLoadState == MLS_CLOSING) - { - TRACE(_T("WARNING: CMainFrame::CloseMedia() called twice or more\n")); - return; - } - - int nTimeWaited = 0; - - while(m_iMediaLoadState == MLS_LOADING) - { - m_fOpeningAborted = true; - - if(pGB) pGB->Abort(); // TODO: lock on graph objects somehow, this is not thread safe - - if(nTimeWaited > 5*1000 && m_pGraphThread) - { - MessageBeep(MB_ICONEXCLAMATION); - TRACE(_T("CRITICAL ERROR: !!! Must kill opener thread !!!")); - TerminateThread(m_pGraphThread->m_hThread, -1); - m_pGraphThread = (CGraphThread*)AfxBeginThread(RUNTIME_CLASS(CGraphThread)); - s_fOpenedThruThread = false; - break; - } - - Sleep(50); - - nTimeWaited += 50; - } - - m_fOpeningAborted = false; - - m_closingmsg.Empty(); - - m_iMediaLoadState = MLS_CLOSING; - - OnFilePostClosemedia(); - - if(m_pGraphThread && s_fOpenedThruThread) - { - CAMEvent e; - m_pGraphThread->PostThreadMessage(CGraphThread::TM_CLOSE, 0, (LPARAM)&e); - e.Wait(); // either opening or closing has to be blocked to prevent reentering them, closing is the better choice - } - else - { - CloseMediaPrivate(); - } - - UnloadExternalObjects(); -} - -// -// CGraphThread -// - -IMPLEMENT_DYNCREATE(CGraphThread, CWinThread) - -BOOL CGraphThread::InitInstance() -{ - AfxSocketInit(); - return SUCCEEDED(CoInitialize(0)) ? TRUE : FALSE; -} - -int CGraphThread::ExitInstance() -{ - CoUninitialize(); - return __super::ExitInstance(); -} - -BEGIN_MESSAGE_MAP(CGraphThread, CWinThread) - ON_THREAD_MESSAGE(TM_EXIT, OnExit) - ON_THREAD_MESSAGE(TM_OPEN, OnOpen) - ON_THREAD_MESSAGE(TM_CLOSE, OnClose) -END_MESSAGE_MAP() - -void CGraphThread::OnExit(WPARAM wParam, LPARAM lParam) -{ - PostQuitMessage(0); - if(CAMEvent* e = (CAMEvent*)lParam) e->Set(); -} - -void CGraphThread::OnOpen(WPARAM wParam, LPARAM lParam) -{ - if(m_pMainFrame) - { - CAutoPtr pOMD((OpenMediaData*)lParam); - m_pMainFrame->OpenMediaPrivate(pOMD); - } -} - -void CGraphThread::OnClose(WPARAM wParam, LPARAM lParam) -{ - if(m_pMainFrame) m_pMainFrame->CloseMediaPrivate(); - if(CAMEvent* e = (CAMEvent*)lParam) e->Set(); -} - -afx_msg void CMainFrame::OnSubtitleDelay(UINT nID) -{ - if(m_pCAP) { - int newDelay; - int oldDelay = m_pCAP->GetSubtitleDelay(); - - if(nID == ID_SUB_DELAY_DOWN) - newDelay = oldDelay-AfxGetAppSettings().nSubDelayInterval; - else - newDelay = oldDelay+AfxGetAppSettings().nSubDelayInterval; - - SetSubtitleDelay(newDelay); - } -} diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h deleted file mode 100644 index 2a676135a..000000000 --- a/src/apps/mplayerc/MainFrm.h +++ /dev/null @@ -1,671 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include - -#include "ChildView.h" -#include "PlayerSeekBar.h" -#include "PlayerToolBar.h" -#include "PlayerInfoBar.h" -#include "PlayerStatusBar.h" -#include "PlayerSubresyncBar.h" -#include "PlayerPlaylistBar.h" -#include "PlayerCaptureBar.h" -#include "PlayerShaderEditorBar.h" -#include "PPageSheet.h" -#include "PPageFileInfoSheet.h" -#include "OpenCapDeviceDlg.h" - -#include "FileDropTarget.h" - -#include "KeyProvider.h" - -#include "..\..\subpic\ISubPic.h" - -#include "IGraphBuilder2.h" - -#include "RealMediaGraph.h" -#include "QuicktimeGraph.h" -#include "ShockwaveGraph.h" - -#include "..\..\..\include\IChapterInfo.h" -#include "..\..\..\include\IKeyFrameInfo.h" -#include "..\..\..\include\IBufferInfo.h" - -#include "WebServer.h" - -enum {PM_NONE, PM_FILE, PM_DVD, PM_CAPTURE}; - -class OpenMediaData -{ -public: -// OpenMediaData() {} - virtual ~OpenMediaData() {} // one virtual funct is needed to enable rtti - CString title; - CAtlList subs; -}; - -class OpenFileData : public OpenMediaData -{ -public: - OpenFileData() : rtStart(0) {} - CAtlList fns; - REFERENCE_TIME rtStart; -}; - -class OpenDVDData : public OpenMediaData -{ -public: -// OpenDVDData() {} - CString path; - CComPtr pDvdState; -}; - -class OpenDeviceData : public OpenMediaData -{ -public: - OpenDeviceData() {vinput = vchannel = ainput = -1;} - CStringW DisplayName[2]; - int vinput, vchannel, ainput; -}; - -class CMainFrame; - -class CGraphThread : public CWinThread -{ - CMainFrame* m_pMainFrame; - - DECLARE_DYNCREATE(CGraphThread); - -public: - CGraphThread() : m_pMainFrame(NULL) {} - - void SetMainFrame(CMainFrame* pMainFrame) {m_pMainFrame = pMainFrame;} - - BOOL InitInstance(); - int ExitInstance(); - - enum {TM_EXIT=WM_APP, TM_OPEN, TM_CLOSE}; - DECLARE_MESSAGE_MAP() - afx_msg void OnExit(WPARAM wParam, LPARAM lParam); - afx_msg void OnOpen(WPARAM wParam, LPARAM lParam); - afx_msg void OnClose(WPARAM wParam, LPARAM lParam); -}; -/* -class CKeyFrameFinderThread : public CWinThread, public CCritSec -{ - DECLARE_DYNCREATE(CKeyFrameFinderThread); - -public: - CKeyFrameFinderThread() {} - - CUIntArray m_kfs; // protected by (CCritSec*)this - - BOOL InitInstance(); - int ExitInstance(); - - enum {TM_EXIT=WM_APP, TM_INDEX, TM_BREAK}; - DECLARE_MESSAGE_MAP() - afx_msg void OnExit(WPARAM wParam, LPARAM lParam); - afx_msg void OnIndex(WPARAM wParam, LPARAM lParam); - afx_msg void OnBreak(WPARAM wParam, LPARAM lParam); -}; -*/ -interface ISubClock; - -class CMainFrame : public CFrameWnd, public CDropTarget -{ - enum - { - TIMER_STREAMPOSPOLLER = 1, - TIMER_STREAMPOSPOLLER2, - TIMER_FULLSCREENCONTROLBARHIDER, - TIMER_FULLSCREENMOUSEHIDER, - TIMER_STATS, - TIMER_LEFTCLICK, - TIMER_STATUSERASER - }; - - friend class CPPageFileInfoSheet; - friend class CPPageLogo; - - // TODO: wrap these graph objects into a class to make it look cleaner - - DWORD m_dwRegister; - - CComPtr pGB; - CComQIPtr pMC; - CComQIPtr pME; - CComQIPtr pVW; - CComQIPtr pBV; - CComQIPtr pBA; - CComQIPtr pMS; - CComQIPtr pFS; - CComQIPtr pQP; - CComQIPtr pBI; - CComQIPtr pAMOP; - - CComQIPtr pDVDC; - CComQIPtr pDVDI; - - CComPtr pCGB; - CStringW m_VidDispName, m_AudDispName; - CComPtr pVidCap, pAudCap; - CComPtr pAMVCCap, pAMVCPrev; - CComPtr pAMVSCCap, pAMVSCPrev, pAMASC; - CComPtr pAMXBar; - CComPtr pAMTuner; - CComPtr pAMDF; - - CComPtr m_pCAP; - - void SetBalance(int balance); - - // subtitles - - CCritSec m_csSubLock; - CInterfaceList m_pSubStreams; - int m_iSubtitleSel; // if(m_iSubtitleSel&(1<<31)): disabled - DWORD_PTR m_nSubtitleId; - - friend class CTextPassThruFilter; - - // windowing - - CRect m_lastWindowRect; - CPoint m_lastMouseMove; - - CRect m_rcDesktop; - - void ShowControls(int nCS, bool fSave = true); - - void SetDefaultWindowRect(int iMonitor = 0); - void RestoreDefaultWindowRect(); - void ZoomVideoWindow(double scale = -1); - double GetZoomAutoFitScale(); - - void SetAlwaysOnTop(int i); - - // dynamic menus - - void SetupOpenCDSubMenu(); - void SetupFiltersSubMenu(); - void SetupAudioSwitcherSubMenu(); - void SetupSubtitlesSubMenu(); - void SetupNavAudioSubMenu(); - void SetupNavSubtitleSubMenu(); - void SetupNavAngleSubMenu(); - void SetupNavChaptersSubMenu(); - void SetupFavoritesSubMenu(); - void SetupShadersSubMenu(); - - void SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGroup); - void OnNavStreamSelectSubMenu(UINT id, DWORD dwSelGroup); - - CMenu m_popupmain, m_popup; - CMenu m_opencds; - CMenu m_filters, m_subtitles, m_audios; - CAutoPtrArray m_filterpopups; - CMenu m_navaudio, m_navsubtitle, m_navangle; - CMenu m_navchapters, m_navtitles; - CMenu m_favorites; - CMenu m_shaders; - - CInterfaceArray m_pparray; - CInterfaceArray m_ssarray; - - // chapters (file mode) - CComPtr m_pCB; - void SetupChapters(); - - // - - void SetupIViAudReg(); - - void AddTextPassThruFilter(); - - int m_nLoops; - - bool m_fCustomGraph; - bool m_fRealMediaGraph, m_fShockwaveGraph, m_fQuicktimeGraph; - - CComPtr m_pSubClock; - - int m_fFrameSteppingActive; - int m_VolumeBeforeFrameStepping; - - bool m_fEndOfStream; - - bool m_fBuffering; - - bool m_fLiveWM; - - bool m_fUpdateInfoBar; - - void SendStatusMessage(CString msg, int nTimeOut); - CString m_playingmsg, m_closingmsg; - - REFERENCE_TIME m_rtDurationOverride; - - CComPtr m_pProv; - - void CleanGraph(); - - CComPtr pAudioDubSrc; - - void ShowOptions(int idPage = 0); - - bool GetDIB(BYTE** ppData, long& size, bool fSilent = false); - void SaveDIB(LPCTSTR fn, BYTE* pData, long size); - BOOL IsRendererCompatibleWithSaveImage(); - void SaveImage(LPCTSTR fn); - void SaveThumbnails(LPCTSTR fn); - - // - - friend class CWebClientSocket; - friend class CWebServer; - CAutoPtr m_pWebServer; - -public: - void StartWebServer(int nPort); - void StopWebServer(); - - CString GetStatusMessage(); - bool IsMuted() {return m_wndToolBar.GetVolume() == -10000;} - int GetVolume() {return m_wndToolBar.m_volctrl.GetPos();} - -public: - CMainFrame(); - - DECLARE_DYNAMIC(CMainFrame) - -// Attributes -public: - int m_iPlaybackMode; - - bool m_fFullScreen; - bool m_fHideCursor; - - bool IsFrameLessWindow() {return(m_fFullScreen || AfxGetAppSettings().fHideCaptionMenu);} - bool IsCaptionMenuHidden() {return(!m_fFullScreen && AfxGetAppSettings().fHideCaptionMenu);} - bool IsSomethingLoaded() {return(m_iMediaLoadState != MLS_CLOSED);} - bool IsPlaylistEmpty() {return(m_wndPlaylistBar.GetCount() == 0);} - bool IsInteractiveVideo() {return(AfxGetAppSettings().fIntRealMedia && m_fRealMediaGraph || m_fShockwaveGraph);} - - CControlBar* m_pLastBar; - -protected: - enum {MLS_CLOSED, MLS_LOADING, MLS_LOADED, MLS_CLOSING}; - int m_iMediaLoadState; - - bool m_fAudioOnly; - dispmode m_dmBeforeFullscreen; - - DVD_DOMAIN m_iDVDDomain; - DWORD m_iDVDTitle; - int m_iSpeedLevel; - - double m_ZoomX, m_ZoomY, m_PosX, m_PosY; - int m_AngleX, m_AngleY, m_AngleZ; - -// Operations - bool OpenMediaPrivate(CAutoPtr pOMD); - void CloseMediaPrivate(); - - void SendNowPlayingToMSN(); - void SendNowPlayingTomIRC(); - - void OpenCreateGraphObject(OpenMediaData* pOMD); - void OpenFile(OpenFileData* pOFD); - void OpenDVD(OpenDVDData* pODD); - void OpenCapture(OpenDeviceData* pODD); - void OpenCustomizeGraph(); - void OpenSetupVideo(); - void OpenSetupAudio(); - void OpenSetupInfoBar(); - void OpenSetupStatsBar(); - void OpenSetupStatusBar(); - // void OpenSetupToolBar(); - void OpenSetupCaptureBar(); - void OpenSetupWindowTitle(CString fn = _T("")); - - friend class CGraphThread; - CGraphThread* m_pGraphThread; - - CAtlArray m_kfs; - - bool m_fOpeningAborted; - -public: - void OpenCurPlaylistItem(REFERENCE_TIME rtStart = 0); - void OpenMedia(CAutoPtr pOMD); - void CloseMedia(); - - void AddCurDevToPlaylist(); - - bool m_fTrayIcon; - void ShowTrayIcon(bool fShow); - void SetTrayTip(CString str); - - CSize GetVideoSize(); - void ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasTo); - void MoveVideoWindow(bool fShowStats = false); - void RepaintVideo(); - - OAFilterState GetMediaState(); - REFERENCE_TIME GetPos(), GetDur(); - void SeekTo(REFERENCE_TIME rt, bool fSeekToKeyFrame = false); - - bool LoadSubtitle(CString fn); - void UpdateSubtitle(bool fApplyDefStyle = false); - void SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle = false); - void ReplaceSubtitle(ISubStream* pSubStreamOld, ISubStream* pSubStreamNew); - void InvalidateSubtitle(DWORD_PTR nSubtitleId = -1, REFERENCE_TIME rtInvalidate = -1); - void ReloadSubtitle(); - - // shaders - CAtlList m_shaderlabels; - void SetShaders(); - void UpdateShaders(CString label); - - // capturing - bool m_fCapturing; - HRESULT BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& majortype, AM_MEDIA_TYPE* pmt); // pBF: 0 buff, 1 enc, 2 mux, pmt is for 1 enc - bool BuildToCapturePreviewPin( - IBaseFilter* pVidCap, IPin** pVidCapPin, IPin** pVidPrevPin, - IBaseFilter* pAudCap, IPin** pAudCapPin, IPin** pAudPrevPin); - bool BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPreview, bool fACapture); - bool DoCapture(), StartCapture(), StopCapture(); - - bool DoAfterPlaybackEvent(); - - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo); - virtual void RecalcLayout(BOOL bNotify = TRUE); - -// Implementation -public: - virtual ~CMainFrame(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: // control bar embedded members - - CChildView m_wndView; - - CPlayerSeekBar m_wndSeekBar; - CPlayerToolBar m_wndToolBar; - CPlayerInfoBar m_wndInfoBar; - CPlayerInfoBar m_wndStatsBar; - CPlayerStatusBar m_wndStatusBar; - CList m_bars; - - CPlayerSubresyncBar m_wndSubresyncBar; - CPlayerPlaylistBar m_wndPlaylistBar; - CPlayerCaptureBar m_wndCaptureBar; - CPlayerShaderEditorBar m_wndShaderEditorBar; - CList m_dockingbars; - - CFileDropTarget m_fileDropTarget; - // TODO - DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point); - DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point); - BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point); - DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point); - void OnDragLeave(); - DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point); - - friend class CPPagePlayback; // TODO - friend class CMPlayerCApp; // TODO - - void LoadControlBar(CControlBar* pBar, UINT defDockBarID); - void RestoreFloatingControlBars(); - void SaveControlBars(); - -// Generated message map functions - - DECLARE_MESSAGE_MAP() - -public: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnDestroy(); - - afx_msg LRESULT OnTaskBarRestart(WPARAM, LPARAM); - afx_msg LRESULT OnNotifyIcon(WPARAM, LPARAM); - - afx_msg void OnSetFocus(CWnd* pOldWnd); - afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI); - afx_msg void OnMove(int x, int y); - afx_msg void OnMoving(UINT fwSide, LPRECT pRect); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnSizing(UINT fwSide, LPRECT pRect); - afx_msg void OnDisplayChange(); - - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID); - afx_msg LRESULT OnAppCommand(WPARAM wParam, LPARAM lParam); - - afx_msg void OnTimer(UINT nIDEvent); - - afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnRepaintRenderLess(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnResumeFromState(WPARAM wParam, LPARAM lParam); - - BOOL OnButton(UINT id, UINT nFlags, CPoint point); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); - afx_msg void OnMButtonDown(UINT nFlags, CPoint point); - afx_msg void OnMButtonUp(UINT nFlags, CPoint point); - afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point); - afx_msg void OnRButtonDown(UINT nFlags, CPoint point); - afx_msg void OnRButtonUp(UINT nFlags, CPoint point); - afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point); - afx_msg LRESULT OnXButtonDown(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnXButtonUp(WPARAM wParam, LPARAM lParam); - afx_msg LRESULT OnXButtonDblClk(WPARAM wParam, LPARAM lParam); - afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - - afx_msg LRESULT OnNcHitTest(CPoint point); - - afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - - afx_msg void OnInitMenu(CMenu* pMenu); - afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); - - BOOL OnMenu(CMenu* pMenu); - afx_msg void OnMenuPlayerShort(); - afx_msg void OnMenuPlayerLong(); - afx_msg void OnMenuFilters(); - - afx_msg void OnUpdatePlayerStatus(CCmdUI* pCmdUI); - - afx_msg void OnFilePostOpenmedia(); - afx_msg void OnUpdateFilePostOpenmedia(CCmdUI* pCmdUI); - afx_msg void OnFilePostClosemedia(); - afx_msg void OnUpdateFilePostClosemedia(CCmdUI* pCmdUI); - - afx_msg void OnBossKey(); - - afx_msg void OnStreamAudio(UINT nID); - afx_msg void OnStreamSub(UINT nID); - afx_msg void OnStreamSubOnOff(); - afx_msg void OnOgmAudio(UINT nID); - afx_msg void OnOgmSub(UINT nID); - afx_msg void OnDvdAngle(UINT nID); - afx_msg void OnDvdAudio(UINT nID); - afx_msg void OnDvdSub(UINT nID); - afx_msg void OnDvdSubOnOff(); - - - // menu item handlers - - afx_msg void OnFileOpenQuick(); - afx_msg void OnFileOpenmedia(); - afx_msg void OnUpdateFileOpen(CCmdUI* pCmdUI); - afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct); - afx_msg void OnFileOpendvd(); - afx_msg void OnFileOpendevice(); - afx_msg void OnFileOpenCD(UINT nID); - afx_msg void OnDropFiles(HDROP hDropInfo); // no menu item - afx_msg void OnFileSaveAs(); - afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI); - afx_msg void OnFileSaveImage(); - afx_msg void OnFileSaveImageAuto(); - afx_msg void OnUpdateFileSaveImage(CCmdUI* pCmdUI); - afx_msg void OnFileSaveThumbnails(); - afx_msg void OnUpdateFileSaveThumbnails(CCmdUI* pCmdUI); - afx_msg void OnFileConvert(); - afx_msg void OnUpdateFileConvert(CCmdUI* pCmdUI); - afx_msg void OnFileLoadsubtitle(); - afx_msg void OnUpdateFileLoadsubtitle(CCmdUI* pCmdUI); - afx_msg void OnFileSavesubtitle(); - afx_msg void OnUpdateFileSavesubtitle(CCmdUI* pCmdUI); - afx_msg void OnFileISDBSearch(); - afx_msg void OnUpdateFileISDBSearch(CCmdUI* pCmdUI); - afx_msg void OnFileISDBUpload(); - afx_msg void OnUpdateFileISDBUpload(CCmdUI* pCmdUI); - afx_msg void OnFileISDBDownload(); - afx_msg void OnUpdateFileISDBDownload(CCmdUI* pCmdUI); - afx_msg void OnFileProperties(); - afx_msg void OnUpdateFileProperties(CCmdUI* pCmdUI); - afx_msg void OnFileClosePlaylist(); - afx_msg void OnFileCloseMedia(); // no menu item - afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI); - - afx_msg void OnViewCaptionmenu(); - afx_msg void OnUpdateViewCaptionmenu(CCmdUI* pCmdUI); - afx_msg void OnViewControlBar(UINT nID); - afx_msg void OnUpdateViewControlBar(CCmdUI* pCmdUI); - afx_msg void OnViewSubresync(); - afx_msg void OnUpdateViewSubresync(CCmdUI* pCmdUI); - afx_msg void OnViewPlaylist(); - afx_msg void OnUpdateViewPlaylist(CCmdUI* pCmdUI); - afx_msg void OnViewCapture(); - afx_msg void OnUpdateViewCapture(CCmdUI* pCmdUI); - afx_msg void OnViewShaderEditor(); - afx_msg void OnUpdateViewShaderEditor(CCmdUI* pCmdUI); - afx_msg void OnViewMinimal(); - afx_msg void OnUpdateViewMinimal(CCmdUI* pCmdUI); - afx_msg void OnViewCompact(); - afx_msg void OnUpdateViewCompact(CCmdUI* pCmdUI); - afx_msg void OnViewNormal(); - afx_msg void OnUpdateViewNormal(CCmdUI* pCmdUI); - afx_msg void OnViewFullscreen(); - afx_msg void OnViewFullscreenSecondary(); - afx_msg void OnUpdateViewFullscreen(CCmdUI* pCmdUI); - afx_msg void OnViewZoom(UINT nID); - afx_msg void OnUpdateViewZoom(CCmdUI* pCmdUI); - afx_msg void OnViewZoomAutoFit(); - afx_msg void OnViewDefaultVideoFrame(UINT nID); - afx_msg void OnUpdateViewDefaultVideoFrame(CCmdUI* pCmdUI); - afx_msg void OnViewKeepaspectratio(); - afx_msg void OnUpdateViewKeepaspectratio(CCmdUI* pCmdUI); - afx_msg void OnViewCompMonDeskARDiff(); - afx_msg void OnUpdateViewCompMonDeskARDiff(CCmdUI* pCmdUI); - afx_msg void OnViewPanNScan(UINT nID); - afx_msg void OnUpdateViewPanNScan(CCmdUI* pCmdUI); - afx_msg void OnViewPanNScanPresets(UINT nID); - afx_msg void OnUpdateViewPanNScanPresets(CCmdUI* pCmdUI); - afx_msg void OnViewRotate(UINT nID); - afx_msg void OnUpdateViewRotate(CCmdUI* pCmdUI); - afx_msg void OnViewAspectRatio(UINT nID); - afx_msg void OnUpdateViewAspectRatio(CCmdUI* pCmdUI); - afx_msg void OnViewAspectRatioNext(); - afx_msg void OnViewOntop(UINT nID); - afx_msg void OnUpdateViewOntop(CCmdUI* pCmdUI); - afx_msg void OnViewOptions(); - - afx_msg void OnPlayPlay(); - afx_msg void OnPlayPause(); - afx_msg void OnPlayPauseI(); - afx_msg void OnPlayPlaypause(); - afx_msg void OnPlayStop(); - afx_msg void OnUpdatePlayPauseStop(CCmdUI* pCmdUI); - afx_msg void OnPlayFramestep(UINT nID); - afx_msg void OnUpdatePlayFramestep(CCmdUI* pCmdUI); - afx_msg void OnPlaySeek(UINT nID); - afx_msg void OnPlaySeekKey(UINT nID); // no menu item - afx_msg void OnUpdatePlaySeek(CCmdUI* pCmdUI); - afx_msg void OnPlayGoto(); - afx_msg void OnUpdateGoto(CCmdUI* pCmdUI); - afx_msg void OnPlayChangeRate(UINT nID); - afx_msg void OnUpdatePlayChangeRate(CCmdUI* pCmdUI); - afx_msg void OnPlayResetRate(); - afx_msg void OnUpdatePlayResetRate(CCmdUI* pCmdUI); - afx_msg void OnPlayChangeAudDelay(UINT nID); - afx_msg void OnUpdatePlayChangeAudDelay(CCmdUI* pCmdUI); - afx_msg void OnPlayFilters(UINT nID); - afx_msg void OnUpdatePlayFilters(CCmdUI* pCmdUI); - afx_msg void OnPlayShaders(UINT nID); - afx_msg void OnUpdatePlayShaders(CCmdUI* pCmdUI); - afx_msg void OnPlayAudio(UINT nID); - afx_msg void OnUpdatePlayAudio(CCmdUI* pCmdUI); - afx_msg void OnPlaySubtitles(UINT nID); - afx_msg void OnUpdatePlaySubtitles(CCmdUI* pCmdUI); - afx_msg void OnPlayLanguage(UINT nID); - afx_msg void OnUpdatePlayLanguage(CCmdUI* pCmdUI); - afx_msg void OnPlayVolume(UINT nID); - afx_msg void OnPlayVolumeBoost(UINT nID); - afx_msg void OnUpdatePlayVolumeBoost(CCmdUI* pCmdUI); - afx_msg void OnAfterplayback(UINT nID); - afx_msg void OnUpdateAfterplayback(CCmdUI* pCmdUI); - - afx_msg void OnSubtitleDelay(UINT nID); - - afx_msg void OnNavigateSkip(UINT nID); - afx_msg void OnUpdateNavigateSkip(CCmdUI* pCmdUI); - afx_msg void OnNavigateSkipPlaylistItem(UINT nID); - afx_msg void OnUpdateNavigateSkipPlaylistItem(CCmdUI* pCmdUI); - afx_msg void OnNavigateMenu(UINT nID); - afx_msg void OnUpdateNavigateMenu(CCmdUI* pCmdUI); - afx_msg void OnNavigateAudio(UINT nID); - afx_msg void OnNavigateSubpic(UINT nID); - afx_msg void OnNavigateAngle(UINT nID); - afx_msg void OnNavigateChapters(UINT nID); - afx_msg void OnNavigateMenuItem(UINT nID); - afx_msg void OnUpdateNavigateMenuItem(CCmdUI* pCmdUI); - - afx_msg void OnFavoritesAdd(); - afx_msg void OnUpdateFavoritesAdd(CCmdUI* pCmdUI); - afx_msg void OnFavoritesOrganize(); - afx_msg void OnUpdateFavoritesOrganize(CCmdUI* pCmdUI); - afx_msg void OnFavoritesFile(UINT nID); - afx_msg void OnUpdateFavoritesFile(CCmdUI* pCmdUI); - afx_msg void OnFavoritesDVD(UINT nID); - afx_msg void OnUpdateFavoritesDVD(CCmdUI* pCmdUI); - afx_msg void OnFavoritesDevice(UINT nID); - afx_msg void OnUpdateFavoritesDevice(CCmdUI* pCmdUI); - - afx_msg void OnHelpHomepage(); - afx_msg void OnHelpDocumentation(); - - afx_msg void OnClose(); - - void SetSubtitleDelay(int delay_ms); -}; diff --git a/src/apps/mplayerc/MediaFormats.cpp b/src/apps/mplayerc/MediaFormats.cpp deleted file mode 100644 index b827a2131..000000000 --- a/src/apps/mplayerc/MediaFormats.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include -#include "MediaFormats.h" - -// -// CMediaFormatCategory -// - -CMediaFormatCategory::CMediaFormatCategory() - : m_fAudioOnly(false) -{ -} - -CMediaFormatCategory::CMediaFormatCategory( - CString label, CAtlList& exts, bool fAudioOnly, - CString specreqnote, engine_t engine) -{ - m_label = label; - m_exts.AddTailList(&exts); - m_backupexts.AddTailList(&m_exts); - m_specreqnote = specreqnote; - m_fAudioOnly = fAudioOnly; - m_engine = engine; -} - -CMediaFormatCategory::CMediaFormatCategory( - CString label, CString exts, bool fAudioOnly, - CString specreqnote, engine_t engine) -{ - m_label = label; - ExplodeMin(exts, m_exts, ' '); - POSITION pos = m_exts.GetHeadPosition(); - while(pos) m_exts.GetNext(pos).TrimLeft('.'); - - m_backupexts.AddTailList(&m_exts); - m_specreqnote = specreqnote; - m_fAudioOnly = fAudioOnly; - m_engine = engine; -} - -CMediaFormatCategory::~CMediaFormatCategory() -{ -} - -void CMediaFormatCategory::UpdateData(bool fSave) -{ - if(fSave) - { - AfxGetApp()->WriteProfileString(_T("FileFormats"), m_label, GetExts(true)); - } - else - { - SetExts(AfxGetApp()->GetProfileString(_T("FileFormats"), m_label, GetExts(true))); - } -} - -CMediaFormatCategory::CMediaFormatCategory(const CMediaFormatCategory& mfc) -{ - *this = mfc; -} - -CMediaFormatCategory& CMediaFormatCategory::operator = (const CMediaFormatCategory& mfc) -{ - m_label = mfc.m_label; - m_specreqnote = mfc.m_specreqnote; - m_exts.RemoveAll(); - m_exts.AddTailList(&mfc.m_exts); - m_backupexts.RemoveAll(); - m_backupexts.AddTailList(&mfc.m_backupexts); - m_fAudioOnly = mfc.m_fAudioOnly; - m_engine = mfc.m_engine; - return *this; -} - -void CMediaFormatCategory::RestoreDefaultExts() -{ - m_exts.RemoveAll(); - m_exts.AddTailList(&m_backupexts); -} - -void CMediaFormatCategory::SetExts(CAtlList& exts) -{ - m_exts.RemoveAll(); - m_exts.AddTailList(&exts); -} - -void CMediaFormatCategory::SetExts(CString exts) -{ - m_exts.RemoveAll(); - ExplodeMin(exts, m_exts, ' '); - POSITION pos = m_exts.GetHeadPosition(); - while(pos) - { - POSITION cur = pos; - CString& ext = m_exts.GetNext(pos); - if(ext[0] == '\\') {m_engine = (engine_t)_tcstol(ext.TrimLeft('\\'), NULL, 10); m_exts.RemoveAt(cur);} - else ext.TrimLeft('.'); - } -} - -CString CMediaFormatCategory::GetFilter() -{ - CString filter; - POSITION pos = m_exts.GetHeadPosition(); - while(pos) filter += _T("*.") + m_exts.GetNext(pos) + _T(";"); - filter.TrimRight(_T(";")); // cheap... - return(filter); -} - -CString CMediaFormatCategory::GetExts(bool fAppendEngine) -{ - CString exts = Implode(m_exts, ' '); - if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine); - return(exts); -} - -CString CMediaFormatCategory::GetExtsWithPeriod(bool fAppendEngine) -{ - CString exts; - POSITION pos = m_exts.GetHeadPosition(); - while(pos) exts += _T(".") + m_exts.GetNext(pos) + _T(" "); - exts.TrimRight(_T(" ")); // cheap... - if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine); - return(exts); -} - -CString CMediaFormatCategory::GetBackupExtsWithPeriod(bool fAppendEngine) -{ - CString exts; - POSITION pos = m_backupexts.GetHeadPosition(); - while(pos) exts += _T(".") + m_backupexts.GetNext(pos) + _T(" "); - exts.TrimRight(_T(" ")); // cheap... - if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine); - return(exts); -} - -// -// CMediaFormats -// - -CMediaFormats::CMediaFormats() -{ -} - -CMediaFormats::~CMediaFormats() -{ -} - -void CMediaFormats::UpdateData(bool fSave) -{ - if(fSave) - { - AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL); - - AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspHandler"), m_iRtspHandler); - AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), m_fRtspFileExtFirst); - } - else - { - RemoveAll(); -#define ADDFMT(f) Add(CMediaFormatCategory##f) - ADDFMT((_T("Windows Media file"), _T("wmv wmp wm asf"))); - ADDFMT((_T("Windows Media Audio file"), _T("wma"), true)); - ADDFMT((_T("Video file"), _T("avi"))); - ADDFMT((_T("Audio file"), _T("wav"), true)); - ADDFMT((_T("MPEG Media file"), _T("mpg mpeg mpe m1v m2v mpv2 mp2v ts tp tpr pva m2ts m2t mts evo m2p"))); - ADDFMT((_T("VCD file"), _T("dat"))); - ADDFMT((_T("MPEG Audio file"), _T("mpa mp2 m1a m2a"), true)); - ADDFMT((_T("DVD file"), _T("vob ifo"))); - ADDFMT((_T("DVD Audio file"), _T("ac3 dts"), true)); - ADDFMT((_T("MP3 Format Sound"), _T("mp3"), true)); - ADDFMT((_T("MIDI file"), _T("mid midi rmi"), true)); - ADDFMT((_T("Indeo Video file"), _T("ivf"))); - ADDFMT((_T("AIFF Format Sound"), _T("aif aifc aiff"), true)); - ADDFMT((_T("AU Format Sound"), _T("au snd"), true)); - ADDFMT((_T("Ogg Media file"), _T("ogm ogv"))); - ADDFMT((_T("Ogg Vorbis Audio file"), _T("ogg oga"), true)); - ADDFMT((_T("CD Audio Track"), _T("cda"), true, _T("Windows 2000/XP or better"))); - ADDFMT((_T("FLIC file"), _T("fli flc flic"))); - ADDFMT((_T("DVD2AVI Project file"), _T("d2v"))); - ADDFMT((_T("MPEG4 file"), _T("mp4 m4v mp4v mpv4 hdmov 3gp 3gpp"))); - ADDFMT((_T("MPEG4 Audio file"), _T("m4a m4b aac"), true, _T(""), QuickTime)); - ADDFMT((_T("Matroska Media file"), _T("mkv"))); - ADDFMT((_T("Matroska Audio file"), _T("mka"), true)); - ADDFMT((_T("Smacker/Bink Media file"), _T("smk bik"), false, _T("smackw32/binkw32.dll in dll path"))); - ADDFMT((_T("ratdvd file"), _T("ratdvd"), false, _T("ratdvd media file"))); - ADDFMT((_T("RoQ Media file"), _T("roq"), false)); - ADDFMT((_T("Real Media file"), _T("rm ram rpm rmm"), false, _T("RealPlayer or Real Alternative"), RealMedia)); - ADDFMT((_T("Real Audio file"), _T("ra"), true, _T("RealPlayer or Real Alternative"), RealMedia)); - ADDFMT((_T("Real Script file"), _T("rt rp smi smil"), false, _T("RealPlayer or Real Alternative"), RealMedia)); - ADDFMT((_T("Dirac Video file"), _T("drc"), false)); - ADDFMT((_T("DirectShow Media file"), _T("dsm dsv dsa dss"))); - ADDFMT((_T("Musepack file"), _T("mpc"), true)); - ADDFMT((_T("FLAC Audio file"), _T("flac"), true)); - ADDFMT((_T("WavPack Audio file"), _T("wv"), true)); - ADDFMT((_T("ALAC Audio file"), _T("alac"), true)); - ADDFMT((_T("OptimFrog Audio file"), _T("ofr ofs"), true)); - ADDFMT((_T("Monkey's Audio file"), _T("ape apl"), true)); - ADDFMT((_T("True Audio file"), _T("tta"), true)); - ADDFMT((_T("AMR Audio file"), _T("amr"), true)); - ADDFMT((_T("Flash Video file"), _T("flv iflv f4v"))); - ADDFMT((_T("Shockwave Flash file"), _T("swf"), false, _T("ShockWave ActiveX control"), ShockWave)); - ADDFMT((_T("Quicktime file"), _T("mov 3g2 3gp2"), false, _T("QuickTime (Alternative)"), QuickTime)); - ADDFMT((_T("Playlist file"), _T("asx m3u pls wvx wax wmx mpcpl"))); - ADDFMT((_T("Blu-ray playlist file"), _T("mpls bdmv"))); - ADDFMT((_T("Other"), _T("divx vp6 rmvb amv"))); -#undef ADDFMT - - m_iRtspHandler = (engine_t)AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspHandler"), (int)RealMedia); - m_fRtspFileExtFirst = !!AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), 1); - } - - for(int i = 0; i < GetCount(); i++) - GetAt(i).UpdateData(fSave); -} - -engine_t CMediaFormats::GetRtspHandler(bool& fRtspFileExtFirst) -{ - fRtspFileExtFirst = m_fRtspFileExtFirst; - return m_iRtspHandler; -} - -void CMediaFormats::SetRtspHandler(engine_t e, bool fRtspFileExtFirst) -{ - m_iRtspHandler = e; - m_fRtspFileExtFirst = fRtspFileExtFirst; -} - -bool CMediaFormats::IsUsingEngine(CString path, engine_t e) -{ - return(GetEngine(path) == e); -} - -engine_t CMediaFormats::GetEngine(CString path) -{ - path.Trim().MakeLower(); - - if(!m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) - return m_iRtspHandler; - - CString ext = CPath(path).GetExtension(); - ext.MakeLower(); - if(!ext.IsEmpty()) - { - if(path.Find(_T("rtsp://")) == 0) - { - if(ext == _T(".ram") || ext == _T(".rm") || ext == _T(".ra")) - return RealMedia; - if(ext == _T(".qt") || ext == _T(".mov")) - return QuickTime; - } - - for(int i = 0; i < GetCount(); i++) - { - CMediaFormatCategory& mfc = GetAt(i); - if(mfc.FindExt(ext)) - return mfc.GetEngineType(); - } - } - - if(m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) - return m_iRtspHandler; - - return DirectShow; -} - -bool CMediaFormats::FindExt(CString ext, bool fAudioOnly) -{ - ext.TrimLeft(_T(".")); - - if(!ext.IsEmpty()) - { - for(int i = 0; i < GetCount(); i++) - { - CMediaFormatCategory& mfc = GetAt(i); - if((!fAudioOnly || mfc.IsAudioOnly()) && mfc.FindExt(ext)) - return(true); - } - } - - return(false); -} - -void CMediaFormats::GetFilter(CString& filter, CAtlArray& mask) -{ - CString strTemp; - - filter += _T("Media files (all types)|"); - mask.Add(_T("")); - - for(int i = 0; i < GetCount(); i++) - { - strTemp = GetAt(i).GetFilter() + _T(";");; - mask[0] += strTemp; - filter += strTemp; - } - mask[0].TrimRight(_T(";")); - filter.TrimRight(_T(";")); - filter += _T("|"); - - for(int i = 0; i < GetCount(); i++) - { - CMediaFormatCategory& mfc = GetAt(i); - filter += mfc.GetLabel() + _T("|" + GetAt(i).GetFilter() + _T("|")); - mask.Add(mfc.GetFilter()); - } - - filter += _T("All files (*.*)|(*.*)|"); - mask.Add(_T("*.*")); - - filter += _T("|"); -} - -void CMediaFormats::GetAudioFilter(CString& filter, CAtlArray& mask) -{ - CString strTemp; - filter += _T("Audio files (all types)|"); - mask.Add(_T("")); - - for(int i = 0; i < GetCount(); i++) - { - CMediaFormatCategory& mfc = GetAt(i); - if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) continue; - strTemp = GetAt(i).GetFilter() + _T(";"); - mask[0] += strTemp; - filter += strTemp; - } - - mask[0].TrimRight(_T(";")); - filter.TrimRight(_T(";")); - filter += _T("|"); - - for(int i = 0; i < GetCount(); i++) - { - CMediaFormatCategory& mfc = GetAt(i); - if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) continue; - filter += mfc.GetLabel() + _T("|") + GetAt(i).GetFilter() + _T("|"); - mask.Add(mfc.GetFilter()); - } - - filter += _T("All files (*.*)|(*.*)|"); - mask.Add(_T("*.*")); - - filter += _T("|"); -} diff --git a/src/apps/mplayerc/MediaFormats.h b/src/apps/mplayerc/MediaFormats.h deleted file mode 100644 index 0f3f4a1c7..000000000 --- a/src/apps/mplayerc/MediaFormats.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include -#include "BaseGraph.h" - -class CMediaFormatCategory -{ -protected: - CString m_label, m_specreqnote; - CAtlList m_exts, m_backupexts; - bool m_fAudioOnly; - engine_t m_engine; - -public: - CMediaFormatCategory(); - CMediaFormatCategory( - CString label, CAtlList& exts, bool fAudioOnly = false, - CString specreqnote = _T(""), engine_t e = DirectShow); - CMediaFormatCategory( - CString label, CString exts, bool fAudioOnly = false, - CString specreqnote = _T(""), engine_t e = DirectShow); - virtual ~CMediaFormatCategory(); - - void UpdateData(bool fSave); - - CMediaFormatCategory(const CMediaFormatCategory& mfc); - CMediaFormatCategory& operator = (const CMediaFormatCategory& mfc); - - void RestoreDefaultExts(); - void SetExts(CAtlList& exts); - void SetExts(CString exts); - - bool FindExt(CString ext) {return m_exts.Find(ext.TrimLeft(_T(".")).MakeLower()) != NULL;} - - CString GetLabel() {return m_label;} - CString GetFilter(); - CString GetExts(bool fAppendEngine = false); - CString GetExtsWithPeriod(bool fAppendEngine = false); - CString GetBackupExtsWithPeriod(bool fAppendEngine = false); - CString GetSpecReqNote() {return m_specreqnote;} - bool IsAudioOnly() {return m_fAudioOnly;} - engine_t GetEngineType() {return m_engine;} - void SetEngineType(engine_t e) {m_engine = e;} -}; - -class CMediaFormats : public CAtlArray -{ -protected: - engine_t m_iRtspHandler; - bool m_fRtspFileExtFirst; - -public: - CMediaFormats(); - virtual ~CMediaFormats(); - - void UpdateData(bool fSave); - - engine_t GetRtspHandler(bool& fRtspFileExtFirst); - void SetRtspHandler(engine_t e, bool fRtspFileExtFirst); - - bool IsUsingEngine(CString path, engine_t e); - engine_t GetEngine(CString path); - - bool FindExt(CString ext, bool fAudioOnly = false); - - void GetFilter(CString& filter, CAtlArray& mask); - void GetAudioFilter(CString& filter, CAtlArray& mask); -}; diff --git a/src/apps/mplayerc/MediaTypesDlg.cpp b/src/apps/mplayerc/MediaTypesDlg.cpp deleted file mode 100644 index 7ebfac4fa..000000000 --- a/src/apps/mplayerc/MediaTypesDlg.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// MediaTypesDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "MediaTypesDlg.h" -#include "..\..\DSUtil\DSUtil.h" -#include "..\..\..\include\moreuuids.h" - -// CMediaTypesDlg dialog - -//IMPLEMENT_DYNAMIC(CMediaTypesDlg, CResizableDialog) -CMediaTypesDlg::CMediaTypesDlg(IGraphBuilderDeadEnd* pGBDE, CWnd* pParent /*=NULL*/) - : CResizableDialog(CMediaTypesDlg::IDD, pParent) - , m_pGBDE(pGBDE) -{ - m_subtype = GUID_NULL; - m_type = UNKNOWN; -} - -CMediaTypesDlg::~CMediaTypesDlg() -{ -} - -void CMediaTypesDlg::DoDataExchange(CDataExchange* pDX) -{ - CResizableDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_COMBO1, m_pins); - DDX_Control(pDX, IDC_EDIT1, m_report); -} - -void CMediaTypesDlg::AddLine(CString str) -{ - str.Replace(_T("\n"), _T("\r\n")); - int len = m_report.GetWindowTextLength(); - m_report.SetSel(len, len, TRUE); - m_report.ReplaceSel(str); -} - -void CMediaTypesDlg::AddMediaType(AM_MEDIA_TYPE* pmt) -{ - m_subtype = pmt->subtype; - if(pmt->majortype == MEDIATYPE_Video) m_type = VIDEO; - else if(pmt->majortype == MEDIATYPE_Audio) m_type = AUDIO; - else m_type = UNKNOWN; - - CAtlList sl; - CMediaTypeEx(*pmt).Dump(sl); - POSITION pos = sl.GetHeadPosition(); - while(pos) AddLine(sl.GetNext(pos) + '\n'); -} - -BEGIN_MESSAGE_MAP(CMediaTypesDlg, CResizableDialog) - ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1) -END_MESSAGE_MAP() - - -// CMediaTypesDlg message handlers - -BOOL CMediaTypesDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - CAtlList path; - CAtlList mts; - - for(int i = 0; S_OK == m_pGBDE->GetDeadEnd(i, path, mts); i++) - { - if(!path.GetCount()) continue; - m_pins.SetItemData(m_pins.AddString(CString(path.GetTail())), (DWORD_PTR)i); - } - - m_pins.SetCurSel(0); - OnCbnSelchangeCombo1(); - - AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_STATIC2, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDOK, BOTTOM_RIGHT); - - SetMinTrackSize(CSize(300, 200)); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CMediaTypesDlg::OnCbnSelchangeCombo1() -{ - m_report.SetWindowText(_T("")); - - int i = m_pins.GetCurSel(); - if(i < 0) return; - - CAtlList path; - CAtlList mts; - - if(FAILED(m_pGBDE->GetDeadEnd(i, path, mts)) || !path.GetCount()) - return; - - POSITION pos = path.GetHeadPosition(); - while(pos) - { - AddLine(CString(path.GetNext(pos)) + _T("\n")); - if(!pos) AddLine(_T("\n")); - } - - pos = mts.GetHeadPosition(); - for(int j = 0; pos; j++) - { - CString str; - str.Format(_T("Media Type %d:\n"), j); - AddLine(str); - AddLine(_T("--------------------------\n")); - AddMediaType(&mts.GetNext(pos)); - AddLine(); - } - - m_report.SetSel(0, 0); -} diff --git a/src/apps/mplayerc/MediaTypesDlg.h b/src/apps/mplayerc/MediaTypesDlg.h deleted file mode 100644 index 7651f73a7..000000000 --- a/src/apps/mplayerc/MediaTypesDlg.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include -#include -#include "IGraphBuilder2.h" - -// CMediaTypesDlg dialog - -class CMediaTypesDlg : public CResizableDialog -{ -// DECLARE_DYNAMIC(CMediaTypesDlg) - -private: - CComPtr m_pGBDE; - enum {UNKNOWN, VIDEO, AUDIO} m_type; - GUID m_subtype; - void AddLine(CString str = _T("\n")); - void AddMediaType(AM_MEDIA_TYPE* pmt); - -public: - CMediaTypesDlg(IGraphBuilderDeadEnd* pGBDE, CWnd* pParent = NULL); // standard constructor - virtual ~CMediaTypesDlg(); - -// Dialog Data - enum { IDD = IDD_MEDIATYPES_DLG }; - CComboBox m_pins; - CEdit m_report; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnCbnSelchangeCombo1(); -}; diff --git a/src/apps/mplayerc/OpenCapDeviceDlg.cpp b/src/apps/mplayerc/OpenCapDeviceDlg.cpp deleted file mode 100644 index e4a3b0b60..000000000 --- a/src/apps/mplayerc/OpenCapDeviceDlg.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (C) 2003-2006 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// OpenCapDeviceDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "mplayerc.h" -#include "OpenCapDeviceDlg.h" -#include "..\..\DSUtil\DSUtil.h" - -static struct cc_t {long code; AnalogVideoStandard standard; const TCHAR* str;} s_countrycodes[] = -{ - {1, AnalogVideo_NTSC_M, _T("USA")}, -/* {1, AnalogVideo_NTSC_M, _T("Anguilla")}, - {1, AnalogVideo_NTSC_M, _T("Antigua")}, - {1, AnalogVideo_NTSC_M, _T("Bahamas")}, - {1, AnalogVideo_NTSC_M, _T("Barbados")}, - {1, AnalogVideo_NTSC_M, _T("Bermuda")}, - {1, AnalogVideo_NTSC_M, _T("British Virgin Islands")}, - {1, AnalogVideo_NTSC_M, _T("Canada")}, - {1, AnalogVideo_NTSC_M, _T("Cayman Islands")}, - {1, AnalogVideo_NTSC_M, _T("Dominica")}, - {1, AnalogVideo_NTSC_M, _T("Dominican Republic")}, - {1, AnalogVideo_NTSC_M, _T("Grenada")}, - {1, AnalogVideo_NTSC_M, _T("Jamaica")}, - {1, AnalogVideo_NTSC_M, _T("Montserrat")}, - {1, AnalogVideo_NTSC_M, _T("Nevis")}, - {1, AnalogVideo_NTSC_M, _T("St. Kitts")}, - {1, AnalogVideo_NTSC_M, _T("St. Vincent and the Grenadines")}, - {1, AnalogVideo_NTSC_M, _T("Trinidad and Tobago")}, - {1, AnalogVideo_NTSC_M, _T("Turks and Caicos Islands")}, - {1, AnalogVideo_NTSC_M, _T("Barbuda")}, - {1, AnalogVideo_NTSC_M, _T("Puerto Rico")}, - {1, AnalogVideo_NTSC_M, _T("Saint Lucia")}, - {1, AnalogVideo_NTSC_M, _T("United States Virgin Islands")}, -*/ {2, AnalogVideo_NTSC_M, _T("Canada")}, - {7, AnalogVideo_SECAM_D, _T("Russia")}, -/* {7, AnalogVideo_SECAM_D, _T("Kazakhstan")}, - {7, AnalogVideo_SECAM_D, _T("Kyrgyzstan")}, - {7, AnalogVideo_SECAM_D, _T("Tajikistan")}, - {7, AnalogVideo_SECAM_D, _T("Turkmenistan")}, - {7, AnalogVideo_SECAM_D, _T("Uzbekistan")}, -*/ {20, AnalogVideo_SECAM_B, _T("Egypt")}, - {27, AnalogVideo_PAL_I, _T("South Africa")}, - {30, AnalogVideo_SECAM_B, _T("Greece")}, - {31, AnalogVideo_PAL_B, _T("Netherlands")}, - {32, AnalogVideo_PAL_B, _T("Belgium")}, - {33, AnalogVideo_SECAM_L, _T("France")}, - {34, AnalogVideo_PAL_B, _T("Spain")}, - {36, AnalogVideo_SECAM_D, _T("Hungary")}, - {39, AnalogVideo_PAL_B, _T("Italy")}, - {39, AnalogVideo_PAL_B, _T("Vatican City")}, - {40, AnalogVideo_PAL_D, _T("Romania")}, - {41, AnalogVideo_PAL_B, _T("Switzerland")}, - {41, AnalogVideo_PAL_B, _T("Liechtenstein")}, - {43, AnalogVideo_PAL_B, _T("Austria")}, - {44, AnalogVideo_PAL_I, _T("United Kingdom")}, - {45, AnalogVideo_PAL_B, _T("Denmark")}, - {46, AnalogVideo_PAL_B, _T("Sweden")}, - {47, AnalogVideo_PAL_B, _T("Norway")}, - {48, AnalogVideo_PAL_B, _T("Poland")}, - {49, AnalogVideo_PAL_B, _T("Germany")}, - {51, AnalogVideo_NTSC_M, _T("Peru")}, - {52, AnalogVideo_NTSC_M, _T("Mexico")}, - {53, AnalogVideo_NTSC_M, _T("Cuba")}, - {53, AnalogVideo_NTSC_M, _T("Guantanamo Bay")}, - {54, AnalogVideo_PAL_N, _T("Argentina")}, - {55, AnalogVideo_PAL_M, _T("Brazil")}, - {56, AnalogVideo_NTSC_M, _T("Chile")}, - {57, AnalogVideo_NTSC_M, _T("Colombia")}, - {58, AnalogVideo_NTSC_M, _T("Bolivarian Republic of Venezuela")}, - {60, AnalogVideo_PAL_B, _T("Malaysia")}, - {61, AnalogVideo_PAL_B, _T("Australia")}, - // {61, AnalogVideo_NTSC_M, _T("Cocos-Keeling Islands")}, - {62, AnalogVideo_PAL_B, _T("Indonesia")}, - {63, AnalogVideo_NTSC_M, _T("Philippines")}, - {64, AnalogVideo_PAL_B, _T("New Zealand")}, - {65, AnalogVideo_PAL_B, _T("Singapore")}, - {66, AnalogVideo_PAL_B, _T("Thailand")}, - {81, AnalogVideo_NTSC_M_J, _T("Japan")}, - {82, AnalogVideo_NTSC_M, _T("Korea (South)")}, - {84, AnalogVideo_NTSC_M, _T("Vietnam")}, - {86, AnalogVideo_PAL_D, _T("China")}, - {90, AnalogVideo_PAL_B, _T("Turkey")}, - {91, AnalogVideo_PAL_B, _T("India")}, - {92, AnalogVideo_PAL_B, _T("Pakistan")}, - {93, AnalogVideo_PAL_B, _T("Afghanistan")}, - {94, AnalogVideo_PAL_B, _T("Sri Lanka")}, - {95, AnalogVideo_NTSC_M, _T("Myanmar")}, - {98, AnalogVideo_SECAM_B, _T("Iran")}, - {212, AnalogVideo_SECAM_B, _T("Morocco")}, - {213, AnalogVideo_PAL_B, _T("Algeria")}, - {216, AnalogVideo_SECAM_B, _T("Tunisia")}, - {218, AnalogVideo_SECAM_B, _T("Libya")}, - {220, AnalogVideo_SECAM_K, _T("Gambia")}, - {221, AnalogVideo_SECAM_K, _T("Senegal Republic")}, - {222, AnalogVideo_SECAM_B, _T("Mauritania")}, - {223, AnalogVideo_SECAM_K, _T("Mali")}, - {224, AnalogVideo_SECAM_K, _T("Guinea")}, - {225, AnalogVideo_SECAM_K, _T("Cote D'Ivoire")}, - {226, AnalogVideo_SECAM_K, _T("Burkina Faso")}, - {227, AnalogVideo_SECAM_K, _T("Niger")}, - {228, AnalogVideo_SECAM_K, _T("Togo")}, - {229, AnalogVideo_SECAM_K, _T("Benin")}, - {230, AnalogVideo_SECAM_B, _T("Mauritius")}, - {231, AnalogVideo_PAL_B, _T("Liberia")}, - {232, AnalogVideo_PAL_B, _T("Sierra Leone")}, - {233, AnalogVideo_PAL_B, _T("Ghana")}, - {234, AnalogVideo_PAL_B, _T("Nigeria")}, - {235, AnalogVideo_PAL_B, _T("Chad")}, - {236, AnalogVideo_PAL_B, _T("Central African Republic")}, - {237, AnalogVideo_PAL_B, _T("Cameroon")}, - {238, AnalogVideo_NTSC_M, _T("Cape Verde Islands")}, - {239, AnalogVideo_PAL_B, _T("Sao Tome and Principe")}, - {240, AnalogVideo_SECAM_B, _T("Equatorial Guinea")}, - {241, AnalogVideo_SECAM_K, _T("Gabon")}, - {242, AnalogVideo_SECAM_D, _T("Congo")}, - {243, AnalogVideo_SECAM_K, _T("Congo(DRC)")}, - {244, AnalogVideo_PAL_I, _T("Angola")}, - {245, AnalogVideo_NTSC_M, _T("Guinea-Bissau")}, - {246, AnalogVideo_NTSC_M, _T("Diego Garcia")}, - {247, AnalogVideo_NTSC_M, _T("Ascension Island")}, - {248, AnalogVideo_PAL_B, _T("Seychelle Islands")}, - {249, AnalogVideo_PAL_B, _T("Sudan")}, - {250, AnalogVideo_PAL_B, _T("Rwanda")}, - {251, AnalogVideo_PAL_B, _T("Ethiopia")}, - {252, AnalogVideo_PAL_B, _T("Somalia")}, - {253, AnalogVideo_SECAM_K, _T("Djibouti")}, - {254, AnalogVideo_PAL_B, _T("Kenya")}, - {255, AnalogVideo_PAL_B, _T("Tanzania")}, - {256, AnalogVideo_PAL_B, _T("Uganda")}, - {257, AnalogVideo_SECAM_K, _T("Burundi")}, - {258, AnalogVideo_PAL_B, _T("Mozambique")}, - {260, AnalogVideo_PAL_B, _T("Zambia")}, - {261, AnalogVideo_SECAM_K, _T("Madagascar")}, - {262, AnalogVideo_SECAM_K, _T("Reunion Island")}, - {263, AnalogVideo_PAL_B, _T("Zimbabwe")}, - {264, AnalogVideo_PAL_I, _T("Namibia")}, - {265, AnalogVideo_NTSC_M, _T("Malawi")}, - {266, AnalogVideo_PAL_I, _T("Lesotho")}, - {267, AnalogVideo_SECAM_K, _T("Botswana")}, - {268, AnalogVideo_PAL_B, _T("Swaziland")}, - {269, AnalogVideo_SECAM_K, _T("Mayotte Island")}, -// {269, AnalogVideo_NTSC_M, _T("Comoros")}, - {290, AnalogVideo_NTSC_M, _T("St. Helena")}, - {291, AnalogVideo_NTSC_M, _T("Eritrea")}, - {297, AnalogVideo_NTSC_M, _T("Aruba")}, - {298, AnalogVideo_PAL_B, _T("Faroe Islands")}, - {299, AnalogVideo_NTSC_M, _T("Greenland")}, - {350, AnalogVideo_PAL_B, _T("Gibraltar")}, - {351, AnalogVideo_PAL_B, _T("Portugal")}, - {352, AnalogVideo_PAL_B, _T("Luxembourg")}, - {353, AnalogVideo_PAL_I, _T("Ireland")}, - {354, AnalogVideo_PAL_B, _T("Iceland")}, - {355, AnalogVideo_PAL_B, _T("Albania")}, - {356, AnalogVideo_PAL_B, _T("Malta")}, - {357, AnalogVideo_PAL_B, _T("Cyprus")}, - {358, AnalogVideo_PAL_B, _T("Finland")}, - {359, AnalogVideo_SECAM_D, _T("Bulgaria")}, - {370, AnalogVideo_PAL_B, _T("Lithuania")}, - {371, AnalogVideo_SECAM_D, _T("Latvia")}, - {372, AnalogVideo_PAL_B, _T("Estonia")}, - {373, AnalogVideo_SECAM_D, _T("Moldova")}, - {374, AnalogVideo_SECAM_D, _T("Armenia")}, - {375, AnalogVideo_SECAM_D, _T("Belarus")}, - {376, AnalogVideo_NTSC_M, _T("Andorra")}, - {377, AnalogVideo_SECAM_G, _T("Monaco")}, - {378, AnalogVideo_PAL_B, _T("San Marino")}, - {380, AnalogVideo_SECAM_D, _T("Ukraine")}, - {381, AnalogVideo_PAL_B, _T("Serbia and Montenegro")}, - {385, AnalogVideo_PAL_B, _T("Croatia")}, - {386, AnalogVideo_PAL_B, _T("Slovenia")}, - {387, AnalogVideo_PAL_B, _T("Bosnia and Herzegovina")}, - {389, AnalogVideo_PAL_B, _T("F.Y.R.O.M. (Former Yugoslav Republic of Macedonia)")}, - {420, AnalogVideo_PAL_D, _T("Czech Republic")}, - {421, AnalogVideo_PAL_B, _T("Slovak Republic")}, - {500, AnalogVideo_PAL_I, _T("Falkland Islands (Islas Malvinas)")}, - {501, AnalogVideo_NTSC_M, _T("Belize")}, - {502, AnalogVideo_NTSC_M, _T("Guatemala")}, - {503, AnalogVideo_NTSC_M, _T("El Salvador")}, - {504, AnalogVideo_NTSC_M, _T("Honduras")}, - {505, AnalogVideo_NTSC_M, _T("Nicaragua")}, - {506, AnalogVideo_NTSC_M, _T("Costa Rica")}, - {507, AnalogVideo_NTSC_M, _T("Panama")}, - {508, AnalogVideo_SECAM_K, _T("St. Pierre and Miquelon")}, - {509, AnalogVideo_NTSC_M, _T("Haiti")}, - {590, AnalogVideo_SECAM_K, _T("Guadeloupe")}, -// {590, AnalogVideo_NTSC_M, _T("French Antilles")}, - {591, AnalogVideo_PAL_N, _T("Bolivia")}, - {592, AnalogVideo_SECAM_K, _T("Guyana")}, - {593, AnalogVideo_NTSC_M, _T("Ecuador")}, - {594, AnalogVideo_SECAM_K, _T("French Guiana")}, - {595, AnalogVideo_PAL_N, _T("Paraguay")}, - {596, AnalogVideo_SECAM_K, _T("Martinique")}, - {597, AnalogVideo_NTSC_M, _T("Suriname")}, - {598, AnalogVideo_PAL_N, _T("Uruguay")}, - {599, AnalogVideo_NTSC_M, _T("Netherlands Antilles")}, - {670, AnalogVideo_NTSC_M, _T("Saipan Island")}, -// {670, AnalogVideo_NTSC_M, _T("Rota Island")}, -// {670, AnalogVideo_NTSC_M, _T("Tinian Island")}, - {671, AnalogVideo_NTSC_M, _T("Guam")}, - {672, AnalogVideo_NTSC_M, _T("Christmas Island")}, - {672, AnalogVideo_NTSC_M, _T("Australian Antarctic Territory")}, - //{672, AnalogVideo_PAL_B, _T("Norfolk Island")}, - {673, AnalogVideo_PAL_B, _T("Brunei")}, - {674, AnalogVideo_NTSC_M, _T("Nauru")}, - {675, AnalogVideo_PAL_B, _T("Papua New Guinea")}, - {676, AnalogVideo_NTSC_M, _T("Tonga")}, - {677, AnalogVideo_NTSC_M, _T("Solomon Islands")}, - {678, AnalogVideo_NTSC_M, _T("Vanuatu")}, - {679, AnalogVideo_NTSC_M, _T("Fiji Islands")}, - {680, AnalogVideo_NTSC_M, _T("Palau")}, - {681, AnalogVideo_SECAM_K, _T("Wallis and Futuna Islands")}, - {682, AnalogVideo_PAL_B, _T("Cook Islands")}, - {683, AnalogVideo_NTSC_M, _T("Niue")}, - {684, AnalogVideo_NTSC_M, _T("Territory of American Samoa")}, - {685, AnalogVideo_PAL_B, _T("Samoa")}, - {686, AnalogVideo_PAL_B, _T("Kiribati Republic")}, - {687, AnalogVideo_SECAM_K, _T("New Caledonia")}, - {688, AnalogVideo_NTSC_M, _T("Tuvalu")}, - {689, AnalogVideo_SECAM_K, _T("French Polynesia")}, - {690, AnalogVideo_NTSC_M, _T("Tokelau")}, - {691, AnalogVideo_NTSC_M, _T("Micronesia")}, - {692, AnalogVideo_NTSC_M, _T("Marshall Islands")}, - {850, AnalogVideo_SECAM_D, _T("Korea (North)")}, - {852, AnalogVideo_PAL_I, _T("Hong Kong SAR")}, - {853, AnalogVideo_PAL_I, _T("Macao SAR")}, - {855, AnalogVideo_PAL_B, _T("Cambodia")}, - {856, AnalogVideo_PAL_B, _T("Laos")}, - {871, AnalogVideo_NTSC_M, _T("INMARSAT (Atlantic-East)")}, - {872, AnalogVideo_NTSC_M, _T("INMARSAT (Pacific)")}, - {873, AnalogVideo_NTSC_M, _T("INMARSAT (Indian)")}, - {874, AnalogVideo_NTSC_M, _T("INMARSAT (Atlantic-West)")}, - {880, AnalogVideo_PAL_B, _T("Bangladesh")}, - {886, AnalogVideo_NTSC_M, _T("Taiwan")}, - {960, AnalogVideo_PAL_B, _T("Maldives")}, - {961, AnalogVideo_SECAM_B, _T("Lebanon")}, - {962, AnalogVideo_PAL_B, _T("Jordan")}, - {963, AnalogVideo_SECAM_B, _T("Syria")}, - {964, AnalogVideo_SECAM_B, _T("Iraq")}, - {965, AnalogVideo_PAL_B, _T("Kuwait")}, - {966, AnalogVideo_SECAM_B, _T("Saudi Arabia")}, - {967, AnalogVideo_PAL_B, _T("Yemen")}, - {968, AnalogVideo_PAL_B, _T("Oman")}, - {971, AnalogVideo_PAL_B, _T("United Arab Emirates")}, - {972, AnalogVideo_PAL_B, _T("Israel")}, - {973, AnalogVideo_PAL_B, _T("Bahrain")}, - {974, AnalogVideo_PAL_B, _T("Qatar")}, - {975, AnalogVideo_NTSC_M, _T("Bhutan")}, - {976, AnalogVideo_SECAM_D, _T("Mongolia")}, - {977, AnalogVideo_PAL_B, _T("Nepal")}, - {994, AnalogVideo_SECAM_D, _T("Azerbaijan")}, - {995, AnalogVideo_SECAM_D,_T("Georgia")}, -}; - -// COpenCapDeviceDlg dialog - -//IMPLEMENT_DYNAMIC(COpenCapDeviceDlg, CResizableDialog) -COpenCapDeviceDlg::COpenCapDeviceDlg(CWnd* pParent /*=NULL*/) - : CResizableDialog(COpenCapDeviceDlg::IDD, pParent) - , m_vidstr(_T("")) - , m_audstr(_T("")) - , m_country(1) -{ -} - -COpenCapDeviceDlg::~COpenCapDeviceDlg() -{ -} - -void COpenCapDeviceDlg::DoDataExchange(CDataExchange* pDX) -{ - __super::DoDataExchange(pDX); - DDX_Control(pDX, IDC_COMBO1, m_vidctrl); - DDX_Control(pDX, IDC_COMBO2, m_audctrl); - DDX_Control(pDX, IDC_COMBO9, m_countryctrl); -} - -BEGIN_MESSAGE_MAP(COpenCapDeviceDlg, CResizableDialog) - ON_BN_CLICKED(IDOK, OnBnClickedOk) -END_MESSAGE_MAP() - - -// COpenCapDeviceDlg message handlers - -BOOL COpenCapDeviceDlg::OnInitDialog() -{ - __super::OnInitDialog(); - - AddAnchor(m_vidctrl, TOP_LEFT, TOP_RIGHT); - AddAnchor(m_audctrl, TOP_LEFT, TOP_RIGHT); - AddAnchor(m_countryctrl, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDOK, TOP_CENTER); - AddAnchor(IDCANCEL, TOP_CENTER); - - CRect r; - GetWindowRect(r); - CSize s = r.Size(); - SetMinTrackSize(s); - s.cx = 1000; - SetMaxTrackSize(s); - - CString dummy = _T("dummy"); - CString vidstr = AfxGetApp()->GetProfileString(_T("Capture"), _T("VidDispName"), dummy); - CString audstr = AfxGetApp()->GetProfileString(_T("Capture"), _T("AudDispName"), dummy); - long country = AfxGetApp()->GetProfileInt(_T("Capture"), _T("Country"), 1); - - int iSel = vidstr == dummy ? 0 : -1; - - BeginEnumSysDev(CLSID_VideoInputDeviceCategory, pMoniker) - { - CComPtr pPB; - pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB); - - CComVariant var; - pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL); - int i = m_vidctrl.AddString(CString(var.bstrVal)); - - LPOLESTR strName = NULL; - if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) - { - m_vidnames.Add(CString(strName)); - if(vidstr == CString(strName)) iSel = i; - CoTaskMemFree(strName); - } - } - EndEnumSysDev - - if(m_vidctrl.GetCount()) - m_vidctrl.SetCurSel(iSel); - - iSel = audstr == dummy ? 0 : -1; - - BeginEnumSysDev(CLSID_AudioInputDeviceCategory, pMoniker) - { - CComPtr pPB; - pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB); - - CComVariant var; - pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL); - int i = m_audctrl.AddString(CString(var.bstrVal)); - - LPOLESTR strName = NULL; - if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) - { - m_audnames.Add(CString(strName)); - if(audstr == CString(strName)) iSel = i; - CoTaskMemFree(strName); - } - } - EndEnumSysDev - - { - int i = m_audctrl.AddString(_T("