Exemplo n.º 1
0
	PGPError 
PFLNewFileSpecFromFullPath(
	PGPMemoryMgrRef		memoryMgr,
	char const *		path,
	PFLFileSpecRef *	outRef )
{
	PFLFileSpecRef	newFileRef	= NULL;
	PGPError		err	= kPGPError_NoErr;
	
	PGPValidatePtr( outRef );
	*outRef	= NULL;
	PGPValidateMemoryMgr( memoryMgr );
	
	err	= pgpNewFileSpec( memoryMgr, kPFLFileSpecFullPathType,
			strlen(path) + 1, &newFileRef );
	if ( IsntPGPError( err ) )
	{
		MyData *	myData	= GetMyData( newFileRef );
		
		strcpy( myData->path, path );
	}
	
	*outRef	= newFileRef;
	return err;
}
Exemplo n.º 2
0
	static PGPError
sCreateProc( PFLFileSpecRef ref )
{
	PGPError		err	= kPGPError_NoErr;
	char const *	path	= GetMyData( ref )->path;
	
#if PGP_UNIX	/* [ */
	int			fileDes;
	
	/*
	 * XXX Beware that calling this routine could be a security flaw,
	 *     because there is a window between creating and opening
	 *     the file, in between which the file might have been moved
	 *     out of the way, thus possibly having you open a new file
	 *     with the wrong permissions.
	 */
	fileDes = open( path, O_WRONLY | O_CREAT | O_EXCL, 0600 );
	if (fileDes > 0)
		close( fileDes );
	else
		err = kPGPError_FileOpFailed;
#else	/* ] PGP_UNIX [ */
	FILE *		stdIOFile;
	
	stdIOFile = fopen( path, "ab+");
	if ( NULL!=(int)( stdIOFile ) )
		fclose(stdIOFile);
	else
		err = kPGPError_FileOpFailed;
#endif	/* ] PGP_UNIX */

	return( err );
}
Exemplo n.º 3
0
	static PGPError
sRenameProc(
	PFLFileSpecRef	ref,
	const char *	newName)
{
	PGPError		err	= kPGPError_NoErr;
	MyData *		myData	= GetMyData( ref );
	PGPUInt32		nameLength;
	Str255			pascalName;
	
	if ( myData->specIsValid )
	{
		nameLength	= strlen( newName );
		PGPValidateParam( nameLength <= 31 );
		
		pgpCopyMemory( newName, &pascalName[ 1 ], nameLength );
		pascalName[ 0 ]	= nameLength;
		
		err	= FSpRename( &myData->spec, pascalName );
		if ( IsntPGPError( err ) )
		{
			err	= sSetNameProc( ref, newName );
		}
		else if ( err == fnfErr )
			err	= kPGPError_FileNotFound;
		else
			err	= kPGPError_FileOpFailed;
	}
	else
	{
		err	= kPGPError_FileNotFound;
	}
	
	return( err );
}
Exemplo n.º 4
0
	PGPError 
PFLGetFullPathFromFileSpec(
	PFLConstFileSpecRef		fileRef,
	char **					fullPathPtr)
{
	PGPError		err = kPGPError_NoErr;
	char const *	srcPath;
	char *			newPath	= NULL;
	MyData *		myData	= GetMyData( fileRef );

	PGPValidatePtr( fullPathPtr );
	*fullPathPtr	= NULL;
	PFLValidateFileSpec( fileRef );
	PGPValidateParam( fileRef->type == kPFLFileSpecFullPathType );
	
	srcPath	= myData->path;

	newPath = (char *)PGPNewData( fileRef->memoryMgr,
				strlen( myData->path ) + 1, 0);
	
	if ( NULL!=(int)( newPath ) )
		strcpy( newPath, myData->path );
	else
		err	= kPGPError_OutOfMemory;
	
	*fullPathPtr	= newPath;
	
	return err;
}
Exemplo n.º 5
0
	static PGPError
sCreateProc( PFLFileSpecRef ref )
{
	PGPError		err	= kPGPError_NoErr;
	OSStatus		macErr	= noErr;
	MyData *		myData	= GetMyData( ref );
	OSType			fileCreator;
	OSType			fileType;

	fileCreator	= myData->metaInfo.fInfo.fileCreator;
	fileType	= myData->metaInfo.fInfo.fileType;
	
	if( myData->specIsValid )
	{
		macErr = FSpCreate( &myData->spec, fileCreator, fileType, smSystemScript );
		if ( macErr != noErr )
		{
			err	= kPGPError_FileOpFailed;
		}
	}
	else
	{
		err	= kPGPError_FileOpFailed;
	}
	
	return( err );
}
Exemplo n.º 6
0
/*____________________________________________________________________________
	Export a C string which is the entire path.
____________________________________________________________________________*/
	static PGPError
sExportProc(
	PFLConstFileSpecRef	ref,
	PGPByte **			dataOut,
	PGPSize *			dataSizeOut )
{
	PGPUInt32			dataSize;
	PGPError			err	= kPGPError_NoErr;
	char *				exported	= NULL;
	char const *		srcName;
	
	srcName		= GetMyData( ref )->path;
	dataSize	= strlen( srcName ) + 1;	/* yes, include the NULL char */
	
	exported	= (char *)PGPNewData( ref->memoryMgr, dataSize, 0);
	if ( NULL!=(int)( exported ) )
	{
		strcpy( exported, srcName );
	}
	else
	{
		err	= kPGPError_OutOfMemory;
	}
	
	pgpAssert( dataSize == strlen( srcName ) + 1 );
	*dataOut		= (PGPByte *)exported;
	*dataSizeOut	= dataSize;
	
	return( err);
}
Exemplo n.º 7
0
	PGPError
pgpPlatformGetFileInfo(
	PFLConstFileSpecRef	spec,
	PFLFileInfo *		outInfo )
{
	PGPError		err		= kPGPError_NoErr;
	const char *	path	= GetMyData( spec )->path;
	struct stat		statInfo;

	PGPValidateParam( spec->type == kPFLFileSpecFullPathType );
	if ( stat( path, &statInfo ) != 0 )
	{
		err = kPGPError_FileOpFailed;
	}
	else
	{
		outInfo->flags = 0;
		if ( PGP_ISDIR( statInfo.st_mode ) )
			outInfo->flags |= kPGPFileInfo_IsDirectory;
		if ( PGP_ISREG( statInfo.st_mode ) )
		{
			outInfo->flags |= kPGPFileInfo_IsPlainFile;
			outInfo->dataLength = statInfo.st_size;
		}
		else
		{
			outInfo->dataLength = 0;
		}
		outInfo->modificationTime = statInfo.st_mtime;
	}
	
	return err;
}
Exemplo n.º 8
0
	static PGPError
sSetNameProc(
	PFLFileSpecRef		ref,
	char const *		name )
{
	PGPError	err		= kPGPError_NoErr;
	MyData *	myData	= GetMyData( ref );
	PGPUInt32	nameLength;
	
	PGPValidatePtr( myData );
	nameLength	= strlen( name );
	PGPValidateParam( nameLength <= sizeof( myData->spec.name ) - 1 );
	
	if ( nameLength > sizeof( myData->spec.name ) - 1 )
	{
		err = kPGPError_BufferTooSmall;
	}
	else
	{
		pgpCopyMemory( name, &myData->spec.name[ 1 ], nameLength );
		myData->spec.name[ 0 ]	= nameLength;
	}
	
	return( err );

}
Exemplo n.º 9
0
/*____________________________________________________________________________
	The imported data should be a NULL-terminated C string
____________________________________________________________________________*/
	static PGPError
sImportProc(
	PFLFileSpecRef		ref,
	PGPByte const *		importData,
	PGPSize				importDataSize )
{
	PGPError		err		= kPGPError_NoErr;
	char const *	importedPath;
	MyData *		myData	= NULL;

	importedPath	= (char const *)importData;
	/* data should be a C string (NULL-terminated)  */
	PGPValidateParam( importedPath[ importDataSize - 1 ] == '\0' );
	pgpAssert( strlen( importedPath ) == importDataSize - 1 );
	
	err	= PGPReallocData( ref->memoryMgr, &ref->data, importDataSize, 0 );
	
	if ( IsntPGPError( err ) )
	{
		myData	= GetMyData( ref );
		ref->dataSize	= importDataSize;
		
		pgpAssert( ref->dataSize == strlen( importedPath ) + 1 );
		strcpy( myData->path, importedPath );
	}
	
	return( err);
}
Exemplo n.º 10
0
	static PGPError
sImportProc(
	PFLFileSpecRef		ref,
	PGPByte const *		data,
	PGPSize				dataSize )
{
	const ExportedFileSpec *	exportedData;
	MyData *					newData	= NULL;
	PGPError					err	= kPGPError_NoErr;

	(void) dataSize;
	
	exportedData	= (const ExportedFileSpec *)data;
	newData			= GetMyData( ref );
	
	err	= PGPReallocData( ref->memoryMgr,
			&newData, sizeof( *newData ), 0 );
	if ( IsntPGPError( err ) )
	{
		MyData *		myData	= (MyData *)newData;
		
		ref->data		= (PGPByte *)newData;
		ref->dataSize	= sizeof( *newData );
		
		myData->specIsValid 	= FALSE;
		
		CopyPString( exportedData->name, myData->spec.name );
		
		if( exportedData->aliasDataSize != 0 )
		{
			AliasHandle	alias;
			
			if( PtrToHand( &exportedData->aliasData[0], (Handle *) &alias,
						exportedData->aliasDataSize ) == noErr )
			{
				FSSpec	spec;
				short	aliasCount = 1;
				Boolean	needsUpdate;
				
				if( MatchAlias( NULL, kARMNoUI | kARMSearch,
						alias, &aliasCount, &spec, &needsUpdate, NULL, NULL ) == noErr )
				{
					CInfoPBRec	cpb;
					
					if( FSpGetCatInfo( &spec, &cpb ) == noErr )
					{
						myData->specIsValid = TRUE;
					
						myData->spec.vRefNum 	= spec.vRefNum;
						myData->spec.parID 		= cpb.dirInfo.ioDrDirID;
					}
				}
				
				DisposeHandle( (Handle) alias );
			}
		}
	}
	
	return( err );
}
Exemplo n.º 11
0
	static PGPError
sParentDirProc(
	PFLConstFileSpecRef		fileFromDir,
	PFLFileSpecRef *		outParent )
{
	PGPMemoryMgrRef	memoryMgr		= fileFromDir->memoryMgr;
	PFLFileSpecRef	newFileRef	= NULL;
	PGPError		err			= kPGPError_NoErr;
	char *			path		= NULL;
	PGPUInt32		nameOffset;
	
	PGPValidatePtr( outParent );
	*outParent	= NULL;
	PGPValidateParam( PGPMemoryMgrIsValid( memoryMgr ) );

	path		= (char *)fileFromDir->data;
	nameOffset	= pgpFileNameTail( path ) - path;

	if (nameOffset <= 1)	/* There is no parent directory */
		return kPGPError_FileNotFound;	/* XXX Reasonable error code? */
	
	err	= pgpNewFileSpec( memoryMgr, kPFLFileSpecFullPathType,
				nameOffset, &newFileRef );
	if ( IsntPGPError( err ) )
	{
		MyData *	myData	= GetMyData( newFileRef );
		
		pgpCopyMemory( path, myData->path, nameOffset - 1 );
		myData->path[nameOffset - 1] = '\0';
	}
	
	*outParent	= newFileRef;
	return err;
}
void ProviderD3D10Impl::CreateAccessorD3D10BufferWrite(MemoryObject *resource, AccessorD3D10BufferWrite **result, UINT d3dBindFlags, Processor *p)
{
    AutoPtr<AccessorD3D10BufferWriteImpl> tmp(new AccessorD3D10BufferWriteImpl(GetMyData(resource), d3dBindFlags));
    DetachRawPtr(tmp, result);

    assert(!resource->GetProcessor());
    resource->GetProviderBinding()->SetProcessor(p);
}
Exemplo n.º 13
0
	static PGPError
sDeleteProc( PFLConstFileSpecRef ref )
{
	PGPError		err	= kPGPError_NoErr;
	const char *	path	= GetMyData( ref )->path;
	
	if ( remove( path ) != 0 )
		err = kPGPError_FileOpFailed;
	
	return( err );
}
Exemplo n.º 14
0
	static PGPError
sRenameProc(
	PFLFileSpecRef	ref,
	const char *	newName)
{
	PGPError		err	= kPGPError_NoErr;
	MyData *		oldDataCopy	= NULL;
	PGPMemoryMgrRef	memoryMgr	= ref->memoryMgr;
	
	/* save the old data in case the rename fails */
	/* also needed for rename (see below) */
	oldDataCopy	= (MyData *)PGPNewData( memoryMgr,
					MyDataSize( ref ), 0);
	if ( NULL!=(int)( oldDataCopy ) )
	{
		pgpCopyMemory( GetMyData( ref ),
			oldDataCopy, MyDataSize( ref ) );

		/* this changes the current data */
		err	= sSetNameProc( ref, newName );
		
		if ( rename( oldDataCopy->path, GetMyData( ref )->path ) != 0)
		{
			err = kPGPError_FileOpFailed;		/* XXX Improve error */
			/* put old path back in place of new one */
			PGPFreeData( GetMyData( ref ) );
			SetMyData( ref, oldDataCopy );
		}
		else
		{
			PGPFreeData( oldDataCopy );
		}
	}
	else
	{
		err	= kPGPError_OutOfMemory;
	}
	
	return( err );
}
Exemplo n.º 15
0
	static PGPError
sGetMaxNameLengthProc(
	PFLConstFileSpecRef	ref,
	PGPSize *		maxNameLength )
{
	const MyData *	myData	= GetMyData( ref );
	
	PGPValidatePtr( myData );
	
	/* at some point, this will need to be done programmatically by
	examining the file system in use which the file is  on */
	*maxNameLength	= kMaxHFSFileNameLength;
	
	return( kPGPError_NoErr );
}
Exemplo n.º 16
0
	static PGPError
sSetMetaInfoProc(
	PFLFileSpecRef	ref,
	void const *	infoIn )
{
	PGPError	err	= kPGPError_NoErr;
	MyData *	myData	= GetMyData( ref );
	PFLFileSpecMacMetaInfo const *	info;
	
	info	= (PFLFileSpecMacMetaInfo const *)infoIn;
	pgpAssert( info->fInfo.reserved == 0 );
	
	myData->metaInfo	= *info;
	
	return( err );
}
Exemplo n.º 17
0
	static PGPError
sGetNameProc(
	PFLConstFileSpecRef	ref,
	char				name[ 256 ] )
{
	const MyData *	myData	= GetMyData( ref );
	const FSSpec *	spec;
	
	PGPValidatePtr( myData );
	spec	= &myData->spec;
	PGPValidateParam( StrLength( spec->name ) <= 31 );
	
	pgpCopyMemory( &spec->name[ 1 ], name, StrLength( spec->name ) );
	name[ StrLength( spec->name ) ]	= '\0';
	
	return( kPGPError_NoErr );
}
Exemplo n.º 18
0
	static PGPError
sExistsProc(
	PFLFileSpecRef	ref,
	PGPBoolean *	exists)
{
	PGPError		err	= kPGPError_NoErr;
	MyData const *	myData = GetMyData( ref );
	FILE *			stdIOFile;

	/* Open the file read-only. If file doesn't exit, fopen fails */

	stdIOFile = fopen( myData->path, "rb" );
	if ( NULL!=(int)( stdIOFile ) )
	{
		fclose(stdIOFile);
		*exists = TRUE;
	}
#ifdef EACCES
	else if ( errno == EACCES )
	{
#if PGP_WIN32
		err = kPGPError_CantOpenFile;
#endif
		*exists = TRUE;
	}
#endif
#ifdef ENOENT
	else if ( errno == ENOENT )
		*exists = FALSE;
#endif
#ifdef EAGAIN
	else if ( errno == EAGAIN )
		*exists = FALSE;
#endif
#if 1   /* FOPEN_ERRNO_ZERO */
	else if ( errno == 0 )
		*exists = FALSE;
#endif
	else
	{
		pgpDebugMsg( "pgpFileSpecStd.c:sExistsProc(): unknown errno" );
		err = kPGPError_CantOpenFile;
	}

	return( err );
}
Exemplo n.º 19
0
	static PGPError
sParentDirProc(
	PFLConstFileSpecRef	ref,
	PFLFileSpecRef *	outParent )
{
	PGPError		err		= kPGPError_NoErr;
	MyData *		myData;
	FSSpec			spec;
	HFileInfo		pb;

	PGPValidateParam( ref->type == kPFLFileSpecMacType );

	myData	= GetMyData( ref );
	spec	= myData->spec;
	
	if( myData->specIsValid )
	{
		pb.ioNamePtr = spec.name;
		pb.ioVRefNum = spec.vRefNum;
		pb.ioDirID = spec.parID;
		pb.ioFDirIndex = -1;
		
		if ( PBGetCatInfoSync( (CInfoPBPtr)&pb ) != noErr )
		{
			if ( pb.ioResult == fnfErr )
				err	= kPGPError_FileNotFound;
			else
				err	= kPGPError_FileOpFailed;
		}
		else
		{
			spec.vRefNum = pb.ioVRefNum;
			spec.parID = pb.ioFlParID;
			err = PFLNewFileSpecFromFSSpec( ref->memoryMgr, &spec, outParent );
		}
	}
	else
	{
		err = kPGPError_FileNotFound;
	}
	
	return( err );
}
Exemplo n.º 20
0
	PGPError 
PFLNewFileSpecFromFSSpec(
	PGPMemoryMgrRef		memoryMgr,
	FSSpec const *		spec,
	PFLFileSpecRef *	outRef )
{
	PFLFileSpecRef	newFileRef	= NULL;
	PGPError		err	= kPGPError_NoErr;
	
	PGPValidatePtr( outRef );
	*outRef	= NULL;
	PGPValidateMemoryMgr( memoryMgr );
	PGPValidatePtr( spec );
	PGPValidateParam( spec->vRefNum < 0 && spec->parID != 0 &&
		spec->name[ 0 ] != 0 && spec->name[ 0 ] <= 31 );
	
	err	= pgpNewFileSpec( memoryMgr, kPFLFileSpecMacType,
		sizeof( MyData ), &newFileRef );
	if ( IsntPGPError( err ) )
	{
		MyData *	myData	= GetMyData( newFileRef );
		
		pgpClearMemory( myData, sizeof( *myData ) );
		myData->spec			= *spec;
		
		/* volume info not used if vRefNumIsValid */
		myData->specIsValid	= TRUE;

		if( FSpGetFInfo( spec, (FInfo *) &myData->metaInfo.fInfo ) != noErr )
		{
			myData->metaInfo.fInfo.fileType 		= 'BINA';
			myData->metaInfo.fInfo.fileCreator 		= '????';
			myData->metaInfo.fInfo.finderFlags 		= 0;
			myData->metaInfo.fInfo.location.h 		= -1;
			myData->metaInfo.fInfo.location.v 		= -1;
			myData->metaInfo.fInfo.reserved			= 0;
		}
	}
	
	*outRef	= newFileRef;
	return err;
}
Exemplo n.º 21
0
	static PGPError
sExistsProc(
	PFLFileSpecRef	ref,
	PGPBoolean *	exists)
{
	PGPError	err	= kPGPError_NoErr;
	MyData *	myData	= GetMyData( ref );
	FInfo		fInfo;
	
	if ( myData->specIsValid )
	{
		err		= FSpGetFInfo( &myData->spec, &fInfo );
		*exists	= ( err == noErr );
	}
	else
	{
		*exists	= FALSE;
	}
	
	return( kPGPError_NoErr );
}
Exemplo n.º 22
0
	static PGPError
sDeleteProc( PFLConstFileSpecRef ref )
{
	PGPError		err	= kPGPError_NoErr;
	MyData *		myData	= GetMyData( ref );
	
	if ( myData->specIsValid )
	{
		err	= FSpDelete( &myData->spec );
		if ( err == fnfErr )
			err	= kPGPError_FileNotFound;
		else if ( IsPGPError( err ) )
			err	= kPGPError_FileOpFailed;
	}
	else
	{
		err	= kPGPError_FileNotFound;
	}
	
	return( err );
}
Exemplo n.º 23
0
	static PGPError
sComposeProc(
	PFLConstFileSpecRef	parent,
	const char *		fileName,
	PFLFileSpecRef *	outRef )
{
	PGPMemoryMgrRef	memoryMgr		= parent->memoryMgr;
	PFLFileSpecRef	newFileRef	= NULL;
	PGPError		err			= kPGPError_NoErr;
	char *			path		= NULL;
	PGPSize			pathLength;
	
	PGPValidatePtr( outRef );
	*outRef	= NULL;
	PGPValidateParam( PGPMemoryMgrIsValid( memoryMgr ) );

	path	= (char *)parent->data;
	pathLength	= strlen( path );
	if ( pathLength > 0 && NULL!=(int)( strchr( kDirectorySeparators,
											 path[ pathLength - 1 ] ) ) )
	{
		pathLength--;
	}

	err	= pgpNewFileSpec( memoryMgr, kPFLFileSpecFullPathType,
				pathLength + strlen( fileName ) + 2, &newFileRef );
	if ( IsntPGPError( err ) )
	{
		MyData *	myData	= GetMyData( newFileRef );
		
		pgpCopyMemory( path, myData->path, pathLength );
		myData->path[ pathLength ] = kDirectorySeparators[0];
		strcpy( myData->path + pathLength + 1, fileName );
	}
	
	*outRef	= newFileRef;
	return err;
}
Exemplo n.º 24
0
	static PGPError
GetSpec(
	PFLConstFileSpecRef	ref,
	FSSpec				*fileSpec,
	CInfoPBRec			*fileInfo)
{
	MyData 		*myData;
	PGPError	err = kPGPError_NoErr;
	
	PGPValidateParam( ref->type == kPFLFileSpecMacType );

	myData = GetMyData( ref );
	if( myData->specIsValid )
	{
		*fileSpec = myData->spec;
		
		if( fileInfo != NULL )
		{
			OSStatus	macErr;
			
			macErr = FSpGetCatInfo( fileSpec, fileInfo );
			if ( macErr == fnfErr )
			{
				err	= kPGPError_FileNotFound;
			}
			else if( macErr != noErr )
			{
				err	= kPGPError_FileOpFailed;
			}
		}	
	}
	else
	{
		err = kPGPError_FileNotFound;
	}
	
	return( err );
}
Exemplo n.º 25
0
	PGPError
pgpPlatformNewDirectoryIter(
	PFLConstFileSpecRef		parentDir,
	PFLDirectoryIterRef *	outIter )
{
	PGPMemoryMgrRef			memoryMgr		= parentDir->memoryMgr;
	const char *			path		= GetMyData( parentDir )->path;
	PFLDirectoryIterRef		newIter		= NULL;
	PGPError				err			= kPGPError_NoErr;

	*outIter = NULL;
	PGPValidateParam( parentDir->type == kPFLFileSpecFullPathType );
	PGPValidateParam( PGPMemoryMgrIsValid( memoryMgr ) );

	newIter = (PFLDirectoryIterRef)PGPNewData( memoryMgr,
										sizeof( *newIter ), 0 );
	if ( NULL!=(int)( newIter ) )
	{
		newIter->memoryMgr = memoryMgr;
		newIter->dirRef = opendir( path );
		if ( NULL==(int)( newIter->dirRef ) )
			err = kPGPError_FileOpFailed;	/* XXX Better error code? */
		else
			err = PFLCopyFileSpec( parentDir, &newIter->parentDir );
	}
	else
	{
		err = kPGPError_OutOfMemory;
	}
	
	if ( IsntPGPError( err ) )
		*outIter = newIter;
	else if ( NULL!=(int)( newIter ) )
		PGPFreeData( newIter );

	return err;
}
void ProviderD3D10Impl::CreateAccessorD3D10BufferRead(MemoryObject *resource, AccessorD3D10BufferRead **result, UINT d3dBindFlags)
{
    assert(0 == (d3dBindFlags & D3D10_BIND_SHADER_RESOURCE)); // use CreateAccessorD3D10BufferSRV instead
    AutoPtr<AccessorD3D10BufferReadImpl> tmp(new AccessorD3D10BufferReadImpl(GetMyData(resource), d3dBindFlags));
    DetachRawPtr(tmp, result);
}
void ProviderD3D10Impl::CreateAccessorD3D10BufferSRV(MemoryObject *resource, AccessorD3D10BufferSRV **result, DXGI_FORMAT format, D3D10_BUFFER_SRV desc)
{
    AutoPtr<AccessorD3D10BufferSRVImpl> tmp(new AccessorD3D10BufferSRVImpl(GetMyData(resource), format, desc));
    DetachRawPtr(tmp, result);
}
Exemplo n.º 28
0
	static PGPError
sExportProc(
	PFLConstFileSpecRef		ref,
	PGPByte **				dataOut,
	PGPSize *				dataSizeOut )
{
	MyData *			myData;
	PGPError			err				= kPGPError_NoErr;
	AliasHandle			alias			= NULL;
	void				*aliasData		= NULL;
	PGPUInt32			aliasDataSize	= 0;
	PGPByte *			data 			= NULL;
	PGPUInt32			dataSize		= 0;
	
	myData = GetMyData( ref );
	
	if( myData->specIsValid )
	{
		CInfoPBRec	cpb;
		FSSpec		parFolderSpec;
		
		parFolderSpec = myData->spec;
		
		pgpClearMemory( &cpb, sizeof( cpb ) );
		
		cpb.dirInfo.ioVRefNum	= parFolderSpec.vRefNum;
		cpb.dirInfo.ioDrDirID	= parFolderSpec.parID;
		cpb.dirInfo.ioNamePtr	= parFolderSpec.name;
		cpb.dirInfo.ioFDirIndex	= -1;
		
		if( PBGetCatInfoSync( &cpb ) == noErr )
		{
			parFolderSpec.parID	= cpb.dirInfo.ioDrParID;

			if( NewAlias( NULL, &parFolderSpec, &alias ) == noErr )
			{
				HLock( (Handle) alias );
				
				aliasData		= *alias;
				aliasDataSize 	= GetHandleSize( (Handle) alias );
			}
		}
	}
	
	dataSize = sizeof( ExportedFileSpec ) + aliasDataSize;
	
	data = (PGPByte *) PGPNewData( ref->memoryMgr, dataSize, 0 );
	if ( NULL!=(int)( data ) )
	{
		ExportedFileSpec	*exportedData = (ExportedFileSpec *) data;
		
		exportedData->aliasDataSize	= aliasDataSize;
		
		CopyPString( myData->spec.name, exportedData->name );
		
		if( aliasData != NULL )
			pgpCopyMemory( aliasData, &exportedData->aliasData[0], aliasDataSize );
	}
	else
	{
		err	= kPGPError_OutOfMemory;
	}
	
	if( alias != NULL )
		DisposeHandle( (Handle) alias );
		
	*dataOut		= data;
	*dataSizeOut	= dataSize;
	
	return( err );
}