Skip to content

Commit b608567

Browse files
committed
Add CLI and export functionality to WinDepends
Introduces a command-line interface (CLI) handler (CCliHandler.cs) and export functionality (CExporter.cs) supporting multiple formats (JSON, CSV, HTML, DOT, text). Updates README with CLI documentation and usage examples. Minor code and designer cleanups in utility and form files to support new features.
1 parent 059b50b commit b608567

File tree

11 files changed

+1681
-149
lines changed

11 files changed

+1681
-149
lines changed

README.md

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,144 @@ WinDepends is a rewrite of the [Dependency Walker](https://www.dependencywalker.
3333
* Supports C++ function name undecorating to provide human readable C++ function prototypes including function names, return types, and parameter types.
3434
* Save/restore sessions to/from files.
3535
* Client-server architecture: Client (WinForms .NET app) provides the GUI; server (C application) handles PE parsing.
36+
* Command-line interface (CLI) for automation and scripting with multiple export formats.
3637

3738
### Missing features / Known issues
3839

3940
* Current state: **BETA**. Some Dependency Walker features are unimplemented (e.g., profiling).
4041
* MDI GUI discontinued; launch multiple instances to analyze multiple files.
4142
* Some functionality may not work as expected or be disabled in beta.
42-
* CLI version not yet implemented (and unlikely will be).
4343
* ARM binaries untested in native environments (lack of bare-metal hardware).
4444
* Some limitations stem from Windows OS support.
4545
* Found a bug? Have suggestions? Submit issues or pull requests! We appreciate your input!
4646

4747
# Installation and Usage
4848

4949
The WinDepends compiled binaries include:
50-
+ WinDepends.exe: Main GUI (client)
50+
+ WinDepends.exe: Main GUI (client) and CLI
5151
+ WinDepends.Core.exe: Server (launched by the client)
5252
+ PDB files for both
5353

5454
They can be found in the Release section of this repository.
5555

5656
No installation required. Copy the folder, run WinDepends.exe. To uninstall, close the client/server and delete files.
5757

58+
# Command-Line Interface (CLI)
59+
60+
WinDepends supports a command-line interface for automation, scripting, and integration with other tools. The CLI mode is automatically activated when specific command-line switches are detected.
61+
62+
### Basic Usage
63+
64+
```
65+
WinDepends.exe <input-file> [options]
66+
```
67+
68+
### Command-Line Options
69+
70+
| Option | Description |
71+
|--------|-------------|
72+
| `-o, --output <file>` | Output file path (default: input file with format extension) |
73+
| `-f, --format <format>` | Output format: json, csv, html, dot, text (default: json) |
74+
| `-d, --depth <n>` | Maximum dependency depth (default: from configuration) |
75+
| `-q, --quiet` | Suppress console output |
76+
| `-e, --exports` | Include export information (default: on) |
77+
| `--no-exports` | Exclude export information |
78+
| `-i, --imports` | Include import information (default: on) |
79+
| `--no-imports` | Exclude import information |
80+
| `--no-resolve` | Don't resolve API set names (default: from configuration) |
81+
| `-k, --kernel` | Use kernel-mode search order |
82+
| `--short-paths` | Use short file names instead of full paths (default: from configuration) |
83+
| `-h, --help` | Show help message |
84+
| `-v, --version` | Show version information |
85+
86+
**Note:** Many default values are read from the program configuration file. Use the GUI to configure these settings.
87+
88+
### Export Formats
89+
90+
| Format | Description |
91+
|--------|-------------|
92+
| `json` | Full structured JSON data with all module information |
93+
| `csv` | Flat module list as comma-separated values |
94+
| `html` | Interactive HTML report with collapsible dependency tree |
95+
| `dot` | Graphviz DOT format for graph visualization |
96+
| `text` | Plain text tree output |
97+
98+
### Examples
99+
100+
#### Basic JSON Export
101+
```cmd
102+
WinDepends.exe C:\Windows\System32\notepad.exe -o notepad.json -f json
103+
```
104+
105+
#### HTML Report
106+
```cmd
107+
WinDepends.exe myapp.exe -o report.html -f html
108+
```
109+
110+
#### Kernel-Mode Driver Analysis
111+
```cmd
112+
WinDepends.exe C:\Windows\System32\ntoskrnl.exe -o ntoskrnl.json -f json -k
113+
```
114+
115+
#### Graphviz DOT Export
116+
```cmd
117+
WinDepends.exe module.dll -f dot -o dependencies.dot
118+
```
119+
To generate an image from DOT file:
120+
```cmd
121+
dot -Tpng dependencies.dot -o dependencies.png
122+
```
123+
124+
#### Quiet Mode (No Console Output)
125+
```cmd
126+
WinDepends.exe myapp.exe -o report.json -f json -q
127+
```
128+
129+
#### Limited Depth Analysis
130+
```cmd
131+
WinDepends.exe myapp.exe -o report.json -f json -d 3
132+
```
133+
134+
#### Export Without Function Data
135+
```cmd
136+
WinDepends.exe myapp.exe -o report.json -f json --no-exports --no-imports
137+
```
138+
139+
#### Short Paths (File Names Only)
140+
```cmd
141+
WinDepends.exe myapp.exe -o report.html -f html --short-paths
142+
```
143+
144+
#### Combined Options
145+
```cmd
146+
WinDepends.exe C:\Windows\System32\ntoskrnl.exe -o ntoskrnl.html -f html -k -d 5 --short-paths
147+
```
148+
149+
### CLI Output
150+
151+
When not in quiet mode, the CLI displays progress information:
152+
153+
```
154+
WinDepends CLI v1.0.0.2511
155+
Analyzing: C:\Windows\System32\notepad.exe
156+
[*] Server has been started: WDEP/1.0 WinDepends.Core
157+
Processing dependencies...
158+
[1] Analyzing: ntdll.dll
159+
[2] Analyzing: kernel32.dll
160+
[3] Analyzing: kernelbase.dll
161+
...
162+
Exporting to Html: notepad.html
163+
Export completed successfully.
164+
```
165+
166+
### GUI Mode
167+
168+
When no CLI-specific switches are provided, WinDepends runs in GUI mode. You can still pass a file path to open it directly:
169+
170+
```cmd
171+
WinDepends.exe C:\Windows\System32\notepad.exe
172+
```
173+
58174
# Documentation and Help
59175

60176
* https://github.com/hfiref0x/WinDepends.Docs

0 commit comments

Comments
 (0)