wine/library
Alexandre Julliard 03468f7d4b Release 980215
Sun Feb 15 12:02:59 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [graphics/x11drv/*.c] [objects/*.c]
	A few X11 critical section optimizations, mostly with XGet/PutPixel.

	* [scheduler/sysdeps.c] [misc/main.c]
	Make sure X11 critical section is available before any Xlib call.

	* [if1632/relay.c] [tools/build.c]
	Yet another attempt at fixing Catch/Throw.

	* [loader/pe_image.c]
	Fixed broken PE DLL loading.

	* [include/winnt.h] [scheduler/handle.c] [scheduler/*.c]
	Implemented handle access rights.
	Added Get/SetHandleInformation.

Sun Feb 15 09:45:23 1997  Andreas Mohr <100.30936@germany.net>

	* [misc/winsock.c]
	Fixed bug in WSACleanup which lead to crashes in WINSOCK_HandleIO.

	* [graphics/fontengine.c] [include/font.h]
	Minor improvements.

	* [memory/global.c]
	Implemented GlobalEntryHandle.

	* [misc/toolhelp.c]
	Fixed a memory bug in Notify*register.

	* [misc/w32scomb.c]
	Improved Get16DLLAddress.

	* [objects/gdiobj.c]
	Implemented GdiSeeGdiDo.


Sat Feb 14 14:57:39 1998  John Richardson <jrichard@zko.dec.com>

	* [win32/console.c]
	Added the console implementation, AllocConsole, FreeConsole,
	CONSOLE_InheritConsole.

	* [documentation/console]
	Some documentation on the console.

	* [include/winerror.h]
	Added some error defines.

	* [scheduler/k32obj.c]
	Registered the scheduler ops.

Fri Feb 13 19:35:35 1998  James Moody  <013263m@dragon.acadiau.ca>

	* [ole/ole2nls.c]
	Some English language fixes for missing values.

	* [controls/listbox.c]
	Fix to allow an empty listbox to deselect all items.

	* [relay32/user32.spec] [windows/keyboard.c]
	CreateAcceleratorTableA stub method.

	* [windows/sysmetrics.c]
	Added missing SM_CXCURSOR & SM_CYCURSOR initializers.

	* [windows/message.c]
	PostThreadMessage32A stub method.

Fri Feb 13 17:12:24 1998  Jim Peterson <jspeter@roanoke.infi.net>

	* [libtest/hello3res.rc] [libtest/hello3.c] [libtest/Makefile.in]
	Updated the 'hello3' test so that it functions properly again.

Fri Feb 13 14:08:07 1998  Martin Boehme  <boehme@informatik.mu-luebeck.de>
	
	* [graphics/mapping.c]
	Fixed the embarrassing bugs I introduced into DPtoLP and
	LPtoDP.

	* [windows/scroll.c]
	Prevent ScrollWindow32 from sending WM_ERASEBKGND.

Thu Feb 12 22:46:53 1998  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [objects/metafile] [include/ldt.h]
	Fix to cope with records longer than 64K.

	* [windows/clipboard.c]
	Clean up bitmaps and metapicts properly.

Mon Feb  3 21:52:18 1998  Karl Backström <karl_b@geocities.com>

	* [programs/winhelp/Sw.rc] [resources/sysres_Sw.rc]
	Minor update of Swedish language support.
1998-02-15 19:40:49 +00:00
..
Makefile.in Release 971116 1997-11-16 17:38:29 +00:00
README.resources Release 951226 1995-12-26 15:05:24 +00:00
winestub.c Release 980215 1998-02-15 19:40:49 +00:00

This is a short discussion of resources in WineLib.

Introduction
Resources are used to store dialogs, menus, bitmaps, icons, 
version information, strings, fonts, and accelerators.
In a Win3.1 programming environment, there are three file formats for 
resources:
- the RC script, which is human-readable and can be processed by a resource
compiler
- the .RES file, which is the output of the resource compiler
- the .EXE and .DLL files, which store resources as a part of the NE
file format
For WineLib, only a part of this is supported. In particular, there is no
.RES file, the executable is not a NE file (as it is a native Unix executable),
and some resource types are not implemented: icons, version information,
strings, and fonts.

Building a WineLib application
The build process assumes that the C source files and the resource script
is available. At the moment, a single resource script is recommended.
This script is processed by winerc:
1) the preprocessor is used to resolve symbolic style name (LBS_STANDARD, ...)
into numbers. This involves processing windows.h
2) the unused parts of windows.h (type definitions) are removed. This would
not be necessary if Wine's windows.h would use the RC_INVOKED macro.
3) winerc is invoked to create a binary representation of the resources.
This representation is stored as C source code (arrays).
4) gcc is used to compile the generated C code.
Now, each resource is available as a C array to the application. As the 
executable is not in the NE format, it is not possible to retrieve resource
locations in the executable via name. Instead, the resources have to be
referenced with their generated C array names. The linker then resolves
these names in the compiled resource file.
5) The program sources are compiled and linked with the output of step 4.
A sample build process is in toolkit/Makefile:hello3.

Required changes to the program sources
Because loading the resources from an instance handle is not possible,
the *Indirect functions have to be used to load a resource. The C arrays
can be directly passed to the *Indirect functions. So, instead of writing

	hMenu=LoadMenu(hInstance,"MAIN");

write

	hMenu=LoadMenuIndirect(hello3_MENU_MAIN.bytes);

Fortunately, the Windows API has the following functions available:
DialogBoxIndirect
CreateDialogIndirect
DialogBoxIndirectParam
CreateDialogIndirectParam

LoadMenuIndirect
SetDIBitsToDevice

Sample code is available in hello3.c. hello3res.c contains the corresponding
resources.

Keeping a common source
Clearly, changing the sources is not very desirable, and suggestions how
to reduce the amount of work are welcome. In the meantime, two approaches
allow at least to remain a common source between the Win3.1 code and the
WineLib code:
1) conditional compiles:
When compiling a WineLib application, WINELIB is defined. This can be used
to select Wine-specific code.
2) usage of winerc for Windows: The *Indirect functions are available on
plain Win3.1, and the resource format is fully compatible. Thus, recompiling
sources modified for WineLib on Win3.1 is possible and known to work.

Open problems
1) Icons and cursors: For these resources, there is no *Indirect function
documented. In addition, both are implemented by a set of two resources.
This is the reason why they are not supported by winerc.
2) Accelerators: Although winerc supports accelerators, there is no 
LoadAcceleratorIndirect function. A work-around would be to define one.
3) Fonts: Font resources are not supported by Wine at all.
4) String tables: Although string tables are not supported by winerc, there
is no reason not to add such support. Again, some indirect loading would
be necessary.
5) API requires loading by name: At some places, the name of a resource
is passed instead of a handle. The WNDCLASS structure contains the name
of a menu resource, and the icon in a dialog box is referenced by its name.
(Are there some more places?)
Clearly, loading the resource by name would be highly desirable. The
resource compiler currently creates a structure containing all resources
defined in an RC file. However, it is not clear how WINELIB could find the
location of this structure, especially, when there is more than one RC file.