wine/library
Alexandre Julliard 59730ae1c6 Release 960324
Sun Mar 24 13:13:11 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [include/win.h] [windows/*.c]
	Replaced next, parent, child and owner handles by pointers in WND
	structure. This should improve performance, and should be
	reasonably safe since Microsoft did the same in Win95.

	* [include/wintypes.h] [*/*]
	Redefined HANDLE to be UINT instead of a pointer for Winelib. This
	allows removing a lot of unnecessary casts and NPFMTs.

	* [windows/caret.c]
	Create the caret brush upon CreateCaret(); use the bitmap
	dimensions for the caret.
	Fixed CARET_DisplayCaret() to use PatBlt().

Fri Mar 22 16:00:00 1996  Anand Kumria <akumria@ozemail.com.au>

	* [misc/winsocket.c]
	More sanity checks, fixup some erroneous return codes.

	* [documentation/winsock]
	Description of how compatible the winsock is currently.

Fri Mar 22 13:05:34 1996  Ulrich Schmid  <uschmid@mail.hh.provi.de>

	* [library/winmain.c]
	Set `lpszCmdParam' by concatenating arguments.

	* [loader/module.c]
	WinExec: accept Unix commands, use Wine emulator.

Mon Mar 18 12:16:27 1996  Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
	DeleteCriticalSection, EnterCriticalSection,
 	InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
 	TlsFree, TlsGetValue, TlsSetValue: new functions.
	CRITICAL_SECTION: new structure.

	* [if1632/kernel32.spec][win32/code_page.c]
	WideCharToMultiByte: new function.

	* [if1632/kernel32.spec][win32/file.c]
	GetFileAttributesA: new function.

	* [if1632/kernel32.spec][misc/main.c]
	GetEnvironmentStringsW, FreeEnvironmentStringsA,
 	FreeEnvironmentStringsW: new functions.
	
	* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
	cursoricon32.c: new file.
	LoadCursorA, LoadCursorW: modified implementation from LoadCursor
 	to WIN32_*.
	LoadIconA, LoadIconW: modified implementation from LoadIconA32
	to WIN32_*.

	* [include/struct32.h]
	pragma pack inserted.
	CURSORICON32 structures added.

	* [include/winnls.h]
	Constants CP_* and WC_* added.

	* [loader/pe_image.c]
	PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.

Sun Mar 17 16:59:12 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [misc/commdlg.c]
	Introduced hook function handling in file dialog.
	Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().

Thu Mar 14 10:50:00 1996  Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>

	* [if1632/gdi32.spec]
	Added GetNearestColor.

	* [if1632/kernel32.spec]
	Added GlobalAddAtomA.

	* [win32/param32.c]
	Added stackframe.h to includes.
	WIN32_GlobalAddAtomA() - new function.
1996-03-24 16:20:51 +00:00
..
arch.c Release 951226 1995-12-26 15:05:24 +00:00
atom.c Release 960114 1996-01-14 18:12:01 +00:00
heap.c Release 960324 1996-03-24 16:20:51 +00:00
libres.c Release 960324 1996-03-24 16:20:51 +00:00
Makefile.in Release 951226 1995-12-26 15:05:24 +00:00
miscstubs.c Release 960324 1996-03-24 16:20:51 +00:00
README.resources Release 951226 1995-12-26 15:05:24 +00:00
sup.c Release 951226 1995-12-26 15:05:24 +00:00
winestub.c Release 960131 1996-01-31 19:02:28 +00:00
winmain.c Release 960324 1996-03-24 16:20:51 +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.