GetVolumeInformation

117 views
Skip to first unread message

riccardo...@gmail.com

unread,
Oct 9, 2009, 4:33:38 AM10/9/09
to Dokan
Hi, how can implement GetVolumeInformation function?
I have this code:
tatic int (DOKAN_CALLBACK
from_Dokan_GetVolumeInformation) (
LPWSTR VolumeNameBuffer,
DWORD VolumeNameSize,
LPDWORD VolumeSerialNumber,
LPDWORD MaximumComponentLength,
LPDWORD FileSystemFlags,
LPWSTR FileSystemNameBuffer,
DWORD FileSystemNameSize,
PDOKAN_FILE_INFO DokanFileInfo)
{
VolumeNameBuffer = L"riky";
VolumeNameSize = sizeof("riky");
VolumeSerialNumber = NULL;
MaximumComponentLength = NULL;
FileSystemFlags = NULL;
FileSystemNameBuffer = L"RDFS";
FileSystemNameSize = sizeof("RDFS");
return 0;
}

but when i mount my virtual file system, the name of volume is nothing
and the file system name is RAW.
And the return value, in case the operation is successful you should
need to return zero, as described in the readme, or a nonzero value
as described in the MSDN documentation: http://msdn.microsoft.com/en-us/library/aa364993
(VS .85). aspx ?

riccardo...@gmail.com

unread,
Oct 9, 2009, 6:38:26 AM10/9/09
to Dokan
I have resolve the problem.
This follow code work:

static int (DOKAN_CALLBACK
from_Dokan_GetVolumeInformation) (
LPWSTR VolumeNameBuffer,
DWORD VolumeNameSize,
LPDWORD VolumeSerialNumber,
LPDWORD MaximumComponentLength,
LPDWORD FileSystemFlags,
LPWSTR FileSystemNameBuffer,
DWORD FileSystemNameSize,
PDOKAN_FILE_INFO DokanFileInfo)
{
wchar_t * volumeName = L"riky";
wchar_t * fsName = L"RDFS";
wcscat(VolumeNameBuffer,volumeName);
*VolumeSerialNumber = 0x19831116;
*MaximumComponentLength = 256;
*FileSystemFlags = FILE_CASE_SENSITIVE_SEARCH |
FILE_CASE_PRESERVED_NAMES |
FILE_SUPPORTS_REMOTE_STORAGE |
FILE_UNICODE_ON_DISK;
wcscat(FileSystemNameBuffer, fsName);
return 0;
}

I found this code in volume.c of source code of dokan library.
Thanks Dokan for the exelend work!

Joe Burmeister

unread,
Oct 9, 2009, 8:57:02 AM10/9/09
to do...@googlegroups.com
Hi riccardo,

It's very easy.
Here's what I've done, I'm sure someone will pipe up if it's not 100% correct, but it works fine for me:

int __stdcall    ExampleGetVolumeInformation(    LPWSTR                sVolumeNameBuffer,
                                                    DWORD                nVolumeNameSize,
                                                    LPDWORD                pnVolumeSerialNumber,
                                                    LPDWORD                pnMaximumComponentLength,
                                                    LPDWORD                pnFileSystemFlags,
                                                    LPWSTR                sFileSystemNameBuffer,
                                                    DWORD                nFileSystemNameSize,
                                                    PDOKAN_FILE_INFO    pDokanFileInfo)
{
    nVolumeNameSize /= sizeof(WCHAR);
    nFileSystemNameSize /= sizeof(WCHAR);

    wcscpy_s(sFileSystemNameBuffer, nFileSystemNameSize, L"Dokan");
    wcscpy_s(sVolumeNameBuffer, nVolumeNameSize, L"SomeFS");

    *pnVolumeSerialNumber        = 0x19831116;
    *pnFileSystemFlags            = FILE_UNICODE_ON_DISK|FILE_CASE_PRESERVED_NAMES;
    *pnMaximumComponentLength    = MAX_PATH;

    return 0;
}




Joe



Reply all
Reply to author
Forward
0 new messages