Get Server Access With Diffrent user Acct.

Posted on 2005-04-12
Last Modified: 2010-04-01
I need to modify/delete access files on a server from my c++ program running on a client machine with a read only access to a mapped drive.
I have a user acct with full access
The server is not running FTP.
I can't map a drive with a diffrent user name. only one map allowed
IIS is not running.
All clients amd servers are on the same domain.

Is there any other way to access the files??

Question by:MCofer
    LVL 86

    Expert Comment

    You could just use 'WNetAddConnection2()' to authenticate to the share as a different user, e.g.

       NETRESOURCE         nr;
       DWORD               dwRes;

       ZeroMemory  (   &nr,    sizeof  (   NETRESOURCE));

       nr.dwType           =   RESOURCETYPE_DISK;
       nr.lpLocalName      =   "";
       nr.lpRemoteName     =   "\\\\server\\share";

       dwRes   =   WNetAddConnection2  (   &nr,

    Author Comment

    WNetAddConnection2() will not let you create a new share if one already exist with another user name.
    The Client already has a read only share with his account.
    I can't create a new Full Access share.

    LVL 86

    Expert Comment

    >> WNetAddConnection2() will not let you create a new share if one already exist with another user name

    It should work, since we're not mapping to a drive letter.

    Author Comment

    I've tried it!! You can create two or more shares with the same user name but only one share when using unique account names.

    Author Comment

    I found a solution using :


    Accepted Solution

    PAQ'd, 250 points refunded.
    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
    Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
    The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now