Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,
Can anybody tell me how to use VDS in order to perform format operation on any volume connected with your computer.

Thank in advance
Posted
Updated 12-May-10 23:28pm
v2

VDS works on hard disks, not CD/DVD.
Look at IMAPI[^] for targetting CD/DVD
 
Share this answer
 
Comments
jeniusj 13-May-10 5:47am    
Thanks Michel for your reply,
Can you please elaborate the use of VDS for formatting Hard Disk prgrammatically.
jeniusj 13-May-10 6:16am    
and another question is that IVdsVolumeMF::Format conatins the file system type CDFS, so it means that CD/DVD can be access through VDS also in windows vista and windows 7 if i delete the fmifs.dll then no prompt occurs
Still confused. Microsoft elaborates on this: http://msdn.microsoft.com/en-us/library/aa819125(v=VS.85).aspx[^]
What else do you want to know?
 
Share this answer
 
Comments
jeniusj 13-May-10 6:27am    
But if you look at the following the link it will give VDS object model diagram;
http://msdn.microsoft.com/en-us/library/aa383402(VS.85).aspx
if you transverse through this diagram, then you first get the interface of IVdsServiceLoader, through which you start the VDS service by using IVdsServiceLoader::LoadService(). After that you get the providers by QueryProviders method and from the Provider interface you will get Pack and through QueryVolume, you will get IEnumVdsObject list of Volumes, My problem is that when I am trying to get the IUnkown pointer list form IEnumVdsObject, I failed. It returns me S_FALSE with IUnknwown* = NULL so that I can not use QueryInterface to get IVdsVolume interface, through which I can format the particular drive.
Michel Godfroid 13-May-10 7:04am    
Hang on, What exactly are you trying to achieve? VDS works one level above the device driver, and is a VIRTUAL Disk service. Microsoft is trying to standardise a number of low-level, OEM proprietary operations through a standard interface. It sill depends on the underlying interface. If you can do your operation through DISKPART, you should be able to do it programmaticaly, but the normal way of doing this would be through the WMI/CIMV2 interface, or through scripting (which will call the WMI/CIMV2 interface anyway)
Suggest you post a new question, giving us some more details on what you're trying to achieve.
Cheers,
jeniusj 13-May-10 8:22am    
Actually I am trying to format CD/DVD to UDF programatically so that is why I want to implement it through VDS
here it is my code through which I am successfully initialize the VDS service and get the Packs but When I call QueryVolumes on IVdsPack Object, I am able to get IEnumVdsObjects but unable to get IUnknown* from IEnumVdsObject::Next reutrns S_FALSE with IUnkown* = NULL. So this IUnknown* cant be used to QueryInterface for IVdsVolume

Help me out to get out of this situation
HRESULT hResult;
IVdsService* pService = NULL;
IVdsServiceLoader *pLoader = NULL;

//Launch the VDS Service
hResult = CoInitialize(NULL);
if( SUCCEEDED(hResult) )
{
    hResult = CoCreateInstance( CLSID_VdsLoader,
                NULL,
                CLSCTX_LOCAL_SERVER,
                IID_IVdsServiceLoader,
                (void**) &pLoader
                );

    //if succeeded load VDS on local machine
    if( SUCCEEDED(hResult) )
        pLoader->LoadService(NULL, &pService);

    //Done with Loader now release VDS Loader interface
    _SafeRelease(pLoader);

    if( SUCCEEDED(hResult) )
    {
        hResult = pService->WaitForServiceReady();
        if ( SUCCEEDED(hResult) )
        {
            AfxMessageBox(L"VDS Service Loaded");
            IEnumVdsObject* pEnumVdsObject = NULL;
            hResult = pService->QueryProviders(VDS_QUERY_SOFTWARE_PROVIDERS, &pEnumVdsObject);

            IUnknown* ppObjUnk ;
            IVdsSwProvider* pVdsSwProvider = NULL;
            IVdsPack* pVdsPack = NULL;
            IVdsVolume* pVdsVolume = NULL;
            ULONG ulFetched = 0;

            hResult = E_INVALIDARG;
            while(!SUCCEEDED(hResult))
            {
                hResult = pEnumVdsObject->Next(1, &ppObjUnk, &ulFetched);
                hResult = ppObjUnk->QueryInterface(IID_IVdsSwProvider, (void**)&pVdsSwProvider);
                if(!SUCCEEDED(hResult))
                    _SafeRelease(ppObjUnk);
            }
            _SafeRelease(pEnumVdsObject);
            _SafeRelease(ppObjUnk);

            hResult = pVdsSwProvider->QueryPacks(&pEnumVdsObject);

            hResult = E_INVALIDARG;
            while(!SUCCEEDED(hResult))
            {
                hResult = pEnumVdsObject->Next(1, &ppObjUnk, &ulFetched);
                hResult = ppObjUnk->QueryInterface(IID_IVdsPack, (void**)&pVdsPack);
                if(!SUCCEEDED(hResult))
                    _SafeRelease(ppObjUnk);
            }

            _SafeRelease(pEnumVdsObject);
            _SafeRelease(ppObjUnk);

            hResult = pVdsPack->QueryVolumes(&pEnumVdsObject);
            pEnumVdsObject->Reset();

            hResult = E_INVALIDARG;
            ulFetched = 0;
            BOOL bDone = FALSE;
            while(!SUCCEEDED(hResult))
            {
                hResult = pEnumVdsObject->Next(1, &ppObjUnk, &ulFetched);
                hResult = ppObjUnk->QueryInterface(IID_IVdsVolume, (void**)&pVdsVolume);
                if(!SUCCEEDED(hResult))
                    _SafeRelease(ppObjUnk);
            }
            _SafeRelease(pEnumVdsObject);
            _SafeRelease(ppObjUnk);
            _SafeRelease(pVdsPack);
            _SafeRelease(pVdsSwProvider);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900