Example #1
0
void CHttpRequest::ProcessOneLine(const CString& Line){
  int sPos = Line.Pos(':');
  if (sPos > 0) {
    RHeaderResponse.set_value(Line.Copy(0, sPos), Line.Copy(sPos+1, Line.StrLength()).StrTrim());
#ifdef _U_DEBUG
    cout << "CHTTPREQUEST::Header:[" << Line.Copy(0, sPos) << "]:[" << Line.Copy(sPos+1, Line.StrLength()).StrTrim() << "]" << endl;
#endif
  } else {
#ifdef _U_DEBUG
    cout << "CHTTPREQUEST::Header (???):[" << Line << "]" << endl;
#endif
  }
}
Example #2
0
CString CMail::MPDomainLiteral(const CString& iStr, int& curPos){
  /*
    domain-literal =  "[" *(dtext / quoted-pair) "]"
    */

#ifdef M_DEBUG
  cout << "MPDomainLiteral() - " << curPos << endl;
#endif

  if (curPos < iStr.StrLength()) {        
    int workingPos = curPos;
    if (iStr[workingPos] == '[') {            
      workingPos++;
      while (workingPos < iStr.StrLength()) {
	if (MPDtext(iStr, workingPos)) workingPos++;
	else if (MPQuotedPair(iStr, workingPos)) workingPos++;
	else break;	
      }
      if (iStr[workingPos] == ']') {
	CString Result = iStr.Copy(curPos, workingPos - curPos);
	curPos = workingPos+1;
	return Result;
      } else return "";
    } else return "";
  } else return "";
}
Example #3
0
void ShellFunctions::StrRetToStr(STRRET& strret,LPITEMIDLIST lpiil,CString& sString)
{
	switch (strret.uType)
	{
	case STRRET_OFFSET:
		sString.Copy((LPSTR)((LPBYTE)lpiil+strret.uOffset));
		break;
	case STRRET_CSTR:
		sString.Copy(strret.cStr);
		break;
	case STRRET_WSTR:
		sString.Copy(strret.pOleStr);
		CoTaskMemFree(strret.pOleStr);
		break;
	}	
}
Example #4
0
BOOL ShellFunctions::RunRegistryCommand(HKEY hKey,LPCSTR szFile)
{
	PROCESS_INFORMATION pi;
	STARTUPINFO si;
	CRegKey CommandKey;
	CString ExecuteStr;
	CString CommandLine;
	int i;

	if (CommandKey.OpenKey(hKey,"command",CRegKey::openExist|CRegKey::samAll)!=ERROR_SUCCESS)
		return FALSE;
	if (CommandKey.QueryValue(szEmpty,ExecuteStr)<2)
		return FALSE;
	i=ExecuteStr.FindFirst('%');
	while (i!=-1)
	{
		if (ExecuteStr[i+1]=='1')
		{
			CommandLine.Copy(ExecuteStr,i);
			CommandLine<<szFile;
			CommandLine<<((LPCSTR)ExecuteStr+i+2);
			break;
		}
		i=ExecuteStr.FindNext('%',i);
	}
	if (i==-1)
		CommandLine=ExecuteStr;
	if (!ExpandEnvironmentStrings(CommandLine,ExecuteStr.GetBuffer(1000),1000))
		ExecuteStr.Swap(CommandLine);
	si.cb=sizeof(STARTUPINFO);
	si.lpReserved=NULL;
	si.cbReserved2=0;
	si.lpReserved2=NULL;
	si.lpDesktop=NULL;
	si.lpTitle=NULL;
	si.dwFlags=STARTF_USESHOWWINDOW;
	si.wShowWindow=SW_SHOWDEFAULT;
	if (!CreateProcess(NULL,ExecuteStr.GetBuffer(),NULL,
		NULL,FALSE,CREATE_DEFAULT_ERROR_MODE|NORMAL_PRIORITY_CLASS,
		NULL,NULL,&si,&pi))
	{
		CommandKey.CloseKey();
		return FALSE;
	}
	CloseHandle(pi.hThread);
	CloseHandle(pi.hProcess);
	CommandKey.CloseKey();
	return TRUE;
}
Example #5
0
void SysErrorMessage(CString& str,DWORD dwSystemError)
{
	LPVOID lpMsgBuf;
	FormatMessage( 
		FORMAT_MESSAGE_ALLOCATE_BUFFER | 
		FORMAT_MESSAGE_FROM_SYSTEM | 
		FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		dwSystemError,
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
		(LPTSTR) &lpMsgBuf,
		0,
		NULL 
	);
	str.Copy(LPCSTR(lpMsgBuf));
	LocalFree( lpMsgBuf );
}
Example #6
0
void ext_param::traverse_cline_internal(cgiOutStream& CGIStream, const CString& arg){
	if (arg == "equiv") output_current_equivs(CGIStream);
	else if (arg == "nocache") entry_manager::set_value("CACHED", "0");
	else if (arg == "admin") output_current_admins(CGIStream);
	else if (arg.StartsWith("access")) {
		CString passwd = arg.Copy(strlen("access"), arg.StrLength());
		if (check_root_access(passwd)) cgi_error(CGIStream, "access denied");
		output_current_access(CGIStream);
	} else if (arg == "version") {
		CGIStream << "(" << __DATE__ ") Daniel Doubrovkine - University of Geneva" << elf;
		CGIStream << "&copy; Vestris Inc. - 1994-1998 - All Rights Reserved" << elf;
	}
	else if (arg == "environ") {
#ifdef ANSI
		extern char **environ;
		char ** _environ = environ;
#endif
		int i=0; while (_environ[i]) CGIStream << _environ[i++]<<elf;
	}
}
Example #7
0
void CSymbolTable::CopyHandler (CObject *pOriginal)

//	CopyHandler
//
//	If we own the objects in the array, we need to make copies
//	of the objects also

	{
	int i;

	for (i = 0; i < GetCount(); i++)
		{
		//	Get the key and value

		int iKey, iValue;
		GetEntry(i, &iKey, &iValue);

		//	Convert to the appropriate thing

		CString *pKey = (CString *)iKey;
		CObject *pValue = (CObject *)iValue;

		//	Bump the ref-count on the string

		CString *pNewKey = (CString *)pKey->Copy();

		//	If we own the object then make a copy too

		CObject *pNewValue;
		if (m_bOwned)
			pNewValue = pValue->Copy();
		else
			pNewValue = pValue;

		//	Stuff the new values (we don't need to free the previous
		//	values since they are kept by the original).

		SetEntry(i, (int)pNewKey, (int)pNewValue);
		}
	}
Example #8
0
CString CMail::MPQuotedString(const CString& iStr, int& curPos){  
  /*
    quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or quoted chars.
    */

#ifdef M_DEBUG
  cout << "MPQuotedString() - " << curPos << endl;
#endif
  if (curPos < iStr.StrLength()) {
    if (iStr[curPos] == '\"'){
      int workingPos = curPos+1;   
      while (workingPos < iStr.StrLength()){
	if (!MPQText(iStr, workingPos))
	  if (!MPQuotedPair(iStr, workingPos)) 
	    break;
      }
      if (iStr[workingPos] == '\"') {
	CString Result = iStr.Copy(curPos, workingPos - curPos);
	curPos = workingPos+1;
	return Result;
      } else return "";
    } else return "";
  } else return "";
}
Example #9
0
CString CMail::MPRoute(const CString& iStr, int& curPos){
/*
  route       =  1#("@" domain) ":"           ; path-relative         
  means 1 at least "@:" or "domain:"
  separated eventually by commas
  */

#ifdef M_DEBUG
  cout << "MPRoute() - " << curPos << endl;
#endif

  if (curPos < iStr.StrLength()) {
    int workingPos = curPos;
    if (iStr[workingPos] != '@') {
      CString FDomain = MPDomain(iStr, workingPos);      
      if (!FDomain.StrLength()) return "";
    } else workingPos++;
    if (iStr[workingPos] != ':') return "";
    CString Result = iStr.Copy(curPos, workingPos-curPos);
    curPos = workingPos+1;
    if (iStr[curPos] == ',') return (Result+=MPRoute(iStr, curPos));
    else return Result;
  } else return "";
}