How to access share using specific credentials?



Our application needs to write a file into a share on a network server. The
account that the application is running under does not have access to the
share.

But we have been given a username and password that is valid on the target
machine (and that target machine only - it's an accout local to that
machine - and not on the domain).



If the application tries to write to the share, it gets access denied. But
if i first interactivly browse to the share myself, i am prompted to enter a
username and password. So i enter

User name: DEATHSTAR\IanWork
Password: mypassword1

And i can see and access the shares. At this point, it appears that my
credentials are cached someplace in memory. If i close explorer and try to
once again browse to the share, i can see them straight away - without
having to enter the credentials.


What i need, is to find dozen or so API calls that duplicate this
functionality but in a non-interactive say (i.e. from a service)

The best i can find are a confusing hodgepodge of api calls, with names like
AcquireCredentialsHandle, InitializeSecurityContext and the like. But none
let me pass in a username, password and machine name.


.



Relevant Pages

  • RE: Help Needed configuring Samba on Webserver
    ... username and password, and it reported successfully joining the domain ... Passwd: files windbind ... I logged in as the jkocher user on a windows xp pro station that is part ... Supplying the credentials for jkocher (the logged in ...
    (Fedora)
  • Re: Connecting to a File Server
    ... to retreive a password and username saved in the credential manager? ... Using 4.2 we were able to save the credentials and then pass 0 to username ... BOOL SaveDefaultCredentials(TCHAR *szUser, TCHAR *szPassword, TCHAR ... BOOL RetValue = FALSE; ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Stange access problem
    ... Merv Porter [SBS-MVP] ... "Windows cannot bind to local domain (invalid credentials)" ... logging on with his correct username and password. ... One oddity is the username that pops up is not his 'domain/username'. ...
    (microsoft.public.backoffice.smallbiz)
  • Re: Stange access problem
    ... "Windows cannot bind to local domain (invalid credentials)" ... network resource accesses are requiring his credentials. ... on with his correct username and password. ... One oddity is the username that pops up is not his 'domain/username'. ...
    (microsoft.public.backoffice.smallbiz)
  • Weird 2000 authentication problem
    ... Hope somebody can help with this Weird windows 2000 problem. ... The NT username entered (we have a system that user name starts with F then ... the details are fed to the Oracle app, but it appears that this app can only ... then the API and the username variable see the user as f000 (note lowercase ...
    (microsoft.public.win2000.security)