[Winpcap-users] While testing Gianlucas winpcap3.1 [prerelease]...

Marc Wetzel mwse at gmx.de
Wed Aug 3 11:00:35 GMT 2005


Right,

Fun part is if I use the same (CoInitialize(NULL)), then it doesn't work 
at all (inside a thread).
I can definately say that it only works inside a thread if I initialize 
to COINIT_MULTITHREADED

You are absolutely right about the CoUnitialize() call. This was not 
needed, but the program behaves the same.

I haven't been able to do the following:

[Initialize COM to APARTMENT (this is a must if you use most ActiveX 
components like IExplorer]
[Initialize IExplorer]
[Create new thread]
[inside thread proc initilize COM to MULTITHREADED]
[use winpcap inside the thread...]

It always gives me the "Device not found" error,


Can you verify this? (using a simple example with _beginthread() )

Greetings
/Marc

Gianluca Varenni wrote:

>
> ----- Original Message ----- From: "Marc Wetzel" <mwse at gmx.de>
> To: <winpcap-users at winpcap.org>
> Sent: Monday, August 01, 2005 11:28 PM
> Subject: Re: [Winpcap-users] While testing Gianlucas winpcap3.1 
> [prerelease]...
>
>
>> Gianluca,
>>
>> the following code is copied out of the Delphi headerfile defining 
>> the constants
>> for CoInitializeEx:
>> const
>>  // flags passed as the coInit parameter to CoInitializeEx.
>>  {$EXTERNALSYM COINIT_MULTITHREADED}
>>  COINIT_MULTITHREADED      = 0;      // OLE calls objects on any thread.
>>  {$EXTERNALSYM COINIT_APARTMENTTHREADED}
>>  COINIT_APARTMENTTHREADED  = 2;      // Apartment model
>>  {$EXTERNALSYM COINIT_DISABLE_OLE1DDE}
>>  COINIT_DISABLE_OLE1DDE    = 4;      // Dont use DDE for Ole1 support.
>>  {$EXTERNALSYM COINIT_SPEED_OVER_MEMORY}
>>  COINIT_SPEED_OVER_MEMORY  = 8;      // Trade memory for speed.
>>
>> as you see, 0 has the meaning of COINIT_MULTITHREADED
>> You said you initialize also to NULL?
>
>
> No. I said that WinPcap uses CoInitialize(NULL) (note the lack of the 
> trailing "Ex" in the function name), which corresponds to 
> CoInitializeEx(NULL, COINIT_APARTMENTTHREADED).
>
> Have a nice day
> GV
>
>
>
>> Maybe we both are doing the same?
>>
>> Regards
>> /Marc
>>
>> Gianluca Varenni wrote:
>>
>>>
>>> ----- Original Message ----- From: "Marc Wetzel" <mwse at gmx.de>
>>> To: <winpcap-users at winpcap.org>
>>> Sent: Monday, August 01, 2005 12:43 PM
>>> Subject: Re: [Winpcap-users] While testing Gianlucas winpcap3.1 
>>> [prerelease]...
>>>
>>>
>>>>
>>>>>>
>>>>>> But you might remember, that I had trouble using 
>>>>>> winpcap3.1.b4/WAN devices with Delphi,
>>>>>> because of some kind of COM initialization problems.
>>>>>> It only worked if I do a CoInitializeEx(NIL, 
>>>>>> COINIT_MULTITHREADED) at the very start of the code.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I know. This is one of the biggest headaches I had with WinPcap 
>>>>> and NdisWan.
>>>>>
>>>> It really really only works if I set it to COINIT_MULTITHREADED 
>>>> (not the other way around).
>>>
>>>
>>>
>>> Uhm, are you using Windows XP? If you are using the test dlls on my 
>>> web pages (i.e. the latest build of the dlls, in practice) every 
>>> attempt to open/list the wan adapters fails if COM has been 
>>> initialized as COINIT_MULTITHREADED *on the same thread*.
>>>
>> _______________________________________________
>> Winpcap-users mailing list
>> Winpcap-users at winpcap.org
>> https://www.winpcap.org/mailman/listinfo/winpcap-users 
>
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>


More information about the Winpcap-users mailing list