mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Also update source-sink tests.
This commit is contained in:
@@ -13,32 +13,35 @@ typedef long long LONGLONG;
|
||||
typedef unsigned long* ULONG_PTR;
|
||||
typedef char *LPTSTR;
|
||||
typedef DWORD* LPDWORD;
|
||||
typedef ULONG REGSAM;
|
||||
typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
|
||||
typedef PVOID PSECURITY_DESCRIPTOR;
|
||||
typedef struct _GUID {
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
typedef GUID* REFGUID;
|
||||
|
||||
typedef struct _SECURITY_ATTRIBUTES {
|
||||
DWORD nLength;
|
||||
LPVOID lpSecurityDescriptor;
|
||||
BOOL bInheritHandle;
|
||||
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
|
||||
|
||||
typedef struct _FILETIME {
|
||||
DWORD dwLowDateTime;
|
||||
DWORD dwHighDateTime;
|
||||
} FILETIME, *PFILETIME, *LPFILETIME;
|
||||
|
||||
using size_t = decltype(sizeof(int));
|
||||
using SIZE_T = size_t;
|
||||
|
||||
typedef struct _OVERLAPPED {
|
||||
namespace ATL {
|
||||
|
||||
typedef ULONG REGSAM;
|
||||
typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
|
||||
typedef PVOID PSECURITY_DESCRIPTOR;
|
||||
typedef struct _GUID {
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
typedef GUID* REFGUID;
|
||||
|
||||
typedef struct _SECURITY_ATTRIBUTES {
|
||||
DWORD nLength;
|
||||
LPVOID lpSecurityDescriptor;
|
||||
BOOL bInheritHandle;
|
||||
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
|
||||
|
||||
typedef struct _FILETIME {
|
||||
DWORD dwLowDateTime;
|
||||
DWORD dwHighDateTime;
|
||||
} FILETIME, *PFILETIME, *LPFILETIME;
|
||||
|
||||
typedef struct _OVERLAPPED {
|
||||
ULONG_PTR Internal;
|
||||
ULONG_PTR InternalHigh;
|
||||
union {
|
||||
@@ -49,21 +52,21 @@ typedef struct _OVERLAPPED {
|
||||
PVOID Pointer;
|
||||
} DUMMYUNIONNAME;
|
||||
HANDLE hEvent;
|
||||
} OVERLAPPED, *LPOVERLAPPED;
|
||||
} OVERLAPPED, *LPOVERLAPPED;
|
||||
|
||||
using LPOVERLAPPED_COMPLETION_ROUTINE = void(DWORD, DWORD, LPOVERLAPPED);
|
||||
using LPOVERLAPPED_COMPLETION_ROUTINE = void(DWORD, DWORD, LPOVERLAPPED);
|
||||
|
||||
using HKEY = void*;
|
||||
using HKEY = void*;
|
||||
|
||||
class CAtlTransactionManager;
|
||||
class CAtlTransactionManager;
|
||||
|
||||
class CHandle {
|
||||
class CHandle {
|
||||
CHandle() throw();
|
||||
CHandle(CHandle& h) throw();
|
||||
explicit CHandle(HANDLE h) throw();
|
||||
};
|
||||
};
|
||||
|
||||
struct CAtlFile : public CHandle {
|
||||
struct CAtlFile : public CHandle {
|
||||
CAtlFile() throw();
|
||||
CAtlFile(CAtlTransactionManager* pTM) throw();
|
||||
CAtlFile(CAtlFile& file) throw();
|
||||
@@ -128,15 +131,15 @@ struct CAtlFile : public CHandle {
|
||||
LPCVOID pBuffer,
|
||||
DWORD nBufSize,
|
||||
LPOVERLAPPED pOverlapped) throw();
|
||||
};
|
||||
};
|
||||
|
||||
void test_CAtlFile() {
|
||||
void test_CAtlFile() {
|
||||
CAtlFile catFile;
|
||||
char buffer[1024];
|
||||
catFile.Read(buffer, 1024); // $ local_source
|
||||
}
|
||||
}
|
||||
|
||||
struct CAtlFileMappingBase {
|
||||
struct CAtlFileMappingBase {
|
||||
CAtlFileMappingBase(CAtlFileMappingBase& orig);
|
||||
CAtlFileMappingBase() throw();
|
||||
~CAtlFileMappingBase() throw();
|
||||
@@ -168,19 +171,19 @@ struct CAtlFileMappingBase {
|
||||
DWORD dwViewDesiredAccess) throw();
|
||||
|
||||
HRESULT Unmap() throw();
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct CAtlFileMapping : public CAtlFileMappingBase {
|
||||
template <typename T>
|
||||
struct CAtlFileMapping : public CAtlFileMappingBase {
|
||||
operator T*() const throw();
|
||||
};
|
||||
};
|
||||
|
||||
void test_CAtlFileMapping(CAtlFileMapping<char> mapping) {
|
||||
void test_CAtlFileMapping(CAtlFileMapping<char> mapping) {
|
||||
char* data = static_cast<char*>(mapping); // $ local_source
|
||||
void* data2 = mapping.GetData(); // $ local_source
|
||||
}
|
||||
}
|
||||
|
||||
struct CAtlTemporaryFile {
|
||||
struct CAtlTemporaryFile {
|
||||
CAtlTemporaryFile() throw();
|
||||
~CAtlTemporaryFile() throw();
|
||||
HRESULT Close(LPCTSTR szNewName) throw();
|
||||
@@ -207,16 +210,16 @@ struct CAtlTemporaryFile {
|
||||
DWORD nBufSize,
|
||||
DWORD* pnBytesWritten) throw();
|
||||
operator HANDLE() throw();
|
||||
};
|
||||
};
|
||||
|
||||
void test_CAtlTemporaryFile() {
|
||||
void test_CAtlTemporaryFile() {
|
||||
CAtlTemporaryFile file;
|
||||
char buffer[1024];
|
||||
DWORD bytesRead;
|
||||
file.Read(buffer, 1024, bytesRead); // $ local_source
|
||||
}
|
||||
}
|
||||
|
||||
struct CRegKey {
|
||||
struct CRegKey {
|
||||
CRegKey() throw();
|
||||
CRegKey(CRegKey& key) throw();
|
||||
explicit CRegKey(HKEY hKey) throw();
|
||||
@@ -358,9 +361,9 @@ struct CRegKey {
|
||||
CRegKey& operator= (CRegKey& key) throw();
|
||||
|
||||
HKEY m_hKey;
|
||||
};
|
||||
};
|
||||
|
||||
void test_CRegKey() {
|
||||
void test_CRegKey() {
|
||||
CRegKey key;
|
||||
char data[1024];
|
||||
ULONG bytesRead;
|
||||
@@ -386,4 +389,5 @@ void test_CRegKey() {
|
||||
|
||||
DWORD value2;
|
||||
key.QueryValue(value2, "foo"); // $ local_source
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user