This is the C# example i found : http://www.varsanofiev.com/inside/TunTest.cs
2010/5/13 Jorge Aldo G. de F. Junior <jagf...@gmail.com>: > handle still returns -1 > > 2010/5/13 José Mejuto <joshy...@gmail.com>: >> Hello FPC-Pascal, >> >> Thursday, May 13, 2010, 10:42:37 PM, you wrote: >> >> JAGdFJ> Handle := CreateFile(PChar(TAP_Device), GENERIC_READ Or >> JAGdFJ> GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM Or >> JAGdFJ> FILE_FLAG_OVERLAPPED, 0); >> >> Try using: >> >> Handle:=CreateFileA(PChar(TAP_Device), GENERIC_READ or GENERIC_WRITE, >> 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); >> >> Overlapped attribute is an error for sure as non overlapped structure >> is being passed. In fact I think that no FILE_xxxx is needed at all. >> >> JAGdFJ> (translated from a C# example) >> >> Maybe the example is wrong ;) >> >> -- >> Best regards, >> José >> >> _______________________________________________ >> fpc-pascal maillist - fpc-pas...@lists.freepascal.org >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal