2010年10月14日 星期四

Enumerate EDB volumes

I wrote a test application to enumerates all EDB volumes on my WM6.1 devices. Here is the code piece:

CEGUID guid;
DWORD  dwErr;
WCHAR  wszMsg[255];
WCHAR  wszName[255];

CREATE_INVALIDGUID(&guid);

while (CeEnumDBVolumes(&guid, wszName, 255))
{
        StringCchPrintfW(
                wszMsg, 255, L"VOL: %s\n", wszName);
        OutputDebugStringW(wszMsg);
}

if (GetLastError != ERROR_NO_MORE_ITEMS)
{
        OutputDebugString(L”Unexpected stop\n”);       
}   

According the MSDN, the size of wszName should be enough to CEDB_MAXDBASENAMELEN. But actually I got ERROR_INSUFFICIENT_BUFFER error when using that size.

After increase the size to 255, the enumeration finish normally, and here is the output in my device.

VOL: \Documents and Settings\default.vol
VOL: \ReplStorVol
VOL: \mxip_notify.vol
VOL: \mxip_swmgmt.vol
VOL: \cemail.vol
VOL: \mxip_system.vol
VOL: \mxip_lang.vol

It’s more than I expected….嚎啕大哭

And notice the first one, the length is absolutely larger then CEDB_MAXDBASENAMELEN (32), that means the reference guide of CeEnumDBVolumes() was wrong.

Back to the list I got, there are more than that when I searching the *.vol files on root file system. Cause CeEnumDBVolumes() only list the mounted database volumes.

And of course, the volumes listed has been locked after my mobile device boot up, there is a long road for me to understand how to release them for backup/restore purpose.

沒有留言:

張貼留言