fixed: error when installing, The parameter is incorrect.
This commit is contained in:
parent
d339d60d69
commit
469a263356
|
@ -21,6 +21,7 @@
|
||||||
#include "CArchMiscWindows.h"
|
#include "CArchMiscWindows.h"
|
||||||
#include "XArchWindows.h"
|
#include "XArchWindows.h"
|
||||||
#include "stdvector.h"
|
#include "stdvector.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
//
|
//
|
||||||
// CArchDaemonWindows
|
// CArchDaemonWindows
|
||||||
|
@ -817,22 +818,15 @@ CArchDaemonWindows::installDaemon()
|
||||||
// install default daemon if not already installed.
|
// install default daemon if not already installed.
|
||||||
if (!isDaemonInstalled(DEFAULT_DAEMON_NAME, true)) {
|
if (!isDaemonInstalled(DEFAULT_DAEMON_NAME, true)) {
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
GetModuleFileName(CArchMiscWindows::instanceWin32(), &path[1], MAX_PATH - 2);
|
GetModuleFileName(CArchMiscWindows::instanceWin32(), path, MAX_PATH);
|
||||||
|
|
||||||
int length = 0;
|
|
||||||
for (int i = 0; i < MAX_PATH; i++) {
|
|
||||||
if (path[i] == '\0') {
|
|
||||||
length = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// wrap in quotes so a malicious user can't start \Program.exe as admin.
|
// wrap in quotes so a malicious user can't start \Program.exe as admin.
|
||||||
path[0] = '"';
|
std::stringstream ss;
|
||||||
path[length] = '"';
|
ss << '"';
|
||||||
path[length + 1] = '\0';
|
ss << path;
|
||||||
|
ss << '"';
|
||||||
|
|
||||||
installDaemon(DEFAULT_DAEMON_NAME, DEFAULT_DAEMON_INFO, path, "", "", true);
|
installDaemon(DEFAULT_DAEMON_NAME, DEFAULT_DAEMON_INFO, ss.str().c_str(), "", "", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
start(DEFAULT_DAEMON_NAME);
|
start(DEFAULT_DAEMON_NAME);
|
||||||
|
|
Loading…
Reference in New Issue