[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Get Server Access With Diffrent user Acct.

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??

0
MCofer
Asked:
MCofer
  • 3
  • 2
1 Solution
 
jkrCommented:
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,
                                       "Password",
                                       "UserName",
                                       0
                                   );
0
 
MCoferAuthor Commented:
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.

mcofer
0
 
jkrCommented:
>> 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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
MCoferAuthor Commented:
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.
0
 
MCoferAuthor Commented:
I found a solution using :

LogonUser()
ImpersonateLoggedOnUser(hToken)
RevertToSelf();
0
 
CetusMODCommented:
PAQ'd, 250 points refunded.
CetusMOD
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now