Commit db525887 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Const correctness.

parent e98a664d
......@@ -317,14 +317,14 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
* NULL: Failure
*/
static SUBHEAP *HEAP_FindSubHeap(
HEAP *heap, /* [in] Heap pointer */
const HEAP *heap, /* [in] Heap pointer */
LPCVOID ptr /* [in] Address */
) {
SUBHEAP *sub = &heap->subheap;
const SUBHEAP *sub = &heap->subheap;
while (sub)
{
if (((char *)ptr >= (char *)sub) &&
((char *)ptr < (char *)sub + sub->size)) return sub;
if (((const char *)ptr >= (const char *)sub) &&
((const char *)ptr < (const char *)sub + sub->size)) return (SUBHEAP*)sub;
sub = sub->next;
}
return NULL;
......@@ -705,15 +705,15 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
*
* Check that the pointer is inside the range possible for arenas.
*/
static BOOL HEAP_IsValidArenaPtr( HEAP *heap, void *ptr )
static BOOL HEAP_IsValidArenaPtr( const HEAP *heap, const void *ptr )
{
int i;
SUBHEAP *subheap = HEAP_FindSubHeap( heap, ptr );
const SUBHEAP *subheap = HEAP_FindSubHeap( heap, ptr );
if (!subheap) return FALSE;
if ((char *)ptr >= (char *)subheap + subheap->headerSize) return TRUE;
if ((const char *)ptr >= (const char *)subheap + subheap->headerSize) return TRUE;
if (subheap != &heap->subheap) return FALSE;
for (i = 0; i < HEAP_NB_FREE_LISTS; i++)
if (ptr == (void *)&heap->freeList[i].arena) return TRUE;
if (ptr == (const void *)&heap->freeList[i].arena) return TRUE;
return FALSE;
}
......@@ -813,9 +813,9 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
/***********************************************************************
* HEAP_ValidateInUseArena
*/
static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena, BOOL quiet )
static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *pArena, BOOL quiet )
{
char *heapEnd = (char *)subheap + subheap->size;
const char *heapEnd = (const char *)subheap + subheap->size;
/* Check for unaligned pointers */
if ( (long)pArena % ALIGNMENT != 0 )
......@@ -861,15 +861,15 @@ static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena, BOOL
return FALSE;
}
/* Check arena size */
if ((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) > heapEnd)
if ((const char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) > heapEnd)
{
ERR("Heap %08lx: bad size %08lx for in-use arena %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena->size & ARENA_SIZE_MASK, (DWORD)pArena );
return FALSE;
}
/* Check next arena PREV_FREE flag */
if (((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) < heapEnd) &&
(*(DWORD *)((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK)) & ARENA_FLAG_PREV_FREE))
if (((const char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) < heapEnd) &&
(*(const DWORD *)((const char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK)) & ARENA_FLAG_PREV_FREE))
{
ERR("Heap %08lx: in-use arena %08lx next block has PREV_FREE flag\n",
(DWORD)subheap->heap, (DWORD)pArena );
......@@ -878,7 +878,7 @@ static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena, BOOL
/* Check prev free arena */
if (pArena->size & ARENA_FLAG_PREV_FREE)
{
ARENA_FREE *pPrev = *((ARENA_FREE **)pArena - 1);
const ARENA_FREE *pPrev = *((const ARENA_FREE * const*)pArena - 1);
/* Check prev pointer */
if (!HEAP_IsValidArenaPtr( subheap->heap, pPrev ))
{
......@@ -895,7 +895,7 @@ static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena, BOOL
return FALSE;
}
/* Check that prev arena is really the previous block */
if ((char *)(pPrev + 1) + (pPrev->size & ARENA_SIZE_MASK) != (char *)pArena)
if ((const char *)(pPrev + 1) + (pPrev->size & ARENA_SIZE_MASK) != (const char *)pArena)
{
ERR("Heap %08lx: prev arena %08lx is not prev for in-use %08lx\n",
(DWORD)subheap->heap, (DWORD)pPrev, (DWORD)pArena );
......@@ -940,7 +940,7 @@ static BOOL HEAP_IsRealArena( HEAP *heapPtr, /* [in] ptr to the heap */
/* Only check this single memory block */
if (!(subheap = HEAP_FindSubHeap( heapPtr, block )) ||
((char *)block < (char *)subheap + subheap->headerSize
((const char *)block < (char *)subheap + subheap->headerSize
+ sizeof(ARENA_INUSE)))
{
if (quiet == NOISY)
......@@ -949,7 +949,7 @@ static BOOL HEAP_IsRealArena( HEAP *heapPtr, /* [in] ptr to the heap */
WARN("Heap %p: block %p is not inside heap\n", heapPtr, block );
ret = FALSE;
} else
ret = HEAP_ValidateInUseArena( subheap, (ARENA_INUSE *)block - 1, quiet );
ret = HEAP_ValidateInUseArena( subheap, (const ARENA_INUSE *)block - 1, quiet );
if (!(flags & HEAP_NO_SERIALIZE))
RtlLeaveCriticalSection( &heapPtr->critSection );
......
......@@ -106,7 +106,7 @@ static WINE_MODREF *cached_modref;
static WINE_MODREF *current_modref;
static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_MODREF** pwm );
static FARPROC find_named_export( HMODULE module, IMAGE_EXPORT_DIRECTORY *exports,
static FARPROC find_named_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, const char *name, int hint );
/* convert PE image VirtualAddress to Real Address */
......@@ -245,11 +245,11 @@ static WINE_MODREF *find_fullname_module( LPCWSTR name )
*/
static FARPROC find_forwarded_export( HMODULE module, const char *forward )
{
IMAGE_EXPORT_DIRECTORY *exports;
const IMAGE_EXPORT_DIRECTORY *exports;
DWORD exp_size;
WINE_MODREF *wm;
WCHAR mod_name[32];
char *end = strchr(forward, '.');
const char *end = strchr(forward, '.');
FARPROC proc = NULL;
if (!end) return NULL;
......@@ -285,11 +285,11 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward )
* The exports base must have been subtracted from the ordinal already.
* The loader_section must be locked while calling this function.
*/
static FARPROC find_ordinal_export( HMODULE module, IMAGE_EXPORT_DIRECTORY *exports,
static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, int ordinal )
{
FARPROC proc;
DWORD *functions = get_rva( module, exports->AddressOfFunctions );
const DWORD *functions = get_rva( module, exports->AddressOfFunctions );
if (ordinal >= exports->NumberOfFunctions)
{
......@@ -301,8 +301,9 @@ static FARPROC find_ordinal_export( HMODULE module, IMAGE_EXPORT_DIRECTORY *expo
proc = get_rva( module, functions[ordinal] );
/* if the address falls into the export dir, it's a forward */
if (((char *)proc >= (char *)exports) && ((char *)proc < (char *)exports + exp_size))
return find_forwarded_export( module, (char *)proc );
if (((const char *)proc >= (const char *)exports) &&
((const char *)proc < (const char *)exports + exp_size))
return find_forwarded_export( module, (const char *)proc );
if (TRACE_ON(snoop) && current_modref)
{
......@@ -324,11 +325,11 @@ static FARPROC find_ordinal_export( HMODULE module, IMAGE_EXPORT_DIRECTORY *expo
* Find an exported function by name.
* The loader_section must be locked while calling this function.
*/
static FARPROC find_named_export( HMODULE module, IMAGE_EXPORT_DIRECTORY *exports,
static FARPROC find_named_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, const char *name, int hint )
{
WORD *ordinals = get_rva( module, exports->AddressOfNameOrdinals );
DWORD *names = get_rva( module, exports->AddressOfNames );
const WORD *ordinals = get_rva( module, exports->AddressOfNameOrdinals );
const DWORD *names = get_rva( module, exports->AddressOfNames );
int min = 0, max = exports->NumberOfNames - 1;
/* first check the hint */
......@@ -360,16 +361,17 @@ static FARPROC find_named_export( HMODULE module, IMAGE_EXPORT_DIRECTORY *export
* Import the dll specified by the given import descriptor.
* The loader_section must be locked while calling this function.
*/
static WINE_MODREF *import_dll( HMODULE module, IMAGE_IMPORT_DESCRIPTOR *descr, LPCWSTR load_path )
static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LPCWSTR load_path )
{
NTSTATUS status;
WINE_MODREF *wmImp;
HMODULE imp_mod;
IMAGE_EXPORT_DIRECTORY *exports;
const IMAGE_EXPORT_DIRECTORY *exports;
DWORD exp_size;
IMAGE_THUNK_DATA *import_list, *thunk_list;
const IMAGE_THUNK_DATA *import_list;
IMAGE_THUNK_DATA *thunk_list;
WCHAR buffer[32];
char *name = get_rva( module, descr->Name );
const char *name = get_rva( module, descr->Name );
DWORD len = strlen(name) + 1;
thunk_list = get_rva( module, (DWORD)descr->FirstThunk );
......@@ -476,7 +478,7 @@ static WINE_MODREF *import_dll( HMODULE module, IMAGE_IMPORT_DESCRIPTOR *descr,
static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
{
int i, nb_imports;
IMAGE_IMPORT_DESCRIPTOR *imports;
const IMAGE_IMPORT_DESCRIPTOR *imports;
WINE_MODREF *prev;
DWORD size;
NTSTATUS status;
......@@ -525,8 +527,8 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
{
WINE_MODREF *wm;
WCHAR *p;
IMAGE_NT_HEADERS *nt = RtlImageNtHeader(hModule);
const WCHAR *p;
const IMAGE_NT_HEADERS *nt = RtlImageNtHeader(hModule);
PLIST_ENTRY entry, mark;
if (!(wm = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*wm) ))) return NULL;
......@@ -587,7 +589,7 @@ static NTSTATUS alloc_process_tls(void)
{
PLIST_ENTRY mark, entry;
PLDR_MODULE mod;
IMAGE_TLS_DIRECTORY *dir;
const IMAGE_TLS_DIRECTORY *dir;
ULONG size, i;
mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
......@@ -929,7 +931,7 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod)
{
mod = CONTAINING_RECORD(entry, LDR_MODULE, InMemoryOrderModuleList);
if ((const void *)mod->BaseAddress <= addr &&
(char *)addr < (char*)mod->BaseAddress + mod->SizeOfImage)
(const char *)addr < (char*)mod->BaseAddress + mod->SizeOfImage)
{
*pmod = mod;
return STATUS_SUCCESS;
......@@ -1972,12 +1974,14 @@ PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection( const IMAGE_NT_HEADERS *nt,
HMODULE module, DWORD rva )
{
int i;
IMAGE_SECTION_HEADER *sec = (IMAGE_SECTION_HEADER*)((char*)&nt->OptionalHeader +
const IMAGE_SECTION_HEADER *sec;
sec = (const IMAGE_SECTION_HEADER*)((const char*)&nt->OptionalHeader +
nt->FileHeader.SizeOfOptionalHeader);
for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
{
if ((sec->VirtualAddress <= rva) && (sec->VirtualAddress + sec->SizeOfRawData > rva))
return sec;
return (PIMAGE_SECTION_HEADER)sec;
}
return NULL;
}
......
......@@ -103,7 +103,7 @@ static struct loadorder_list env_list;
*/
static int cmp_sort_func(const void *s1, const void *s2)
{
return strcmpiW(((module_loadorder_t *)s1)->modulename, ((module_loadorder_t *)s2)->modulename);
return strcmpiW(((const module_loadorder_t *)s1)->modulename, ((const module_loadorder_t *)s2)->modulename);
}
......@@ -112,7 +112,7 @@ static int cmp_sort_func(const void *s1, const void *s2)
*/
static int strcmp_func(const void *s1, const void *s2)
{
return strcmpiW( (WCHAR *)s1, (WCHAR *)s2 );
return strcmpiW( (const WCHAR *)s1, (const WCHAR *)s2 );
}
......
......@@ -61,9 +61,9 @@ extern void DECLSPEC_NORETURN server_abort_thread( int status );
/* module handling */
extern BOOL MODULE_GetSystemDirectory( UNICODE_STRING *sysdir );
extern void RELAY_InitDebugLists(void);
extern FARPROC RELAY_GetProcAddress( HMODULE module, IMAGE_EXPORT_DIRECTORY *exports,
extern FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, FARPROC proc, const WCHAR *user );
extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size,
extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size,
FARPROC origfun, DWORD ordinal, const WCHAR *user );
extern void RELAY_SetupDLL( HMODULE hmod );
extern void SNOOP_SetupDLL( HMODULE hmod );
......
......@@ -691,18 +691,18 @@ __ASM_GLOBAL_FUNC( RELAY_CallFrom32Regs,
static BOOL is_register_entry_point( const BYTE *addr )
{
extern void __wine_call_from_32_regs();
int *offset;
void *ptr;
const int *offset;
const void *ptr;
if (*addr != 0xe8) return FALSE; /* not a call */
/* check if call target is __wine_call_from_32_regs */
offset = (int *)(addr + 1);
if (*offset == (char *)__wine_call_from_32_regs - (char *)(offset + 1)) return TRUE;
offset = (const int *)(addr + 1);
if (*offset == (const char *)__wine_call_from_32_regs - (const char *)(offset + 1)) return TRUE;
/* now check if call target is an import table jump to __wine_call_from_32_regs */
addr = (BYTE *)(offset + 1) + *offset;
addr = (const BYTE *)(offset + 1) + *offset;
if (addr[0] != 0xff || addr[1] != 0x25) return FALSE; /* not an indirect jmp */
ptr = *(void **)(addr + 2); /* get indirect jmp target address */
return (*(char **)ptr == (char *)__wine_call_from_32_regs);
ptr = *(const void * const*)(addr + 2); /* get indirect jmp target address */
return (*(const char * const*)ptr == (char *)__wine_call_from_32_regs);
}
......@@ -711,11 +711,11 @@ static BOOL is_register_entry_point( const BYTE *addr )
*
* Return the proc address to use for a given function.
*/
FARPROC RELAY_GetProcAddress( HMODULE module, IMAGE_EXPORT_DIRECTORY *exports,
FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, FARPROC proc, const WCHAR *user )
{
DEBUG_ENTRY_POINT *debug = (DEBUG_ENTRY_POINT *)proc;
DEBUG_ENTRY_POINT *list = (DEBUG_ENTRY_POINT *)((char *)exports + exp_size);
const DEBUG_ENTRY_POINT *debug = (DEBUG_ENTRY_POINT *)proc;
const DEBUG_ENTRY_POINT *list = (const DEBUG_ENTRY_POINT *)((const char *)exports + exp_size);
if (debug < list || debug >= list + exports->NumberOfFunctions) return proc;
if (list + (debug - list) != debug) return proc; /* not a valid address */
......@@ -857,17 +857,17 @@ void SNOOP_SetupDLL(HMODULE hmod)
*
* Return the proc address to use for a given function.
*/
FARPROC SNOOP_GetProcAddress( HMODULE hmod, IMAGE_EXPORT_DIRECTORY *exports,
FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, FARPROC origfun, DWORD ordinal,
const WCHAR *user)
{
int i;
const char *ename;
WORD *ordinals;
DWORD *names;
const WORD *ordinals;
const DWORD *names;
SNOOP_DLL *dll = firstdll;
SNOOP_FUN *fun;
IMAGE_SECTION_HEADER *sec;
const IMAGE_SECTION_HEADER *sec;
if (!TRACE_ON(snoop)) return origfun;
if (!check_from_module( debug_from_snoop_includelist, debug_from_snoop_excludelist, user ))
......@@ -884,27 +884,27 @@ FARPROC SNOOP_GetProcAddress( HMODULE hmod, IMAGE_EXPORT_DIRECTORY *exports,
while (dll) {
if (hmod == dll->hmod)
break;
dll=dll->next;
dll = dll->next;
}
if (!dll) /* probably internal */
return origfun;
/* try to find a name for it */
ename = NULL;
names = (DWORD *)((char *)hmod + exports->AddressOfNames);
ordinals = (WORD *)((char *)hmod + exports->AddressOfNameOrdinals);
names = (const DWORD *)((const char *)hmod + exports->AddressOfNames);
ordinals = (const WORD *)((const char *)hmod + exports->AddressOfNameOrdinals);
if (names) for (i = 0; i < exports->NumberOfNames; i++)
{
if (ordinals[i] == ordinal)
{
ename = (char *)hmod + names[i];
ename = (const char *)hmod + names[i];
break;
}
}
if (!SNOOP_ShowDebugmsgSnoop(dll->name,ordinal,ename))
return origfun;
assert(ordinal < dll->nrofordinals);
fun = dll->funs+ordinal;
fun = dll->funs + ordinal;
if (!fun->name)
{
fun->name = ename;
......
......@@ -99,7 +99,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_first_entry( const IMAGE_RESOURCE_DI
for (pos = 0; pos < dir->NumberOfNamedEntries + dir->NumberOfIdEntries; pos++)
{
if (!entry[pos].u2.s3.DataIsDirectory == !want_dir)
return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s3.OffsetToDirectory);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory);
}
return NULL;
}
......@@ -127,8 +127,8 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
if (!entry[pos].u2.s3.DataIsDirectory == !want_dir)
{
TRACE("root %p dir %p id %04x ret %p\n",
root, dir, id, (char *)root + entry[pos].u2.s3.OffsetToDirectory);
return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s3.OffsetToDirectory);
root, dir, id, (const char*)root + entry[pos].u2.s3.OffsetToDirectory);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory);
}
break;
}
......@@ -161,15 +161,15 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_
while (min <= max)
{
pos = (min + max) / 2;
str = (IMAGE_RESOURCE_DIR_STRING_U *)((char *)root + entry[pos].u1.s1.NameOffset);
str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].u1.s1.NameOffset);
res = strncmpW( name, str->NameString, str->Length );
if (!res && namelen == str->Length)
{
if (!entry[pos].u2.s3.DataIsDirectory == !want_dir)
{
TRACE("root %p dir %p name %s ret %p\n",
root, dir, debugstr_w(name), (char *)root + entry[pos].u2.s3.OffsetToDirectory);
return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s3.OffsetToDirectory);
root, dir, debugstr_w(name), (const char*)root + entry[pos].u2.s3.OffsetToDirectory);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory);
}
break;
}
......@@ -389,9 +389,9 @@ NTSTATUS WINAPI RtlFindMessage( HMODULE hmod, ULONG type, ULONG lang,
{
const MESSAGE_RESOURCE_ENTRY *entry;
entry = (MESSAGE_RESOURCE_ENTRY *)((char *)data + block->OffsetToEntries);
entry = (const MESSAGE_RESOURCE_ENTRY *)((const char *)data + block->OffsetToEntries);
for (i = msg_id - block->LowId; i > 0; i--)
entry = (MESSAGE_RESOURCE_ENTRY *)((char *)entry + entry->Length);
entry = (const MESSAGE_RESOURCE_ENTRY *)((const char *)entry + entry->Length);
*ret = entry;
return STATUS_SUCCESS;
}
......
......@@ -482,7 +482,7 @@ VOID WINAPI RtlZeroMemory( VOID *Destination, SIZE_T Length )
SIZE_T WINAPI RtlCompareMemory( const VOID *Source1, const VOID *Source2, SIZE_T Length)
{
SIZE_T i;
for(i=0; (i<Length) && (((LPBYTE)Source1)[i]==((LPBYTE)Source2)[i]); i++);
for(i=0; (i<Length) && (((const BYTE*)Source1)[i]==((const BYTE*)Source2)[i]); i++);
return i;
}
......
......@@ -654,7 +654,7 @@ CCHAR WINAPI RtlFindLeastSignificantBit(ULONGLONG ulLong)
*/
static int NTDLL_RunSortFn(const void *lhs, const void *rhs)
{
if (((PCRTL_BITMAP_RUN)lhs)->SizeOfRun > ((PRTL_BITMAP_RUN)rhs)->SizeOfRun)
if (((const RTL_BITMAP_RUN*)lhs)->SizeOfRun > ((const RTL_BITMAP_RUN*)rhs)->SizeOfRun)
return -1;
return 1;
}
......
......@@ -222,7 +222,7 @@ static struct file_view *VIRTUAL_FindView( const void *addr ) /* [in] Address */
{
struct file_view *view = LIST_ENTRY( ptr, struct file_view, entry );
if (view->base > addr) break;
if ((char *)view->base + view->size > (const char *)addr) return view;
if ((const char*)view->base + view->size > (const char*)addr) return view;
}
return NULL;
}
......@@ -241,8 +241,8 @@ static struct file_view *find_view_range( const void *addr, size_t size )
LIST_FOR_EACH( ptr, &views_list )
{
struct file_view *view = LIST_ENTRY( ptr, struct file_view, entry );
if ((char *)view->base >= (const char *)addr + size) break;
if ((char *)view->base + view->size > (const char *)addr) return view;
if ((const char *)view->base >= (const char *)addr + size) break;
if ((const char *)view->base + view->size > (const char *)addr) return view;
}
return NULL;
}
......@@ -1063,7 +1063,7 @@ DWORD VIRTUAL_HandleFault( LPCVOID addr )
}
else
{
BYTE vprot = view->prot[((char *)addr - (char *)view->base) >> page_shift];
BYTE vprot = view->prot[((const char *)addr - (const char *)view->base) >> page_shift];
void *page = (void *)((UINT_PTR)addr & ~page_mask);
char *stack = NtCurrentTeb()->Tib.StackLimit;
if (vprot & VPROT_GUARD)
......@@ -1072,7 +1072,7 @@ DWORD VIRTUAL_HandleFault( LPCVOID addr )
ret = STATUS_GUARD_PAGE_VIOLATION;
}
/* is it inside the stack guard page? */
if (((char *)addr >= stack) && ((char *)addr < stack + (page_mask+1)))
if (((const char *)addr >= stack) && ((const char *)addr < stack + (page_mask+1)))
ret = STATUS_STACK_OVERFLOW;
}
}
......
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