MTF_DEFS.H

/* 
* This is a part of the Microsoft Source Code Samples.

*
*This sample code shows the usage of some portions
*of the NTMS API.
*
*Return codes are, for the most part, not checked in
*this code. See the Programmer's reference for error
*return information.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
* PARTICULAR PURPOSE.
*
* Copyright 1997 - 1998 Microsoft Corporation. All Rights Reserved.
*/


#ifndef _MTF_DEFS_H
#define _MTF_DEFS_H

#include <rpc.h>

// make sure we are byte aligned ...
#pragma pack(1)

// definitions from the MTF spec needed for media label identification ...
//
#define MTF_LABEL_REVISION_LEVEL_MIN 1
#define MTF_LABEL_REVISION_LEVEL_MAX 1

#define MTF_TapeDBLKLabel"TAPE"
#define MTF_TapeDBLKLabelSizestrlen (MTF_TapeDBLKLabel)

// defines for StringType in common block header ...
#define NO_STRINGS0x00
#define ANSI_STR0x01
#define UNICODE_STR0x02

// defines for MEDIA Attributes in tape header descriptior block
#define TAPE_SOFT_FILEMARK_BIT 0x0001
#define TAPE_MEDIA_LABEL_BIT 0x0002

// define MTF_DateTime
typedef struct
{
BYTETime[5] ;
} MTF_DateTime;

// define MTF_TapeAddress
typedef struct
{
WORD Size;
WORD Offset;
} MTF_TapeAddress;

// definition of the MTF_DBLKHdr - this exists in the first part of
// all DBLKs in MTF.
typedef struct
{
BYTEBlockType[4];
DWORDBlockAttributes;
WORDOffsetToFirstStream;
BYTEOSID;
BYTEOSVersion;
DWORDLONGDisplayableSize;
DWORDLONG FormatLogicalAddress;
WORDReservedForMBC;
WORDSoftwareCompression;
BYTE Reserved1[4];
DWORDControlBlockId;
BYTEReserved2[4];
MTF_TapeAddressOSSpecificData;
BYTEStringType;
BYTEReserved3;
WORDHeaderCheckSum;
} MTF_DBLKHdr;



// definition of the MTF_TapeDBLK - this is the first DBLK that is recorded on
// the physical media. This includes the MTF_DBLKHdr
typedef struct
{
MTF_DBLKHdrBlockHeader;
DWORD TapeFamilyID;
DWORD TapeAttributes;
WORDTapeSequenceNumber;
WORDPasswordEncryptionAlgorithm;
WORDECCAlgorithm;
WORDTapeCatalogType;
MTF_TapeAddress TapeName;
MTF_TapeAddress TapeDescription;
MTF_TapeAddress TapePassword;
MTF_TapeAddress SoftwareName;
WORDAlignmentFactor;
WORDSoftwareVendorId;
MTF_DateTimeTapeDate;
BYTE MTFMajorVersion;
} MTF_TapeDBLK;
//
// The MTF NTMS scratch label defines and struct
//

#define MTF_NTMS_Tag L"MTF Media Label|"
#define MTF_NTMS_TagSize sizeof (MTF_NTMS_Tag)

#define MTF_NTMS_Version L"1.0|"
#define MTF_NTMS_VersionSize sizeof(MTF_NTMS_Version)

#define MTF_NTMS_Vendor L"Microsoft|"
#define MTF_NTMS_VendorSize sizeof(MTF_NTMS_Vendor)

#define MTF_NTMS_ProductId L"NTMS|"
#define MTF_NTMS_ProductIdSize (sizeof(MTF_NTMS_ProductId)-1)

#define MTF_NTMS_TimeSize 40

#define MTF_NTMS_Label L"|"
#define MTF_NTMS_LabelSize (sizeof(MTF_NTMS_Label)-1)

#define MTF_NTMS_Side L"1|"
#define MTF_NTMS_SideSize (sizeof(MTF_NTMS_Side)-1)

#define MTF_NTMS_MediaIDBlank L"{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}|"
#define MTF_NTMS_MediaIDSize (sizeof(MTF_NTMS_MediaIDBlank)-1)

#define MTF_NTMS_Domain L"|"
#define MTF_NTMS_DomainSize (sizeof(MTF_NTMS_Domain)-1)

// reserved for future

#define VendorSpecificSize 5

typedef struct
{
BYTETag[MTF_NTMS_TagSize];
BYTEVersion[MTF_NTMS_VersionSize];
BYTEVendor[MTF_NTMS_VendorSize];
BYTEVendorProductId[MTF_NTMS_ProductIdSize];
BYTETime[MTF_NTMS_TimeSize];
BYTELabel[MTF_NTMS_LabelSize]; // not used
BYTESide[MTF_NTMS_SideSize];
BYTEMediaID[MTF_NTMS_MediaIDSize];
BYTEDomainID[MTF_NTMS_DomainSize]; // not used
BYTEVS[VendorSpecificSize];
} NTMS_MTF_MediaLabel;

#endif