November 27, 2001 fun

I am not making this up…

A friend of mine stumbled over this in the Microsoft source code:

//  Function:   RunCommandEx
//  Synopsis:   runs the given command in the current session, more robust
//				than RunCommand
//  Arguments:  none
//  Returns:    S_OK if success
//  History:    October 3, 2000 - created [name withheld to protect the guilty]
HRESULT RunCommandEx(LPCWSTR szCmdLine) {
	DWORD dwTry = 0;
	HRESULT hResult = S_OK;

	// try run command 3 times at most
	while (dwTry<4) 4="" {="" hresult="RunCommand(szCmdLine);" if="" (hresult!="E_FAIL)" we="" succeeded="" break;="" }="" dwtry++;="" (dwtry="=4)" atltrace(l"could="" start="" the="" command="" even="" tried="" times\n");="" assert(false);="" return="" hresult;="" }<="" pre="">

That's not quite my definition of robust, but oh well...

Tue 11/27/2001 3:52 PM