[4/5] ntdll: Fix compilation warnings in 64-bit mode

Dmitry Timoshkov dmitry at codeweavers.com
Wed May 23 02:36:29 CDT 2007


Hello,

ntdll should be completely 64-bit clean now.

Changelog:
    ntdll: Fix compilation warnings in 64-bit mode.

---
 dlls/ntdll/critsection.c |   12 +++++-----
 dlls/ntdll/heap.c        |    2 +-
 dlls/ntdll/loader.c      |    4 +-
 dlls/ntdll/ntdll_misc.h  |    4 +-
 dlls/ntdll/process.c     |    2 +-
 dlls/ntdll/reg.c         |    2 +-
 dlls/ntdll/rtl.c         |    8 +++---
 dlls/ntdll/sec.c         |   48 ++++++++++++++++++++++-----------------------
 dlls/ntdll/server.c      |    4 +-
 dlls/ntdll/sync.c        |    2 +-
 dlls/ntdll/thread.c      |   14 ++++++------
 dlls/ntdll/virtual.c     |    4 +-
 12 files changed, 52 insertions(+), 54 deletions(-)

diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index e3fb88e..90626db 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -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++;
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 06bbbc0..cbbcf0a 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -92,7 +92,7 @@ typedef struct tagARENA_FREE
 /* Max size of the blocks on the free lists */
 static const DWORD HEAP_freeListSizes[] =
 {
-    0x10, 0x20, 0x30, 0x40, 0x60, 0x80, 0x100, 0x200, 0x400, 0x1000, ~0UL
+    0x10, 0x20, 0x30, 0x40, 0x60, 0x80, 0x100, 0x200, 0x400, 0x1000, ~0U
 };
 #define HEAP_NB_FREE_LISTS  (sizeof(HEAP_freeListSizes)/sizeof(HEAP_freeListSizes[0]))
 
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 0f50653..77e5308 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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 );
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index c6ef77c..c7eb5ed 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -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, 
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 39ca74a..724c081 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -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 );
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 2127888..d03925f 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -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;
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index f1b5c0d..1390c64 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -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
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index ee1d9b2..c417de8 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -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;
     }
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index e2d5d7c..29c9cfd 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -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;
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 03f3a73..ca0605e 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -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:
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index c97ecd3..b100608 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -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 */
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5b9ec31..5964258 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -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;
         }
-- 
1.5.1.6






More information about the wine-patches mailing list