Use SIZE_T type for size variables in NTDLL when appropriate.

This commit is contained in:
Dmitry Timoshkov 2005-07-15 10:01:30 +00:00 committed by Alexandre Julliard
parent 6ea26b50a9
commit 1dc18952ae
6 changed files with 79 additions and 74 deletions

View File

@ -242,7 +242,7 @@ SIZE_T WINAPI VirtualQueryEx(
PMEMORY_BASIC_INFORMATION info, /* [out] Address of info buffer */
SIZE_T len /* [in] Size of buffer */ )
{
DWORD ret;
SIZE_T ret;
NTSTATUS status;
if ((status = NtQueryVirtualMemory( process, addr, MemoryBasicInformation, info, len, &ret )))

View File

@ -48,6 +48,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(heap);
* require it.
*/
/* FIXME: use SIZE_T for 'size' structure members, but we need to make sure
* that there is no unaligned accesses to structure fields.
*/
typedef struct tagARENA_INUSE
{
DWORD size; /* Block size; must be the first field */
@ -129,7 +133,7 @@ static HEAP *firstHeap; /* head of secondary heaps list */
static BOOL HEAP_IsRealArena( HEAP *heapPtr, DWORD flags, LPCVOID block, BOOL quiet );
/* mark a block of memory as free for debugging purposes */
static inline void mark_block_free( void *ptr, size_t size )
static inline void mark_block_free( void *ptr, SIZE_T size )
{
if (TRACE_ON(heap)) memset( ptr, ARENA_FREE_FILLER, size );
#ifdef VALGRIND_MAKE_NOACCESS
@ -138,7 +142,7 @@ static inline void mark_block_free( void *ptr, size_t size )
}
/* mark a block of memory as initialized for debugging purposes */
static inline void mark_block_initialized( void *ptr, size_t size )
static inline void mark_block_initialized( void *ptr, SIZE_T size )
{
#ifdef VALGRIND_MAKE_READABLE
VALGRIND_DISCARD( VALGRIND_MAKE_READABLE( ptr, size ));
@ -146,7 +150,7 @@ static inline void mark_block_initialized( void *ptr, size_t size )
}
/* mark a block of memory as uninitialized for debugging purposes */
static inline void mark_block_uninitialized( void *ptr, size_t size )
static inline void mark_block_uninitialized( void *ptr, SIZE_T size )
{
#ifdef VALGRIND_MAKE_WRITABLE
VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size ));
@ -162,7 +166,7 @@ static inline void mark_block_uninitialized( void *ptr, size_t size )
}
/* clear contents of a block of memory */
static inline void clear_block( void *ptr, size_t size )
static inline void clear_block( void *ptr, SIZE_T size )
{
mark_block_initialized( ptr, size );
memset( ptr, 0, size );
@ -197,7 +201,7 @@ static void HEAP_Dump( HEAP *heap )
subheap = &heap->subheap;
while (subheap)
{
DWORD freeSize = 0, usedSize = 0, arenaSize = subheap->headerSize;
SIZE_T freeSize = 0, usedSize = 0, arenaSize = subheap->headerSize;
DPRINTF( "\n\nSub-heap %08lx: size=%08lx committed=%08lx\n",
(DWORD)subheap, subheap->size, subheap->commitSize );
@ -369,7 +373,7 @@ static SUBHEAP *HEAP_FindSubHeap(
*/
static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
{
DWORD size = (DWORD)((char *)ptr - (char *)subheap);
SIZE_T size = (SIZE_T)((char *)ptr - (char *)subheap);
size = (size + COMMIT_MASK) & ~COMMIT_MASK;
if (size > subheap->size) size = subheap->size;
if (size <= subheap->commitSize) return TRUE;
@ -395,9 +399,9 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
{
void *addr;
ULONG decommit_size;
SIZE_T decommit_size;
SIZE_T size = (SIZE_T)((char *)ptr - (char *)subheap);
DWORD size = (DWORD)((char *)ptr - (char *)subheap);
/* round to next block and add one full block */
size = ((size + COMMIT_MASK) & ~COMMIT_MASK) + COMMIT_MASK + 1;
if (size >= subheap->commitSize) return TRUE;
@ -421,7 +425,7 @@ static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
* Create a free block at a specified address. 'size' is the size of the
* whole block, including the new arena.
*/
static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, DWORD size )
static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, SIZE_T size )
{
ARENA_FREE *pFree;
char *pEnd;
@ -478,7 +482,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, DWORD size )
static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
{
ARENA_FREE *pFree;
DWORD size = (pArena->size & ARENA_SIZE_MASK) + sizeof(*pArena);
SIZE_T size = (pArena->size & ARENA_SIZE_MASK) + sizeof(*pArena);
/* Check if we can merge with previous block */
@ -504,7 +508,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
if (((char *)pFree == (char *)subheap + subheap->headerSize) &&
(subheap != &subheap->heap->subheap))
{
ULONG size = 0;
SIZE_T size = 0;
SUBHEAP *pPrev = &subheap->heap->subheap;
/* Remove the free block from the list */
pFree->next->prev = pFree->prev;
@ -529,7 +533,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
*
* Shrink an in-use block.
*/
static void HEAP_ShrinkBlock(SUBHEAP *subheap, ARENA_INUSE *pArena, DWORD size)
static void HEAP_ShrinkBlock(SUBHEAP *subheap, ARENA_INUSE *pArena, SIZE_T size)
{
if ((pArena->size & ARENA_SIZE_MASK) >= size + HEAP_MIN_BLOCK_SIZE)
{
@ -551,7 +555,7 @@ static void HEAP_ShrinkBlock(SUBHEAP *subheap, ARENA_INUSE *pArena, DWORD size)
* HEAP_InitSubHeap
*/
static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
DWORD commitSize, DWORD totalSize )
SIZE_T commitSize, SIZE_T totalSize )
{
SUBHEAP *subheap;
FREE_LIST_ENTRY *pEntry;
@ -637,7 +641,7 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
* If heap == NULL, creates a main heap.
*/
static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
DWORD commitSize, DWORD totalSize )
SIZE_T commitSize, SIZE_T totalSize )
{
LPVOID address = base;
@ -663,7 +667,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
if (!HEAP_InitSubHeap( heap ? heap : (HEAP *)address,
address, flags, commitSize, totalSize ))
{
ULONG size = 0;
SIZE_T size = 0;
if (!base) NtFreeVirtualMemory( NtCurrentProcess(), &address, &size, MEM_RELEASE );
return NULL;
}
@ -678,7 +682,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
* Find a free block at least as large as the requested size, and make sure
* the requested size is committed.
*/
static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
SUBHEAP **ppSubHeap )
{
SUBHEAP *subheap;
@ -691,7 +695,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
pArena = pEntry->arena.next;
while (pArena != &heap->freeList[0].arena)
{
DWORD arena_size = (pArena->size & ARENA_SIZE_MASK) +
SIZE_T arena_size = (pArena->size & ARENA_SIZE_MASK) +
sizeof(ARENA_FREE) - sizeof(ARENA_INUSE);
if (arena_size >= size)
{
@ -757,7 +761,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
char *heapEnd = (char *)subheap + subheap->size;
/* Check for unaligned pointers */
if ( (long)pArena % ALIGNMENT != 0 )
if ( (ULONG_PTR)pArena % ALIGNMENT != 0 )
{
ERR( "Heap %08lx: unaligned arena pointer %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena );
@ -777,6 +781,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
{
ERR("Heap %08lx: bad flags %lx for free arena %08lx\n",
(DWORD)subheap->heap, pArena->size & ~ARENA_SIZE_MASK, (DWORD)pArena );
return FALSE;
}
/* Check arena size */
if ((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) > heapEnd)
@ -849,7 +854,7 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
const char *heapEnd = (const char *)subheap + subheap->size;
/* Check for unaligned pointers */
if ( (long)pArena % ALIGNMENT != 0 )
if ( (ULONG_PTR)pArena % ALIGNMENT != 0 )
{
if ( quiet == NOISY )
{
@ -1035,7 +1040,7 @@ static BOOL HEAP_IsRealArena( HEAP *heapPtr, /* [in] ptr to the heap */
* Success: A HANDLE to the newly created heap.
* Failure: a NULL HANDLE.
*/
HANDLE WINAPI RtlCreateHeap( ULONG flags, PVOID addr, ULONG totalSize, ULONG commitSize,
HANDLE WINAPI RtlCreateHeap( ULONG flags, PVOID addr, SIZE_T totalSize, SIZE_T commitSize,
PVOID unknown, PRTL_HEAP_DEFINITION definition )
{
SUBHEAP *subheap;
@ -1101,7 +1106,7 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
while (subheap)
{
SUBHEAP *next = subheap->next;
ULONG size = 0;
SIZE_T size = 0;
void *addr = subheap;
NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE );
subheap = next;
@ -1127,13 +1132,13 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
* NOTES
* This call does not SetLastError().
*/
PVOID WINAPI RtlAllocateHeap( HANDLE heap, ULONG flags, ULONG size )
PVOID WINAPI RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_T size )
{
ARENA_FREE *pArena;
ARENA_INUSE *pInUse;
SUBHEAP *subheap;
HEAP *heapPtr = HEAP_GetPtr( heap );
ULONG rounded_size;
SIZE_T rounded_size;
/* Validate the parameters */
@ -1259,13 +1264,12 @@ BOOLEAN WINAPI RtlFreeHeap( HANDLE heap, ULONG flags, PVOID ptr )
* Success: A pointer to the resized block (which may be different).
* Failure: NULL.
*/
PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, ULONG size )
PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size )
{
ARENA_INUSE *pArena;
DWORD oldSize;
HEAP *heapPtr;
SUBHEAP *subheap;
ULONG rounded_size;
SIZE_T oldSize, rounded_size;
if (!ptr) return NULL;
if (!(heapPtr = HEAP_GetPtr( heap )))
@ -1460,15 +1464,15 @@ BOOLEAN WINAPI RtlUnlockHeap( HANDLE heap )
* NOTES
* The size may be bigger than what was passed to RtlAllocateHeap().
*/
ULONG WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, PVOID ptr )
SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, PVOID ptr )
{
DWORD ret;
SIZE_T ret;
HEAP *heapPtr = HEAP_GetPtr( heap );
if (!heapPtr)
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE );
return (ULONG)-1;
return ~0UL;
}
flags &= HEAP_NO_SERIALIZE;
flags |= heapPtr->flags;
@ -1476,7 +1480,7 @@ ULONG WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, PVOID ptr )
if (!HEAP_IsRealArena( heapPtr, HEAP_NO_SERIALIZE, ptr, QUIET ))
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
ret = (ULONG)-1;
ret = ~0UL;
}
else
{
@ -1640,7 +1644,7 @@ HW_end:
*/
ULONG WINAPI RtlGetProcessHeaps( ULONG count, HANDLE *heaps )
{
DWORD total;
ULONG total;
HEAP *ptr;
if (!processHeap) return 0; /* should never happen */

View File

@ -305,7 +305,7 @@ NTSTATUS WINAPI NtSetInformationProcess(
NTSTATUS WINAPI NtFlushInstructionCache(
IN HANDLE ProcessHandle,
IN LPCVOID BaseAddress,
IN ULONG Size)
IN SIZE_T Size)
{
#ifdef __i386__
TRACE("%p %p %ld - no-op on x86\n", ProcessHandle, BaseAddress, Size );

View File

@ -67,7 +67,7 @@ typedef struct file_view
{
struct list entry; /* Entry in global view list */
void *base; /* Base address */
UINT size; /* Size in bytes */
size_t size; /* Size in bytes */
HANDLE mapping; /* Handle to the file mapping */
BYTE flags; /* Allocation flags (VFLAG_*) */
BYTE protect; /* Protection for all pages at allocation time */
@ -532,7 +532,7 @@ static BYTE VIRTUAL_GetProt( DWORD protect )
*/
static BOOL VIRTUAL_SetProt( FILE_VIEW *view, /* [in] Pointer to view */
void *base, /* [in] Starting address */
UINT size, /* [in] Size in bytes */
size_t size, /* [in] Size in bytes */
BYTE vprot ) /* [in] Protections to use */
{
TRACE("%p-%p %s\n",
@ -611,9 +611,9 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
/* Release the extra memory while keeping the range
* starting on the granularity boundary. */
if ((unsigned int)ptr & granularity_mask)
if ((ULONG_PTR)ptr & granularity_mask)
{
unsigned int extra = granularity_mask + 1 - ((unsigned int)ptr & granularity_mask);
size_t extra = granularity_mask + 1 - ((ULONG_PTR)ptr & granularity_mask);
munmap( ptr, extra );
ptr = (char *)ptr + extra;
view_size -= extra;
@ -753,7 +753,7 @@ static NTSTATUS decommit_pages( struct file_view *view, size_t start, size_t siz
* Apply the relocations to a mapped PE image
*/
static int do_relocations( char *base, const IMAGE_DATA_DIRECTORY *dir,
int delta, DWORD total_size )
int delta, SIZE_T total_size )
{
IMAGE_BASE_RELOCATION *rel;
@ -816,8 +816,8 @@ static int do_relocations( char *base, const IMAGE_DATA_DIRECTORY *dir,
*
* Map an executable (PE format) image into memory.
*/
static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, DWORD total_size,
DWORD header_size, int shared_fd, BOOL removable, PVOID *addr_ptr )
static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_size,
SIZE_T header_size, int shared_fd, BOOL removable, PVOID *addr_ptr )
{
IMAGE_DOS_HEADER *dos;
IMAGE_NT_HEADERS *nt;
@ -920,7 +920,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, DWORD total_size
for (i = pos = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
{
DWORD size;
SIZE_T size;
/* a few sanity checks */
size = sec->VirtualAddress + ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
@ -1031,7 +1031,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, DWORD total_size
sec = (IMAGE_SECTION_HEADER*)((char *)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader);
for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
{
DWORD size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
SIZE_T size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
BYTE vprot = VPROT_COMMITTED;
if (sec->Characteristics & IMAGE_SCN_MEM_READ) vprot |= VPROT_READ;
if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_READ|VPROT_WRITECOPY;
@ -1158,11 +1158,11 @@ void VIRTUAL_UseLargeAddressSpace(void)
* ZwAllocateVirtualMemory (NTDLL.@)
*/
NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_bits,
ULONG *size_ptr, ULONG type, ULONG protect )
SIZE_T *size_ptr, ULONG type, ULONG protect )
{
void *base;
BYTE vprot;
DWORD size = *size_ptr;
SIZE_T size = *size_ptr;
NTSTATUS status = STATUS_SUCCESS;
struct file_view *view;
@ -1267,13 +1267,13 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_
* NtFreeVirtualMemory (NTDLL.@)
* ZwFreeVirtualMemory (NTDLL.@)
*/
NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *size_ptr, ULONG type )
NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr, ULONG type )
{
FILE_VIEW *view;
char *base;
NTSTATUS status = STATUS_SUCCESS;
LPVOID addr = *addr_ptr;
DWORD size = *size_ptr;
SIZE_T size = *size_ptr;
TRACE("%p %p %08lx %lx\n", process, addr, size, type );
@ -1340,7 +1340,7 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *siz
* NtProtectVirtualMemory (NTDLL.@)
* ZwProtectVirtualMemory (NTDLL.@)
*/
NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *size_ptr,
NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr,
ULONG new_prot, ULONG *old_prot )
{
FILE_VIEW *view;
@ -1348,7 +1348,8 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *
char *base;
UINT i;
BYTE vprot, *p;
DWORD prot, size = *size_ptr;
ULONG prot;
SIZE_T size = *size_ptr;
LPVOID addr = *addr_ptr;
TRACE("%p %p %08lx %08lx\n", process, addr, size, new_prot );
@ -1412,12 +1413,12 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *
*/
NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
MEMORY_INFORMATION_CLASS info_class, PVOID buffer,
ULONG len, ULONG *res_len )
SIZE_T len, SIZE_T *res_len )
{
FILE_VIEW *view;
char *base, *alloc_base = 0;
struct list *ptr;
UINT size = 0;
SIZE_T size = 0;
MEMORY_BASIC_INFORMATION *info = buffer;
if (info_class != MemoryBasicInformation)
@ -1519,7 +1520,7 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
* NtLockVirtualMemory (NTDLL.@)
* ZwLockVirtualMemory (NTDLL.@)
*/
NTSTATUS WINAPI NtLockVirtualMemory( HANDLE process, PVOID *addr, ULONG *size, ULONG unknown )
NTSTATUS WINAPI NtLockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *size, ULONG unknown )
{
if (!is_current_process( process ))
{
@ -1534,7 +1535,7 @@ NTSTATUS WINAPI NtLockVirtualMemory( HANDLE process, PVOID *addr, ULONG *size, U
* NtUnlockVirtualMemory (NTDLL.@)
* ZwUnlockVirtualMemory (NTDLL.@)
*/
NTSTATUS WINAPI NtUnlockVirtualMemory( HANDLE process, PVOID *addr, ULONG *size, ULONG unknown )
NTSTATUS WINAPI NtUnlockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *size, ULONG unknown )
{
if (!is_current_process( process ))
{
@ -1617,13 +1618,13 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_
* ZwMapViewOfSection (NTDLL.@)
*/
NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_ptr, ULONG zero_bits,
ULONG commit_size, const LARGE_INTEGER *offset_ptr, ULONG *size_ptr,
SIZE_T commit_size, const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr,
SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect )
{
IO_STATUS_BLOCK io;
FILE_FS_DEVICE_INFORMATION device_info;
NTSTATUS res;
UINT size = 0;
SIZE_T size = 0;
int unix_handle = -1;
int prot;
void *base;
@ -1635,7 +1636,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
offset.QuadPart = offset_ptr ? offset_ptr->QuadPart : 0;
TRACE("handle=%p process=%p addr=%p off=%lx%08lx size=%x access=%lx\n",
TRACE("handle=%p process=%p addr=%p off=%lx%08lx size=%lx access=%lx\n",
handle, process, *addr_ptr, offset.u.HighPart, offset.u.LowPart, size, protect );
if (!is_current_process( process ))
@ -1752,7 +1753,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
/* Map the file */
TRACE("handle=%p size=%x offset=%lx%08lx\n",
TRACE("handle=%p size=%lx offset=%lx%08lx\n",
handle, size, offset.u.HighPart, offset.u.LowPart );
res = map_file_into_view( view, unix_handle, 0, size, offset.QuadPart, prot, removable );
@ -1768,7 +1769,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
}
else
{
ERR( "map_file_into_view %p %x %lx%08lx failed\n",
ERR( "map_file_into_view %p %lx %lx%08lx failed\n",
view->base, size, offset.u.HighPart, offset.u.LowPart );
delete_view( view );
}
@ -1812,7 +1813,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
* ZwFlushVirtualMemory (NTDLL.@)
*/
NTSTATUS WINAPI NtFlushVirtualMemory( HANDLE process, LPCVOID *addr_ptr,
ULONG *size_ptr, ULONG unknown )
SIZE_T *size_ptr, ULONG unknown )
{
FILE_VIEW *view;
NTSTATUS status = STATUS_SUCCESS;
@ -1866,14 +1867,14 @@ NTSTATUS WINAPI NtWriteVirtualMemory( HANDLE process, void *addr, const void *bu
SIZE_T size, SIZE_T *bytes_written )
{
static const unsigned int zero;
unsigned int first_offset, last_offset, first_mask, last_mask;
SIZE_T first_offset, last_offset, first_mask, last_mask;
NTSTATUS status;
if (!size) return STATUS_INVALID_PARAMETER;
/* compute the mask for the first int */
first_mask = ~0;
first_offset = (unsigned int)addr % sizeof(int);
first_offset = (ULONG_PTR)addr % sizeof(int);
memset( &first_mask, 0, first_offset );
/* compute the mask for the last int */

View File

@ -485,7 +485,7 @@ typedef struct _MEMORY_BASIC_INFORMATION
LPVOID BaseAddress;
LPVOID AllocationBase;
DWORD AllocationProtect;
DWORD RegionSize;
SIZE_T RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;

View File

@ -1689,7 +1689,7 @@ NTSTATUS WINAPI NtAlertResumeThread(HANDLE,PULONG);
NTSTATUS WINAPI NtAlertThread(HANDLE ThreadHandle);
NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID lpLuid);
NTSTATUS WINAPI NtAllocateUuids(PULARGE_INTEGER,PULONG,PULONG);
NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG,ULONG*,ULONG,ULONG);
NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG,SIZE_T*,ULONG,ULONG);
NTSTATUS WINAPI NtCallbackReturn(PVOID,ULONG,NTSTATUS);
NTSTATUS WINAPI NtCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
NTSTATUS WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
@ -1732,11 +1732,11 @@ NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PV
NTSTATUS WINAPI NtExtendSection(HANDLE,PLARGE_INTEGER);
NTSTATUS WINAPI NtFindAtom(const WCHAR*,ULONG,RTL_ATOM*);
NTSTATUS WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,ULONG);
NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
NTSTATUS WINAPI NtFlushKey(HANDLE);
NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
NTSTATUS WINAPI NtFlushWriteBuffer(VOID);
NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
NTSTATUS WINAPI NtFsControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
NTSTATUS WINAPI NtGetContextThread(HANDLE,CONTEXT*);
NTSTATUS WINAPI NtGetPlugPlayEvent(ULONG,ULONG,PVOID,ULONG);
@ -1750,9 +1750,9 @@ NTSTATUS WINAPI NtListenPort(HANDLE,PLPC_MESSAGE);
NTSTATUS WINAPI NtLoadDriver(const UNICODE_STRING *);
NTSTATUS WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
NTSTATUS WINAPI NtLockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtLockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
NTSTATUS WINAPI NtMakeTemporaryObject(HANDLE);
NTSTATUS WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,ULONG,const LARGE_INTEGER*,ULONG*,SECTION_INHERIT,ULONG,ULONG);
NTSTATUS WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
NTSTATUS WINAPI NtNotifyChangeDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,ULONG,BOOLEAN);
NTSTATUS WINAPI NtNotifyChangeKey(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
@ -1775,7 +1775,7 @@ NTSTATUS WINAPI NtPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,UL
NTSTATUS WINAPI NtPrivilegeCheck(HANDLE,PPRIVILEGE_SET,PBOOLEAN);
NTSTATUS WINAPI NtPrivilegeObjectAuditAlarm(PUNICODE_STRING,HANDLE,HANDLE,ULONG,PPRIVILEGE_SET,BOOLEAN);
NTSTATUS WINAPI NtPrivilegedServiceAuditAlarm(PUNICODE_STRING,PUNICODE_STRING,HANDLE,PPRIVILEGE_SET,BOOLEAN);
NTSTATUS WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG,ULONG*);
NTSTATUS WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG,ULONG*);
NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG);
NTSTATUS WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
NTSTATUS WINAPI NtQueryAttributesFile(const OBJECT_ATTRIBUTES*,FILE_BASIC_INFORMATION*);
@ -1811,7 +1811,7 @@ NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER);
NTSTATUS WINAPI NtQueryTimer(HANDLE,TIMER_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtQueryTimerResolution(PULONG,PULONG,PULONG);
NTSTATUS WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,SIZE_T,SIZE_T*);
NTSTATUS WINAPI NtQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
void WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
NTSTATUS WINAPI NtRaiseHardError(NTSTATUS,ULONG,PUNICODE_STRING,PVOID*,HARDERROR_RESPONSE_OPTION,PHARDERROR_RESPONSE);
@ -1878,7 +1878,7 @@ NTSTATUS WINAPI NtUnloadDriver(const UNICODE_STRING *);
NTSTATUS WINAPI NtUnloadKey(HANDLE);
NTSTATUS WINAPI NtUnloadKeyEx(POBJECT_ATTRIBUTES,HANDLE);
NTSTATUS WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG);
NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
NTSTATUS WINAPI NtVdmControl(ULONG,PVOID);
NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
@ -1905,7 +1905,7 @@ PVOID WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLE
NTSTATUS WINAPI RtlAdjustPrivilege(ULONG,BOOLEAN,BOOLEAN,PBOOLEAN);
NTSTATUS WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
RTL_HANDLE * WINAPI RtlAllocateHandle(RTL_HANDLE_TABLE *,ULONG *);
PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,ULONG);
PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,SIZE_T);
WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *);
DWORD WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
NTSTATUS WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
@ -1939,7 +1939,7 @@ void WINAPI RtlCopyUnicodeString(UNICODE_STRING*,const UNICODE_STRING*);
NTSTATUS WINAPI RtlCreateAcl(PACL,DWORD,DWORD);
NTSTATUS WINAPI RtlCreateAtomTable(ULONG,RTL_ATOM_TABLE*);
NTSTATUS WINAPI RtlCreateEnvironment(BOOLEAN, PWSTR*);
HANDLE WINAPI RtlCreateHeap(ULONG,PVOID,ULONG,ULONG,PVOID,PRTL_HEAP_DEFINITION);
HANDLE WINAPI RtlCreateHeap(ULONG,PVOID,SIZE_T,SIZE_T,PVOID,PRTL_HEAP_DEFINITION);
NTSTATUS WINAPI RtlCreateProcessParameters(RTL_USER_PROCESS_PARAMETERS**,const UNICODE_STRING*,
const UNICODE_STRING*,const UNICODE_STRING*,
const UNICODE_STRING*,PWSTR,const UNICODE_STRING*,
@ -2104,7 +2104,7 @@ NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*);
void WINAPI RtlRaiseException(PEXCEPTION_RECORD);
void WINAPI RtlRaiseStatus(NTSTATUS);
ULONG WINAPI RtlRandom(PULONG);
PVOID WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,ULONG);
PVOID WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,SIZE_T);
void WINAPI RtlReleasePebLock(void);
void WINAPI RtlReleaseResource(LPRTL_RWLOCK);
ULONG WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
@ -2127,7 +2127,7 @@ void WINAPI RtlSetLastWin32Error(DWORD);
void WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus(NTSTATUS);
NTSTATUS WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
NTSTATUS WINAPI RtlSetTimeZoneInformation(const RTL_TIME_ZONE_INFORMATION*);
ULONG WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
SIZE_T WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
NTSTATUS WINAPI RtlStringFromGUID(REFGUID,PUNICODE_STRING);
LPDWORD WINAPI RtlSubAuthoritySid(PSID,DWORD);
LPBYTE WINAPI RtlSubAuthorityCountSid(PSID);