jeeqer
Newbie level 3
Hello fellows, I am a total noob, but i do learn quickly.
Bought one of chinese 8 pin soic programmer(SOFI sp8-B). I don't know how to serialize and also to write date and time with the programmer. Although they provide me with a sample file written in C++ of which i don't know where to input the date and time on chip. The sample file is attached. Somebody should help please.
// SampleSN.cpp :
//
#include "stdafx.h"
#include "stdio.h"
1 BOOL APIENTRY DllMain( HANDLE hModule,
2 DWORD ul_reason_for_call,
3 LPVOID lpReserved
4 )
5 {
6 return TRUE;
7 }
8 const char AUTOSN_DISC[] = "This is a sample.";
/****************************************************************************************************
** DLL¿âÃèÊö **
** ×î´óÔÊÐí128¸ö×Ö·û **
****************************************************************************************************/
9 extern "C" __declspec(dllexport) void GetDescription(char * ptext)
10 {
11 strcpy(ptext, AUTOSN_DISC);
12 }
/****************************************************************************************************
** ×Ô¶¯ÐòÁкŸüк¯Êý **
** **
** ´«Èë²ÎÊý: pBuf - оƬÊý¾Ý»º³åÇøÖ¸Õë(²»ÔÊÐí³¬³öоƬµÄÈÝÁ¿·¶Î§) **
** pMsg - »Ø´«ÃèÊöÐÅÏ¢, ×î¶à64¸öÓ¢ÎÄ×Ö·û(32¸öÖÐÎÄ×Ö) **
** ÿִÐÐÒ»´ÎоƬÉÕ¼ºó, ´ËÐÅÏ¢½«×Ô¶¯ÏÔʾÔÚ²Ù×÷ÐÅÏ¢´°ÄÚ ** **
****************************************************************************************************/
13 extern "C" __declspec(dllexport) void UpdateSN(BYTE * pBuf, char * pMsg)
14 {
15 DWORD dwCount;
16
17 dwCount = pBuf[0];
18 dwCount |= pBuf[1] << 8;
19 dwCount |= pBuf[2] << 16;
20 dwCount |= pBuf[3] << 24;
21
22 dwCount++;
23
24 pBuf[0] = (BYTE)(dwCount & 0xff);
25 pBuf[1] = (BYTE)(dwCount >> 8);
26 pBuf[2] = (BYTE)(dwCount >> 16);
27 pBuf[3] = (BYTE)(dwCount >> 24);
28
29 sprintf(pMsg, "[SampleSN.DLL]ÐòÁкŸüÐÂΪ: %8.8X", dwCount);
30 }
Bought one of chinese 8 pin soic programmer(SOFI sp8-B). I don't know how to serialize and also to write date and time with the programmer. Although they provide me with a sample file written in C++ of which i don't know where to input the date and time on chip. The sample file is attached. Somebody should help please.
// SampleSN.cpp :
//
#include "stdafx.h"
#include "stdio.h"
1 BOOL APIENTRY DllMain( HANDLE hModule,
2 DWORD ul_reason_for_call,
3 LPVOID lpReserved
4 )
5 {
6 return TRUE;
7 }
8 const char AUTOSN_DISC[] = "This is a sample.";
/****************************************************************************************************
** DLL¿âÃèÊö **
** ×î´óÔÊÐí128¸ö×Ö·û **
****************************************************************************************************/
9 extern "C" __declspec(dllexport) void GetDescription(char * ptext)
10 {
11 strcpy(ptext, AUTOSN_DISC);
12 }
/****************************************************************************************************
** ×Ô¶¯ÐòÁкŸüк¯Êý **
** **
** ´«Èë²ÎÊý: pBuf - оƬÊý¾Ý»º³åÇøÖ¸Õë(²»ÔÊÐí³¬³öоƬµÄÈÝÁ¿·¶Î§) **
** pMsg - »Ø´«ÃèÊöÐÅÏ¢, ×î¶à64¸öÓ¢ÎÄ×Ö·û(32¸öÖÐÎÄ×Ö) **
** ÿִÐÐÒ»´ÎоƬÉÕ¼ºó, ´ËÐÅÏ¢½«×Ô¶¯ÏÔʾÔÚ²Ù×÷ÐÅÏ¢´°ÄÚ ** **
****************************************************************************************************/
13 extern "C" __declspec(dllexport) void UpdateSN(BYTE * pBuf, char * pMsg)
14 {
15 DWORD dwCount;
16
17 dwCount = pBuf[0];
18 dwCount |= pBuf[1] << 8;
19 dwCount |= pBuf[2] << 16;
20 dwCount |= pBuf[3] << 24;
21
22 dwCount++;
23
24 pBuf[0] = (BYTE)(dwCount & 0xff);
25 pBuf[1] = (BYTE)(dwCount >> 8);
26 pBuf[2] = (BYTE)(dwCount >> 16);
27 pBuf[3] = (BYTE)(dwCount >> 24);
28
29 sprintf(pMsg, "[SampleSN.DLL]ÐòÁкŸüÐÂΪ: %8.8X", dwCount);
30 }