STDMETHODIMP CDisk::get_compname(BSTR *pVal) { const char *name = dsk_compname(m_driver); if (!name) name = ""; *pVal = ret_string(name); return S_OK; }
IdentityForm::IdentityForm(wxWindow* parent, const wxString &title, DSK_PDRIVER dsk, DSK_GEOMETRY *dg) : wxDialog(parent, -1, title, wxDefaultPosition, wxSize(400, 375)) { const char *comp; char *comment; dsk_err_t err; unsigned char drv_status; memcpy(&m_dg, dg, sizeof(m_dg)); comp = dsk_compname(dsk); (void)new wxStaticText(this, -1, wxT("Driver:"), wxPoint(5, 5), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString(dsk_drvdesc(dsk), wxConvUTF8), wxPoint(105, 5), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Compression:"), wxPoint(5, 25), wxSize(95, 25)); (void)new wxStaticText(this, -1, comp ? wxString(comp, wxConvUTF8) : wxT("None"), wxPoint(105,25), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Sidedness:"), wxPoint(5, 45), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_sidedness), wxPoint(105,45), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Cylinders:"), wxPoint(5, 65), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_cylinders), wxPoint(105,65), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Heads:"), wxPoint(5, 85), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_heads), wxPoint(105,85), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Sectors:"), wxPoint(5, 105), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_sectors), wxPoint(105,105), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Sec. size:"), wxPoint(5, 125), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_secsize), wxPoint(105,125), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("1st sector:"), wxPoint(5, 145), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_secbase), wxPoint(105,145), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Data rate:"), wxPoint(5, 165), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("%d"), m_dg.dg_datarate), wxPoint(105,165), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Record mode:"), wxPoint(5, 185), wxSize(95, 25)); (void)new wxStaticText(this, -1, m_dg.dg_fm ? wxT("FM") : wxT("MFM"), wxPoint(105,185), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("R/W gap:"), wxPoint(5, 205), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("0x%02x"), m_dg.dg_rwgap), wxPoint(105,205), wxSize(300, 25)); (void)new wxStaticText(this, -1, wxT("Format gap:"), wxPoint(5, 225), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString::Format(wxT("0x%02x"), m_dg.dg_fmtgap), wxPoint(105,225), wxSize(300, 25)); err = dsk_drive_status(dsk, &m_dg, 0, &drv_status); (void)new wxStaticText(this, -1, wxT("Drive status:"), wxPoint(5, 245), wxSize(95, 25)); if (!err) { (void)new wxStaticText(this, -1, wxString::Format(wxT("0x%02x"), drv_status), wxPoint(105,245), wxSize(300, 25)); } else { (void)new wxStaticText(this, -1, wxString(dsk_strerror(err), wxConvUTF8), wxPoint(105,245), wxSize(300, 25)); } err = dsk_get_comment(dsk, &comment); if (err == DSK_ERR_OK && comment != NULL) { (void)new wxStaticText(this, -1, wxT("Comment:"), wxPoint(5, 265), wxSize(95, 25)); (void)new wxStaticText(this, -1, wxString(comment, wxConvUTF8), wxPoint(105,265), wxSize(300, 100)); } (void)new wxButton(this, wxID_OK, wxT("OK"), wxPoint(160, 305), wxSize(80, 30)); }
int do_login(int argc, char *outfile, char *outtyp, char *outcomp, int forcehead) { DSK_PDRIVER outdr = NULL; dsk_err_t e; DSK_GEOMETRY dg; unsigned char drv_status; const char *comp; char *comment; int indent = 0; int opt, any; dsk_reportfunc_set(report, report_end); e = dsk_open(&outdr, outfile, outtyp, outcomp); if (!e) e = dsk_set_retry(outdr, retries); if (forcehead >= 0 && !e) e = dsk_set_forcehead(outdr, forcehead); if (!e) e = dsk_getgeom(outdr, &dg); if (!e) { if (argc > 1) { printf("%s:\n", outfile); indent = 2; } printf( "%-*.*sDriver: %s\n", indent, indent, "", dsk_drvdesc(outdr)); comp = dsk_compname(outdr); if (comp) { printf("%-*.*sCompression: %s\n", indent, indent, "", dsk_compdesc(outdr)); } if (forcehead >= 0) { printf("%-*.*s[Forced to read from side %d]\n", indent, indent, "", forcehead); } printf("%-*.*sSidedness: %s\n" "%-*.*sCylinders: %2d\n" "%-*.*sHeads: %d\n" "%-*.*sSectors: %3d\n" "%-*.*sFirst sector: %3d\n" "%-*.*sSector size: %4ld\n" "%-*.*sData rate: %s\n" "%-*.*sRecord mode: %s\n" "%-*.*sComplement: %s\n" "%-*.*sR/W gap: 0x%02x\n" "%-*.*sFormat gap: 0x%02x\n", indent, indent, "", show_sidedness(dg.dg_sidedness), indent, indent, "", dg.dg_cylinders, indent, indent, "", dg.dg_heads, indent, indent, "", dg.dg_sectors, indent, indent, "", dg.dg_secbase, indent, indent, "", (long)dg.dg_secsize, indent, indent, "", show_rate(dg.dg_datarate), indent, indent, "", show_recmode(dg.dg_fm), indent, indent, "", (dg.dg_fm & RECMODE_COMPLEMENT) ? "Yes" : "No", indent, indent, "", dg.dg_rwgap, indent, indent, "", dg.dg_fmtgap); e = dsk_drive_status(outdr, &dg, 0, &drv_status); if (!e) { printf("\n%-*.*sDrive status: 0x%02x\n", indent, indent, "", drv_status); } e = dsk_get_comment(outdr, &comment); if (!e && comment) { char *c; printf("%-*.*sComment: ", indent, indent, ""); c = comment; while (*c) { putchar(*c); if (*c == '\n') printf("%-*.*s ", indent, indent, ""); c++; } } putchar('\n'); /* Dump filesystem options -- ie, any options beginning "FS." */ opt = 0; any = 0; while (dsk_option_enum(outdr, opt, &comment) == DSK_ERR_OK && comment != NULL) { int value; char buf[30]; if (!strncmp(comment, "FS:", 3) && dsk_get_option(outdr, comment, &value) == DSK_ERR_OK) { if (!any) { printf("%-*.*sFilesystem parameters:\n", indent, indent, ""); any = 1; } sprintf(buf, "%s:", comment + 3); printf("%-*.*s%-15.15s0x%02x\n", indent, indent, "", buf, value); } ++opt; } } if (outdr) { if (!e) e = dsk_close(&outdr); else dsk_close(&outdr); } if (e) { fprintf(stderr, "%s: %s\n", outfile, dsk_strerror(e)); return 1; } return 0; }