Use IMAPI burn ISO file
IMAPI 1.0needed:
- Platform Software Development Kit
IMAPI 2.0nedded:
- Windows SDK for Windows Server 2008 and .NET Framework 3.5
- WindowsXP-KB932716-v2-x86-CHS.exe [ for XP ]
Note:1.
::CoInitialize(0) ;
2. read iso file into istream
SHCreateStreamOnFileEx(fileName, STGM_READ, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN,FALSE, NULL, &dataStream );
3. blank CD
IMAPI 1.0
IDiscRecorder->Erase(bFullErase)
IMAPI 2.0
CComPtr
discFormatErase;
CoCreateInstance(__uuidof(MsftDiscFormat2Erase), NULL, CLSCTX_INPROC_SERVER,
__uuidof(IDiscFormat2Erase), (void**)&discFormatErase);
discFormatErase->put_Recorder(pRecorder);
discFormatErase->put_ClientName(clientName);
discFormatErase->EraseMedia();
4. CString --> LPWCSTR
CString clientName = CLIENT_NAME;
BSTR bstrText = clientName.AllocSysString();
SysFreeString(bstrText);
5. burn
IMAPI 1.0
CComQIPtr dm;
dm.CoCreateInstance(CLSID_MSDiscMasterObj,NULL,
CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER);
dm->Open();
CComQIPtr dr;
dm->SetActiveDiscRecorder(dr);
CComQIPtr jdm(dm);
jdm->AddData(storage, FALSE);
dm->RecordDisc(FALSE, FALSE);
IMAPI 2.0
CComBSTR DriveUnqueID;
discMaster->get_Item( DriveIndex, &DriveUnqueID );
CComPtr recorder;
recorder.CoCreateInstance(__uuidof(MsftDiscRecorder2));
recorder->InitializeDiscRecorder( DriveUnqueID );
CComPtr discFormat2Data;
discFormat2Data.CoCreateInstance(__uuidof(MsftDiscFormat2Data));
discFormat2Data->put_Recorder( recorder );
discFormat2Data->put_ClientName( L"VistaCDWriterTest" );
discFormat2Data->Write( StreamOut );
阅读(2342) | 评论(0) | 转发(0) |