aboutsummaryrefslogtreecommitdiff
path: root/src/tool_main.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2018-11-01 02:50:40 -0400
committerJay Satiro <raysatiro@yahoo.com>2018-11-06 03:15:44 -0500
commit397664a065abffb7c3445ca9086f917e13719d1f (patch)
tree0767418d916c3c3eee605e36f48ad8233e2672ad /src/tool_main.c
parent28429fb1753d63a659f38577b39e0b5747f28939 (diff)
tool: add undocumented option --dump-module-paths for win32
- Add an undocumented diagnostic option for Windows to show the full paths of all loaded modules regardless of whether or not libcurl initialization succeeds. This is needed so that in the CI we can get a list of all DLL dependencies after initialization (when they're most likely to have finished loading) and then package them as artifacts so that a functioning build can be downloaded. Also I imagine it may have some use as a diagnostic for help requests. Ref: https://github.com/curl/curl/pull/3103 Closes https://github.com/curl/curl/pull/3208
Diffstat (limited to 'src/tool_main.c')
-rw-r--r--src/tool_main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tool_main.c b/src/tool_main.c
index 6dc74d923..3089ee37f 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -38,6 +38,7 @@
#include "tool_cfgable.h"
#include "tool_convert.h"
+#include "tool_doswin.h"
#include "tool_msgs.h"
#include "tool_operate.h"
#include "tool_panykey.h"
@@ -305,6 +306,21 @@ int main(int argc, char *argv[])
/* Initialize the curl library - do not call any libcurl functions before
this point */
result = main_init(&global);
+
+#ifdef WIN32
+ /* Undocumented diagnostic option to list the full paths of all loaded
+ modules, regardless of whether or not initialization succeeded. */
+ if(argc == 2 && !strcmp(argv[1], "--dump-module-paths")) {
+ struct curl_slist *item, *head = GetLoadedModulePaths();
+ for(item = head; item; item = item->next) {
+ printf("%s\n", item->data);
+ }
+ curl_slist_free_all(head);
+ if(!result)
+ main_free(&global);
+ }
+ else
+#endif /* WIN32 */
if(!result) {
/* Start our curl operation */
result = operate(&global, argc, argv);