Commit 267ca682 authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed HANDLE<->HFILE conversions, since they will be different types

when handles are void*.
parent 04b5a86c
......@@ -33,7 +33,7 @@ typedef struct
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 @@ extern BOOL EMFDRV_WidenPath( PHYSDEV dev );
#endif /* __WINE_METAFILEDRV_H */
......@@ -277,7 +277,7 @@ HDC WINAPI CreateEnhMetaFileW(
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) );
......
......@@ -219,7 +219,7 @@ HDC16 WINAPI CreateMetaFile16(
HDC ret;
DC *dc;
METAFILEDRV_PDEVICE *physDev;
HFILE hFile;
HANDLE hFile;
TRACE("'%s'\n", filename );
......
......@@ -33,7 +33,7 @@ typedef struct
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_StrokePath( PHYSDEV dev );
extern BOOL MFDRV_WidenPath( PHYSDEV dev );
#endif /* __WINE_METAFILEDRV_H */
......@@ -2044,7 +2044,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib)
{
int ret = TYPE_E_CANTLOADLIBRARY;
DWORD dwSignature = 0;
HFILE hFile;
HANDLE hFile;
TRACE_(typelib)("%s:%d\n", debugstr_w(pszFileName), index);
......
......@@ -251,7 +251,7 @@ static HRESULT ICO_ExtractIconExW(
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 @@ HRESULT WINAPI PrivateExtractIconExA (
HeapFree(GetProcessHeap(), 0, lpwstrFile);
return ret;
}
......@@ -342,7 +342,7 @@ BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID para
* (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;
......
......@@ -684,7 +684,7 @@ BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
*/
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 @@ const DOS_DEVICE *DOSFS_GetDevice( const char *name )
/***********************************************************************
* 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 @@ static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access, DWORD attributes,
*/
HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa )
{
int i;
unsigned int i;
const char *p;
HANDLE handle;
......
......@@ -936,8 +936,8 @@ static UINT FILE_GetTempFileName( LPCSTR path, LPCSTR prefix, UINT unique,
{
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 @@ static HFILE FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT mode,
BOOL win32 )
{
HFILE hFileRet;
HANDLE handle;
FILETIME filetime;
WORD filedatetime[2];
DOS_FULL_NAME full_name;
......@@ -1094,9 +1095,9 @@ static HFILE FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT mode,
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 @@ found:
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 @@ found:
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 @@ HFILE16 WINAPI _lclose16( HFILE16 hFile )
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 @@ LONG WINAPI WIN16_hread( HFILE16 hFile, SEGPTR buffer, LONG count )
/* 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 @@ UINT16 WINAPI WIN16_lread( HFILE16 hFile, SEGPTR buffer, UINT16 count )
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 @@ UINT WINAPI _lread( HFILE handle, LPVOID buffer, UINT count )
*/
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 @@ UINT16 WINAPI _lread16( HFILE16 hFile, LPVOID buffer, UINT16 count )
*/
HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
{
return Win32HandleToDosFileHandle( _lcreat( path, attr ) );
return Win32HandleToDosFileHandle( (HANDLE)_lcreat( path, attr ) );
}
......@@ -1931,9 +1933,9 @@ HFILE WINAPI _lcreat( LPCSTR path, INT attr )
/* 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 _llseek16( HFILE16 hFile, LONG lOffset, INT16 nOrigin )
*/
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 @@ LONG WINAPI _llseek( HFILE hFile, LONG lOffset, INT nOrigin )
*/
HFILE16 WINAPI _lopen16( LPCSTR path, INT16 mode )
{
return Win32HandleToDosFileHandle( _lopen( path, mode ) );
return Win32HandleToDosFileHandle( (HANDLE)_lopen( path, mode ) );
}
......@@ -2008,7 +2010,7 @@ HFILE WINAPI _lopen( LPCSTR path, INT mode )
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 @@ HFILE WINAPI _lopen( LPCSTR path, INT mode )
*/
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 @@ UINT WINAPI _lwrite( HFILE hFile, LPCSTR buffer, UINT count )
*/
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 _hread( HFILE hFile, LPVOID buffer, LONG count)
*/
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 @@ LONG WINAPI _hwrite( HFILE handle, LPCSTR buffer, LONG count )
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 MoveFileW( LPCWSTR fn1, LPCWSTR fn2 )
*/
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 @@ BOOL WINAPI CopyFileA( LPCSTR source, LPCSTR dest, BOOL fail_if_exists )
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 @@ BOOL WINAPI UnlockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetH
* UnlockFileEx (KERNEL32.@)
*/
BOOL WINAPI UnlockFileEx(
HFILE hFile,
HANDLE hFile,
DWORD dwReserved,
DWORD nNumberOfBytesToUnlockLow,
DWORD nNumberOfBytesToUnlockHigh,
......@@ -2881,7 +2886,7 @@ static BOOL DOS_RemoveLock(FILE_OBJECT *file, struct flock *f)
* 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 @@ BOOL WINAPI LockFile(
* UnlockFile (KERNEL32.@)
*/
BOOL WINAPI UnlockFile(
HFILE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,
HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh )
{
FILE_OBJECT *file;
......
......@@ -95,7 +95,7 @@ extern void DOSFS_UnixTimeToFileTime( time_t unixtime, LPFILETIME ft,
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,
......
......@@ -207,7 +207,7 @@ extern BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved );
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 @@ extern DWORD NE_StartTask(void);
/* 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 );
......
......@@ -1487,6 +1487,7 @@ LPVOID WINAPI TlsGetValue(DWORD);
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 SetVolumeLabelA(LPCSTR,LPCSTR);
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);
......
......@@ -899,8 +899,8 @@ UINT WINAPI WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
{
PROCESS_INFORMATION info;
STARTUPINFOA startup;
HINSTANCE hInstance;
char *cmdline;
UINT ret;
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
......@@ -917,18 +917,18 @@ UINT WINAPI WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
/* 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 @@ static LPCSTR allocate_lib_dir(LPCSTR libname)
* 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;
......
......@@ -311,7 +311,7 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId,
/**********************************************************************
* 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 @@ HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type )
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 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
/**********************************************************************
* 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 @@ DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC16 hRsrc )
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;
}
......
......@@ -111,7 +111,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
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 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
/* 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 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
if (pModule->flags & NE_FFLAGS_SELFLOAD)
{
HFILE hf;
HANDLE hf;
HFILE16 hFile16;
HGLOBAL16 sel;
/* Handle self-loading modules */
......
......@@ -59,7 +59,7 @@ typedef struct _HRSRC_MAP
/**********************************************************************
* 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 @@ static HRSRC16 MapHRsrc32To16( NE_MODULE *pModule, HANDLE hRsrc32, WORD type )
/* 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 @@ static HRSRC16 MapHRsrc32To16( NE_MODULE *pModule, HANDLE hRsrc32, WORD type )
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 @@ static HANDLE MapHRsrc16To32( NE_MODULE *pModule, HRSRC16 hRsrc16 )
/**********************************************************************
* 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 @@ static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc, BOOL bRet16 )
/* 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 @@ static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc, BOOL bRet16 )
*/
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 @@ LPVOID WINAPI LockResource( HGLOBAL handle )
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 @@ typedef WORD (WINAPI *pDestroyIcon32Proc)( HGLOBAL16 handle, UINT16 flags );
*/
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 @@ BOOL WINAPI FreeResource( HGLOBAL handle )
{
if (HIWORD(handle)) return 0; /* 32-bit memory handle: nothing to do */
return FreeResource16( handle );
return FreeResource16( LOWORD(handle) );
}
/**********************************************************************
......
......@@ -209,7 +209,7 @@ BOOL WINAPI DeleteMetaFile( HMETAFILE hmf )
* 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;
......
......@@ -37,10 +37,10 @@ BOOL WINAPI CloseHandle( HANDLE handle )
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) );
......
......@@ -449,7 +449,7 @@ static void start_process(void)
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 @@ DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
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 @@ DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
return (DWORD)&current_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 @@ BOOL WINAPI TlsSetValue(
#undef GetCurrentProcess
HANDLE WINAPI GetCurrentProcess(void)
{
return 0xffffffff;
return (HANDLE)0xffffffff;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment