Ejemplo n.º 1
0
typename KeyFileReader< ResRefT >::FileHandle
KeyFileReader< ResRefT >::OpenFile(
	__in const ResRefIf & FileName,
	__in ResType Type
	)
/*++

Routine Description:

	This routine logically opens an encapsulated sub-file within the KEY file.

	Currently, file handles are implemented as simply ResID indicies.
	Thus, "opening" a file simply involves looking up its ResID.

Arguments:

	FileName - Supplies the name of the resource file to open.

	Type - Supplies the type of file to open (i.e. ResTRN, ResARE).

Return Value:

	The routine returns a new file handle on success.  The file handle must be
	closed by a call to CloseFile on successful return.

	On failure, the routine returns the manifest constant INVALID_FILE, which
	should not be closed.

Environment:

	User mode.

--*/
{
	PCKEY_RESOURCE_DESCRIPTOR Key;

//	WriteText( "Checking for key %.32s/%lu -- %lu keys\n", FileName.RefStr, Type, m_KeyDir.size( ) );

	Key = LookupResourceKey( FileName, Type );

	if (Key == NULL)
		return INVALID_FILE;

	return (FileHandle) (Key->DirectoryIndex + 1);
}
Ejemplo n.º 2
0
	The routine returns a new file handle on success.  The file handle must be
	closed by a call to CloseFile on successful return.

	On failure, the routine returns the manifest constant INVALID_FILE, which
	should not be closed.

Environment:

	User mode.

--*/
{
	PCBIF_RESOURCE Key;

	Key = LookupResourceKey( (ResID) FileIndex );

	if (Key == NULL)
		return INVALID_FILE;

	if ((FileId) (Key->ID & 0xFFFFF) != FileIndex)
		return INVALID_FILE;

	return (FileHandle) (FileIndex + 1);
}

template< typename ResRefT >
bool
BifFileReader< ResRefT >::CloseFile(
	__in typename BifFileReader< ResRefT >::FileHandle File
	)