锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久国产视频网,亚洲精品乱码久久久久久蜜桃图片 ,亚洲精品国精品久久99热http://www.shnenglu.com/meet-dream/zh-cnWed, 07 May 2025 18:00:28 GMTWed, 07 May 2025 18:00:28 GMT60boost::graph鐨勫悕瀛楀弬鏁?/title><link>http://www.shnenglu.com/meet-dream/archive/2007/05/28/24987.html</link><dc:creator>meet-dream</dc:creator><author>meet-dream</author><pubDate>Mon, 28 May 2007 09:08:00 GMT</pubDate><guid>http://www.shnenglu.com/meet-dream/archive/2007/05/28/24987.html</guid><wfw:comment>http://www.shnenglu.com/meet-dream/comments/24987.html</wfw:comment><comments>http://www.shnenglu.com/meet-dream/archive/2007/05/28/24987.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.shnenglu.com/meet-dream/comments/commentRss/24987.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/meet-dream/services/trackbacks/24987.html</trackback:ping><description><![CDATA[     鎽樿: 鍒濊boost鐨勫悕瀛楀弬鏁幫紝緇欎漢涓縐嶁滄儕涓哄ぉ浜衡濈殑鎰熻錛屾病鎯沖埌....  <a href='http://www.shnenglu.com/meet-dream/archive/2007/05/28/24987.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/meet-dream/aggbug/24987.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/meet-dream/" target="_blank">meet-dream</a> 2007-05-28 17:08 <a href="http://www.shnenglu.com/meet-dream/archive/2007/05/28/24987.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>搴旂敤杞歡鍜屽鉤鍙拌蔣浠剁殑涓鐐規濊?/title><link>http://www.shnenglu.com/meet-dream/archive/2007/05/28/24973.html</link><dc:creator>meet-dream</dc:creator><author>meet-dream</author><pubDate>Mon, 28 May 2007 05:54:00 GMT</pubDate><guid>http://www.shnenglu.com/meet-dream/archive/2007/05/28/24973.html</guid><wfw:comment>http://www.shnenglu.com/meet-dream/comments/24973.html</wfw:comment><comments>http://www.shnenglu.com/meet-dream/archive/2007/05/28/24973.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.shnenglu.com/meet-dream/comments/commentRss/24973.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/meet-dream/services/trackbacks/24973.html</trackback:ping><description><![CDATA[     鎽樿:   <a href='http://www.shnenglu.com/meet-dream/archive/2007/05/28/24973.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/meet-dream/aggbug/24973.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/meet-dream/" target="_blank">meet-dream</a> 2007-05-28 13:54 <a href="http://www.shnenglu.com/meet-dream/archive/2007/05/28/24973.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>boost asio 2:threadinghttp://www.shnenglu.com/meet-dream/archive/2007/05/25/24822.htmlmeet-dreammeet-dreamFri, 25 May 2007 06:06:00 GMThttp://www.shnenglu.com/meet-dream/archive/2007/05/25/24822.htmlhttp://www.shnenglu.com/meet-dream/comments/24822.htmlhttp://www.shnenglu.com/meet-dream/archive/2007/05/25/24822.html#Feedback2http://www.shnenglu.com/meet-dream/comments/commentRss/24822.htmlhttp://www.shnenglu.com/meet-dream/services/trackbacks/24822.html闃呰鍏ㄦ枃

]]>
boost asio 1:how to use ithttp://www.shnenglu.com/meet-dream/archive/2007/05/25/24821.htmlmeet-dreammeet-dreamFri, 25 May 2007 06:04:00 GMThttp://www.shnenglu.com/meet-dream/archive/2007/05/25/24821.htmlhttp://www.shnenglu.com/meet-dream/comments/24821.htmlhttp://www.shnenglu.com/meet-dream/archive/2007/05/25/24821.html#Feedback2http://www.shnenglu.com/meet-dream/comments/commentRss/24821.htmlhttp://www.shnenglu.com/meet-dream/services/trackbacks/24821.html #include #include void print(const boost::asio::error& /*e*/) { std::cout << "Hello, world!\n"; } int main() { // 瀹氫箟涓涓猧o_service,瀹冪殑浣滅敤鏄敞鍐屾湇鍔★紝璋冪敤涓涓紓姝ヨ姹傚畬鎴愬悗瀵瑰簲鐨勬搷浣滐紙涓涓猦andle錛? boost::asio::io_service io; //娣誨姞涓涓畾鏃跺櫒鏈嶅姟錛? boost::asio::deadline_timer t(io, boost::posix_time::seconds(5)); //鍚姩涓涓紓姝ユ搷浣滐紝璇ユ搷浣滀細璁板綍浜巌o_service 鐨勪竴涓槦鍒椾腑 t.async_wait(print); //姣忎釜娉ㄥ唽鐨勬湇鍔″惎鍔ㄥ伐浣? io.run(); //5s鍚庯紝瀹氭椂鍣ㄦ椂闂村埌錛宲rint琚皟鐢紝鐒跺悗璇andle錛坧rint錛変粠闃熷垪涓垹闄? return 0; } 鍙互鐪嬪嚭錛屽涓涓嬌鐢ㄨ呮潵璇達紝asio鐨勫師鐞嗗緢綆鍗? 1銆傚畾涔変竴涓狪O_Service 2.鍚慖O_Service娉ㄥ唽涓涓湇鍔?璇ユ湇鍔″彲浠ユ槸io鏈嶅姟,涔熷彲浠ユ槸瀹氭椂鍣ㄦ湇鍔?褰撶劧,浣犱篃鍙互鑷繁璁㈠埗涓涓偖浠舵湇鍔? 3.鍦ㄨ鏈嶅姟涓婂惎鍔ㄤ竴涓紓姝ユ搷浣?榪欓渶瑕佷竴涓洖璋冨嚱鏁? 4.濡傛灉寮傛鎿嶄綔瀹屾垚,浣犵殑鍥炶皟鍑芥暟浼氳璋冪敤 5.鍙兘鐨勯敊璇鐞? 鐞嗚Вasio鐨勫師鐞嗗悗錛屽啓涓涓綉緇滈氫俊鐨勭▼搴忕畝鐩存槸渚濊懌鑺︾敾鐡㈢殑浜嬩簡 鎴戜滑鐪嬩竴涓椂闂存煡璇㈢殑鏈嶅姟绔細 #include #include #include #include #include #include #include using boost::asio::ip::udp; std::string make_daytime_string() { using namespace std; // For time_t, time and ctime; time_t now = time(0); return ctime(&now); } class udp_server { public: //瀵硅薄寤虹珛鏃訛紝娉ㄥ唽浜唘dp鐨剆ocket鏈嶅姟錛屾帴鐫灝卞紑濮嬩簡涓涓紓姝ョ殑鎺ユ敹鎿嶄綔 udp_server(boost::asio::io_service& io_service) : socket_(io_service, udp::endpoint(udp::v4(), 13)) { start_receive(); } private: void start_receive() { //鍚姩鐨勫紓姝ユ搷浣? socket_.async_receive_from( boost::asio::buffer(recv_buffer_), //鎺ユ敹緙撳啿鍖? remote_endpoint_, //瀛樺偍璇鋒眰鐨勫鎴峰湴鍧錛宨p+port boost::bind(&udp_server::handle_receive, this, //鏋勯犱竴涓洖璋冨嚱鏁幫紝瀹為檯璋冪敤浜嗘垚鍛樺嚱鏁癶andle_receive錛屽叿浣撹boost::bind boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred) ); } void handle_receive(const boost::asio::error& error, std::size_t /*bytes_transferred*/) { //鎺ュ埌瀹㈡埛绔殑淇℃伅錛屽拷鐣ヤ簡璇鋒眰鍐呭錛岀洿鎺ュ彂鍥炴湰鏈虹殑鏃墮棿錛屽彂閫佷篃鏄竴涓紓姝ユ搷浣? if (!error || error == boost::asio::error::message_size) { boost::shared_ptr message( new std::string(make_daytime_string())); socket_.async_send_to(boost::asio::buffer(*message), remote_endpoint_, boost::bind(&udp_server::handle_send, this, message, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); start_receive(); } } //鍙戦佸畬鎴愶紝蹇界暐 void handle_send(boost::shared_ptr /*message*/, const boost::asio::error& /*error*/, std::size_t /*bytes_transferred*/) { } udp::socket socket_; udp::endpoint remote_endpoint_; boost::array recv_buffer_; }; int main() { try { boost::asio::io_service io_service; udp_server server(io_service); io_service.run(); } catch (std::exception& e) { std::cerr << e.what() << std::endl; } return 0; } 鍙互鐪嬪埌錛岀敤asio寮鍙戜竴涓綉緇滄湇鍔$鐨勭▼搴忎竴浠跺涔堢畝鍗曠殑浜嬨傚姝ょ▼搴忕◢鍔犳敼鍔紝鎴戜滑灝卞彲浠ュ緩绔嬩竴涓敮鎸佸綰跨▼錛岄珮騫跺彂鐨勭綉緇滄湇鍔$▼搴忋? 鍚庨潰鎴戜滑灝嗙戶緇垎鏋恆sio鐨勫綰跨▼鏀寔錛屽緙撳啿錛岀綉緇滄祦絳夋洿濂界殑鍩虹鐗規с?

]]>
a simple template hook class for function and member functionshttp://www.shnenglu.com/meet-dream/archive/2007/03/05/19265.htmlmeet-dreammeet-dreamMon, 05 Mar 2007 15:51:00 GMThttp://www.shnenglu.com/meet-dream/archive/2007/03/05/19265.htmlhttp://www.shnenglu.com/meet-dream/comments/19265.htmlhttp://www.shnenglu.com/meet-dream/archive/2007/03/05/19265.html#Feedback0http://www.shnenglu.com/meet-dream/comments/commentRss/19265.htmlhttp://www.shnenglu.com/meet-dream/services/trackbacks/19265.htmlSome times,we need too hook some function to do something that's not so easy to do with normally add somecode.A solution is to hook focused functions and interface.Here is a template hook class maybe help your work easier,which complie with vs2005.It midify the jmp table to replace the function,maybe not聽properly聽 for other compliers.

class HookPfn
{
聽struct make_writeable
聽{
聽聽void* p;
聽聽MEMORY_BASIC_INFORMATION mbi_thunk;
聽聽make_writeable(void* _p):p(_p)
聽聽{
聽聽聽VirtualQuery(p, &mbi_thunk, sizeof(MEMORY_BASIC_INFORMATION));
聽聽聽VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize, PAGE_READWRITE, &mbi_thunk.Protect);
聽聽
聽聽}
聽聽~make_writeable()
聽聽{
聽聽聽VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize, mbi_thunk.Protect,&mbi_thunk.Protect);
聽聽}
聽};
public:
聽template<class F>
聽void restore(F pfn,unsigned long handle)
聽{
聽聽
聽聽void* p;
聽聽__asm mov eax,[pfn]
聽聽__asm mov dword ptr[p],eax
聽聽make_writeable write(p);
聽聽__asm push ecx
聽聽__asm mov eax,pfn
聽聽__asm inc eax
聽聽__asm mov ecx,handle
聽聽__asm mov dword ptr[eax],ecx
聽聽__asm pop ecx
聽}
聽template<class F1,class F2>
聽unsigned long redirect(F1 pfn1,F2 pfn2)
聽{
聽聽聽//should use restrict object prevent聽F1 and F2 's arguments and type not same
聽聽void* p;
聽聽__asm mov eax,[pfn1]
聽聽__asm mov dword ptr[p],eax
聽聽make_writeable write(p);

聽聽unsigned long bas1,bas2,of1,of2,of;
聽聽__asm push ecx
聽聽__asm mov eax,pfn1
聽聽__asm mov bas1,eax
聽聽__asm inc eax
聽聽__asm mov ecx,dword ptr[eax]
聽聽__asm mov of1,ecx

聽聽__asm mov eax,pfn2
聽聽__asm mov bas2,eax
聽聽__asm inc eax
聽聽__asm mov ecx,dword ptr[eax]
聽聽__asm mov of2,ecx

聽聽of=(bas2-bas1+of2-of1)+of1;

聽聽__asm mov eax,pfn1
聽聽__asm inc eax
聽聽__asm mov ecx,of
聽聽__asm mov dword ptr[eax],ecx
聽聽__asm pop ecx
聽聽return of1;
聽}

};

class mmt
{
public:
聽void donothing()
{
}
聽void donothing(int)
{
}
聽聽void dosomething()
{
}
};

void fastcall(int a,int b)
{
}
void askcall(int,int)
{
}


It can be used as example:
int main()
{
聽HookMemberFunction sh;
聽unsigned long hd=sh.redirect(&fastcall,&askcall);//test api
聽fastcall(0,0);//two聽function
聽askcall(0,0);
聽sh.restore(&fastcall,hd);
聽askcall(0,0);
聽fastcall(0,0);
//test overlay functions(donothing)
聽typedef void (mmt::*sp)(void);
聽sp p1=&mmt::dosomething;
聽sp p2=&mmt::donothing;
聽hd=sh.redirect(p1,p2);
聽mmt mt;//a class
聽mt.donothing();
聽mt.dosomething();
聽sh.restore(p1,hd);
聽mt.donothing();
聽mt.dosomething();

}
Although it can be work right,addtionly we may be use it not properly.Youcan add some strict class to prevent bad use of it by check if the argument and return type is strictly same.,if you need it.



]]>
久久青青草原亚洲av无码app| 中文字幕久久精品| 色综合久久久久综合99| 国产精品欧美久久久久无广告 | 99久久夜色精品国产网站| 午夜精品久久久久9999高清| 欧美伊人久久大香线蕉综合69 | 久久夜色精品国产噜噜麻豆| 久久天天躁狠狠躁夜夜2020一| 亚洲国产成人精品久久久国产成人一区二区三区综 | 久久久噜噜噜久久中文福利| 久久影院综合精品| 国内精品久久久久久99| 久久99精品国产99久久6男男| yellow中文字幕久久网| 久久精品免费大片国产大片| 色8激情欧美成人久久综合电| 伊人久久大香线蕉亚洲五月天| 久久久久国产精品熟女影院 | 国产午夜福利精品久久2021 | 91精品国产91久久| 精品久久久久久无码中文字幕| 日本精品久久久久影院日本| 亚洲国产精品成人久久| 青青草国产成人久久91网| 欧美粉嫩小泬久久久久久久| 久久精品国产精品亚洲精品| 久久久青草久久久青草| 热久久国产欧美一区二区精品| 青青草原综合久久大伊人| 国产精品无码久久综合 | 久久人人爽人人爽人人片AV东京热| 久久人搡人人玩人妻精品首页| 中文字幕人妻色偷偷久久| 欧美日韩中文字幕久久伊人| 久久精品成人欧美大片| 亚洲国产精品久久| 午夜欧美精品久久久久久久| 久久久久亚洲精品中文字幕| 国产∨亚洲V天堂无码久久久| 一本大道久久东京热无码AV|