473,287 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Tun/Tap Driver using OpenVPN and DeviceIoControl

Hello I am trying to port some code and I am running into some issues I
may or may not be able to solve on my own and would appreciate your help

Basically I am trying to open the Tun Driver through openvpn in Ether
(Tap mode).

code is as follows

f = win32file.CreateFile("C:\\WINDOWS\\System32\\drive rs\\tunmp.sys",
GENERIC_READ, 0, None, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
if WINDOWS:
ifs = win32file.DeviceIoControl(f, TUNSETIFF,
struct.pack("16sH", "wj%d", TUNMODE), 0, None)
else:
ifs = ioctl(f, TUNSETIFF, struct.pack("16sH", "wj%d", TUNMODE))
ifname = ifs[:16].strip("\x00")
print "Interface %s created. Configure it and use it" % ifname

but does not seem to work so well I get "The Paramater is incorrect"

Traceback (most recent call last):
File "wifi.py", line 167, in <module>
ifs = win32file.DeviceIoControl(f, TUNSETIFF, struct.pack("16sH",
"wj%d", TU
NMODE), 0, None)
pywintypes.error: (87, 'DeviceIoControl', 'The parameter is incorrect.')
Would appreciate any help

Ty
Jun 27 '08 #1
0 1816

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jules Crown | last post by:
Everyone, greetings, newbee here. What I'm trying to do is to compress files on NTFS from C#. I've been fishing around for info and gathered the hereafter. I'd like to know what's wrong with...
12
by: Steve | last post by:
I wrote a simple virtual device driver int15.sys, Is C# support load the device driver from AP?
3
by: bb | last post by:
I have a windows network device driver written in c++ and a user interface im porting to c#, my problem is i dont seem to be getting notified of the event calls from the driver to the c# app im...
3
by: Jacky | last post by:
Hi, I am trying to make network card interface with VB.NET 2002. I use DeviceIOControl-function. I have tried to define inbuffer and outbuffer using byte array and it's pointer. The second I...
1
by: Juan Pedro Gonzalez | last post by:
Helo, I'm having problems here with the input buffer.... Ive defined the API call as: <System.Runtime.InteropServices.DllImport("kernel32", SetLastError:=True)> _ Private Shared Function...
6
by: Fla | last post by:
Hy! I'm newbie to VB 2005 and I'm trying to read value from a device driver, as I used in VB6 with CreateFile and DeveiceIoControl. I get a correct driver handle with CreateFile but I can't read...
1
by: =?Utf-8?B?S2lk?= | last post by:
hi Can I CreateFile and DeviceIOControl by C# ? Does it use the same functions as Visual C , what file should I include and link ? Thank you .
1
by: raravaice | last post by:
We have a problem with openvpn routing Accordingly to the picture we have a server and a client of openvpn,server is Fedora9 and client is win xp,we intend to assign a valid ip address from server...
0
by: scotter86 | last post by:
Hi everyone, I'm somewhat new to Linux, and completely new to OpenVPN. But here is my situation, I have OpenVPN Installed on my server runing Ubuntu 7.10. I also have wandered through tutorials...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.