Problem reading/writing sectors

I made a program in Turbo Pascal 7.0 that sometimes reads sectors (using REGS and INTR standard procedures) from a floppy disk and writes it back to the same sector when my program do some modifications to the information, But sometimes in Windows 95 (DOS box) when I do this operation many times, the program "read" the sector but not writes its contents back (no writes anything). When I try this program in Windows NT (MS-DOS Console), it reads the sector but not writes back anything(!). What happen in this two cases? I need DPMI or something? The program works without problems in Win95 DOS Only-Mode and DOS 6.x. Thanks a Lot!!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Windows 95 and Windows NT 4.0 use different FATs. I think there is the problem.
mapadu2000Author Commented:
What programming tool (language) I need for re-write the application as Win32 Console App? Thanks a Lot
it depends, if u still want a program designed for DOS or (Dos-Mode) i think it can be done with BP7 (protected mode) or if you wish a 32-bit win-exe you could use Delphi, this is pascal based
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

mapadu2000Author Commented:
In Delphi, How I can read/writes sectors? Can you give me an example code? Thanks
I suggest you to compile your program in BP7 protected mode and try if it works in that mode.
you can't do direct disk reads in windows.

from win32sdk.hlp:

Windows NT: You can use the CreateFile function to open a disk drive or a partition on a disk drive. The function returns a handle to the disk device; that handle can be used with the DeviceIOControl function.
before running the program under windows 95.. Try using the LOCK command
lock a:

This will allow the program to have "DIRECT" access to the sectors on the drive by bypassing dos.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.