Questions tagged [wnet]

19 questions
6
votes
3 answers

WNetAddConnection2 returns 1219

I am using WNetAddConnection2 and WNetCancelConnection2 to map or unmap drives. What i am trying to do is as follows: I mapped a folder(eg:Folder1) on server(eg:myserver). so the path is \\myserver\Folder1 and i map it to drive X. Now i want to…
R3D3vil
  • 681
  • 1
  • 9
  • 22
6
votes
2 answers

WNetAddConnection2 returns Error 1200 - Local name is valid

I'm trying to connect a share (let's say \server\folder) to my local device X: [DllImport("Mpr.dll", CharSet = CharSet.Unicode, SetLastError = true)] private static extern int WNetAddConnection2( [In] NetResource lpNetResource, …
Th1sD0t
  • 1,089
  • 3
  • 11
  • 37
3
votes
1 answer

boost create_directories() fails on restricted remote server

I have a problem creating directories on a share folder on a remote computer with boost create_directories(). I have only the access to read on this share. But I create a connection with user credentials with full access to read and write. The…
Phil24
  • 61
  • 6
2
votes
1 answer

Calling WNetAddConnection2 with empty local name

I have a small program that simply checks if a specified file is located on a specified network drive that is not mapped on the computer. To check this I temporarily map to the network location, check if the file exists and than unmap the drive. I…
Simon Linder
  • 3,378
  • 4
  • 32
  • 49
2
votes
1 answer

WNet API doesn't work in Windows 8

We have a .NET application that uses the WNet API through P/Invoke to enumerate network resources in a Windows network. The application works perfectly on Vista and Windows 7, but in Windows 8 it doesn't discover anything. I have tried to debug it…
Mihai Cozma
  • 385
  • 1
  • 12
2
votes
1 answer

Calling WNetAddConnection2 from PowerShell

I am trying to directly call some Win32 API's from a PowerShell script. I managed to make WNetAddConnection work with the code below: $cp = New-Object Microsoft.CSharp.CSharpCodeProvider $cpar = New-Object…
Remko
  • 7,214
  • 2
  • 32
  • 52
1
vote
0 answers

Win32: How can I detect when a computer is added or removed from network in real time?

Using the various WNet functions you can get a list of computers for given workgroups or domains. How can I detect, in real-time, when a computer shuts down (removed from network) or a new one starts up (added to network) without having to…
user3161924
  • 1,849
  • 18
  • 33
1
vote
1 answer

Problem with Win32 WNet APIs and NFS paths

I am running on a Win2K8R2 system that has Microsoft's NFS client installed in addition to the Windows CIFS client. Given a UNC path (which the NFS client does support with caveats) I need to be able to tell if operations on the path would be…
ribram
  • 2,392
  • 1
  • 18
  • 20
1
vote
1 answer

Is it possible to get a valid token from a remote computer?

Is it possible to impersonate a u/p on a remote computer? Ideally I would like to call the ImpersonateLoggedOnUser with a token I would obtain from logging into a remote computer. I know I can make a valid connection using wnet functions, but just…
Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
1
vote
0 answers

Connect to admin$ share

I am going to conenct to share folder (admin$) on remote computer in my network. This is code which I wrote in order to do it. std::wstring remoteRc(L"\\\\WIN7-PRO-X86\\admin$"); NETRESOURCE nr; ::ZeroMemory(&nr, sizeof(NETRESOURCE)); …
definename
  • 193
  • 1
  • 12
0
votes
0 answers

Save credentials via WNetAddConection API

I'm creating a desktop app in C# using aejw API. Then i have to map a persistent network drive connection with stored authentication. There is a sample code i using without effect. The code maps share succesfully, but dont store a password in…
0
votes
0 answers

Windows Networking (WNet API / mpr.dll) WNetAddConnection2 fails with NotAuthenticated

I am writing a program to map a network drive (WebDAV) from a graphical UI (Windows Forms). I am using the Windows Networking API that lives in the mpr.dll. Now, when the user enters a wrong password WNetAddConnection2 returns the NotAuthenticated…
ChrisM
  • 1,148
  • 8
  • 22
0
votes
1 answer

How to resolve this error "ERROR_BAD_USERNAME" in WNetAddConnection2?

My problem is to copy file from one system to another system on the same network. I googled for the above problem, I started working with Mark Brackett's answer. Now i am planning to copy the files from my system to another system, but i am getting…
Anjali
  • 1,680
  • 4
  • 26
  • 48
0
votes
0 answers

Error 1326 when WNetAddConnection2 is run by a Local system account

In my environment I have the following machines on the same domain: hostnam1 (Windows 7 enterprise) hostnam2 (Windows 7 enterprise) hostnam3 (Windows Server 2012 R2 domain control) I have a service which runs as Local system account on…
Bemipefe
  • 1,397
  • 4
  • 17
  • 30
0
votes
0 answers

How output structure in C++

In my program I want to get user's local groups. My code is: LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; //STRUCTURE DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT ; DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH; DWORD dwEntriesRead = 0; DWORD…
1
2