Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5aada39

Browse files
committed
C++: Add failing tests for 'CRegKey'.
1 parent 33212da commit 5aada39

1 file changed

Lines changed: 172 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: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,175 @@ void test_CAtlTemporaryFile() {
215215
DWORD bytesRead;
216216
file.Read(buffer, 1024, bytesRead); // $ local_source
217217
}
218+
219+
struct CRegKey {
220+
CRegKey() throw();
221+
CRegKey(CRegKey& key) throw();
222+
explicit CRegKey(HKEY hKey) throw();
223+
CRegKey(CAtlTransactionManager* pTM) throw();
224+
225+
~CRegKey() throw();
226+
void Attach(HKEY hKey) throw();
227+
LONG Close() throw();
228+
229+
LONG Create(
230+
HKEY hKeyParent,
231+
LPCTSTR lpszKeyName,
232+
LPTSTR lpszClass,
233+
DWORD dwOptions,
234+
REGSAM samDesired,
235+
LPSECURITY_ATTRIBUTES lpSecAttr,
236+
LPDWORD lpdwDisposition) throw();
237+
238+
LONG DeleteSubKey(LPCTSTR lpszSubKey) throw();
239+
LONG DeleteValue(LPCTSTR lpszValue) throw();
240+
HKEY Detach() throw();
241+
242+
LONG EnumKey(
243+
DWORD iIndex,
244+
LPTSTR pszName,
245+
LPDWORD pnNameLength,
246+
FILETIME* pftLastWriteTime) throw();
247+
248+
LONG Flush() throw();
249+
250+
LONG GetKeySecurity(
251+
SECURITY_INFORMATION si,
252+
PSECURITY_DESCRIPTOR psd,
253+
LPDWORD pnBytes) throw();
254+
255+
LONG NotifyChangeKeyValue(
256+
BOOL bWatchSubtree,
257+
DWORD dwNotifyFilter,
258+
HANDLE hEvent,
259+
BOOL bAsync) throw();
260+
261+
LONG Open(
262+
HKEY hKeyParent,
263+
LPCTSTR lpszKeyName,
264+
REGSAM samDesired) throw();
265+
266+
LONG QueryBinaryValue(
267+
LPCTSTR pszValueName,
268+
void* pValue,
269+
ULONG* pnBytes) throw();
270+
271+
LONG QueryDWORDValue(
272+
LPCTSTR pszValueName,
273+
DWORD& dwValue) throw();
274+
275+
LONG QueryGUIDValue(
276+
LPCTSTR pszValueName,
277+
GUID& guidValue) throw();
278+
279+
LONG QueryMultiStringValue(
280+
LPCTSTR pszValueName,
281+
LPTSTR pszValue,
282+
ULONG* pnChars) throw();
283+
284+
LONG QueryQWORDValue(
285+
LPCTSTR pszValueName,
286+
ULONGLONG& qwValue) throw();
287+
288+
LONG QueryStringValue(
289+
LPCTSTR pszValueName,
290+
LPTSTR pszValue,
291+
ULONG* pnChars) throw();
292+
293+
LONG QueryValue(
294+
LPCTSTR pszValueName,
295+
DWORD* pdwType,
296+
void* pData,
297+
ULONG* pnBytes) throw();
298+
299+
LONG QueryValue(
300+
DWORD& dwValue,
301+
LPCTSTR lpszValueName);
302+
303+
LONG QueryValue(
304+
LPTSTR szValue,
305+
LPCTSTR lpszValueName,
306+
DWORD* pdwCount);
307+
308+
LONG RecurseDeleteKey(LPCTSTR lpszKey) throw();
309+
310+
LONG SetBinaryValue(
311+
LPCTSTR pszValueName,
312+
const void* pValue,
313+
ULONG nBytes) throw();
314+
315+
LONG SetDWORDValue(LPCTSTR pszValueName, DWORD dwValue) throw();
316+
317+
LONG SetGUIDValue(LPCTSTR pszValueName, REFGUID guidValue) throw();
318+
319+
LONG SetKeySecurity(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR psd) throw();
320+
321+
LONG SetKeyValue(
322+
LPCTSTR lpszKeyName,
323+
LPCTSTR lpszValue,
324+
LPCTSTR lpszValueName) throw();
325+
326+
LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue) throw();
327+
328+
LONG SetQWORDValue(LPCTSTR pszValueName, ULONGLONG qwValue) throw();
329+
330+
LONG SetStringValue(
331+
LPCTSTR pszValueName,
332+
LPCTSTR pszValue,
333+
DWORD dwType) throw();
334+
335+
LONG SetValue(
336+
LPCTSTR pszValueName,
337+
DWORD dwType,
338+
const void* pValue,
339+
ULONG nBytes) throw();
340+
341+
static LONG SetValue(
342+
HKEY hKeyParent,
343+
LPCTSTR lpszKeyName,
344+
LPCTSTR lpszValue,
345+
LPCTSTR lpszValueName);
346+
347+
LONG SetValue(
348+
DWORD dwValue,
349+
LPCTSTR lpszValueName);
350+
351+
LONG SetValue(
352+
LPCTSTR lpszValue,
353+
LPCTSTR lpszValueName,
354+
bool bMulti,
355+
int nValueLen);
356+
357+
operator HKEY() const throw();
358+
CRegKey& operator= (CRegKey& key) throw();
359+
360+
HKEY m_hKey;
361+
};
362+
363+
void test_CRegKey() {
364+
CRegKey key;
365+
char data[1024];
366+
ULONG bytesRead;
367+
key.QueryBinaryValue("foo", data, &bytesRead); // $ MISSING: local_source
368+
369+
DWORD value;
370+
key.QueryDWORDValue("foo", value); // $ MISSING: local_source
371+
372+
GUID guid;
373+
key.QueryGUIDValue("foo", guid); // $ MISSING: local_source
374+
375+
key.QueryMultiStringValue("foo", data, &bytesRead); // $ MISSING: local_source
376+
377+
ULONGLONG qword;
378+
key.QueryQWORDValue("foo", qword); // $ MISSING: local_source
379+
380+
key.QueryStringValue("foo", data, &bytesRead); // $ MISSING: local_source
381+
382+
key.QueryValue(data, "foo", &bytesRead); // $ MISSING: local_source
383+
384+
DWORD type;
385+
key.QueryValue("foo", &type, data, &bytesRead); // $ MISSING: local_source
386+
387+
DWORD value2;
388+
key.QueryValue(value2, "foo"); // $ MISSING: local_source
389+
}

0 commit comments

Comments
 (0)