// DeviceHelper.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "gx.h"
int WINAPI WinMain(	HINSTANCE hInstance,
					HINSTANCE hPrevInstance,
					LPTSTR    lpCmdLine,
					int       nCmdShow)
{
 	// TODO: Place code here.
	char temp[201];
	TCHAR src[200];
	TCHAR dst[200];
	TCHAR* dir=lpCmdLine;
	SystemParametersInfo(SPI_GETOEMINFO,200,(void*)temp,0);

	GXDisplayProperties x;			
	x=GXGetDisplayProperties();

	if (wcsstr((LPTSTR)temp,_T("iPAQ H3100")))
	{
		wcscpy(src,dir);
		wcscpy(dst,dir);
		wcscat(dst,_T("\\PocketMVP.exe"));
		wcscat(src,_T("\\PocketMVP_MONOPAQ.exe"));
		CopyFile(src,dst,FALSE);
	}	

	else if (x.cbxPitch>2||(x.cbxPitch<2))
	{
		wcscpy(src,dir);
		wcscpy(dst,dir);
		wcscat(dst,_T("\\PocketMVP.exe"));
		wcscat(src,_T("\\PocketMVP_IPAQ.exe"));
		CopyFile(src,dst,FALSE);
	}
	if ((wcsstr((LPTSTR)temp,_T("740"))||(wcsstr((LPTSTR)temp,_T("750"))&&(MessageBox(GetActiveWindow(),_T("Would you like to install the E740 ATI optimizations?"),_T("E740 detected"),MB_YESNO)==IDYES))
	{
		wcscpy(src,dir);
		wcscpy(dst,dir);
		wcscat(dst,_T("\\PocketMVP.exe"));
		wcscat(src,_T("\\PocketMVP_ATI.exe"));
		CopyFile(src,dst,FALSE);
	}
	else
	{
		wcscpy(src,dir);
		wcscat(src,_T("\\corelinklib.dll"));
		DeleteFile(src);
	}	
	wcscpy(src,dir);
	wcscat(src,_T("\\PocketMVP_MONOPAQ.exe"));
	DeleteFile(src);
	wcscpy(src,dir);
	wcscat(src,_T("\\PocketMVP_IPAQ.exe"));
	DeleteFile(src);
	wcscpy(src,dir);
	wcscat(src,_T("\\PocketMVP_ATI.exe"));
	DeleteFile(src);

	return 0;
}

