I think you can try to use another interface - IMessageStore. You can initialize it using the absolute path (in terms of file system) to the folder which contains the .dbx files. For example (on my machine) it is "C:\Documents and Settings\Alexey\Local Settings\Application Data\Identities\{<some_guid>}\Microsoft\Outlook Express". After proper initialization you will have access to whole tree of OE's folders located in this file folder.
You can get the instance using simple call of CoCreateInstance:
IMessageStore* p_store = NULL;
...
HRESULT hr = ::CoCreateInstance(CLSID_MessageStore,NULL,CLSCTX_INPROC_SERVER,IID_IMessageStore,(void**)&store );
if (FAILED(hr) || (p_store == NULL)) return E_FAIL;
hr = p_store->Initialize(sz_path_to_dbx_folder);
...
Then you can use member functions:
EnumChildren - to enumerate folders,
OpenFolder - to open folder,
OpenSpecialFolder... and so on.
They works very like the ones from IStoreNamespace (actually these members of IStoreNamespace delegate their calls to IMessageStore). If you see, for example, OpenFolder (in difference with such member from IStoreNamespace) returns the pointer to IMessageFolder, instead of IStoreFolder - and also wait for parameter IMessageServer.
Actually you can use IMessageFolder as more general version of IStoreFolder.
hm... I think I can summ the knowledge of internal OE structures into standalone article here on CodeProject, how you think? :->
Below is the necessary declarations (they are non-official - so, it may contain misstypes; be careful!)
<br />
DEFINE_GUID(CLSID_MessageStore, 0x101A8FB9, 0xF1B9, 0x11d1, 0x9A, 0x56, 0x0, 0xC0, 0x4F, 0xA3, 0x09, 0xD4);<br />
<br />
DEFINE_GUID(IID_IMessageStore, 0xE883FC75, 0xEC08, 0x11D1, 0x9A, 0x53, 0x0, 0xC0, 0x4F, 0xA3, 0x09, 0xD4);<br />
<br />
struct tagMESSAGEINFO;<br />
typedef tagMESSAGEINFO MESSAGEINFO, __RPC_FAR *LPMESSAGEINFO;<br />
<br />
struct tagFINDINFO;<br />
struct tagGETCOUNTTYPE;<br />
struct tagAPPLYCHILDRENTYPE;<br />
struct tagMARK_TYPE;<br />
struct tagFOLDERSORTINFO;<br />
struct tagGETNEXTTYPE;<br />
struct tagROWMESSAGETYPE;<br />
struct tagRELATIVEROWTYPE;<br />
struct tagFINDNEXTFLAGS;<br />
struct tagFOLDER_OPTIONS;<br />
<br />
interface IListSelector;<br />
interface IMessageServer;<br />
interface IMessageTableNotify;<br />
<br />
typedef DWORD MESSAGEID__;<br />
typedef unsigned long FOLDERID__;<br />
typedef DWORD tagADJUSTFLAGS;<br />
<br />
interface IStoreCallback : public IUnknown<br />
{<br />
};<br />
<br />
struct HLOCK__;<br />
struct tagTABLEINDEX;<br />
struct tagRESULTLIST;<br />
struct tagFOLDERINFO;<br />
struct HROWSET__;<br />
struct HTRANSACTION__;<br />
typedef unsigned short ushort;<br />
typedef unsigned char uchar;<br />
<br />
interface IDatabaseNotify;<br />
interface IDatabaseProgress;<br />
interface IDatabase;<br />
interface IEnumerateFolders;<br />
interface IImnAccount;<br />
<br />
interface IMessageFolder;<br />
<br />
interface IMessageStore : public IUnknown<br />
{<br />
virtual HRESULT STDMETHODCALLTYPE Lock(HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE Unlock(HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE InsertRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE UpdateRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE FindRecord(unsigned long,unsigned long,void *,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE GetRowOrdinal(unsigned long,void *,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE FreeRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE GetUserData(void *,unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE SetUserData(void *,unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE GetRecordCount(unsigned long,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE GetIndexInfo(unsigned long,char * *,struct tagTABLEINDEX *);<br />
virtual HRESULT STDMETHODCALLTYPE ModifyIndex(unsigned long,char const *,struct tagTABLEINDEX const *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteIndex(unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE CreateRowset(unsigned long,unsigned long,struct HROWSET__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE SeekRowset(struct HROWSET__ *,enum tagSEEKROWSETTYPE,long,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE QueryRowset(struct HROWSET__ *,long,void * *,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE CloseRowset(struct HROWSET__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE CreateStream(unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteStream(unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE CopyStream(struct IDatabase *,unsigned long,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE OpenStream(enum tagACCESSTYPE,unsigned long,struct IStream * *);<br />
virtual HRESULT STDMETHODCALLTYPE ChangeStreamLock(struct IStream *,enum tagACCESSTYPE);<br />
virtual HRESULT STDMETHODCALLTYPE RegisterNotify(unsigned long,unsigned long,unsigned long,IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE DispatchNotify(struct IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE SuspendNotify(struct IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE ResumeNotify(struct IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE UnregisterNotify(struct IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE LockNotify(unsigned long,struct HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE UnlockNotify(struct HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE GetTransaction(struct HTRANSACTION__ * *,enum tagTRANSACTIONTYPE *,void *,void *,unsigned long *,struct tagORDINALLIST *);<br />
virtual HRESULT STDMETHODCALLTYPE MoveFileA(unsigned short const *);<br />
virtual HRESULT STDMETHODCALLTYPE SetSize(unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE Repair(void);<br />
virtual HRESULT STDMETHODCALLTYPE Compact(struct IDatabaseProgress *,unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE HeapAllocate(unsigned long,unsigned long,void * *);<br />
virtual HRESULT STDMETHODCALLTYPE HeapFree(void *);<br />
virtual HRESULT STDMETHODCALLTYPE GenerateId(unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE GetClientCount(unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE GetFile(unsigned short * *);<br />
virtual HRESULT STDMETHODCALLTYPE GetSize(unsigned long *,unsigned long *,unsigned long *,unsigned long *);<br />
virtual HRESULT STDMETHODCALLTYPE Initialize(LPCSTR pszPath);<br />
virtual HRESULT STDMETHODCALLTYPE Validate(unsigned long);<br />
virtual HRESULT STDMETHODCALLTYPE GetDirectory(int,LPSTR lpString1,int iMaxLength);<br />
virtual HRESULT STDMETHODCALLTYPE Synchronize(FOLDERID__ *,unsigned long,struct IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE FindServerId(char const *,FOLDERID__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE CreateServer(IImnAccount *,ULONG,FOLDERID__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE CreateFolder(ULONG,tagFOLDERINFO *,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE OpenSpecialFolder(FOLDERID__ *,IMessageServer *,uchar,IMessageFolder**);<br />
virtual HRESULT STDMETHODCALLTYPE OpenFolder(FOLDERID__ *,IMessageServer *,ULONG,IMessageFolder**);<br />
virtual HRESULT STDMETHODCALLTYPE MoveFolder(FOLDERID__ *,FOLDERID__ *,ULONG,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE RenameFolder(FOLDERID__ *,char const *,ULONG,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteFolder(FOLDERID__ *,ULONG,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE GetFolderInfo(FOLDERID__ *,tagFOLDERINFO *);<br />
virtual HRESULT STDMETHODCALLTYPE GetSpecialFolderInfo(FOLDERID__ *,uchar,tagFOLDERINFO *);<br />
virtual HRESULT STDMETHODCALLTYPE SubscribeToFolder(FOLDERID__ *,int,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE HrSetNoSecUICallback(ULONG,long (*)(ULONG));<br />
virtual HRESULT STDMETHODCALLTYPE UpdateFolderCounts(FOLDERID__ *,long,long,long,long);<br />
virtual HRESULT STDMETHODCALLTYPE EnumChildren(FOLDERID__ *,int,IEnumerateFolders **);<br />
virtual HRESULT STDMETHODCALLTYPE GetAdvise(ULONG *,ULONG *,IAdviseSink * *);<br />
};<br />
<br />
interface IMessageFolder : public IUnknown<br />
{<br />
virtual HRESULT STDMETHODCALLTYPE Lock(HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE Unlock(HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE InsertRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE UpdateRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE FindRecord(ULONG,ULONG,void *,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE GetRowOrdinal(ULONG,void *,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE FreeRecord(void *);<br />
virtual HRESULT STDMETHODCALLTYPE GetUserData(void *,ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE SetUserData(void *,ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE GetRecordCount(ULONG,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE GetIndexInfo(ULONG,char * *,tagTABLEINDEX *);<br />
virtual HRESULT STDMETHODCALLTYPE ModifyIndex(ULONG,char const *,tagTABLEINDEX const *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteIndex(ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE CreateRowset(ULONG,ULONG,HROWSET__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE SeekRowset(HROWSET__ *,tagSEEKROWSETTYPE,long,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE QueryRowset(HROWSET__ *,long,void * *,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE CloseRowset(HROWSET__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE CreateStream(ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteStream(ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE CopyStream(IDatabase *,ULONG,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE OpenStream(tagACCESSTYPE,ULONG,IStream * *);<br />
virtual HRESULT STDMETHODCALLTYPE ChangeStreamLock(IStream *,tagACCESSTYPE);<br />
virtual HRESULT STDMETHODCALLTYPE RegisterNotify(ULONG,ULONG,ULONG,IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE DispatchNotify(IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE SuspendNotify(IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE ResumeNotify(IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE UnregisterNotify(IDatabaseNotify *);<br />
virtual HRESULT STDMETHODCALLTYPE LockNotify(ULONG,HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE UnlockNotify(HLOCK__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE GetTransaction(HTRANSACTION__ * *,tagTRANSACTIONTYPE *,void *,void *,ULONG *,tagORDINALLIST *);<br />
virtual HRESULT STDMETHODCALLTYPE MoveFileA(ushort const *);<br />
virtual HRESULT STDMETHODCALLTYPE SetSize(ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE Repair(void);<br />
virtual HRESULT STDMETHODCALLTYPE Compact(IDatabaseProgress *,ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE HeapAllocate(ULONG,ULONG,void * *);<br />
virtual HRESULT STDMETHODCALLTYPE HeapFree(void *);<br />
virtual HRESULT STDMETHODCALLTYPE GenerateId(ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE GetClientCount(ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE GetFile(ushort * *);<br />
virtual HRESULT STDMETHODCALLTYPE GetSize(ULONG *,ULONG *,ULONG *,ULONG *);<br />
virtual HRESULT STDMETHODCALLTYPE Initialize(IMessageStore *,IMessageServer *,ULONG,FOLDERID__ *);<br />
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(int);<br />
virtual HRESULT STDMETHODCALLTYPE UpdateRegistry(int);<br />
virtual HRESULT STDMETHODCALLTYPE GetFolderId(FOLDERID__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE GetMessageFolderId(MESSAGEID__ *,FOLDERID__ * *);<br />
virtual HRESULT STDMETHODCALLTYPE GetAdvise(ULONG *,ULONG *,IAdviseSink * *);<br />
virtual HRESULT STDMETHODCALLTYPE OpenMessage(MESSAGEID__ *,ULONG,IMimeMessage * *,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE SaveMessage(MESSAGEID__ * *,ULONG,ULONG,IStream *,IMimeMessage *,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE HrSetNoSecUICallback(ULONG,long (*)(ULONG));<br />
virtual HRESULT STDMETHODCALLTYPE SetMessageFlags(tagMESSAGEIDLIST *,tagADJUSTFLAGS *,tagRESULTLIST *,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE CopyMessages(IMessageFolder *,ULONG,tagMESSAGEIDLIST *,tagADJUSTFLAGS *,tagRESULTLIST *,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE DeleteMessages(ULONG,tagMESSAGEIDLIST *,tagRESULTLIST *,IStoreCallback *);<br />
virtual HRESULT STDMETHODCALLTYPE ResetFolderCounts(ULONG,ULONG,ULONG,ULONG);<br />
virtual HRESULT STDMETHODCALLTYPE IsWatched(char const *,char const *);<br />
virtual HRESULT STDMETHODCALLTYPE GetDatabase(IDatabase * *);<br />
virtual HRESULT STDMETHODCALLTYPE ConnectionRelease(void);<br />
virtual HRESULT STDMETHODCALLTYPE ConnectionRelease1(void);<br />
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp1(int);<br />
};<br />
|