summaryrefslogtreecommitdiffstats
path: root/private/oleutest/cfmex/ctest.hxx
blob: 32d1e0012e159a61440cbffaa0f368bb0a5db514 (plain) (blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118


//+================================================================
//
//  File:       CTest.hxx
//
//  Purpose:    Declare the CTest class.
//
//              This class is the test engine for the CreateFileMonikerEx
//              API (CFMEx) DRTs.
//
//+================================================================

#ifndef _C_TEST_HXX_
#define _C_TEST_HXX_

//  --------
//  Includes
//  --------

#include "CDir.hxx"

//  -----
//  CTest
//  -----

class CTest
{

// (De)Construction

public:

    CTest( );
    ~CTest();

// Public member routines.

public:

    BOOL Initialize( const CDirectory& cDirectoryOriginal,
                     const CDirectory& cDirectoryFinal );
    BOOL CreateFileMonikerEx();
    BOOL BindToStorage();
    BOOL BindToObject();
    BOOL IPersist();
    BOOL ComposeWith();
    BOOL GetDisplayName();
    BOOL GetTimeOfLastChange();
    BOOL DeleteLinkSource( DWORD dwDelay = INFINITE );

    BOOL GetOversizedBindOpts();
    BOOL GetUndersizedBindOpts();
    BOOL SetOversizedBindOpts();
    BOOL SetUndersizedBindOpts();

// Private member routines.

private:

    void DisplayErrors( BOOL bSuccess, WCHAR * wszFunctionName );

// Private member variables.

private:

    CMoniker  m_cMoniker;
    long      m_lError;
    WCHAR     m_wszErrorMessage[ 512 ];

    const CDirectory* m_pcDirectoryOriginal;
    const CDirectory* m_pcDirectoryFinal;

};


//  --------------
//  Inline Members
//  --------------

#define OUTFILE     stdout

inline void CTest::DisplayErrors( BOOL bSuccess, WCHAR * wszFunctionName )
{
    if( !bSuccess )
    fwprintf( OUTFILE, L"Error in %s (%08x)\n   %s   \n",
              wszFunctionName, m_lError, m_wszErrorMessage );
}


//  ------
//  Macros
//  ------

#undef EXIT
#define EXIT( error )               \
                                    {\
                                       wcscpy( m_wszErrorMessage, ##error );\
                                       goto Exit;\
                                    }


#define ERROR_IN_EXIT( error )    \
                         {\
                            wcscpy( m_wszErrorMessage, ##error );\
                            bSuccess = FALSE; \
                         }


//  -------
//  Defines
//  -------

#define SIZE_OF_LARGE_BIND_OPTS  ( 2 * sizeof( BIND_OPTS2 ))
#define SIZE_OF_SMALL_BIND_OPTS  ( 3 * sizeof( DWORD ))

#endif // _C_TEST_HXX_