星期六, 7月 28, 2007

WindowsXP 系統登陸原理及其驗證機制概述

  • http://www.dgi.com.tw/polo/Forum/detail.asp?TitleID=20&tid=112&postname=admin

星期五, 7月 27, 2007

常見檔案、目錄操作

  • 不錯的整理:http://silenceangelwaitingfor.spaces.live.com/blog/cns!47F284FC052C0DE0!442.entry
  • 檢驗帳號是否對某個檔案有NTFS存取權限:
    這個問題似乎沒有好的解答
    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1851064&SiteID=1

    也許從這篇可以得到解答: http://www.codeproject.com/csharp/accessctrl3.asp?df=100&forumid=180919&exp=0&select=1350552#Accesscheck
  • 存取檔案、目錄ACL
    FileSecurity fSecurity = File.GetAccessControl(@"c:\temp");
    fSecurity.AddAccessRule(
    new FileSystemAccessRule(
    "DomainA/UserB",
    FileSystemRights.AppendData | FileSystemRights.CreateFiles,
    AccessControlType.Allow)
    );
    File.SetAccessControl(@"c:\temp", fSecurity);
  • 設定檔案成ReadOnly
    FileInfo f = new FileInfo(@"c:\temp\1.txt");
    f.Attributes |= FileAttributes.ReadOnly;


星期日, 7月 22, 2007

在命令列編譯Visual Studio C++專案

devenv MyProject.vcproj /rebuild debug

如果需要參照到額外的include檔案或library檔案,則使用以下格式

devenv MyProject.vcproj /rebuild debug /useenv

同時記得設定INCLUDE以及LIB環境變數

使用VS2005的XML IntelliSense

XML檔案

  • 使用適當的xml namespace, 如:
    <rootelement xmlns=http://mysite/oo/>
  • 指定該namespace所對應的XML Schema檔案, 如:
    <rootelement
      xsi:http://www.w3.org/2001/XMLSchema-instance
      xsi:schemaLocation="http://mysite/oo  c:\temp\ooxx.xsd"/>
    表示http://mysite/oo這個namespace的Schema描述在ooxx.xsd這個檔案中。

XML Schema檔案

星期一, 7月 16, 2007

砍掉Process

在.NET中砍掉一個process最直覺的方法就是使用Process class的Kill method。如果測試幾次應該會發現,有些時候在Kill method回傳後,process事實上還沒真的被砍掉。為了確認process已經被砍掉可以在Kill之後呼叫WaitForExit,如下:

p.Kill();
p.WaitForExit();

不過在實際使用時,似乎還是有一些process還是沒有砍掉的狀況,需要再進一步地研究。

references:
* http://www.dotnet247.com/247reference/msgs/47/237175.aspx