1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Declares an event to represent a HeapSetInformation function call.
16 : #ifndef SYZYGY_BARD_EVENTS_HEAP_SET_INFORMATION_EVENT_H_
17 : #define SYZYGY_BARD_EVENTS_HEAP_SET_INFORMATION_EVENT_H_
18 :
19 : #include <windows.h>
20 :
21 : #include "base/memory/scoped_ptr.h"
22 : #include "syzygy/bard/event.h"
23 :
24 : namespace bard {
25 : namespace events {
26 :
27 : // An event that wraps a call to HeapSetInformation, to be played against
28 : // a HeapBackdrop.
29 : class HeapSetInformationEvent : public EventInterface {
30 : public:
31 : HeapSetInformationEvent(HANDLE trace_heap,
32 : HEAP_INFORMATION_CLASS info_class,
33 : PVOID info,
34 : SIZE_T info_length,
35 : BOOL trace_succeeded);
36 :
37 : // @name EventInterface implementation.
38 : // @{
39 E : EventType type() const override { return kHeapSetInformationEvent; }
40 : bool Play(void* backdrop) override;
41 : bool Equals(const EventInterface* rhs) const override;
42 : // @}
43 :
44 : // @name Serialization methods.
45 : // @{
46 : static bool Save(const EventInterface* const event,
47 : core::OutArchive* out_archive);
48 : static scoped_ptr<HeapSetInformationEvent> Load(
49 : core::InArchive* in_archive);
50 : // @}
51 :
52 : // @name Accessors.
53 : // @{
54 E : HANDLE trace_heap() const { return trace_heap_; }
55 : HEAP_INFORMATION_CLASS info_class() const { return info_class_; }
56 : PVOID info() const { return info_; }
57 : SIZE_T info_length() const { return info_length_; }
58 : BOOL trace_succeeded() const { return trace_succeeded_; }
59 : // @}
60 :
61 : private:
62 : // Arguments to HeapSetInformation.
63 : HANDLE trace_heap_;
64 : HEAP_INFORMATION_CLASS info_class_;
65 : PVOID info_;
66 : SIZE_T info_length_;
67 :
68 : // Recorded return value.
69 : BOOL trace_succeeded_;
70 :
71 : DISALLOW_COPY_AND_ASSIGN(HeapSetInformationEvent);
72 : };
73 :
74 : } // namespace events
75 : } // namespace bard
76 :
77 : #endif // SYZYGY_BARD_EVENTS_HEAP_SET_INFORMATION_EVENT_H_
|