Skip to content

Commit ac0599c

Browse files
committed
C++: Add a failing test with 'CAtlFileMapping'.
1 parent 74eae4a commit ac0599c

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

  • cpp/ql/test/library-tests/dataflow/source-sink-tests

cpp/ql/test/library-tests/dataflow/source-sink-tests/atl.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,47 @@ void test_CAtlFile() {
135135
char buffer[1024];
136136
catFile.Read(buffer, 1024); // $ local_source
137137
}
138+
139+
struct CAtlFileMappingBase {
140+
CAtlFileMappingBase(CAtlFileMappingBase& orig);
141+
CAtlFileMappingBase() throw();
142+
~CAtlFileMappingBase() throw();
143+
144+
HRESULT CopyFrom(CAtlFileMappingBase& orig) throw();
145+
void* GetData() const throw();
146+
HANDLE GetHandle() throw ();
147+
SIZE_T GetMappingSize() throw();
148+
149+
HRESULT MapFile(
150+
HANDLE hFile,
151+
SIZE_T nMappingSize,
152+
ULONGLONG nOffset,
153+
DWORD dwMappingProtection,
154+
DWORD dwViewDesiredAccess) throw();
155+
156+
HRESULT MapSharedMem(
157+
SIZE_T nMappingSize,
158+
LPCTSTR szName,
159+
BOOL* pbAlreadyExisted,
160+
LPSECURITY_ATTRIBUTES lpsa,
161+
DWORD dwMappingProtection,
162+
DWORD dwViewDesiredAccess) throw();
163+
164+
HRESULT OpenMapping(
165+
LPCTSTR szName,
166+
SIZE_T nMappingSize,
167+
ULONGLONG nOffset,
168+
DWORD dwViewDesiredAccess) throw();
169+
170+
HRESULT Unmap() throw();
171+
};
172+
173+
template <typename T>
174+
struct CAtlFileMapping : public CAtlFileMappingBase {
175+
operator T*() const throw();
176+
};
177+
178+
void test_CAtlFileMapping(CAtlFileMapping<char> mapping) {
179+
char* data = static_cast<char*>(mapping); // $ MISSING: local_source
180+
void* data2 = mapping.GetData(); // $ MISSING: local_source
181+
}

0 commit comments

Comments
 (0)