Start New Discussion Reply to this Discussion Please help .....how can i get the drive information
Hi ..
this is my first post here...
i have been trying to solve this problem for two days ..but no luck..
here is my problemm...
I am using win32..
I can able to get notified on new device insertion and removal using DBT_DEVTYP_DEVICEINTERFACE
if ( DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam )
{
PDEV_BROADCAST_HDR pHdr = ( PDEV_BROADCAST_HDR )lParam;
PDEV_BROADCAST_DEVICEINTERFACE pDevInf;
PDEV_BROADCAST_VOLUME pDevVolume = reinterpret_cast<PDEV_BROADCAST_VOLUME>(lParam);
switch( pHdr->dbch_devicetype )
{
case DBT_DEVTYP_DEVICEINTERFACE:
pDevInf = ( PDEV_BROADCAST_DEVICEINTERFACE )pHdr;
updateDevice( pDevInf, wParam);
break;
}
}
anybody please tell me how can i get the drive information ( G:/ ) for the above notication
any help would be greatly appreciated
Related Article: I have a question about C++
is a C++ discussion thread by Denxerator that has 6 replies and was last updated 3 years ago.
newbgal
Newbie Poster
1 post since Jun 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
This gets some basic device information.
//handle to the drive to be examined
HANDLE hDevice = CreateFile(TEXT("\\\\.\\G:"), //Drive to open
GENERIC_READ|GENERIC_WRITE,//Access to the drive
FILE_SHARE_READ|FILE_SHARE_WRITE,//Share mode
NULL,//Security
OPEN_EXISTING,0,// no file attributes
NULL);
if (hDevice == INVALID_HANDLE_VALUE)//Cannot open the drive
return 0;
CDROM_TOC val; // table of contents for a generic CDROM
DWORD nBytesReturned;
BOOL bResult= DeviceIoControl(
hDevice,
IOCTL_CDROM_READ_TOC,//operation to perform
&val, sizeof(val),//no input buffer
&val, sizeof(val),//output buffer
&nBytesReturned,//#bytes returned
(LPOVERLAPPED) NULL);//synchronous I/O
CloseHandle(hDevice);
wisaacs
Light Poster
46 posts since Jun 2010
Reputation Points: 8
Solved Threads: 5
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page rendered in 0.0570 seconds
using 2.67MB