This is probably not the correct interpretation of this error.
The Win32 error above is more likely to indicate the actual problem.
Flags
Severity
Success
This code indicates success, rather than an error.
This may not be the correct interpretation of this code,
or possibly the program is handling errors incorrectly.
I am using TAP-Windows (from the OpenVPN project) to create an interface as described here and here. I am basing my code of the example provided in the first article: const string UsermodeDeviceSpace = "\\\\.\\Global\\"; string devGuid = GetDeviceGuid(); IntPtr ptr= CreateFile(UsermodeDeviceSpace+devGuid+".tap", FileAccess.ReadWrite, FileShare.ReadWrite, 0, FileMode.Open, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, IntPtr.Zero); [...] read more
I was trying to set up TUN-TAP device in Windows using this sample code (all driver already installed correctly): http://www.varsanofiev.com/inside/TunTest.cs IntPtr ptr = CreateFile(UsermodeDeviceSpace + this.devGuid + ".tap", FileAccess.ReadWrite, FileShare.ReadWrite, 0, FileMode.Open, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, IntPtr.Zero); int len; IntPtr pstatus = Marshal.AllocHGlobal(4); Marshal.WriteInt32(pstatus, 1); DeviceIoControl(ptr, TAP_CONTROL_CODE(6, METHOD_BUFFERED) /* TAP_IOCTL_SET_MEDIA_STATUS */, [...] read more