Author: cfinck
Date: Fri Mar 14 19:44:07 2008
New Revision: 32688
URL:
http://svn.reactos.org/svn/reactos?rev=3D32688&view=3Drev
Log:
Aaand yet another one, including fixed indentation for the whole file
(sorry for the commit spam, but I'm trying to solve the building problems o=
f a user over IRC :D)
Modified:
trunk/reactos/tools/sysreg/os_support.cpp
Modified: trunk/reactos/tools/sysreg/os_support.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/os_suppo=
rt.cpp?rev=3D32688&r1=3D32687&r2=3D32688&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/sysreg/os_support.cpp (original)
+++ trunk/reactos/tools/sysreg/os_support.cpp Fri Mar 14 19:44:07 2008
@@ -8,6 +8,7 @@
*/
=
#include "os_support.h"
+#include <cstdlib>
=
namespace System_
{
@@ -19,7 +20,7 @@
void OsSupport::checkAlarms()
{
struct timeval tm;
- size_t i;
+ size_t i;
#if 0
// gettimeofday(&tm, 0);
#endif
@@ -109,33 +110,33 @@
return 0;
}
#endif
- bool OsSupport::terminateProcess(OsSupport::ProcessID pid, int exitcode)
- {
- HANDLE hProcess =3D OpenProcess(PROCESS_TERMINATE, FALSE, pid);
- if (!hProcess)
- {
- return false;
- }
-
- bool ret =3D TerminateProcess(hProcess, exitcode);
- CloseHandle(hProcess);
- return ret;
- }
-
- OsSupport::ProcessID OsSupport::createProcess(const char *procname, int p=
rocargsnum, const char **procargs, bool wait)
- {
- STARTUPINFO siStartInfo;
- PROCESS_INFORMATION piProcInfo;
- OsSupport::ProcessID pid;
+ bool OsSupport::terminateProcess(OsSupport::ProcessID pid, int exitcod=
e)
+ {
+ HANDLE hProcess =3D OpenProcess(PROCESS_TERMINATE, FALSE, pid);
+ if (!hProcess)
+ {
+ return false;
+ }
+
+ bool ret =3D TerminateProcess(hProcess, exitcode);
+ CloseHandle(hProcess);
+ return ret;
+ }
+
+ OsSupport::ProcessID OsSupport::createProcess(const char *procname, in=
t procargsnum, const char **procargs, bool wait)
+ {
+ STARTUPINFO siStartInfo;
+ PROCESS_INFORMATION piProcInfo;
+ OsSupport::ProcessID pid;
DWORD length =3D 0;
char * szBuffer;
char * cmd;
- ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
- ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
-
- siStartInfo.cb =3D sizeof(STARTUPINFO);
- siStartInfo.wShowWindow =3D SW_SHOWNORMAL;
- siStartInfo.dwFlags =3D STARTF_USESHOWWINDOW;
+ ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
+ ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
+
+ siStartInfo.cb =3D sizeof(STARTUPINFO);
+ siStartInfo.wShowWindow =3D SW_SHOWNORMAL;
+ siStartInfo.dwFlags =3D STARTF_USESHOWWINDOW;
=
if (procargsnum)
{
@@ -173,27 +174,27 @@
cmd =3D _strdup(procname);
=
}
- if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, =
NULL, NULL, &siStartInfo, &piProcInfo))
- {
+ if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, NORMAL_PRIORITY_C=
LASS, NULL, NULL, &siStartInfo, &piProcInfo))
+ {
cerr << "Error: CreateProcess failed " << cmd <<
endl;
- pid =3D 0;
- }
- else
- {
- pid =3D piProcInfo.dwProcessId;
+ pid =3D 0;
+ }
+ else
+ {
+ pid =3D piProcInfo.dwProcessId;
if (wait)
{
WaitForSingleObject(piProcInfo.hThread, INFINITE);
}
- CloseHandle(piProcInfo.hProcess);
- CloseHandle(piProcInfo.hThread);
- }
- free(cmd);
- return pid;
- }
- void OsSupport::delayExecution(long value)
- {
- Sleep(value * 1000);
+ CloseHandle(piProcInfo.hProcess);
+ CloseHandle(piProcInfo.hThread);
+ }
+ free(cmd);
+ return pid;
+ }
+ void OsSupport::delayExecution(long value)
+ {
+ Sleep(value * 1000);
}
=
DWORD WINAPI AlarmThread(LPVOID param)
@@ -243,23 +244,23 @@
/*************************************************************************=
*******************************************/
=
=
- struct sigaction OsSupport::s_sact;
-
-
- OsSupport::ProcessID OsSupport::createProcess(const char *procname, int p=
rocargsnum, const char **procargs, bool bWait)
- {
- ProcessID pid;
-
- if ((pid =3D fork()) < 0)
- {
- cerr << "OsSupport::createProcess> fork failed" << endl;
- return 0;
- }
- if (pid =3D=3D 0)
- {
- execv(procname, (char* const*)procargs);
- return 0;
- }
+ struct sigaction OsSupport::s_sact;
+
+
+ OsSupport::ProcessID OsSupport::createProcess(const char *procname, in=
t procargsnum, const char **procargs, bool bWait)
+ {
+ ProcessID pid;
+
+ if ((pid =3D fork()) < 0)
+ {
+ cerr << "OsSupport::createProcess> fork failed" <<
endl;
+ return 0;
+ }
+ if (pid =3D=3D 0)
+ {
+ execv(procname, (char* const*)procargs);
+ return 0;
+ }
else
{
/* parent process */
@@ -268,14 +269,14 @@
waitpid(pid, NULL, 0);
}
}
- return pid;
- }
-
- bool OsSupport::terminateProcess(OsSupport::ProcessID pid, int exitcode)
- {
- kill(pid, SIGKILL);
- return true;
- }
+ return pid;
+ }
+
+ bool OsSupport::terminateProcess(OsSupport::ProcessID pid, int exitcod=
e)
+ {
+ kill(pid, SIGKILL);
+ return true;
+ }
=
void OsSupport::delayExecution(long value)
{