從幸福空間上看到不錯的設計
2012年3月15日 星期四
[note]auto_ptr
auto_ptr<CPolicyEvent> pPolicyEvent( new CPolicyEvent(pEvent) );
有constructor 和desctructor之後, C++真的可以玩很多東西耶
auto_ptr 這玩意會在離開scope的時候 自動幫你Delete
template<class _Ty>
class auto_ptr
{ // wrap an object pointer to ensure destruction
explicit auto_ptr(_Ty *_Ptr = 0) _THROW0()
: _Myptr(_Ptr)
{ // construct from object pointer
}
~auto_ptr()
{ // destroy the object
delete (_Ty *)_Myptr;
}'
private:
const _Ty *_Myptr; // the wrapped object pointer
}
方便~
2012年1月31日 星期二
2012年1月8日 星期日
kernel debug command and options
bcdedit /dbgsettings serial debugport:1
bcdedit /copy {current} /d DebugEntry After this command executed, the ${ID} will appear on console and please replace all ${ID} with it.
bcdedit /displayorder {current} ${ID}
bcdedit /debug ${ID} ON
bcdedit /default ${ID}
** The commands above need to be executed on administrator privilege console window(right click command prompt and choose “run as administrator” option).
** To execute driver without signed:
. Press F8 when windows starting
. Choose “停用驅動程式簽章增強” option(I forget the wording in English)
** To show debug log message on WinDBG console, please modify the registry value below:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter]
"DEFAULT"=dword:0000ffff
2012年1月4日 星期三
windows hook
今天阿文TOI 有提到的 Three Ways to Inject Your Code into Another Process
針對 windows hook 我的理解是 windows 開放來monitor windows message 用的 (比如某隻process 有沒有收到keyboard的message 或者滑鼠做了什麼事..)
可以自己monitor自己 也可以monotor 別人(別的process) message
透過 SetWindowHookEx(MSDN link) 就可以做到這件事, (寫到這裡忽然有同事說遊戲外掛就是用這個做的. 攔到就多送幾個鍵. XD)
因為它的實作會把dll map 到remote process 去執行, 所以就可以用這個function 來做到inject dll.
這邊還有一篇介紹windows hook的 文章 , 簡體的不會比英文好讀到那裡去.. :P 不過還是可以看一下
2012年1月3日 星期二
phpbb 用 LDAP 認證
Lightweight Directory Access Protocol
LDAP目錄也是一種類型的資料庫,但是不是關係型資料庫。不像被設計成每分鐘需要處理成百上千條資料變化的資料庫,例如:在電子商務中經常用到的在線交易處理(OLTP)系統,LDAP主要是最佳化資料讀取的效能
LDAP最大的優勢是:可以在任何電腦平台上,用很容易獲得的而且數目不斷增加的LDAP的客戶端程序訪問LDAP目錄。而且也很容易定制應用程式為它加上LDAP的支持
節錄自 這裡 裡面 還有介紹一些內部用tree來記和其他有的沒的
php bb設定 (待續)
2012年1月1日 星期日
2011年12月29日 星期四
2011年11月21日 星期一
2011年10月12日 星期三
Two dictums from a friend
1. Have the courage to follow your heart and intuition (adopted from Jobs)
2. Don’t lie to others, you can only fool the one who believes in you.