Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LPCTSTR lpFileName=L"\\.\Device\Harddisk0\Partition3";
- HANDLE handl=CreateFile( lpFileName,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL );
- if (handl==INVALID_HANDLE_VALUE)
- {
- qDebug()<<"handl invalid"<<" error"<<GetLastError();}
- bool success = DefineDosDevice(DDD_RAW_TARGET_PATH,L"I:",L"\Device\Harddisk0\Partition3");
- if(!success)
- qDebug()<<" DefineDosDevice failed "<<GetLastError();
- bFlag = GetVolumeNameForVolumeMountPoint(
- L"I:\", // input volume mount point or directory
- /** what u do in this directory u find it in th mount piont and vice versa**/
- Buf, // output volume name buffer
- BUFSIZE // size of volume name buffer
- );
- if (bFlag != TRUE)
- {
- //_tprintf( TEXT("Retrieving volume name for %s failed.n"), argv[2] );
- qDebug()<<"Retrieving volume name failed. "<<GetLastError();
- return (-2);
- }
- qDebug()<<"Volume name"<<QString::fromWCharArray(Buf);
- bool fResult = DefineDosDevice (
- DDD_RAW_TARGET_PATH|DDD_REMOVE_DEFINITION|
- DDD_EXACT_MATCH_ON_REMOVE, L"I:",
- L"\Device\Harddisk0\Partition3");
- if (!fResult)
- qDebug()<<"DefineDosDevice failed "<< GetLastError();
- bFlag = SetVolumeMountPoint(L"D:\myDirExample\example\", // mount point
- /** should b empty**/
- Buf // volume to be mounted
- );
- if (!bFlag)
- {
- qDebug()<<"Attempt to mount failed";
- qDebug()<<"error "<<GetLastError();
- }
- return (bFlag);
- CloseHandle(handl);
- handl invalid error 3
- Retrieving volume name failed erorr 2
Add Comment
Please, Sign In to add comment