This is the same method that is used to traverse the path in kernel32.dll. Its still not perfect, because
the wineserver will easily get confused by symlinks. In this case the attributes should be inherited
from the real parent directory, not from the directory that contains the symlink.
It is a bit risky to use two different values for mem_alloc and memcpy - under some circumstances
these values probably don't match, leading to an invalid memory access. As the ACLs are accessed
without any special checks this shows that we'll also need additional protection in one of the
earlier patches.