I am trying to execute icacls from c++. Code below does nothing. I still don't know why it does nothing. I cannot see what icacls return to me because cmd windows automactly closes. HINSTANCE also doesnt provides me much. How i can use icacls with multiple parameters?
HINSTANCE hInst = ShellExecute( NULL,
NULL,
L"icacls",
L"s.jpg /grant:r %username%:W",
L"C:/",
SW_NORMAL
);
Undeleting post:
I had written up this bit of code earlier, unfortunately it is CLR/.NET specific. However, since you professed that using 'the API' is hard (it is, I did it 10 years ago and NTFS ACLS are no picknick), you might be motivated by the below sample to integrate a bit of .NET code (C++/CLI or Interop based?)
Any specific reason not to use C# code?
With the following helpers from MSDN: How to: Add or Remove Access Control List Entries:
See the article for full details and comments