summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorburlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-11 20:35:28 +0000
committerburlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-11 20:35:28 +0000
commit9a9a39c9782737f503db220d0a71659d227fc106 (patch)
tree2b63ea5f5ee92675d85f24adb078ea6a2ded8db7 /src/inspircd.cpp
parent895c3dcdf043b8f36219b228c36612282be602b0 (diff)
- Added more debug output to windows fork in order to help debug problems encountered.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7270 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index dee4ece10..3fed0470f 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -58,7 +58,10 @@ DWORD WindowsForkStart(InspIRCd * Instance)
char module[MAX_PATH];
if(!GetModuleFileName(NULL, module, MAX_PATH))
+ {
+ printf("GetModuleFileName() failed.\n");
return false;
+ }
STARTUPINFO startupinfo;
PROCESS_INFORMATION procinfo;
@@ -81,13 +84,19 @@ DWORD WindowsForkStart(InspIRCd * Instance)
&procinfo); // process info
if(!bSuccess)
+ {
+ printf("CreateProcess() failed.\n");
return false;
+ }
// Set the owner process id in the target process.
SIZE_T written = 0;
DWORD pid = GetCurrentProcessId();
if(!WriteProcessMemory(procinfo.hProcess, &owner_processid, &pid, sizeof(DWORD), &written) || written != sizeof(DWORD))
+ {
+ printf("WriteProcessMemory() failed.\n");
return false;
+ }
// Resume the other thread (let it start)
ResumeThread(procinfo.hThread);
@@ -98,6 +107,7 @@ DWORD WindowsForkStart(InspIRCd * Instance)
// If we hit this it means startup failed, default to 14 if this fails.
DWORD ExitCode = 14;
GetExitCodeProcess(procinfo.hProcess, &ExitCode);
+ printf("Startup failed, exitcode was %u.\n", ExitCode);
CloseHandle(procinfo.hThread);
CloseHandle(procinfo.hProcess);
return ExitCode;
@@ -107,11 +117,17 @@ void WindowsForkKillOwner(InspIRCd * Instance)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, owner_processid);
if(!hProcess || !owner_processid)
+ {
+ printf("Could not open process id %u.\n", owner_processid);
Instance->Exit(14);
+ }
// die die die
if(!TerminateProcess(hProcess, 0))
+ {
+ printf("Could not TerminateProcess().\n");
Instance->Exit(14);
+ }
CloseHandle(hProcess);
}