锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产美女久久久,久久99这里只有精品国产,亚洲精品蜜桃久久久久久 http://m.shnenglu.com/meet-dream/zh-cn Thu, 03 Jul 2025 12:43:49 GMT Thu, 03 Jul 2025 12:43:49 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 闃呰鍏ㄦ枃 ]]> 搴旂敤杞歡鍜屽鉤鍙拌蔣浠剁殑涓鐐規(guī)濊?/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));
//鍚姩涓涓紓姝ユ搷浣滐紝璇ユ搷浣滀細(xì)璁板綍浜巌o_service 鐨勪竴涓槦鍒椾腑
t.async_wait(print);
//姣忎釜娉ㄥ唽鐨勬湇鍔″惎鍔ㄥ伐浣?
io.run();
//5s鍚庯紝瀹氭椂鍣ㄦ椂闂村埌錛宲rint琚皟鐢紝鐒跺悗璇andle錛坧rint錛変粠闃熷垪涓垹闄?
return 0;
}
鍙互鐪嬪嚭錛屽涓涓嬌鐢ㄨ呮潵璇達(dá)紝asio鐨勫師鐞嗗緢綆鍗?
1銆傚畾涔変竴涓狪O_Service
2.鍚慖O_Service娉ㄥ唽涓涓湇鍔?璇ユ湇鍔″彲浠ユ槸io鏈嶅姟,涔熷彲浠ユ槸瀹氭椂鍣ㄦ湇鍔?褰撶劧,浣犱篃鍙互鑷繁璁㈠埗涓涓偖浠舵湇鍔?
3.鍦ㄨ鏈嶅姟涓婂惎鍔ㄤ竴涓紓姝ユ搷浣?榪欓渶瑕佷竴涓洖璋冨嚱鏁?
4.濡傛灉寮傛鎿嶄綔瀹屾垚,浣犵殑鍥炶皟鍑芥暟浼?xì)琚皟鐢?
5.鍙兘鐨勯敊璇鐞?
鐞嗚Вasio鐨勫師鐞嗗悗錛屽啓涓涓綉緇滈氫俊鐨勭▼搴忕畝鐩存槸渚濊懌鑺︾敾鐡㈢殑浜嬩簡
鎴戜滑鐪嬩竴涓椂闂存煡璇㈢殑鏈嶅姟绔細(xì)
#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鐨勫綰跨▼鏀寔錛屽緙撳啿錛岀綉緇滄祦絳夋洿濂界殑鍩虹鐗規(guī)с? ]]> 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.
]]>
久久婷婷色综合一区二区 |
欧美一区二区久久精品 |
久久er国产精品免费观看2 |
精品国产一区二区三区久久久狼 |
国产99精品久久 |
理论片午午伦夜理片久久 |
亚洲欧洲日产国码无码久久99 |
99久久人人爽亚洲精品美女 |
97香蕉久久夜色精品国产 |
久久精品免费观看 |
免费久久人人爽人人爽av |
国产69精品久久久久99 |
狠狠综合久久综合88亚洲 |
国内精品久久久久久不卡影院 |
久久无码AV一区二区三区 |
国产日韩久久免费影院 |
亚洲精品无码久久久久sm |
久久中文字幕视频、最近更新 |
国产亚洲色婷婷久久99精品 |
模特私拍国产精品久久 |
久久97久久97精品免视看 |
精品一区二区久久 |
77777亚洲午夜久久多人 |
久久久精品波多野结衣 |
97久久精品人人澡人人爽 |
亚洲国产精品无码久久SM |
久久精品桃花综合 |
久久中文字幕无码专区 |
久久一区二区免费播放 |
国内精品久久久久国产盗摄 |
狠狠色丁香婷综合久久 |
国产成人无码久久久精品一 |
久久综合综合久久综合 |
久久久无码精品亚洲日韩蜜臀浪潮 |
一级女性全黄久久生活片免费
|
久久精品卫校国产小美女 |
久久久久国产一区二区三区 |
国产一区二区三精品久久久无广告 |
亚洲一区中文字幕久久 |
国産精品久久久久久久 |
亚洲精品国产综合久久一线 |