Hi, I'm trying to use IWriteEngine2 of IMAPI2 to write a single sector to a disc at LBA 0. Everything goes fine until the very end - when it's supposed to stop burning, the disc keeps spinning and the device is locked. I can't open the tray without doing a restart. In fact, WriteSection() returns S_OK, indicating that data must've been written, although the medium (CD-RW) remains blank afterwards (checked with hex editor).
Every call to the COM methods returns S_OK (this is what Assert() checks for), see excerpt below.
I've tried reading the stream, which works fine, so it shouldn't be a problem with IStream. The reason I'm using IWriteEngine2 is that data will be generated "on the fly" and should not be written in the conventional data CD format, but raw.Code:CoInitialize(NULL); IWriteEngine2* writeEngine; Assert(CoCreateInstance(__uuidof(MsftWriteEngine2), NULL, CLSCTX_ALL, __uuidof(IWriteEngine2), (void**)&writeEngine)); IDiscRecorder2* discRecorder; Assert(CoCreateInstance(__uuidof(MsftDiscRecorder2), NULL, CLSCTX_ALL, __uuidof(IDiscRecorder2), (void**)&discRecorder)); IDiscMaster2* discMaster; Assert(CoCreateInstance(__uuidof(MsftDiscMaster2), NULL, CLSCTX_ALL, __uuidof(IDiscMaster2), (void**)&discMaster)); BSTR uniqueID; long numDevices = 0; Assert(discMaster->get_Count(&numDevices)); for(int i = 0; i < 100; i++) if(discMaster->get_Item(i, &uniqueID) == S_OK) break; Assert(discRecorder->InitializeDiscRecorder(uniqueID)); Assert(discRecorder->AcquireExclusiveAccess(VARIANT_TRUE, SysAllocString(L"abcd"))); Assert(writeEngine->put_Recorder((IDiscRecorder2Ex*)discRecorder)); Assert(writeEngine->put_BytesPerSector(2048)); Assert(writeEngine->put_StartingSectorsPerSecond(-1)); Assert(writeEngine->put_EndingSectorsPerSecond(-1)); IStream* patternStream; patternStream = SHCreateMemStream(pattern, 2048); //pattern is a valid pointer to 2048 bytes of memory Assert(writeEngine->WriteSection(patternStream, 0, 1)); //after burning this returns S_OK Assert(discRecorder->ReleaseExclusiveAccess());
Let me know of any ideas to fix this. Thanks!



LinkBack URL
About LinkBacks



