wine/win32/error.c
Alexandre Julliard 349a95315b Release 970202
Sun Feb  2 12:31:03 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [files/drive.c]
	Fixed SetCurrentDirectory() to also change the current drive.

	* [win32/except.c] [tools/build.c]
	Use Win32 register functions to implement exception handling.
	Fixed UnhandledExceptionFilter.

Fri Jan 31 15:42:41  1997  David Faure  <david.faure@ihamy.insa-lyon.fr>

	* [windows/keyboard.c]
	Added KEYBOARD_GenerateMsg to generate Caps Lock and NumLock events
	Added calls to KEYBOARD_GenerateMsg when the key is pressed/released
	or when the state has changed, out of wine.
	Changed type 3-state 'ToggleKeyState' to boolean. The On/Off is given
	by InputKeyStateTable.

Wed Jan 29 21:53:04 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [loader/*resource.c][if1632/thunk.c]
	EnumResource* added.

	* [loader/pe_resource.] [loader/resource.c]
	SizeofResource32(), LoadAccelerators32() added.

	* [misc/lstr.c]
	FormatMessage %n added.

	* [misc/crtdll.c][include/ctrdll.h][if1632/crtdll.spec]
	_chdrive,_errno,_isctype added.

	* [misc/cpu.c]
	Replaced runtime_cpu by GetSystemInfo().

	* [windows/hook.c][include/hook.h]
	Fixed mapping of hooks to win32/unicode.

	* [windows/keyboard.c] [windows/defwnd.c]
	Updated to win32 standard.
	ALT-<Menukey> fixed.

	* [windows/queue.c]
	GetWindowThreadProcessId() implemented.

Mon Jan 27 16:42:49 1997  John Harvey <john@division.co.uk>

	* [graphics/metafiledrv/*] [graphics/x11drv/*]
	  [objects/bitmap.c] [objects/brush.c] [objects/font.c]
	  [objects/gdiobj.c] [objects/pen.c]
	Moved SelectObject to graphics drivers. Printer support now works
	in a few cases but is definitely not complete. Generic/text driver
	works. The postscript driver works if true type fonts are disabled
	from the control panel. To enable printer support add Printer=on
	to the wine section of your wine.conf file. This causes write not
	to work properly. I know that several other printer drivers do not
	work.

	* [tools/build.c]
	Make .stabs not used for svr4 since it doesn't use GNU assembler.

	* [misc/fontengine.c]
	Make sure a printf doesn't crash the system.

Sat Jan 25 15:53:35 1997  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [objects/metafile.c]
	Fixed some problems with PlayMetaFileRecord().

	* [objects/dc.c]
	hClipRgn gets initialized in GetDCState().

Fri Jan 24 21:22:26 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [debugger/stabs.c]
	Handle file names beginning with '/'.

Fri Jan 24 18:33:04 1997  Robert Pouliot <krynos@clic.net>

	* [*/*]
	Some more patches for OS/2 support.

Fri Jan 24 11:30:41 1997  Bang Jun-Young  <bangjy@nownuri.nowcom.co.kr>

	* [resources/sysres_Ko.rc]
	Updated support for Korean (Ko) language.
1997-02-02 19:01:52 +00:00

128 lines
3.2 KiB
C

/*
* Win32 kernel functions
*
* Copyright 1995 Martin von Loewis and Cameron Heide
*/
#include <stdio.h>
#include <errno.h>
#include "windows.h"
#include "winerror.h"
#include "stddebug.h"
#include "debug.h"
/* The errno_xlat_table contains the errno-to-Win32 error
* mapping. Since this is a single table, it can't easily
* take into account function-specific differences, so there
* will probably be quite a few points where we don't exactly
* match what NT would return. Then again, neither does
* Windows 95. :-)
*/
typedef struct {
int errno;
DWORD win32err;
} ERRNO_XLAT_TABLE;
/* The table looks pretty ugly due to the preprocessor stuff,
* but I honestly have no idea how many of these values are
* portable. I'm not even sure how many of them are even
* used at all. :-)
*/
static ERRNO_XLAT_TABLE errno_xlat_table[] = {
#if defined(EPERM)
{ EPERM, ERROR_ACCESS_DENIED },
#endif
#if defined(ENOENT)
{ ENOENT, ERROR_FILE_NOT_FOUND },
#endif
#if defined(ESRCH)
{ ESRCH, ERROR_INVALID_PARAMETER },
#endif
#if defined(EIO)
{ EIO, ERROR_IO_DEVICE },
#endif
#if defined(ENOEXEC)
{ ENOEXEC, ERROR_BAD_FORMAT },
#endif
#if defined(EBADF)
{ EBADF, ERROR_INVALID_HANDLE },
#endif
#if defined(ENOMEM)
{ ENOMEM, ERROR_OUTOFMEMORY },
#endif
#if defined(EACCES)
{ EACCES, ERROR_ACCESS_DENIED },
#endif
#if defined(EBUSY)
{ EBUSY, ERROR_BUSY },
#endif
#if defined(EEXIST)
{ EEXIST, ERROR_FILE_EXISTS },
#endif
#if defined(ENODEV)
{ ENODEV, ERROR_BAD_DEVICE },
#endif
#if defined(EINVAL)
{ EINVAL, ERROR_INVALID_PARAMETER },
#endif
#if defined(EMFILE)
{ EMFILE, ERROR_TOO_MANY_OPEN_FILES },
#endif
#if defined(ETXTBSY)
{ ETXTBSY, ERROR_BUSY, },
#endif
#if defined(ENOSPC)
{ ENOSPC, ERROR_DISK_FULL },
#endif
#if defined(ESPIPE)
{ ESPIPE, ERROR_SEEK_ON_DEVICE },
#endif
#if defined(EPIPE)
{ EPIPE, ERROR_BROKEN_PIPE },
#endif
#if defined(EDEADLK)
{ EDEADLK, ERROR_POSSIBLE_DEADLOCK },
#endif
#if defined(ENAMETOOLONG)
{ ENAMETOOLONG, ERROR_FILENAME_EXCED_RANGE },
#endif
#if defined(ENOTEMPTY)
{ ENOTEMPTY, ERROR_DIR_NOT_EMPTY },
#endif
{ -1, 0 }
};
DWORD ErrnoToLastError(int errno_num)
{
DWORD rc = ERROR_UNKNOWN;
int i = 0;
while(errno_xlat_table[i].errno != -1)
{
if(errno_xlat_table[i].errno == errno_num)
{
rc = errno_xlat_table[i].win32err;
break;
}
i++;
}
return rc;
}
int LastErrorToErrno(DWORD lasterror)
{
int rc = 0; /* no error */
int i = 0;
while(errno_xlat_table[i].errno != -1)
{
if(errno_xlat_table[i].win32err == lasterror )
{
rc = errno_xlat_table[i].errno;
break;
}
i++;
}
return rc;
}