![]() |
CreateHardLinkW ... aber auch für WinNT4 ... (more inside)
Download unter:
![]() ![]() Der Code ist wahlweise unter ![]() ![]() LGPL wurde nur als Option angegeben um die Benutzung in unserem DP-Projekt ![]() Hiho, ich habe die CreateHardLink API, welche mit Windows 2000 offiziell eingeführt wurde, komplett nachempfunden (in Delphi). Will heißen, auch wenn der Code nicht identisch ist, macht er dennoch das Gleiche (wenn auch nicht das Selbe). Wohlgemerkt alle Fehlerrückgaben, die bei der orginalen Windows 2000 API zurückgegeben werden, sind identisch. Auch die Annahme von Parametern und Verarbeitung entspricht dem Original. Bei einigen Punkten habe ich einfach eine Native API genommen statt "per Hand" zu kopieren. Es gelten die gleichen Einschränkungen und Features von CreateHardLinkW() in der Kernel32.dll in Windows 2000 wie CreateHardLinkW() in meiner Unit. Einzig ein Kompilerschalter definiert ob die Funktion mit oder ohne STDCALL läuft. Standard ist ohne ... ich gehe davon aus, daß meine Funktionen nur unter Delphi und BCB benutzt werden. Außerdem ist die Funktion komplett kompatibel mit NT4 aufwärts (und NTFS). Ich habe eine ANSI und eine Unicode-Version implementiert. Würde man eine EXPORT-Klausel einfügen, könnte man die DLL auf jedem der aktuellen NT-Systeme (NT4/2K/XP/2K3) benutzen. Informationen zu Hardlinks gibts hier (von MS selbst im PSDK formuliert):
Code:
[edit=Chakotay1308]Download-Links geupdatet. Mfg, Chakotay1308[/edit]
Any directory entry for a file, whether created with CreateFile or
CreateHardLink, is a hard link to the associated file. Additional hard links, created with the CreateHardLink function, allow you to have multiple directory entries for a file, that is, multiple hard links to the same file. These may be different names in the same directory, or they may be the same (or different) names in different directories. However, all hard links to a file must be on the same volume. Because hard links are just directory entries for a file, whenever an application modifies a file through any hard link, all applications using any other hard link to the file see the changes. Also, all of the directory entries are updated if the file changes. For example, if the file's size changes, all of the hard links to the file will show the new size. The security descriptor belongs to the file to which the hard link points. The link itself, being merely a directory entry, has no security descriptor. Thus, if you change the security descriptor of any hard link, you're actually changing the underlying file's security descriptor. All hard links that point to the file will thus allow the newly specified access. There is no way to give a file different security descriptors on a per-hard-link basis. This function does not modify the security descriptor of the file to be linked to, even if security descriptor information is passed in the lpSecurityAttributes parameter. Use DeleteFile to delete hard links. You can delete them in any order regardless of the order in which they were created. Flags, attributes, access, and sharing as specified in CreateFile operate on a per-file basis. That is, if you open a file with no sharing allowed, another application cannot share the file by creating a new hard link to the file. CreateHardLink does not work over the network redirector. Note that when you create a hard link on NTFS, the file attribute information in the directory entry is refreshed only when the file is opened or when GetFileInformationByHandle is called with the handle of the file of interest. |
Re: CreateHardLinkW ... aber auch für WinNT4 ... (more insid
Es gibt ein entsprechendes OpenSource-Projekt zu der Unit. Dieses ermöglicht das Erstellen von Hardlinks auf der Kommandozeile. Ein Vorteil (durch meine neue eigene Implementation von CreateHardLink) zur vorigen Version von LN ist, daß man keine Backup/Restore-Privilegien braucht um Hardlinks (mit der Backupstream-Methode) zu erstellen. Man kann dieses Programm getrost als Beispiel bezeichnen. Es ist voll Unicodefähig. Die Downloadlinks sind oben im ersten Beitrag.
[edit=Chakotay1308]Download-Links geupdatet. Mfg, Chakotay1308[/edit] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz