// CardReader.h : main header file for the CARDREADER DLL
//
#if !defined(AFX_CARDREADER_H__929A1DE0_0DE7_4A6A_8F23_B3E1D93E2CAD__INCLUDED_)
#define AFX_CARDREADER_H__929A1DE0_0DE7_4A6A_8F23_B3E1D93E2CAD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CCardReaderApp
// See CardReader.cpp for the implementation of this class
//
class CCardReaderApp : public CWinApp
{
public:
CCardReaderApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCardReaderApp)
//}}AFX_VIRTUAL
//{{AFX_MSG(CCardReaderApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CARDREADER_H__929A1DE0_0DE7_4A6A_8F23_B3E1D93E2CAD__INCLUDED_)
CardReaderTest.h
// CardReaderTest.h: interface for the CCardReaderTest class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CARDREADERTEST_H__159D5D0A_0724_4887_8E7F_D29E285865AE__INCLUDED_)
#define AFX_CARDREADERTEST_H__159D5D0A_0724_4887_8E7F_D29E285865AE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "TestBase.h"
#define MODULENAME "CardReader"
#define LOGPATH ".\\Log\\CardReader.log"
#define SOURCE_FILE ".\\tmp\\cardreader.src"
#define DES_FILE "temp$$test"
typedef DWORD ( *FoxMarkLib_RemoveNode)(LPTSTR ParentPath, LPTSTR childPath, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_CreateFile_Root)(LPTSTR RootName, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_AddNode)(LPTSTR ParentPath, LPTSTR NewNodeName, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_AddNodeAndValue)(LPTSTR ParentPath, LPTSTR NewNode, LPTSTR NodeValue, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_ChangeValue)(LPTSTR NodePath, LPTSTR NewValue, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_RemoveNode)(LPTSTR ParentPath, LPTSTR childPath, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_ReadNodeValue)(LPTSTR NodePath, LPTSTR FilePath, LPTSTR pbBuffer);
typedef DWORD ( *FoxMarkLib_GetPortVal)( WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize );
typedef DWORD ( *FoxMarkLib_SetPortVal)( WORD wPortAddr, DWORD dwPortVal, BYTE bSize );
typedef DWORD ( *FoxMarkLib_GetPhysMemVal)( DWORD dwPhysAddr, LPTSTR pbBuffer, int nLength);
typedef DWORD ( *FoxMarkLib_SetNodeAttribute)(LPTSTR NodePath, LPTSTR AttributeName, LPTSTR AttributeValue, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_FindChildNum)(LPTSTR NodePath, LPTSTR FilePath, long *pChildNum);
typedef DWORD ( *FoxMarkLib_RemoveAllNode)(LPTSTR AvlPath, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_RemoveAvl)(LPTSTR lUnitName, int nAVLIndex, LPTSTR FilePath);
typedef DWORD ( *FoxMarkLib_LoadXml)(LPTSTR FilePath);
typedef HANDLE ( *FoxMarkLib_GetDiskHandle)( int Num );
typedef enum
{
//test unit
FileRWC = 0x1,
} TESTITEM;
typedef enum
{
TESTPASS = 0,
TESTFAIL = 1,
TESTSTOP = 2,
} RETURNVALUE;
typedef enum
{
ERROR_CREATE_XML_PARAMETER = 0x00160001,
ERROR_READ_XML_FILE = 0x00160002,
ERROR_CREATE_SOURCE_FILE = 0x00160003,
ERROR_MAKE_SRCFILE_MD5 = 0x00160004,
ERROR_CHECK_SRCFILE_MD5 = 0x00160005,
ERROR_CARD_WRITE_PROTECT = 0x00160006,
ERROR_TEST_CARD_BAD = 0x00160007,
ERROR_TEST_CARD_NUM = 0x00160008,
ERROR_CARD_READ_TEST = 0x00160009,
ERROR_CARD_READ_COMPARE = 0x00160010,
ERROR_PARTITION_NUM_MISMATCH = 0x00160011,
} ERRORCODE;
class CCardReaderTest : public CTestBase
{
public:
TCHAR gModulePath[256];
public:
CCardReaderTest();
virtual ~CCardReaderTest();
virtual DWORD Test(int iTestMask,CListCtrl *list,DWORD dwIndex,int iCycleMode, int iCycleNum, int iHalt, int iPara);
virtual DWORD GetModuleInfo(PModuleInfo pMoudleinfo);
virtual DWORD DisplayWindow(int x,int y,int width,int high,CWnd *pParent);
virtual DWORD OutPutParameters(int iTestMask,CListCtrl *list,DWORD dwIndex,DWORD *dwTestReturn);
int GetRemovablePartitionNum(void);
DWORD GetUnit1Param();
BOOL FileExist(const char *pszFileName);
DWORD InitTestStatus();
DWORD FileRWCTest();
DWORD CreateRandomFile(int size);
public:
TCHAR xmlPath[MAX_PATH];
BOOL bLibready;
HINSTANCE hFoxLibDll;
TCHAR RootPath[MAXLEN];
TCHAR GetLibPath[MAXLEN];
TCHAR FailDescription[256];
unsigned char md5_str[40];
};
#endif // !defined(AFX_CARDREADERTEST_H__159D5D0A_0724_4887_8E7F_D29E285865AE__INCLUDED_)
/////////////FileVersion.h
// FileVersion.h: interface for the CFileVersion class.
// by Lichengyi2002@msn.com
//////////////////////////////////////////////////////////////////////
#ifndef __FILEVERSION_H_
#define __FILEVERSION_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CFileVersion
{
// Construction
public:
CFileVersion();
// Operations
public:
BOOL Open(LPCTSTR lpszModuleName);
void Close();
CString QueryValue(LPCTSTR lpszValueName, DWORD dwLangCharset = 0);
CString GetFileDescription() {return QueryValue(_T("FileDescription")); };
CString GetFileVersion() {return QueryValue(_T("FileVersion")); };
CString GetInternalName() {return QueryValue(_T("InternalName")); };
CString GetCompanyName() {return QueryValue(_T("CompanyName")); };
CString GetLegalCopyright() {return QueryValue(_T("LegalCopyright")); };
CString GetOriginalFilename() {return QueryValue(_T("OriginalFilename"));};
CString GetProductName() {return QueryValue(_T("ProductName")); };
CString GetProductVersion() {return QueryValue(_T("ProductVersion")); };
BOOL GetFixedInfo(VS_FIXEDFILEINFO& vsffi);
CString GetFixedFileVersion();
CString GetFixedProductVersion();
// Attributes
protected:
LPBYTE m_lpVersionData;
DWORD m_dwLangCharset;
// Implementation
public:
~CFileVersion();
};
#endif // __FILEVERSION_H_
Globedef.h
/*
File Name: GlobalDef.h
Description: Declare global define in foxburnin
Author: Dragon
Data: 2005-9-22
*/
#define WM_ERROR WM_APP+100
#define MAXLEN 256
#define MAXITEM 64
#define APPVERSION "FoxMark 1.0.0.1"
typedef enum
{
PRETEST = 0,
RUNIN = 1,
NONE = -1,
} TESTTYPE;
typedef enum
{
COUNTMODE = 0,
TIMEMODE = 1,
}RUNMODE;
typedef enum
{
FACTORYMODE = 0,
LABMODE = 1,
} ENVMODE;
typedef enum
{
TESTING = 0,
PASS = 1,
FAIL = 2,
SKIP = 3,
WAITING = 4,
STOP = 5,
} TESTRESULT;
typedef enum
{
SUCCESS = 0x00000000,
ERROR_UNKNOW = 0x00000001,
ERROR_OPEN_FILE = 0x00000002,
ERROR_CLOSE_FILE = 0x00000003,
ERROR_DISPLAY_WINDOW = 0x00000004,
ERROR_LOAD_LIBRARY = 0x00000005,
ERROR_STOP_TEST = 0xFFFFFFFF,
} COMM_ERRORCODE;
typedef enum
{
STARTTEST = 0,
ENDTEST = 1,
}TESTSTATUS;
typedef struct _SubItem
{
//CString szSubItemName;
TCHAR szSubItemName[MAXITEM];
int iTestType;
}SubItem, *PSubItem;
typedef struct _ModuleInfo
{
TCHAR szModuleName[MAXITEM];
int iTestItemCount;
SubItem sSubItem[MAXITEM];
TCHAR szIconPath[MAXITEM];
}ModuleInfo, *PModuleInfo;
typedef struct _SubItemResult
{
TCHAR szSubItemName[MAXITEM];
int iTestResult;
int iCurrentTime; // Current test times
int iFailTime; // Have already fail times
DWORD dwErrorCode;
TCHAR szStartTime[MAXITEM];
TCHAR szEndTime[MAXITEM];
TCHAR szDescription[MAXITEM];
}SubItemResult, *PSubItemResult;
typedef struct _TestResult
{
TCHAR szmoduleName[MAXITEM];
int iTestItemCount;
SubItemResult subItem[MAXITEM];
}TestResult,*PTestResult;
/////////md5.h
/*
File: MD5.h
Describe: The header file of MD5.cpp
Modify: Liugang(Gary)
Date: 07/02/2004
*/
#ifndef _MD5_ALGORITHM_
#define _MD5_ALGORITHM_
#define FILE_ERROR_SHARING_VIOLATION "00000000000000000000000000000000"
#define FILE_ERROR_LOCK_VIOLATION "11111111111111111111111111111111"
typedef struct _MD5_CTX
{
ULONG state[4];
ULONG count[2];
UCHAR buffer[64];
} MD5_CTX, * PMD5_CTX;
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
// F, G, H and I are basic MD5 functions.
#define T(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
// rotates x left n bits
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
// rotation is separate from addition to prevent recomputation.
#define FF(a, b, c, d, x, s, ac) { \
(a) += T ((b), (c), (d)) + (x) + (ULONG)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (ULONG)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (ULONG)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (ULONG)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
void MD5Init(PMD5_CTX pMD5Ctx);
void MD5Update(PMD5_CTX pMD5Ctx, PUCHAR message, ULONG ulBytes);
UCHAR * MD5Final(UCHAR * digest, PMD5_CTX pMD5Ctx);
UCHAR * MD5MakeString(UCHAR * message, UCHAR * digest);
UCHAR * MD5MakeData(LPVOID message, ULONG ulBytes, UCHAR * digest);
UCHAR * MD5MakeFile(LPCTSTR lpszFileName, UCHAR * digest);
BOOL MD5CheckFile(LPCTSTR lpszFileName, UCHAR * digest);
BOOL MD5MakeFolder(LPCTSTR lpszFolder, LPCTSTR lpszLogFile = NULL);
BOOL MD5CheckFolder(LPCTSTR lpszLogFile = NULL);
#endif
///////////Resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by CardReader.rc
//
#define IDD_DIALOG1 2000
#define IDC_STATIC_STATUS 2001
#define IDC_STATIC_ACTION 2002
#define IDC_STATIC_SRC 2003
#define IDC_STATIC_SRCPATH 2004
#define IDC_STATIC_DEC 2005
#define IDC_STATIC_DESPATH 2006
#define IDC_PROGRESS_FILERWC 2007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 2001
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2009
#define _APS_NEXT_SYMED_VALUE 2000
#endif
#endif
/////////////TestBase.h
#if !defined(AFX_TESTBASE_H__43741379_4538_4612_95DD_8516143C64A4__INCLUDED_)
#define AFX_TESTBASE_H__43741379_4538_4612_95DD_8516143C64A4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GlobalDef.h"
#define LINE "==========================================================================================================================\n"
#define ICONPATH ".\\icon\\"
class CTestBase : public CDialog
{
public:
CTestBase();
virtual ~CTestBase();
virtual DWORD DisplayWindow(int x,int y,int width,int high,CWnd *pParent);
virtual DWORD OutPutParameters(int iTestMask,CListCtrl *list,DWORD dwIndex,DWORD *dwTestReturn);
virtual DWORD Test(int iTestMask,CListCtrl *list,DWORD dwIndex,int iCycleMode, int iCycleNum, int iHalt,int iPara);
virtual DWORD GetModuleInfo(PModuleInfo pMoudleinfo);
virtual DWORD ModifyAVLForUnit(int iTestMask,int iAVLIndex,int iModifyMode);
virtual void StopTest();
void InitTestResult(LPCSTR lpModuleName,int iTestMask);
BOOL UpdateTestResult(int iSubModuleIndex,TESTRESULT testresult,LPCSTR lpErrorMessage,TESTSTATUS status,int iCurrentTime,int iFailTime,DWORD dwErrorCode=0x00000000);
TestResult GetTestResult();
void DisplayTestResult(CListCtrl *list,DWORD dwIndex);
BOOL SendErrorMessage();
BOOL WriteLogFile(LPCSTR lpFileName,DWORD dwTestIndex);
BOOL WriteLogHeader(LPCSTR lpFileName,LPCSTR lpModuleName);
BOOL m_bIsRunning;
BOOL m_bStop;
protected:
virtual BOOL PreTranslateMessage(MSG* pMsg);
TestResult m_TestResult;
char m_szSubTestItem[MAXLEN][MAXITEM];
int m_iSubTestItemCount;
int m_iTotalCount;
int m_iSubItemFailCount[MAXITEM];
TESTTYPE m_iTestType[MAXITEM]; //Define sub item is fit to prtest or runnin
};
#endif // !defined(AFX_TESTBASE_H__43741379_4538_4612_95DD_8516143C64A4__INCLUDED_)
////Stdafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__7D7E813A_CB55_4580_9FC8_695B91F33571__INCLUDED_)
#define AFX_STDAFX_H__7D7E813A_CB55_4580_9FC8_695B91F33571__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__7D7E813A_CB55_4580_9FC8_695B91F33571__INCLUDED_)