<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Windows CE Networking Team WebLog : Author: David Kanz</title><link>http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx</link><description>Tags: Author: David Kanz</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Memory Corruption, Compiler Bug, Or Not?</title><link>http://blogs.msdn.com/cenet/archive/2007/10/22/memory-corruption-compiler-bug-or-not.aspx</link><pubDate>Tue, 23 Oct 2007 04:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5613267</guid><dc:creator>cenet</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cenet/comments/5613267.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=5613267</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;While tracking down some memory corruption issues, I noticed in one function that a parameter on the stack was always getting set to the value 2, even though it was a pointer. I could see it turn red in the memory view window as its value changed. I thought I had identified a compiler bug. But no, it was not a compiler bug. It was actually a mismatch between the optimizing compiler and the debugger. The x86 optimizer knew that the memory for the stack variable was referenced only one time and then was enregistered, so its stack memory could be used for another local variable. The debugger’s local variable display did not realize this and continued to display the memory value for the local variable – confusing.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;On ARM, a similar situation can arise since the first 4 registers (R0, R1, R2 and R3) are used as function parameters. The debugger doesn’t track when a function parameter gets moved to a “permanent” register (R6 for instance) and continues to display the function parameter register’s value as the local variable’s value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5613267" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>Windows CE and the Serial Carrier Detect Signal</title><link>http://blogs.msdn.com/cenet/archive/2007/07/24/windows-ce-and-the-serial-carrier-detect-signal.aspx</link><pubDate>Tue, 24 Jul 2007 22:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4032933</guid><dc:creator>cenet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/cenet/comments/4032933.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=4032933</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;The Windows CE serial port based networking components have an historical affinity for the RS232 Carrier Detect (CD) signal. A key feature of Windows CE 1.0 was automatic synchronization of email and contacts when docked (ActiveSync). The device needed to detect when it was docked, and it needed to wake up when docked. Since this scenario was originally serial port based, CD was used as both the wake-source interrupt and the signal to start the ActiveSync application on the device.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;The corresponding components (mostly Unimodem and PPP) in Windows NT/XP/Vista do not rely on CD, so many scenarios that work between non-CE devices do not work the same when a CE device is involved. It is often due to one of the following reasons:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; mso-add-space: auto"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;The cable being used does not include the Carrier Detect line.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; mso-add-space: auto"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;The platform specific serial port device driver does not properly report CD status. The serial driver’s SL_GetModemStatus indicates CD state with the MS_RLSD_ON flag for the Win32 serial port API function GetCommModemStatus(). EV_RLSD is used to indicate a change in state of the CD signal.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; mso-add-space: auto"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;The hardware does not implement the CD signal. If this is the case, then a valid workaround is for the serial port device driver to always indicate that CD is asserted by always setting MS_RLSD_ON in its SL_GetModemStatus function.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4032933" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>PCMCIA Problems on Windows CE Devices.</title><link>http://blogs.msdn.com/cenet/archive/2007/05/07/pcmcia-problems-on-windows-ce-devices.aspx</link><pubDate>Mon, 07 May 2007 20:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2465921</guid><dc:creator>cenet</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/cenet/comments/2465921.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=2465921</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;I wrote the first PCMCIA driver for Windows CE in 1995. At the time, CE had not been ported to the PC, so we had to rely on reference platforms and prototypes to debug. Some problems were not software related.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;The first Windows CE reference platform was called PeRP (Pegasus Reference Platform, Pegasus was the code name for Windows CE 1.0). The designer did not understand how the software would use the PCMCIA memory mapped regions. &lt;B style="mso-bidi-font-weight: normal"&gt;He thought he would be thrifty and “save” three gates by making a byte appear at every DWORD address.&lt;/B&gt; This is why the CE 1.0 Card Services API included such functions as CardReadAttrByte and CardWriteIOByte. A vestige of this design decision remained until CE 5.0 in CardMapWindow’s pGranularity parameter. On the PeRP, pGranularity would be set to 4 or sizeof(DWORD). On all other platforms it is 1.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;The next Microsoft developed reference platform was called the Odo (after a Star Trek character). It had a pluggable CPU architecture so we could test the various processors supported by CE at the time. Those in charge of the decision were sometimes too quick to approve a new CPU board. In their view, I guess booting CE to the shell was good enough. The PCMCIA support always seemed to get overlooked. I was left scrambling to figure out another reason why PCMCIA was failing on yet another Odo CPU board. I became quite adept at setting up the logic analyzer for monitoring the PCMCIA bus, and adept at reading the traces. Sometimes this wasn’t enough.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;On one flavor of MIPS CPU board for Odo, some cards would work fine, and others would get recognized, but then could not be used in I/O mode. By simply reading some of the PCMCIA lines with a multi-meter we found that the power lines had not even been attached! &lt;B style="mso-bidi-font-weight: normal"&gt;The cards were being powered by the address lines!&lt;/B&gt; This of course limited the amount of power available to the card. Any card requiring more than a certain amount of power would not work in I/O mode. A card in memory mode (the initial mode a card is in when first inserted) has minimal power requirements since the attribute memory is usually a small ROM. I/O mode usually requires much more power. The amount of power varies from one card to another. This is why some worked and others did not.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;I have encountered many similar power related problems. Much of the time the root cause is that the batteries cannot supply enough power for the card. A closely related problem is that the device on battery power cannot power a card to operating voltage in enough time. That is why there is the power-on delay registry setting. &lt;B style="mso-bidi-font-weight: normal"&gt;Often, plugging in the A/C power adapter provides enough power in these cases.&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Another interesting problem had nothing to do with the PCMCIA controller hardware implementation and nothing to do with power. In version 1.0, CE did not support 16 bit I/O on PCMCIA. When support for it was added, there were some platforms that had problems. When I finally put the logic analyzer to work, I discovered that accesses to some byte-wide registers were not appearing in the trace. There were only 16 bit accesses. Configuring the software for the platform to report support for only 8 bit PCMCIA I/O obviously worked since the platform worked with CE 1.0. A visit to the MIPS architecture manual revealed the reason – &lt;B style="mso-bidi-font-weight: normal"&gt;MIPS has no instructions for byte-wide memory accesses!&lt;/B&gt; On MIPS, you either support 16 bit PCMCIA access or 8 bit, but not both. The same MIPS instruction is used for both; the PCMCIA subsystem generates an 8 bit access on the PCMCIA bus if it is configured for 8 bit. Many card designs are modeled from PC (x86) architecture designs and so they freely allow mixed 8 and 16 bit I/O accesses, often to the same register. Because of this a MIPS based device almost always has to support 8 bit only PCMCIA I/O.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2465921" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>Windows CE IRDA Architecture</title><link>http://blogs.msdn.com/cenet/archive/2007/02/09/windows-ce-irda-architecture.aspx</link><pubDate>Fri, 09 Feb 2007 23:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1637071</guid><dc:creator>cenet</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/cenet/comments/1637071.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=1637071</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The IrDA related Windows CE components are Irdastk.dll, Ircomm.dll and an IrDA NDIS miniport driver - typically Irsir.dll is used. For platforms with DMA based IrDA hardware, a platform specific IrDA NDIS miniport driver will be used.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Protocol Driver&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The irdastk.dll component implements the IrDA protocol. It provides support for AF_IRDA Winsock sockets. It is an NDIS protocol driver and it binds to an underlying NDIS IrDA miniport driver.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Serial Based &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:place w:st="on"&gt;&lt;st1:PlaceName w:st="on"&gt;NDIS&lt;/st1:PlaceName&gt; IrDA &lt;st1:PlaceType w:st="on"&gt;Miniport&lt;/st1:PlaceType&gt;&lt;/st1:place&gt; Driver&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The irsir.dll component is a special IrDA NDIS miniport driver that talks to IrDA hardware that is exposed as a serial port. Early in IrDA history, it was appropriate to expose the IrDA hardware as a special serial port due to the lower speeds and simpler hardware abstraction. When irdastk.dll binds to the irsir.dll NDIS miniport, irsir.dll converts the NDIS miniport driver commands into appropriate Win32 serial port function calls. For instance, when irdastk.dll calls NdisSend(), NDIS routes the call to irsir.dll’s miniport SendHandler which in turn calls WriteFile() on the Irda serial port.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Many Windows Mobile devices still expose their IrDA hardware as a serial port.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Virtual &lt;st1:place w:st="on"&gt;&lt;st1:PlaceName w:st="on"&gt;Serial&lt;/st1:PlaceName&gt; &lt;st1:PlaceType w:st="on"&gt;Port&lt;/st1:PlaceType&gt;&lt;/st1:place&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The ircomm.dll component implements a virtual serial port. A serial port based application can communicate over IrDA without change just by using the serial port presented by ircomm.dll (i.e. “COM3:”). For each Win32 serial port function, ircomm.dll calls an appropriate AF_IRDA Winsock function. For instance, if an application calls WriteFile() using the ircomm.dll serial port handle, it causes ircomm.dll to call the Winsock send() function.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The serial port presented by Ircomm.dll has the index found under the registry key [HKEY_LOCAL_MACHINE\Drivers\Builtin\Ircomm] in the REG_DWORD value named “Index”.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1637071" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>Configuring TAPI line devices in Windows CE</title><link>http://blogs.msdn.com/cenet/archive/2006/11/21/configuring-tapi-line-devices-in-windows-ce.aspx</link><pubDate>Wed, 22 Nov 2006 04:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1119108</guid><dc:creator>cenet</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cenet/comments/1119108.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=1119108</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;In Windows CE, TAPI listens for device plug and play notifications. When it gets notified of a new device, it looks in the device driver’s key and subkeys for a REG_SZ value named Tsp. If it is found, it specifies the dll name of a TSP (TAPI Service Provider, for instance, unimodem.dll) to be associated with this device. TAPI loads the TSP and calls both its TSPI_providerCreateLineDevice and TSPI_providerCreatePhoneDevice functions with 3 parameters: a handle to the new device’s “active” registry key (i.e. HKEY_LOCAL_MACHINE\Drivers\Active\NN), the device driver registry key path string, and the new device’s name.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Take for example, a new serial driver, BSPSerial.dll. Its device driver key would look something like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;[HKEY_LOCAL_MACHINE\Drivers\Builtin\BSPSerial]&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“Dll”=”bspserial.dll”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“Prefix”=”COM”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“Index”=dword:1&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“DeviceArrayIndex”=dword:0&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;To expose it as a null modem Unimodem controlled TAPI line device, add this key and these values: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;[HKEY_LOCAL_MACHINE\Drivers\Builtin\BSPSerial\Unimodem]&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“Tsp”=”unimodem.dll”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“DeviceType”=dword:0&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;(DeviceType == 0 means null modem, see unimodem.h for the complete list of values)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Additionally, BSPSerial could be exposed as a Hayes compatible Unimodem controlled TAPI line device by adding this key: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;[HKEY_LOCAL_MACHINE\Drivers\Builtin\BSPSerial\UnimodemHayes]&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“Tsp”=”unimodem.dll”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;“DeviceType”=dword:1&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;These two subkeys of BSPSerial will cause two TAPI line devices to appear when BSPSerial’s COM1: device is created.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;In the first version of Windows CE, the unimodem device settings were located directly in the device driver key. This limited TAPI configurability by not allowing multiple TSPs to use the same device and by not allowing multiple unimodem line device types on the same device. This configuration is still allowed, although discouraged.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;For unimodem, this limitation was overcome with the HKEY_LOCAL_MACHINE\ExtModems key. Unimodem.dll reads this key immediately after system initialization and instantiates the line devices listed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;Author: David Kanz&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1119108" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>TAPI Resource Cleanup</title><link>http://blogs.msdn.com/cenet/archive/2006/06/16/634694.aspx</link><pubDate>Sat, 17 Jun 2006 01:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:634694</guid><dc:creator>cenet</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cenet/comments/634694.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=634694</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;TAPI maintains its resources in a hierarchy and will perform automatic cleanup based on the hierarchy of objects.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The top of the TAPI resource hierarchy is the HLINEAPP which represents a TAPI client application instance. It is returned from lineInitialize and lineInitializeEx. If the application calls lineShutdown with its HLINEAPP, then all TAPI resources associated with the HLINEAPP will be deleted. An application may have more than one HLINEAPP.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The next level of the TAPI resource hierarchy is the HLINE which represents an open handle to a TAPI line device, returned from lineOpen. An HLINE is closed with lineClose.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Below HLINE is the HCALL which represents an open handle to a call. HCALLs are unique since TAPI will allocate them behalf of an application with an open line device (HLINE) in order to indicate call status messages to the application. An HCALL is also allocated by calling certain TAPI functions, for instance lineMakeCall. An HCALL is closed with lineDeallocateCall. Since TAPI automatically allocates HCALLs for an application, it is most efficient for the application to call lineDeallocateCall when it receives the LINE_CALLSTATE message with the LINECALLSTATE_IDLE state.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The bottom of the hierarchy is the LINEMESSAGE. A LINEMESSAGE may be associated with an HLINEAPP, an HLINE or an HCALL. There is no application control over the allocation or freeing of LINEMESSAGEs. An application needs to be aware that when it closes or frees an HLINEAPP, HLINE or HCALL, then TAPI will delete all pending LINEMESSAGEs associated with that resource. When an application closes one of the higher level objects, it should no longer wait for any messages associated with the object.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In summary:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Closing an HCALL (lineDeallocateCall) deletes all pending LINEMESSAGEs associated with it.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Closing an HLINE (lineClose) closes all HCALLs associated with it.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Closing an HLINEAPP (lineShtudown) closes all associated HLINEs.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In Windows CE, TAPI is implemented as a PSL (Protected Server Library), so it gets a notification when a process terminates. When a process terminates, TAPI closes all HLINEAPPs associated with the process.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Author: David Kanz&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=634694" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>TAPI Call Handle Confusion</title><link>http://blogs.msdn.com/cenet/archive/2006/06/13/630411.aspx</link><pubDate>Wed, 14 Jun 2006 06:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:630411</guid><dc:creator>cenet</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cenet/comments/630411.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=630411</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;TAPI call handles (HCALLs) consume memory and should be closed with lineDeallocateCall when no longer needed.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;If an application has a TAPI line device opened (HLINE), then TAPI will allocate call handles on its behalf in order to indicate call status messages to the application. Such an application needs to be aware of this and at the very least process the LINE_CALLSTATE message indicating LINECALLSTATE_IDLE by calling lineDeallocateCall on the HCALL passed as dwParam1. Otherwise, the system will leak almost 200 bytes of memory per call.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;For an application using TAPI to control a call, LINECALLSTATE_IDLE is also a good time to call lineDeallocateCall. In this case though, the application needs to be aware that calling lineDeallocateCall will cause TAPI to delete any LINE_REPLY messages for asynchronous operations associated with that HCALL. If the application has a separate thread that calls lineDrop and then blocks waiting for the associated LINE_REPLY, there needs to be coordination with the message handling thread that just called lineDeallocateCall, otherwise the lineDrop thread will block indefinitely.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Author: David Kanz&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=630411" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>Pageable Device Drivers</title><link>http://blogs.msdn.com/cenet/archive/2006/06/13/630377.aspx</link><pubDate>Wed, 14 Jun 2006 06:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:630377</guid><dc:creator>cenet</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/cenet/comments/630377.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=630377</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;During the Windows Mobile 5.0 timeframe, we changed most of the networking components to be pageable device drivers. This caused boot times to decrease by a significant amount since there was now more than 2MB extra free RAM.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;A device driver can safely be made pageable if:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;1. it does not need to do any processing during the critical power down and power up phase (xxx_PowerDown and xxx_PowerUp)&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2. it is not involved in the paging process&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;All that needs to be done to make a device driver pageable is:&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in" type=1&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;remove the xxx_PowerDown and xxx_PowerUp entries from the driver’s .def file&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;add the value, “Flags”=dword:2, to the device driver’s device key (2 == DEVFLAGS_LOADLIBRARY). By default, a device driver’s DLL is loaded with LoadDriver() which loads it as non-pageable.&lt;/LI&gt;&lt;/OL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In some device drivers the only processing during xxx_PowerDown/Up is to note that the system power mode has changed. Such processing can be replaced with a thread that uses a Message Queue (CreateMsgQueue) which it has passed to the RequestPowerNotifications function, specifying PBT_RESUME. Then it can loop calling ReadMsgQueue.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The PBT_RESUME messages get posted in a timely enough manner that this method is in most cases an adequate replacement for xxx_PowerDown/Up.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;Author: David Kanz&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=630377" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item><item><title>About David Kanz</title><link>http://blogs.msdn.com/cenet/archive/2006/06/13/630315.aspx</link><pubDate>Wed, 14 Jun 2006 04:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:630315</guid><dc:creator>cenet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/cenet/comments/630315.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cenet/commentrss.aspx?PostID=630315</wfw:commentRss><description>&lt;P&gt;I'm David Kanz. I've worked at Microsoft since October 19, 1987 - Yes, Black Monday. I initially worked on OS/2 Lan Manager. When the Windows For Workgroups team asked me to join them in 1993, they tried to entice me by talking about Thomas Fenwick's tiny kernel for handheld devices. I was sold. This was to become what we now call Windows CE. When it was announced that the Winpad, Pulsar and At Work FAX teams were being disbanded and rejoined to form what is now Windows CE, I joined as soon as I could.&lt;/P&gt;
&lt;P&gt;I initially worked on the drivers team developing the PCMCIA system and helping with other driver issues. Then I switched to the networking team, where I own TAPI, Irda, some Winsock stuff&amp;nbsp;and VoIP, among other things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=630315" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cenet/archive/tags/Author_3A00_+David+Kanz/default.aspx">Author: David Kanz</category></item></channel></rss>