static USHORT CheckWriteProtect(PVOLINFO pVolInfo) { USHORT rc; USHORT usSectors = 1; if (f32Parms.fMessageActive & LOG_FUNCS) Message("CheckWriteProtect"); rc = FSH_DOVOLIO(DVIO_OPREAD, DVIO_ALLACK, pVolInfo->hVBP, pVolInfo->pbFatSector, &usSectors, 1L); if (!rc) { usSectors = 1; rc = FSH_DOVOLIO(DVIO_OPWRITE, DVIO_ALLACK, pVolInfo->hVBP, pVolInfo->pbFatSector, &usSectors, 1L); } return rc; }
int far pascal _loadds FS_MOUNT( unsigned short flag, struct vpfsi far *pvpfsi, struct vpfsd far *pvpfsd, unsigned short hVPB, char far *pBoot ) { unsigned short cbSec = 1; unsigned short old_hVPB; unsigned short selector; char far *p; int rc; int i; kprintf("**** FS_MOUNT\n"); if (flag) return ERROR_NOT_SUPPORTED; memset(pvpfsd, 0, sizeof(struct vpfsd)); secsize = pvpfsi->vpi_bsize; volsize = pvpfsi->vpi_totsec * secsize; kprintf("volume size: %lu bytes, sector size: 0x%x\n", volsize, secsize); pdpb = (struct dpb far *)pvpfsi->vpi_hDEV; kprintf("DPB addr: pvpfsi->vpi_hDEV = 0x%08lx\n", pdpb); kprintf("vpi_pDCS = 0x%08lx, vpi_pVCS = 0x%08lx\n", pvpfsi->vpi_pDCS, pvpfsi->vpi_pVCS); kprintf("hVPB: 0x%04x\n", hVPB); if (drvletter == 'A' + pvpfsi->vpi_drive) { my_hVPB = hVPB; // ... memset(boot, 0, sizeof(boot)); rc = FSH_DOVOLIO(8, // return errors directly, not through harderr daemon 1 + 2 + 4 + 8, // ABORT | RETRY | FAIL | IGNORE hVPB, boot, &cbSec, 0); kprintf("FSH_DOVOLIO: rc = 0x%x\n", rc); if (rc) FSH_INTERR(read_panic, strlen(read_panic)); kprintf("read %u sectors\n", cbSec); // ... // save devcaps structure to the safe place memmove(&devcaps, pvpfsi->vpi_pDCS, sizeof(struct devcaps)); // save volume characteristics memmove(&volchars, pvpfsi->vpi_pVCS, sizeof(volchars)); memset(save_map, 0, sizeof(save_map)); return NO_ERROR; // volume is recognized } return NO_ERROR + 1; // volume is not recognized }
int far pascal _loadds FS_READ( struct sffsi far *psffsi, struct sffsd far *psffsd, char far *pData, unsigned short far *pLen, unsigned short IOflag ) { int rc; kprintf("**** FS_READ\n"); filemax = psffsi->sfi_size; filepos = psffsi->sfi_position; kprintf("sfi_size = %lu, sfi_position = %lu\n", filemax, filepos); kprintf("buf = 0x%08lx, size = %u\n", pData, *pLen); if (*((unsigned long far *)psffsd + 1)) // direct read flag { if (!(rc = FSH_PROBEBUF(1, pData, *pLen))) { unsigned short cbSec = *pLen / secsize; if (rc = FSH_DOVOLIO(8, // return errors directly, don't use harderr daemon 1 + 2 + 4, // ABORT | RETRY | FAIL psffsi->sfi_hVPB, pData, &cbSec, filepos / secsize)) kprintf("FSH_DOVOLIO failed, rc = %u\n", rc); else { kprintf("FSH_DOVOLIO(buf = 0x%08lx, len = %u, start = %lu sectors) succeeded\n", pData, cbSec, filepos / secsize); *pLen = cbSec * secsize; kprintf("%u butes read\n", *pLen); filepos += *pLen; rc = NO_ERROR; } } else { kprintf("FS_READ: FSH_PROBEBUF failed!\n"); rc = 1; } } else { filebase = *((unsigned long far *)psffsd); advance_ptr(); if (rc = MFS_READ(pData, pLen)) { kprintf("MFS_READ failed, rc = %u\n", rc); } } psffsi->sfi_position = filepos; return rc; }