// acclib.c : .DLL initialization

#include "FTest.h"


HINSTANCE hDLL;              // Handle to DLL
DWORD LibId;


BOOL LoadDll(void)
{
	BOOL NotAllFunctionsPresent;
	BOOL Notf2, Notf3, Notf4, Notf5;

	hDLL = LoadLibrary(accLibName);
	LibId = DLLVER;

	if (hDLL != NULL)
	{
		FFDLL(2, "DiskOpInit");
		FFDLL(3, "FormatCylinder");
		FFDLL(4, "DiskCompletion");
		FFDLL(5, "GetFloppyType");

		NotAllFunctionsPresent =
			Notf2 && Notf3 && Notf4 && Notf5; 

		if (NotAllFunctionsPresent)
		{
			FreeLibrary(hDLL);
			printf("Function not found!\n");
			return FALSE;
		};
		return TRUE;
	}
	else
	{
		printf("File %s not found!\n", accLibName);
		return FALSE;
	}
}

void FreeDll(void)
{
	FreeLibrary(hDLL);
}

int DiskOpInit(DWORD Drive, DWORD MediaType, LPCTSTR VolumeLab, BOOL NeedVerify, LPDWORD DiskHandle)
{
	return lpfnDllFunc2(Drive, MediaType, VolumeLab, NeedVerify, DiskHandle);
}

int FormatCylinder(DWORD Cyl)
{
	return lpfnDllFunc3(Cyl);
}

int DiskCompletion(BOOL NeedFatsAndRoot, DWORD DiskHandle)
{
	return lpfnDllFunc4(NeedFatsAndRoot, DiskHandle);
}

int GetFloppyType(DWORD Drive, LPDWORD ErrNo)
{
	return lpfnDllFunc5(Drive, ErrNo);
}




