<div>Hi Jouni, </div>
<div>&nbsp;</div>
<div>I looked at the new version of ndis_events.c and the fix is exactly what I have expected. Thank you!</div>
<div>&nbsp;</div>
<div><span class="gmail_quote">On 9/6/06, <b class="gmail_sendername">Jouni Malinen</b> &lt;<a href="mailto:jkmaline@cc.hut.fi">jkmaline@cc.hut.fi</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Tue, Sep 05, 2006 at 11:03:20AM +0300, Adrian Nistor wrote:<br><br>&gt; The issue is with the CoInitializeSecurity() call in ndis_events.c. It is
<br>&gt; done too many times during the lifetime of the wpa_supplicant process. MSDN<br>&gt; says this call should be done only once during the lifetime of a process. A<br>&gt; second call will fail with the error RPC_E_TOO_LATE. This is also visible in
<br>&gt; the log you supplied, look for the line:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1157393449.796875: CoInitializeSecurity() failed - returned<br>&gt; 0x80010119&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;----- aka RPC_E_TOO_LATE<br><br>&gt; In ndis_events.c the static variable wmi_refcnt is used in order to avoid
<br>&gt; doing initializations of COM and WMI code too many times. Still this is not<br>&gt; enough to ensure correctness, because after you remove all interfaces the<br>&gt; counter drops to 0 again and a subsequent add_interface will re-do all the
<br>&gt; said initializations and call CoInitializeSecurity() again, which is wrong.<br>&gt; It is ok to do the COM and WMI thing again, but not ok to re-do<br>&gt; CoInitializeSecurity.<br><br>wmi_refcnt is used only to protect CoInitialize* part, not WMI setup.
<br>Anyway, it was allow CoInitializeSecurity() to be called multiple times.<br><br>&gt; I suggest to add a new flag to indicate if CoInitializeSecurity() was<br>&gt; called, apart from the already existing wmi_refcnt variable.
<br>&gt; This small patch fixed the problem.<br>&gt;<br>&gt; Jouni, could you add this to the dev branch? Thank you!<br><br>No patch included, but this was a trivial change, so I just added a new<br>variable to allow CoInitializeSecurity() to be called once. I have not
<br>tested this, but I'm assuming that it is still okay to call<br>CoUninitialize() follow by CoInitialize() and just skip<br>CoInitializeSecurity() in this case (e.g., when an adapter is removed<br>and added back).<br><br>
--<br>Jouni Malinen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PGP id EFC895FA<br>_______________________________________________<br>HostAP mailing list<br><a href="mailto:HostAP@shmoo.com">HostAP@shmoo.com</a><br><a href="http://lists.shmoo.com/mailman/listinfo/hostap">
http://lists.shmoo.com/mailman/listinfo/hostap</a><br></blockquote></div><br>