If passed path is a directory, GetDirectoryName truncates it  of one level.

Passing that string, "C:\Directory\SubDirectory", into GetDirectoryName will result in "C:\Directory".