1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef WabObject_h___
#define WabObject_h___
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
#include <windows.h>
#include <wab.h>
class CWabIterator {
public:
virtual nsresult EnumUser(const char16_t *pName, LPENTRYID pEid, ULONG cbEid) = 0;
virtual nsresult EnumList(const char16_t *pName, LPENTRYID pEid, ULONG cbEid, LPMAPITABLE lpTable) = 0;
};
class CWAB
{
public:
CWAB(nsIFile *fileName);
~CWAB();
bool Loaded(void) { return m_bInitialized;}
HRESULT IterateWABContents(CWabIterator *pIter, int *pDone);
// Methods for User entries
LPDISTLIST GetDistList(ULONG cbEid, LPENTRYID pEid);
void ReleaseDistList(LPDISTLIST pList) { if (pList) pList->Release();}
LPMAILUSER GetUser(ULONG cbEid, LPENTRYID pEid);
void ReleaseUser(LPMAILUSER pUser) { if (pUser) pUser->Release();}
LPSPropValue GetUserProperty(LPMAILUSER pUser, ULONG tag);
LPSPropValue GetListProperty(LPDISTLIST pList, ULONG tag);
void FreeProperty(LPSPropValue pVal) { if (pVal) m_lpWABObject->FreeBuffer(pVal);}
void GetValueString(LPSPropValue pVal, nsString& val);
void GetValueTime(LPSPropValue pVal, PRTime& val);
void CStrToUnicode(const char *pStr, nsString& result);
// Utility stuff used by iterate
void FreeProws(LPSRowSet prows);
bool IsAvailable();
private:
char16_t * m_pUniBuff;
int m_uniBuffLen;
bool m_bInitialized;
HINSTANCE m_hinstWAB;
LPWABOPEN m_lpfnWABOpen;
LPADRBOOK m_lpAdrBook;
LPWABOBJECT m_lpWABObject;
};
#endif // WABOBJECT_INCLUDED
|