Results 1 to 2 of 2

Thread: QFile: cannot retrieve size from PHYSICALDRIVE

  1. #1

    Default QFile: cannot retrieve size from PHYSICALDRIVE

    I wrote a tool which was originally thought for analyzing hard disc images. Now I'm trying to use this tool for live analyzis of computer systems, means my tool tries to access the physical drive.

    I implemented my tool in QT accessing the images using the QFile class. Instead of images I hand over the physical drive, under windows it is \.\PHYSICALDRIVE0.

    I was wondering first I didnt get any errors, I can open the device, I can seek, get the position, almost everything. The only thing I have problems with is retrieving the drive size with size().

    Some code example:

    QFile file( "\\.\PHYSICALDRIVE0" );
    file.open( QIODevice::ReadOnly );

    file.size(); //returns 0

    I'm not too deep into QT, probably this is some easy thing. I would like to thank everybody who has an idea what is the reason.

    thanks in advance!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFile: cannot retrieve size from PHYSICALDRIVE

    What happens if you open this file using fopen(), fseek() to SEEK_END then call ftell()? Do you still get 0?

    Perhaps this really isn't a "file" in the normal sense. Some operations might appear to work, but others fail because the underlying device isn't a real file.

Similar Threads

  1. Replies: 4
    Last Post: 9th May 2011, 10:52
  2. QFile &QFile::operator= is private
    By Fallen_ in forum Newbie
    Replies: 1
    Last Post: 15th March 2011, 16:08
  3. retrieve code from DLL
    By kernel.roy in forum Newbie
    Replies: 1
    Last Post: 15th September 2010, 07:21
  4. Replies: 11
    Last Post: 5th April 2010, 09:38
  5. QPainter - Retrieve drawText size
    By Raccoon29 in forum Qt Programming
    Replies: 2
    Last Post: 2nd May 2008, 10:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.