PDA

View Full Version : A pearl (for advanced users)


Mac the Knife
11th Dec 2005, 15:33
Ever used Sysinternals junction.exe to create reparse points?

Neat aren't they (can be dangerous too...)

Here's a cool free graphical utility for creating shell links (and junctions too if you want).

"Winbolic Link creates special folders which serve as links to the contents of another folder. They are functionally similar to "symbolic links" or "symlinks" which unix users are familiar with.

Winbolic Link creates these links using only built-in functionality of Windows. It does not extend or modify the functionality of Windows or the file system, install any drivers, or require any service to remain running to maintain functionality. It merely creates the special kinds of files and folders Windows already supports, but which Microsoft did not distribute tools to create."

http://www.pearlmagik.com/winbolic/

Users would do well to heed the warnings about junctions.....but they are kind of neat occasionally...

--------------------
"Bother," said Pooh as he struggled with /etc/sendmail.cf, "it never does quite what I want. I wish Christopher Robin was here."

timmcat
11th Dec 2005, 20:40
Wow - he said 'Advanced Users' - That's me, I thought.

Perhaps not as advanced as I thought I was! :sad:

WeatherJinx
11th Dec 2005, 21:21
Don't worry about him, Timmcat... he's just showing off :E ;)

An example of a symlink in plain English would be the setup I have on my Mac which streams my iTunes library over the web.

Instead of having to place a duplicate of my iTunes library on the server (and at 10-odd gigabytes it's a bit hefty to be making copies all over the place), the symlink arrangement lets me keep the existing iTunes library folder where it is, creating a kind of 'metaphor' or pointer, if you will, from the music to the server.

This also has the advantage of letting me keep my music safe and sound in a secure area of the Mac, rather than risking it on the server.

Hope that's as clear as mud!

Spinflight
12th Dec 2005, 08:29
They're pretty much the same as shortcuts timmy. :)

What exactly are you doing to find that useful Mac?

Mac the Knife
12th Dec 2005, 11:55
Shortcuts, Links and Junctions

A folder shortcut is a special file that contains the full path of a folder, for example C:\Program Files\File Downloader\My Downloads. When you run (e.g. by double-clicking) this shortcut, you are taken to that folder. If you look at the address bar of your file browser, you will see that you are in C:\Program Files\File Downloader\My Downloads.

A link, on the other hand, is a folder which is an alias for another folder. If you have a link named "My Downloads" in C:\ to C:\Program Files\File Downloader\My Downloads, the address bar will say C:\My Downloads but show the contents of C:\Program Files\File Downloader\My Downloads.

Junctions are a bit different - junctions allow you to create hardlinks between directories.

Example use: when a drive is nearly full
Your main hard drive (C:) is nearly full, and while your secondary hard drive (D:) has plenty space you have something new that will need to be on C:. There are no files that you can move to D without breaking something, especially programs. But with a Junction, a special kind of link, you can move programs to D: and have windows think that it's still on C:. Start by creating a new folder named "Program Files" in D:\. Move your C:\Program Files\OldProgram to D:\Program Files\, then create a junction called "OldProgram" in C:\Program Files that points to D:\Program Files\OldProgram. Now, that program actually resides on the D: drive but it still looks as though it's still in its original location.

Junctions (a.k.a. Junction Points or Reparse Points), for most intents and purposes, are invisible to Windows. Virtually all programs, including Windows Explorer in certain cases, will interpret the linked folder as though it were the target folder. This makes Junctions dangerous because deleting the link in a non-junction-aware program such as Explorer may cause a recursive delete, deleting the contents of the target folder as well as the link.

So be careful - best deleted with a utility that knows about junctions, like Winbolic or Junction Link Magic - http://www.rekenwonder.com/linkmagic.htm - or Hardlink Shell Extension - http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html

The truth of the matter is that I like poking around operating systems (DOS, BeOS, Unix, Windows, Linux etc.) and finding neat utilities that are bound to be useful "someday" - junk collection really, but every now and then I find something really useful.

I've got a some hardlinks and two junctions set up just for fun (one of them is actually useful) - I'm sure one day I'll find a situation whwn I absolutely HAVE to have this...and maybe some stymied PPRuNer will too - at least he/she will find the info somewhere.

--------------------
"Bother," said Pooh as he struggled with /etc/sendmail.cf, "it never does quite what I want. I wish Christopher Robin was here."

BOAC
12th Dec 2005, 16:31
Anyone got a spare dark room and ice pack?:D

Mac the Knife
12th Dec 2005, 21:06
Understanding this stuff REALLY works is actually pretty hard - it does need a dark room and an ice-pack.

It is complicated by the fact that different OSes (Windows/Linux/Unix) and different file systems (NTFS, ext2/3, Reiser etc.) use similar terms to refer to somewhat different things and work differently internally.

I think that I've got it figured out, thanks to an excellent article at http://shell-shocked.org/article.php?id=284

I'm writing a condensed summary for myself in order to make quite sure that it's all clear in my head - if anyone is interested I'll post it here.

Spinflight
13th Dec 2005, 01:05
Yeah I'd like to see that Mac, though I suspect me and thee will be the only two humans ever to set eyes on it. :ok:

If you want a real challenge try making sense of the MSDN documentation......

Let me guess, its using the different file stream support under ntfs to spoof the operating system?

MyData
15th Dec 2005, 17:05
Some good stuff here:
http://encyclopedia.thefreedictionary.com/NTFS%20Junction%20point

The hall of mirrors effect could be fun ;-)


Spinflight - do you know if streams are used? I'm just trying to figure out how that would be implemented (and why).


SysInternals... haven't been there for a long time, some excellent stuff there, one of my all time favourites.

BEagle
15th Dec 2005, 18:55
Does it work with ZX-80s?

Mac the Knife
15th Dec 2005, 20:51
"Does it work with ZX-80s?"

Dunno, but that's where I learned about channels and streams!

Still got mine BTW - I think I'm inspired to dig it out and have a dose of nostalge - not sure I've got a working cassette recoder tho'

MyData
15th Dec 2005, 22:55
You might have to upgrade your chipset to the ZX-81 and add a 16K RAM pack*. That might do the trick.

Aaahh, nostalgia eh?


*and make sure the pack is securely seated otherwise you will get a system crash at the most inopportune moment.

Spinflight
16th Dec 2005, 14:58
The short answer MyData would be no they are not. However they are supported under ntfs should someone wish to save different versions of a file for Win, Unix, Mac etc.

Not many peeps seem to know they exist, and those wot do generally use them for nefarious porpoises. :)

MyData
17th Dec 2005, 10:24
Spinflight - I recall doing some streams programming many moons ago and the idea was to hide encrypted information in streams of 'normal' looking files. This could be classed as a nefarious activity as the users weren't aware that this data was there...

IIRC the structure / purpose of streams was for embedding (streaming) COM containers within documents e.g. an Excel sheet within a Word doc, but I'm not sure if that is how things turned out. Hence my question on how and why a junction point would be placed in a stream.