Why do you recommend some Windows specific functionality when the paths that xinyiman showed are clearly Unix paths? Also this wouldn't help anything. This would just return whether they are equal or at what position they differ.
For the depth - as xinyiman asked for - resolving the two paths and then counting the slashes is the more correct approach.
I saw a "Win10" in his signature, but you're correct with the Unix-Paths. I missed that.
As for "RtlCompareMemory": That function actually returns the number of matching bytes, as in: To which position are the strings (better said: memory-blocks) equal.
If that number of bytes equals the length of par1, then par1 is on a higher level!
That was the idea behind my approach.
I looked into sysutils, and you're right: i could only find the equivalents to strcmp and memcmp, but nothing equal to RtlCompareMemory (a pity. I like RtlCompareMemory for fast comparing strings or arrays)