Пример #1
0
/**
 * this will work only on a CxImageJPG object, if the image originally has valid EXIF data
 \verbatim
	CxImageJPG jpg;
	CxIOFile in,out;
	in.Open("D:\\exif_in.jpg","rb");
	out.Open("D:\\exif_out.jpg","w+b");
	jpg.Decode(&in);
	if (jpg.IsValid()){
		jpg.RotateLeft();
		jpg.Encode(&out);
	}
 \endverbatim
*/
bool CxImageJPG::CxExifInfo::EncodeExif(CxFile * hFile)
{
    int a;

    if (FindSection(M_SOS)==NULL) {
        strcpy(m_szLastError,"Can't write exif : didn't read all");
        return false;
    }

    // Initial static jpeg marker.
    hFile->PutC(0xff);
    hFile->PutC(0xd8);

    if (Sections[0].Type != M_EXIF && Sections[0].Type != M_JFIF) {
        // The image must start with an exif or jfif marker.  If we threw those away, create one.
        static BYTE JfifHead[18] = {
            0xff, M_JFIF,
            0x00, 0x10, 'J' , 'F' , 'I' , 'F' , 0x00, 0x01,
            0x01, 0x01, 0x01, 0x2C, 0x01, 0x2C, 0x00, 0x00
        };
        hFile->Write(JfifHead, 18, 1);
    }

    // Write all the misc sections
    for (a=0; a<SectionsRead-1; a++) {
        hFile->PutC(0xff);
        hFile->PutC((unsigned char)(Sections[a].Type));
        hFile->Write(Sections[a].Data, Sections[a].Size, 1);
    }

    // Write the remaining image data.
    hFile->Write(Sections[a].Data, Sections[a].Size, 1);

    return true;
}
Пример #2
0
	void copyThumbnailData(uchar* thumbnailData, int thumbnailLen)
	{
		LOGI("******************************** copyThumbnailData");

		Section_t* ExifSection = FindSection(M_EXIF);

		if (ExifSection == NULL) {
			return;
		}

		int NewExifSize = ImageInfo.ThumbnailOffset+8+thumbnailLen;
		ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);

		if (ExifSection->Data == NULL) {
			LOGW("ExifSection->Data = NULL");
			return;
		}

		uchar* ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;
		memcpy(ThumbnailPointer, thumbnailData, thumbnailLen);

		ImageInfo.ThumbnailSize = thumbnailLen;

		Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, thumbnailLen);

		ExifSection->Data[0] = (uchar)(NewExifSize >> 8);
		ExifSection->Data[1] = (uchar)NewExifSize;
		ExifSection->Size = NewExifSize;
	}
Пример #3
0
//--------------------------------------------------------------------------
// Replace or remove exif thumbnail
//--------------------------------------------------------------------------
int SaveThumbnail(char * ThumbFileName)
{
    FILE * ThumbnailFile;

    if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailSize == 0){
        fprintf(stderr,"Image contains no thumbnail\n");
        return FALSE;
    }

    if (strcmp(ThumbFileName, "-") == 0){
        // A filename of '-' indicates thumbnail goes to stdout.
        // This doesn't make much sense under Windows, so this feature is unix only.
        ThumbnailFile = stdout;
    }else{
        ThumbnailFile = fopen(ThumbFileName,"wb");
    }

    if (ThumbnailFile){
        uchar * ThumbnailPointer;
        Section_t * ExifSection;
        ExifSection = FindSection(M_EXIF);
        ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;

        fwrite(ThumbnailPointer, ImageInfo.ThumbnailSize ,1, ThumbnailFile);
        fclose(ThumbnailFile);
        return TRUE;
    }else{
        ErrFatal("Could not write thumbnail file");
        return FALSE;
    }
}
Пример #4
0
const char *GProfile::GetPath(const char *szSectionName, const char *szKey, short bThrowNotFound)
{
	Section *pSection = FindSection(szSectionName);
	if (pSection)
	{
		NameValuePair *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if ( !( pNVP->m_strValue.Right(1) == "/" || pNVP->m_strValue.Right(1) == "\\") )
			{
		#ifdef _WIN32
				pNVP->m_strValue += "\\";
		#else
				pNVP->m_strValue += "/";
		#endif
			}
			return pNVP->m_strValue;
		}
		else if (bThrowNotFound)
		{
			// throw key not found

		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found

	}

	return 0;
}
Пример #5
0
	static jbyteArray getThumbnail(JNIEnv *env, jobject jobj, jstring jfilename)
	{
		LOGI("getThumbnail");

		const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL);

		if (filename)
		{
			loadExifInfo(filename, FALSE);
			Section_t* ExifSection = FindSection(M_EXIF);
			if (ExifSection == NULL || ImageInfo.ThumbnailSize == 0)
			{
				LOGE("no exif section or size == 0, so no thumbnail\n");
				goto noThumbnail;
			}
			uchar* thumbnailPointer = ExifSection->Data + ImageInfo.ThumbnailOffset + 8;
			jbyteArray byteArray = (*env)->NewByteArray(env, ImageInfo.ThumbnailSize);
			if (byteArray == NULL)
			{
				LOGE("couldn't allocate thumbnail memory, so no thumbnail\n");
				goto noThumbnail;
			}
			(*env)->SetByteArrayRegion(env, byteArray, 0, ImageInfo.ThumbnailSize, thumbnailPointer);
			LOGD("thumbnail size %d\n", ImageInfo.ThumbnailSize);
			(*env)->ReleaseStringUTFChars(env, jfilename, filename);
			DiscardData();
			return byteArray;
		}
		noThumbnail: if (filename)
		{
			(*env)->ReleaseStringUTFChars(env, jfilename, filename);
		}
		DiscardData();
		return NULL;
	}
Пример #6
0
static jlongArray getThumbnailRange(JNIEnv *env, jobject jobj, jstring jfilename) {
    jlongArray resultArray = NULL;
    const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL);
    if (filename) {
        loadExifInfo(filename, FALSE);
        Section_t* ExifSection = FindSection(M_EXIF);
        if (ExifSection == NULL || ImageInfo.ThumbnailSize == 0) {
            goto done;
        }

        jlong result[2];
        result[0] = ExifSection->Offset + ImageInfo.ThumbnailOffset + 8;
        result[1] = ImageInfo.ThumbnailSize;

        resultArray = (*env)->NewLongArray(env, 2);
        if (resultArray == NULL) {
            goto done;
        }

        (*env)->SetLongArrayRegion(env, resultArray, 0, 2, result);
    }
done:
    if (filename) {
        (*env)->ReleaseStringUTFChars(env, jfilename, filename);
    }
    DiscardData();
    return resultArray;
}
Пример #7
0
// function retrieves a boolean from the specified section
short GProfile::GetBool(const char *szSectionName, const char *szKey, short bThrowNotFound /* = true */)
{
	Section *pSection = FindSection(szSectionName);
	if (pSection)
	{
		NameValuePair *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			char chTest = '0';
			if (!pNVP->m_strValue.IsEmpty())
				chTest = pNVP->m_strValue[0];
			return IsTrue(chTest);
		}
		else if (bThrowNotFound)
		{
			// throw key not found

		}
	}
	else if (bThrowNotFound)
	{

	}

	return 0;
}
Пример #8
0
//--------------------------------------------------------------------------
// Replace or remove exif thumbnail
//--------------------------------------------------------------------------
int ReplaceThumbnailFromBuffer(const char * Thumb, int ThumbLen)
{
    int NewExifSize;
    Section_t * ExifSection;
    uchar * ThumbnailPointer;

    if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){
        if (Thumb == NULL){
            // Delete of nonexistent thumbnail (not even pointers present)
            // No action, no error.
            return FALSE;
        }

        // Adding or removing of thumbnail is not possible - that would require rearranging
        // of the exif header, which is risky, and jhad doesn't know how to do.
        fprintf(stderr,"Image contains no thumbnail to replace - add is not possible\n");
#ifdef SUPERDEBUG
        ALOGE("Image contains no thumbnail to replace - add is not possible\n");
#endif
        return FALSE;
    }

    if (Thumb) {
        if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){
	        //ErrFatal("Thumbnail is too large to insert into exif header");
	        ALOGE("Thumbnail is too large to insert into exif header");
	        return FALSE;
        }
    } else {
        if (ImageInfo.ThumbnailSize == 0){
             return FALSE;
        }

        ThumbLen = 0;
    }

    ExifSection = FindSection(M_EXIF);

    NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen;
    ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);

    ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;

    if (Thumb){
        memcpy(ThumbnailPointer, Thumb, ThumbLen);
    }

    ImageInfo.ThumbnailSize = ThumbLen;

    Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen);

    ExifSection->Data[0] = (uchar)(NewExifSize >> 8);
    ExifSection->Data[1] = (uchar)NewExifSize;
    ExifSection->Size = NewExifSize;

#ifdef SUPERDEBUG
        ALOGE("ReplaceThumbnail successful thumblen %d", ThumbLen);
#endif
    return TRUE;
}
Пример #9
0
static int LoadDSN (
   const gchar* iniFileName, const gchar* dsnName, GHashTable* table)
{
   FILE* stream;
   gchar* name;
   gchar* value;


   if ((stream = fopen (iniFileName, "r" )) != NULL )   
   {
      if (!FindSection (stream, dsnName))
      {
	 g_printerr ("Couldn't find DSN %s in %s\n", dsnName, iniFileName);
	 fclose (stream);
         return 0;
      }
      else
      {
         while (GetNextItem (stream, &name, &value))
         {
            g_hash_table_insert (table, g_strdup (name), g_strdup (value));
         }
      }

      fclose( stream );   
   }

   return 1;
}
Пример #10
0
// function retrieves a long from the specified section
long GProfile::GetLong(const char *szSectionName, const char *szKey, short bThrowNotFound /* = true */)
{
	Section *pSection = FindSection(szSectionName);
	if (pSection)
	{
		NameValuePair *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if (!pNVP->m_strValue.IsEmpty())
				return atol((const char *)pNVP->m_strValue);
		}
		else if (bThrowNotFound)
		{
			// throw key not found

		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found

	}

	return 0;
}
Пример #11
0
// function retrieves a boolean from the specified section
bool GProfile::GetBool(const char *szSectionName, const char *szKey, bool bThrowNotFound /* = true */)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		GProfileEntry *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if (!pNVP->m_strValue.IsEmpty())
			{
				if (pNVP->m_strValue.GetAt(0) == '1')
					return 1;
				if (pNVP->m_strValue.CompareNoCase("Yes") == 0)
					return 1;
				if (pNVP->m_strValue.CompareNoCase("On") == 0)
					return 1;
			}
			return 0;
		}
		else if (bThrowNotFound)
		{
			// throw key not found
			throw GException("Profile", 0, szSectionName, szKey);
		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found
		throw GException("Profile", 1, szSectionName);
	}

	return 0;
}
Пример #12
0
const char *GProfile::GetPath(const char *szSectionName, const char *szKey, bool bThrowNotFound)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		GProfileEntry *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if ( !( pNVP->m_strValue.Right(1) == "/" || pNVP->m_strValue.Right(1) == "\\") )
			{
		#ifdef _WIN32
				pNVP->m_strValue += "\\";
		#else
				pNVP->m_strValue += "/";
		#endif
			}
			return pNVP->m_strValue;
		}
		else if (bThrowNotFound)
		{
			// throw key not found
			throw GException("Profile", 0, szSectionName, szKey);
		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found
		throw GException("Profile", 1, szSectionName);
	}

	return 0;
}
Пример #13
0
void GProfile::SetString(const char *szSectionName, const char *szKey, const char *szValue)
{
	m_bCached = true;

	Section *pSection = FindSection(szSectionName);
	if (!pSection)
	{
		pSection = new Section;
		pSection->m_strName = szSectionName;
		pSection->m_strName.TrimLeftWS();
		pSection->m_strName.TrimRightWS();

		m_lstSections.AddLast(pSection);
	}

	if (pSection)
	{
		NameValuePair *pNVP = FindKey(szKey, pSection);
		if (!pNVP)
		{
			pNVP = new NameValuePair;
			pSection->m_lstNVP.AddLast(pNVP);
			pNVP->m_strName = szKey;
			pNVP->m_strName.TrimLeftWS();
			pNVP->m_strName.TrimRightWS();
		}
			
		if (pNVP)
		{
			pNVP->m_strValue = szValue;
			pNVP->m_strValue.TrimLeftWS();
			pNVP->m_strValue.TrimRightWS();
		}
	}
}
Пример #14
0
int	 GProfile::GetInt(const char *szSectionName, const char *szKey, bool bThrowNotFound/* = true*/)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		GProfileEntry *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if (!pNVP->m_strValue.IsEmpty())
				return atoi((const char *)pNVP->m_strValue);
		}
		else if (bThrowNotFound)
		{
			// throw key not found
			throw GException("Profile", 0, szSectionName, szKey);
		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found
		throw GException("Profile", 1, szSectionName);
	}

	return 0;
}
Пример #15
0
// function retrieves a boolean from the specified section
bool GProfile::GetBoolean(const char *szSectionName, const char *szKey, bool bThrowNotFound /* = true */)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		GProfileEntry *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if (pNVP->m_strValue.CompareNoCase("true") == 0 ||
				pNVP->m_strValue.CompareNoCase("on") == 0  ||
				pNVP->m_strValue.CompareNoCase("yes") == 0 ||
				pNVP->m_strValue.CompareNoCase("1") == 0)
			{
				return 1;
			}
			else
			{
				return 0;
			}
		}
		else if (bThrowNotFound)
		{
			// throw key not found
			throw GException("Profile", 0, szSectionName, szKey);
		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found
		throw GException("Profile", 1, szSectionName);
	}

	return 0;
}
Пример #16
0
// function retrieves a boolean from the specified section
short GProfile::GetBoolean(const char *szSectionName, const char *szKey, short bThrowNotFound /* = true */)
{
	Section *pSection = FindSection(szSectionName);
	if (pSection)
	{
		NameValuePair *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if (pNVP->m_strValue.CompareNoCase("true") == 0 ||
				pNVP->m_strValue.CompareNoCase("on") == 0  ||
				pNVP->m_strValue.CompareNoCase("yes") == 0 ||
				pNVP->m_strValue.CompareNoCase("1") == 0)
			{
				return 1;
			}
			else
			{
				return 0;
			}
		}
		else if (bThrowNotFound)
		{

		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found

	}

	return 0;
}
Пример #17
0
//--------------------------------------------------------------------------
// Replace or remove exif thumbnail
//--------------------------------------------------------------------------
int ReplaceThumbnail(const char * ThumbFileName)
{
    FILE * ThumbnailFile;
    int ThumbLen, NewExifSize;
    Section_t * ExifSection;
    uchar * ThumbnailPointer;

    if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){
        // Adding or removing of thumbnail is not possible - that would require rearranging
        // of the exif header, which is risky, and jhad doesn't know how to do.

        printf("Image contains no thumbnail to replace - add is not possible\n");
        return FALSE;
    }

    if (ThumbFileName){
        ThumbnailFile = fopen(ThumbFileName,"rb");

        if (ThumbnailFile == NULL){
            ErrFatal("Could not read thumbnail file");
            return FALSE;
        }

        // get length
        fseek(ThumbnailFile, 0, SEEK_END);

        ThumbLen = ftell(ThumbnailFile);
        fseek(ThumbnailFile, 0, SEEK_SET);

        if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){
            ErrFatal("Thumbnail is too large to insert into exif header");
        }
    }else{
        ThumbLen = 0;
        ThumbnailFile = NULL;
    }

    ExifSection = FindSection(M_EXIF);

    NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen;
    ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);

    ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;

    if (ThumbnailFile){
        fread(ThumbnailPointer, ThumbLen, 1, ThumbnailFile);
        fclose(ThumbnailFile);
    }

    ImageInfo.ThumbnailSize = ThumbLen;

    Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen);

    ExifSection->Data[0] = (uchar)(NewExifSize >> 8);
    ExifSection->Data[1] = (uchar)NewExifSize;
    ExifSection->Size = NewExifSize;

    return TRUE;
}
Пример #18
0
const GList *GProfile::GetSection(const char *szSectionName)
{
	Section *pSection = FindSection(szSectionName);

	if (pSection)
		return &pSection->m_lstNVP;
	
	return 0;
}
Пример #19
0
bool GProfile::DoesExist(const char *szSectionName)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		return 1;
	}
	return 0;
}
Пример #20
0
ElfSection*
ElfFile::GetSection(const char* name)
{
	ElfSection* section = FindSection(name);
	if (section != NULL && section->Load() == B_OK)
		return section;

	return NULL;
}
Пример #21
0
// returns the number of entries for a given section
__int64 GProfile::GetSectionEntryCount(const char *szSectionName)
{
	GProfileSection *pSection = FindSection(szSectionName);

	if (pSection)
		return pSection->m_lstNVP.Size();
	
	return 0;
}
Пример #22
0
bool CIniFile::FindKey  (CCHR *pSection, CCHR *pKey, EFIND *pList)
{
	char Search [130];
	char Found  [130];
	char Text   [255];
	char *pText;
	struct ENTRY *pEntry;
	pList->pSec        = NULL;
	pList->pKey        = NULL;
	pEntry = FindSection (pSection);
	if (pEntry == NULL) { return FALSE; }
	pList->pSec        = pEntry;
	pList->KeyText[0] = 0;
	pList->ValText[0] = 0;
	pList->Comment[0] = 0;
	pEntry = pEntry->pNext;
	if (pEntry == NULL) { return FALSE; }
	sprintf (Search, "%s",pKey);
	strupr  (Search);
	while (pEntry != NULL)
	{
		if ((pEntry->Type == tpSECTION) || // Stop after next section or EOF 
			(pEntry->Type == tpNULL   ))
		{
			return FALSE;
		}
		if (pEntry->Type == tpKEYVALUE)
		{
			strcpy (Text, pEntry->pText);
			pText = strchr (Text, ';');
			if (pText != NULL)
			{
				strcpy (pList->Comment, pText);
				*pText = 0;
			}
			pText = strchr (Text, '=');
			if (pText != NULL)
			{
				*pText = 0;
				strcpy (pList->KeyText, Text);
				strcpy (Found, Text);
				*pText = '=';
				strupr (Found);
				//            printf ("%s,%s\n", Search, Found); 
				if (strcmp (Found,Search) == 0)
				{
				   strcpy (pList->ValText, pText+1);
				   pList->pKey = pEntry;
				   return TRUE;
				}
			}
		}
		pEntry = pEntry->pNext;
	}
	return NULL;
}
Пример #23
0
GProfileSection *GProfile::RemoveSection(const char *szSection)
{
	GProfileSection *pS = FindSection(szSection);
	if (pS)
	{
		m_lstSections.Remove(pS);
		return pS;
	}
	return 0;
}
Пример #24
0
//--------------------------------------------------------------------
// @mfunc Tokenize the Provider info
//
// @rdesc BOOL
//      @flag TRUE | Parsing yielded no Error
//
BOOL CParseInitFile::ParseProviderInfo()
{
	//move to beginning of file
    seekg(0L);
	CHAR* pszStart = NULL;
	CHAR* pszEnd = NULL;
	CHAR szVersion[100];

	TRACE_CALL(L"PRIVLIB: CParseInitFile::ParseProviderInfo.\n");

	//Skip over any lines, until the [INFO] section is reached...
	//Make sure the INI contains the required version (at least)
	if( FindSection("[INFO]")==S_OK &&
		GetNextLine(m_pvInput, MAX_INPUT_BUFFER)==S_OK  &&
		(pszStart = strstr(m_pvInput, START_OF_TYPE)) &&
		(pszStart = strstr(pszStart, "VERSION=")) &&
		(pszStart = strstr(pszStart, ",")) &&
		(pszStart = strstr(pszStart+1, ",")) &&
		(pszEnd = strstr(pszStart+1, ",")) )
	{
		//Build Version is between 2nd and 3rd comma.  (1,50,3518,00)
		pszStart++;
		strncpy(szVersion, pszStart, (size_t)(pszEnd - pszStart));
		szVersion[pszEnd - pszStart] = '\0';
		ULONG ulVersion = strtoul(szVersion, NULL, 10);
		if(ulVersion == ULONG_MAX || ulVersion < 3518)
		{
			odtLog << "ERROR:  This version of the Privlib requires a INI File generated from " << ENDL;
			odtLog << "ERROR:  from TableDump.exe 1.50.3518.00 or later." << ENDL;
			return FALSE;
		}
	}
	else
	{
		odtLog << "ERROR:  Unable to find Versioning Information in INI <File:" << m_pszFileName << ">" << ENDL;
		odtLog << "ERROR:  This version of the Privlib requires a INI with a version section" << ENDL;
		odtLog << "ERROR:  and generated using a version of TableDump.exe 1.50.3518.00 or later." << ENDL;
		return FALSE;
	}

	//Get the NextLine {(TABLE=; DEFAULTQUERY=; DATASOURCE=; USERID=; PASSWORD=; etc... )}
	if(GetNextLine(m_pvInput, MAX_INPUT_BUFFER)!=S_OK ||
		(pszStart = strstr(m_pvInput, START_OF_TYPE))==NULL ||
		(pszStart = strstr(pszStart, "TABLE="))==NULL)
	{
		odtLog << "ERROR:  Unable to find InitString containing Initialization Information in INI <File:" << m_pszFileName << ">" << ENDL;
		odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;
		return FALSE;
	}
    
	//We just need to append the InitString from the FILE to the InitString 
	//Already stored in the CModInfo from LTM.  And we will parse both together...
	GetModInfo()->AddToInitString(pszStart);
	return  TRUE;
}
Пример #25
0
extern  void    CVDefSegs( void ){
/**************************/
    if( _IsModel( DBG_LOCALS ) ) {
        CVSyms = DbgSegDef( ".debug$S"  );
        CVSymMain = FindSection( CVSyms );
        owlCVSym = CVSymMain->owl_handle;
    }
    if( _IsModel( DBG_TYPES ) ) {
        CVTypes = DbgSegDef( ".debug$T" );
    }
}
Пример #26
0
ConfigSection* ConfigFile::GetEntry(string name)
{
	ConfigSection* c=FindSection(name);
	if (!c)
	{
		entrys=c= new ConfigSection(entrys);
		c->name=name;
	}

	return c;
}
Пример #27
0
//--------------------------------------------------------------------
// @mfunc Retrieve the data associated with a particular column. 
//
//
// @rdesc BOOL
//      @flag TRUE | Succeeded
//      @flag FALSE | Failed
//
BOOL CParseInitFile::ParseColumnInfo()
{
    HRESULT hr = S_OK;
	CHAR* pszStart = NULL;
	
	TRACE_CALL(L"PRIVLIB: CParseInitFile::ParseColumnInfo.\n");

	// If Column data has not been retrieved,
    if(m_ColData.IsEmpty())
	{
		//Skip over any lines, until the [COLUMN] section is reached...
		if(FAILED(hr = FindSection("[COLUMN]")))
			return FALSE;

		//Get the NextLine {ColName(iOrdinal, TYPE, ulColumnSize, bPrecision, bScale, dwFlags)} 
		if((hr = GetNextLine(m_pvInput, MAX_INPUT_BUFFER))!=S_OK)
		{
			odtLog << "ERROR:  Unable to find Columns in INI <File:" << m_pszFileName << ">" << ENDL;
			odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;
			return FALSE;
		}

		//Now parse the Columns
		m_ColData.RemoveAll();
			    
		// Parse the records
		while(hr==S_OK)
		{	
			pszStart = strstr(m_pvInput, START_OF_TYPE);
			if(pszStart)
			{
				// if we have reached [DATA] part bail out
				pszStart++;
				if(strncmp(pszStart, szDATA, 6) ==0)
					return TRUE;
			
				// parse the column metadata info
				if(!GetColumns(pszStart))
					break;
			}
			
			//Retrieve the next row
			if((hr = GetNextLine(m_pvInput, MAX_INPUT_BUFFER))!=S_OK)
			{
				odtLog << "ERROR:  Unable to finding ColumnInfo for Column " << m_ColData.GetCount() << " in INI <File:" << m_pszFileName << ">" << ENDL;
				odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;
				return FALSE;
			}
		}
    }

	return FALSE;
}
Пример #28
0
void dynLibImplLinux::GetImportAndExportData( 
	const char* dllName )
{
	if( std::string(dllName).empty())
	{
		return;
	}

	Elf* mainElf;
	struct link_map* mainLm;
	std::string csPath_o;
	OpenDynamicLibrary( dllName, mainElf, mainLm, csPath_o );
	if ( mainLm == NULL )
	{
		return;
	}

	Elf_Scn* section = 0;
	ElfW(Shdr) *shdr;
	FindSection( mainElf, SHT_DYNAMIC, section, shdr );

	std::list<std::string> dependencies;
	ExtractDynSymbols( mainElf, section, shdr, STT_NOTYPE, dependencies );

	std::list<std::string>::iterator it;
	for(it = dependencies.begin( ); it != dependencies.end( ) ; it++) {

		AddString( it->c_str() );

		if ( GetDllEntry( it->c_str()  ) == NULL )
		{
			DLL_ENTRY stImpExport;

			std::string csPath_o;
			if ( GetExportData( it->c_str(), stImpExport.ArrayExport, csPath_o ) )
			{
				stImpExport.m_bIsStable = true;
				stImpExport.m_csFullPath = csPath_o;

				// Add data to static internal map
				MakeUpper( *it );
				m_DataEntry[ *it ] = stImpExport;

			}

		}

		DeleteString( it->c_str() );
	}

	dlclose( mainLm );
}
Пример #29
0
IniSection* MIniFile::GetNextSection(const char* currentSectionName)
{
	int nIndex = FindSection(currentSectionName);
	if(-1 == nIndex)
		return 0;

	++nIndex;

	if(nIndex >= m_SectionList.size())
		return 0;

	return m_SectionList[nIndex];
}
Пример #30
0
bool GProfile::DoesExist(const char *szSectionName, const char *szKey)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		GProfileEntry *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			return 1;
		}
	}
	return 0;
}