Windows ConfidentialTracking Shortcuts Raymond Chen If the target of a shortcut moves, the Windows shell will try to find the new location; this is known as "resolving" the shortcut.But what algorithm does the shell use to find that target? The answer: It depends. Windows 95 When shortcuts were introduced in Windows 95, file systems did not have a lot of smarts associated with object tracking.The Windows 95 shell uses a simple searching algorithm to find the lost shortcut destination: When a shortcut is created, various properties of the target of the shortcut are recorded in the shortcut file itself—properties such as the file name, file size, creation time and the last-modified time, as well as information about the drive containing the file. These properties are updated periodically when the shortcut is used, and when the target of the shortcut goes missing, the shell starts searching for a file with as many properties as possible in common with the intended target file.When it finds a file that looks similar enough to the original target, it declares the target as having been found. Different properties have varying importance, but creation time has the greatest weight, because that property tends to remain attached to a file even after it has been modified and even renamed.File system tunneling helps keep this information associated with the file, even when programs unwittingly operate in a manner that would normally destroy the information. The search starts in the directory that was the file's last known location.But even locating the starting point can take a bit of work if the drive has changed; for example, if the shortcut target was on a network drive mapped to drive "O" but is now mapped to drive "P." After searching the last-known directory, the search descends into subdirectories; then expands outward to the parent directory and sibling directories; then moves to the grandparent directory, aunts, uncles and cousins—pretty much every relative known to mankind.If the search continues for two minutes with no luck, the effort is abandoned (even if not all candidate directories have been searched). The NT Way The Windows NT file system folks looked at the Windows 95 shortcut resolution algorithm and scoffed. "We can do better than that: We're object-oriented!" Each NTFS object has an object identifier; a shortcut with a target that's on an NTFS volume also records the object identifier of the shortcut target, as well as the object identifier of the drive itself. When it comes time to resolve the shortcut, the shell asks the Distributed Link Tracking Service to look for the original object.On a domain, this can produce surprising results, like finding the file even when the drive has been taken out of one computer and installed into another one. There are a number of ways administrators can affect the algorithm the shell chooses to use.If you enable the Do not track Shell shortcuts during roaming (LinkResolveIgnoreLinkInfo) policy, the shell will not try to locate the original drive.If the shortcut target was on a network drive, the shell will not try to locate the original network resource when determining the starting location for the Windows 95-style search.It will just assume the drive letter is correct; if it isn't, well, what happens, happens. This policy was created for environments which have a pool of identical network resources, where the load is distributed by having a login script connect the "O" drive (for example) to a different server depending on the user.Even though two users are connecting to two physically different servers, they are logically identical.If you set this policy, a shortcut to O:\program.exe will run the program currently on drive "O," even if drive "O" is not connected to the same network resource as when the shortcut was created. There are also a pair of policies that let you disable the two object-location algorithms once the starting point has been determined: the Do not use the tracking-based method when resolving shell shortcuts (NoResolveTrack) policy disables the fancy NTFS object-tracking algorithm; the Do not use the search-based method when resolving shell shortcuts (NoResolveSearch) policy disables the low-tech Windows 95 search algorithm. Repairing broken shortcuts is one of those thankless jobs of the shell: People don't even realize that they're relying on the feature until it stops working. Raymond Chen's Web site, The Old New Thing, and identically titled book (Addison-Wesley 2007) deal with Windows history and Win32 programming.He sometimes encodes information by translating it into German (poorly). | Windows 機(jī)密跟蹤快捷方式 Raymond Chen 如果目標(biāo)的快捷方式移動(dòng)在 Windows 外殼程序?qū)L試查找新的位置 ;這稱為"解析"該快捷方式。但外殼程序查找該目標(biāo)會(huì)使用哪種算法呢? 答案是:這要視情況而定。 Windows 95 當(dāng)在 Windows 95 中引入的快捷方式時(shí),文件系統(tǒng)不具有大量與跟蹤的對(duì)象關(guān)聯(lián)的智能。Windows 95 外殼程序使用一個(gè)簡(jiǎn)單的搜索算法中查找丟失的快捷方式目標(biāo):在創(chuàng)建快捷方式時(shí)的快捷方式的目標(biāo)的各種屬性都記錄在快捷方式文件本身) 屬性,如鏂囦歡鍚、 文件大小、 創(chuàng)建時(shí)間和在上次修改的時(shí)間,以及有關(guān)驅(qū)動(dòng)器包含該文件的信息。 定期使用快捷方式,和快捷方式的目標(biāo)是缺少更新這些屬性,外殼程序啟動(dòng)盡可能與預(yù)期的目標(biāo)文件中搜索具有多個(gè)屬性的文件。當(dāng)找到類似足夠原始目標(biāo)的文件時(shí),它聲明發(fā)現(xiàn)具有作為目標(biāo)。 不同的屬性具有不同的重要性但創(chuàng)建時(shí)間,最大權(quán)值,因?yàn)樵搶傩酝鶗?huì)保持連接到一個(gè)文件,即使它有被修改,即使重命名。文件系統(tǒng)的隧道操作有助于此程序無意通常會(huì)破壞信息的方式運(yùn)行,即使與文件,相關(guān)聯(lián)的信息。 搜索開始在該文件的上次已知的位置的目錄中。但如果該驅(qū)動(dòng)器已更改 ; 甚至定位起始點(diǎn)會(huì)花費(fèi)的工作例如如果快捷方式目標(biāo)在網(wǎng)絡(luò)驅(qū)動(dòng)器上映射到驅(qū)動(dòng)器"O"但現(xiàn)在被映射到驅(qū)動(dòng)器"P." 按降序后搜索上次已知目錄,搜索排列到子目錄中 ;然后向外擴(kuò)展到父目錄和同級(jí)目錄 ;然后移動(dòng)到祖父目錄、 aunts、 uncles cousins — — 幾乎已知人類的每個(gè)多相對(duì)。如果搜索繼續(xù)與未能提供有用的兩分鐘,努力被放棄 (即使不是所有的候選目錄已被搜索)。 NT 方式 在 Windows NT 文件系統(tǒng)人員查看 Windows 95 的快捷方式解析算法和 scoffed。"我們可以更好的執(zhí)行操作:我們是面向?qū)ο蟮?!"NTFS 的每個(gè)對(duì)象具有一個(gè)對(duì)象的標(biāo)識(shí)符 ;快捷方式,在 NTFS 卷上的目標(biāo)還記錄的該快捷方式目標(biāo)對(duì)象標(biāo)識(shí)符,以及驅(qū)動(dòng)器本身的對(duì)象標(biāo)識(shí)符。 若要解決該快捷方式的時(shí)間時(shí),外殼程序會(huì)詢問分布式鏈接跟蹤服務(wù)以查找原始對(duì)象。加入某個(gè)域,這可能會(huì)產(chǎn)生類似于查找文件,即使已經(jīng)采取的一臺(tái)計(jì)算機(jī)并安裝到另一個(gè)驅(qū)動(dòng)器的意外結(jié)果。 有許多的管理員可能會(huì)影響外殼程序選擇使用該算法的方法。如果啟用不在漫游 (LinkResolveIgnoreLinkInfo) 策略的過程中跟蹤外殼程序快捷方式,外殼程序?qū)⒉粐L試找到原始的驅(qū)動(dòng)器。濡傛灉鍦 ㄦ 緗戠粶椹卞姩鍣 ㄤ 笂快捷方式目標(biāo),外殼程序不會(huì)找到原始的網(wǎng)絡(luò)資源時(shí)確定 Windows 95 的樣式的搜索起始位置。它只是將假定該驅(qū)動(dòng)器號(hào)是正確的 ;如果不是,還,發(fā)生什么情況發(fā)生。 此策略是為創(chuàng)建具有的相同網(wǎng)絡(luò)的資源池的負(fù)載分布通過登錄腳本 (例如) 連接到不同的服務(wù)器根據(jù)用戶的"O"驅(qū)動(dòng)器的環(huán)境的。即使兩個(gè)用戶連接到兩個(gè)不同的服務(wù)器,他們是邏輯上相同的。如果設(shè)置了該策略將 O:\program.exe 快捷方式將上運(yùn)行程序當(dāng)前驅(qū)動(dòng)器"O,"即使驅(qū)動(dòng)器"O"未連接到作為相同的網(wǎng)絡(luò)資源,創(chuàng)建快捷方式時(shí)。 還有一對(duì)的策略,可以禁用在兩個(gè)對(duì)象的位置算法,已確定的起始點(diǎn)后的:該操作不使用基于跟蹤的方法解析外殼程序快捷方式 (NoResolveTrack) 策略禁用別致的 NTFS 對(duì)象的跟蹤算法 ;該操作不使用基于搜索的方法解析外殼程序快捷方式 (NoResolveSearch) 策略禁用 low-tech Windows 95 搜索算法。 修復(fù)斷開的快捷方式是外殼程序的那些 thankless 作業(yè):用戶沒有甚至意識(shí)到它們依賴功能停止工作之前。 Raymond Chen 網(wǎng)站、 的舊的新內(nèi)容 和具有相同標(biāo)題的簡(jiǎn)介冊(cè) (Addison-Wesley 2007) Windows 歷史記錄和 Win32 編程處理。他有時(shí)信息通過對(duì)進(jìn)行編碼 (差) 將其翻譯成德語。 |
聯(lián)系客服