Release 980601

Sun May 31 13:40:13 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [if1632/signal.c]
	Added display of exception name.

	* [loader/task.c]
	Yet another attempt at fixing SwitchStackTo/SwitchStackBack.

	* [memory/selector.c] [relay32/builtin32.c] [tools/build.c]
	  [win32/kernel32.c]
	Generate an assembly stub for Win32 register functions to make
	their names available at link time.

	* [programs/*/Makefile.in]
	Added hacks to support old resource compiler.

Fri May 29 16:27:14 1998  Marcus Meissner <marcus@jet.franken.de>

	* [tools/testrun]
	Merge of my testscripts at home into one single perl program
	(tested with perl5). Works only on Linux due to 'ps' and 'ipcs'
	magic.

	* [controls/menu.c]
	Added some DefaultMenuItem stubs.

	* [debugger/stabs.c]
	Fixed stabs loading, now supports (int,int) typeinfo format used
	by gcc-2.8 and egcs-1. If it still crashes, please mail me.

	* [if1632/][relay32/]
	Added msvideo.dll (stubs only)
	Replaced some ptr by str for stringcases
	Added some new stubs (VxDCall, FindCloseNotif....)

	* [misc/network.c]
	Some argument fixes.

	* [misc/registry.c][misc/cpu.c]
	Registry initialization partially rewritten and enhanced.

	* [scheduler/*.c]
	Some additions so we don't do kill(0,SIGUSR1) (kill processgroup
	instead of targeted thread)
	Added SetThreadContext.

Thu May 28 23:59:59 1998  Bertho Stultiens <bertho@akhphd.au.dk>

	* [tools/wrc/*]
	New resource compiler version 1.0.0 (28-May-1998)

	* [Make.rules.in] [Makefile.in]
	Changed and added rc rules to point to tools/wrc/wrc.

	* [configure.in] [include/config.h.in]
	Added check for function 'stricmp'.

	* [include/resource.h]
	Commented out the old resource structure to catch references.
	It also includes wrc_rsc.h.

	* [include/wrc_rsc.h]
	New file. Definitions for the resources generated with wrc.

	* [include/windows.h]
	Added #ifdef RC_INVOKED to exclude stdarg.h.
	Added SS_NOTIFY flag.

	* [include/winnls.h]
	Added SUBLANG_* definitions and corrected some defaults.

	* [loader/libres.c]
	Changed the sysres load functions to support wrc generated
	resources.

	* [resource/sysres_*.rc]
	Added #include <windows.h>

	* [resource/sysres.c]
	Changed declarations to match wrc's output

	* [resource/Makefile.in]
	Changed rules to work with wrc.

	* [tools/makedep.c]
	Changed generation of .rc file dependencies to .s target.

Thu May 28 22:28:39 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [files/file.c][include/windows.c][relay32/kernel32.spec]
	Implemented GetFileAttributesEx32A/W.

	* [misc/imagelist.h][include/commctrl.h][relay32/comctl32.spec]
	Added ImageList_Read and ImageList_Write stubs.
	Added ImageList_AddIcon function.
	Added ImageList_LoadImage. It is the same as ImageList_LoadImage32A.

	* [controls/header.c]
	Fixed bitmap drawing bug.
	Added full bitmap support.

	* [include/commctrl.h]
	Added missing header macros.

	* [controls/toolbar.c][include/toolbar.h][include/commctrl.h]
	  [controls/commctrl.c] [relay32/comctl32.spec]
	First implementation of toolbar control.
	Implemented CreateToolbar, CreateToolbarEx and CreateMappedBitmap.

	* [controls/progress.c][controls/status.c]
	Some code cleanup.

	* [controls/commctrl.c][include/commctrl.h][relay32/comctl32.spec]
	Removed CreateStatusWindow16 and DrawStatusText16.
	CreateStatusWindow is the same as CreateStatusWindow32A.
	DrawStatusText is the same as DrawStatusText32A.

Thu May 28 16:01:28 1998  Matthew J. Francis  <asbel@dial.pipex.com>

	* [objects/bitmap.c] [objects/bitmap.h] [objects/oembitmap.c]
	  [objects/dc.c] [graphics/x11drv/bitblt.c]
	Added partial implementation of CreateDIBSection, with great thanks
	to Ulrich Weigand <weigand@informatik.uni-erlangen.de> for
	contributing the bulk of the patch.

Wed May 27 19:04:31 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [win32/kernel32.c] [if1632/thunk.c] [include/flatthunk.h]
	ThunkConnect16 and related functions moved to emulator.

	* [loader/ne/segment.c]
	Call DllEntryPoint with correct arguments.

	* [relay32/builtin32.c]
	Bugfix: Relay debugging did not work for multiple processes.

	* [controls/menu.c]
	Bugfix: dwItemData was not set for MF_OWNERDRAW menus.

	* [if1632/relay.c] [relay32/relay386.c]
	Relay messages converted to use DPRINTF.

	* [controls/desktop.c] [relay32/user32.spec]
	Implemented PaintDesktop.

	* [files/profile.c] [if1632/kernel.spec] [misc/network.c]
	  [misc/printdrv.c] [relay32/winspool.spec] 
	  [win32/ordinals.c] [relay32/kernel32.spec]
	Some stubs added.

	* [relay32/mpr.spec]
	All ordinals were off by one.

Tue May 26 13:32:57 1998  Bill Hawes <whawes@star.net>

	* [misc/lstr.c] [include/casemap.h] [tools/unimap.pl]
	Added Unicode case conversion routines towupper/towlower,
	with mapping tables casemap.h created by tools/unimap.pl.

	* [misc/ntdll.c] [include/winnls.h] [relay32/ntdll.spec]
	  [relay32/advapi.spec]
	Minimal implementation of IsTextUnicode, just enough to get
	NT4 notepad to open ascii/unicode files.

	* [Make.rules.in] [resources/sysres_En.rc]
	Added include file dlgs.h for building resource files, so that
	resources can refer to defined values (e.g. pshHelp).

	* [misc/crtdll.c] [relay32/crtdll.spec]
	Use towupper/towlower for 32W case conversions.

	* [memory/string.c]
	Use towupper for 32W case conversions.

	* [ole/ole2nls.c]
	Use towupper for 32W case conversions; fix mem leak; minor cleanup

	* [controls/edit.c]
	Added soft break flag to edit state. Print unknown action values
	for WM_VSCROLL (action 190 occurs when running NT4 notepad.)

Mon May 25 22:42:40 1998  Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [files/file.c]
	Care for a pathological case in SetFilePointer.

	* [graphics/x11drv/xfont.c]
	Handle longer Font names in LFD_ComposeLFD and try to catch errors.

	* [loader/pe_image.c]
	Unload Dummymodule when PE_LoadLibraryEx32A fails with
	PE_LoadImage (makes Encarta 98 installer proceed).

	* [misc/registry.c]
	Move a check for a special case in RegCreateKeyEx32W after the
	check for existence.

Tue May 25 20:18:26 1998  Matthew Becker <mbecker@glasscity.net>

	* [misc/ntdll.c]
	Added some stubs, just guessing at the size of their param lists.

	* [misc/registry.c]
	Added stubs for RegUnLoadKey, RegSetKeySecurity, RegSaveKey,
	RegRestoreKey, and RegReplaceKey

	* [programs/regtest/regtest.c]
	Updated registry testing program.

Sun May 24 18:11:40 1998  Alex Priem <alexp@sci.kun.nl>

	* [file/profile.c]
	Added flag 'return_values' to PROFILE_GetSection.

Sun May 24 13:41:10 1998  James Juran <jrj120@psu.edu>

	* [misc/shell.c] [files/directory.c]
	Documentation/debugging info additions.

	* [*/*.c] [include/*.h]
	Moved many extern function definitions to appropriate header files.
	Cleaned up a few compile warnings.
	If #include "debug.h" is present, removed #include <stdio.h>.
	debug.h includes stdio.h, so it is not necessary to include both.

	* [graphics/*.c] [if1632/signal.c] [ipc/*.c] [scheduler/*.c]
	  [win32/*.c] [windows/*.c]
	Final patch to convert fprintf statements to new debugging interface.
	Some fprintfs are still left, especially in the debugger/ directory.
	However, IMHO, it's not worth the effort to change the rest.

Fri May 22 21:58:35 1998  Morten Welinder  <terra@diku.dk>

	* [windows/keyboard.c]
	Correct handling of keys "`-=[]\;',./".

Fri May 22 12:06:00 1998  Per Lindström <pelinstr@algonet.se>

	* [include/windows.h] [relay32/kernel32.spec] [win32/console.c]
	Added stub for ReadConsoleOutputCharacter32A.

Thu May 21 16:45:48 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [ole/ole2nls.c]
	Began better implementation of LCMapString32A.
	Not very well tested yet, and still need improvements.

	* [controls/scroll.c]
	Documented functions.

Wed May 20 21:37:56 1998  Peter Hunnisett <hunnise@nortel.ca>

	* [include/windows.h][misc/main.c]
	Change SystemParameterInfo to support SPI_GETHIGHCONTRAST. Also
	include some missing SPI_ definitions.

	* [include/dsound.h][multimedia/dsound.c][relay32/dplayx.spec]
	Added stubs for DirectPlayLobbyCreate[AW]. Not sure if these
	should go into a new files dplayx.c? Anyone care?

	* [include/winnls.h]
	Added two missing flags for the CompareString32 functions.
diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c
new file mode 100644
index 0000000..910cf14
--- /dev/null
+++ b/tools/wrc/wrc.c
@@ -0,0 +1,492 @@
+/*
+ *
+ * Copyright  Martin von Loewis, 1994
+ * Copyrignt 1998 Bertho A. Stultiens (BS)
+ *
+ * 21-May-1998 BS	- Removed the CPP option. Its internal now.
+ *			- Added implementations for defines and includes
+ *			  on the commandline.
+ *
+ * 30-Apr-1998 BS	- The options now contain nearly the entire alphabet.
+ *			  Seems to be a sign for too much freedom. I implemeted
+ *			  most of them as a user choice possibility for things
+ *			  that I do not know what to put there by default.
+ *			- -l and -L options are now known as -t and -T.
+ *
+ * 23-Apr-1998 BS	- Finally gave up on backward compatibility on the
+ *			  commandline (after a blessing from the newsgroup).
+ *			  So, I changed the lot.
+ *
+ * 17-Apr-1998 BS	- Added many new command-line options but took care
+ *			  that it would not break old scripts (sigh).
+ *
+ * 16-Apr-1998 BS	- There is not much left of the original source...
+ *			  I had to rewrite most of it because the parser
+ *			  changed completely with all the types etc..
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include <config.h>
+#include "wrc.h"
+#include "utils.h"
+#include "writeres.h"
+#include "readres.h"
+#include "dumpres.h"
+#include "genres.h"
+#include "newstruc.h"
+#include "preproc.h"
+#include "parser.h"
+
+char usage[] = "Usage: wrc [options...] [infile[.rc|.res]]\n"
+	"   -a n        Alignment of resource (win16 only, default is 4)\n"
+	"   -b          Create a C array from a binary .res file\n"
+	"   -c          Add 'const' prefix to C constants\n"
+	"   -C cp       Set the resource's codepage to cp (default is 0)\n"
+	"   -d n        Set debug level to 'n'\n"
+	"   -D id[=val] Define preprocessor identifier id=val\n"
+	"   -e          Disable recognition of win32 keywords in 16bit compile\n"
+	"   -g          Add symbols to the global c namespace\n"
+	"   -h          Also generate a .h file\n"
+	"   -H file     Same as -h but written to file\n"
+	"   -I path     Set include search dir to path (multiple -I allowed)\n"
+	"   -l lan      Set default language to lan (default is neutral {0})\n"
+	"   -n          Do not generate .s file\n"
+	"   -o file     Output to file (default is infile.[res|s|h]\n"
+	"   -p prefix   Give a prefix for the generated names\n"
+	"   -r          Create binary .res file (compile only)\n"
+	"   -s          Add structure with win32/16 (PE/NE) resource directory\n"
+	"   -t          Generate indirect loadable resource tables\n"
+	"   -T          Generate only indirect loadable resources tables\n"
+	"   -V          Print version end exit\n"
+	"   -w 16|32    Select win16 or win32 output (default is win32)\n"
+	"   -W          Enable pedantic warnings\n"
+	"Input is taken from stdin if no sourcefile specified.\n"
+	"Debug level 'n' is a bitmask with following meaning:\n"
+	"    * 0x01 Tell which resource is parsed (verbose mode)\n"
+	"    * 0x02 Dump internal structures\n"
+	"    * 0x04 Create a parser trace (yydebug=1)\n"
+	"The -o option only applies to the final destination file, which is\n"
+	"in case of normal compile a .s file. You must use the '-H header.h'\n"
+	"option to override the header-filename.\n"
+	"If no input filename is given and the output name is not overridden\n"
+	"with -o and/or -H, then the output is written to \"wrc.tab.[sh]\"\n"
+	;
+
+char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
+			"Copyright 1998 Bertho A. Stultiens\n"
+			"          1994 Martin von Loewis\n";
+
+/*
+ * Default prefix for resource names used in the C array.
+ * Option '-p name' sets it to 'name'
+ */
+char *prefix = "_Resource";
+
+/*
+ * Set if compiling in 32bit mode (default).
+ */
+int win32 = 1;
+
+/*
+ * Set when generated C variables should be prefixed with 'const'
+ */
+int constant = 0;
+
+/*
+ * Create a .res file from the source and exit (-r option).
+ * The compiler actually always creates this file, and then
+ * converts it into whatever is requested. The compiler just
+ * stops after the res-file when create_res is set.
+ */
+int create_res = 0;
+
+/*
+ * debuglevel == DEBUGLEVEL_NONE	Don't bother
+ * debuglevel & DEBUGLEVEL_CHAT		Say whats done
+ * debuglevel & DEBUGLEVEL_DUMP		Dump internal structures
+ * debuglevel & DEBUGLEVEL_TRACE	Create parser trace
+ */
+int debuglevel = DEBUGLEVEL_NONE;
+
+/*
+ * Recognize win32 keywords if set (-w 32 enforces this),
+ * otherwise set with -e option.
+ */
+int extensions = 1;
+
+/*
+ * Set when creating C array from .res file (-b option).
+ */
+int binary = 0;
+
+/*
+ * Set when an additional C-header is to be created in compile (-h option).
+ */
+int create_header = 0;
+
+/*
+ * Set when the NE/PE resource directory should be dumped into
+ * the output file.
+ */
+int create_dir = 0;
+
+/*
+ * Set when all symbols should be added to the global namespace (-g option)
+ */
+int global = 0;
+
+/*
+ * Set when indirect loadable resource tables should be created (-t)
+ */
+int indirect = 0;
+
+/*
+ * Set when _only_ indirect loadable resource tables should be created (-T)
+ */
+int indirect_only = 0;
+
+/*
+ * NE segment resource aligment (-a option)
+ */
+int alignment = 4;
+int alignment_pwr;
+
+/*
+ * Cleared when the assembly file must be suppressed (-n option)
+ */
+int create_s = 1;
+
+/*
+ * Language setting for resources (-l option)
+ */
+language_t *currentlanguage = NULL;
+
+/*
+ * The codepage to write in win32 PE resource segment (-C option)
+ */
+DWORD codepage = 0;
+
+/*
+ * Set when extra warnings should be generated (-W option)
+ */
+int pedantic = 0;
+
+char *output_name;		/* The name given by the -o option */
+char *input_name;		/* The name given on the command-line */
+char *header_name;		/* The name given by the -H option */
+
+char *cmdline;			/* The entire commandline */
+
+resource_t *resource_top;	/* The top of the parsed resources */
+
+int getopt (int argc, char *const *argv, const char *optstring);
+
+int main(int argc,char *argv[])
+{
+	extern char* optarg;
+	extern int   optind;
+	int optc;
+	int lose = 0;
+	int ret;
+	int a;
+	int i;
+	int cmdlen;
+
+	/* First rebuild the commandline to put in destination */
+	/* Could be done through env[], but not all OS-es support it */
+	cmdlen = 4; /* for "wrc " */
+	for(i = 1; i < argc; i++)
+		cmdlen += strlen(argv[i]) + 1;
+	cmdline = (char *)xmalloc(cmdlen);
+	strcpy(cmdline, "wrc ");
+	for(i = 1; i < argc; i++)
+	{
+		strcat(cmdline, argv[i]);
+		if(i < argc-1)
+			strcat(cmdline, " ");
+	}
+
+	while((optc = getopt(argc, argv, "a:bcC:d:D:eghH:I:l:no:p:rstTVw:W")) != EOF)
+	{
+		switch(optc)
+		{
+		case 'a':
+			alignment = atoi(optarg);
+			break;
+		case 'b':
+			binary = 1;
+			break;
+		case 'c':
+			constant = 1;
+			break;
+		case 'C':
+			codepage = strtol(optarg, NULL, 0);
+			break;
+		case 'd':
+			debuglevel = strtol(optarg, NULL, 0);
+			break;
+		case 'D':
+			add_cmdline_define(optarg);
+			break;
+		case 'e':
+			extensions = 0;
+			break;
+		case 'g':
+			global = 1;
+			break;
+		case 'H':
+			header_name = strdup(optarg);
+			/* Fall through */
+		case 'h':
+			create_header = 1;
+			break;
+		case 'I':
+			add_include_path(optarg);
+			break;
+		case 'l':
+			{
+				int lan;
+				lan = strtol(optarg, NULL, 0);
+				currentlanguage = new_language(PRIMARYLANGID(lan), SUBLANGID(lan));
+			}
+			break;
+		case 'n':
+			create_s = 0;
+			break;
+		case 'o':
+			output_name = strdup(optarg);
+			break;
+		case 'p':
+			prefix = strdup(optarg);
+			break;
+		case 'r':
+			create_res = 1;
+			break;
+		case 's':
+			create_dir = 1;
+			break;
+		case 'T':
+			indirect_only = 1;
+			/* Fall through */
+		case 't':
+			indirect = 1;
+			break;
+		case 'V':
+			printf(version_string);
+			exit(0);
+			break;
+		case 'w':
+			if(!strcmp(optarg, "16"))
+				win32 = 0;
+			else if(!strcmp(optarg, "32"))
+				win32 = 1;
+			else
+				lose++;
+			break;
+		case 'W':
+			pedantic = 1;
+			break;
+		default:
+			lose++;
+			break;
+		}
+	}
+
+	if(lose)
+	{
+		fprintf(stderr, usage);
+		return 1;
+	}
+
+	/* Check the command line options for invalid combinations */
+	if(win32)
+	{
+		if(!extensions)
+		{
+			warning("Option -e ignored with 32bit compile\n");
+			extensions = 1;
+		}
+	}
+
+	if(create_res)
+	{
+		if(constant)
+		{
+			warning("Option -c ignored with compile to .res\n");
+			constant = 0;
+		}
+
+		if(create_header)
+		{
+			warning("Option -[h|H] ignored with compile to .res\n");
+			create_header = 0;
+		}
+
+		if(indirect)
+		{
+			warning("Option -l ignored with compile to .res\n");
+			indirect = 0;
+		}
+
+		if(indirect_only)
+		{
+			warning("Option -L ignored with compile to .res\n");
+			indirect_only = 0;
+		}
+
+		if(global)
+		{
+			warning("Option -g ignored with compile to .res\n");
+			global = 0;
+		}
+
+		if(create_dir)
+		{
+			error("Option -r and -s cannot be used together\n");
+		}
+
+		if(binary)
+		{
+			error("Option -r and -b cannot be used together\n");
+		}
+	}
+
+	/* Set alignment power */
+	a = alignment;
+	for(alignment_pwr = 0; alignment_pwr < 10 && a > 1; alignment_pwr++)
+	{
+		a >>= 1;
+	}
+	if(a != 1)
+	{
+		error("Alignment must be between 1 and 1024");
+	}
+	if((1 << alignment_pwr) != alignment)
+	{
+		error("Alignment must be a power of 2");
+	}
+
+	/* Kill io buffering when some kind of debuglevel is enabled */
+	if(debuglevel)
+	{
+		setbuf(stdout,0);
+		setbuf(stderr,0);
+	}
+
+	yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
+
+	/* Set the default defined stuff */
+	add_cmdline_define("RC_INVOKED=1");
+	add_cmdline_define("__WRC__=1");
+	if(win32)
+	{
+		add_cmdline_define("__WIN32__=1");
+		add_cmdline_define("__FLAT__=1");
+	}
+
+	/* Check if the user set a language, else set default */
+	if(!currentlanguage)
+		currentlanguage = new_language(0, 0);
+
+	/* Check for input file on command-line */
+	if(optind < argc)
+	{
+		input_name = argv[optind];
+		yyin = fopen(input_name, "rb");
+		if(!yyin)
+		{
+			error("Could not open %s\n", input_name);
+		}
+	}
+	else
+	{
+		yyin = stdin;
+	}
+
+	if(binary && !input_name)
+	{
+		error("Binary mode requires .res file as input");
+	}
+
+	if(!output_name)
+	{
+		output_name = dup_basename(input_name, binary ? ".res" : ".rc");
+		strcat(output_name, create_res ? ".res" : ".s");
+	}
+
+	if(!header_name && !create_res)
+	{
+		header_name = dup_basename(input_name, binary ? ".res" : ".rc");
+		strcat(header_name, ".h");
+	}
+
+	if(!binary)
+	{
+		/* Go from .rc to .res or .s */
+		chat("Starting parse");
+		ret = yyparse();
+
+		if(input_name)
+			fclose(yyin);
+
+		if(ret)
+		{
+			/* Error during parse */
+			exit(1);
+		}
+
+		if(debuglevel & DEBUGLEVEL_DUMP)
+			dump_resources(resource_top);
+
+		/* Convert the internal lists to binary data */
+		resources2res(resource_top);
+
+		if(create_res)
+		{
+			chat("Writing .res-file");
+			write_resfile(output_name, resource_top);
+		}
+		else
+		{
+			if(create_s)
+			{
+				chat("Writing .s-file");
+				write_s_file(output_name, resource_top);
+			}
+			if(create_header)
+			{
+				chat("Writing .h-file");
+				write_h_file(header_name, resource_top);
+			}
+		}
+
+	}
+	else
+	{
+		/* Go from .res to .s */
+		chat("Reading .res-file");
+		resource_top = read_resfile(input_name);
+		if(create_s)
+		{
+			chat("Writing .s-file");
+			write_s_file(output_name, resource_top);
+		}
+		if(create_header)
+		{
+			chat("Writing .h-file");
+			write_h_file(header_name, resource_top);
+		}
+	}
+
+	return 0;
+}
+
+
+
+