Пример #1
0
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	bool						bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	IAAFIdentification			*pIdent = NULL;
	HRESULT						hr = S_OK;
	aafUInt32					readNumIdents, readNameLen;
	aafWChar					readBuf[256];
	aafUID_t					readUID;
	aafProductVersion_t			readVersion;

	try
	{
		// Open the file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = true;
		
		// We can't really do anthing in AAF without the header.
		checkResult(pFile->GetHeader(&pHeader));
		checkResult(pHeader->CountIdentifications(&readNumIdents));
		checkExpression(1 == readNumIdents, AAFRESULT_TEST_FAILED);
		checkResult(pHeader->GetLastIdentification (&pIdent));
		/***/
		checkResult(pIdent->GetCompanyNameBufLen (&readNameLen));
		checkExpression(readNameLen < 256, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetCompanyName (readBuf, readNameLen));
		checkExpression(wcscmp(COMPANY_NAME, readBuf) == 0, AAFRESULT_TEST_FAILED);
		/***/
		checkResult(pIdent->GetProductNameBufLen (&readNameLen));
		checkExpression(readNameLen < 256, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetProductName (readBuf, readNameLen));
		checkExpression(wcscmp(PRODUCT_NAME, readBuf) == 0, AAFRESULT_TEST_FAILED);
		/***/
		checkResult(pIdent->GetProductVersionStringBufLen (&readNameLen));
		checkExpression(readNameLen < 256, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetProductVersionString (readBuf, readNameLen));
		checkExpression(wcscmp(TEST_VERSION, readBuf) == 0, AAFRESULT_TEST_FAILED);
		/***/
		checkResult(pIdent->GetProductID(&readUID));
		checkExpression(memcmp(&readUID, &UnitTestProductID, sizeof(UnitTestProductID)) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetProductVersion(&readVersion));
		/***/
		checkExpression(readVersion.major == testVersion.major, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.minor == testVersion.minor, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.tertiary == testVersion.tertiary, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.patchLevel == testVersion.patchLevel, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.type == testVersion.type, AAFRESULT_TEST_FAILED);		
		checkResult(pFile->Close());
		bFileOpen = false;
		
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
	
	// Cleanup and return
		
	if (pHeader)
		pHeader->Release();
	
	if (pIdent)
		pIdent->Release();
	
	if (pFile)
	{	// Close file
		if (bFileOpen)
			pFile->Close();
		pFile->Release();
	}
	
	return hr;
}
Пример #2
0
static void ReadAAFFile(aafWChar * pFileName)
{
    HRESULT hr = S_OK;
    IAAFFile * pFile = NULL;

    hr = AAFFileOpenExistingRead (pFileName, AAF_FILE_MODE_LAZY_LOADING, &pFile);
    if (SUCCEEDED(hr))
    {
        IAAFHeader * pHeader = NULL;

        hr = pFile->GetHeader(&pHeader);
        check(hr); // display error message
        if (SUCCEEDED(hr))
        {
            IAAFIdentification *    pIdent = NULL;

            hr = pHeader->GetLastIdentification(&pIdent);
            check(hr); // display error message
            if (SUCCEEDED(hr))
            {
                printIdentification(pIdent);

                pIdent->Release();
                pIdent = NULL;

                // count Mobs
                aafNumSlots_t n;
                hr = pHeader->CountMobs(kAAFAllMob, &n);
                check(hr);
                printf("\nNumber of Mobs       = %d\n", n);

                // Header::Version, Header::ObjectModelVersion
                aafVersionType_t version = {0};
                check(pHeader->GetFileRevision (&version) );
                printf("\nHeader::Version      = %d.%d\n", version.major, version.minor);

                aafFileRev_t fileVersion = kAAFRev1;
                check(pFile->GetRevision (&fileVersion) );
                printf("\nHeader::ObjectModelVersion = %d", fileVersion);

                if (fileVersion == kAAFRev1)
                    printf(" (recognized as kAAFRev1)\n");
                else if (fileVersion == kAAFRev2)
                    printf(" (recognized as kAAFRev2)\n");
                else
                    printf("\n");

                // Show datadefs, with version
                IEnumAAFDataDefsSP pEnumDataDef;
                IAAFDictionarySP pDictionary;
                check(pHeader->GetDictionary(&pDictionary));
                check(pDictionary->GetDataDefs(&pEnumDataDef));
                IAAFDataDef* pDataDef;

                printf("\nDatadefs             = ");
                while (SUCCEEDED(pEnumDataDef->NextOne(&pDataDef)))
                {
                    IAAFDefObjectSP pDefObject;
                    check(pDataDef->QueryInterface(IID_IAAFDefObject, (void**)&pDefObject));
                    pDataDef->Release();
                    pDataDef = NULL;

                    aafUID_t id = {0};
                    check(pDefObject->GetAUID(&id));

                    aafWChar wchName[500];
                    char chName[1000];
                    check( pDefObject->GetName(wchName, sizeof (wchName)) );
                    convert(chName, sizeof(chName), wchName);

                    if (memcmp( &id, &kAAFDataDef_LegacyPicture, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as legacy Picture)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Picture, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Picture)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_LegacySound, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as legacy Sound)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Sound, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Sound)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_LegacyTimecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as legacy Timecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Timecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Timecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_PictureWithMatte, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as PictureWithMatte)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Edgecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Edgecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Auxiliary, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Auxiliary)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_DescriptiveMetadata, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as DescriptiveMetadata)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Matte, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Matte)\n", chName);
                    else
                        printf("\"%s\"\n", chName);
                    printf("                       ");
                }

                // Check if file contains TypeDefs known to cause a v1.0 reader to assert.
                // Known instances of this are UInt32Set and AUIDSet added to the v1.1 SDK.
                // Cannot use Dictionary::LookupTypeDef to check for them, because this
                // has the side effect of registering the typedef we are checking for
                // from the built-in model. Instead, iterate through typedefs (in file)
                // and check for the known instances.
                printf("\nTypes incompatible with SDK v1.0.x =");
                IEnumAAFTypeDefsSP pEnumTypeDef;
                check(pDictionary->GetTypeDefs(&pEnumTypeDef));
                IAAFTypeDef* pTypeDef;
                bool foundToxic = false;
                while (SUCCEEDED(pEnumTypeDef->NextOne(&pTypeDef)))
                {
                    IAAFMetaDefinitionSP pMetaDef;
                    check(pTypeDef->QueryInterface(IID_IAAFMetaDefinition, (void**)&pMetaDef));
                    pTypeDef->Release();
                    pTypeDef = NULL;

                    aafUID_t typeUID;
                    check(pMetaDef->GetAUID(&typeUID));

                    aafWChar wchName[500];
                    char chName[1000];
                    check( pMetaDef->GetName(wchName, sizeof (wchName)) );
                    convert(chName, sizeof(chName), wchName);

                    if ((memcmp( &typeUID, &kAAFTypeID_AUIDSet, sizeof(typeUID)) == 0)
                            || (memcmp( &typeUID, &kAAFTypeID_UInt32Set, sizeof(typeUID)) == 0))
                    {
                        printf(" %s", chName);
                        foundToxic = true;
                    }
                }
                if (!foundToxic)
                    printf(" (none)");
                printf("\n\n");

            }
            pHeader->Release();
            pHeader = NULL;
        }

        hr = pFile->Close();
        check(hr);

        pFile->Release();
        pFile = NULL;

        // Get file kind.
        // Since AAF SDK v1.0.2, the file kind actually identifies the implementation
        // of the file kind, from which the file kind is inferred.
        aafUID_t fileKind = {0};
        aafBool isAAFFile = kAAFFalse;

        check(AAFFileIsAAFFile(pFileName, &fileKind, &isAAFFile));
        if (isAAFFile)
        {
            if (memcmp( &fileKind, &kAAFFileKind_AafM512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with Microsoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafS512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with Schemasoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafG512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with GSF)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_Aaf512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with default implementation)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafM4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with Microsoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafS4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with Schemasoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafG4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with GSF)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_Aaf4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with default implementation)\n");
            else
                printf("Filekind             = Recognized by SDK but unknown to AAFInfo\n");
        }
    }
    else
    {
        fprintf(stderr, "Error : Failed to open file (result = %0x).\n", hr);
        exit(1);
    }
}
Пример #3
0
static HRESULT CreateAAFFile(
    aafWChar * pFileName,
    aafUID_constref fileKind,
    testRawStorageType_t rawStorageType)
{
	IAAFFile *					pFile = NULL;
	bool 						bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	IAAFDictionary				*pDictionary = NULL;
	IAAFIdentification			*pIdent = NULL;
	IAAFIdentification			*pTestIdent = NULL;
	aafUInt32					readNumIdents;
	char 						testName[35];
	aafCharacter 				*myBuffer;
	aafUInt32 					bufSize = 0;
	aafUInt32 					bufSize2 = 0;

	aafProductIdentification_t	ProductInfo;
	memset(&ProductInfo, 0, sizeof(ProductInfo));
	ProductInfo.companyName = const_cast<aafWChar*>(COMPANY_NAME);
	ProductInfo.productName = const_cast<aafWChar*>(PRODUCT_NAME);
	ProductInfo.productVersionString = const_cast<aafWChar*>(TEST_VERSION);
	ProductInfo.productID = UnitTestProductID;
	ProductInfo.productVersion = &testVersion;
	hr = S_OK;

	try 
	{
		// Remove the previous test file if any.
		RemoveTestFile(pFileName);
				
		// Create the file.
		checkResult(CreateTestFile(pFileName, fileKind,
				rawStorageType, ProductInfo, &pFile));
		bFileOpen = true;
		
		// We can't really do anthing in AAF without the header.
		checkResult(pFile->GetHeader(&pHeader));
		
 	    checkResult(pHeader->GetDictionary(&pDictionary));
	    CAAFBuiltinDefs defs (pDictionary);
		
		checkResult(pHeader->CountIdentifications(&readNumIdents));
		checkExpression(1 == readNumIdents, AAFRESULT_TEST_FAILED);
		checkResult(pHeader->GetLastIdentification (&pIdent));

		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	

	/* Initialize */
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "Initialize()");
		TestMethod(pTestIdent->Initialize(NULL,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   NULL,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   NULL,
									   UnitTestProductID), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_ALREADY_INITIALIZED);									   
		pTestIdent->Release();
		PrintTestResult(testName);
									   

	/* GetCompanyNameBufLen *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetCompanyNameBufLen()");
		bufSize = sizeof(COMPANY_NAME);
		bufSize2 = 0;
		TestMethod(pIdent->GetCompanyNameBufLen(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetCompanyNameBufLen(&bufSize2), AAFRESULT_SUCCESS);
		if (bufSize != bufSize2)
			localhr = AAFRESULT_TEST_FAILED;
		
		PrintTestResult(testName);

	/* GetCompanyName *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetCompanyName()");
		myBuffer = new aafCharacter [bufSize];
		TestMethod(pIdent->GetCompanyName(NULL, bufSize), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetCompanyName(myBuffer, bufSize-1), AAFRESULT_SMALLBUF);
		TestMethod(pIdent->GetCompanyName(myBuffer, bufSize), AAFRESULT_SUCCESS);
		if (wcscmp(myBuffer, COMPANY_NAME))
			localhr = AAFRESULT_TEST_FAILED;
								
		delete [] myBuffer;

		PrintTestResult(testName);		

	/* GetProductNameBufLen *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetProductNameBufLen()");
		bufSize = sizeof(PRODUCT_NAME);
		bufSize2 = 0;
		TestMethod(pIdent->GetProductNameBufLen(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetProductNameBufLen(&bufSize2), AAFRESULT_SUCCESS);
		if (bufSize != bufSize2)
			localhr = AAFRESULT_TEST_FAILED;
		
		PrintTestResult(testName);

	/* GetProductName *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetProductName()");
		myBuffer = new aafCharacter [bufSize];
		TestMethod(pIdent->GetProductName(NULL, bufSize), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetProductName(myBuffer, bufSize-1), AAFRESULT_SMALLBUF);
		TestMethod(pIdent->GetProductName(myBuffer, bufSize), AAFRESULT_SUCCESS);
		if (wcscmp(myBuffer, PRODUCT_NAME))
			localhr = AAFRESULT_TEST_FAILED;
							
		delete [] myBuffer;

		PrintTestResult(testName);
		
	/* GetProductVersionStringBufLen *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetProductVersionStringBufLen()");
		bufSize = sizeof(TEST_VERSION);
		bufSize2 = 0;
		TestMethod(pIdent->GetProductVersionStringBufLen(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetProductVersionStringBufLen(&bufSize2), AAFRESULT_SUCCESS);
		if (bufSize != bufSize2)
			localhr = AAFRESULT_TEST_FAILED;
		
		PrintTestResult(testName);

	/* GetProductVersionString *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetProductVersionString()");
		myBuffer = new aafCharacter [bufSize];
		TestMethod(pIdent->GetProductVersionString(NULL, bufSize), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetProductVersionString(myBuffer, bufSize-1), AAFRESULT_SMALLBUF);
		TestMethod(pIdent->GetProductVersionString(myBuffer, bufSize), AAFRESULT_SUCCESS);	
		if (wcscmp(myBuffer, TEST_VERSION))
			localhr = AAFRESULT_TEST_FAILED;
					
		delete [] myBuffer;

		PrintTestResult(testName);

	/* SetProductVersion *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "SetProductVersion()");

		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	

		TestMethod(pTestIdent->SetProductVersion(testVersion), AAFRESULT_NOT_INITIALIZED);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);
		TestMethod(pTestIdent->SetProductVersion(testVersion), AAFRESULT_SUCCESS);
		TestMethod(pIdent->SetProductVersion(testVersion), AAFRESULT_SUCCESS);
			
		pTestIdent->Release();
		PrintTestResult(testName);

	/* GetProductVersion *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetProductVersion()");
		aafProductVersion_t productVersion;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	

		TestMethod(pTestIdent->GetProductVersion(&productVersion), AAFRESULT_NOT_INITIALIZED);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);
									   
		TestMethod(pTestIdent->GetProductVersion(&productVersion), AAFRESULT_PROP_NOT_PRESENT);
		TestMethod(pTestIdent->SetProductVersion(testVersion), AAFRESULT_SUCCESS);

		TestMethod(pTestIdent->GetProductVersion(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->GetProductVersion(&productVersion), AAFRESULT_SUCCESS);
		if (productVersion.major != testVersion.major ||
			productVersion.minor != testVersion.minor ||
			productVersion.tertiary != testVersion.tertiary ||
			productVersion.patchLevel != testVersion.patchLevel ||
			productVersion.type != testVersion.type)
			localhr = AAFRESULT_TEST_FAILED;	


		pTestIdent->Release();
		PrintTestResult(testName);
		
	/* GetPlatformBufLen *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetPlatformBufLen()");
		TestMethod(pIdent->GetPlatformBufLen(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetPlatformBufLen(&bufSize), AAFRESULT_SUCCESS);
		
		if (bufSize != sizeof(PLATFORM_STRING))
			localhr = AAFRESULT_TEST_FAILED;

		PrintTestResult(testName);

	/* GetPlatform *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetPlatform()");
		myBuffer = new aafCharacter [bufSize];
		TestMethod(pIdent->GetPlatform(NULL, bufSize), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetPlatform(myBuffer, bufSize-1), AAFRESULT_SMALLBUF);
		TestMethod(pIdent->GetPlatform(myBuffer, bufSize), AAFRESULT_SUCCESS);

		if (wcscmp(myBuffer, PLATFORM_STRING))
			localhr = AAFRESULT_TEST_FAILED;
							
		delete [] myBuffer;

		PrintTestResult(testName);


	/* GetProductID *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetProductID()");
		aafUID_t thisProductID;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	
		TestMethod(pTestIdent->GetProductID(&thisProductID), AAFRESULT_NOT_INITIALIZED);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);
									   
		TestMethod(pTestIdent->GetProductID(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->GetProductID(&thisProductID), AAFRESULT_SUCCESS);
		
		if (memcmp(&UnitTestProductID, &thisProductID, sizeof(UnitTestProductID)) != 0)
			localhr = AAFRESULT_TEST_FAILED;
			
		pTestIdent->Release();
		PrintTestResult(testName);

	/* GetRefImplVersion *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetRefImplVersion()");
		aafProductVersion_t refImplVersion;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	
		TestMethod(pTestIdent->GetRefImplVersion(&refImplVersion), AAFRESULT_NOT_INITIALIZED);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);

		TestMethod(pTestIdent->GetRefImplVersion(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->GetRefImplVersion(&refImplVersion), AAFRESULT_SUCCESS);
		
		pTestIdent->Release();
		PrintTestResult(testName);


	/* GetDate *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetDate()");
		aafTimeStamp_t timeStamp;
		aafTimeStamp_t startTimeStamp;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	
		TestMethod(pTestIdent->GetDate(&timeStamp), AAFRESULT_NOT_INITIALIZED);

		GetDateTime (&startTimeStamp);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);

		TestMethod(pTestIdent->GetDate(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->GetDate(&timeStamp), AAFRESULT_SUCCESS);

		if (timeStamp.date.year != startTimeStamp.date.year ||
			timeStamp.date.month != startTimeStamp.date.month ||
			timeStamp.date.day != startTimeStamp.date.day)
			localhr = AAFRESULT_TEST_FAILED;

		if (timeStamp.time.hour != startTimeStamp.time.hour ||
			timeStamp.time.minute != startTimeStamp.time.minute ||
			timeStamp.time.second != startTimeStamp.time.second)
			localhr = AAFRESULT_TEST_FAILED;

		pTestIdent->Release();
		PrintTestResult(testName);


	/* GetGeneration *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetGeneration()");
		aafUID_t generation;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	
		TestMethod(pTestIdent->GetGenerationID(&generation), AAFRESULT_NOT_INITIALIZED);

		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);

		TestMethod(pIdent->GetGenerationID(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetGenerationID(&generation), AAFRESULT_SUCCESS);
		
		pTestIdent->Release();
		PrintTestResult(testName);

		
		// Attempt to save the file.
		checkResult(pFile->Save());
		
		// Attempt to close the file.
		checkResult(pFile->Close());
		bFileOpen = false;
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
	
	// Cleanup and return
	if (pIdent)
		pIdent->Release();
	
	if (pHeader)
		pHeader->Release();
	
	if (pDictionary)
		pDictionary->Release();

	if (pFile)
	{	// Close file
		if (bFileOpen)
		{
			pFile->Save();
			pFile->Close();
		}
		pFile->Release();
	}
	
	return hr;
}