September 2003 Archives

WinCE Syncing internals overview

|
This is an email/howto that I sent to the missing-sync mailing list. It is a good overview of how WinCE handles partnerships. It covers WinCE registry editing. ActiveSync parameters. TCP/IP is also touched on.

The PPC is able to record partnerships with 2 desktops. This means that you can have two computers that you sync with. It records the partnerships in the WinCE registry under the keys:

HKLM\Software\Microsoft\Windows CE Services\Partners\P1
HKLM\Software\Microsoft\Windows CE Services\Partners\P2

Each key has two values; PId and PName. The PId is a DWORD value that uniquely identifies the partnership. I believe it is a number generated on the desktop. The PName is the netbios/dns hostname of the computer. PNames are the computer names listed under the options in ActiveSync.

To connect to an ActiveSync host over the network the PName must be associated with an address in your resolver. If your local DNS/WINS infrastructure has the right name to ip number mapping then you are golden. If it doesn't then you can use HOSTS entries to force your WinCE device to resolve to a specific address.

Most computers have a hosts mechanism. Unixes have /etc/hosts. Windows has %systemroot%\hosts or lmhosts. WinCE performs this function through the registry. Hosts are recorded in:

HKLM\Comm\Tcpip\Hosts

Each host has a key that is the host name. That means there should be a "folder" under Hosts that is the name of the computer you would like to access over the net (e.g. sync with). Then inside that key/folder there should be one binary value named ipaddr. ipaddr is usally a hexidecimal representation of your IP address.

Now, if the ip address on your desktop changes, but DNS/WINS doesn't handle it OR you don't update your host entry then your pocket PC will time out. Missing-sync will never see the connection (not it's fault). EVEN over USB this TCP/IP mechanism is used because MarkSpace just uses a PPP over PTY connection to do USB syncing (pretty elegant).

Here's an example. Let's say that you have a PPC that is already connected to your network. That means you could open a web page or ping (checkout VxUtils for WinCE) using your handheld. Let's say that you've already established a partnership using USB and missing-sync on your Macintosh. We'll call the apple MyMac and say it has the ip 192.168.1.2 .

So, when you look in HKLM\Software\Microsoft\Windows CE Services\Partners\P1 you'll see a hexadecimal number for PId. You should also see MyMac listed in the PName area. Also, look at HKLM\Comm\Tcpip\Hosts. You'll probably have a folder/key titled "MyMac" and it's ip address value would be 'C0 A8 01 02' ( c0.a8.01.02 is 192.168.1.2 in hex). Now choosing 'MyMac' as the network sync host in ActiveSync will do a network sync to 192.168.1.2.

Now let's say that you've moved MyMac from home to work. Same PPC, Same missing sync, but new network address. Let's say that now MyMac is 10.0.0.200. In order to re-establish a network sync you should change ipaddr in your hosts registry area to '0A 00 00 C8' (0A.00.00.C8 is 10.0.0.200 in hex). Now missing sync will connect to the right computer.

Missing-sync doesn't care what address it is on. It's just waiting for connections. WinCE doesn't care what address the PPC has either. It just tries to connect to the partner you chose. What DOES matter is that the partner's PName matches a DNS, wins or hosts entry.

I've a billion cut&paste tips and tricks that make this faster. You'll likely derive your own. There are programs that can do this for you. Plus, this method (if your savvy) let's you sync with *more* than just 2 pcs. And please remember you are dealing with a WinCE device which is basically the Windows95 kernel and tcp/ip stack. I don't usually have to do resets to get this to work, but YMMV.

I've had great success with missing-sync and have recommended it to many people. They've done quite a lot to cushion how much MS blows. My next major need is to get my mac, ppc, and my work's exchange server to play nice for *very* basic calendar/todo/contact items.

I use Resco Explorer's registry editor.

http://www.resco-net.com/homepage.asp

But there is a very good freeware registry editor for WinCE. I use almost all the tools at this site.

http://www.phm.lu/Products/PocketPC/

I use VxUtils for basic tcp/ip tools. VxIpconfig is helpful as well.

http://www.cam.com/windowsce.html

PennySoft Calc 98 can do decimal to hex conversions because I'm lazy (but it's not as good as the palm easycalc)

http://www.calculator.org/

I have a little write up about my experiences with my first PPC that has other useful software

http://www.jimweller.net/article.php?story=20030824231527462

HTH,
Jim Weller

Doc: 32bit Assembly Quick Start using Visual Studio and MASM on Windows

| | Comments (1)
I've just completed work on my first draft of a how to describing how to create, compile and debug a helloworld assembly language program for windows on intel using visual c++ and masm. I could not find an equivalent. I'm in an assembly/architecture class this semester and these are my notes on preparing for the assembly programs later in the semester. I'm really excited to be learning this. The java XML-FO to PDF converter I'm using to transform my docbook (FOP) is not doing a good job with CDATA (code samples) in converting to PDF, but the html looks good. Check it out if your intersted. Update: I fixed the xsl stylesheets to make the pdf look better. It's readable, but still formats some spacing oddly in programlisting tags.