Creating Symbolic Links (SymLinks) in Vista
Posted: Mon Dec 10, 2007 11:37 pm
I wanted to play around with some of the new API things in Vista. Since I was interested in the use of SymLinks thought i'd start there. Its easy.
Just a little example:
Just a little example:
Code: Select all
;based on: http://msdn2.microsoft.com/en-us/library/aa363866.aspx
;dwFlags:
;0x0 = The link target is a file.
;0x1 = The link target is a directory.
;WARNING - Must be using NTFS for SymLinks to work
; example creates a symlink for the windows\system32\ folder. Compile as .exe and place in a folder then run from that folder.
; will create a symlink in that folder or from where ever the file is run.
ProcedureDLL Sym_Link(in_lnkname.s, in_targetname.s, dw_flag.l)
Libef = LoadLibrary_("Kernel32.dll")
If Libef
*SymLfunc = GetProcAddress_(Libef, "CreateSymbolicLinkA")
CallFunctionFast(*SymLfunc, in_lnkname, in_targetname, dw_flag)
FreeLibrary_(Libef)
EndIf
ProcedureReturn
EndProcedure
Sym_Link("test_link", "c:\windows\system32\", 1)