|
| 1 | +private import semmle.code.cpp.models.interfaces.CommandExecution |
| 2 | + |
| 3 | +/** The `ShellExecute` family of functions from Win32. */ |
| 4 | +class ShellExecute extends Function { |
| 5 | + ShellExecute() { this.hasGlobalName("ShellExecute" + ["", "A", "W"]) } |
| 6 | +} |
| 7 | + |
| 8 | +private class ShellExecuteModel extends ShellExecute, CommandExecutionFunction { |
| 9 | + override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(2) } |
| 10 | +} |
| 11 | + |
| 12 | +/** The `WinExec` function from Win32. */ |
| 13 | +class WinExec extends Function { |
| 14 | + WinExec() { this.hasGlobalName("WinExec") } |
| 15 | +} |
| 16 | + |
| 17 | +private class WinExecModel extends WinExec, CommandExecutionFunction { |
| 18 | + override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(0) } |
| 19 | +} |
| 20 | + |
| 21 | +/** The `CreateProcess` family of functions from Win32. */ |
| 22 | +class CreateProcess extends Function { |
| 23 | + CreateProcess() { this.hasGlobalName("CreateProcess" + ["", "A", "W"]) } |
| 24 | +} |
| 25 | + |
| 26 | +private class CreateProcessModel extends CreateProcess, CommandExecutionFunction { |
| 27 | + override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(0) } |
| 28 | +} |
| 29 | + |
| 30 | +/** The `CreateProcessAsUser` family of functions from Win32. */ |
| 31 | +class CreateProcessAsUser extends Function { |
| 32 | + CreateProcessAsUser() { this.hasGlobalName("CreateProcessAsUser" + ["", "A", "W"]) } |
| 33 | +} |
| 34 | + |
| 35 | +private class CreateProcessAsUserModel extends CreateProcessAsUser, CommandExecutionFunction { |
| 36 | + override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(1) } |
| 37 | +} |
| 38 | + |
| 39 | +/** The `CreateProcessWithLogonW` function from Win32. */ |
| 40 | +class CreateProcessWithLogonW extends Function { |
| 41 | + CreateProcessWithLogonW() { this.hasGlobalName("CreateProcessWithLogonW") } |
| 42 | +} |
| 43 | + |
| 44 | +private class CreateProcessWithLogonModel extends CreateProcessWithLogonW, CommandExecutionFunction { |
| 45 | + override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(4) } |
| 46 | +} |
| 47 | + |
| 48 | +/** The `CreateProcessWithTokenW` function from Win32. */ |
| 49 | +class CreateProcessWithTokenW extends Function { |
| 50 | + CreateProcessWithTokenW() { this.hasGlobalName("CreateProcessWithTokenW") } |
| 51 | +} |
| 52 | + |
| 53 | +private class CreateProcessWithTokenWModel extends CreateProcessWithTokenW, CommandExecutionFunction |
| 54 | +{ |
| 55 | + override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(2) } |
| 56 | +} |
0 commit comments