Hi there,
I am currently trying to build a DLL using ImDisk so as to create a RAM disk for my python application. I've got everything installed and working and can create a disk from Control Panel etc., however I am unable to do so programatically via C++. The following is a potted example of what I am trying to do:
VFS_API int create(void) { if ( ! ImDiskStartService(L"ImDisk")) wcout << "Failed to start service!" << dec << GetLastError() << endl; DISK_GEOMETRY dg = {0}; DWORD device = 0; LARGE_INTEGER imgoff = {0}; WCHAR letter [ 4 ] = { ImDiskFindFreeDriveLetter(), L':', L'\\', L'\0' }; if ( ! ImDiskCreateDeviceEx ( NULL, & device, & dg, 0, 0, NULL, NULL, letter ) ) { wcout << "GLE:" << dec << GetLastError() << endl; wcout << "Failed to mount: " << letter << endl; return -1; } wcout << "Mounted: " << letter << endl; return 0; }
When I call this function, the service starts as expected, I get a suitable free drive letter ("E:\" in this case) but I cannot, no matter what arguments I pass, get the ImDiskCreateDriveEx(...) call to succeed. All I get from GetLastError() is '87' which translates to invalid parameters, but I can't work out which ones or why.
I'm compiling this using Visual C++ 2008 on Windows 7 Enterprise 32-bit.
I would really appreciate any advice or examples that can point me in the right direction.
Thanks.