Skip to content

C++: Address comments from earlier Windows MaD PRs #19599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/ql/lib/ext/Boost.Asio.model.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# partial model of the Boost::Asio network library
# partial model of the Boost::Asio network library
extensions:
- addsTo:
pack: codeql/cpp-all
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/lib/ext/Windows.model.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# partial model of windows system calls
# partial model of windows system calls
extensions:
- addsTo:
pack: codeql/cpp-all
Expand Down
276 changes: 138 additions & 138 deletions cpp/ql/test/library-tests/dataflow/external-models/flow.expected

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
| asio_streams.cpp:87:34:87:44 | read_until output argument | remote |
| test.cpp:10:10:10:18 | call to ymlSource | local |
| windows.cpp:11:15:11:29 | *call to GetCommandLineA | local |
| windows.cpp:23:17:23:38 | *call to GetEnvironmentStringsA | local |
| windows.cpp:28:36:28:38 | GetEnvironmentVariableA output argument | local |
| windows.cpp:164:35:164:40 | ReadFile output argument | local |
| windows.cpp:173:23:173:28 | ReadFileEx output argument | local |
| windows.cpp:185:21:185:26 | ReadFile output argument | local |
| windows.cpp:188:23:188:29 | ReadFileEx output argument | local |
| windows.cpp:194:21:194:26 | ReadFile output argument | local |
| windows.cpp:197:23:197:29 | ReadFileEx output argument | local |
| windows.cpp:205:84:205:89 | NtReadFile output argument | local |
| windows.cpp:282:23:282:35 | *call to MapViewOfFile | local |
| windows.cpp:289:23:289:36 | *call to MapViewOfFile2 | local |
| windows.cpp:298:23:298:36 | *call to MapViewOfFile3 | local |
| windows.cpp:307:23:307:43 | *call to MapViewOfFile3FromApp | local |
| windows.cpp:314:23:314:37 | *call to MapViewOfFileEx | local |
| windows.cpp:321:23:321:42 | *call to MapViewOfFileFromApp | local |
| windows.cpp:328:23:328:40 | *call to MapViewOfFileNuma2 | local |
| windows.cpp:22:15:22:29 | *call to GetCommandLineA | local |
| windows.cpp:34:17:34:38 | *call to GetEnvironmentStringsA | local |
| windows.cpp:39:36:39:38 | GetEnvironmentVariableA output argument | local |
| windows.cpp:168:35:168:40 | ReadFile output argument | local |
| windows.cpp:177:23:177:28 | ReadFileEx output argument | local |
| windows.cpp:189:21:189:26 | ReadFile output argument | local |
| windows.cpp:192:23:192:29 | ReadFileEx output argument | local |
| windows.cpp:198:21:198:26 | ReadFile output argument | local |
| windows.cpp:201:23:201:29 | ReadFileEx output argument | local |
| windows.cpp:209:84:209:89 | NtReadFile output argument | local |
| windows.cpp:286:23:286:35 | *call to MapViewOfFile | local |
| windows.cpp:293:23:293:36 | *call to MapViewOfFile2 | local |
| windows.cpp:302:23:302:36 | *call to MapViewOfFile3 | local |
| windows.cpp:311:23:311:43 | *call to MapViewOfFile3FromApp | local |
| windows.cpp:318:23:318:37 | *call to MapViewOfFileEx | local |
| windows.cpp:325:23:325:42 | *call to MapViewOfFileFromApp | local |
| windows.cpp:332:23:332:40 | *call to MapViewOfFileNuma2 | local |
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
| test.cpp:28:35:28:35 | 0 | test.cpp:28:11:28:33 | call to ymlStepManual_with_body |
| test.cpp:32:38:32:38 | 0 | test.cpp:32:11:32:36 | call to ymlStepGenerated_with_body |
| test.cpp:35:38:35:38 | x | test.cpp:35:11:35:36 | call to ymlStepGenerated_with_body |
| windows.cpp:16:36:16:38 | *cmd | windows.cpp:16:17:16:34 | **call to CommandLineToArgvA |
| windows.cpp:27:36:27:38 | *cmd | windows.cpp:27:17:27:34 | **call to CommandLineToArgvA |
26 changes: 15 additions & 11 deletions cpp/ql/test/library-tests/dataflow/external-models/windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@ void sink(char);
void sink(char*);
void sink(char**);

char* GetCommandLineA();
char** CommandLineToArgvA(char*, int*);
char* GetEnvironmentStringsA();
int GetEnvironmentVariableA(const char*, char*, int);
using HANDLE = void*;
using DWORD = unsigned long;
using LPCH = char*;
using LPSTR = char*;
using LPCSTR = const char*;
using LPVOID = void*;
using LPDWORD = unsigned long*;
using PVOID = void*;
using ULONG_PTR = unsigned long*;
using SIZE_T = decltype(sizeof(0));

LPSTR GetCommandLineA();
LPSTR* CommandLineToArgvA(LPSTR, int*);
LPCH GetEnvironmentStringsA();
DWORD GetEnvironmentVariableA(LPCSTR, LPSTR, DWORD);

void getCommandLine() {
char* cmd = GetCommandLineA();
Expand All @@ -30,13 +41,6 @@ void getEnvironment() {
sink(*buf); // $ ir
}

using HANDLE = void*;
using DWORD = unsigned long;
using LPVOID = void*;
using LPDWORD = unsigned long*;
using PVOID = void*;
using ULONG_PTR = unsigned long*;
using SIZE_T = decltype(sizeof(0));
typedef struct _OVERLAPPED {
ULONG_PTR Internal;
ULONG_PTR InternalHigh;
Expand Down
Loading