/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * WinIoEx - AppMain.cpp
 *
 * WinIoEx Copyright (C) 2009-2010 Doug Chen.
 * 
 *
 * You can use the binary files or source code, I DO NOT restrict you anything on anywhere even 
 * commercial purpose, but please send a mail or leave a message on MSN to me before releasing your 
 * project for encourage me keep going on the project, thank you.
 *
 *
 *                                                           Doug Chen, 2009/11/10 20:23 Taiwan Taipei
 *	
 *	Name		: Doug Chen  (³―Αδ·½)
 * 	Email		: dougchen850208@gmail.com
 * 	MSN			: dougchen850208@gmail.com
 *  Location	: Taiwan Taipei
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */




#include <Windows.h>
#include <Commctrl.h>
#include <shlwapi.h>
#include <stdio.h>
#include <crtdbg.h>
#include <iostream>
#include <vector>

#include "resource.h"
#include "Sample.h"
#include "ErrorSearch.h"


LRESULT  CALLBACK WndProc_MainForm(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);

BOOL CALLBACK WndProc_TabPage_01(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);

BOOL CALLBACK WndProc_TabPage_02(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);

BOOL CALLBACK WndProc_TabPage_03(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);

BOOL CALLBACK WndProc_TabPage_04(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);

BOOL CALLBACK WndProc_TabPage_05(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);

BOOL CALLBACK WndProc_TabPage_06(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam);



void ResetTabPageRect(HWND _hwnd, RECT *_rect);
void HexString2Bytes(wchar_t	*_str, unsigned char *_out_buff, unsigned int _out_buff_len);





static HINSTANCE	g_hInst;



//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
int WINAPI WinMain(	HINSTANCE	_hinstance,
				    HINSTANCE	_prev_hinstance,
				    LPSTR		_cmdline,
				    int			_cmdshow)
{

	static	HWND		m_hDlg		= NULL;	
	static	MSG			m_Msg;
	static	RECT		m_Resolution;
	static	RECT		m_FormBounds;

	g_hInst = _hinstance;
	InitCommonControls();

	m_hDlg		= CreateDialog( _hinstance, MAKEINTRESOURCE(IDD_DIALOG_MAINFORM),NULL, (DLGPROC)WndProc_MainForm);

	if(m_hDlg==NULL)
	{
		MessageBox(NULL,L"Create form false !!!",L"Error",MB_OK);
		return FALSE;
	}

	GetWindowRect(GetDesktopWindow(), &m_Resolution);
	GetWindowRect(m_hDlg,&m_FormBounds);
	SetWindowPos(	m_hDlg,
					NULL,
					m_Resolution.right/2-(m_FormBounds.right-m_FormBounds.left)/2,
					m_Resolution.bottom/2-(m_FormBounds.bottom-m_FormBounds.top)/2,
					m_FormBounds.right-m_FormBounds.left,
					m_FormBounds.bottom-m_FormBounds.top,0);


	ShowWindow(m_hDlg,	 _cmdshow);


	while (GetMessage(&m_Msg, NULL, 0, 0))
	{
		if(!IsDialogMessage(m_hDlg, &m_Msg))
		{
			TranslateMessage(&m_Msg);
			DispatchMessage(&m_Msg);
		}
	}
	return FALSE;
}




//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
LRESULT  CALLBACK WndProc_MainForm(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam)
{

	static	HWND		m_TabCtrl	= NULL;
	static	HWND		m_TabPage1	= NULL;
	static	HWND		m_TabPage2	= NULL;
	static	HWND		m_TabPage3	= NULL;
	static	HWND		m_TabPage4	= NULL;
	static	HWND		m_TabPage5	= NULL;
	static	HWND		m_TabPage6	= NULL;


	static	MSG			m_Msg;
	static	TCITEM		m_TcItem;
	static	RECT		m_Rect;
	
	static	int			m_TabIndex;
	
	int					m_TabDymIndex = 0;

	switch( _msg )
	{

	case WM_INITDIALOG :

		m_TabCtrl	= GetDlgItem(_hwnd,IDC_TAB1);

		m_TcItem.mask = TCIF_TEXT | TCIF_IMAGE;
		m_TcItem.iImage = -1;

		m_TcItem.pszText = L"INFO";		
		TabCtrl_InsertItem(m_TabCtrl,m_TabDymIndex++, &m_TcItem);			
		m_TabPage1 = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_TABPAGE_01), _hwnd, WndProc_TabPage_01);	
		ResetTabPageRect(m_TabCtrl, &m_Rect);
		SetWindowPos(m_TabPage1, HWND_TOP, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, 0);

		m_TcItem.pszText = L"IO PORT";
		TabCtrl_InsertItem(m_TabCtrl,m_TabDymIndex++, &m_TcItem);			
		m_TabPage2 = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_TABPAGE_02), _hwnd, WndProc_TabPage_02);
		ResetTabPageRect(m_TabCtrl, &m_Rect);
		SetWindowPos(m_TabPage2, HWND_TOP, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, 0);

		m_TcItem.pszText = L"PCI BUS";
		TabCtrl_InsertItem(m_TabCtrl,m_TabDymIndex++, &m_TcItem);			
		m_TabPage3 = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_TABPAGE_03), _hwnd, WndProc_TabPage_03);
		ResetTabPageRect(m_TabCtrl, &m_Rect);
		SetWindowPos(m_TabPage3, HWND_TOP, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, 0);

		m_TcItem.pszText = L"CPU MSR";
		TabCtrl_InsertItem(m_TabCtrl,m_TabDymIndex++, &m_TcItem);			
		m_TabPage4 = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_TABPAGE_04), _hwnd, WndProc_TabPage_04);
		ResetTabPageRect(m_TabCtrl, &m_Rect);
		SetWindowPos(m_TabPage4, HWND_TOP, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, 0);

		m_TcItem.pszText = L"MEMORY";
		TabCtrl_InsertItem(m_TabCtrl,m_TabDymIndex++, &m_TcItem);			
		m_TabPage5 = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_TABPAGE_05), _hwnd, WndProc_TabPage_05);	
		ResetTabPageRect(m_TabCtrl, &m_Rect);
		SetWindowPos(m_TabPage5, HWND_TOP, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, 0);

		m_TcItem.pszText = L"ABOUT";
		TabCtrl_InsertItem(m_TabCtrl,m_TabDymIndex++, &m_TcItem);			
		m_TabPage6 = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_TABPAGE_06), _hwnd, WndProc_TabPage_06);	
		ResetTabPageRect(m_TabCtrl, &m_Rect);
		SetWindowPos(m_TabPage6, HWND_TOP, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, 0);


		TabCtrl_SetItemSize(m_TabCtrl,60,40);
		TabCtrl_SetCurSel(m_TabCtrl, 0);


		ShowWindow(m_TabPage1,SW_SHOW);
		ShowWindow(m_TabPage2,SW_HIDE);
		ShowWindow(m_TabPage3,SW_HIDE);
		ShowWindow(m_TabPage4,SW_HIDE);
		ShowWindow(m_TabPage5,SW_HIDE);
		ShowWindow(m_TabPage6,SW_HIDE);

		UpdateWindow(_hwnd);
		return TRUE;


	case WM_NOTIFY:
		switch (((LPNMHDR)_lparam)->code)
		{
			
			case TCN_SELCHANGE:
			{
				m_TabIndex = TabCtrl_GetCurSel (m_TabCtrl);
				
				
				ShowWindow(m_TabPage1,SW_HIDE);
				ShowWindow(m_TabPage2,SW_HIDE);
				ShowWindow(m_TabPage3,SW_HIDE);
				ShowWindow(m_TabPage4,SW_HIDE);
				ShowWindow(m_TabPage5,SW_HIDE);
				ShowWindow(m_TabPage6,SW_HIDE);


				switch(m_TabIndex)
				{
				case 0:
					ShowWindow(m_TabPage1,SW_SHOW);
					break;
				case 1:
					ShowWindow(m_TabPage2,SW_SHOW);
					break;
				case 2:
					ShowWindow(m_TabPage3,SW_SHOW);	
					break;
				case 3:				
					ShowWindow(m_TabPage4,SW_SHOW);
					break;
				case 4:
					ShowWindow(m_TabPage5,SW_SHOW);
					break;				
				case 5:
					ShowWindow(m_TabPage6,SW_SHOW);
					break;
				}
			}
			
		UpdateWindow(_hwnd);
			break;
		}
		break;

	case WM_CLOSE: 
		DestroyWindow(_hwnd); 
		return TRUE;

	case WM_DESTROY: 
		PostQuitMessage(0); 
		return TRUE;
	default :
		return FALSE;
	}
	return TRUE ;
}












////******************************************************************************************************
////
////------------------------------------------------------------------------------------------------------
//// Author	: Doug Chen
//// Date		: 2009/09/04
////******************************************************************************************************
//void SearchErrorText(unsigned long _err_code)
//{
//	wchar_t			m_ErrorHeaderPath[512]	= {0};
//	wchar_t			m_StringBuffer[65536]	= {0};	
//
//	unsigned char	m_FileDataBuff[65536]	= {0};
//	unsigned char	m_FileBuffTmp1[65536]	= {0};
//	unsigned char	m_FileBuffTmp2[65536]	= {0};
//
//
//	static unsigned long	m_ReadSize				=  0;
//	unsigned long	m_LastErrCode			=  0;
//	static HANDLE			m_ErrFileHandle;
//
//	std::wstring	m_WStringBuff;
//
//
//	std::vector<std::wstring>		m_TextLines;
//
//	if(g_ErrDataList.size()==0)
//	{
//		//g_ErrDataList.push_back(m_ErrDataUnit);
//		m_TextLines.clear();
//		//GetCurrentDirectory(512,m_ErrorHeaderPath);
//		//wcscat(m_ErrorHeaderPath,L"\\ErrorCode.h");
//		wcscat(m_ErrorHeaderPath,L"C:\\ErrorCode.h");
//		
//		m_ErrFileHandle = CreateFile(	m_ErrorHeaderPath,
//										GENERIC_READ,
//										FILE_SHARE_READ,
//										NULL,
//										OPEN_EXISTING,
//										FILE_ATTRIBUTE_NORMAL,
//										NULL);
//
//		if(m_ErrFileHandle==NULL)
//		{			
//			MessageBox(NULL,L"HANDLE NULL",L"BB",MB_OK);
//			return;
//		}
//
//
//		while(true)			
//		{
//			//Clear queue buffer.
//			m_WStringBuff.clear();
//
//
//			if(ReadFile(	m_ErrFileHandle,
//							m_FileDataBuff,
//							65536,
//							&m_ReadSize,
//							NULL))
//			{
//				for(int i=0;i<(int)m_ReadSize;i++)
//				{
//					if(m_FileDataBuff[i]=='\n')
//					{
//						//Clear temperatory buffers.
//						memset(m_FileBuffTmp1,0,65536);
//						memset(m_FileBuffTmp2,0,65536);
//
//						//Split original string as two substrings.
//						memcpy(m_FileBuffTmp1,m_FileDataBuff,i);
//						memcpy(m_FileBuffTmp2,m_FileDataBuff+i,m_ReadSize-i+1);
//
//						//Convert from bytes to string format, and queue the string.			
//						swprintf(m_StringBuffer,L"%s",m_FileBuffTmp1);
//						m_WStringBuff.append(m_StringBuffer);
//						m_TextLines.push_back(m_WStringBuff);
//
//						//m_WStringBuff.clear();
//						//swprintf(m_StringBuffer,L"%S",m_FileBuffTmp2);
//						//m_WStringBuff.append(m_StringBuffer);
//						
//					}
//					swprintf(m_StringBuffer,L"%S",m_FileDataBuff);
//					m_WStringBuff.append(m_StringBuffer);
//
//
//
//				}				
//				
//			}
//			m_LastErrCode = GetLastError();
//			swprintf(m_ErrorHeaderPath,L"ReadFile ErrorCode = %d",m_LastErrCode);
//			MessageBox(NULL,m_ErrorHeaderPath,L"BB",MB_OK);
//		
//		
//		}
//		
//
//
//		if(m_ErrFileHandle!=NULL)
//		{
//			CloseHandle(m_ErrFileHandle);
//		}
//
//		
//	}
//
//}



//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
void Hex2BinStr(unsigned long _value, wchar_t *_str,unsigned char _fix_bytes,bool _paired)
{
	wchar_t		m_Ret[1024]		= {0};
	wchar_t		m_Buff[1024]	= {0};
	int			m_BuffLen		=  _fix_bytes;
	wchar_t		*m_UpperStr;
	
	static		unsigned char m_FixedBytes = _fix_bytes;

	if(m_FixedBytes==1)	{		swprintf(m_Buff,L"%.2X",_value);	}	
	if(m_FixedBytes==2)	{		swprintf(m_Buff,L"%.4X",_value);	}	
	if(m_FixedBytes==4)	{		swprintf(m_Buff,L"%.8X",_value);	}	
	else				{		swprintf(m_Buff,L"%.2X",_value);	}	


	m_BuffLen = wcslen(m_Buff);

	if(_paired)
	{
		if((m_BuffLen%2)!=0)
		{
			swprintf(m_Buff,L"0%.2X",_value);
		}
	}



	m_UpperStr = _wcsupr(m_Buff);
	m_BuffLen = wcslen(m_UpperStr);


	for(int i=0;i<m_BuffLen;i++)
	{
		switch(m_UpperStr[i])
		{
		case '0':
			wcscat(m_Ret,L"0000");
			break;

		case '1':
			wcscat(m_Ret,L"0001");
			break;

		case '2':
			wcscat(m_Ret,L"0010");
			break;

		case '3':
			wcscat(m_Ret,L"0011");
			break;

		case '4':
			wcscat(m_Ret,L"0100");
			break;

		case '5':
			wcscat(m_Ret,L"0101");
			break;

		case '6':
			wcscat(m_Ret,L"0110");
			break;

		case '7':
			wcscat(m_Ret,L"0111");
			break;

		case '8':
			wcscat(m_Ret,L"1000");
			break;

		case '9':
			wcscat(m_Ret,L"1001");
			break;

		case 'A':
			wcscat(m_Ret,L"1010");
			break;

		case 'B':
			wcscat(m_Ret,L"1011");
			break;		
		case 'C':
			wcscat(m_Ret,L"1100");
			break;		
		case 'D':
			wcscat(m_Ret,L"1101");
			break;		
		case 'E':
			wcscat(m_Ret,L"1110");
			break;		
		case 'F':
			wcscat(m_Ret,L"1111");
			break;
		default:

			break;
		}
	}

	wcscpy(_str,m_Ret);

}























//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
void HexString2Bytes(wchar_t	*_str, unsigned char *_out_buff, unsigned int _out_buff_len)
{
	int				m_SpaceFound_1 = -1;
	int				m_SpaceFound_2 = -1;
	int				m_StrToExtA_Addr = 0;

	static int		m_OutBuffIndex = 0;
	int				m_InStrLen =(int)wcslen(_str);
	unsigned char	m_SpaceChar	= (unsigned char)' ';
	wchar_t			m_TextBuffer[16] = {0};

	unsigned char	m_OutBuff[1024] = {0};



	//-----------------------------------------
	//Append a space at the end of string.
	if(*(_str+m_InStrLen-1)!=m_SpaceChar)
	{
		wcscat(_str,L" ");
		m_InStrLen++;
	}



	for(static int i=0;i<m_InStrLen;i++)
	{
		if(((unsigned char)*(_str+i))==m_SpaceChar)
		{
			if(i>=2)
			{	
				m_TextBuffer[0] = '0';
				m_TextBuffer[1] = 'x';
				m_TextBuffer[2] = *(_str+i-2);
				m_TextBuffer[3] = *(_str+i-1);

				StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Addr);	
				m_OutBuff[m_OutBuffIndex++] = m_StrToExtA_Addr;
				
			
			}
	
		}
	}


	memcpy(_out_buff,	m_OutBuff,_out_buff_len);

}








//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
void ResetTabPageRect(HWND _hwnd, RECT *_rect)
{
	RECT rtab_0;

	GetWindowRect(_hwnd, _rect);
	ScreenToClient(GetParent(_hwnd), (POINT *) & _rect->left);
	ScreenToClient(_hwnd, (POINT *) & _rect->right);
	TabCtrl_GetItemRect(_hwnd, 0, &rtab_0);	

	_rect->top		= _rect->top + (rtab_0.bottom - rtab_0.top+25);		//x coord
	_rect->left		= _rect->left +2;									//y coord
	_rect->bottom	= _rect->bottom - (rtab_0.bottom - rtab_0.top+27);	// height
	_rect->right	= _rect->right - 3;									// width

}



//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
BOOL CALLBACK WndProc_TabPage_01(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam)
{

	static HFONT		m_TextFont;
	static BOOL			m_ResultRet;
	static wchar_t		m_ErrorCodeTxtBuff[128] = {0};

	switch( _msg )
	{
	case WM_INITDIALOG :
		
		 m_TextFont = CreateFont(26,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");

		 SendMessage(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),WM_SETFONT,(DWORD)m_TextFont,0);
		
		 m_TextFont = CreateFont(15,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Verdana");

		 SendMessage(GetDlgItem(_hwnd,IDC_STATIC_ERRORCODE_INITIAL2),WM_SETFONT,(DWORD)m_TextFont,0);
		
		 
		 

		return TRUE;

	case WM_COMMAND:
		switch(_wparam)
		{
		case IDC_BUTTON_INFO_INIT:
			m_ResultRet = SampleCode_Initial(0);
			break;

		case IDC_BUTTON_INFO_UNINIT:
			m_ResultRet = SampleCode_Initial(1);
			break;

		case IDC_BUTTON_INFO_AVAILABLE:
			m_ResultRet = SampleCode_Initial(2);
			break;

		case IDC_BUTTON_INFO_ENABLEERRMSG:
			m_ResultRet = SampleCode_Initial(3);
			break;
			
		default:
			return FALSE;
		}

		//Update errorcode information bar.
		if(m_ResultRet)	{	swprintf(m_ErrorCodeTxtBuff,L"SUCCESSFUL");}
		else			{	swprintf(m_ErrorCodeTxtBuff,L"GET WRONG !!!");}
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),m_ErrorCodeTxtBuff);
		return TRUE;
	default :
		return FALSE ;
	}

	return TRUE;
}

//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
BOOL CALLBACK WndProc_TabPage_02(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam)
{

	static int					m_StrToExtA_Addr			= 0;
	static int					m_StrToExtA_Value			= 0;

	static unsigned long		m_Buffer_Addr				= 0;
	static unsigned long		m_Buffer_Value				= 0;


	static wchar_t				m_TextBuffer[512]			= {0};

	static HFONT				m_TextFont;


	static BOOL					m_ResultRet;
	static wchar_t				m_ErrorCodeTxtBuff[128]		= {0};


	switch( _msg )
	{

	case WM_INITDIALOG :

		m_TextFont = CreateFont(26,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");

		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),WM_SETFONT,(DWORD)m_TextFont,0);




		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_ADDRESS),L"0x80");
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_VALUE),	L"0x00");
		SendDlgItemMessage(_hwnd,IDC_RADIO_IOPORT_UCHAR,   BM_SETCHECK ,   1,   0);
		break;

	case WM_COMMAND:
		switch(_wparam)
		{
		case IDC_BUTTON_IOPORT_READ:

			//Address textbox.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_ADDRESS),m_TextBuffer,512);			
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Addr);	
			
			//Value textbox.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_VALUE),m_TextBuffer,512);			
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
			

			if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_RADIO_IOPORT_UCHAR))
			{
				m_Buffer_Addr		= m_StrToExtA_Addr&0x000000FF;
				m_ResultRet = SampleCode_GetIoPort(0,m_Buffer_Addr,m_Buffer_Value);
				swprintf(m_TextBuffer,L"0x%.2X",m_Buffer_Value);				
			}
			else if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_RADIO_IOPORT_USHORT))
			{
				m_Buffer_Addr		= m_StrToExtA_Addr&0x0000FFFF;
				m_ResultRet = SampleCode_GetIoPort(1,m_Buffer_Addr,m_Buffer_Value);				
				swprintf(m_TextBuffer,L"0x%.4X",m_Buffer_Value);
			}
			else if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_RADIO_IOPORT_ULONG))
			{
				m_Buffer_Addr		= m_StrToExtA_Addr;
				m_ResultRet = SampleCode_GetIoPort(2,m_Buffer_Addr,m_Buffer_Value);
				swprintf(m_TextBuffer,L"0x%.8X",m_Buffer_Value);
			}
			else
			{
				//NOTHING.
			}

			//Update data context textbox.
			SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_VALUE),m_TextBuffer);


			break;

		case IDC_BUTTON_IOPORT_WRITE:
			//Address textbox.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_ADDRESS),m_TextBuffer,512);			
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Addr);	
			


			//Value textbox.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_IOPORT_VALUE),m_TextBuffer,512);			
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	



			if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_RADIO_IOPORT_UCHAR))
			{
				m_Buffer_Addr	= m_StrToExtA_Addr&0xFF;
				m_Buffer_Value	= m_StrToExtA_Value&0xFF;
				m_ResultRet = SampleCode_SetIoPort(0,m_Buffer_Addr,m_Buffer_Value);
			}
			else if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_RADIO_IOPORT_USHORT))
			{
				m_Buffer_Addr	= m_StrToExtA_Addr&0xFF;
				m_Buffer_Value	= m_StrToExtA_Value&0xFF;
				m_ResultRet = SampleCode_SetIoPort(1,m_Buffer_Addr,m_Buffer_Value);
			}
			else if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_RADIO_IOPORT_ULONG))
			{
				m_Buffer_Addr	= m_StrToExtA_Addr&0xFF;
				m_Buffer_Value	= m_StrToExtA_Value&0xFF;
				m_ResultRet = SampleCode_SetIoPort(02,m_Buffer_Addr,m_Buffer_Value);
			}
			else
			{
				//NOTHING.
			}

			break;
		default:
			return FALSE;
		}

		//Update errorcode information bar.
		if(m_ResultRet)	{	swprintf(m_ErrorCodeTxtBuff,L"SUCCESSFUL");}
		else			{	swprintf(m_ErrorCodeTxtBuff,L"GET WRONG !!!");}
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),m_ErrorCodeTxtBuff);

		return TRUE;


	default :
		return FALSE ;
	}

	return TRUE;
	//return DefWindowProc (_hwnd, _msg, _wparam, _lparam) ; 
}





//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
BOOL CALLBACK WndProc_TabPage_03(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam)
{
	static int				m_StrToExtA_Value		=  0;
	static wchar_t			m_TextBuffer[512]		= {0};

	static unsigned char	m_Bus					= 0;
	static unsigned char	m_Device				= 0;
	static unsigned char	m_Function				= 0;
	static unsigned char	m_Index					= 0;
	static unsigned long	m_Data					= 0;

	static HFONT			m_TextFont;

	static BOOL				m_ResultRet;
	static wchar_t			m_ErrorCodeTxtBuff[128] = {0};




	switch( _msg )
	{	

	case WM_INITDIALOG :

		m_TextFont = CreateFont(26,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");

		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),WM_SETFONT,(DWORD)m_TextFont,0);


		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_BUS),		L"0x00");
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_DEVICE),		L"0x00");
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_FUNCTION),	L"0x00");
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_INDEX),		L"0x00");
		
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_DATA),		L"0x00000000");
		return TRUE;

	case WM_COMMAND:
		if((LOWORD(_wparam)==IDC_BUTTON_PCIBUS_GET)||(LOWORD(_wparam)==IDC_BUTTON_PCIBUS_SET))
		{
			//Bus
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_BUS),m_TextBuffer,512);
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
			m_Bus = m_StrToExtA_Value&0xFF;

			//Device.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_DEVICE),m_TextBuffer,512);
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
			m_Device = m_StrToExtA_Value&0xFF;

			//Function.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_FUNCTION),m_TextBuffer,512);
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
			m_Function = m_StrToExtA_Value&0xFF;

			//Index.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_FUNCTION),m_TextBuffer,512);
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
			m_Index = m_StrToExtA_Value&0xFF;

			//Data.
			GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_DATA),m_TextBuffer,512);
			StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
			m_Data = m_StrToExtA_Value&0xFF;



			switch(LOWORD(_wparam))
			{
			case IDC_BUTTON_PCIBUS_GET:
				m_ResultRet = SampleCode_GetPciBus(1,m_Bus,m_Device,m_Function,m_Index,m_Data);
				swprintf(m_TextBuffer,L"0x%.8X",m_Data);
				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_DATA),m_TextBuffer);
				break;
			case IDC_BUTTON_PCIBUS_SET:
				m_ResultRet = SampleCode_SetPciBus(1,m_Bus,m_Device,m_Function,m_Index,m_Data);
				swprintf(m_TextBuffer,L"0x%.8X",m_Data);
				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_PCIBUS_DATA),m_TextBuffer);
				break;
			}

			//Update errorcode information bar.
		if(m_ResultRet)	{	swprintf(m_ErrorCodeTxtBuff,L"SUCCESSFUL");}
		else			{	swprintf(m_ErrorCodeTxtBuff,L"GET WRONG !!!");}
			SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),m_ErrorCodeTxtBuff);
			return TRUE;
		}
		else
		{
			return FALSE;
		}
		
	default :
		return FALSE ;
	}

	return TRUE;
}







//******************************************************************************************************
//
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
BOOL CALLBACK WndProc_TabPage_04(	HWND	_hwnd,
								 UINT	_msg,
								 WPARAM	_wparam,
								 LPARAM	_lparam)
{

	static wchar_t			m_OutBuff[1024]		= {0};
	static wchar_t			m_InBuff[1024]		= {0};
	static int				m_StrToExtA_Value	= 0;
	static unsigned char	m_CpuCoreIndex		= 0;
	static unsigned long	m_MsrIndex;
	static HFONT			m_TextFont;

	static unsigned long	m_CpuRegs_EAX		= 0;
	static unsigned long	m_CpuRegs_EBX		= 0;
	static unsigned long	m_CpuRegs_ECX		= 0;
	static unsigned long	m_CpuRegs_EDX		= 0;


	static BOOL				m_ResultRet;
	static wchar_t			m_ErrorCodeTxtBuff[128] = {0};


	switch( _msg )
	{

	case WM_INITDIALOG :

		m_TextFont = CreateFont(26,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");

		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),WM_SETFONT,(DWORD)m_TextFont,0);


		m_TextFont = CreateFont(15,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");


		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EAX_HEX),WM_SETFONT,(DWORD)m_TextFont,0);
		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EBX_HEX),WM_SETFONT,(DWORD)m_TextFont,0);
		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_ECX_HEX),WM_SETFONT,(DWORD)m_TextFont,0);
		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EDX_HEX),WM_SETFONT,(DWORD)m_TextFont,0);


		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_CPUINDEX),L"0x00");
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_MSRINDEX),L"0x0000019A");

		return TRUE;

	case WM_COMMAND:
		if( (LOWORD(_wparam)==IDC_BUTTON_CPUMSR_GET)||
			(LOWORD(_wparam)==IDC_BUTTON_CPUMSR_SET))
		{
			switch(LOWORD(_wparam))
			{
			case IDC_BUTTON_CPUMSR_GET:

				//Get value - CPU Inex.
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_CPUINDEX),m_InBuff,1024);
				if(wcscmp(m_InBuff,L"")==0){return FALSE;}
				StrToIntEx(m_InBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_CpuCoreIndex = (unsigned char)(m_StrToExtA_Value&0xFF);

				//Get value - MSR Index.
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_MSRINDEX),m_InBuff,1024);
				if(wcscmp(m_InBuff,L"")==0){return FALSE;}
				StrToIntEx(m_InBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_MsrIndex = (unsigned long)(m_StrToExtA_Value);

				//Call WinIoEx API.
				//WinIoEx_GetCpuMsr(GetCurrentProcess(),m_CpuCoreIndex,0x19A,m_CpuRegs);
				m_ResultRet = SampleCode_GetCpuMsr(	GetCurrentProcess(),
					m_CpuCoreIndex,
					m_MsrIndex,
					m_CpuRegs_EAX,
					m_CpuRegs_EBX,
					m_CpuRegs_ECX,
					m_CpuRegs_EDX  );

				//Set WindowText - EAX.			
				swprintf(m_InBuff,L"0x%.8X",m_CpuRegs_EAX);
				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EAX_HEX),m_InBuff);

				//Set WindowText - EBX.
				swprintf(m_InBuff,L"0x%.8X",m_CpuRegs_EBX);
				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EBX_HEX),m_InBuff);

				//Set WindowText - ECX.
				swprintf(m_InBuff,L"0x%.8X",m_CpuRegs_ECX);
				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_ECX_HEX),m_InBuff);

				//Set WindowText - EDX.		
				swprintf(m_InBuff,L"0x%.8X",m_CpuRegs_EDX);
				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EDX_HEX),m_InBuff);

				break;


			case IDC_BUTTON_CPUMSR_SET:

				//Get value - CPU Inex.
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_CPUINDEX),m_InBuff,1024);
				if(wcscmp(m_InBuff,L"")==0){return FALSE;}
				StrToIntEx(m_InBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_CpuCoreIndex = (unsigned char)(m_StrToExtA_Value&0xFF);

				//Get value - MSR Index.
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_MSRINDEX),m_InBuff,1024);
				if(wcscmp(m_InBuff,L"")==0){return FALSE;}
				StrToIntEx(m_InBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_MsrIndex = (unsigned long)(m_StrToExtA_Value);



				if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_CHECK_CPUMSR_EAX))
				{
					GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EAX_HEX),m_OutBuff,1024);
					if(wcscmp(m_OutBuff,L"")==0){return FALSE;}
					StrToIntEx(m_OutBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
					m_CpuRegs_EAX = (unsigned long)(m_StrToExtA_Value);
				}
				if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_CHECK_CPUMSR_EBX))
				{
					GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EBX_HEX),m_OutBuff,1024);
					if(wcscmp(m_OutBuff,L"")==0){return FALSE;}
					StrToIntEx(m_OutBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
					m_CpuRegs_EBX = (unsigned long)(m_StrToExtA_Value);
				}
				if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_CHECK_CPUMSR_ECX))
				{
					GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_ECX_HEX),m_OutBuff,1024);
					if(wcscmp(m_OutBuff,L"")==0){return FALSE;}
					StrToIntEx(m_OutBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
					m_CpuRegs_ECX = (unsigned long)(m_StrToExtA_Value);
				}
				if(BST_CHECKED == IsDlgButtonChecked(_hwnd,IDC_CHECK_CPUMSR_EDX))
				{
					GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_CPUMSR_EDX_HEX),m_OutBuff,1024);
					if(wcscmp(m_OutBuff,L"")==0){return FALSE;}
					StrToIntEx(m_OutBuff,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
					m_CpuRegs_EDX = (unsigned long)(m_StrToExtA_Value);
				}

				m_ResultRet = SampleCode_SetCpuMsr(	GetCurrentProcess(),
					m_CpuCoreIndex,
					m_MsrIndex,
					m_CpuRegs_EAX,
					m_CpuRegs_EBX,
					m_CpuRegs_ECX,
					m_CpuRegs_EDX  );
				break;
			}


			//Update errorcode information bar.
			if(m_ResultRet)	{	swprintf(m_ErrorCodeTxtBuff,L"SUCCESSFUL");}
			else			{	swprintf(m_ErrorCodeTxtBuff,L"GET WRONG !!!");}
			SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),m_ErrorCodeTxtBuff);

			return TRUE;
		}
		else
		{
			return FALSE;
		}

	default :
		return FALSE ;
	}

	return TRUE;
}








//******************************************************************************************************
// Access Memory.
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
BOOL CALLBACK WndProc_TabPage_05(	HWND	_hwnd,
								 UINT	_msg,
								 WPARAM	_wparam,
								 LPARAM	_lparam)
{

	static int				m_StrToExtA_Value		= 0;

	static unsigned long	m_MemIndex				= 0;
	static unsigned long	m_MemLeng				= 0;


	static wchar_t			m_TextBuffer[64]		= {0};
	static wchar_t			m_ContextBuff[65536]	= {0};

	static unsigned char	m_OutBuffer[1024]		= {0};
	static HFONT			m_TextFont;

	static wchar_t			m_ErrorCodeTxtBuff[128] = {0};

	static BOOL				m_ResultRet;


	switch( _msg )
	{

	case WM_INITDIALOG :	

		m_TextFont = CreateFont(26,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");

		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),WM_SETFONT,(DWORD)m_TextFont,0);

		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_INDEX),		L"0x000E0000");
		SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_LENGTH),	L"100");			



		m_TextFont = CreateFont(15,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New"); // Arial, MS Sans Serif


		SendMessage(GetDlgItem(_hwnd,IDC_EDIT_MEM_CONTEXT),WM_SETFONT,(DWORD)m_TextFont,0);


		return TRUE;

	case WM_COMMAND:


		if( (LOWORD(_wparam)==IDC_BUTTON_MEM_GET)||
			(LOWORD(_wparam)==IDC_BUTTON_MEM_SET))
		{

			switch(LOWORD(_wparam))
			{
			case IDC_BUTTON_MEM_GET:
				memset(m_TextBuffer,0,64);
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_INDEX),m_TextBuffer,64);
				StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_MemIndex = m_StrToExtA_Value;

				memset(m_TextBuffer,0,64);
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_LENGTH),m_TextBuffer,64);
				StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_MemLeng = m_StrToExtA_Value;

				//WinIoEx_GetMemBlock(m_MemBlock);
				m_ResultRet = SampleCode_GetMemBlock(m_MemIndex,m_MemLeng,&m_OutBuffer[0]);
				memset(m_ContextBuff,0,65536);

				//wcscat(m_ContextBuff,L"\t\r\n");

				//for(int i=0;i<16;i++)
				//{
				//	swprintf(m_TextBuffer,L"%.2X  ",i);
				//	wcscat(m_ContextBuff,m_TextBuffer);
				//}
				//wcscat(m_ContextBuff,L"\r\n-----------------------------------------------------------------------\r\n");

				for(int i=0;i < (int)m_MemLeng;i++)
				{
					swprintf(m_TextBuffer,L"%.2X ",(m_OutBuffer[i]));
					wcscat(m_ContextBuff,m_TextBuffer);

					if(((i+1)%16)==0)
					{
						wcscat(m_ContextBuff,L"\r\n");
					}
				}

				SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_CONTEXT),m_ContextBuff);

				break;

			case IDC_BUTTON_MEM_SET:				

				//------------------------
				//Get value - index.
				memset(m_TextBuffer,0,64);
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_INDEX),m_TextBuffer,64);
				StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_MemIndex = m_StrToExtA_Value;

				//------------------------
				//Get value - data.
				memset(m_TextBuffer,0,64);
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_LENGTH),m_TextBuffer,64);
				StrToIntEx(m_TextBuffer,STIF_SUPPORT_HEX,&m_StrToExtA_Value);	
				m_MemLeng = m_StrToExtA_Value;

				//------------------------
				//Get value - context data.
				GetWindowText(GetDlgItem(_hwnd,IDC_EDIT_MEM_CONTEXT),m_ContextBuff,65536);
				HexString2Bytes(m_ContextBuff,&m_OutBuffer[0],m_MemLeng);

				//------------------------
				//Execute WinIoEx API.
				m_ResultRet = SampleCode_SetMemBlock(m_MemIndex,m_MemLeng,&m_OutBuffer[0]);

				break;
			}

				//Update errorcode information bar.
			if(m_ResultRet)	{	swprintf(m_ErrorCodeTxtBuff,L"SUCCESSFUL");}
			else			{	swprintf(m_ErrorCodeTxtBuff,L"GET WRONG !!!");}
			SetWindowText(GetDlgItem(_hwnd,IDC_EDIT_ERRORCODE_INITIAL),m_ErrorCodeTxtBuff);

			return TRUE;
		}
		else
		{
			return FALSE;
		}


	default :
		return FALSE ;
	}

	return TRUE;
}





//******************************************************************************************************
// About.
//------------------------------------------------------------------------------------------------------
// Author	: Doug Chen
// Date		: 2009/09/04
//******************************************************************************************************
BOOL CALLBACK WndProc_TabPage_06(	HWND	_hwnd,
									UINT	_msg,
									WPARAM	_wparam,
									LPARAM	_lparam)
{	
	static HFONT				m_TextFont;
	static ERR_DATA_GROUP		m_ErrDataGroup;
	static int					m_StrToExtA_Value;
	static wchar_t				m_TextBuffer[512]		= {0};
	static wchar_t				m_TextBuffQueue[512]	= {0};
	

	switch( _msg )
	{

	case WM_INITDIALOG :
		//----------------------------------------------------------------
		m_TextFont = CreateFont(36,0,0,0,FW_DONTCARE,0,0,0,
			DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
			DEFAULT_QUALITY,DEFAULT_PITCH ,L"Verdana");

		SendMessage(GetDlgItem(_hwnd,IDC_STATIC_ABOUT_LOGO),WM_SETFONT,(DWORD)m_TextFont,0);

		////----------------------------------------------------------------
		//m_TextFont = CreateFont(15,0,0,0,FW_DONTCARE,0,0,0,
		//	DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
		//	DEFAULT_QUALITY,DEFAULT_PITCH ,L"Courier New");

		//SendMessage(GetDlgItem(_hwnd,IDC_EDIT_ABOUT_ERRORCODE),WM_SETFONT,(DWORD)m_TextFont,0);


		return TRUE;

	default :
		return FALSE ;
	}

	return TRUE;
}






