#pragma once



#ifndef HDEVICE
#define HDEVICE unsigned long
#endif

typedef struct _DTL_WIRELESSNET_DEVICEINFO
{
	HDEVICE	hDevice;
	WCHAR	szName[MAX_PATH];
	GUID	guid;
	WCHAR	szHwid[MAX_PATH];
	BOOL	bIsWirelessNet;			//TRUE为无线网卡，FALSE为USB接口设备
	BOOL	bHasDriver;
	BOOL	bEnableUpdateBestDriver;
	BOOL	bEnableUpdateLastDriver;
	BOOL	bEnableUninstDriver;
}DTL_WIRELESSNET_DEVICEINFO,*PDTL_WIRELESSNET_DEVICEINFO;


typedef int (__stdcall* pfDTLGetWirelessNetArray)( PDTL_WIRELESSNET_DEVICEINFO* OUT ppInfoArr );


#define DTL_RESULT_ERROR		0	//安装失败，卸载失败
#define DTL_RESULT_SUCESS		1	//安装成功，卸载成功
#define	DTL_RESULT_REBOOT		2	//安装成功，卸载成功，需要重启


typedef int (__stdcall* pfDTLUninstallDriver)( HDEVICE IN hDevice );

typedef int (__stdcall* pfDTLUpdateBestDriver)( HDEVICE IN hDevice );

typedef int (__stdcall* pfDTLUpdateLastDriver)( HDEVICE IN hDevice );

typedef void (__stdcall* pfDTLFreeWirelessNetArray)();


class CDtlApiInterface
{
public:
	CDtlApiInterface(void);
	~CDtlApiInterface(void);

public:

	bool InitInterface(WCHAR* szMod);
	void CloseInterface();

	/*
	返回获取到的个数，
	-1，获取失败
	0，无无线网卡
	>0,无线网卡个数
	*/
	int GetWirelessNetArray( PDTL_WIRELESSNET_DEVICEINFO* OUT ppInfoArr );

	/*卸载驱动*/
	int UninstallDriver( HDEVICE IN hDevice );

	/*安装推荐驱动*/
	int UpdateBestDriver( HDEVICE IN hDevice );

	/*安装最新驱动*/
	int UpdateLastDriver( HDEVICE IN hDevice );

	/*释放数组*/
	void FreeWirelessNetArray();

private:

	pfDTLGetWirelessNetArray	m_pfDTLGetWirelessNetArray;
	pfDTLUninstallDriver		m_pfDTLUninstallDriver;
	pfDTLUpdateBestDriver		m_pfDTLUpdateBestDriver;
	pfDTLUpdateLastDriver		m_pfDTLUpdateLastDriver;
	pfDTLFreeWirelessNetArray	m_pfDTLFreeWirelessNetArray;

	HMODULE		m_hMod;
};
