Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ACL

ACL

Scheduled Pinned Locked Moved C / C++ / MFC
json
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vishalgpt
    wrote on last edited by
    #1

    hi to all, I am writing a function to check access rights on file or folder using AclAPI.h I am using following api's GetFileSecurity() ImperonateSelf() OpenThreadToken() MapGenericMask() AccessCheck() do i have to include

    #pragma comment(lib, "advapi32.lib")

    in my code or not. Without including #pragma comment(lib, "advapi32.lib") Program is working. and

    BOOL WINAPI OpenThreadToken(
    __in HANDLE ThreadHandle,
    __in DWORD DesiredAccess,
    __in BOOL OpenAsSelf,
    __out PHANDLE TokenHandle
    );

    what does parameter in OpenThreadToken (OpenAsSelf) means. Please give some valuable suggestions.

    Regards, Vishal

    H 1 Reply Last reply
    0
    • V vishalgpt

      hi to all, I am writing a function to check access rights on file or folder using AclAPI.h I am using following api's GetFileSecurity() ImperonateSelf() OpenThreadToken() MapGenericMask() AccessCheck() do i have to include

      #pragma comment(lib, "advapi32.lib")

      in my code or not. Without including #pragma comment(lib, "advapi32.lib") Program is working. and

      BOOL WINAPI OpenThreadToken(
      __in HANDLE ThreadHandle,
      __in DWORD DesiredAccess,
      __in BOOL OpenAsSelf,
      __out PHANDLE TokenHandle
      );

      what does parameter in OpenThreadToken (OpenAsSelf) means. Please give some valuable suggestions.

      Regards, Vishal

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      Answer to first question: If the program is working without it, you have your answer. Answer to second question: From MSDN: OpenAsSelf [in] - TRUE if the access check is to be made against the process-level security context. FALSE if the access check is to be made against the current security context of the thread calling the OpenThreadToken function. The OpenAsSelf parameter allows the caller of this function to open the access token of a specified thread when the caller is impersonating a token at SecurityIdentification level. Without this parameter, the calling thread cannot open the access token on the specified thread because it is impossible to open executive-level objects by using the SecurityIdentification impersonation level.

      Best wishes, Hans


      [Hans Dietrich Software]

      V 1 Reply Last reply
      0
      • H Hans Dietrich

        Answer to first question: If the program is working without it, you have your answer. Answer to second question: From MSDN: OpenAsSelf [in] - TRUE if the access check is to be made against the process-level security context. FALSE if the access check is to be made against the current security context of the thread calling the OpenThreadToken function. The OpenAsSelf parameter allows the caller of this function to open the access token of a specified thread when the caller is impersonating a token at SecurityIdentification level. Without this parameter, the calling thread cannot open the access token on the specified thread because it is impossible to open executive-level objects by using the SecurityIdentification impersonation level.

        Best wishes, Hans


        [Hans Dietrich Software]

        V Offline
        V Offline
        vishalgpt
        wrote on last edited by
        #3

        advapi32.lib is already linked in the linker. Found in the Project Settings ->Linker->Input->Additional Dependencies. thanks.:thumbsup: for your reply.

        Regards, Vishal

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups