Чистенький модуль для будущих поколений:
Код | unit Imapi;
interface
uses Windows, ActiveX;
const MEDIA_CDDA_CDROM = 1; MEDIA_CD_ROM_XA = 2; MEDIA_CD_I = 3; MEDIA_CD_EXTRA = 4; MEDIA_CD_OTHER = 5; MEDIA_SPECIAL = 6;
RECORDER_CDR = 1; RECORDER_CDRW = 2; RECORDER_DOING_NOTHING = 0; RECORDER_OPENED = 1; RECORDER_BURNING = 2;
MEDIA_BLANK = 1; MEDIA_RW = 2; MEDIA_WRITABLE = 4; MEDIA_FORMAT_UNUSABLE_BY_IMAPI = 8;
IID_IDiscRecorder: TGUID = '{85AC9776-CA88-4cf2-894E-09598C078A41}'; IID_IEnumDiscRecorders: TGUID = '{9B1921E1-54AC-11d3-9144-00104BA11C5E}'; IID_IEnumDiscMasterFormats: TGUID = '{DDF445E1-54BA-11d3-9144-00104BA11C5E}'; IID_IRedbookDiscMaster: TGUID = '{E3BC42CD-4E5C-11D3-9144-00104BA11C5E}'; IID_IJolietDiscMaster: TGUID = '{E3BC42CE-4E5C-11D3-9144-00104BA11C5E}'; IID_IDiscMasterProgressEvents: TGUID = '{EC9E51C1-4E5D-11D3-9144-00104BA11C5E}'; IID_IDiscMaster: TGUID = '{520CCA62-51A5-11D3-9144-00104BA11C5E}';
CLSID_MSDiscRecorderObj: TGUID = '{520CCA61-51A5-11D3-9144-00104BA11C5E}'; MSDiscRecorderObj: TGUID = '{520CCA61-51A5-11D3-9144-00104BA11C5E}'; CLSID_MSDiscMasterObj: TGUID = '{520CCA63-51A5-11D3-9144-00104BA11C5E}'; MSDiscMasterObj: TGUID = '{520CCA63-51A5-11D3-9144-00104BA11C5E}'; CLSID_MSEnumDiscRecordersObj: TGUID = '{8A03567A-63CB-4BA8-BAF6-52119816D1EF}'; MSEnumDiscRecordersObj: TGUID = '{8A03567A-63CB-4BA8-BAF6-52119816D1EF}';
type MEDIA_TYPES = DWORD; TMediaTypes = MEDIA_TYPES;
MEDIA_FLAGS = DWORD; TMediaFlags = MEDIA_FLAGS;
RECORDER_TYPES = DWORD; TRecorderTypes = RECORDER_TYPES;
IDiscRecorder = interface(IUnknown) ['{85AC9776-CA88-4cf2-894E-09598C078A41}'] function Init(pbyUniqueID: PByte; nulIDSize, nulDriveNumber: ULONG): HRESULT; stdcall; function GetRecorderGUID(pbyUniqueID: PByte; ulBufferSize: ULONG; out pulReturnSizeRequired: ULONG): HRESULT; stdcall; function GetRecorderType(out fTypeCode: Longint): HRESULT; stdcall; function GetDisplayNames(var pbstrVendorID, pbstrProductID, pbstrRevision: PWideChar): HRESULT; stdcall; function GetBasePnPID(out pbstrBasePnPID: PWideChar): HRESULT; stdcall; function GetPath(out pbstrPath: PWideChar): HRESULT; stdcall; function GetRecorderProperties(out ppPropStg: IPropertyStorage): HRESULT; stdcall; function SetRecorderProperties(pPropStg: IPropertyStorage): HRESULT; stdcall; function GetRecorderState(out pulDevStateFlags: ULONG): HRESULT; stdcall; function OpenExclusive: HRESULT; stdcall; function QueryMediaType(out fMediaType, fMediaFlags: Longint): HRESULT; stdcall; function QueryMediaInfo(out pbSessions, pbLastTrack: Byte; out ulStartAddress, ulNextWritable, ulFreeBlocks: ULONG): HRESULT; stdcall; function Eject: HRESULT; stdcall; function Erase(bFullErase: BOOL): HRESULT; stdcall; function Close: HRESULT; stdcall; end;
IEnumDiscRecorders = interface(IUnknown) ['{9B1921E1-54AC-11d3-9144-00104BA11C5E}'] function Next(cRecorders: ULONG; out ppRecorder: IDiscRecorder; out pcFetched: ULONG): HRESULT; stdcall; function Skip(cRecorders: ULONG): HRESULT; stdcall; function Reset: HRESULT; stdcall; function Clone(out ppEnum: IEnumDiscRecorders): HRESULT; stdcall; end;
IEnumDiscMasterFormats = interface(IUnknown) ['{DDF445E1-54BA-11d3-9144-00104BA11C5E}'] function Next(cFormats: ULONG; out lpiidFormatID: TGUID; out pcFetched: ULONG): HRESULT; stdcall; function Skip(cFormats: ULONG): HRESULT; stdcall; function Reset: HRESULT; stdcall; function Clone(out ppEnum: IEnumDiscMasterFormats): HRESULT; stdcall; end;
IRedbookDiscMaster = interface(IUnknown) ['{E3BC42CD-4E5C-11D3-9144-00104BA11C5E}'] function GetTotalAudioTracks(out pnTracks: Longint): HRESULT; stdcall; function GetTotalAudioBlocks(out pnBlocks: Longint): HRESULT; stdcall; function GetUsedAudioBlocks(out pnBlocks: Longint): HRESULT; stdcall; function GetAvailableAudioTrackBlocks(out pnBlocks: Longint): HRESULT; stdcall; function GetAudioBlockSize(out pnBlockBytes: Longint): HRESULT; stdcall; function CreateAudioTrack(nBlocks: Longint): HRESULT; stdcall; function AddAudioTrackBlocks(pby: PByte; cb: Longint): HRESULT; stdcall; function CloseAudioTrack: HRESULT; stdcall; end;
IJolietDiscMaster = interface(IUnknown) ['{E3BC42CE-4E5C-11D3-9144-00104BA11C5E}'] function GetTotalDataBlocks(out pnBlocks: Longint): HRESULT; stdcall; function GetUsedDataBlocks(out pnBlocks: Longint): HRESULT; stdcall; function GetDataBlockSize(out pnBlockBytes: Longint): HRESULT; stdcall; function AddData(pStorage: IStorage; lFileOverwrite: Longint): HRESULT; stdcall; function GetJolietProperties(out ppPropStg: IPropertyStorage): HRESULT; stdcall; function SetJolietProperties(pPropStg: IPropertyStorage): HRESULT; stdcall; end;
IDiscMasterProgressEvents = interface(IUnknown) ['{EC9E51C1-4E5D-11D3-9144-00104BA11C5E}'] function QueryCancel(out pbCancel: BOOL): HRESULT; stdcall; function NotifyPnPActivity: HRESULT; stdcall; function NotifyAddProgress(nCompletedSteps, nTotalSteps: Longint): HRESULT; stdcall; function NotifyBlockProgress(nCompleted, nTotal: Longint): HRESULT; stdcall; function NotifyTrackProgress(nCurrentTrack, nTotalTracks: Longint): HRESULT; stdcall; function NotifyPreparingBurn(nEstimatedSeconds: Longint): HRESULT; stdcall; function NotifyClosingDisc(nEstimatedSeconds: Longint): HRESULT; stdcall; function NotifyBurnComplete(status: HRESULT): HRESULT; stdcall; function NotifyEraseComplete(status: HRESULT): HRESULT; stdcall; end;
IDiscMaster = interface(IUnknown) ['{520CCA62-51A5-11D3-9144-00104BA11C5E}'] function Open: HRESULT; stdcall; function EnumDiscMasterFormats(out ppEnum: IEnumDiscMasterFormats): HRESULT; stdcall; function GetActiveDiscMasterFormat(out lpiid: TGUID): HRESULT; stdcall; function SetActiveDiscMasterFormat(const riid: TGUID; out ppUnk: IUnknown): HRESULT; stdcall; function EnumDiscRecorders(out ppEnum: IEnumDiscRecorders): HRESULT; stdcall; function GetActiveDiscRecorder(out ppRecorder: IDiscRecorder): HRESULT; stdcall; function SetActiveDiscRecorder(pRecorder: IDiscRecorder): HRESULT; stdcall; function ClearFormatContent: HRESULT; stdcall; function ProgressAdvise(pEvents: IDiscMasterProgressEvents; out pvCookie: UINT): HRESULT; stdcall; function ProgressUnadvise(vCookie: UINT): HRESULT; stdcall; function RecordDisc(bSimulate, bEjectAfterBurn: BOOL): HRESULT; stdcall; function Close: HRESULT; stdcall; end;
implementation
end.
|
|