* [Openvpn-devel] I want to use tap driver in my application, buf have a problem
@ 2010-10-04 9:18
0 siblings, 0 replies; only message in thread
From: @ 2010-10-04 9:18 UTC (permalink / raw)
To: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 828 bytes --]
I call DeviceIoControl function to get tap version,but it returned error, and GetLastError return 1.
this is my code:
int main(int argc, char* argv[])
{
HANDLE hICDriver = CreateFile("\\\\.\\{E00D9A99-2A50-47F6-9B6C-FCD17739CCE5}", GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, NULL);
if (hICDriver==INVALID_HANDLE_VALUE)
{
printf("打开设备失败 ErrorCode=%d\n", GetLastError());
goto err;
}
printf("成功打开设备\n");
ULONG info[3];
DWORD len;
memset(info, 0, sizeof(ULONG)*3);
if (!DeviceIoControl (hICDriver, TAP_IOCTL_GET_VERSION,
&info, sizeof (info),
&info, sizeof (info), &len, NULL))
{
printf("DeviceIoControl ErrorCode=%d\n", GetLastError());
goto err;
}
err:
Sleep(5000);
return 0;
}
[-- Attachment #2: Type: text/html, Size: 1236 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-04 9:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-04 9:18 [Openvpn-devel] I want to use tap driver in my application, buf have a problem
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.