Thread: File IO to unpartioned data

  1. #1
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339

    File IO to unpartioned data

    Hi,

    I am wondering what the possibilities are for writing files to an unpartitioned area of a disk, i.e the free space area. Now this would obviously mean i would have no file system or partition tables etc to work with.

    The problem is im not sure on the best way to approach this and what tools i would need, so im after some advice on languages/library's i could use to do the job. For example, could it be done with something high level like C++ or would i need to go down to assembly.

    To make things more difficult a cross-platform (windows/linux) would be preferred.

    From what I can think up, I would need to have some kind of 'virtual' file system that my program knows about, and can use to read/write files from the disk area. I'm really just not sure about the actual IO.

    Thanks for any advice,

    Jack
    TNT
    You Can Stop Me, But You Cant Stop Us All

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Quote Originally Posted by (TNT) View Post
    Now this would obviously mean i would have no file system or partition tables etc to work with.
    No - you have a partition table with partitions that don't span the entire disk. Or you have a completely blank disk, or you're not using partition tables.

    The problem is im not sure on the best way to approach this and what tools i would need,
    What exactly are you trying to do? Why do you want to write files in unpartitioned space? Offer the forum more insight on what you're trying to accomplish - there may be a Better Way.

    To make things more difficult a cross-platform (windows/linux) would be preferred.
    Probably not going to happen, unless there's a library out there that I'm unaware of that bridges the gaps.

    If you're on Linux, I think it's just as easy as opening one of the /dev/hd? files. Granted, if there's anything on that drive, you need to know exactly what you're doing, or you will lose data. It probably also won't work on mounted drives and you'll need root privileges. Windows is an entirely different story. Again, what exactly do you want to do?

    From what I can think up, I would need to have some kind of 'virtual' file system that my program knows about, and can use to read/write files from the disk area.
    Why reinvent the wheel? Whatever you're using now has a perfectly good file system on it...

    File systems are not simple things - even something as primitive as FAT32 would be a considerable task. If hiding data is what you're after, then putting it in unpartitioned space is a waste of time/effort. There are tools to look in those places. You're better off encrypting your data with a reasonable algorithm in my opinion, and putting the files in some easier-to-access place.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Thanks for the info, and sorry i didn't provide more information. The reason i was looking into it was for a form of stenography, the data is already encrypted i was just wondering if i could extend my project by making the encrypted data hidden and appear purely as random data in the free space of the drive, hence adding a form of 'plausible deniability'.

    Maybe this is an unrealistic idea though, especially with a cross-platform requirement.
    TNT
    You Can Stop Me, But You Cant Stop Us All

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    TrueCrypt
    - is open source
    - is cross-platform
    - has steganographic features for plausible deniability
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  3. Bitmasking Problem
    By mike_g in forum C++ Programming
    Replies: 13
    Last Post: 11-08-2007, 12:24 AM
  4. spell check in C using a dictionary file
    By goron350 in forum C Programming
    Replies: 10
    Last Post: 11-25-2004, 06:44 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM