Monday, March 16, 2015

Cerberus Alpha: NTFS File Systems and Letter Case Headaches

On my test virtual machine I formatted the drives as FAT-32 without thinking, but in reality many Windows drives are formatted as NTFS by default. When I actually tried my test CD, it gave me an error stating that the file system was read only. I thought this was due to some error in the implementation of the mount function, so I tried a few modifications to that. When I finally got around to searching the internet for advice I found that the version of mount on TinyCore Linux by default does not have the ability to mount NTFS file systems. Tiny indeed!

To take care of this issue, all I had to do was add "ntfs-3g" into the list of utilities that my remastered OS would load. With that installed, mount would load the Windows file systems as read-write and cp worked as expected. Before I figured this out, I thought that my output suppressing statement was an issue (1>/dev/null 2&>1) was causing the issue and it actually did actually seem to be a problem because it seemed to mount the file system to /dev/null. I may have to take a look back and see if I can put that back in and it will still work.

The next major issue is one of letter case. I can expect certain files to be named differently depending on the OS:
  • Windows XP:
    • /WINDOWS/system32/
      • utilman.exe
      • sethc.exe
      • cmd.exe
  • Windows 7:
    • /Windows/System32/
      • Utilman.exe
      • sethc.exe
      • cmd.exe
  • Windows 8:          (need to confirm)
    • /Windows/System32/
      • Utilman.exe
      • sethc.exe
      • cmd.exe
I can't say for certain that these are the only possibilities, but at the very least there are two paths and two file names I could encounter. One shortcut I could take is to tell cp to access /*indows/*ystem32 and *tilman.exe, but aside from the fact that ignores the all-caps version of "WINDOWS" this still has a big problem. What do I copy to? If I copy *tilman.exe toutilman_bak.exe for example, how do I know whether I need to copy cmd.exe to Utilman.exe or utilman.exe?

I've come up with a few solutions, but none of them I really like. At the moment, the program assumes you want the Windows 7 version if you're copying Utilman, and the Windows XP version if you're copying sethc.exe. I could assume that Windows doesn't care about the case of Utilman, and then just only deal with the "windows" case issue. Or I could make the "thorough install" option attempt to copy all different possible versions, starting with the most likely. That would slow it down though. I also read something about a "no-case glob" option in bash, so I will have to explore that.

This case issue is what I'm working on at the moment. Another issue I'm working on is that my message regarding number of successful installs does not count correctly, but I may just scrap that idea as it's not very important.

No comments:

Post a Comment