Commit e142779b authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ntdll: Fix compilation warnings in 64-bit mode.

parent 4d0d9fcb
......@@ -398,12 +398,12 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
if (crit->DebugInfo) name = (char *)crit->DebugInfo->Spare[0];
if (!name) name = "?";
ERR( "section %p %s wait timed out in thread %04x, blocked by %04x, retrying (60 sec)\n",
crit, debugstr_a(name), GetCurrentThreadId(), (DWORD)crit->OwningThread );
crit, debugstr_a(name), GetCurrentThreadId(), HandleToULong(crit->OwningThread) );
status = wait_semaphore( crit, 60 );
if ( status == STATUS_TIMEOUT && TRACE_ON(relay) )
{
ERR( "section %p %s wait timed out in thread %04x, blocked by %04x, retrying (5 min)\n",
crit, debugstr_a(name), GetCurrentThreadId(), (DWORD) crit->OwningThread );
crit, debugstr_a(name), GetCurrentThreadId(), HandleToULong(crit->OwningThread) );
status = wait_semaphore( crit, 300 );
}
}
......@@ -498,7 +498,7 @@ NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
if (interlocked_inc( &crit->LockCount ))
{
if (crit->OwningThread == (HANDLE)GetCurrentThreadId())
if (crit->OwningThread == ULongToHandle(GetCurrentThreadId()))
{
crit->RecursionCount++;
return STATUS_SUCCESS;
......@@ -508,7 +508,7 @@ NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
RtlpWaitForCriticalSection( crit );
}
done:
crit->OwningThread = (HANDLE)GetCurrentThreadId();
crit->OwningThread = ULongToHandle(GetCurrentThreadId());
crit->RecursionCount = 1;
return STATUS_SUCCESS;
}
......@@ -536,11 +536,11 @@ BOOL WINAPI RtlTryEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
BOOL ret = FALSE;
if (interlocked_cmpxchg( (int *)&crit->LockCount, 0, -1 ) == -1)
{
crit->OwningThread = (HANDLE)GetCurrentThreadId();
crit->OwningThread = ULongToHandle(GetCurrentThreadId());
crit->RecursionCount = 1;
ret = TRUE;
}
else if (crit->OwningThread == (HANDLE)GetCurrentThreadId())
else if (crit->OwningThread == ULongToHandle(GetCurrentThreadId()))
{
interlocked_inc( &crit->LockCount );
crit->RecursionCount++;
......
......@@ -90,7 +90,7 @@ typedef struct tagARENA_FREE
#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(ARENA_FREE))
/* Max size of the blocks on the free lists */
static const DWORD HEAP_freeListSizes[] =
static const SIZE_T HEAP_freeListSizes[] =
{
0x10, 0x20, 0x30, 0x40, 0x60, 0x80, 0x100, 0x200, 0x400, 0x1000, ~0UL
};
......@@ -236,7 +236,7 @@ static void HEAP_Dump( HEAP *heap )
DPRINTF( "\nFree lists:\n Block Stat Size Id\n" );
for (i = 0; i < HEAP_NB_FREE_LISTS; i++)
DPRINTF( "%p free %08x prev=%p next=%p\n",
DPRINTF( "%p free %08lx prev=%p next=%p\n",
&heap->freeList[i].arena, HEAP_freeListSizes[i],
LIST_ENTRY( heap->freeList[i].arena.entry.prev, ARENA_FREE, entry ),
LIST_ENTRY( heap->freeList[i].arena.entry.next, ARENA_FREE, entry ));
......
......@@ -516,7 +516,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d
{
int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal);
WARN("No implementation for %s.%d", name, ordinal );
thunk_list->u1.Function = allocate_stub( name, (const char *)ordinal );
thunk_list->u1.Function = allocate_stub( name, IntToPtr(ordinal) );
}
else
{
......@@ -543,7 +543,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d
ordinal - exports->Base );
if (!thunk_list->u1.Function)
{
thunk_list->u1.Function = allocate_stub( name, (const char *)ordinal );
thunk_list->u1.Function = allocate_stub( name, IntToPtr(ordinal) );
WARN("No implementation for %s.%d imported from %s, setting to %p\n",
name, ordinal, debugstr_w(current_modref->ldr.FullDllName.Buffer),
(void *)thunk_list->u1.Function );
......
......@@ -80,8 +80,8 @@ extern UNICODE_STRING system_dir;
/* redefine these to make sure we don't reference kernel symbols */
#define GetProcessHeap() (NtCurrentTeb()->Peb->ProcessHeap)
#define GetCurrentProcessId() ((DWORD)NtCurrentTeb()->ClientId.UniqueProcess)
#define GetCurrentThreadId() ((DWORD)NtCurrentTeb()->ClientId.UniqueThread)
#define GetCurrentProcessId() (HandleToULong(NtCurrentTeb()->ClientId.UniqueProcess))
#define GetCurrentThreadId() (HandleToULong(NtCurrentTeb()->ClientId.UniqueThread))
/* Device IO */
extern NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
......
......@@ -386,7 +386,7 @@ NTSTATUS WINAPI NtOpenProcess(PHANDLE handle, ACCESS_MASK access,
SERVER_START_REQ( open_process )
{
req->pid = (process_id_t)cid->UniqueProcess;
req->pid = HandleToULong(cid->UniqueProcess);
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
status = wine_server_call( req );
......
......@@ -1148,7 +1148,7 @@ NTSTATUS WINAPI RtlQueryRegistryValues(IN ULONG RelativeTo, IN PCWSTR Path,
if (QueryTable->Flags & RTL_QUERY_REGISTRY_SUBKEY)
{
handle = 0;
status = RTL_GetKeyHandle((ULONG)QueryTable->Name, Path, &handle);
status = RTL_GetKeyHandle(PtrToUlong(QueryTable->Name), Path, &handle);
if(status != STATUS_SUCCESS)
{
ret = status;
......
......@@ -164,7 +164,7 @@ start:
}
else if( rwl->iNumberActive < 0 ) /* exclusive lock in progress */
{
if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() )
if( rwl->hOwningThreadId == ULongToHandle(GetCurrentThreadId()) )
{
retVal = 1;
rwl->iNumberActive--;
......@@ -189,7 +189,7 @@ wait:
goto wait;
if( retVal == 1 )
rwl->hOwningThreadId = (HANDLE)GetCurrentThreadId();
rwl->hOwningThreadId = ULongToHandle(GetCurrentThreadId());
done:
RtlLeaveCriticalSection( &rwl->rtlCS );
return retVal;
......@@ -208,7 +208,7 @@ start:
RtlEnterCriticalSection( &rwl->rtlCS );
if( rwl->iNumberActive < 0 )
{
if( rwl->hOwningThreadId == (HANDLE)GetCurrentThreadId() )
if( rwl->hOwningThreadId == ULongToHandle(GetCurrentThreadId()) )
{
rwl->iNumberActive--;
retVal = 1;
......@@ -945,7 +945,7 @@ WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER ListHeader)
TRACE("(%p)\n", ListHeader);
#ifdef _WIN64
FIXME("stub\n");
return NULL;
return 0;
#else
return ListHeader->s.Depth;
#endif
......
......@@ -460,7 +460,7 @@ NTSTATUS WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR pSourceSD, PSECUR
if (isSelfRelative)
{
destSD->Owner = srcSD->Owner;
RtlCopySid(length, (LPBYTE)destSD + (DWORD)destSD->Owner, Owner);
RtlCopySid(length, (LPBYTE)destSD + (DWORD_PTR)destSD->Owner, Owner);
}
else
{
......@@ -475,7 +475,7 @@ NTSTATUS WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR pSourceSD, PSECUR
if (isSelfRelative)
{
destSD->Group = srcSD->Group;
RtlCopySid(length, (LPBYTE)destSD + (DWORD)destSD->Group, Group);
RtlCopySid(length, (LPBYTE)destSD + (DWORD_PTR)destSD->Group, Group);
}
else
{
......@@ -492,7 +492,7 @@ NTSTATUS WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR pSourceSD, PSECUR
if (isSelfRelative)
{
destSD->Dacl = srcSD->Dacl;
copy_acl(length, (PACL)((LPBYTE)destSD + (DWORD)destSD->Dacl), Dacl);
copy_acl(length, (PACL)((LPBYTE)destSD + (DWORD_PTR)destSD->Dacl), Dacl);
}
else
{
......@@ -510,7 +510,7 @@ NTSTATUS WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR pSourceSD, PSECUR
if (isSelfRelative)
{
destSD->Sacl = srcSD->Sacl;
copy_acl(length, (PACL)((LPBYTE)destSD + (DWORD)destSD->Sacl), Sacl);
copy_acl(length, (PACL)((LPBYTE)destSD + (DWORD_PTR)destSD->Sacl), Sacl);
}
else
{
......@@ -552,14 +552,14 @@ ULONG WINAPI RtlLengthSecurityDescriptor(
PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
ULONG offset = 0;
ULONG_PTR offset = 0;
ULONG Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
if ( lpsd == NULL )
return 0;
if ( lpsd->Control & SE_SELF_RELATIVE)
offset = (ULONG) lpsd;
offset = (ULONG_PTR) lpsd;
if ( lpsd->Owner != NULL )
Size += RtlLengthSid((PSID)((LPBYTE)lpsd->Owner + offset));
......@@ -599,7 +599,7 @@ NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(
if ( (*lpbDaclPresent = (SE_DACL_PRESENT & lpsd->Control) ? 1 : 0) )
{
if ( SE_SELF_RELATIVE & lpsd->Control)
*pDacl = (PACL) ((LPBYTE)lpsd + (DWORD)lpsd->Dacl);
*pDacl = (PACL) ((LPBYTE)lpsd + (DWORD_PTR)lpsd->Dacl);
else
*pDacl = lpsd->Dacl;
......@@ -662,7 +662,7 @@ NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(
if ( (*lpbSaclPresent = (SE_SACL_PRESENT & lpsd->Control) ? 1 : 0) )
{
if (SE_SELF_RELATIVE & lpsd->Control)
*pSacl = (PACL) ((LPBYTE)lpsd + (DWORD)lpsd->Sacl);
*pSacl = (PACL) ((LPBYTE)lpsd + (DWORD_PTR)lpsd->Sacl);
else
*pSacl = lpsd->Sacl;
......@@ -716,8 +716,7 @@ NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
if (lpsd->Owner != NULL)
{
if (lpsd->Control & SE_SELF_RELATIVE)
*Owner = (PSID)((LPBYTE)lpsd +
(ULONG)lpsd->Owner);
*Owner = (PSID)((LPBYTE)lpsd + (ULONG_PTR)lpsd->Owner);
else
*Owner = lpsd->Owner;
......@@ -794,8 +793,7 @@ NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
if (lpsd->Group != NULL)
{
if (lpsd->Control & SE_SELF_RELATIVE)
*Group = (PSID)((LPBYTE)lpsd +
(ULONG)lpsd->Group);
*Group = (PSID)((LPBYTE)lpsd + (ULONG_PTR)lpsd->Group);
else
*Group = lpsd->Group;
......@@ -818,7 +816,7 @@ NTSTATUS WINAPI RtlMakeSelfRelativeSD(
IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
IN OUT LPDWORD lpdwBufferLength)
{
ULONG offsetRel;
ULONG_PTR offsetRel;
ULONG length;
SECURITY_DESCRIPTOR* pAbs = pAbsoluteSecurityDescriptor;
SECURITY_DESCRIPTOR* pRel = pSelfRelativeSecurityDescriptor;
......@@ -924,30 +922,30 @@ NTSTATUS WINAPI RtlSelfRelativeToAbsoluteSD(
}
if (pRel->Control & SE_DACL_PRESENT &&
*lpdwDaclSize < ((PACL)((LPBYTE)pRel->Dacl + (ULONG)pRel))->AclSize)
*lpdwDaclSize < ((PACL)((LPBYTE)pRel->Dacl + (ULONG_PTR)pRel))->AclSize)
{
*lpdwDaclSize = ((PACL)((LPBYTE)pRel->Dacl + (ULONG)pRel))->AclSize;
*lpdwDaclSize = ((PACL)((LPBYTE)pRel->Dacl + (ULONG_PTR)pRel))->AclSize;
status = STATUS_BUFFER_TOO_SMALL;
}
if (pRel->Control & SE_SACL_PRESENT &&
*lpdwSaclSize < ((PACL)((LPBYTE)pRel->Sacl + (ULONG)pRel))->AclSize)
*lpdwSaclSize < ((PACL)((LPBYTE)pRel->Sacl + (ULONG_PTR)pRel))->AclSize)
{
*lpdwSaclSize = ((PACL)((LPBYTE)pRel->Sacl + (ULONG)pRel))->AclSize;
*lpdwSaclSize = ((PACL)((LPBYTE)pRel->Sacl + (ULONG_PTR)pRel))->AclSize;
status = STATUS_BUFFER_TOO_SMALL;
}
if (pRel->Owner &&
*lpdwOwnerSize < RtlLengthSid((PSID)((LPBYTE)pRel->Owner + (ULONG)pRel)))
*lpdwOwnerSize < RtlLengthSid((PSID)((LPBYTE)pRel->Owner + (ULONG_PTR)pRel)))
{
*lpdwOwnerSize = RtlLengthSid((PSID)((LPBYTE)pRel->Owner + (ULONG)pRel));
*lpdwOwnerSize = RtlLengthSid((PSID)((LPBYTE)pRel->Owner + (ULONG_PTR)pRel));
status = STATUS_BUFFER_TOO_SMALL;
}
if (pRel->Group &&
*lpdwPrimaryGroupSize < RtlLengthSid((PSID)((LPBYTE)pRel->Group + (ULONG)pRel)))
*lpdwPrimaryGroupSize < RtlLengthSid((PSID)((LPBYTE)pRel->Group + (ULONG_PTR)pRel)))
{
*lpdwPrimaryGroupSize = RtlLengthSid((PSID)((LPBYTE)pRel->Group + (ULONG)pRel));
*lpdwPrimaryGroupSize = RtlLengthSid((PSID)((LPBYTE)pRel->Group + (ULONG_PTR)pRel));
status = STATUS_BUFFER_TOO_SMALL;
}
......@@ -964,7 +962,7 @@ NTSTATUS WINAPI RtlSelfRelativeToAbsoluteSD(
if (pRel->Control & SE_SACL_PRESENT)
{
PACL pAcl = (PACL)((LPBYTE)pRel->Sacl + (ULONG)pRel);
PACL pAcl = (PACL)((LPBYTE)pRel->Sacl + (ULONG_PTR)pRel);
memcpy(pSacl, pAcl, pAcl->AclSize);
pAbs->Sacl = pSacl;
......@@ -972,21 +970,21 @@ NTSTATUS WINAPI RtlSelfRelativeToAbsoluteSD(
if (pRel->Control & SE_DACL_PRESENT)
{
PACL pAcl = (PACL)((LPBYTE)pRel->Dacl + (ULONG)pRel);
PACL pAcl = (PACL)((LPBYTE)pRel->Dacl + (ULONG_PTR)pRel);
memcpy(pDacl, pAcl, pAcl->AclSize);
pAbs->Dacl = pDacl;
}
if (pRel->Owner)
{
PSID psid = (PSID)((LPBYTE)pRel->Owner + (ULONG)pRel);
PSID psid = (PSID)((LPBYTE)pRel->Owner + (ULONG_PTR)pRel);
memcpy(pOwner, psid, RtlLengthSid(psid));
pAbs->Owner = pOwner;
}
if (pRel->Group)
{
PSID psid = (PSID)((LPBYTE)pRel->Group + (ULONG)pRel);
PSID psid = (PSID)((LPBYTE)pRel->Group + (ULONG_PTR)pRel);
memcpy(pPrimaryGroup, psid, RtlLengthSid(psid));
pAbs->Group = pPrimaryGroup;
}
......
......@@ -1123,8 +1123,8 @@ size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point )
req->wait_fd = ntdll_get_thread_data()->wait_fd[1];
req->debug_level = (TRACE_ON(server) != 0);
ret = wine_server_call( req );
NtCurrentTeb()->ClientId.UniqueProcess = (HANDLE)reply->pid;
NtCurrentTeb()->ClientId.UniqueThread = (HANDLE)reply->tid;
NtCurrentTeb()->ClientId.UniqueProcess = ULongToHandle(reply->pid);
NtCurrentTeb()->ClientId.UniqueThread = ULongToHandle(reply->tid);
info_size = reply->info_size;
version = reply->version;
server_start_time = reply->server_start;
......
......@@ -778,7 +778,7 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
call->create_thread.func,
call->create_thread.arg,
&result->create_thread.handle, &id );
result->create_thread.tid = (thread_id_t)id.UniqueThread;
result->create_thread.tid = HandleToULong(id.UniqueThread);
break;
}
default:
......
......@@ -522,7 +522,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
if (result.create_thread.status == STATUS_SUCCESS)
{
if (id) id->UniqueThread = (HANDLE)result.create_thread.tid;
if (id) id->UniqueThread = ULongToHandle(result.create_thread.tid);
if (handle_ptr) *handle_ptr = result.create_thread.handle;
else NtClose( result.create_thread.handle );
}
......@@ -567,8 +567,8 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
info->pthread_info.teb_size = size;
if ((status = init_teb( teb ))) goto error;
teb->ClientId.UniqueProcess = (HANDLE)GetCurrentProcessId();
teb->ClientId.UniqueThread = (HANDLE)tid;
teb->ClientId.UniqueProcess = ULongToHandle(GetCurrentProcessId());
teb->ClientId.UniqueThread = ULongToHandle(tid);
thread_data = (struct ntdll_thread_data *)teb->SystemReserved2;
thread_regs = (struct ntdll_thread_regs *)teb->SpareBytes1;
......@@ -609,7 +609,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
}
pthread_functions.sigprocmask( SIG_SETMASK, &sigset, NULL );
if (id) id->UniqueThread = (HANDLE)tid;
if (id) id->UniqueThread = ULongToHandle(tid);
if (handle_ptr) *handle_ptr = handle;
else NtClose( handle );
......@@ -650,7 +650,7 @@ NTSTATUS WINAPI NtOpenThread( HANDLE *handle, ACCESS_MASK access,
SERVER_START_REQ( open_thread )
{
req->tid = (thread_id_t)id->UniqueThread;
req->tid = HandleToULong(id->UniqueThread);
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
ret = wine_server_call( req );
......@@ -1173,8 +1173,8 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
{
info.ExitStatus = reply->exit_code;
info.TebBaseAddress = reply->teb;
info.ClientId.UniqueProcess = (HANDLE)reply->pid;
info.ClientId.UniqueThread = (HANDLE)reply->tid;
info.ClientId.UniqueProcess = ULongToHandle(reply->pid);
info.ClientId.UniqueThread = ULongToHandle(reply->tid);
info.AffinityMask = reply->affinity;
info.Priority = reply->priority;
info.BasePriority = reply->priority; /* FIXME */
......
......@@ -1149,8 +1149,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
if (nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)
{
WARN( "Need to relocate module from addr %x, but there are no relocation records\n",
nt->OptionalHeader.ImageBase );
WARN( "Need to relocate module from addr %lx, but there are no relocation records\n",
(ULONG_PTR)nt->OptionalHeader.ImageBase );
status = STATUS_CONFLICTING_ADDRESSES;
goto error;
}
......
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