1

Iam trying to get permissions on file/folder for current user. I found nice article about it here. I have tried to run this program but I got few erros and I dont know where I can find solutions to them. I tried to make my own version. Unfortunately when i try:

LPWSTR lpszPrimaryDC = NULL;
NetGetDCName(NULL, L"A", (LPBYTE *)&lpszPrimaryDC);

I got error: NERR_DCNotFound. How I can solve this problem?

Roman R.
  • 68,205
  • 6
  • 94
  • 158
user1042321
  • 45
  • 1
  • 9

2 Answers2

0

The only way the code didn't crash and gave me correct answer to question: is file or folder readable?

`   
FILE *myFile = fopen(dirPath, "r");
if (myFile == 0) {
    // "File or Dir is not readable
}
`

Hope this helps. You can use the same for writing test with "w".

mafonya
  • 2,152
  • 22
  • 21
0

The documentation says that error is returned when it "Could not find the domain controller for the domain specified in the domainname parameter." Do you have a domain called "A"? If not, the function is right to fail (and you need to rethink why/how you are calling it).

John Zwinck
  • 239,568
  • 38
  • 324
  • 436