예제 #1
0
static boolean getcmdshell (Handle *hshell) {

	/*
	2006-03-09 aradke: return name or path of command shell in hshell.
		check the COMSPEC environment variable first. if it does not exist, resort
		to guessing the name of the shell based on the current OS version.
		caller is responsible for disposing the handle if we return true.
	*/
	
	OSVERSIONINFO osinfo;
	bigstring bs;
	
	if (getenvironmentvariable ("COMSPEC", false, hshell))
		return (true);

	osinfo.dwOSVersionInfoSize = sizeof (osinfo);
		
	if (GetVersionEx (&osinfo) == nil) {
		winerror ();
		return (false);
		}

	if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
		copystring ("\x0b" "command.com", bs); /*Win95/98/ME: actual DOS command interpreter*/
		}
	else {
		copystring ("\x07" "cmd.exe", bs); /*WinNT and successors: DOS emulation*/
		}

	return (newtexthandle (bs, hshell));
	} /*getcmdshell*/
예제 #2
0
ThreadFunction::ThreadFunction()
{
	maxWorkerThreads = 0;

	boost::optional<std::string> v = getenvironmentvariable("CCFINDERX_MAX_WORKER_THREADS");
	if (v) {
		try {
			maxWorkerThreads = boost::lexical_cast<int>(*v);
		}
		catch (boost::bad_lexical_cast &) {
			// just neglect it.
		}
	}
}
예제 #3
0
static boolean searchcmdpath (Handle *hshell) {

	/*
	2006-03-09 aradke: get the PATH environment variable and parse it.
		see if the command shell is located in any of the directories.
		caller is responsible for disposing hshell.
	*/
	
	Handle hpath = nil;
	Handle h = nil;
	long ix = 0;

	/*obtain path environment variable*/

	if (!getenvironmentvariable ("PATH", true, &hpath))
		return (false);
	
	/*parse path*/
	
	while (getnextpath (hpath, &ix, &h)) {
		
		if (!pushhandle (*hshell, h))
			goto exit;

		if (!pushcharhandle (CHNULL, h))
			goto exit;
		
		if (cmdshellexists (h)) {
			disposehandle (*hshell);
			*hshell = h;
			return (true);
			}

		disposehandle (h);
		}/*while*/
	
	cmdnotfounderror (*hshell);
	
exit:
	disposehandle (hpath);
	
	return (false);
	} /*searchcmdpath*/