Author: janderwald
Date: Mon Oct 8 13:01:33 2007
New Revision: 29453
URL:
http://svn.reactos.org/svn/reactos?rev=29453&view=rev
Log:
- randomize named pipe name
- remove hardcoded path in named pipe reader class
Modified:
trunk/reactos/tools/sysreg/namedpipe_reader.cpp
trunk/reactos/tools/sysreg/rosboot_test.cpp
Modified: trunk/reactos/tools/sysreg/namedpipe_reader.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/namedpipe_rea…
==============================================================================
--- trunk/reactos/tools/sysreg/namedpipe_reader.cpp (original)
+++ trunk/reactos/tools/sysreg/namedpipe_reader.cpp Mon Oct 8 13:01:33 2007
@@ -50,7 +50,7 @@
return false;
}
#ifndef __LINUX__
- h_Pipe = CreateFile("\\\\.\\pipe\\qemu", //PipeCmd.c_str(),
+ h_Pipe = CreateFile(PipeCmd.c_str(),
GENERIC_WRITE | GENERIC_READ,
0,
NULL,
@@ -139,7 +139,7 @@
long offset = 0;
size_t start_size = vect.size ();
char * start = buffer;
- buffer[cbRead] = _T('\0');
+ buffer[cbRead] = '\0';
char * end = strstr(buffer, s_LineBreak);
//cout << "extractLines entered with append_line: " <<
append_line << " cbRead: " << cbRead << "buffer: "
<< buffer << endl;
@@ -148,7 +148,7 @@
{
if (end)
{
- end[0] = _T('\0');
+ end[0] = '\0';
string line = start;
end += (sizeof(s_LineBreak) / sizeof(char));
start = end;
Modified: trunk/reactos/tools/sysreg/rosboot_test.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.…
==============================================================================
--- trunk/reactos/tools/sysreg/rosboot_test.cpp (original)
+++ trunk/reactos/tools/sysreg/rosboot_test.cpp Mon Oct 8 13:01:33 2007
@@ -27,7 +27,8 @@
#include <assert.h>
#include <math.h>
#include <signal.h>
-
+#include <io.h>
+
namespace Sysreg_
{
using std::vector;
@@ -273,7 +274,7 @@
{
string pipe;
string qemudir;
-
+ char pipename[] = "qemuXXXXXX";
if (m_MaxMem.length() == 0)
{
/* set default memory size to 64M */
@@ -281,14 +282,35 @@
}
#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";
m_DebugPort = "pipe";
#else
- pipe = "pipe:qemu";
- m_Src = "\\\\.\\pipe\\qemu";
+ if (_mktemp(pipename))
+ {
+ string temp = pipename;
+ pipe = "pipe:" + temp;
+ m_Src = "\\\\.\\pipe\\" + temp;
+ }
+ else
+ {
+ pipe = "pipe:qemu";
+ m_Src = "\\\\.\\pipe\\qemu";
+ }
m_DebugPort = "pipe";
+
if (!getQemuDir(qemudir))
{
return false;