搜尋此網誌

2009年2月24日 星期二

Disable Autorun in Windows

http://support.microsoft.com/kb/967715

Windows Server 2003, Windows XP, and Windows 2000

1. Click Start, click Run, type Gpedit.msc in the Open box, and then click OK.
2. Under Computer Configuration, expand Administrative Templates, and then click System.
3. In the Settings pane, right-click Turn off Autoplay, and then click Properties.

Note In Windows 2000, the policy setting is named Disable Autoplay.
4. Click Enabled, and then select All drives in the Turn off Autoplay box to disable Autorun on all drives.
5. Click OK to close the Turn off Autoplay Properties dialog box.
6. Restart the computer.

2009年2月9日 星期一

WSAStartup 無法解析的外部符號

使用"WSAStartup(MAKEWORD(2, 2), &wsaData)"時遇到問題,
出現了"imp__WSAStartup@8 error LNK1120: 1 個無法解析的外部符號",
在http://www.diybl.com/course/3_program/c++/cppsl/2008315/104702.html裡找到了解決方法,
原來是沒有加入ws2_32.lib,
在最上面的選項中按專案 -> '專案名稱'屬性 -> 組態屬性 -> 連結器 ->命令列 裡面的"其他選項"
輸入ws2_32.lib就可以加入了!


hostent與gethostbyname function(或gethostbyaddr function)搭配使用,
不僅可以知道IP address和domain name,
還可知道address的type、長度、別名(同樣可連到此網站的另一個domain name)。
WSAGetLastError可判斷發生何種錯誤,若回傳值為0,則沒有錯誤。