Click here to Skip to main content
15,899,937 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Binary resource in Windows service? Pin
RoyceF17-May-05 8:42
RoyceF17-May-05 8:42 
GeneralRe: Binary resource in Windows service? Pin
James R. Twine17-May-05 12:17
James R. Twine17-May-05 12:17 
GeneralRe: Binary resource in Windows service? Pin
RoyceF17-May-05 12:30
RoyceF17-May-05 12:30 
GeneralRe: Binary resource in Windows service? Pin
RoyceF17-May-05 12:43
RoyceF17-May-05 12:43 
GeneralGetTextExtentExPoint Pin
webmaster123446365316-May-05 4:42
susswebmaster123446365316-May-05 4:42 
GeneralRe: GetTextExtentExPoint Pin
Chris Losinger16-May-05 4:52
professionalChris Losinger16-May-05 4:52 
GeneralRe: GetTextExtentExPoint Pin
ucc80116-May-05 20:27
ucc80116-May-05 20:27 
QuestionHow Can I check file permissions? Pin
Dimitris Vikeloudas16-May-05 4:18
Dimitris Vikeloudas16-May-05 4:18 
Hi

I want to check if my current process has the proper access rights to a file. I read about the ACL and windows security and I understand how they work conceptually. But I am not sure how to invoke the functions to do my checks.

Up to now (correct me if I missunderstood something) I am about to use
GetFileSecurity() to get the security ID of my file. It seems that I have to call it with OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION to get all the ACLs of that file in the proper order.

It also seems that I have to call the OpenProcessToken() with the current process handle to get my current process rights.

Then I have to call (according to my understanding) the AccessCheck to verify my access. And there is where I am stack. I know that I need to specify desired access and the GENERIC_MAPPING structure. I think that for read the desired access is FILE_READ_ATTRIBUTE | FILE_READ_DATA | FILE_READ_EA | READ_CONTROL | SYNCHRONIZE, for write FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | FILE_WRITE_EA | WRITE_CONTROL | SYNCHRONIZE, for execute or directory traversing FILE_READ_ATTRIBUTES | READ_CONTROL | FILE_EXECUTE | SYNCHRONIZE and for deletion DELETE (or do I also need to combine the write flags also)?

I 've seen the GENERIC_READ, GENERIC_WRITE and the GENERIC_EXECUTE flag. I am not understanding what to declare in the GENERIC_MAPPING structure and what to use in the MapGenericMask function (which the MSDN suggests to use).

Please help me since I am begginer to windows security coding.

Thanks...


Dimitris Vikeloudas
GeneralPlease help me Pin
microsoftcertificate16-May-05 3:54
sussmicrosoftcertificate16-May-05 3:54 
GeneralRe: Please help me Pin
microsoftcertificate16-May-05 6:22
sussmicrosoftcertificate16-May-05 6:22 
GeneralRe: Please help me Pin
Christian Graus16-May-05 14:25
protectorChristian Graus16-May-05 14:25 
GeneralRe: Please help me Pin
ucc80116-May-05 20:31
ucc80116-May-05 20:31 
GeneralBrowsing workgroups Pin
badzio16-May-05 3:33
badzio16-May-05 3:33 
GeneralRe: Browsing workgroups Pin
David Crow16-May-05 3:38
David Crow16-May-05 3:38 
GeneralRe: Browsing workgroups Pin
badzio16-May-05 21:54
badzio16-May-05 21:54 
GeneralRe: Browsing workgroups Pin
David Crow17-May-05 3:52
David Crow17-May-05 3:52 
GeneralRe: Browsing workgroups Pin
badzio17-May-05 4:01
badzio17-May-05 4:01 
GeneralRe: Browsing workgroups Pin
David Crow17-May-05 4:09
David Crow17-May-05 4:09 
GeneralRe: Browsing workgroups Pin
badzio17-May-05 4:25
badzio17-May-05 4:25 
GeneralRe: Browsing workgroups Pin
David Crow17-May-05 5:16
David Crow17-May-05 5:16 
GeneralRe: Browsing workgroups Pin
Graham Bradshaw16-May-05 14:13
Graham Bradshaw16-May-05 14:13 
GeneralRe: Browsing workgroups Pin
badzio17-May-05 4:28
badzio17-May-05 4:28 
GeneralRe: Browsing workgroups Pin
Graham Bradshaw17-May-05 4:33
Graham Bradshaw17-May-05 4:33 
GeneralRe: Browsing workgroups Pin
badzio17-May-05 22:12
badzio17-May-05 22:12 
GeneralRe: Browsing workgroups Pin
Graham Bradshaw17-May-05 22:17
Graham Bradshaw17-May-05 22:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.