Fixed some handle type mismatches and added a few casts in prevision

of void* handles.
This commit is contained in:
Alexandre Julliard 2002-07-31 19:26:03 +00:00
parent 05d42e5b2f
commit 7375597fe2
28 changed files with 70 additions and 118 deletions

View File

@ -153,7 +153,7 @@ BOOL CRYPT_VerifyImage(LPCSTR lpszImage, BYTE* pData)
return TRUE;
}
BOOL CRYPT_ReturnhWnd(DWORD *phWnd)
BOOL CRYPT_ReturnhWnd(HWND *phWnd)
{
if (!phWnd)
return FALSE;

View File

@ -23,6 +23,16 @@
#include "wincrypt.h"
typedef struct _VTableProvStruc {
DWORD Version;
BOOL (*pFuncVerifyImage)(LPCSTR lpszImage, BYTE *pSigData);
BOOL (*pFuncReturnhWnd)(HWND *phWnd);
DWORD dwProvType;
BYTE *pbContextInfo;
DWORD cbContextInfo;
LPSTR pszProvName;
} VTableProvStruc, *PVTableProvStruc;
typedef struct tagPROVFUNCS
{
BOOL (*pCPAcquireContext)(HCRYPTPROV *phProv, LPSTR pszContainer, DWORD dwFlags, PVTableProvStruc pVTable);

View File

@ -140,7 +140,7 @@ HANDLE WINAPI
OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
{
FIXME("stub\n");
return TRUE;
return (HANDLE)1;
}
/******************************************************************************
@ -154,7 +154,7 @@ HANDLE WINAPI
OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
{
FIXME("stub\n");
return TRUE;
return (HANDLE)1;
}
/******************************************************************************
@ -163,7 +163,7 @@ OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source)
{
FIXME("(%s,%s),stub!\n",uncname,source);
return 0xcafe4242;
return (HANDLE)0xcafe4242;
}
/******************************************************************************
@ -177,7 +177,7 @@ HANDLE WINAPI
OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
{
FIXME("stub\n");
return TRUE;
return (HANDLE)1;
}
/******************************************************************************
@ -241,7 +241,7 @@ RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
{
FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName),
debugstr_w(lpSourceName));
return 1;
return (HANDLE)1;
}
/******************************************************************************

View File

@ -674,7 +674,7 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
*/
DWORD WINAPI RegCloseKey( HKEY hkey )
{
if (!hkey || hkey >= 0x80000000) return ERROR_SUCCESS;
if (!hkey || hkey >= (HKEY)0x80000000) return ERROR_SUCCESS;
return RtlNtStatusToDosError( NtClose( hkey ) );
}
@ -1435,7 +1435,7 @@ LONG WINAPI RegSaveKeyA( HKEY hkey, LPCSTR file, LPSECURITY_ATTRIBUTES sa )
int count = 0;
LPSTR name;
DWORD ret, err;
HFILE handle;
HANDLE handle;
TRACE( "(%x,%s,%p)\n", hkey, debugstr_a(file), sa );

View File

@ -596,7 +596,7 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
TRACE("Starting service %s\n", debugstr_a(path) );
data = CreateSemaphoreA(NULL,1,1,"ADVAPI32_ServiceStartData");
if(data == ERROR_INVALID_HANDLE)
if (!data)
{
data = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, "ADVAPI32_ServiceStartData");
if(data == 0)
@ -700,4 +700,3 @@ QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
return TRUE;
}

View File

@ -88,7 +88,6 @@ BOOL WINAPI WaitForDebugEvent(
event->u.CreateProcessInfo.lpStartAddress = data.info.create_process.start;
event->u.CreateProcessInfo.lpImageName = data.info.create_process.name;
event->u.CreateProcessInfo.fUnicode = data.info.create_process.unicode;
if (data.info.create_process.file == -1) event->u.CreateProcessInfo.hFile = 0;
break;
case EXIT_THREAD_DEBUG_EVENT:
event->u.ExitThread.dwExitCode = data.info.exit.exit_code;
@ -103,7 +102,6 @@ BOOL WINAPI WaitForDebugEvent(
event->u.LoadDll.nDebugInfoSize = data.info.load_dll.dbg_size;
event->u.LoadDll.lpImageName = data.info.load_dll.name;
event->u.LoadDll.fUnicode = data.info.load_dll.unicode;
if (data.info.load_dll.handle == -1) event->u.LoadDll.hFile = 0;
break;
case UNLOAD_DLL_DEBUG_EVENT:
event->u.UnloadDll.lpBaseOfDll = data.info.unload_dll.base;
@ -389,4 +387,3 @@ BOOL WINAPI DebugSetProcessKillOnExit(BOOL kill)
SERVER_END_REQ;
return ret;
}

View File

@ -145,7 +145,7 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32,
struct ThunkDataCommon *TD32, DWORD checksum)
{
struct ThunkDataCommon *TD16;
HMODULE hmod;
HMODULE16 hmod;
int ordinal;
if ((hmod = LoadLibrary16(module)) <= 32)
@ -1918,7 +1918,7 @@ void WINAPI CBClientThunkSLEx( CONTEXT86 *context )
* A 16:16 segmented pointer to the function is returned.
* Written without any docu.
*/
SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name)
SEGPTR WINAPI Get16DLLAddress(HMODULE16 handle, LPSTR func_name)
{
static WORD code_sel32;
FARPROC16 proc_16;

View File

@ -211,11 +211,11 @@ HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type )
case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND:
return (HANDLE)handle;
return (HANDLE)(ULONG_PTR)handle;
default:
ERR( "handle 0x%04x of unknown type %d\n", handle, type );
return (HANDLE)handle;
return (HANDLE)(ULONG_PTR)handle;
}
}
@ -501,5 +501,3 @@ DWORD WINAPI WOW16Call(WORD x,WORD y,WORD z)
DPRINTF(") calling address was 0x%08lx\n",calladdr);
return 0;
}

View File

@ -160,7 +160,7 @@ NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
{
if (interlocked_inc( &crit->LockCount ))
{
if (crit->OwningThread == GetCurrentThreadId())
if (crit->OwningThread == (HANDLE)GetCurrentThreadId())
{
crit->RecursionCount++;
return STATUS_SUCCESS;
@ -169,7 +169,7 @@ NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
/* Now wait for it */
RtlpWaitForCriticalSection( crit );
}
crit->OwningThread = GetCurrentThreadId();
crit->OwningThread = (HANDLE)GetCurrentThreadId();
crit->RecursionCount = 1;
return STATUS_SUCCESS;
}
@ -183,11 +183,11 @@ BOOL WINAPI RtlTryEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
BOOL ret = FALSE;
if (interlocked_cmpxchg( &crit->LockCount, 0L, -1 ) == -1)
{
crit->OwningThread = GetCurrentThreadId();
crit->OwningThread = (HANDLE)GetCurrentThreadId();
crit->RecursionCount = 1;
ret = TRUE;
}
else if (crit->OwningThread == GetCurrentThreadId())
else if (crit->OwningThread == (HANDLE)GetCurrentThreadId())
{
interlocked_inc( &crit->LockCount );
crit->RecursionCount++;

View File

@ -274,7 +274,7 @@ NTSTATUS WINAPI NtOpenProcessToken(
{
FIXME("(0x%08x,0x%08lx,%p): stub\n",
ProcessHandle,DesiredAccess, TokenHandle);
*TokenHandle = 0xcafe;
*TokenHandle = (HANDLE)0xcafe;
return 0;
}
@ -290,7 +290,7 @@ NTSTATUS WINAPI NtOpenThreadToken(
{
FIXME("(0x%08x,0x%08lx,0x%08x,%p): stub\n",
ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
*TokenHandle = 0xcafe;
*TokenHandle = (HANDLE)0xcafe;
return 0;
}

View File

@ -101,7 +101,7 @@ start:
}
else if( rwl->iNumberActive < 0 ) /* exclusive lock in progress */
{
if( rwl->hOwningThreadId == GetCurrentThreadId() )
if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() )
{
retVal = 1;
rwl->iNumberActive--;
@ -123,7 +123,7 @@ wait:
goto wait;
if( retVal == 1 )
rwl->hOwningThreadId = GetCurrentThreadId();
rwl->hOwningThreadId = (HANDLE)GetCurrentThreadId();
done:
RtlLeaveCriticalSection( &rwl->rtlCS );
return retVal;
@ -142,7 +142,7 @@ start:
RtlEnterCriticalSection( &rwl->rtlCS );
if( rwl->iNumberActive < 0 )
{
if( rwl->hOwningThreadId == GetCurrentThreadId() )
if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() )
{
rwl->iNumberActive--;
retVal = 1;

View File

@ -189,35 +189,3 @@ RETERR16 WINAPI GenInstall16( HINF16 hinf16, LPCSTR section, WORD genflags )
SetupTermDefaultQueueCallback( context );
return ret;
}
WORD InfNumEntries = 0;
INF_FILE *InfList = NULL;
HINF16 IP_curr_handle = 0;
BOOL IP_FindInf(HINF16 hInf, WORD *ret)
{
WORD n;
for (n=0; n < InfNumEntries; n++)
if (InfList[n].hInf == hInf)
{
*ret = n;
return TRUE;
}
return FALSE;
}
LPCSTR IP_GetFileName(HINF16 hInf)
{
WORD n;
if (IP_FindInf(hInf, &n))
{
return InfList[n].lpInfFileName;
}
return NULL;
}

View File

@ -44,17 +44,6 @@ typedef struct tagLDD_LIST {
ldd.ldid = LDID; \
} while(0)
typedef struct {
HINF16 hInf;
HFILE hInfFile;
LPSTR lpInfFileName;
} INF_FILE;
extern INF_FILE *InfList;
extern WORD InfNumEntries;
extern LPCSTR IP_GetFileName(HINF16 hInf);
/* string substitutions */
struct inf_file;

View File

@ -96,15 +96,15 @@ typedef struct tagDC
INT vportExtY;
int flags;
HRGN16 hClipRgn; /* Clip region (may be 0) */
HRGN16 hVisRgn; /* Visible region (must never be 0) */
HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
HPEN16 hPen;
HBRUSH16 hBrush;
HFONT16 hFont;
HBITMAP16 hBitmap;
HANDLE16 hDevice;
HPALETTE16 hPalette;
HRGN hClipRgn; /* Clip region (may be 0) */
HRGN hVisRgn; /* Visible region (must never be 0) */
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
HPEN hPen;
HBRUSH hBrush;
HFONT hFont;
HBITMAP hBitmap;
HANDLE hDevice;
HPALETTE hPalette;
GdiFont gdiFont;
GdiPath path;

View File

@ -37,6 +37,6 @@ typedef struct tagPALETTEOBJ
LOGPALETTE logpalette; /* _MUST_ be the last field */
} PALETTEOBJ;
extern HPALETTE16 PALETTE_Init(void);
extern HPALETTE PALETTE_Init(void);
#endif /* __WINE_PALETTE_H */

View File

@ -28,15 +28,6 @@ typedef unsigned long HCRYPTKEY;
typedef unsigned long HCRYPTHASH;
/* CSP Structs */
typedef struct _VTableProvStruc {
DWORD Version;
BOOL (*pFuncVerifyImage)(LPCSTR lpszImage, BYTE *pSigData);
BOOL (*pFuncReturnhWnd)(DWORD *phWnd);
DWORD dwProvType;
BYTE *pbContextInfo;
DWORD cbContextInfo;
LPSTR pszProvName;
} VTableProvStruc, *PVTableProvStruc;
typedef struct _CRYPTOAPI_BLOB {
DWORD cbData;

View File

@ -1713,7 +1713,7 @@ HMODULE16 WINAPI MapHModuleLS(HMODULE hmod) {
if (!hmod)
return TASK_GetCurrent()->hInstance;
if (!HIWORD(hmod))
return hmod; /* we already have a 16 bit module handle */
return LOWORD(hmod); /* we already have a 16 bit module handle */
pModule = (NE_MODULE*)GlobalLock16(hFirstModule);
while (pModule) {
if (pModule->module32 == hmod)
@ -1747,7 +1747,7 @@ HMODULE WINAPI MapHModuleSL(HMODULE16 hmod) {
*/
void WINAPI MapHInstLS( CONTEXT86 *context )
{
context->Eax = MapHModuleLS(context->Eax);
context->Eax = MapHModuleLS( (HMODULE)context->Eax );
}
/***************************************************************************
@ -1756,7 +1756,7 @@ void WINAPI MapHInstLS( CONTEXT86 *context )
*/
void WINAPI MapHInstSL( CONTEXT86 *context )
{
context->Eax = MapHModuleSL(context->Eax);
context->Eax = (DWORD)MapHModuleSL( context->Eax );
}
/***************************************************************************
@ -1764,7 +1764,7 @@ void WINAPI MapHInstSL( CONTEXT86 *context )
*/
void WINAPI MapHInstLS_PN( CONTEXT86 *context )
{
if (context->Eax) context->Eax = MapHModuleLS(context->Eax);
if (context->Eax) context->Eax = MapHModuleLS( (HMODULE)context->Eax );
}
/***************************************************************************
@ -1772,5 +1772,5 @@ void WINAPI MapHInstLS_PN( CONTEXT86 *context )
*/
void WINAPI MapHInstSL_PN( CONTEXT86 *context )
{
if (context->Eax) context->Eax = MapHModuleSL(context->Eax);
if (context->Eax) context->Eax = (DWORD)MapHModuleSL( context->Eax );
}

View File

@ -287,7 +287,7 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
*/
DWORD WINAPI RegCloseKey( HKEY hkey )
{
if (!hkey || hkey >= 0x80000000) return ERROR_SUCCESS;
if (!hkey || hkey >= (HKEY)0x80000000) return ERROR_SUCCESS;
return RtlNtStatusToDosError( NtClose( hkey ) );
}

View File

@ -908,7 +908,7 @@ void WINAPI AllocMappedBuffer( CONTEXT86 *context )
context->Eax = context->Edi = 0;
else
{
buffer[0] = handle;
buffer[0] = (DWORD)handle;
buffer[1] = ptr;
context->Eax = (DWORD) ptr;
@ -932,7 +932,7 @@ void WINAPI FreeMappedBuffer( CONTEXT86 *context )
UnMapLS(buffer[1]);
GlobalUnlock(buffer[0]);
GlobalFree(buffer[0]);
GlobalUnlock((HGLOBAL)buffer[0]);
GlobalFree((HGLOBAL)buffer[0]);
}
}

View File

@ -1652,7 +1652,7 @@ LONG WINAPI RegReplaceKeyA( HKEY hkey, LPCSTR lpSubKey, LPCSTR lpNewFile,
*/
static inline void fix_win16_hkey( HKEY *hkey )
{
if (*hkey == 0 || *hkey == 1) *hkey = HKEY_CLASSES_ROOT;
if (*hkey == 0 || *hkey == (HKEY)1) *hkey = HKEY_CLASSES_ROOT;
}
/******************************************************************************

View File

@ -1174,7 +1174,7 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
*/
{
DWORD *stack = (DWORD *)W32S_APP2WINE(context->Edx);
HANDLE handle = stack[0];
HANDLE handle = (HANDLE)stack[0];
DWORD *id = (DWORD *)W32S_APP2WINE(stack[1]);
TRACE("NtCloseSection(%lx, %lx)\n", (DWORD)handle, (DWORD)id);
@ -1197,7 +1197,7 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
*/
{
DWORD *stack = (DWORD *)W32S_APP2WINE(context->Edx);
HANDLE handle = stack[0];
HANDLE handle = (HANDLE)stack[0];
HANDLE new_handle;
TRACE("NtDupSection(%lx)\n", (DWORD)handle);
@ -1229,7 +1229,7 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
*/
{
DWORD * stack = (DWORD *)W32S_APP2WINE(context->Edx);
HANDLE SectionHandle = stack[0];
HANDLE SectionHandle = (HANDLE)stack[0];
DWORD ProcessHandle = stack[1]; /* ignored */
DWORD * BaseAddress = (DWORD *)W32S_APP2WINE(stack[2]);
DWORD ZeroBits = stack[3];
@ -1651,4 +1651,3 @@ void WINAPI VXD_Win32s( CONTEXT86 *context )
}
}

View File

@ -100,9 +100,9 @@ static const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS] =
*
* Create the system palette.
*/
HPALETTE16 PALETTE_Init(void)
HPALETTE PALETTE_Init(void)
{
HPALETTE16 hpalette;
HPALETTE hpalette;
LOGPALETTE * palPtr;
PALETTEOBJ* palObj;
@ -115,7 +115,7 @@ HPALETTE16 PALETTE_Init(void)
palPtr->palVersion = 0x300;
palPtr->palNumEntries = NB_RESERVED_COLORS;
memcpy( palPtr->palPalEntry, sys_pal_template, sizeof(sys_pal_template) );
hpalette = CreatePalette16( palPtr );
hpalette = CreatePalette( palPtr );
HeapFree( GetProcessHeap(), 0, palPtr );
palObj = (PALETTEOBJ*) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );

View File

@ -184,8 +184,8 @@ SNOOP_GetProcAddress(HMODULE hmod,LPCSTR name,DWORD ordinal,FARPROC origfun) {
for (j=0;j<PE_HEADER(hmod)->FileHeader.NumberOfSections;j++)
/* 0x42 is special ELF loader tag */
if ((pe_seg[j].VirtualAddress==0x42) ||
(((DWORD)origfun-hmod>=pe_seg[j].VirtualAddress)&&
((DWORD)origfun-hmod <pe_seg[j].VirtualAddress+
(((char *)origfun - (char *)hmod>=pe_seg[j].VirtualAddress)&&
((char *)origfun - (char *)hmod <pe_seg[j].VirtualAddress+
pe_seg[j].SizeOfRawData
))
)

View File

@ -148,7 +148,7 @@ VOID WINAPI _KERNEL32_86(SYSLEVEL *lock)
*/
DWORD WINAPI _ConfirmSysLevel(SYSLEVEL *lock)
{
if ( lock && lock->crst.OwningThread == GetCurrentThreadId() )
if ( lock && lock->crst.OwningThread == (HANDLE)GetCurrentThreadId() )
return lock->crst.RecursionCount;
else
return 0L;
@ -160,7 +160,8 @@ DWORD WINAPI _ConfirmSysLevel(SYSLEVEL *lock)
*/
VOID WINAPI _CheckNotSysLevel(SYSLEVEL *lock)
{
if (lock && lock->crst.OwningThread == GetCurrentThreadId() && lock->crst.RecursionCount)
if (lock && lock->crst.OwningThread == (HANDLE)GetCurrentThreadId() &&
lock->crst.RecursionCount)
{
ERR( "Holding lock %p level %d\n", lock, lock->level );
DbgBreakPoint();

View File

@ -760,7 +760,7 @@ BOOL WINAPI SetThreadLocale(
#undef GetCurrentThread
HANDLE WINAPI GetCurrentThread(void)
{
return 0xfffffffe;
return (HANDLE)0xfffffffe;
}

View File

@ -87,8 +87,8 @@ struct key_value
/* the special root keys */
#define HKEY_SPECIAL_ROOT_FIRST HKEY_CLASSES_ROOT
#define HKEY_SPECIAL_ROOT_LAST HKEY_DYN_DATA
#define HKEY_SPECIAL_ROOT_FIRST ((unsigned int)HKEY_CLASSES_ROOT)
#define HKEY_SPECIAL_ROOT_LAST ((unsigned int)HKEY_DYN_DATA)
#define NB_SPECIAL_ROOT_KEYS (HKEY_SPECIAL_ROOT_LAST - HKEY_SPECIAL_ROOT_FIRST + 1)
#define IS_SPECIAL_ROOT_HKEY(h) (((unsigned int)(h) >= HKEY_SPECIAL_ROOT_FIRST) && \
((unsigned int)(h) <= HKEY_SPECIAL_ROOT_LAST))

View File

@ -72,7 +72,7 @@ struct sock
struct event *event; /* event object */
user_handle_t window; /* window to send the message to */
unsigned int message; /* message to send */
unsigned int wparam; /* message wparam (socket handle) */
obj_handle_t wparam; /* message wparam (socket handle) */
int errors[FD_MAX_EVENTS]; /* event errors */
struct sock* deferred; /* socket that waits for a deferred accept */
struct async_queue read_q; /* Queue for asynchronous reads */
@ -260,7 +260,7 @@ static void sock_wake_up( struct sock *sock, int pollev )
if (sock->pmask & (1 << event))
{
unsigned int lparam = (1 << event) | (sock->errors[event] << 16);
post_message( sock->window, sock->message, sock->wparam, lparam );
post_message( sock->window, sock->message, (unsigned int)sock->wparam, lparam );
}
}
sock->pmask = 0;

View File

@ -195,7 +195,7 @@ HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
{
FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
nMaxMessageSize, lReadTimeout, sa);
return 1;
return (HANDLE)1;
}
@ -217,7 +217,7 @@ HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
{
FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName),
nMaxMessageSize, lReadTimeout, sa);
return 1;
return (HANDLE)1;
}