예제 #1
0
int RegQueryStringArray (
		HKEY hKey,
		const TCHAR *lpPrefix,
		TCHAR*** Strings
		)
{
	TCHAR *lpValueName = StrCreate (260);
	TCHAR **pValueData;

	int i = 0;
	DWORD dwType = REG_SZ;
	DWORD dwSize;

	while ( true )
	{
		FSF.sprintf (lpValueName, _T("%s%d"), lpPrefix, i);

		if ( RegQueryValueEx (
				hKey,
				lpValueName,
				NULL,
				&dwType,
				NULL,
				&dwSize
				) == ERROR_SUCCESS )
		{
			if ( Strings )
			{
				pValueData = *Strings;
				pValueData[i] = StrCreate (dwSize+1);

				RegQueryValueEx (
					hKey,
					lpValueName,
					NULL,
					&dwType,
					(PBYTE)pValueData[i],
					&dwSize
					);
			}

			i++;
		}
		else
			break;
	}

	StrFree (lpValueName);

	return i;
}
예제 #2
0
파일: tsee.c 프로젝트: andy-yx-chen/dsfixer
EEVal* TranslateFxRet(pfx_ret ret){
	EEVal* value;
	value = (EEVal*)_tsmalloc(sizeof(EEVal));
	if(ret == null){
		return null;
	}
	switch(ret->type){
		int szList, i;
	case number:
		value->type = Number;
		value->value = ret->buffer;
		break;
	case string:
		value->type = String;
		value->value = (_tspvoid)StrCreate();
		StrAppendS((TSStr*)value->value, (_tschar*)ret->buffer);
		break;
	case list:
		szList = ((int*)ret->buffer)[0];
		i = 1;
		value->type = List;
		value->value = (_tspvoid)_tsmalloc(sizeof(_tspvoid) * (szList + 1));
		((int*)value->value)[0] = szList;

		for(; i <= szList; ++i){
			((EEVal**)value->value)[i] = TranslateFxRet(((pfx_ret*)ret->buffer)[i]);
		}
		break;
	default:
		/*no other objec type*/
		break;
	}
	return value;
}
예제 #3
0
void RegSaveStringArray (
		HKEY hKey,
		const TCHAR *lpPrefix,
		TCHAR **Strings,
		int nStringCount
		)
{
	TCHAR *lpValueName = StrCreate (260);

	DWORD dwSize;

	if ( Strings )
	{
		for (int i = 0; i < nStringCount; i++)
		{
			dwSize = StrLength(Strings[i])+1;

			FSF.sprintf (lpValueName, _T("%s%d"), lpPrefix, i);

			RegSetValueEx (
					hKey,
					lpValueName,
					0,
					REG_SZ,
					(PBYTE)Strings[i],
					dwSize
					);
		}
	}

	StrFree (lpValueName);
}
예제 #4
0
void AddVarToTable(EEVarTable* table, EEVar* var){
	TSStr* str;
	list_entry *list;
	str = StrCreate();
	StrAppendS(str, var->name);
	list = &table->table[table->hash(str)];
	insert_before(list, &var->vlist);
	StrDestroy(str);
}
예제 #5
0
char *StrDuplicate (const char *String, int Length)
{
	if (String && Length)
	{
		if (Length == -1)
			Length = StrLength(String)+1;

		char *result = StrCreate (Length);
		strcpy (result, String);

		return result;
	}

	return NULL;
}
예제 #6
0
TCHAR *StrDuplicate (const TCHAR *String, int Length)
{
	if (String && Length)
	{
		if (Length == -1)
			Length = StrLength(String)+1;

		TCHAR *result = StrCreate (Length);
		_tcscpy (result, String);

		return result;
	}

	return NULL;
}
예제 #7
0
void doIndicator (
		int x,
		int y,
		dword dwPercent
		)
{
	char *lpTemp = StrCreate (100);

	memset (lpTemp, 177, 40);
	memset (lpTemp, 219, dwPercent);

	Info.Text (x, y, FarGetColor (COL_DIALOGTEXT), lpTemp);

	StrFree (lpTemp);
}
예제 #8
0
int __stdcall Archive::OnQueryPassword (int nMode, ArchivePassword *pPassword)
{
   	if ( nMode == PASSWORD_RESET )
   	{
   		if ( m_lpLastUsedPassword )
   		{
   			free (m_lpLastUsedPassword);
   			m_lpLastUsedPassword = NULL;
   		}
   	}

   	if ( (nMode == PASSWORD_LIST) || (nMode == PASSWORD_FILE) )
   	{
   		bool bResult = true;

   		if ( !m_lpLastUsedPassword )
   		{
   			m_lpLastUsedPassword = StrCreate (512);

   			bResult = Info.InputBox (
   					(nMode == PASSWORD_LIST)?_M(MQueryPasswordFileList):_M(MQueryPasswordContents),
   					_M(MQueryPasswordEnterPassword),
   					NULL,
   					NULL,
   					m_lpLastUsedPassword,
   					512,
   					NULL,
   					0
   					);

   			if ( !bResult )
   			{
   				StrFree (m_lpLastUsedPassword);
   				m_lpLastUsedPassword = NULL;
   			}
   		}

   		if ( m_lpLastUsedPassword && bResult )
   		{
   			strcpy (pPassword->lpBuffer, m_lpLastUsedPassword);
   			return TRUE;
   		}

   		return FALSE;
   	}

   	return FALSE;
}
예제 #9
0
void RemoveVarFromTable(EEVarTable* table, const _tsstr name){
	TSStr* str;
	list_entry *list, *entry;
	EEVar* var;
	str = StrCreate();
	StrAppendS(str, name);
	list = &table->table[table->hash(str)];
	StrDestroy(str);
	for_each(list, entry){
		if( !_tsstrcmp(contain_record(entry, EEVar, vlist)->name, name) ) break;
	}
	if( entry != list ){
		remove(entry);
		var = contain_record(entry, EEVar, vlist);
		/*we need to free the space owned by this entry and its value*/
		FreeEEObject(var->value.type, (void*)var->value.value);

		_tsfree(var);/*finally, free the var object;*/
	}
}
예제 #10
0
char *LoadDefaultCommand (
		ArchivePlugin *pPlugin,
		const GUID &uid,
		int nCommand,
		char *lpCommand
		)
{
	HKEY hKey;

	char *lpRegKey = StrCreate (260);

	FSF.sprintf (
			lpRegKey,
			"%s\\newarc\\Formats\\%s",
			Info.RootKey,
			GUID2STR (uid)
			);

	if ( RegOpenKeyEx (
			HKEY_CURRENT_USER,
			lpRegKey,
			0,
			KEY_READ,
			&hKey
			) == ERROR_SUCCESS )
	{
		lpCommand = RegQueryStringValueEx (
				hKey,
				pCommandNames[nCommand],
				lpCommand
				);

		RegCloseKey (hKey);
	}

	StrFree (lpRegKey);

	return lpCommand;
}
예제 #11
0
EEVar* FindVarInTable(EEVarTable* table, const _tsstr name)
/**
	Retrieve a EEVar object from the specified in hash table EEVarTable object with name specified.
	If any can be found, return the EEVar pointer
	else return NULL
*/
{
	TSStr* str;
	EEVar* result = NULL;
	list_entry *list,*entry;
	str = StrCreate();
	StrAppendS(str, name);
	list = &table->table[table->hash(str)];
	StrDestroy(str);
	for_each(list, entry){
		if(! _tsstrcmp(contain_record(entry, EEVar, vlist)->name, name)){
			result = contain_record(entry, EEVar, vlist);
			break;
		}
	}
	return result;
}
예제 #12
0
TCHAR *RegQueryStringValueEx (
		HKEY hKey,
		const TCHAR *lpValueName,
		TCHAR *lpCurrentValue /* = NULL */
		)
{
	DWORD dwSize = 0;

	TCHAR *lpResultValue;

	if ( (RegQueryValueEx (
			hKey,
			lpValueName,
			NULL,
			NULL,
			NULL,
			&dwSize
			) == ERROR_SUCCESS) )
	{
		StrFree (lpCurrentValue);
		lpResultValue = StrCreate (dwSize+1);

		RegQueryValueEx (
				hKey,
				lpValueName,
				NULL,
				NULL,
				(PBYTE)lpResultValue,
				&dwSize
				);

		return lpResultValue;
	}

	return lpCurrentValue;
}
예제 #13
0
int __stdcall Archive::OnProcessFile (int nParam1, ProcessFileStruct *pfs)
{
	char *lpTemp;

	m_pCurrentItem = pfs?pfs->pItem:NULL;

	if ( m_OS.bFirstFile )
	{
		if ( !OptionIsOn (m_nMode, OPM_SILENT) )
		{
			if ( m_OS.nOperation == OPERATION_EXTRACT )
			{
				doEmptyDialog (_M(MProcessFileExtractionTitle), false, c);
				Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileExtraction));
			}

			if ( m_OS.nOperation == OPERATION_ADD )
				doEmptyDialog (_M(MProcessFileAdditionTitle), false, c);

			if ( m_OS.nOperation == OPERATION_DELETE )
			{
				doEmptyDialog (_M(MProcessFileDeletionTitle), false, c);
				Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileDeletion));
			}

			Info.Text (c.X+5, c.Y+4, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileTo));

			doIndicator (c.X+5, c.Y+6, 0);
			doIndicator (c.X+5, c.Y+8, 0);

			Info.Text (0, 0, 0, 0);
		}

		m_OS.bFirstFile = false;
		m_OS.uTotalProcessedSize = 0;
	}

	if ( m_OS.nOperation == OPERATION_ADD )
	{
		if ( m_pCurrentItem )
			Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileAddition));
		else
			Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileAdditionRecompresion));
	}

	//if ( m_pCurrentItem )
	//	MessageBox (0, m_pCurrentItem->FindData.cFileName, m_pCurrentItem->FindData.cFileName, MB_OK);

	if ( !OptionIsOn (m_nMode, OPM_SILENT) )
	{
		lpTemp = StrCreate (260);

		memset (lpTemp, 32, 40);
		Info.Text (c.X+5, c.Y+3, FarGetColor (COL_DIALOGTEXT), lpTemp);
		Info.Text (c.X+5, c.Y+5, FarGetColor (COL_DIALOGTEXT), lpTemp);

		if ( m_pCurrentItem )
		{
			strcpy (lpTemp, m_pCurrentItem->FindData.cFileName);

			FSF.TruncPathStr (lpTemp, 40);
			Info.Text (c.X+5, c.Y+3, FarGetColor (COL_DIALOGTEXT), lpTemp);
		}

		if ( pfs && pfs->lpDestFileName )
		{
			strcpy (lpTemp, pfs->lpDestFileName);
			FSF.TruncPathStr (lpTemp, 40);

			Info.Text (c.X+5, c.Y+5, FarGetColor (COL_DIALOGTEXT), lpTemp);
		}

		StrFree (lpTemp);

		Info.Text (0, 0, 0, 0);
	}

	if ( m_pCurrentItem )
		m_OS.uFileSize = m_pCurrentItem->FindData.nFileSizeHigh*0x100000000ull+m_pCurrentItem->FindData.nFileSizeLow;
	else
		m_OS.uFileSize = m_OS.uTotalSize;

	m_OS.uProcessedSize = 0;

	return TRUE;
}