I need a program that will traverse a given directory tree on Windows 2003 Server (or compatible) and return Groups and Users that have access to each folder. I also need the exact permissions for each user that has access to the folder. The output should be a text file containing any usable format, csv, json or xml, etc.
If such a program is not freely available, I need a direction on what Windows functions to use to retrieve security information. I'm on Visual Studio 2012 and I already have the algorithm to traverse a tree structure. I need to know how to retrieve security information from a folder.