mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
windows create dump file on desktop
This commit is contained in:
parent
5090e95003
commit
cff3152985
1 changed files with 36 additions and 0 deletions
36
one.cpp
36
one.cpp
|
@ -30,6 +30,7 @@
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <shlobj.h>
|
||||||
#include "osdep/WindowsEthernetTap.hpp"
|
#include "osdep/WindowsEthernetTap.hpp"
|
||||||
#include "windows/ZeroTierOne/ServiceInstaller.h"
|
#include "windows/ZeroTierOne/ServiceInstaller.h"
|
||||||
#include "windows/ZeroTierOne/ServiceBase.h"
|
#include "windows/ZeroTierOne/ServiceBase.h"
|
||||||
|
@ -1076,6 +1077,41 @@ static int cli(int argc,char **argv)
|
||||||
free(addresses);
|
free(addresses);
|
||||||
addresses = NULL;
|
addresses = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char path[MAX_PATH + 1] = {};
|
||||||
|
if (SHGetFolderPathA(NULL, CSIDL_DESKTOP, NULL, 0, path) == S_OK) {
|
||||||
|
sprintf(path, "%s%szerotier_dump.txt", path, ZT_PATH_SEPARATOR_S);
|
||||||
|
fprintf(stdout, "Writing dump to: %s\n", path);
|
||||||
|
HANDLE file = CreateFileA(
|
||||||
|
path,
|
||||||
|
GENERIC_WRITE,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
CREATE_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (file == INVALID_HANDLE_VALUE) {
|
||||||
|
fprintf(stdout, "%s", dump.str().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL err = WriteFile(
|
||||||
|
file,
|
||||||
|
dump.str().c_str(),
|
||||||
|
dump.str().size(),
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (err = FALSE) {
|
||||||
|
fprintf(stderr, "Error writing file");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CloseHandle(file);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout, "%s", dump.str().c_str());
|
||||||
|
}
|
||||||
#elif defined(__LINUX__)
|
#elif defined(__LINUX__)
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
struct ifconf ifc;
|
struct ifconf ifc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue