diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 8415d7c40a0..e37941fd751 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -385,6 +385,7 @@ dsound/libdsound.so: libwinmm.so libkernel32.so gdi/libgdi32.so: libkernel32.so icmp/libicmp.so: libkernel32.so imagehlp/libimagehlp.so: libkernel32.so +imm32/libimm32.so: libkernel32.so lzexpand/liblz32.so: libkernel32.so mpr/libmpr.so: libkernel32.so msacm/libmsacm32.so: libwinmm.so libkernel32.so @@ -393,14 +394,14 @@ ole32/libole32.so: libadvapi32.so libuser32.so libgdi32.so librpcrt4.so libkerne oleaut32/liboleaut32.so: libole32.so libgdi32.so libkernel32.so olecli/libolecli32.so: libole32.so libolesvr32.so libgdi32.so olepro32/libolepro32.so: liboleaut32.so -opengl32/libopengl32.so: libx11drv.so +opengl32/libopengl32.so: libx11drv.so libkernel32.so psapi/libpsapi.so: libkernel32.so richedit/libriched32.so: libuser32.so libkernel32.so serialui/libserialui.so: libuser32.so libadvapi32.so libkernel32.so -setupapi/libsetupapi.so: libkernel32.so +setupapi/libsetupapi.so: libadvapi32.so libkernel32.so shell32/libshell32.so: libole32.so libshlwapi.so libcomctl32.so libadvapi32.so libuser32.so libgdi32.so libkernel32.so shfolder/libshfolder.so: libshell32.so -shlwapi/libshlwapi.so: libadvapi32.so libuser32.so libkernel32.so +shlwapi/libshlwapi.so: libadvapi32.so libuser32.so libgdi32.so libkernel32.so tapi32/libtapi32.so: libkernel32.so ttydrv/libttydrv.so: libuser32.so libgdi32.so libkernel32.so urlmon/liburlmon.so: libole32.so diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c index 966adf574c9..20c2f788a80 100644 --- a/dlls/advapi32/advapi.c +++ b/dlls/advapi32/advapi.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "winbase.h" #include "windef.h" @@ -25,11 +26,9 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize ) size_t len; char *name; - name=getlogin(); -#if 0 - /* FIXME: should use getpwuid() here */ - if (!name) name=cuserid(NULL); -#endif + struct passwd *pwd = getpwuid( getuid() ); + if (!pwd) return 0; + name = pwd->pw_name; len = name ? strlen(name) : 0; if (!len || !lpSize || len > *lpSize) { if (lpszName) *lpszName = 0; diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 566c8c4516e..41265e8d303 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -476,8 +476,8 @@ HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsS icf.lQuality = aco->dwQuality; icf.lKeyRate = aco->dwKeyFrameEvery; - icf.GetData = (LONG (*)(LPARAM,LONG,LPVOID,LONG)) 0xdead4242; - icf.PutData = (LONG (*)(LPARAM,LONG,LPVOID,LONG)) 0xdead4243; + icf.GetData = (void *)0xdead4242; + icf.PutData = (void *)0xdead4243; ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf)); } return S_OK; diff --git a/dlls/commdlg/comdlg32.spec b/dlls/commdlg/comdlg32.spec index 60bf66eac64..b4cbeb5187b 100644 --- a/dlls/commdlg/comdlg32.spec +++ b/dlls/commdlg/comdlg32.spec @@ -10,6 +10,7 @@ import user32.dll import winspool.drv import gdi32.dll import kernel32.dll +import ntdll.dll 0 stub ArrowBtnWndProc 1 stdcall ChooseColorA(ptr) ChooseColorA diff --git a/dlls/crtdll/crtdll_main.c b/dlls/crtdll/crtdll_main.c index 85d6509387b..993669d0b50 100644 --- a/dlls/crtdll/crtdll_main.c +++ b/dlls/crtdll/crtdll_main.c @@ -100,6 +100,7 @@ typedef VOID (*new_handler_type)(VOID); static new_handler_type new_handler; CRTDLL_FILE * __cdecl CRTDLL__fdopen(INT handle, LPCSTR mode); +INT __cdecl CRTDLL_fgetc( CRTDLL_FILE *file ); /********************************************************************* * CRTDLL_MainInit (CRTDLL.init) @@ -116,6 +117,24 @@ BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } +/********************************************************************* + * malloc (CRTDLL.427) + */ +VOID* __cdecl CRTDLL_malloc(DWORD size) +{ + return HeapAlloc(GetProcessHeap(),0,size); +} + +/********************************************************************* + * _strdup (CRTDLL.285) + */ +LPSTR __cdecl CRTDLL__strdup(LPCSTR ptr) +{ + LPSTR ret = CRTDLL_malloc(strlen(ptr)+1); + if (ret) strcpy( ret, ptr ); + return ret; +} + /********************************************************************* * _GetMainArgs (CRTDLL.022) */ @@ -134,8 +153,7 @@ LPSTR * __cdecl CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv, if (CRTDLL_acmdln_dll != NULL) HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll); - CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0, - GetCommandLineA() ); + CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() ); TRACE("got '%s'\n", cmdline); version = GetVersion(); @@ -166,8 +184,7 @@ LPSTR * __cdecl CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv, sizeof(char*)*(xargc+1)); if (strlen(cmdline+afterlastspace)) { - xargv[xargc] = HEAP_strdupA( GetProcessHeap(), 0, - cmdline+afterlastspace); + xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace); xargc++; if (!last_arg) /* need to seek to the next arg ? */ { @@ -865,15 +882,6 @@ INT __cdecl CRTDLL_rand() } -/********************************************************************* - * putchar (CRTDLL.442) - */ -void __cdecl CRTDLL_putchar( INT x ) -{ - putchar(x); -} - - /********************************************************************* * fputc (CRTDLL.374) */ @@ -887,6 +895,15 @@ INT __cdecl CRTDLL_fputc( INT c, CRTDLL_FILE *file ) } +/********************************************************************* + * putchar (CRTDLL.442) + */ +void __cdecl CRTDLL_putchar( INT x ) +{ + CRTDLL_fputc( x, CRTDLL_stdout ); +} + + /********************************************************************* * fputs (CRTDLL.375) */ @@ -905,7 +922,7 @@ INT __cdecl CRTDLL_fputs( LPCSTR s, CRTDLL_FILE *file ) INT __cdecl CRTDLL_puts(LPCSTR s) { TRACE("%s \n",s); - return puts(s); + return CRTDLL_fputs(s, CRTDLL_stdout); } @@ -981,7 +998,7 @@ LPSTR __cdecl CRTDLL_gets(LPSTR buf) * windows95's ftp.exe. */ - for(cc = fgetc(stdin); cc != EOF && cc != '\n'; cc = fgetc(stdin)) + for(cc = CRTDLL_fgetc(CRTDLL_stdin); cc != EOF && cc != '\n'; cc = CRTDLL_fgetc(CRTDLL_stdin)) if(cc != '\r') *buf++ = (char)cc; *buf = '\0'; @@ -1098,14 +1115,6 @@ VOID __cdecl CRTDLL_longjmp(jmp_buf env, int val) longjmp(env, val); } -/********************************************************************* - * malloc (CRTDLL.427) - */ -VOID* __cdecl CRTDLL_malloc(DWORD size) -{ - return HeapAlloc(GetProcessHeap(),0,size); -} - /********************************************************************* * new (CRTDLL.001) */ @@ -1159,14 +1168,6 @@ VOID __cdecl CRTDLL_delete(VOID* ptr) HeapFree(GetProcessHeap(),0,ptr); } -/********************************************************************* - * _strdup (CRTDLL.285) - */ -LPSTR __cdecl CRTDLL__strdup(LPCSTR ptr) -{ - return HEAP_strdupA(GetProcessHeap(),0,ptr); -} - /********************************************************************* * fclose (CRTDLL.362) */ @@ -1659,7 +1660,27 @@ LPINT __cdecl CRTDLL__errno() static int crtdllerrno; /* FIXME: we should set the error at the failing function call time */ - crtdllerrno = LastErrorToErrno(GetLastError()); + + switch(GetLastError()) + { + case ERROR_ACCESS_DENIED: crtdllerrno = EPERM; break; + case ERROR_FILE_NOT_FOUND: crtdllerrno = ENOENT; break; + case ERROR_INVALID_PARAMETER: crtdllerrno = EINVAL; break; + case ERROR_IO_DEVICE: crtdllerrno = EIO; break; + case ERROR_BAD_FORMAT: crtdllerrno = ENOEXEC; break; + case ERROR_INVALID_HANDLE: crtdllerrno = EBADF; break; + case ERROR_OUTOFMEMORY: crtdllerrno = ENOMEM; break; + case ERROR_BUSY: crtdllerrno = EBUSY; break; + case ERROR_FILE_EXISTS: crtdllerrno = EEXIST; break; + case ERROR_BAD_DEVICE: crtdllerrno = ENODEV; break; + case ERROR_TOO_MANY_OPEN_FILES: crtdllerrno = EMFILE; break; + case ERROR_DISK_FULL: crtdllerrno = ENOSPC; break; + case ERROR_SEEK_ON_DEVICE: crtdllerrno = ESPIPE; break; + case ERROR_BROKEN_PIPE: crtdllerrno = EPIPE; break; + case ERROR_POSSIBLE_DEADLOCK: crtdllerrno = EDEADLK; break; + case ERROR_FILENAME_EXCED_RANGE: crtdllerrno = ENAMETOOLONG; break; + case ERROR_DIR_NOT_EMPTY: crtdllerrno = ENOTEMPTY; break; + } return &crtdllerrno; } diff --git a/dlls/crtdll/wcstring.c b/dlls/crtdll/wcstring.c index 877e4b99f5d..cbc480526d6 100644 --- a/dlls/crtdll/wcstring.c +++ b/dlls/crtdll/wcstring.c @@ -11,6 +11,7 @@ #include #include "windef.h" +#include "winbase.h" #include "winnls.h" #include "wine/unicode.h" #include "crtdll.h" @@ -114,7 +115,7 @@ LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept ) */ INT __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch ) { - return WideCharToMultiByte( CP_ACP, 0, ch, 1, dst, 6, NULL, NULL ); + return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL ); } /********************************************************************* diff --git a/dlls/imm32/Makefile.in b/dlls/imm32/Makefile.in index 7b252f5189c..65028e6ce60 100644 --- a/dlls/imm32/Makefile.in +++ b/dlls/imm32/Makefile.in @@ -4,6 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = imm32 SOVERSION = 1.0 +IMPORTS = kernel32 C_SRCS = \ imm.c diff --git a/dlls/imm32/imm32.spec b/dlls/imm32/imm32.spec index af03d3e272b..f008bfe6b2c 100644 --- a/dlls/imm32/imm32.spec +++ b/dlls/imm32/imm32.spec @@ -1,6 +1,8 @@ name imm32 type win32 +import kernel32.dll + @ stdcall ImmAssociateContext(long long) ImmAssociateContext @ stdcall ImmConfigureIMEA(long long long ptr) ImmConfigureIMEA @ stdcall ImmConfigureIMEW(long long long ptr) ImmConfigureIMEW diff --git a/dlls/kernel/wowthunk.c b/dlls/kernel/wowthunk.c index 18dd9ed973c..ff622d7a125 100644 --- a/dlls/kernel/wowthunk.c +++ b/dlls/kernel/wowthunk.c @@ -7,15 +7,15 @@ #include "wine/winbase16.h" #include "winbase.h" #include "wownt32.h" +#include "file.h" #include "heap.h" #include "miscemu.h" #include "syslevel.h" #include "stackframe.h" #include "builtin16.h" #include "debugtools.h" -#include "file.h" -DEFAULT_DEBUG_CHANNEL(thunk) +DEFAULT_DEBUG_CHANNEL(thunk); /* * 32-bit WOW routines (in WOW32, but actually forwarded to KERNEL32) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index b5da7bf3118..f6514f3f300 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -21,7 +21,6 @@ #include "wownt32.h" #include "ole2ver.h" #include "debugtools.h" -#include "file.h" #include "heap.h" #include "ldt.h" #include "winreg.h" @@ -1492,11 +1491,10 @@ void WINAPI CoFreeUnusedLibraries(void) * RETURNS * the current system time in lpFileTime */ -HRESULT WINAPI CoFileTimeNow( - FILETIME *lpFileTime /* [out] the current time */ -) { - DOSFS_UnixTimeToFileTime(time(NULL), lpFileTime, 0); - return S_OK; +HRESULT WINAPI CoFileTimeNow( FILETIME *lpFileTime ) /* [out] the current time */ +{ + GetSystemTimeAsFileTime( lpFileTime ); + return S_OK; } /*********************************************************************** diff --git a/dlls/opengl32/Makefile.in b/dlls/opengl32/Makefile.in index d2d1530958a..58f73575279 100644 --- a/dlls/opengl32/Makefile.in +++ b/dlls/opengl32/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = opengl32 SOVERSION = 1.0 -IMPORTS = x11drv +IMPORTS = x11drv kernel32 C_SRCS = \ wgl.c \ diff --git a/dlls/opengl32/opengl32.spec b/dlls/opengl32/opengl32.spec index 7ec0b469bb1..3ec44fe3e07 100644 --- a/dlls/opengl32/opengl32.spec +++ b/dlls/opengl32/opengl32.spec @@ -1,8 +1,9 @@ - name opengl32 type win32 init OpenGL32_Init + import x11drv +import kernel32 @ stdcall wglCreateContext(long) wglCreateContext @ stdcall wglCreateLayerContext(long long) wglCreateLayerContext diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in index b850029945e..6efa6dc4647 100644 --- a/dlls/setupapi/Makefile.in +++ b/dlls/setupapi/Makefile.in @@ -5,7 +5,7 @@ VPATH = @srcdir@ MODULE = setupapi SOVERSION = 1.0 ALTNAMES = setupx -IMPORTS = kernel32 +IMPORTS = advapi32 kernel32 C_SRCS = \ setupx_main.c \ diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index 4b5cf0921aa..c38a8358c42 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -1,6 +1,7 @@ name setupapi type win32 +import advapi32.dll import kernel32.dll # almost all functions are commented out for now. Ordinals are from setupapi.dll 4.0 diff --git a/dlls/shlwapi/Makefile.in b/dlls/shlwapi/Makefile.in index 394227bc56c..8978b8fc22a 100644 --- a/dlls/shlwapi/Makefile.in +++ b/dlls/shlwapi/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = shlwapi SOVERSION = 1.0 -IMPORTS = advapi32 user32 kernel32 +IMPORTS = advapi32 user32 gdi32 kernel32 C_SRCS = \ ordinal.c \ diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 4ee8bb7a732..4ead3468af6 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -4,6 +4,7 @@ init SHLWAPI_LibMain import advapi32 import user32 +import gdi32 import kernel32 1 stdcall @(ptr ptr) SHLWAPI_1 @@ -614,7 +615,7 @@ import kernel32 @ stdcall StrCSpnW (wstr wstr) StrCSpnW @ stdcall StrCatBuffA (str str long) StrCatBuffA @ stdcall StrCatBuffW (wstr wstr long) StrCatBuffW -@ stub StrCatW +@ stdcall StrCatW (ptr wstr) StrCatW @ stdcall StrChrA (str long) StrChrA @ stub StrChrIA @ stub StrChrIW @@ -626,7 +627,7 @@ import kernel32 @ stdcall StrCmpNW (wstr wstr long) StrCmpNW @ stdcall StrCmpW (wstr wstr) lstrcmpW @ stdcall StrCpyNW (ptr wstr long) lstrcpynW -@ stdcall StrCpyW (ptr wstr) lstrcpyW +@ stdcall StrCpyW (ptr wstr) StrCpyW @ stdcall StrDupA (str) StrDupA @ stdcall StrDupW (wstr) StrDupW @ stdcall StrFormatByteSizeA(long str long) StrFormatByteSizeA diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index c5b404c660c..8becbd43f59 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -66,6 +66,24 @@ int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len) return strncmpiW(wstr1, wstr2, len); } +/************************************************************************* + * StrCatW [SHLWAPI] + */ +LPWSTR WINAPI StrCatW( LPWSTR wstr1, LPCWSTR wstr2 ) +{ + return strcatW( wstr1, wstr2 ); +} + + +/************************************************************************* + * StrCpyW [SHLWAPI] + */ +LPWSTR WINAPI StrCpyW( LPWSTR wstr1, LPCWSTR wstr2 ) +{ + return strcpyW( wstr1, wstr2 ); +} + + /************************************************************************* * StrStrA [SHLWAPI] */ @@ -174,7 +192,7 @@ LPWSTR WINAPI StrDupW (LPCWSTR lpSrc) TRACE("%s\n", debugstr_w(lpSrc)); - if (lpDest) lstrcpyW(lpDest, lpSrc); + if (lpDest) strcpyW(lpDest, lpSrc); return lpDest; } diff --git a/files/dos_fs.c b/files/dos_fs.c index 7b259463baf..e6e76cd2145 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -25,6 +25,7 @@ #include "wingdi.h" #include "winuser.h" #include "wine/winbase16.h" +#include "wine/unicode.h" #include "winerror.h" #include "drive.h" #include "file.h" @@ -966,7 +967,7 @@ DWORD WINAPI GetShortPathNameA( LPCSTR longpath, LPSTR shortpath, /* Check if the file exists and use the existing file name */ if ( DOSFS_GetFullName ( tmpshortpath, TRUE, &full_name ) ) { - lstrcpyA ( tmpshortpath+sp, strrchr ( full_name.short_name, '\\' ) + 1 ); + strcpy( tmpshortpath+sp, strrchr ( full_name.short_name, '\\' ) + 1 ); sp += strlen ( tmpshortpath+sp ); lp += tmplen; continue; @@ -1266,7 +1267,7 @@ DWORD WINAPI GetFullPathNameW( LPCWSTR name, DWORD len, LPWSTR buffer, HeapFree( GetProcessHeap(), 0, nameA ); if (ret && (ret<=len) && buffer && lastpart) { - LPWSTR p = buffer + lstrlenW(buffer); + LPWSTR p = buffer + strlenW(buffer); if (*p != (WCHAR)'\\') { while ((p > buffer + 2) && (*p != (WCHAR)'\\')) p--; @@ -1295,9 +1296,9 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAA *entry ) { if (info->cur_pos) return 0; entry->dwFileAttributes = FILE_ATTRIBUTE_LABEL; - DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftCreationTime, 0 ); - DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftLastAccessTime, 0 ); - DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftLastWriteTime, 0 ); + RtlSecondsSince1970ToTime( (time_t)0, &entry->ftCreationTime ); + RtlSecondsSince1970ToTime( (time_t)0, &entry->ftLastAccessTime ); + RtlSecondsSince1970ToTime( (time_t)0, &entry->ftLastWriteTime ); entry->nFileSizeHigh = 0; entry->nFileSizeLow = 0; entry->dwReserved0 = 0; @@ -1932,7 +1933,7 @@ BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft) newtm.tm_mday = (fatdate & 0x1f); newtm.tm_mon = ((fatdate >> 5) & 0x0f) - 1; newtm.tm_year = (fatdate >> 9) + 80; - DOSFS_UnixTimeToFileTime( mktime( &newtm ), ft, 0 ); + RtlSecondsSince1970ToTime( mktime( &newtm ), ft ); return TRUE; } diff --git a/files/file.c b/files/file.c index 3ab0cf780da..e85f4b3b97a 100644 --- a/files/file.c +++ b/files/file.c @@ -526,9 +526,9 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info ) if (!(st->st_mode & S_IWUSR)) info->dwFileAttributes |= FILE_ATTRIBUTE_READONLY; - DOSFS_UnixTimeToFileTime( st->st_mtime, &info->ftCreationTime, 0 ); - DOSFS_UnixTimeToFileTime( st->st_mtime, &info->ftLastWriteTime, 0 ); - DOSFS_UnixTimeToFileTime( st->st_atime, &info->ftLastAccessTime, 0 ); + RtlSecondsSince1970ToTime( st->st_mtime, &info->ftCreationTime ); + RtlSecondsSince1970ToTime( st->st_mtime, &info->ftLastWriteTime ); + RtlSecondsSince1970ToTime( st->st_atime, &info->ftLastAccessTime ); info->dwVolumeSerialNumber = 0; /* FIXME */ info->nFileSizeHigh = 0; @@ -571,9 +571,9 @@ DWORD WINAPI GetFileInformationByHandle( HANDLE hFile, if (!info) return 0; req->handle = hFile; if (server_call( REQ_GET_FILE_INFO )) return 0; - DOSFS_UnixTimeToFileTime( req->write_time, &info->ftCreationTime, 0 ); - DOSFS_UnixTimeToFileTime( req->write_time, &info->ftLastWriteTime, 0 ); - DOSFS_UnixTimeToFileTime( req->access_time, &info->ftLastAccessTime, 0 ); + RtlSecondsSince1970ToTime( req->write_time, &info->ftCreationTime ); + RtlSecondsSince1970ToTime( req->write_time, &info->ftLastWriteTime ); + RtlSecondsSince1970ToTime( req->access_time, &info->ftLastAccessTime ); info->dwFileAttributes = req->attr; info->dwVolumeSerialNumber = req->serial; info->nFileSizeHigh = req->size_high; diff --git a/win32/Makefile.in b/win32/Makefile.in index 2ad0c53c02d..0e66230979d 100644 --- a/win32/Makefile.in +++ b/win32/Makefile.in @@ -8,7 +8,6 @@ MODULE = win32 C_SRCS = \ console.c \ device.c \ - error.c \ except.c \ file.c \ init.c \ diff --git a/win32/error.c b/win32/error.c deleted file mode 100644 index 42324c9b2e8..00000000000 --- a/win32/error.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Win32 kernel functions - * - * Copyright 1995 Martin von Loewis and Cameron Heide - */ - -#include -#include "windef.h" -#include "winerror.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 err; - 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].err != -1) - { - if(errno_xlat_table[i].err == 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].err != -1) - { - if(errno_xlat_table[i].win32err == lasterror ) - { - rc = errno_xlat_table[i].err; - break; - } - i++; - } - return rc; -} diff --git a/win32/file.c b/win32/file.c index 07702a5f9c3..4d72eeb3c86 100644 --- a/win32/file.c +++ b/win32/file.c @@ -27,9 +27,7 @@ #include "heap.h" #include "debugtools.h" -DEFAULT_DEBUG_CHANNEL(file) - -DWORD ErrnoToLastError(int errno_num); +DEFAULT_DEBUG_CHANNEL(file); /*********************************************************************** * ReadFileEx (KERNEL32.) @@ -74,7 +72,7 @@ BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes) } if(stat(full_name.long_name,&buf)==-1) { - SetLastError(ErrnoToLastError(errno)); + FILE_SetDosError(); return FALSE; } if (attributes & FILE_ATTRIBUTE_READONLY) @@ -100,8 +98,8 @@ BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes) lpFileName,attributes); if (-1==chmod(full_name.long_name,buf.st_mode)) { + FILE_SetDosError(); MESSAGE("Wine ERROR: Couldn't set file attributes for existing file \"%s\". Check permissions !\n", full_name.long_name); - SetLastError(ErrnoToLastError(errno)); return FALSE; } return TRUE;