主题:如何获取EM9360的硬件ID号 共有44977人关注过本帖 |
---|
lqk |
1楼 信息 | 搜索 | 邮箱 |
加好友 发短信 |
Post By:2014-1-6 9:23:00 [显示全部帖子]
#include <Iphlpapi.h>
#pragma comment(lib, "Iphlpapi.lib") //Read MAC PIP_ADAPTER_INFO pAdapterInfo=NULL; ULONG ulLen=0; dwResult = GetAdaptersInfo( pAdapterInfo,&ulLen ); if( ERROR_BUFFER_OVERFLOW == dwResult ) { pAdapterInfo = (PIP_ADAPTER_INFO)new BYTE[ulLen]; dwResult = GetAdaptersInfo( pAdapterInfo,&ulLen ); } dl = 1; if( dwResult != NO_ERROR ) { sprintf( DatBuf, "Read adapter information failure! ErrCode:%d\r\n", dwResult ); OutPutMsg( DatBuf ); dl= 0; } do{ #ifdef WCE_PLATFORM_EM9161 strcpy( tmpBuf, "DM9CE1" ); #else strcpy( tmpBuf, "EMACB1" ); #endif dwResult = strcmp( pAdapterInfo->AdapterName, tmpBuf ); if( 0 != dwResult ) { sprintf( DatBuf, "Adpter:%s\r\n", pAdapterInfo->AdapterName ) ; OutPutMsg( DatBuf ); fHandle.Write( DatBuf, strlen(DatBuf)); pAdapterInfo = pAdapterInfo->Next; } else break; } while( NULL != pAdapterInfo->Next ); for (i1 = 0, i2 = 0; i1 < 5; ++i1) i2 += sprintf ( DatBuf + i2, "X:", pAdapterInfo->Address[i1]); sprintf ( DatBuf + i2, "X", pAdapterInfo->Address[i1]); sprintf( tmpBuf, "%s", DatBuf ); sprintf( DatBuf, "Adapter:%s MAC: %s\r\n", pAdapterInfo->AdapterName, tmpBuf ); OutPutMsg( DatBuf ); fHandle.Write( DatBuf, strlen(DatBuf)); LCD_Write( 0, row, tmpBuf, dl ); |
单帖管理 | 引用 | 回复 |