CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2004
    Posts
    51

    RegConnectRegistry : Access Denied

    Hi Devs,


    API RegConnectRegistry : HKEY_PERFORMANCE_DATA

    Faling with Error: Access Denied

    GetLastError: Overlapped I/O operation is in progress

    Domain account is used for remote connection.


    Thanks
    SandyG

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: RegConnectRegistry : Access Denied

    Quote Originally Posted by SandyG View Post
    API RegConnectRegistry : HKEY_PERFORMANCE_DATA

    Faling with Error: Access Denied

    GetLastError: Overlapped I/O operation is in progress
    You must not call GetLastError if RegConnectRegistry failed. RegConnectRegistry itself returns the error code for you.

    And about Access Denied problem... Did you look at some discussions of this problem like
    this thread
    or
    https://www.google.com/search?hl=en&...l0l0l9l9l1l1l0
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2004
    Posts
    51

    Re: RegConnectRegistry : Access Denied

    Hi VictorN,

    Yes, you are right we get actual error "Access denied" from RegConnectRegistry itself, but in some cases the GetLastError() is useful.


    For e.g. If wrong credentials are given to RegConnectRegistry then it returns Access Denied and GetLastError() returns the actual reason for access denied
    "Logon Failure: unknown user name or bad password"


    But, may not be true in every case...

    SandyG
    Last edited by SandyG; February 23rd, 2012 at 09:11 AM.

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: RegConnectRegistry : Access Denied

    Quote Originally Posted by SandyG View Post
    Yes, you are right we get actual error "Access denied" from RegConnectRegistry itself, but in some cases the GetLastError() is useful.


    For e.g. If wrong credentials are given to RegConnectRegistry then it returns Access Denied and GetLastError() returns the actual reason for access denied
    "Logon Failure: unknown user name or bad password"
    Possible, last error has been set by a previously called function in your code or by a function internally called by RegConnectRegistry.
    Anyway, as long as it's not clearly documented, avoid this type of workaround.

    Quote Originally Posted by SandyG View Post
    But, may not be true in every case...
    Right. Again, get rid of it.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Mar 2004
    Posts
    51

    Re: RegConnectRegistry : Access Denied

    Hi ovidiucucu,

    Thanks for your recommendations.

    Do we any specific reasons why this call is failing in case where account used is Domain Account.

    User: Domain Account
    Remote Machine: Windows 2003 SP2
    1. Remote Registry is running
    2. Also tried with local Admin user but not working.

  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: RegConnectRegistry : Access Denied

    Reasons in order of their probability:
    1. Remote access to registry is restricted by remote host policy
    2. The accessed key has specific access settings the domain account not in, or explicitly denied
    3. Some network resource (share or printer) on the remote target is already connected, with different account credentials (not sure, but it's worth to check)
    Best regards,
    Igor

  7. #7
    Join Date
    Mar 2004
    Posts
    51

    Re: RegConnectRegistry : Access Denied

    Hi Igor,

    Thanks for the reply...

    Reasons in order of their probability:
    1. Remote access to registry is restricted by remote host policy

    [Comment] Whether any specific Policy to check. e.g.
    "Act as part of operating system" since Access is denied to HKEY_PERFORMANCE_DATA.

    2. The accessed key has specific access settings the domain account not in, or explicitly denied

    [Comment] The Key has the Read Access.

    SandyG

  8. #8
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: RegConnectRegistry : Access Denied

    FYI, "Act as part of operating system" makes sense only for local access.
    Attached Images Attached Images  
    Best regards,
    Igor

  9. #9
    Join Date
    Mar 2004
    Posts
    51

    Re: RegConnectRegistry : Access Denied

    Hi Igor,

    Thanks for the reply...


    SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg
    SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib

    Both the registry entries are present in the Remote registry settings, still the same issue.

    SandyG

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured