/*<Header>==============================================================
*
*	FILE MANAGER / "EIN_FL02.C"
*
*		[ EIN(tm) project : ファイル操作補助関数群 ]
*
*	COPYRIGHT  Nam  1994, All rights reserved.
*
*-----------------------------------------------------------------------
*	V1.0L01α	94.07.07/Nam	プロトタイプ
*</Header>==============================================================*/
#include	<stdio.h>
#include 	<stdlib.h>
#include 	<string.h>
#include	<snd.h>
#include	<winb.h>
#include	<te.h>
#include	<fntb.h>
#include	<gui.h>

#define	EIN_FILE
#include	"..\eintm.h"

#ifndef NOERR
#define	NOERR	(0)
#endif
#ifndef ERROR
#define	ERROR	(1)
#endif

/* from EIN_ASM1.ASM */
extern void		EIN_setVector( unsigned long * );
extern void		EIN_resetVector( unsigned long * );

/* from EIN_ASM2.ASM */
extern int	_EIN_getSect( char );

/*<Func>================================================================
*	int		EIN_getSectSize( int drv )
*
*	【概  要】	指定ドライブのセクタサイズ取得
*
*	【機  能】	指定ドライブのセクタサイズ(byte数)を取得します。
*				int24hハンドラをフックしているので、ドライブにアクセス
*				できなかった場合でもシェルのアラートを出しません。
*				後述の'EIN_getDiskFree'と併用すれば、複数ファイルを
*				コピー可能か否かをチェックできます。
*
*	【入  力】
*				drv		:	チェックしたいドライブ番号(英大文字)
*							[例] size = EIN_getSectSize('A');
*								 size = EIN_getSectSize( EIN_fnameDrv("E:\\"));
*
*	【出  力】
*
*	【関数値】	>= 0		正常終了(byte)
*				== -1		異常終了(パラメータエラー/ドライブにアクセス不可)
*
*	【注  意】	
*
*	【参  照】	
*
*-----------------------------------------------------------------------
*	V11L10	1994.07.16/Nam
*</Func>==============================================================*/
int		EIN_getSectSize( int drv )
{
	unsigned long	vect[3];	/* int24hハンドラの退避用 */
	register int		ret;
	
	if ( drv<'A' || drv>'Z' ){
		return ERROR;
	}
	EIN_setVector( vect );		/* int24をフック */
	ret = _EIN_getSect( drv );
	EIN_resetVector( vect );	/* int24ハンドラを復帰 */
	return ret;
}

