I opted for a different porting strategy than I originally thought. I simply couldn't work effectively outside of Visual Studio, so I decided to create a test application (rdesktop-core-tester), and turn the smallest subset possible of rdesktop into a statically-linked library (rdesktop-core). It needs a lot more work, but the results are very encouraging
Here is the first screenshot *ever* of rdesktop running on pure Win32:
http://img209.imageshack.us/my.php?image=whohoo3ts.png
What's wrong with this picture, and why? All text is missing: text output in RDP is tedious. I'll rip the code off from the X11 version, but it's not vital for now. All bitmaps are black: this is a bug, or rather a peculiarity, of rdesktop, which passes only part of raster operation codes (specifically, the "source" mask), forcing me to do some bit-juggling to turn them back into valid GDI raster operation codes - just passing the "mutilated" code resulted in the code for the BLACKNESS operation every time, and I think it shows. "Shut down..." is upside down: this is a bitmap painted directly to the screen, without a raster operation, so it worked out of the box, unlike the Windows logo in the upper half of the dialog. It turns out RDP bitmaps are top-down, like the framebuffer but unlike regular bitmaps. Easily solved by creating all bitmaps with negative heights!
Also, I could not go further than this point at the time, because keyboard input wasn't hooked up yet! I whipped up some quick support (very easy, just pass the scancodes on the wire), and of course fixed the aforementioned issues, tweaked a couple more things, blind-typed the password (no text output) and...
http://img62.imageshack.us/my.php?image=meh9ct.png
... eh. I expected a lot better. So many bugs. And I really don't understand why the strange "tile" effect... debugging drawing routines is a pain, let me tell you. I would love to have a night-time bug-hunt, but I have some *terrible* back pain, and it's becoming really hard to sit at my desk
All in all, I must say I'm a bit disappointed that the rdesktop authors, who in general stayed true to the Win32 equivalents of RDP features, here and there placed annoying little idiosyncracies - like mutilating rasterops, or using their own structures instead of the "standard" LOGPEN, LOGBRUSH, etc. or calculating and passing around coordinates of left-top + dimensions when they're actually RECTs on the wire, forcing me to recalculate the RECT, and so on, and so on - that I *know* are going to cause me headaches in the days to come (the off-by-one-pixel bug must be caused by something like that)
Well, that's all for this week! see you soon!