IMAPI куда копать?
Вот пытаюсь разобратся с IMAPI нашол какой то исходник с японскими каментами http://blog-imgs-23.fc2.com/j/u/n/junktxt/imapiv1_01.html :rolleyes: Там к сожалению только получении информации о пишущих приводах.Покулапал тот исходник наваял свой
Код:
#include <conio.h>
#include <stdlib.h>
#include <comutil.h>
#include <Objbase.h>
#include <iostream>
#include <Imapi.h>
#include <imapierror.h>
# pragma comment(lib, "comsuppwd.lib")
using namespace std;
void dllt(char devp[1024],char drvlt[3])
{
char data[256];
char disk[]="A:";
for (int i='A'; i<='Z'; i++)
{
disk[0] = i;
QueryDosDeviceA(disk, data, 256);
if(strcmp(data,devp)==0)
{strcpy(drvlt,disk);break;}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
ULONG fet;int i=0;
HRESULT hr=0;
IDiscMaster *pDiskMaster= NULL;
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_MSDiscMasterObj,NULL,CLSCTX_LOCAL_SERVER,IID_IDiscMaster,(PVOID*)&pDiskMaster);
if(hr!=S_OK){printf("%X",hr);getch();}
pDiskMaster->Open();
IEnumDiscRecorders* recordersEnum;
IDiscRecorder* pRecorder;
hr = pDiskMaster->EnumDiscRecorders(&recordersEnum);
char dbcc_name[1024],buf [10*1024];
memset(dbcc_name,NULL,1024);memset(buf,NULL,1024*10);
ULONG ulReturnSizeRequired;
BSTR bstrVendorID=NULL, bstrProductID=NULL, bstrRevision=NULL,bstrPath=NULL;
char DrvLet[1024];
byte sessions;
byte lasttrack;
ULONG ulstartaddress;
ULONG ulnextwritable;
ULONG ulfreeblocks;
long MediaType;
long MediaFlags;
PROPSPEC iPropSpec[5];
PROPVARIANT iPropVariant[5];
IPropertyStorage *pPropertyStorage;
for(;;)
{
recordersEnum->Next(1,&pRecorder,&fet);i++;
if(!pRecorder){break;}
pRecorder->GetRecorderGUID((byte*)dbcc_name,1024,&ulReturnSizeRequired);
hr=pRecorder->GetDisplayNames(&bstrVendorID,&bstrProductID,&bstrRevision);
if(hr!=S_OK){printf("%X",hr);getch();}
cout<<"VEndor:"<<_com_util::ConvertBSTRToString(bstrVendorID)<<endl;
cout<<"Device:"<<_com_util::ConvertBSTRToString(bstrProductID)<<endl;
cout<<"Revision:"<<_com_util::ConvertBSTRToString(bstrRevision)<<endl;
pRecorder->GetPath(&bstrPath);
wsprintf(buf,_com_util::ConvertBSTRToString(bstrPath));
dllt(buf,DrvLet);
cout<<DrvLet<<endl;
hr = pRecorder->OpenExclusive();
pRecorder->QueryMediaInfo(&sessions,&lasttrack,&ulstartaddress,&ulnextwritable,&ulfreeblocks);
printf("sessions:%d\n",sessions);
printf("lasttrack:%d\n",lasttrack);
printf("ulstartaddress:%d\n",ulstartaddress);
printf("ulnextwritable:%d\n",ulnextwritable);
printf("lfreeblocks:%d\n",ulfreeblocks);
pRecorder->QueryMediaType(&MediaType, &MediaFlags);
if(MediaType == MEDIA_CD_EXTRA)
printf("MediaType : MEDIA_CD_EXTRA\n");
else if(MediaType == MEDIA_CD_I)
printf("MediaType : MEDIA_CD_I\n");
else if(MediaType == MEDIA_CD_OTHER)
printf("MediaType : MEDIA_CD_OTHER\n");
else if(MediaType == MEDIA_CD_ROM_XA)
printf("MediaType : MEDIA_CD_ROM_XA\n");
else if(MediaType == MEDIA_CDDA_CDROM)
printf("MediaType : MEDIA_CDDA_CDROM\n");
else if(MediaType == MEDIA_SPECIAL)
printf("MediaType : MEDIA_SPECIAL\n");
printf("MediaFlags:");
if(MediaFlags & MEDIA_BLANK)
printf("MEDIA_BLANK, ");
if(MediaFlags & MEDIA_RW)
printf("MEDIA_RW, ");
if(MediaFlags & MEDIA_WRITABLE)
printf("MEDIA_WRITABLE, ");
printf("\n");
pRecorder->GetRecorderProperties(&pPropertyStorage);
int cnt = sizeof(iPropSpec) / sizeof(PROPSPEC);
iPropSpec[0].ulKind = PRSPEC_LPWSTR;
iPropSpec[0].lpwstr = L"WriteSpeed";
iPropSpec[1].ulKind = PRSPEC_LPWSTR;
iPropSpec[1].lpwstr = L"MaxWriteSpeed";
iPropSpec[2].ulKind = PRSPEC_LPWSTR;
iPropSpec[2].lpwstr = L"EnableBufferUnderrunFree";
iPropSpec[3].ulKind = PRSPEC_LPWSTR;
iPropSpec[3].lpwstr = L"BufferUnderrunFreeCapable";
iPropSpec[4].ulKind = PRSPEC_LPWSTR;
iPropSpec[4].lpwstr = L"AudioGapSize";
pPropertyStorage->ReadMultiple( cnt, iPropSpec, iPropVariant );
if(iPropVariant[0].vt == VT_I4)
printf("WriteSpeed:%d\n", iPropVariant[0].lVal);
if(iPropVariant[1].vt == VT_I4)
printf("MaxWriteSpeed:%d\n", iPropVariant[1].lVal);
if(iPropVariant[2].vt == VT_I4)
printf("EnableBufferUnderrunFree:%d\n", iPropVariant[2].lVal);
if(iPropVariant[3].vt == VT_BOOL)
{
if(iPropVariant[3].boolVal == VARIANT_TRUE)
printf("BufferUnderrunFreeCapable : TRUE\n");
else
printf("BufferUnderrunFreeCapable : FALSE\n");
}
if(iPropVariant[4].vt == VT_I4)
printf("AudioGapSize: %d\n", iPropVariant[4].lVal);
}
getch();
return 0;
}
Теперь напрашивается вопрос IMAPI версии 1.х может коректно работать с DVD приводами?Потому как информация выдаваемая относительно DVD свойств резака пурга полнеяшая :( Да и ещё к сожалению я почти ненашол примеров по записи дисков Кто нибудь может такой подсказать? В 1ю очередь меня интересует запись уже готовой исошки.
|