|
[求助]VC中真实MAC地址的获取方法。
#include "stdafx.h" #include <windows.h> //#include <iptypes.h> #include <iphlpapi.h> #include <NtDDNdis.h> #pragma comment ( lib, "iphlpapi.lib" ) BOOL WINAPI GetPhyMacAddress(char* strServiceName) { BOOL bRet = FALSE; char pstrBuf[512]; sprintf(pstrBuf, "//./%s", strServiceName); HANDLE hDev = CreateFile(pstrBuf, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); if ( hDev != INVALID_HANDLE_VALUE ) { int inBuf; BYTE outBuf[256] = { 0 }; DWORD BytesReturned; inBuf = OID_802_3_PERMANENT_ADDRESS; if ( DeviceIoControl(hDev, IOCTL_NDIS_QUERY_GLOBAL_STATS, (LPVOID)&inBuf, 4, outBuf, 256, &BytesReturned, NULL) ) { sprintf(pstrBuf, "物理mac:%02X-%02X-%02X-%02X-%02X-%02X\n", outBuf[0], outBuf[1], outBuf[2], outBuf[3], outBuf[4], outBuf[5]); printf(pstrBuf); bRet = TRUE; } inBuf = OID_802_3_CURRENT_ADDRESS; if ( DeviceIoControl(hDev, IOCTL_NDIS_QUERY_GLOBAL_STATS, (LPVOID)&inBuf, 4, outBuf, 256, &BytesReturned, NULL) ) { sprintf(pstrBuf, "当前mac:%02X-%02X-%02X-%02X-%02X-%02X\n", outBuf[0], outBuf[1], outBuf[2], outBuf[3], outBuf[4], outBuf[5]); printf(pstrBuf); bRet = TRUE; } CloseHandle(hDev); } return bRet; } // 网卡 MAC 地址 BOOL GetMacAddress() { UINT uErrorCode = 0; IP_ADAPTER_INFO iai; ULONG uSize = 0; DWORD dwResult = GetAdaptersInfo(&iai, &uSize); if ( dwResult == ERROR_BUFFER_OVERFLOW ) { PIP_ADAPTER_INFO piai = (PIP_ADAPTER_INFO)new BYTE[uSize]; dwResult = GetAdaptersInfo(piai, &uSize); if ( ERROR_SUCCESS == dwResult ) { while ( piai ) { printf("名称:%s\n", piai->AdapterName); printf("描述:%s\n", piai->Description); printf("类型:%d\n", piai->Type); GetPhyMacAddress(piai->AdapterName); printf("\n"); piai = piai->Next; } } delete[] piai; } return TRUE; } |
|
[求助][原创]我的电脑没有PS/2鼠标接口,还能用WINIO控制鼠标吗?
笔记本 好像触摸屏是ps2的 |
|
[注意]迅雷做得有点过了,也变成一个流氓软件了.
................. |
|
[转帖]CNNIC CA:最最最严重安全警告!
按你的说法 我向 Entrust.net 申请一个证书也一样能进行SSL MITM攻击 和cnnic没有任何关系 |
|
|
|
[求助]在魔兽上面写字
dx8 的ID3DXFont 占用资源很大 会让游戏的fps下降 |
|
[求助]用OD调试没有retn返回的括号
ctrl+A 重新分析下就有了 |
|
|
|
[求助]KeUpdateSystemTime 是如何更新的
ffdf0000映射到了ring3 就是GetTickCount读取值的地址 |
|
|
|
|
|
[求助]一个数据对齐的问题,VC6.0编译出的汇编代码有问题
用offsetof是标准的用法 /* Define offsetof macro */ #ifdef __cplusplus #ifdef _WIN64 #define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast<const volatile char&>((((s *)0)->m)) ) #else #define offsetof(s,m) (size_t)&reinterpret_cast<const volatile char&>((((s *)0)->m)) #endif #else #ifdef _WIN64 #define offsetof(s,m) (size_t)( (ptrdiff_t)&(((s *)0)->m) ) #else #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif #endif /* __cplusplus */ |
|
[求助]od在win7下用的即时调试器设置
还不行就把uac关了 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值