CS130 Winter 2007 - Wine / Comctl32

[By Lei Zhang; retrieved on 24 Jan 2009 from http://linux.ucla.edu/~leiz/software/wine/cs130_w07.php]

The Winter 2007 CS130 Wine project focuses on Common Controls. (comctl32) Here's some useful information and links for people working on this project.

Content

Windows Programming

Win32 API Programming

The #winprog win32 api tutorial

Messages / Notifications / Styles

Messages to controls: send messages to controls to make it do something or to get some property from it. For comctl32, most controls accept some generic Windows messages as well as some control specific messages. (i.e. the status bar accepts WM_SETTEXT, and SB_GETRECT) One can send messages using the SendMessage() call.

Control notifications: controls send messages to their parents in reaction to some events. Again, there are generic Windows notifications and control specific notifications. (i.e. ListView can send NM_CLICK, and LVN_ITEMCHANGED)

Styles: these turn on/off features or visual properties for a given control. All controls accept generic styles like WS_VISIBLE, and controls have their own specific styles like LVS_AUTOARRANGE. There also exists a set of extended styles. (i.e. Toolbar extended styles)

Comctl32

. o O (Wouldn't it be nuts if programmers had to implement their own GUI elements?) Windows give programmers a set of commonly used GUI elements as basic building blocks for applications.

MSDN reference

List of Common Controls

Checkout Control Spy if you want to see the controls in action.

Control Wine Source Owner Messages Test Status (Jan 07) Test Status (Mar 07) Notes
Animation dlls/comctl32/animate.c No Tests No user interaction
Button Part of user32
ComboBox Part of user32
ComboBoxEx dlls/comctl32/comboex.c 29 Tests
Date and Time Picker dlls/comctl32/datetime.c Kanit 15 No Tests 10 Msgs Tested (544 Tests)
Drag List Box dlls/comctl32/draglist.c No Tests
Edit Part of user32
Flat Scroll Bar dlls/comctl32/flatsb.c - Currently same as regular scroll bar
Header dlls/comctl32/header.c Shanren 26 8 Msgs Tested (306 Tests) 21 Msgs Tested (732 Tests)
Hot Key dlls/comctl32/hotkey.c No Tests
Image Lists dlls/comctl32/imagelist.c - Not a visible control
IP Address dlls/comctl32/ipaddress.c Vamsi 6 No Tests No Tests
List Box Part of user32
List View dlls/comctl32/listview.c George 127 10 Msgs Tested (43 Tests) 20 Msgs Tested (480 Tests)
Month Calendar dlls/comctl32/monthcal.c Farshad 32 8 Msgs Tested (23 Tests) 8 Msgs Tested (1035 Tests)
Pager dlls/comctl32/pager.c Jason 14 No Tests No Tests
Progress Bar dlls/comctl32/progress.c Brandy 16 7 Msgs Tested (19 Tests) 7 Msgs Tested (19 Tests)
Property Sheets dlls/comctl32/propsheet.c Jen 33 Few Tests (2) Few Tests (2)
Rich Edit Separate dll (riched20)
ReBar dlls/comctl32/rebar.c No Tests 12 Msgs Tested (1222 Tests) Needs a lot of work
Scroll Bars Part of user32
Static Part of user32
Status Bars dlls/comctl32/status.c Alex 17 3 Msgs Tested (11 Tests) 16 Msgs Tested (53 Tests) Little user interaction
SysLink dlls/comctl32/syslink.c No Tests Only in Comctl32 V6
Tab dlls/comctl32/tab.c Hagop 29 6 Msgs Tested (520* Tests) 20 Msgs Tested (552 Tests) * many iterations of a few tests
Toolbar dlls/comctl32/toolbar.c 857 Tests
ToolTip dlls/comctl32/tooltips.c Few Tests (2)
Trackbar dlls/comctl32/trackbar.c Keith 35 No Tests 31 Msgs Tested (513 Tests)
Tree-View dlls/comctl32/treeview.c Chris 49 1 Msg Tested (3 Tests) 23 Msgs Tested (556 Tests)
Up-Down dlls/comctl32/updown.c Leslie 16 0 Msg Tested (2 Tests) 14 Msgs Tested (432 Tests) Already have message sequence testing framework

Compiling on Win32

The Windows SDK comes with a command line compiler, and the headers / libraries necessary to compile win32 programs.

Previously, you needed both Visual C++ 2005 Express Edition and the Windows Platform SDK.

After installing these two items, you can start a shell via: Programs -> Microsoft Platform SDK -> Open Build Environment Window -> (pick an os) -> (pick a build environment).

Now run: "c:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" to set up the environment variables needed by Visual C++. Now you can run commands like cl and nmake.

So now, let's say you have a comctl32 program called cs130proj, and its source files are: proj.c and utils.c. To compile this project, run:

cl -c proj.c
cl -c utils.c
cl -o cs130proj.exe proj.obj utils.obj comctl32.lib user32.lib gdi32.lib

A simple makefile for this would look like:

LIBRARIES = user32.lib comctl32.lib
APP = cs130proj.exe
OBJ = proj.obj utils.obj

all: $(APP)

$(APP): $(OBJ)
	$(CC) -o $(APP) $(OBJ) $(LIBRARIES)

.c.obj:
	$(CC) -c $<

clean:
	del $(APP) $(OBJ)

See also: Using Microsoft C++ Toolkit on Linux

Compiling Wine Tests on Windows

We need to make sure the conformance tests we write work on Windows to begin with. This means we need to compile and run the tests on Windows.

Basically, you need to copy wine-version/include/wine/test.h to wine-version/dlls/component/tests/wine/test.h. Then, from wine-version/dlls/component/tests, run:

cl -DSTANDALONE -D_X86_ foo.c user32.lib gdi32.lib bar.lib

i.e. for dll/comctl32/updown.c, do:

cl -DSTANDALONE -D_X86_ updown.c user32.lib gdi32.lib comctl32.lib

This will generate the test program updown.exe.

You may get a compiler error complaining about WM_QUERYUISTATE being undefined. This only happens if you're using the older Platform SDK. It is due to _WIN32_WINNT being incorrect or undefined. Simply add:
#define _WIN32_WINNT 0x0502 to the beginning of updown.c.

There's more information on this subject here and here.

Working with Wine

5 minute intro to Wine development

Useful Links

Documentation

Browsing the code

Mailing lists

Overview page
(I subscribe to: wine-devel, wine-patches, wine-cvs)

Conformance Tests

Wine Developer's Guide - Writing Conformance tests
More on Wine Testing (not Wine Tasting)

Examples: Comctl32: Status Bar Richedit

Also: Nightly Test Results

Wine Test Macros

Wine has a couple useful macros for testing.

The first one is ok().

ok(test, output_msg, args...);

test can be anything statement, and if it evaluates to true, then the test passes. Otherwise, the test fails and Wine prints an error message.

output_msg, args... - output_msg is a string in the same format used by printf() and args... are the variable arguments for values in the format string.

Example: r = Sendmessage(handle, FAKEMSG, 0, 0); ok(r == 5, "Expected 5, got %d\n", r);

Sometimes a test case will work on Windows, but it is known not to work with Wine. For such a case, put it inside a todo_wine() statement. This has several effects: (1) the failure is listed as a todo instead, (2) when the problem gets fixed eventually, the todo will become a failure to alert you, (3) this separates known failures from new failures that can occur through regression.

Messages Sequence Testing

See separate page.

Compiling Wine

Compiling the entire Wine tree can be a time consuming process (15 minutes on a modern machine. Fortunately, most of the time we will just be making changes in the dlls/comctl32 directory, so it's not so bad.

Here's a list of packages needed to compile Wine on certain Linux distributions.

Compiling Windows Program with Wine

To compile Windows program with Wine, use winegcc/wineg++. It takes the same arguments as gcc, so to compile and link a program with comctl32, run: winegcc -o foo foo.c -lcomctl32.

GIT

Wine switched from CVS to Git for revision control. (Git is also used by the Linux Kernel) Here's a couple documents to get started: Using Git With Wine, The Wine Git Tree

Submitting Patches

In case you didn't know: patch and diff.

Generating and Submitting Patches

Example: Patch sent to wine-patches, Patch accepted on wine-cvs

When sending in the email, attaching the patch should work in most case. (It least it does for me with Mutt and Gmail) It's also nice to include the diffstat as shown here:

 dlls/riched20/editor.c       |   26 ++++++++++++++++++--------
 dlls/riched20/tests/editor.c |   10 +++++-----
 2 files changed, 23 insertions(+), 13 deletions(-)

To generate this, run:
diffstat -w 72 your.patch

Bugzilla

Bugzilla is a bug tracking system. This is the Wine Bugzilla.

Sample bug

Here is A sample bug (#6968). There's a lot of information on this page, some of the fields are explained here.

Vijay wrote the fix for the bug, and I wrote the corresponding conformance test.

Outstanding Bugs

This is the current list of open bugs for comctl32.

List of bugs for CS130 students

Submitted all your tests already? Got an itch to fix some bugs? Well, there's plenty to do!

Disclaimer: not all bugs are the same level of difficulty, some may be much harder than others.

Bug (owner)ComponentTypeDifficulty (est)Notes
Datetime (nobody)
3044: selection of commas or weekday datetime Cspy Easy
5928: Bad fields in Timeless Time and Expense datetime Application Medium
IPaddress (nobody)
6966: Cannot overwrite field text ipaddress Cspy Easy
Listview (nobody)
6970: LVM_DELETEITEM causes incorrect redraw listview Cspy Easy
6969: Cannot select multiple items with mouse listview Cspy Medium Messages may not be sent/received in right order?
3107: listview columns do not sort in Acemoney listview Application Hard Multiple apps with the same problem
Month Calendar (nobody)
6967: Wrong date gets selected monthcal Cspy Easy Several inconsistencies
7066: monthcal does not display multiple calendar months monthcal Application Medium
Progress Bar (nobody)
6433: BCDC++ (all dc) crashes if progress bars enabled progress Application hard Have not verified the bug
Tab (nobody)
6947: Tabs are in the wrong order tab Cspy Easy Not in cspy 2.0
6948: Tab images have wrong offset tab Cspy Easy
3047: Cursor Select & Keyboard Navigation Not Implemented/ Not Working tab Cspy Medium Wrong messages getting sent?
Toolbar (nobody)
6392: Shell extension viewer has wrong placed buttons toolbar Application Hard Might be an imagelist bug, app might be sending bad messages
7077: err:toolbar:TOOLBAR_GetImageListForDrawing error in BCDC++ toolbar Application Hard Application source available
Tooltip (nobody)
6455: Image That/Extend Demo: Tooltip background is draw over the text. tooltip Application Medium
Treeview (nobody)
5286: TreeView in Becky! Internet Mail doesn't work properly treeview Application Hard
6011: jstrip crashes treeview Application Hard
Updown (nobody)
7033: Cursor in wrong position updown Cspy Easy
7034: Base 16 mode handling updown Cspy Easy
3048b: Multiple Inconsistencies/Major Work needed updown Cspy Easy Value out of range bug
3048a: Multiple Inconsistencies/Major Work needed updown Cspy Hard Up/down arrow problem only occurs in cspy 1.0, hard to reproduce

/~leiz/software/wine/cs130_w07.php last updated on Wed Dec 31 1969