锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久无码人妻精品一区二区三区
,国产精品午夜久久,久久精品国产亚洲综合色 http://m.shnenglu.com/meet-dream/zh-cn Thu, 03 Jul 2025 09:10:33 GMT Thu, 03 Jul 2025 09:10:33 GMT 60 boost::graph鐨勫悕瀛楀弬鏁?/title> http://m.shnenglu.com/meet-dream/archive/2007/05/28/24987.htmlmeet-dream meet-dream Mon, 28 May 2007 09:08:00 GMT http://m.shnenglu.com/meet-dream/archive/2007/05/28/24987.html http://m.shnenglu.com/meet-dream/comments/24987.html http://m.shnenglu.com/meet-dream/archive/2007/05/28/24987.html#Feedback 5 http://m.shnenglu.com/meet-dream/comments/commentRss/24987.html http://m.shnenglu.com/meet-dream/services/trackbacks/24987.html 闃呰鍏ㄦ枃 ]]> 搴旂敤杞歡鍜屽鉤鍙拌蔣浠剁殑涓鐐規濊?/title> http://m.shnenglu.com/meet-dream/archive/2007/05/28/24973.htmlmeet-dream meet-dream Mon, 28 May 2007 05:54:00 GMT http://m.shnenglu.com/meet-dream/archive/2007/05/28/24973.html http://m.shnenglu.com/meet-dream/comments/24973.html http://m.shnenglu.com/meet-dream/archive/2007/05/28/24973.html#Feedback 4 http://m.shnenglu.com/meet-dream/comments/commentRss/24973.html http://m.shnenglu.com/meet-dream/services/trackbacks/24973.html 闃呰鍏ㄦ枃 ]]> boost asio 2:threading http://m.shnenglu.com/meet-dream/archive/2007/05/25/24822.htmlmeet-dream meet-dream Fri, 25 May 2007 06:06:00 GMT http://m.shnenglu.com/meet-dream/archive/2007/05/25/24822.html http://m.shnenglu.com/meet-dream/comments/24822.html http://m.shnenglu.com/meet-dream/archive/2007/05/25/24822.html#Feedback 2 http://m.shnenglu.com/meet-dream/comments/commentRss/24822.html http://m.shnenglu.com/meet-dream/services/trackbacks/24822.html 闃呰鍏ㄦ枃 ]]> boost asio 1:how to use it http://m.shnenglu.com/meet-dream/archive/2007/05/25/24821.htmlmeet-dream meet-dream Fri, 25 May 2007 06:04:00 GMT http://m.shnenglu.com/meet-dream/archive/2007/05/25/24821.html http://m.shnenglu.com/meet-dream/comments/24821.html http://m.shnenglu.com/meet-dream/archive/2007/05/25/24821.html#Feedback 2 http://m.shnenglu.com/meet-dream/comments/commentRss/24821.html http://m.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 functions http://m.shnenglu.com/meet-dream/archive/2007/03/05/19265.htmlmeet-dream meet-dream Mon, 05 Mar 2007 15:51:00 GMT http://m.shnenglu.com/meet-dream/archive/2007/03/05/19265.html http://m.shnenglu.com/meet-dream/comments/19265.html http://m.shnenglu.com/meet-dream/archive/2007/03/05/19265.html#Feedback 0 http://m.shnenglu.com/meet-dream/comments/commentRss/19265.html http://m.shnenglu.com/meet-dream/services/trackbacks/19265.html Some 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无码偷窥 |
久久最近最新中文字幕大全 |
久久亚洲国产精品五月天婷 |
无码国产69精品久久久久网站 |
伊人久久免费视频 |
思思久久99热只有频精品66 |
国产V亚洲V天堂无码久久久 |
日韩亚洲国产综合久久久 |
国产精品美女久久久m |
伊人久久一区二区三区无码 |
国产精品久久久久AV福利动漫 |
欧美成a人片免费看久久 |
久久青青草原亚洲av无码app |
久久久无码精品亚洲日韩软件 |
99久久久国产精品免费无卡顿 |
色婷婷久久久SWAG精品 |
久久久久久狠狠丁香 |
亚洲色大成网站www久久九 |
成人国内精品久久久久影院VR |
97久久精品人妻人人搡人人玩 |
久久久国产视频 |
久久99精品久久久久久9蜜桃 |
久久夜色精品国产亚洲 |
亚洲国产精品无码久久一区二区 |
色婷婷综合久久久久中文字幕 |
久久99精品久久久久久不卡
|
亚洲AV无码久久精品狠狠爱浪潮 |
亚洲国产精品一区二区久久 |
国产精品久久网 |
国产精品久久久久久福利漫画 |
中文字幕人妻色偷偷久久 |
亚洲性久久久影院 |
一本色道久久综合狠狠躁篇 |
一级女性全黄久久生活片免费
|
国产精品18久久久久久vr |
亚洲国产精品无码久久久秋霞2
|