This article is from the Mac Programming FAQ, by Jon Watte firstname.lastname@example.org with numerous contributions by others.
When the Mac first made an appearance in 1984, it identified files by
using a vRefNum (volume reference number meaning a floppy disk or later
hard disk) and a name. Once HFS saw the light of day, folders within
folders became a reality, and you needed a dirID as well to point out
what folder you really meant on the volume. However, older programs
that weren't being rewritten still knew nothing about directory IDs, so
Apple had SFGetFile make up "fake" vRefNums that didn't just specify a
volume, but also a parent folder. These are called wdRefNums (for
working directory) and were a necessary evil invented in 1985. You
should not create (or, indeed, use) wdRefNums yourself.
There is a system-wide table that maps wdRefNums onto vRefNum/parID
pairs. There is a limit to the size of this table. A dirID and a parID
is almost the same thing; you say "parID" when you mean the folder
something is in, while you say a "dirID" when you mean the folder
itself. If you for instance have a folder called "Foo" with a folder
called "Bar" in it, the parID for "Bar" would be the dirID for "Foo."