void state_usb_flash(){ QString path; HANDLE hDevice = CreateFileA("\\\\.\\PhysicalDrive1" , 0, 0, 0, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, 0); if(hDevice == INVALID_HANDLE_VALUE) { qDebug() << "\nhDevice - INVALID_HANDLE_VALUE"; } else { qDebug() << "\n hDevice handle ok"; qDebug() << " HANDLE: " << hDevice; int n; char dd[4]; DWORD dr = GetLogicalDrives(); for( int i = 0; i < 26; i++ ) { n = ((dr>>i)&0x00000001); if( n == 1 ) { dd[0] = char(65+i); dd[1] = ':'; dd[2] = '\\'; dd[3] = 0; path = QString("%1:\\").arg(dd[0]); int d; d = GetDriveType( path.toStdWString().c_str() ); if( d == DRIVE_REMOVABLE ) { qDebug() << " Label-usb-flash: " << path << endl; break; } } } }}