
Sat Aug 24 13:57:01 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/scroll.c] Renamed SCROLLINFO to SCROLLBAR_INFO to avoid conflict with Win32. * [graphics/driver.c] [include/x11drv.h] New files for graphics driver handling. * [if1632/relay.c] [include/registers.h] [tools/build.c] Implemented Win32 register functions. Not really tested yet. * [include/gdi.h] Added a lot of functions to the DC func table. * [loader/pe_image.c] Initialise %fs before calling out to 32-bit code. * [windows/hook.c] Fixed bug in HOOK_GetHook(). * [windows/win.c] Fixed FindWindow to return an error if the class name doesn't exist. Wed Aug 21 15:15:53 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [if1632/Makefile.in] [misc/mpr.c] [if1632/mpr.spec] mpr.dll specs added. * [if1632/kernel32.spec] [win32/newfns.c] [memory/global.c] QueryPerformanceCounter(), GlobalMemoryStatus() added. * [if1632/user32.spec] [win32/error.c] SetLastErrorEx() added. * [misc/commdlg.c] lpstrFilter might be NULL in FILE_WMInitDialog (NS 3.0 setup). * [misc/registry.c] Some missing NULL ptr checks added, misc clean up. Tue Aug 20 21:00:00 1996 Alex Korobka <alex@pharm.sunysb.edu> * [controls/menu.c] Adjust popup menu coordinates so that it always stays within the desktop. * [misc/main.c] Fixed GetEnvironment() return value for lpEnv == NULL case. Mon Aug 19 22:48:36 1996 Jukka Iivonen <iivonen@cc.helsinki.fi> * [misc/crtdll.c] [if1632/crtdll.spec] Added some is* functions, strlen and tolower. Mon Aug 19 13:33:13 1996 Stephen Simmons <ssimmons@vitsemi.com> * [tools/wineconf] New perl script to generate the wine.conf file. Fri Aug 16 15:31:44 1996 John Harvey <john@division.co.uk> * [if1632/gdi.spec] Lots of printer functions. * [include/callback.h] New functions for printer driver support. * [include/gdi.h] New/changed structures to support printer driver. * [misc/escape.c] New version that uses function table in DC structure. * [objects/dc.c] CreateDC copes with things other than Display. X code for CreateDC moved to graphics/x11drv directory. CreateCompatibleDC copies func table from original DC. * [objects/font.c] GetTextExtentPoint32A,GetTextMetrics16 use function table in DC and code moved to drivers directory. * [misc/printdrv.c] [graphics/*/*] [include/win16drv.h] New files for printer support. Fri Aug 16 12:33:00 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu> * [controls/scroll.c] Added SetScrollInfo32 and GetScrollInfo32. These just call existing code. There are a few options in which I'm probably the wrong person for the job (page size and disable bar). There are comments in the code as to what they should do. * [objects/gdiobj.c] [objects/font.c] [include/font.h] Added 32 bit version of FONT_GetObject.
144 lines
3.8 KiB
C
144 lines
3.8 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"
|
|
|
|
/* WIN32_LastError contains the last error that occurred in the
|
|
* Win32 API. This value should be stored separately for each
|
|
* thread, when we eventually get thread support.
|
|
*/
|
|
static int WIN32_LastError;
|
|
|
|
/* 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 }
|
|
};
|
|
|
|
/**********************************************************************
|
|
* GetLastError (KERNEL32.227)
|
|
*/
|
|
DWORD GetLastError(void)
|
|
{
|
|
return WIN32_LastError;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* SetLastError (KERNEL32.497)
|
|
*
|
|
* This is probably not used by apps too much, but it's useful for
|
|
* our own internal use.
|
|
*/
|
|
void SetLastError(DWORD error)
|
|
{
|
|
WIN32_LastError = error;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* SetLastErrorEx (USER32.484)
|
|
*/
|
|
void SetLastErrorEx(DWORD error,DWORD type) {
|
|
WIN32_LastError = error;
|
|
}
|
|
|
|
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;
|
|
}
|