Example #1
0
STDMETHODIMP CDisk::alform(IGeometry *g, long track, short filler)
{
	HRESULT hr;
	DSK_GEOMETRY geom;

	g_to_dg(g, &geom);
	hr = MapError(dsk_alform(m_driver, &geom, track, (unsigned char)filler));
	dg_to_g(&geom, g);
	return hr;
}
Example #2
0
STDMETHODIMP CLibrary::pcwgeom(VARIANT *buffer, IGeometry **geom)
{
	unsigned char *header;
	DSK_GEOMETRY dg;

	HRESULT hr = GetBuffer(buffer, &header, 512);
	if (FAILED(hr)) return hr;
	hr = MapError(dg_pcwgeom(&dg, header));
	dsk_free(header);
	if (!FAILED(hr)) hr = CGeometry::CreateInstance(geom);
	if (!FAILED(hr)) dg_to_g(&dg, *geom);
	return hr;
}
Example #3
0
STDMETHODIMP CDisk::lformat(IGeometry *g, long track, VARIANT *format, short filler)
{
	HRESULT hr;
	DSK_GEOMETRY geom;
	DSK_FORMAT *fmt;

	g_to_dg(g, &geom);
	hr = GetFormat(format, &fmt, geom.dg_sectors);
	if (FAILED(hr)) return hr;

	hr = MapError(dsk_lformat(m_driver, &geom, track, fmt, (unsigned char)filler));
	dsk_free(fmt);
	dg_to_g(&geom, g);
	return hr;
}
Example #4
0
STDMETHODIMP CDisk::get_geometry(IGeometry **g)
{
	DSK_GEOMETRY dg;
	dsk_err_t err;
	HRESULT hr;

	err = dsk_getgeom(m_driver, &dg);
	if (err)
	{
		if (g) *g = NULL;
		return MapError(err);
	}
	hr = CGeometry::CreateInstance(g);
	if (hr) return hr;

	dg_to_g(&dg, *g);
	return S_OK;
}
Example #5
0
STDMETHODIMP CLibrary::stdformat(int formatid, BSTR *name, BSTR *description, IGeometry **ppGeom)
{
	dsk_cchar_t fname, fdesc;
	DSK_GEOMETRY dg;

	HRESULT hr = MapError(dg_stdformat(&dg, (dsk_format_t)formatid, &fname, &fdesc));
	if (FAILED(hr)) return hr;

	*name        = CComBSTR(fname).Detach();
	*description = CComBSTR(fdesc).Detach();

	if (ppGeom)
	{
		hr = CGeometry::CreateInstance(ppGeom);
		if (!FAILED(hr)) dg_to_g(&dg, *ppGeom);
	}
	return hr;
}