summaryrefslogtreecommitdiff
path: root/print/XPSDrvSmpl/src/common/workbuff.h
blob: 263e97d3c482ef55350071a45e559889f482f9e8 (plain)
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
/*++

Copyright (c) 2005 Microsoft Corporation

All rights reserved.

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

File Name:

   workbuff.h

Abstract:

   CWorkingBuffer class definition. This class provides a means of working
   with a local buffer by defining a simple interface that allows the retrieval
   of a buffer of an appropriate size, handling reallocation as necessary.

--*/

#pragma once

class CWorkingBuffer
{
public:
    CWorkingBuffer();

    virtual ~CWorkingBuffer();

    HRESULT
    GetBuffer(
        _In_                       CONST ULONGLONG cbSize,
        _Outptr_result_bytebuffer_(cbSize) PVOID*          ppBuffer
        );

    HRESULT
    GetBufferAt(
        _In_                       ULONG           cbOffset,
        _In_                       CONST ULONGLONG cbSize,
        _Outptr_result_bytebuffer_(cbSize) PVOID*          ppBuffer
        );

private:
    _Field_size_bytes_(m_cbSize) PVOID  m_pBuffer;

    SIZE_T m_cbSize;
};