SRCDS exit codes?

I’m trying to set up my server so that it auto-updates on certain dates, but to do that, I need to find a way to let the script doing the updating know that the server has been shut down for scheduled maintenance instead of, say, a crash. It’s mostly for logging purposes.
So I started checking the exit codes the process leaves behind, and I found this out:

If I close SRCDS with the EXIT command through the console, it returns 0.
If I close it from the Task Manager, it returns 1.
If I close it with the X button or with TASKKILL /IM SRCDS.exe, it returns -1073741510.
So there, nice and consistent.

I haven’t figured out a way to crash the server yet, but I suspect that I’d get the same exit code that I get from TASKKILL.

Is there a documentation for this?

These are kinda generic exit codes for most programs. If the program closes on its own correctly, it will return a 0. If it doesn’t, it will return some other code representing what closed it or the error that occured.

example:


//this is the main entry point for the program, the integer returned by this is the exit code
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreviousInstance,LPSTR lpcmdline,int nCmdShow)
{
	MSG msg_Message;

	HWND han_Window = NewWindow("DirectX Stuff",100,100,800,600);
	LPDIRECT3DDEVICE9 p_Device = InitializeDevice(han_Window);
	LPDIRECT3DVERTEXBUFFER9 p_dx_VB = FillVertices(han_Window, p_Device);
	LPDIRECT3DINDEXBUFFER9 p_dx_IB = FillIndices(han_Window, p_Device);
	SetUpCamera(p_Device);

	LPDIRECTINPUTDEVICE8 p_KeybDevice = InitializeKeyboard(han_Window);

	while(int_AppRunning)
	{
		if(PeekMessage(&msg_Message,han_Window,0,0,PM_REMOVE))
		{
			DispatchMessage(&msg_Message);
		}
		ReadKeyboard(p_KeybDevice);
		DrawScene(p_Device, p_dx_VB, p_dx_IB);
	}

	p_KeybDevice->Release();
	p_dx_VB->Release();
	p_dx_IB->Release();
	p_Device->Release();
	DestroyWindow(han_Window);

	return 0;//this is what happens when it closes itself successfully.
}

LimeJet? Hi.

Well yeah, obviously. I just wanted the specific codes for SRCDS.

But that doesn’t matter now, as I managed to find a Python module that talks to the server.

Hi :v: