Exemplo n.º 1
0
/**********************************************************************
 * Function: CreateKeyLogFile
 * Info    : Create PGP key logfiles to setup PGPTools window lists
 * Result  : TRUE or FALSE
 **********************************************************************/
void CreateKeyLogFile(HWND hwnd)
{
  CHAR Commandline[PARAM_LEN];

  FreeKeyList(&pKeyListAnchor);
  FreeKeyList(&pOutKeyAnchor);
  strcpy(Commandline, "/C ");
  strcat(Commandline, "\"");
  strcat(Commandline, PGPKeyServiceCommand);
  strcat(Commandline, " -l >");
  strcat(Commandline, TempKeyLog);
  strcat(Commandline, "\"");
  JobDesc.Job = eBuildList;
  ExecutePGP(hwnd, OS2Shell, Commandline);
}
Exemplo n.º 2
0
// Open the keysword editor.
void KeywordEdit::Edit( ClsWindow& Parent, LPPARSER pParser )
{
	// Save parser pointer.
	m_pParser = pParser;
	
	// Save current case setting.
	m_bCase = pParser->bCaseOn;

	// Convert the hash table into a list.
	if ( Hash2List( &m_KeyLst, pParser ))
	{
		// Open the dialog.
		if ( DoModal( Parent, IDD_KEYWORDS ) <= 0 )
			// Free the list.
			FreeKeyList( &m_KeyLst );
		else
		{
			// Use the changes.
			if ( UseKeywords( &m_KeyLst ) == FALSE )
				// Error...
				MessageBox( ClsString( MAKEINTRESOURCE( IDS_NO_MEMORY )), ClsGetApp()->GetAppTitle(), MB_ICONERROR | MB_OK );
			
			// Save case setting.
			pParser->bCaseOn = m_bCase;
			
			// Changes where made.
			pSettings->Changed( pParser );
		}
	}
	else
		// Error...
		MessageBox( ClsString( MAKEINTRESOURCE( IDS_NO_MEMORY )), ClsGetApp()->GetAppTitle(), MB_ICONERROR | MB_OK );
}
Exemplo n.º 3
0
void NvRmPrivDeInitKeyList(NvRmDeviceHandle hRm)
{
    NvOsMutexLock(s_Mutex);
    FreeKeyList();
    s_pKeyList = NULL;
    NvOsMutexUnlock(s_Mutex);
    NvOsMutexDestroy(s_Mutex);
}
Exemplo n.º 4
0
// Use the edited keyword list.
BOOL KeywordEdit::UseKeywords( LPKEYLIST pKeyList )
{
	// Default the parser.
	PARSER pParser;
	::DefaultParser( &pParser );

	// Now we are going to use this parser to 
	// add the edited keywords to. When this 
	// does not fail we free the old hashes
	// and copy these back to the parser.
	for ( LPKEYWORDS pKey = pKeyList->lpFirst; pKey->lpNext; pKey = pKey->lpNext )
	{
		// Iterate the array.
		for ( int i = 0; i < ::ArrayGetSize( pKey->lpaKeywords ); i++ )
		{
			// Get string pointer.
			LPTSTR	pszString = *(( LPTSTR * )::ArrayGetAt( pKey->lpaKeywords, i ));

			// Add it to the hash table.
			if ( ::AddKeyword( pParserPool, &pParser, pszString, pKey->crColor, pKey->crBgColor ) == FALSE )
			{
				// Free node.
				::FreeParserNode( pParserPool, &pParser);

				// Free the list and fail.
				FreeKeyList( pKeyList );
				return FALSE;
			}
		}
	}

	// Free old hashes.
	FreeKeyHashes();

	// Free the keylist.
	FreeKeyList( pKeyList );

	// Setup the new hashes.
	for ( int i = 0; i < 256; i++ )
		m_pParser->aKeywords[ i ] = pParser.aKeywords[ i ];

	return TRUE;
}
Exemplo n.º 5
0
// Convert keywords hashes to
// a keyword list.
BOOL KeywordEdit::Hash2List( LPKEYLIST pKeyList, LPPARSER pParser )
{
	BOOL		bAdded = FALSE;

	// Initialize the list.
	NewList(( LPLIST )pKeyList );

	// Iterate the hashes.
	for ( int i = 0; i < 256; i++ )
	{
		LPKEYHASH pHash, pNext;
		for ( pHash = pParser->aKeywords[ i ]; pHash; pHash = pNext )
		{
			// Save next pointer.
			pNext = pHash->lpNext;

			// See if this color has
			// already been added?
			LPKEYWORDS pKey;
			for ( pKey = pKeyList->lpFirst; pKey->lpNext; pKey = pKey->lpNext )
			{
				// Are the colors the same as the
				// new keyword colors?
				if ( pKey->crColor == pHash->crColor && pKey->crBgColor == pHash->crBkColor )
				{
					// Yes. Simply add the keyword string to the
					// array of this color.
					if ( AddKeyword2Node( pKey, pHash->pszKeyword ) == FALSE )
					{
						// Error.
						FreeKeyList( pKeyList );
						return FALSE;
					}

					// Added keyword.
					bAdded = TRUE;
					break;
				}
			}

			// Added keyword?
			if ( bAdded == FALSE )
			{
				// Allocate a new keyword node.
				if (( pKey = ( LPKEYWORDS )::AllocPooled( pParserPool, sizeof( KEYWORDS ))) != NULL )
				{
					// Create a keyword array.
					if (( pKey->lpaKeywords = ::ArrayCreate( 0, 500, sizeof( LPTSTR * ))) != NULL )
					{
						// Setup the node colors.
						pKey->crColor   = pHash->crColor;
						pKey->crBgColor = pHash->crBkColor;

						// Add to the list.
						AddTail(( LPLIST )pKeyList, ( LPNODE )pKey );

						// Add the keyword.
						if ( AddKeyword2Node( pKey, pHash->pszKeyword ) == FALSE )
						{
							// Error.
							FreeKeyList( pKeyList );
							return FALSE;
						} 
					}
					else
					{
						// Error.
						::FreePooled( pParserPool, pKey );
						FreeKeyList( pKeyList );
						return FALSE;
					}
				}
				else
				{
					// Error.
					FreeKeyList( pKeyList );
					return FALSE;
				}
			}
			// Clear added flag.
			bAdded = FALSE;
		}
	}

	// Sort the arrays.
	for ( LPKEYWORDS pKey = pKeyList->lpFirst; pKey->lpNext; pKey = pKey->lpNext )
		::ArraySort( pKey->lpaKeywords, ( COMPFUNC )CompareKeywords );

	return TRUE;
}