Example #1
0
BOOL CDlgPublishHtml::FillCombo()
{
	// Fill in FTP servers
	m_comboFtpServer.ResetContent();
	HGROUP hGroup = NULL;
	while ( ( hGroup = FTPSERVERS().GetNext( hGroup ) ) != NULL )
		m_comboFtpServer.AddString( hGroup->name );

	// Fill in local server paths
	m_comboFolder.ResetContent();
	CRKey *pRk = WEBSETTINGS().GetKey( "FolderMap" );
	if ( pRk != NULL )
	{	LPREGVALUE	prv = NULL;
		while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
		{
			// Add this path
			int n = m_comboFolder.AddString( pRk->GetSz( prv ) );

			// Select the root
			if (	*prv->cpkey == 0 || !strcmp( prv->cpkey, "/" ) ||
					!strcmp( prv->cpkey, "\\" ) )
				m_comboFolder.SetCurSel( n );

		} // end while
	} // end if

	return TRUE;
}
Example #2
0
BOOL CReg::Parse(LPCTSTR pStr, DWORD size, char sep)
{_STTEX();
	DWORD line = 0;
	DWORD s = 0, e = 0;

	if ( size == 0 ) size = strlen( pStr );

	while ( s < size && e < size )
	{
		// Find start of data
		while ( s < size && ( pStr[ s ] <= ' ' || pStr[ s ] > '~' ) ) s++;
		e = s;

		// Find the end of the data
		BOOL data = FALSE;
		while ( e < size && ( pStr[ e ] >= ' ' && pStr[ e ] <= '~' ) ) 
		{	if ( pStr[ e ] > ' ' ) data = TRUE; e++; }

		// Add to reg
		if ( e > s )
		{	CStr str( line++ );
			CRKey *pRk = GetKey( str );
			if ( pRk != NULL ) pRk->Parse( &pStr[ s ], e - s, sep );
		} // end if

		// Skip data
		s = e;

	} // end while

	return TRUE;
}
Example #3
0
LRESULT CWzFtpPg1::OnPageChange(WPARAM wParam, LPARAM lParam)
{
	if ( wParam != 1 ) return 0;

	UpdateData( TRUE );

	CRKey *pRk = (CRKey*)CWzFrame::GetData( GetSafeHwnd() );
	if ( pRk == NULL ) return 0;

	pRk->Set( "Address", m_sAddr );	
	pRk->Set( "HttpPath", m_sHttpPath );	
	pRk->Set( "ServerName", m_sName );	
	pRk->Set( "Folder", m_sFolder );	

	if ( m_sName.IsEmpty() )
	{	::MessageBox(	GetSafeHwnd(), "Server Name cannot be blank",
		"Blank Field", MB_OK | MB_ICONSTOP ); return 1; }

	if ( m_sAddr.IsEmpty() )
	{	::MessageBox(	GetSafeHwnd(), "Server Address cannot be blank",
		"Blank Field", MB_OK | MB_ICONSTOP ); return 1; }

	if ( m_sHttpPath.IsEmpty() )
	{	::MessageBox(	GetSafeHwnd(), "HTTP Path cannot be blank",
		"Blank Field", MB_OK | MB_ICONSTOP ); return 1; }

	return 0;
}
Example #4
0
BOOL CReg::DeleteValue(LPCTSTR pKey, LPCTSTR pValue)
{_STTEX();
	CRKey *pRk = FindKey( pKey );
	if ( pRk == NULL ) return FALSE;

	return pRk->DeleteValue( pValue );
}
Example #5
0
LRESULT CWzFtpPg1::OnRefresh(WPARAM wParam, LPARAM lParam)
{
	CRKey *pRk = (CRKey*)CWzFrame::GetData( GetSafeHwnd() );
	if ( pRk == NULL ) return -1;

	// Load values
	m_sName = pRk->GetSz( "ServerName" );
	m_sAddr = pRk->GetSz( "Address" ); 
	m_sFolder = pRk->GetSz( "Folder" );
	m_sHttpPath = pRk->GetSz( "HttpPath" );

	// Create a unique group name if needed
	if ( m_sName.IsEmpty() )
	{
		DWORD i = 1;
		char name[ CWF_STRSIZE ];
		do
		{	wsprintf( name, "FTP Server %lu", i++ );
		} while ( FTPSERVERS().FindGroup( name ) != NULL );
		m_sName = name;

	} // end if

	UpdateData( FALSE );

	// Verify HTTP Path
	UpdateHttpPath( TRUE );

	return 1;
}
Example #6
0
BOOL CReg::RenameKey(LPCTSTR pOld, LPCTSTR pNew)
{_STTEX();
	CRKey *pRk = FindKey( pOld );
	if ( pRk == NULL ) return FALSE;

	return pRk->SetName( pNew );
}
Example #7
0
BOOL CReg::EncodeUrl(CPipe *pPipe, LPCTSTR pKey, char chSepNameVal, char chSepValues )
{
	CRKey *prk = FindKey( pKey );
	if ( prk == NULL ) return FALSE;

	return prk->EncodeUrl( pPipe, chSepNameVal, chSepValues );
}
Example #8
0
BOOL CDlgStackTrace::FillList( CReg *pReg )
{_STT();

	// Lose previous tree values
	m_list.DeleteAllItems();

	if ( pReg == NULL ) return FALSE;

	// Get selected tab
	int tab = m_tabSource.GetCurSel();
	if ( tab < 0 ) return FALSE;

	// Get thread selection
	int sel = m_comboThread.GetCurSel();
	if ( sel < 0 ) return FALSE;

	// Get seleted thread
	char szKey[ CWF_STRSIZE ] = "";
	m_comboThread.GetLBText( sel, szKey );

	// Find selected thread information
	CRKey *pRk = NULL;
	if ( '*' == *szKey ) pRk = pReg->FindKey( &szKey[ 2 ] );
	else pRk = pReg->FindKey( szKey );
	if ( !pRk ) return FALSE;

	UINT i = 0;
	int item = 0;
	LPCTSTR pFn = NULL;

	// Write out the call stack
	do
	{
		// Create key
		wsprintf( szKey, "f_%lu", i );

		// Is there a function at this index
		pFn = pRk->GetSz( szKey );
		if ( *pFn ) item = m_list.InsertItem( m_list.GetItemCount(), pFn, 0 );

		if ( tab == 2 )
		{
			wsprintf( szKey, "t_%lu", i );

			// Set the total time spent in this function
			LPCTSTR pT = pRk->GetSz( szKey );
			if ( *pT ) m_list.SetItemText( item, 1, pT );

		} // end if

		i++;

	} while ( *pFn );

	return TRUE;
}
Example #9
0
BOOL CReg::SaveWindowPos(HWND hWnd, LPCTSTR pKey, LPCTSTR pName)
{_STTEX();
	// Sanity checks
	if ( !::IsWindow( hWnd ) || pKey == NULL || pName == NULL ) 
		return FALSE;

	CRKey *pRk = GetKey( pKey );
	if ( pRk == NULL ) return FALSE;

	return pRk->SaveWindowPos( hWnd, pName );
}
Example #10
0
BOOL CReg::RestoreWindowPos(HWND hWnd, LPCTSTR pKey, LPCTSTR pName, BOOL bSize, BOOL bPosition )
{_STTEX();
	// Sanity checks
	if ( !bPosition && !bSize ) return FALSE;
	if ( !::IsWindow( hWnd ) || pKey == NULL || pName == NULL ) 
		return FALSE;

	CRKey *pRk = FindKey( pKey );
	if ( pRk == NULL ) return FALSE;

	return pRk->RestoreWindowPos( hWnd, pName, bSize, bPosition );
}
Example #11
0
BOOL CReg::Copy(CReg *pReg, BOOL bMerge)
{_STTEX();
	if ( !bMerge ) Destroy();
	if ( pReg == NULL ) return FALSE;

	LPREGKEY prk = NULL;
	while( ( prk = (LPREGKEY)pReg->GetNext( prk ) ) != NULL )
	{	CRKey *pRk = GetKey( prk->key->GetName() );
		if ( pRk ) pRk->Copy( prk->key, bMerge );
	} // end while

	return TRUE;
}
Example #12
0
BOOL CStackReport::CallStack(CReg *pReg, CStackTrace *pSt )
{_STT();
	CTlLocalLock ll( *pSt );
	if ( !ll.IsLocked() ) return FALSE;

	// Reset object
	pReg->Destroy();

	DWORD dwThreadId = GetCurrentThreadId();

	char szMsg[ 256 ] = "";
	CStackTrace::iterator it = NULL;
	CStackTrace::list *pList = pSt->GetList();
	while ( NULL != ( it = pList->next( it ) ) )
	{
		wsprintf( szMsg, "Thread %lu ( 0x%lx )", *it->key(), *it->key() );

		CRKey *pRk = pReg->GetKey( szMsg );
		if ( pRk )
		{
			// Flag if this is the current thread
			if ( dwThreadId == *it->key() ) pRk->Set( "current_thread", dwThreadId );
			
			// Save the thread id
			pRk->Set( "thread_id", (DWORD)*it->key() );

			// Get stack information
			UINT uStack = (*it)->GetStackPtr();
			LPCTSTR *pStack = (*it)->GetStack();

			// Save
			if ( uStack ) for ( UINT i = 0, p = uStack - 1; i < uStack; i++, p-- )
			{
				wsprintf( szMsg, "f_%lu", i );

				// If we have a valid string
				if ( pStack[ i ] ) pRk->Set( szMsg, pStack[ p ] );

			} // end for

		} // end if

	} // end while

	return TRUE;
}
Example #13
0
LRESULT CWzEmailPg2::OnPageClose(WPARAM wParam, LPARAM lParam)
{
	UpdateData( TRUE );

	CRKey *pRk = (CRKey*)CWzFrame::GetData( GetSafeHwnd() );
	if ( pRk == NULL ) return -1;

	int sel = m_comboAuthType.GetCurSel();
	if ( sel != CB_ERR ) m_dwAuthType = m_comboAuthType.GetItemData( sel );

	pRk->Set( "AuthDetect", (DWORD)m_bAuthDetect ? 1 : 0 );
	pRk->Set( "Login", (DWORD)m_bLogin ? 1 : 0 );
	pRk->Set( "AuthType", m_dwAuthType );
	pRk->Set( "Username", m_sUsername );
	pRk->Set( "Password", m_sPassword );

	return 0;
}
Example #14
0
void CPgPubExtra::OnSettings() 
{
	CReg *pReg = (CReg*)CDlgTabFrame::GetData( GetSafeHwnd() );
	if ( pReg == NULL ) return;
	CRKey *pRk = pReg->FindKey( "PUBINFO" );
	if ( pRk == NULL ) return;

	int sel = m_comboCodec.GetCurSel();
	if ( sel == CB_ERR ) return;

	// Get data pointer
	LPCODECINFO pci = (LPCODECINFO)m_comboCodec.GetItemData( sel );
	if ( pci == NULL || !m_codecs.VerifyPointer( pci ) ) return;

	// Attempt to open settings dialog
	HIC hIc = ICOpen( ICTYPE_VIDEO, pci->fourCC, ICMODE_QUERY );
	if ( hIc != NULL )
	{
		DWORD size = pRk->GetValueSize( "CodecData" );
		LPBYTE buf = (LPBYTE)pRk->GetValuePtr( "CodecData" );

		// Restore settings
		if ( size > 0 && buf != NULL )
			ICSetState( hIc, buf, size );

		// Configure the compressor
		if ( ICConfigure( hIc, GetSafeHwnd() ) != ICERR_OK )
			return;

		size = ICGetStateSize( hIc );
		if ( size > 0 )
		{
			TMem< BYTE > mem;
			if ( mem.allocate( size ) )
				if ( ICGetState( hIc, mem.ptr(), size ) == ICERR_OK )
					pRk->Set( "CodecData", mem.ptr(), size );

		} // end if

		ICClose( hIc ); 

	} // end if
	
}
Example #15
0
LRESULT CWzEmailPg2::OnRefresh(WPARAM wParam, LPARAM lParam)
{
	CRKey *pRk = (CRKey*)CWzFrame::GetData( GetSafeHwnd() );
	if ( pRk == NULL ) return -1;

	m_bAuthDetect = pRk->GetDword( "AuthDetect", 1 ) != 0;
	m_bLogin = pRk->GetDword( "Login", 1 ) != 0;
	m_dwAuthType = pRk->GetDword( "AuthType" );

	m_sUsername = pRk->GetSz( "Username" );
	m_sPassword = pRk->GetSz( "Password" );
	
	UpdateData( FALSE );

	FillCombo();
	DoEnable();

	return 1;
}
Example #16
0
// wjr 11/10/06...
BOOL CStackReport::ErrorLog(CReg *pReg, CErrLog* pErrLog )
{_STT();
	if( !pReg || !pErrLog )
		return E_INVALIDARG;

	CTlLocalLock ll( *pErrLog );
	if ( !ll.IsLocked() ) return FALSE;

	// Reset object
	pReg->Destroy();

	int	iId = 1;
	char szMsg[ 256 ] = "";
	LPERRORITEMINFO pEii = NULL;
	while ( ( pEii = (LPERRORITEMINFO)pErrLog->GetNext( pEii ) ) != NULL )
	{
		wsprintf( szMsg, "Error %d", iId++ );

		CRKey *pRk = pReg->GetKey( szMsg );
		if ( pRk )
		{
			CWinTime wt;
			wt.SetUnixTime( pEii->dwTime );
			wt.GetString( szMsg, "%w %b %D %Y - %g:%m:%s" );

			// Save the time.
			pRk->Set( "time", szMsg );
			
			// Save function info if present.
			if( pEii->sFile && pEii->sFunction )
			{
				if( pEii->sFile->ptr() && pEii->sFunction->ptr() )
				{
					try
					{
						char* pStr = NULL;
						wsprintf( szMsg, "%s::%s", pEii->sFile->ptr(), pEii->sFunction->ptr() );
						// Parse out the path
						int ch = '\\';
						pStr = strrchr( szMsg, ch );

						if( pStr )
						{
							pStr++; // dump the "\".
							pRk->Set( "function", pStr );
						}

						// Save the file info
						// wjr 1/9/07...
						wsprintf( szMsg, "%s", pEii->sFile->ptr() );
						pRk->Set( "file", szMsg );
						// ...wjr 1/9/07
			
					}
					catch(...)
					{
						ASSERT(0);
					}

				}
			}
			
			// Save the message
			pRk->Set( "message", pEii->cpkey );

			// Save the error code
			CWin32::GetSystemErrorMsg( pEii->dwCode, szMsg );
			pRk->Set( "code", szMsg );

			// wjr 1/9/07...
			// Save the line
			pRk->Set( "line", pEii->dwLine );

			// Save the severity
			pRk->Set( "severity", pEii->dwSeverity );

			// Save the raw time data
			pRk->Set( "timedata", pEii->dwTime );
			// ...wjr 1/9/07

		} // end if

	} // end while

	return TRUE;
}
Example #17
0
BOOL CStackReport::History(CReg *pReg, CStackTrace *pSt )
{_STT();
#ifndef ENABLE_STACK_HISTORY

	return FALSE;

#else

	CTlLocalLock ll( *pSt );
	if ( !ll.IsLocked() ) return FALSE;

	// Reset object
	pReg->Destroy();

	DWORD dwThreadId = GetCurrentThreadId();

	char szMsg[ 256 ] = "";
	CStackTrace::iterator it = NULL;
	CStackTrace::list *pList = pSt->GetList();
	while ( NULL != ( it = pList->next( it ) ) )
	{
		wsprintf( szMsg, "Thread %lu ( 0x%lx )", *it->key(), *it->key() );

		CRKey *pRk = pReg->GetKey( szMsg );
		if ( pRk )
		{
			// Flag if this is the current thread
			if ( dwThreadId == *it->key() ) pRk->Set( "current_thread", dwThreadId );
			
			// Save the thread id
			pRk->Set( "thread_id", (DWORD)*it->key() );

			// Get stack information
			UINT uSize = (*it)->GetMaxHistory();
			UINT uPtr = (*it)->GetHistoryPtr();
			LPCTSTR *pHistory = (*it)->GetHistory();
#ifdef ENABLE_STACK_HISTORY_TIME
			LONGLONG *pHistoryTime = (*it)->GetHistoryTime(); // wjr 1/19/07
#endif

			// Is there anything in the history?
			if ( uSize )
			{
				// Save
				for ( UINT i = 0; i < uSize; i++ )
				{
					// Adjust pointer
					if ( uPtr ) uPtr--; else uPtr = uSize - 1;

					wsprintf( szMsg, "f_%04lu", i );// wjr 1/19/07

					if ( pHistory[ uPtr ] )
					{
						// wjr 1/19/07...
#ifdef ENABLE_STACK_HISTORY_TIME
						char szMsg2[ 256 ] = "";
						if( pHistoryTime[ uPtr ] )
							wsprintf( szMsg2, "%ld - %s", (unsigned long)pHistoryTime[ uPtr ], pHistory[ uPtr ] );
						else
							wsprintf( szMsg2, "%s", pHistory[ uPtr ] );// wjr 1/22/07

						pRk->Set( szMsg, szMsg2 );
#else
						pRk->Set( szMsg, pHistory[ uPtr ] );
#endif
						// ...wjr 1/19/07
					}

				} // end for

			} // end if

		} // end if

	} // end while

	return TRUE;

#endif

}
Example #18
0
BOOL CStackReport::Profile(CReg *pReg, CStackTrace *pSt )
{_STT();
#ifndef ENABLE_STACK_PROFILE

	return FALSE;

#else

	CTlLocalLock ll( *pSt );
	if ( !ll.IsLocked() ) return FALSE;

	// Reset object
	pReg->Destroy();

	DWORD dwThreadId = GetCurrentThreadId();

	char szMsg[ 256 ] = "";
	CStackTrace::iterator it = NULL;
	CStackTrace::list *pList = pSt->GetList();
	while ( NULL != ( it = pList->next( it ) ) )
	{
		wsprintf( szMsg, "Thread %lu ( 0x%lx )", *it->key(), *it->key() );

		CRKey *pRk = pReg->GetKey( szMsg );
		if ( pRk )
		{
			// Flag if this is the current thread
			if ( dwThreadId == *it->key() ) pRk->Set( "current_thread", dwThreadId );
			
			// Save the thread id
			pRk->Set( "thread_id", *it->key() );

			TStrList< CStackTrace::CStack::SProfileItem > *pProfile = (*it)->GetProfile();
			if ( pProfile )
			{
				DWORD i = 0;
				TStrList< CStackTrace::CStack::SProfileItem >::iterator itPi = NULL;
				while ( NULL != ( itPi = pProfile->next( itPi ) ) )
				{
					// Save function name
					wsprintf( szMsg, "f_%lu", i );
					pRk->Set( szMsg, itPi->key() );

					// Save total time
					wsprintf( szMsg, "t_%lu", i );
					pRk->Set( szMsg, (double)( (double)(*itPi)->llTotalTime / (double)CHqTimer::GetTimerFrequency() ) );

					// Next index
					i++;

				} // end while

			} // end if

		} // end if

	} // end while

	return TRUE;
	
#endif
}
Example #19
0
BOOL CReg::IsSet( LPCTSTR pKey, LPCTSTR pName )
{_STTEX();
	CRKey *prk = FindKey( pKey );
	if ( prk == NULL ) return NULL;
	return prk->IsSet( pName );
}
Example #20
0
BOOL CReg::ReadInline(LPBYTE pBuf, DWORD dwSize)
{_STTEX();

	// Sanity checks
	if ( pBuf == NULL || dwSize == 0 ) 
		return FALSE;

	DWORD	i = 0;
	char	token[ CWF_STRSIZE ];

	while ( i < dwSize && pBuf[ i ] != 0 )
	{
		DWORD t = 0;

		// Skip white space
		while ( i < dwSize && ( pBuf[ i ] <= ' ' || pBuf[ i ] > '~' ) && pBuf[ i ] != 0 ) i++;
		if ( i >= dwSize || pBuf[ i ] == 0 ) return TRUE;

		// Read in first token
		while ( i < dwSize && t < ( CWF_STRSIZE - 1 ) &&
				pBuf[ i ] && pBuf[ i ] != '=' )
			token[ t++ ] = pBuf[ i++ ];
		token[ t ] = 0;

		{ // DeCanonicalize token
			
			DWORD dwMin = CCfgFile::GetMinDeCanonicalizeBufferSize( strlen( token ) );
			
			TMem< BYTE > mem; DWORD dwSize = 0;
			if ( mem.allocate( dwMin + 1 ) ) 
			{	if ( CCfgFile::DeCanonicalizeBuffer( token, (LPBYTE)mem.ptr(), strlen( token ), &dwSize ) ) 
				{	memcpy( token, mem.ptr(), dwSize ); token[ dwSize ] = 0; }
			} // end if

		} // end decanoicalize token

		// Check for '='
		if ( pBuf[ i ] == '=' )
		{	i++;

			// Skip starting spaces
			while ( i < dwSize && pBuf[ i ] == ' ' ) i++;

			DWORD s = i;
			BOOL quoted = FALSE;

			// Find the end of the data
			while ( i < dwSize &&
					( ( quoted && pBuf[ i ] >= ' ' ) || pBuf[ i ] > ' ' ) && 
					pBuf[ i ] <= '~' && pBuf[ i ] != '&' ) 
			{
				// Toggle quote mode
				if ( pBuf[ i ] == '"' ) quoted = !quoted;

				// Next char
				i++;
			} // end if

			if ( i > s )
			{
				// DeCanonicalize data
				DWORD dwMin = CCfgFile::GetMinDeCanonicalizeBufferSize( i - s );

				TMem< BYTE > mem;
				if ( mem.allocate( dwMin + 1 ) ) 
				{
					// Do it
					DWORD dwSize = 0;
					if ( CCfgFile::DeCanonicalizeBuffer( (LPCTSTR)&pBuf[ s ], (LPBYTE)mem.ptr(), i - s, &dwSize ) ) 
					{
						CRKey *pRk = GetKey( token );
						pRk->ReadInline( mem.ptr(), dwMin );

					} // end if

				} // end if

			} // end if

			// Skip separator
			while ( i < dwSize && pBuf[ i ] == '&' ) i++;

		} // end if

	} // end while

	return TRUE;
}
Example #21
0
BOOL CNetFile::HttpRequest(LPCTSTR pUrl, CRKey *pHeaders, CRKey *pData, LPCTSTR pMethod, LPCTSTR pLocal, BOOL bCloseFileAfterDownload, HWND hWndParent, DWORD dwUrlEncoding)
{_STT();
	// Lose previous file
	Destroy();

	// Downloading
	m_bUpload = FALSE;

	// Save parent window
	m_hWndParent = hWndParent;

	// Save close file status
	m_bCloseFileAfterDownload = bCloseFileAfterDownload;

	// Sanity check
	if ( pUrl == NULL || *pUrl == NULL ) return FALSE;

	// Are we downloading to file or ram?
	m_bMem = ( pLocal == NULL );

	{ // Copy the url
		
		char buf[ sizeof( m_szUrl ) ] = { 0 };
		DWORD size = sizeof( m_szUrl ) - 1;

		// Is it a local file?
		if ( GetFileAttributes( pUrl ) == MAXDWORD )
		{
			// Fix the url
			if ( InternetCanonicalizeUrl( pUrl, buf, &size, 0 ) )
			{	strcpy_sz( m_szUrl, buf ); }

			// Copy the url name
			else strcpy_sz( m_szUrl, pUrl );
		} // end if
		
		// Copy the local file name
		else strcpy_sz( m_szUrl, pUrl );

	} // end copy url	

	if ( !m_bMem )
	{
		// Where to download the file
		if ( pLocal != DOWNLOADTEMP ) { strcpy_sz( m_szLocal, pLocal ); }
		else CWinFile::CreateTemp( m_szLocal );	

		// Create a file to load data
		if ( !m_local.OpenNew( m_szLocal, GENERIC_READ | GENERIC_WRITE ) )
			return FALSE;
	} // end else
	
	// Set status	
	m_dwTransferStatus = NETFILE_DS_INITIALIZING;

	// Save request method
	if ( pMethod == NULL || *pMethod == 0 ) m_sMethod = "POST";
	else m_sMethod = pMethod;

	// Set data
	DWORD dwContentLength = 0;
	if ( pData != NULL )
	{	CPipe pipe;
		pData->EncodeUrl( &pipe, dwUrlEncoding );
		m_sData.copy( (LPCTSTR)pipe.GetBuffer(), pipe.GetBufferSize() );
		dwContentLength = pipe.GetBufferSize();
	} // end if

	// Set headers
	if ( strcmpi( m_sMethod, "GET" ) )
	{
		CRKey rkHeaders;
		if ( pHeaders != NULL ) rkHeaders.Copy( pHeaders );
		
		rkHeaders.Set( "Content-Type", "application/x-www-form-urlencoded" );
		rkHeaders.Set( "Content-Length", dwContentLength );

		CPipe pipe;
		rkHeaders.EncodeHttpHeaders( &pipe );
		m_sHeaders.copy( (LPCTSTR)pipe.GetBuffer(), pipe.GetBufferSize() );

	} // end if

	// Create a thread to download the file
	if ( !StartThread() )
	{	Destroy();
		m_dwTransferStatus = NETFILE_DS_ERROR;		
		return FALSE;
	} // end if

	return TRUE;
}
Example #22
0
BOOL CHtmlProperties::AddKey(CReg *pReg, CRKey *pRk)
{
	CRKey *pType = pReg->GetKey( "type" );

	if ( pRk != NULL )
	{
		char type[ CWF_STRSIZE ];
		LPREGVALUE prv = NULL;
		while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
		{		
			// Get type
			if ( pType == NULL ) m_dwParams = 0, m_szParams[ 0 ][ 0 ] = 0;

			// Get variable type
			else if ( pType->Get( prv->cpkey, type, sizeof( type ) ) )
				GetParams( type );

			// No params
			else m_dwParams = 0, m_szParams[ 0 ][ 0 ] = 0;
											
			// Image
			if ( m_dwParams > 0 )
			{
				// Check for group name
				if ( *prv->cpkey == '*' )
					GetPropList().Add( PROPTYPE_GROUP, 0, 0, &prv->cpkey[ 1 ], NULL, 0 );

				else if ( !strcmpi( m_szParams[ 0 ], "image" ) )
					GetPropList().Add(	PROPTYPE_FILE, PROPEDIT_COMBOEDIT, 1,
										prv->cpkey, prv->data, prv->size );

				else if ( !strcmpi( m_szParams[ 0 ], "diskimg" ) )
					GetPropList().Add(	PROPTYPE_FILE, PROPEDIT_FILE, 0,
										prv->cpkey, prv->data, prv->size );

				else if ( !strcmpi( m_szParams[ 0 ], "rgb" ) )
					GetPropList().Add(	PROPTYPE_RGBSTR, PROPEDIT_RGB, 0,
										prv->cpkey, prv->data, prv->size );

				else if ( !strcmpi( m_szParams[ 0 ], "slider" ) )
				{
					if ( m_dwParams < 2 ) m_lParams[ 1 ] = 0;
					if ( m_dwParams < 3 ) m_lParams[ 2 ] = 100;

					GetPropList().Add(	PROPTYPE_STR, PROPEDIT_SLIDER, 0,
										prv->cpkey, prv->data, prv->size,
										m_lParams[ 1 ], m_lParams[ 2 ] );
				} // end else if

				else if ( !strcmpi( m_szParams[ 0 ], "combo" ) )
					GetPropList().Add(	PROPTYPE_STR, PROPEDIT_COMBO, 2,
										prv->cpkey, prv->data, prv->size );


				// String
				else GetPropList().Add(	PROPTYPE_STR, PROPEDIT_EDIT, 0,
										prv->cpkey, prv->data, prv->size );
			
			} // end if

			// Check for group name
			else if ( *prv->cpkey == '*' )
				GetPropList().Add( PROPTYPE_GROUP, 0, 0, &prv->cpkey[ 1 ], NULL, 0 );

			else if ( *prv->pcdata == '#' )
			{
				GetPropList().Add(	PROPTYPE_RGBSTR, PROPEDIT_RGB, 0,
									prv->cpkey, prv->data, prv->size );
			} // end if

			// Assume string
			else GetPropList().Add(	PROPTYPE_STR, PROPEDIT_EDIT, 0,
									prv->cpkey, prv->data, prv->size );

		} // end while

	} // end if

	return TRUE;

/*	if ( pRk == NULL ) return FALSE;

	LPREGVALUE prv = NULL;
	while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
	{		
		if ( prv->data != NULL )
		{
			// Check for group name
			if ( *prv->cpkey == '*' )
				GetPropList().Add( PROPTYPE_GROUP, 0, 0, &prv->cpkey[ 1 ], NULL, 0 );

			else if ( *prv->pcdata == '#' )
			{
				GetPropList().Add(	PROPTYPE_RGBSTR, PROPEDIT_RGB, 0,
									prv->cpkey, prv->data, prv->size );
			} // end if

			// Add the property
			else GetPropList().Add(	PROPTYPE_STR, PROPEDIT_EDIT, 0,
									prv->cpkey, prv->data, prv->size );
		} // end if
		
	} // end while

	return TRUE;
*/
}
Example #23
0
BOOL CHtmlProperties::FillCombo(DWORD dwUser, CComboBox *pCombo)
{
	switch( dwUser )
	{
		case 1 :
		{
			{ // Add local server links

				char link[ CWF_STRSIZE ];
				char host[ CWF_STRSIZE ];
				char name[ CWF_STRSIZE ] = { '~', 0x0 };
				DWORD port = 80;
				char strport[ CWF_STRSIZE ];

				// Get port number
				CFG().GetValue( "Settings", "WebServerPort", strport, sizeof( strport ) );
				CFG().GetValue( "Settings", "WebServerPort", &port );

				if ( !gethostname( name, CWF_STRSIZE - 1 ) )
				{
					LPHOSTENT he = gethostbyname( name );
					if ( he != NULL )
					{
						strcpy( host, "http://" );
						strcat( host, inet_ntoa( *(LPIN_ADDR) *( he->h_addr_list ) ) );
						if ( port != 80 ) strcat( host, ":" ), strcat( host, strport );
						strcat( host, "/" );

					} // end if
					else strcpy( host, "http://127.0.0.1/" );

				} // end if
				else strcpy( host, "http://127.0.0.1/" );

				CRKey *pRk = WEBSETTINGS().GetKey( "ImageMap" );
				if ( pRk != NULL )
				{
					LPREGVALUE	prv = NULL;
					while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
					{
						CWinFile::WebBuildPath( link, host, prv->cpkey );
						if ( *link ) pCombo->AddString( link );
					}

					// Add raw image names
					while ( ( prv = (LPREGVALUE)pRk->GetNext( prv ) ) != NULL )
						if ( prv->cpkey != NULL && *prv->cpkey ) 
							pCombo->AddString( prv->cpkey );

				} // end if

			} // end add local server links

			{ // Add publishing links

				LPPUBINFO ppi = NULL;
				char link[ CWF_STRSIZE ];

				while ( ( ppi = (LPPUBINFO)PUBLIST().GetNext( ppi ) ) != NULL )
				{
					if ( ppi->type == PUBTYPE_FTP )
					{
						// Update the filename
						CPubThread::GetFileName( ppi, TRUE );

						// Get HTTP path
						if ( FTPSERVERS().GetValue(	ppi->str, "HttpPath", 
													link, sizeof( link ) ) )
						{
							// Build link to file
							CWinFile::WebBuildPath( link, link, ppi->pub_fname );

							// Add it!
							if ( *link ) pCombo->AddString( link );

						} // end if

					} // end if

					else if ( ppi->type == PUBTYPE_DISK )
					{
						CPubThread::GetFileName( ppi, TRUE );
						CWinFile::WebBuildPath( link, ppi->path, ppi->pub_fname );
						if ( *link ) pCombo->AddString( link );

					} // end else if

				} // end while

			} // end add publishing links

		} break;

		case 2 :
		{
			// Add string values
			for ( DWORD i = 1; i < m_dwParams; i++ )
				pCombo->AddString( m_szParams[ i ] );

		} break;

	} // end switch

	return FALSE;
}