为工程加一个IPicture *pPic 变量。
直接调用OleLoadPicture函数从流中装载图像:
OleLoadPicture(pStm,fstatus.m_size,TRUE,IID_IPicture,(LPVOID*)&pPic));
由于该函数有时会导致失败,所以应当用SUCCEEDED宏来做一些适当的保护工作,只有在数据装载成功的前提下才能继续下面的图像显示工作:
int CQQ号申请工具Dlg::DrawPic(int x, int y, CDC* pDC)
{
if(SUCCEEDED(OleLoadPicture(pStm,fstatus.m_size,TRUE,IID_IPicture,(LPVOID*)&pPic)))
{
OLE_XSIZE_HIMETRIC hmWidth;
OLE_YSIZE_HIMETRIC hmHeight;
pPic->get_Width(&hmWidth);
pPic->get_Height(&hmHeight);
double fX,fY;
fX = (double)pDC->GetDeviceCaps(HORZRES)*(double)hmWidth/((double)pDC->GetDeviceCaps(HORZSIZE)*100.0);
fY = (double)pDC->GetDeviceCaps(VERTRES)*(double)hmHeight/((double)pDC->GetDeviceCaps(VERTSIZE)*100.0);
if(FAILED(pPic->Render(*pDC,0,0,(DWORD)fX,(DWORD)fY,0,hmHeight,hmWidth,-hmHeight,NULL))) {
AfxMessageBox(_T("渲染图像失败!"));
pPic->Release();
}
}
return 0;
}
OK。测试下没有问题。第一步已经完全完成。
2.现在开始进入http协议的处理。
这里有一个非常 重要的http请求。。。之后的加密就靠它了。。
GET: http://reg.qq.com/cgi-bin/checkconn?seed0.9770701186312112
Accept: */*
Accept-Language: zh-cn
Referer: http://reg.qq.com/
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0E; .NET4.0C)
Host: reg.qq.com
Connection: Keep-Alive
seed这个单词一看就知道是随机数。这个http请求,每次它会更新两个数组。
包含13个值。 对应于网页上的所有内容。
如密码,年,月,日,验证码 等等。
我们看下这个http请求的返回内容。
g_dataArray=new Array(new Array("77201a3173562c7715387d451b6a","44440b376f4f2c4b52216a561e54","62391830754f3d775e185d653b4a","13750a2a65523d6c482238520e71","7f79093a50403a7650237a572d50","14750a2a65523d6c4822395a0679","7137083a784f6c75563e7b471964","56211a3173562c771620655d0362","44750b2d6f57206b442951695d20","77771a3865442f624f256258007f","7121083a784f2675563e7b471964","1d791a3173562c7717286d550b7a","7775183e7245076a6e06437f215c"),
new Array(9759,9745,9748,9758,9752,9747,9755,9744,9754,9750,9749,9751,9753),"/cgi-bin/getnum");
这里可能看不明白。
我将这些数据逆序,并整理下
"7775183e7245076a6e06437f215c"
"1d791a3173562c7717286d550b7a",
"7121083a784f2675563e7b471964",
"77771a3865442f624f256258007f",
"44750b2d6f57206b442951695d20",
"56211a3173562c771620655d0362",
"7137083a784f6c75563e7b471964",
"14750a2a65523d6c4822395a0679",
"7f79093a50403a7650237a572d50",
"13750a2a65523d6c482238520e71",
"62391830754f3d775e185d653b4a",
"44440b376f4f2c4b52216a561e54",
"77201a3173562c7715387d451b6a",
看看我们在网页上申请后,所提交的http请求。