mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 05:37:44 +00:00
- randomize named pipe name
- remove hardcoded path in named pipe reader class svn path=/trunk/; revision=29453
This commit is contained in:
parent
1d1547fcc3
commit
6cd6fc2c8c
|
@ -50,7 +50,7 @@ namespace System_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifndef __LINUX__
|
#ifndef __LINUX__
|
||||||
h_Pipe = CreateFile("\\\\.\\pipe\\qemu", //PipeCmd.c_str(),
|
h_Pipe = CreateFile(PipeCmd.c_str(),
|
||||||
GENERIC_WRITE | GENERIC_READ,
|
GENERIC_WRITE | GENERIC_READ,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -139,7 +139,7 @@ namespace System_
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
size_t start_size = vect.size ();
|
size_t start_size = vect.size ();
|
||||||
char * start = buffer;
|
char * start = buffer;
|
||||||
buffer[cbRead] = _T('\0');
|
buffer[cbRead] = '\0';
|
||||||
char * end = strstr(buffer, s_LineBreak);
|
char * end = strstr(buffer, s_LineBreak);
|
||||||
|
|
||||||
//cout << "extractLines entered with append_line: " << append_line << " cbRead: " << cbRead << "buffer: " << buffer << endl;
|
//cout << "extractLines entered with append_line: " << append_line << " cbRead: " << cbRead << "buffer: " << buffer << endl;
|
||||||
|
@ -148,7 +148,7 @@ namespace System_
|
||||||
{
|
{
|
||||||
if (end)
|
if (end)
|
||||||
{
|
{
|
||||||
end[0] = _T('\0');
|
end[0] = '\0';
|
||||||
string line = start;
|
string line = start;
|
||||||
end += (sizeof(s_LineBreak) / sizeof(char));
|
end += (sizeof(s_LineBreak) / sizeof(char));
|
||||||
start = end;
|
start = end;
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
namespace Sysreg_
|
namespace Sysreg_
|
||||||
{
|
{
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
@ -273,7 +274,7 @@ namespace Sysreg_
|
||||||
{
|
{
|
||||||
string pipe;
|
string pipe;
|
||||||
string qemudir;
|
string qemudir;
|
||||||
|
char pipename[] = "qemuXXXXXX";
|
||||||
if (m_MaxMem.length() == 0)
|
if (m_MaxMem.length() == 0)
|
||||||
{
|
{
|
||||||
/* set default memory size to 64M */
|
/* set default memory size to 64M */
|
||||||
|
@ -281,14 +282,35 @@ namespace Sysreg_
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
pipe = "pipe:/tmp/qemu";
|
|
||||||
m_Src = "/tmp/qemu";
|
if (_mktemp(pipename))
|
||||||
|
{
|
||||||
|
string temp = pipename;
|
||||||
|
m_Src = "/tmp/" + temp;
|
||||||
|
pipe = "pipe:" + m_Src;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pipe = "pipe:/tmp/qemu";
|
||||||
|
m_Src = "/tmp/qemu";
|
||||||
|
}
|
||||||
|
|
||||||
qemudir = "/usr/share/qemu";
|
qemudir = "/usr/share/qemu";
|
||||||
m_DebugPort = "pipe";
|
m_DebugPort = "pipe";
|
||||||
#else
|
#else
|
||||||
pipe = "pipe:qemu";
|
if (_mktemp(pipename))
|
||||||
m_Src = "\\\\.\\pipe\\qemu";
|
{
|
||||||
|
string temp = pipename;
|
||||||
|
pipe = "pipe:" + temp;
|
||||||
|
m_Src = "\\\\.\\pipe\\" + temp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pipe = "pipe:qemu";
|
||||||
|
m_Src = "\\\\.\\pipe\\qemu";
|
||||||
|
}
|
||||||
m_DebugPort = "pipe";
|
m_DebugPort = "pipe";
|
||||||
|
|
||||||
if (!getQemuDir(qemudir))
|
if (!getQemuDir(qemudir))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue