"The Linux Gazette...making Linux just a little more fun!"

(?) The Answer Guy (!)

By James T. Dennis, tag@lists.linuxgazette.net
Starshine Technical Services, http://www.starshine.org/

(?) Manipulating Clusters on a Floppy ...

From Padma Kumar on Thu, 17 Dec 1998


I'am basically want to write an application which needs to mark a particular predefined cluster as bad, and also need to change dynamically the value contained in the specific cluster. Is there any way by which we can write some data into a cluster, mark that cluster as bad, again i need to mark that bad cluster as usable and update the data in the cluster and then mark it as bad again.

I would be greatful if you could help me out with this task or tell me where i can find some information regarding this.

Thanking you for your consideration.
With Regards
Padma Kumar

(!) This is a rather dubious request.
You'd have to write you're own custom programs to do this (for each filesystem type that you wanted to support --- since different filesystems have different mechanisms for marking clusters as bad).
I've heard of MS-DOS virus writers, and some copy protection schemes, that used similar techniques to covertly write keying information on people's systems back when software copy-protection seemed feasible. The demise of this technique has two major dimensions:
There were chronic technical problems caused to legitimate users (thus decreasing customer satisfaction while increasing support costs). (Problems resulting from restoration of user programs and data after a hardware failure or upgrade are one example). A moderately skilled cracker could easily reverse engineer and bypass these measures (often by "NOP-ing" out the portions of code that performed the objectional hackery).
Many users/customer simply rejected the whole adversarial stance of software companies employing these techniques. We still see tacit acceptance of "dongles" (hardware keys, typically attached to parallel or serial ports which are queried by a program to enable its operation, typically with some sort of challenge response protocol). However, those are only used for a small number of high end packages.
To write your own code, just look at the examples in the programs: badblocks, mke2fs, and e2fsck. These all manipulate the badblocks lists on Linux' ext2 filesystems.
Naturally you can look at the sources for similar programs for each other fs which you intend to support. Note that most of these programs are under the GPL. While studying them and writing your own code is probably a fair use, if you intend to "cut and paste" code from them you must read and respect their licenses (which would be in conflict with any copy-protection applications which you might have in mind).
I realize I'm reading a lot into your question. I don't know of any other rational uses for bogus "bad blocks."

(?) Manipulating clusters on a floppy ...

From Padma Kumar on Sun, 20 Dec 1998

(?) Sir,

Thanks for spending time for answering my question ...

Basically i'm trying to write the code in Delphi (Assembly code in Delphi) for Windows 95 stand-alone PC.

I hope this clarifies ur doubt in short.

(!) It clarifies things just fine. This is the Linux Gazette. I answer questions that relate to Linux.
If you have programming questions that related to Win '95 and/or Delphi --- please go to Yahoo! and look for a Win '95 or Delphi "Answer Guy" (or other support forum).
You paid money for that commercial software --- with the stated or implied benefit of technical support. It's really a pity that the companies that sold you these packages aren't delivering on that promise.
As I said, you can look at the Linux sources for many examples of manipulating many types of filesystems (including MS-DOS/Win '95) -- those examples are mostly in C.

(?) Thanking you once more for ur consideration
Expecting a reply soon

(!) Have you ever read any of my other answers? How did you find my address without getting any indication of the focus of my work? Is it just that using all that vendorware has left you desparately seeking support from anyone you can find?

Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 36 January 1999

[ Answer Guy Index ] a b c 1 2 3 4 5 6 7 9 10 11 12
15 16 18 19 20 21 22 23 24 25 26 27 28
29 31 32 33 34 35 36 37 38 39 40 41 42 44
45 46 47 48 49 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66
67 69 72 76 77 78 79 80 81 82 84 85 86 87 91 94 95 96 97 98

[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]