Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue #144 by correcting getbpb return code
getbpb now returns 0 instead of S_DONE in case of an uninitialized partition, copying the default BPB into the BPB. The previous return of S_DONE in case of uninitialized partitions resulted in rp->r_bpptr not getting set in bldbpb. This in combination with indicating success resulted in garbage returned via rp->r_bpptr. The DPB values are now being set to the default BPB ones in media_check https://github.com/FDOS/kernel/blob/ea951d8136444e334f06a313465b5844f738354e/kernel/fatfs.c#L1728 via call to bpb_to_dpb in case of an uninitialized partition. This may have side effects. But because DF_NOACCESS is still set, I think it is the right way to do it. The commit also masks high bit of AL for INT25/26 containing the drive number. Some programs may set the bit according to RBIL: "examination of CPWIN386.CPL indicates that if this call fails with error 0408h on an old-style (<32M) call, one should retry the call with the high bit of the drive number in AL set" Leaving the bit set may render the given drive number unusable. It should do no harm to mask it to increase the chance of the operation to succeed. Also, the AH should be set to zero, because drive is given only in AL.
- Loading branch information