[Winpcap-users] Using Packet.dll in an 'not-admin' session

Bryan Kadzban bryan at kadzban.is-a-geek.net
Sat Aug 5 19:12:12 GMT 2006

Eduardo Escudero Sánchez wrote:
> I have posted before a message on this topic and someone told me that
> the only thing i had to do was run a command sc config npf start=
> auto and that's all. But the thruth is that this is not enough.

It should be...  The only thing that winpcap requires admin privileges
for is starting the driver.  Talking to the driver and using it to
capture/send packets does not require admin privileges, because it's
kernel-mode code doing the privileged stuff for you.

> When i start running my project and PacketGetAdapterNames is called
> my program throws an exception telling me that i haven't enough
> permissions.

Oh.  Hmm... maybe posting the exception's type would shed some light --
also, which .net framework version?

I know there are some hoops you have to jump through when using p/invoke
if your code is not what .net calls "fully trusted", but AFAIK this
doesn't apply to the user's account.  It only depends on where your
assembly is sitting (network drives == painful) when you make the
p/invoke call.

Or Google a bit for "code access security"; that's the mechanism that it
sounds like you're running into problems with.  Note that the C code
you're calling inside winpcap *cannot* throw an exception to your .net
code; this is something the .net framework doesn't like.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://www.winpcap.org/pipermail/winpcap-users/attachments/20060805/9a9d4a6e/signature.pgp

More information about the Winpcap-users mailing list