Fixed HANDLE<->HFILE conversions, since they will be different types
when handles are void*.
diff --git a/dlls/gdi/enhmfdrv/enhmetafiledrv.h b/dlls/gdi/enhmfdrv/enhmetafiledrv.h
index ab2ef54..28d1f8c 100644
--- a/dlls/gdi/enhmfdrv/enhmetafiledrv.h
+++ b/dlls/gdi/enhmfdrv/enhmetafiledrv.h
@@ -33,7 +33,7 @@
DC *dc;
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
UINT nextHandle; /* Next handle number */
- HFILE hFile; /* HFILE for disk based MetaFile */
+ HANDLE hFile; /* Handle for disk based MetaFile */
} EMFDRV_PDEVICE;
@@ -139,4 +139,3 @@
#endif /* __WINE_METAFILEDRV_H */
-
diff --git a/dlls/gdi/enhmfdrv/init.c b/dlls/gdi/enhmfdrv/init.c
index 42653ab..c44f0d4 100644
--- a/dlls/gdi/enhmfdrv/init.c
+++ b/dlls/gdi/enhmfdrv/init.c
@@ -277,7 +277,7 @@
DC *dc;
HDC hRefDC = hdc ? hdc : CreateDCA("DISPLAY",NULL,NULL,NULL); /* If no ref, use current display */
EMFDRV_PDEVICE *physDev;
- HFILE hFile;
+ HANDLE hFile;
DWORD size = 0, length = 0;
TRACE("%s\n", debugstr_w(filename) );
diff --git a/dlls/gdi/mfdrv/init.c b/dlls/gdi/mfdrv/init.c
index b67d505..8a4d438 100644
--- a/dlls/gdi/mfdrv/init.c
+++ b/dlls/gdi/mfdrv/init.c
@@ -219,7 +219,7 @@
HDC ret;
DC *dc;
METAFILEDRV_PDEVICE *physDev;
- HFILE hFile;
+ HANDLE hFile;
TRACE("'%s'\n", filename );
diff --git a/dlls/gdi/mfdrv/metafiledrv.h b/dlls/gdi/mfdrv/metafiledrv.h
index caca363..7cc904e 100644
--- a/dlls/gdi/mfdrv/metafiledrv.h
+++ b/dlls/gdi/mfdrv/metafiledrv.h
@@ -33,7 +33,7 @@
DC *dc;
METAHEADER *mh; /* Pointer to metafile header */
UINT nextHandle; /* Next handle number */
- HFILE hFile; /* HFILE for disk based MetaFile */
+ HANDLE hFile; /* Handle for disk based MetaFile */
} METAFILEDRV_PDEVICE;
@@ -152,4 +152,3 @@
extern BOOL MFDRV_WidenPath( PHYSDEV dev );
#endif /* __WINE_METAFILEDRV_H */
-
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 20550f1..65028db 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2044,7 +2044,7 @@
{
int ret = TYPE_E_CANTLOADLIBRARY;
DWORD dwSignature = 0;
- HFILE hFile;
+ HANDLE hFile;
TRACE_(typelib)("%s:%d\n", debugstr_w(pszFileName), index);
diff --git a/dlls/user/exticon.c b/dlls/user/exticon.c
index 8200c0d..bcc7063 100644
--- a/dlls/user/exticon.c
+++ b/dlls/user/exticon.c
@@ -251,7 +251,7 @@
HGLOBAL hRet = E_FAIL;
LPBYTE pData;
DWORD sig;
- HFILE hFile;
+ HANDLE hFile;
UINT16 iconDirCount = 0,iconCount = 0;
LPBYTE peimage;
HANDLE fmapping;
@@ -676,4 +676,3 @@
HeapFree(GetProcessHeap(), 0, lpwstrFile);
return ret;
}
-
diff --git a/dlls/winedos/module.c b/dlls/winedos/module.c
index d2b8a58..b55d50b 100644
--- a/dlls/winedos/module.c
+++ b/dlls/winedos/module.c
@@ -342,7 +342,7 @@
* (i.e. one DOS app spawning another) */
/* FIXME: do we want to check binary type first, to check
* whether it's a NE/PE executable? */
- HFILE hFile = CreateFileA( filename, GENERIC_READ, FILE_SHARE_READ,
+ HANDLE hFile = CreateFileA( filename, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, 0);
BOOL ret = FALSE;
if (hFile == INVALID_HANDLE_VALUE) return FALSE;
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 0ed17de..da71ae2 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -684,7 +684,7 @@
*/
const DOS_DEVICE *DOSFS_GetDevice( const char *name )
{
- int i;
+ unsigned int i;
const char *p;
if (!name) return NULL; /* if FILE_DupUnixHandle was used */
@@ -707,7 +707,7 @@
/***********************************************************************
* DOSFS_GetDeviceByHandle
*/
-const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile )
+const DOS_DEVICE *DOSFS_GetDeviceByHandle( HANDLE hFile )
{
const DOS_DEVICE *ret = NULL;
SERVER_START_REQ( get_file_info )
@@ -769,7 +769,7 @@
*/
HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa )
{
- int i;
+ unsigned int i;
const char *p;
HANDLE handle;
diff --git a/files/file.c b/files/file.c
index b1a5961..05f971a 100644
--- a/files/file.c
+++ b/files/file.c
@@ -936,8 +936,8 @@
{
do
{
- HFILE handle = CreateFileA( buffer, GENERIC_WRITE, 0, NULL,
- CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 );
+ HANDLE handle = CreateFileA( buffer, GENERIC_WRITE, 0, NULL,
+ CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 );
if (handle != INVALID_HANDLE_VALUE)
{ /* We created it */
TRACE("created %s\n",
@@ -1031,6 +1031,7 @@
BOOL win32 )
{
HFILE hFileRet;
+ HANDLE handle;
FILETIME filetime;
WORD filedatetime[2];
DOS_FULL_NAME full_name;
@@ -1094,9 +1095,9 @@
if (mode & OF_CREATE)
{
- if ((hFileRet = CreateFileA( name, GENERIC_READ | GENERIC_WRITE,
- sharing, NULL, CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, 0 ))== INVALID_HANDLE_VALUE)
+ if ((handle = CreateFileA( name, GENERIC_READ | GENERIC_WRITE,
+ sharing, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, 0 ))== INVALID_HANDLE_VALUE)
goto error;
goto success;
}
@@ -1153,19 +1154,19 @@
return 1;
}
- hFileRet = FILE_CreateFile( full_name.long_name, access, sharing,
- NULL, OPEN_EXISTING, 0, 0,
- DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY,
- GetDriveTypeA( full_name.short_name ) );
- if (!hFileRet) goto not_found;
+ handle = FILE_CreateFile( full_name.long_name, access, sharing,
+ NULL, OPEN_EXISTING, 0, 0,
+ DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY,
+ GetDriveTypeA( full_name.short_name ) );
+ if (!handle) goto not_found;
- GetFileTime( hFileRet, NULL, NULL, &filetime );
+ GetFileTime( handle, NULL, NULL, &filetime );
FileTimeToDosDateTime( &filetime, &filedatetime[0], &filedatetime[1] );
if ((mode & OF_VERIFY) && (mode & OF_REOPEN))
{
if (memcmp( ofs->reserved, filedatetime, sizeof(ofs->reserved) ))
{
- CloseHandle( hFileRet );
+ CloseHandle( handle );
WARN("(%s): OF_VERIFY failed\n", name );
/* FIXME: what error here? */
SetLastError( ERROR_FILE_NOT_FOUND );
@@ -1175,15 +1176,16 @@
memcpy( ofs->reserved, filedatetime, sizeof(ofs->reserved) );
success: /* We get here if the open was successful */
- TRACE("(%s): OK, return = %d\n", name, hFileRet );
+ TRACE("(%s): OK, return = %x\n", name, handle );
if (win32)
{
+ hFileRet = (HFILE)handle;
if (mode & OF_EXIST) /* Return the handle, but close it first */
- CloseHandle( hFileRet );
+ CloseHandle( handle );
}
else
{
- hFileRet = Win32HandleToDosFileHandle( hFileRet );
+ hFileRet = Win32HandleToDosFileHandle( handle );
if (hFileRet == HFILE_ERROR16) goto error;
if (mode & OF_EXIST) /* Return the handle, but close it first */
_lclose16( hFileRet );
@@ -1374,7 +1376,7 @@
HFILE WINAPI _lclose( HFILE hFile )
{
TRACE("handle %d\n", hFile );
- return CloseHandle( hFile ) ? 0 : HFILE_ERROR;
+ return CloseHandle( (HANDLE)hFile ) ? 0 : HFILE_ERROR;
}
/***********************************************************************
@@ -1881,7 +1883,7 @@
/* Some programs pass a count larger than the allocated buffer */
maxlen = GetSelectorLimit16( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1;
if (count > maxlen) count = maxlen;
- return _lread(DosFileHandleToWin32Handle(hFile), MapSL(buffer), count );
+ return _lread((HFILE)DosFileHandleToWin32Handle(hFile), MapSL(buffer), count );
}
@@ -1900,7 +1902,7 @@
UINT WINAPI _lread( HFILE handle, LPVOID buffer, UINT count )
{
DWORD result;
- if (!ReadFile( handle, buffer, count, &result, NULL )) return -1;
+ if (!ReadFile( (HANDLE)handle, buffer, count, &result, NULL )) return -1;
return result;
}
@@ -1910,7 +1912,7 @@
*/
UINT16 WINAPI _lread16( HFILE16 hFile, LPVOID buffer, UINT16 count )
{
- return (UINT16)_lread(DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
+ return (UINT16)_lread((HFILE)DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
}
@@ -1919,7 +1921,7 @@
*/
HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
{
- return Win32HandleToDosFileHandle( _lcreat( path, attr ) );
+ return Win32HandleToDosFileHandle( (HANDLE)_lcreat( path, attr ) );
}
@@ -1931,9 +1933,9 @@
/* Mask off all flags not explicitly allowed by the doc */
attr &= FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
TRACE("%s %02x\n", path, attr );
- return CreateFileA( path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- CREATE_ALWAYS, attr, 0 );
+ return (HFILE)CreateFileA( path, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ CREATE_ALWAYS, attr, 0 );
}
@@ -1986,7 +1988,7 @@
*/
LONG WINAPI _llseek( HFILE hFile, LONG lOffset, INT nOrigin )
{
- return SetFilePointer( hFile, lOffset, NULL, nOrigin );
+ return SetFilePointer( (HANDLE)hFile, lOffset, NULL, nOrigin );
}
@@ -1995,7 +1997,7 @@
*/
HFILE16 WINAPI _lopen16( LPCSTR path, INT16 mode )
{
- return Win32HandleToDosFileHandle( _lopen( path, mode ) );
+ return Win32HandleToDosFileHandle( (HANDLE)_lopen( path, mode ) );
}
@@ -2008,7 +2010,7 @@
TRACE("('%s',%04x)\n", path, mode );
FILE_ConvertOFMode( mode, &access, &sharing );
- return CreateFileA( path, access, sharing, NULL, OPEN_EXISTING, 0, 0 );
+ return (HFILE)CreateFileA( path, access, sharing, NULL, OPEN_EXISTING, 0, 0 );
}
@@ -2017,7 +2019,7 @@
*/
UINT16 WINAPI _lwrite16( HFILE16 hFile, LPCSTR buffer, UINT16 count )
{
- return (UINT16)_hwrite( DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
+ return (UINT16)_hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
}
/***********************************************************************
@@ -2034,7 +2036,7 @@
*/
LONG WINAPI _hread16( HFILE16 hFile, LPVOID buffer, LONG count)
{
- return _lread( DosFileHandleToWin32Handle(hFile), buffer, count );
+ return _lread( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
}
@@ -2052,7 +2054,7 @@
*/
LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
{
- return _hwrite( DosFileHandleToWin32Handle(hFile), buffer, count );
+ return _hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
}
@@ -2075,10 +2077,10 @@
if (!count)
{
/* Expand or truncate at current position */
- if (!SetEndOfFile( handle )) return HFILE_ERROR;
+ if (!SetEndOfFile( (HANDLE)handle )) return HFILE_ERROR;
return 0;
}
- if (!WriteFile( handle, buffer, count, &result, NULL ))
+ if (!WriteFile( (HANDLE)handle, buffer, count, &result, NULL ))
return HFILE_ERROR;
return result;
}
@@ -2542,14 +2544,16 @@
*/
BOOL WINAPI CopyFileA( LPCSTR source, LPCSTR dest, BOOL fail_if_exists )
{
- HFILE h1, h2;
+ HANDLE h1, h2;
BY_HANDLE_FILE_INFORMATION info;
- UINT count;
+ DWORD count;
BOOL ret = FALSE;
int mode;
char buffer[2048];
- if ((h1 = _lopen( source, OF_READ )) == HFILE_ERROR) return FALSE;
+ if ((h1 = CreateFileA( source, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
+ return FALSE;
if (!GetFileInformationByHandle( h1, &info ))
{
CloseHandle( h1 );
@@ -2563,13 +2567,14 @@
CloseHandle( h1 );
return FALSE;
}
- while ((count = _lread( h1, buffer, sizeof(buffer) )) > 0)
+
+ while (ReadFile( h1, buffer, sizeof(buffer), &count, NULL ) && count > 0)
{
char *p = buffer;
while (count > 0)
{
- INT res = _lwrite( h2, p, count );
- if (res <= 0) goto done;
+ DWORD res;
+ if (!WriteFile( h2, p, count, &res, NULL ) || !res) goto done;
p += res;
count -= res;
}
@@ -2753,7 +2758,7 @@
* UnlockFileEx (KERNEL32.@)
*/
BOOL WINAPI UnlockFileEx(
- HFILE hFile,
+ HANDLE hFile,
DWORD dwReserved,
DWORD nNumberOfBytesToUnlockLow,
DWORD nNumberOfBytesToUnlockHigh,
@@ -2881,7 +2886,7 @@
* LockFile (KERNEL32.@)
*/
BOOL WINAPI LockFile(
- HFILE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,
+ HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh )
{
struct flock f;
@@ -2932,7 +2937,7 @@
* UnlockFile (KERNEL32.@)
*/
BOOL WINAPI UnlockFile(
- HFILE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,
+ HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh )
{
FILE_OBJECT *file;
diff --git a/include/file.h b/include/file.h
index 25549cc..cfd35ac 100644
--- a/include/file.h
+++ b/include/file.h
@@ -95,7 +95,7 @@
extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
extern BOOL DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
extern const DOS_DEVICE *DOSFS_GetDevice( const char *name );
-extern const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile );
+extern const DOS_DEVICE *DOSFS_GetDeviceByHandle( HANDLE hFile );
extern HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa);
extern BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
INT long_len, LPSTR short_buf,
diff --git a/include/module.h b/include/module.h
index d1d5ccd..ef91450 100644
--- a/include/module.h
+++ b/include/module.h
@@ -207,7 +207,7 @@
extern void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved );
extern void MODULE_DllThreadAttach( LPVOID lpReserved );
extern void MODULE_DllThreadDetach( LPVOID lpReserved );
-extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags );
+extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HANDLE hfile, DWORD flags );
extern BOOL MODULE_FreeLibrary( WINE_MODREF *wm );
extern WINE_MODREF *MODULE_FindModule( LPCSTR path );
extern HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 );
@@ -231,8 +231,8 @@
/* loader/ne/resource.c */
extern HGLOBAL16 WINAPI NE_DefResourceHandler(HGLOBAL16,HMODULE16,HRSRC16);
extern BOOL NE_InitResourceHandler( HMODULE16 hModule );
-extern HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type );
-extern DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC16 hRsrc );
+extern HRSRC NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type );
+extern DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC hRsrc );
extern HGLOBAL16 NE_LoadResource( NE_MODULE *pModule, HRSRC16 hRsrc );
extern BOOL16 NE_FreeResource( NE_MODULE *pModule, HGLOBAL16 handle );
extern NE_TYPEINFO *NE_FindTypeSection( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo, LPCSTR typeId );
diff --git a/include/winbase.h b/include/winbase.h
index 3584c31..a27ded1 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1487,6 +1487,7 @@
BOOL WINAPI TlsSetValue(DWORD,LPVOID);
BOOL WINAPI TransmitCommChar(HANDLE,CHAR);
BOOL WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
+BOOL WINAPI UnlockFileEx(HANDLE,DWORD,DWORD,DWORD,LPOVERLAPPED);
BOOL WINAPI UnmapViewOfFile(LPVOID);
BOOL WINAPI VerifyVersionInfoA(LPOSVERSIONINFOEXA,DWORD,DWORDLONG);
BOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW,DWORD,DWORDLONG);
@@ -1703,7 +1704,6 @@
BOOL WINAPI SetVolumeLabelW(LPCWSTR,LPCWSTR);
#define SetVolumeLabel WINELIB_NAME_AW(SetVolumeLabel)
DWORD WINAPI SizeofResource(HMODULE,HRSRC);
-BOOL WINAPI UnlockFileEx(HFILE,DWORD,DWORD,DWORD,LPOVERLAPPED);
#define UnlockSegment(handle) GlobalUnfix((HANDLE)(handle))
BOOL WINAPI WritePrivateProfileSectionA(LPCSTR,LPCSTR,LPCSTR);
BOOL WINAPI WritePrivateProfileSectionW(LPCWSTR,LPCWSTR,LPCWSTR);
diff --git a/loader/module.c b/loader/module.c
index 6cd398e..6a41cb5 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -899,8 +899,8 @@
{
PROCESS_INFORMATION info;
STARTUPINFOA startup;
- HINSTANCE hInstance;
char *cmdline;
+ UINT ret;
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
@@ -917,18 +917,18 @@
/* Give 30 seconds to the app to come up */
if (wait_input_idle( info.hProcess, 30000 ) == 0xFFFFFFFF)
WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
- hInstance = (HINSTANCE)33;
+ ret = 33;
/* Close off the handles */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
}
- else if ((hInstance = (HINSTANCE)GetLastError()) >= (HINSTANCE)32)
+ else if ((ret = GetLastError()) >= 32)
{
- FIXME("Strange error set by CreateProcess: %d\n", hInstance );
- hInstance = (HINSTANCE)11;
+ FIXME("Strange error set by CreateProcess: %d\n", ret );
+ ret = 11;
}
HeapFree( GetProcessHeap(), 0, cmdline );
- return hInstance;
+ return ret;
}
/**********************************************************************
@@ -1188,7 +1188,7 @@
* init function into load_library).
* allocated_libdir is TRUE in the stack frame that allocated libdir
*/
-WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
+WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HANDLE hfile, DWORD flags )
{
DWORD err = GetLastError();
WINE_MODREF *pwm;
diff --git a/loader/ne/resource.c b/loader/ne/resource.c
index b7139be..57118d7 100644
--- a/loader/ne/resource.c
+++ b/loader/ne/resource.c
@@ -311,7 +311,7 @@
/**********************************************************************
* NE_FindResource
*/
-HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type )
+HRSRC NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type )
{
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
@@ -363,7 +363,7 @@
if ((pNameInfo = NE_FindResourceFromType( pResTab, pTypeInfo, name )))
{
TRACE(" Found id %08lx\n", (DWORD)name );
- return (HRSRC16)( (int)pNameInfo - (int)pModule );
+ return (HRSRC)( (char *)pNameInfo - (char *)pModule );
}
TRACE(" Not found, going on\n" );
pTypeInfo = NEXT_TYPEINFO(pTypeInfo);
@@ -443,7 +443,7 @@
/**********************************************************************
* NE_SizeofResource
*/
-DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC16 hRsrc )
+DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
@@ -453,7 +453,7 @@
TRACE("module=%04x res=%04x\n", pModule->self, hRsrc );
sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
- pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
+ pNameInfo = (NE_NAMEINFO*)((char*)pModule + LOWORD(hRsrc));
return (DWORD)pNameInfo->length << sizeShift;
}
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index 6124bf4..198576f 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -111,7 +111,7 @@
WORD count, i, offset, next_offset;
HMODULE16 module;
FARPROC16 address = 0;
- HFILE hf;
+ HANDLE hf;
DWORD res;
struct relocation_entry_s *rep, *reloc_entries;
BYTE *func_name;
@@ -152,7 +152,7 @@
/* Implement self-loading segments */
SELFLOADHEADER *selfloadheader;
DWORD oldstack;
- HFILE hFile32;
+ HANDLE hFile32;
HFILE16 hFile16;
selfloadheader = MapSL( MAKESEGPTR(SEL(pSegTable->hSeg),0) );
@@ -437,7 +437,7 @@
if (pModule->flags & NE_FFLAGS_SELFLOAD)
{
- HFILE hf;
+ HANDLE hf;
HFILE16 hFile16;
HGLOBAL16 sel;
/* Handle self-loading modules */
diff --git a/loader/resource.c b/loader/resource.c
index e4d3e85..5d77879 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -59,7 +59,7 @@
/**********************************************************************
* MapHRsrc32To16
*/
-static HRSRC16 MapHRsrc32To16( NE_MODULE *pModule, HANDLE hRsrc32, WORD type )
+static HRSRC MapHRsrc32To16( NE_MODULE *pModule, HANDLE hRsrc32, WORD type )
{
HRSRC_MAP *map = (HRSRC_MAP *)pModule->hRsrcMap;
HRSRC_ELEM *newElem;
@@ -80,7 +80,7 @@
/* Check whether HRSRC32 already in map */
for ( i = 0; i < map->nUsed; i++ )
if ( map->elem[i].hRsrc == hRsrc32 )
- return (HRSRC16)(i + 1);
+ return (HRSRC)(i + 1);
/* If no space left, grow table */
if ( map->nUsed == map->nAlloc )
@@ -102,13 +102,13 @@
map->elem[map->nUsed].type = type;
map->nUsed++;
- return (HRSRC16)map->nUsed;
+ return (HRSRC)map->nUsed;
}
/**********************************************************************
* MapHRsrc16To32
*/
-static HANDLE MapHRsrc16To32( NE_MODULE *pModule, HRSRC16 hRsrc16 )
+static HRSRC MapHRsrc16To32( NE_MODULE *pModule, HRSRC hRsrc16 )
{
HRSRC_MAP *map = (HRSRC_MAP *)pModule->hRsrcMap;
if ( !map || !hRsrc16 || (int)hRsrc16 > map->nUsed ) return 0;
@@ -119,7 +119,7 @@
/**********************************************************************
* MapHRsrc16ToType
*/
-static WORD MapHRsrc16ToType( NE_MODULE *pModule, HRSRC16 hRsrc16 )
+static WORD MapHRsrc16ToType( NE_MODULE *pModule, HRSRC hRsrc16 )
{
HRSRC_MAP *map = (HRSRC_MAP *)pModule->hRsrcMap;
if ( !map || !hRsrc16 || (int)hRsrc16 > map->nUsed ) return 0;
@@ -293,7 +293,7 @@
/* 16-bit NE module */
/* If we got a 32-bit hRsrc, we don't need to convert it */
- hMem = NE_LoadResource( pModule, hRsrc );
+ hMem = NE_LoadResource( pModule, LOWORD(hRsrc) );
/* If we are to return a 32-bit resource, we should probably
convert it but we don't for now. FIXME !!! */
@@ -332,8 +332,8 @@
*/
HRSRC16 WINAPI FindResource16( HMODULE16 hModule, LPCSTR name, LPCSTR type )
{
- return RES_FindResource( hModule, type, name,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), FALSE, TRUE );
+ return LOWORD( RES_FindResource( hModule, type, name,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), FALSE, TRUE ) );
}
/**********************************************************************
@@ -420,7 +420,7 @@
return (LPVOID)handle;
/* 16-bit memory handle */
- return LockResource16( handle );
+ return LockResource16( LOWORD(handle) );
}
typedef WORD (WINAPI *pDestroyIcon32Proc)( HGLOBAL16 handle, UINT16 flags );
@@ -432,7 +432,7 @@
*/
BOOL16 WINAPI FreeResource16( HGLOBAL16 handle )
{
- HGLOBAL retv = handle;
+ HGLOBAL16 retv = handle;
NE_MODULE *pModule = NE_GetPtr( FarGetOwner16( handle ) );
TRACE("(%04x)\n", handle );
@@ -463,7 +463,7 @@
{
if (HIWORD(handle)) return 0; /* 32-bit memory handle: nothing to do */
- return FreeResource16( handle );
+ return FreeResource16( LOWORD(handle) );
}
/**********************************************************************
diff --git a/objects/metafile.c b/objects/metafile.c
index ad0404a..8bd1c80 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -209,7 +209,7 @@
* Returns a pointer to a memory based METAHEADER read in from file HFILE
*
*/
-static METAHEADER *MF_ReadMetaFile(HFILE hfile)
+static METAHEADER *MF_ReadMetaFile(HANDLE hfile)
{
METAHEADER *mh;
DWORD BytesRead, size;
diff --git a/scheduler/handle.c b/scheduler/handle.c
index b19db57..683e574 100644
--- a/scheduler/handle.c
+++ b/scheduler/handle.c
@@ -37,10 +37,10 @@
NTSTATUS status;
/* stdio handles need special treatment */
- if ((handle == STD_INPUT_HANDLE) ||
- (handle == STD_OUTPUT_HANDLE) ||
- (handle == STD_ERROR_HANDLE))
- handle = GetStdHandle( handle );
+ if ((handle == (HANDLE)STD_INPUT_HANDLE) ||
+ (handle == (HANDLE)STD_OUTPUT_HANDLE) ||
+ (handle == (HANDLE)STD_ERROR_HANDLE))
+ handle = GetStdHandle( (DWORD)handle );
status = NtClose( handle );
if (status) SetLastError( RtlNtStatusToDosError(status) );
diff --git a/scheduler/process.c b/scheduler/process.c
index e95812d..040f68b 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -449,7 +449,7 @@
int debugged, console_app;
LPTHREAD_START_ROUTINE entry;
WINE_MODREF *wm;
- HFILE main_file = main_exe_file;
+ HANDLE main_file = main_exe_file;
/* use original argv[0] as name for the main module */
if (!main_exe_name[0])
@@ -1332,7 +1332,7 @@
return GetAppCompatFlags16(0);
case GPD_LOAD_DONE_EVENT:
- return current_process.load_done_evt;
+ return (DWORD)current_process.load_done_evt;
case GPD_HINSTANCE16:
return GetTaskDS16();
@@ -1347,10 +1347,10 @@
return (DWORD)¤t_process;
case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
- return current_startupinfo.hStdOutput;
+ return (DWORD)current_startupinfo.hStdOutput;
case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
- return current_startupinfo.hStdInput;
+ return (DWORD)current_startupinfo.hStdInput;
case GPD_STARTF_SHOWWINDOW:
return current_startupinfo.wShowWindow;
@@ -1920,5 +1920,5 @@
#undef GetCurrentProcess
HANDLE WINAPI GetCurrentProcess(void)
{
- return 0xffffffff;
+ return (HANDLE)0xffffffff;
}