Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
db525887
Commit
db525887
authored
Jun 15, 2004
by
Eric Pouech
Committed by
Alexandre Julliard
Jun 15, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Const correctness.
parent
e98a664d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
121 additions
and
117 deletions
+121
-117
heap.c
dlls/ntdll/heap.c
+18
-18
loader.c
dlls/ntdll/loader.c
+26
-22
loadorder.c
dlls/ntdll/loadorder.c
+2
-2
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-2
relay.c
dlls/ntdll/relay.c
+58
-58
resource.c
dlls/ntdll/resource.c
+8
-8
rtl.c
dlls/ntdll/rtl.c
+1
-1
rtlbitmap.c
dlls/ntdll/rtlbitmap.c
+1
-1
virtual.c
dlls/ntdll/virtual.c
+5
-5
No files found.
dlls/ntdll/heap.c
View file @
db525887
...
...
@@ -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
(((
c
har
*
)
ptr
>=
(
char
*
)
sub
)
&&
((
c
har
*
)
ptr
<
(
char
*
)
sub
+
sub
->
size
))
return
sub
;
if
(((
c
onst
char
*
)
ptr
>=
(
const
char
*
)
sub
)
&&
((
c
onst
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
((
c
har
*
)
ptr
>=
(
char
*
)
subheap
+
subheap
->
headerSize
)
return
TRUE
;
if
((
c
onst
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
)
{
c
har
*
heapEnd
=
(
char
*
)
subheap
+
subheap
->
size
;
c
onst
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
((
c
onst
c
har
*
)(
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
(((
c
onst
c
har
*
)(
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
((
c
har
*
)(
pPrev
+
1
)
+
(
pPrev
->
size
&
ARENA_SIZE_MASK
)
!=
(
char
*
)
pArena
)
if
((
c
onst
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,8 +940,8 @@ 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
+
sizeof
(
ARENA_INUSE
)))
((
c
onst
c
har
*
)
block
<
(
char
*
)
subheap
+
subheap
->
headerSize
+
sizeof
(
ARENA_INUSE
)))
{
if
(
quiet
==
NOISY
)
ERR
(
"Heap %p: block %p is not inside heap
\n
"
,
heapPtr
,
block
);
...
...
@@ -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
);
...
...
dlls/ntdll/loader.c
View file @
db525887
...
...
@@ -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
,
'.'
);
c
onst
c
har
*
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
);
c
onst
c
har
*
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
)
(
c
onst
c
har
*
)
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
+
nt
->
FileHeader
.
SizeOfOptionalHeader
);
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
;
}
...
...
dlls/ntdll/loadorder.c
View file @
db525887
...
...
@@ -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
);
}
...
...
dlls/ntdll/ntdll_misc.h
View file @
db525887
...
...
@@ -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
);
...
...
dlls/ntdll/relay.c
View file @
db525887
...
...
@@ -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
==
(
c
har
*
)
__wine_call_from_32_regs
-
(
char
*
)(
offset
+
1
))
return
TRUE
;
offset
=
(
const
int
*
)(
addr
+
1
);
if
(
*
offset
==
(
c
onst
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
(
*
(
c
har
*
*
)
ptr
==
(
char
*
)
__wine_call_from_32_regs
);
ptr
=
*
(
const
void
*
const
*
)(
addr
+
2
);
/* get indirect jmp target address */
return
(
*
(
c
onst
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,64 +857,64 @@ 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
;
SNOOP_DLL
*
dll
=
firstdll
;
SNOOP_FUN
*
fun
;
IMAGE_SECTION_HEADER
*
sec
;
int
i
;
const
char
*
ename
;
const
WORD
*
ordinals
;
const
DWORD
*
names
;
SNOOP_DLL
*
dll
=
firstdll
;
SNOOP_FUN
*
fun
;
const
IMAGE_SECTION_HEADER
*
sec
;
if
(
!
TRACE_ON
(
snoop
))
return
origfun
;
if
(
!
check_from_module
(
debug_from_snoop_includelist
,
debug_from_snoop_excludelist
,
user
))
return
origfun
;
/* the calling module was explicitly excluded */
if
(
!
TRACE_ON
(
snoop
))
return
origfun
;
if
(
!
check_from_module
(
debug_from_snoop_includelist
,
debug_from_snoop_excludelist
,
user
))
return
origfun
;
/* the calling module was explicitly excluded */
if
(
!*
(
LPBYTE
)
origfun
)
/* 0x00 is an imposs. opcode, poss. dataref. */
return
origfun
;
if
(
!*
(
LPBYTE
)
origfun
)
/* 0x00 is an imposs. opcode, poss. dataref. */
return
origfun
;
sec
=
RtlImageRvaToSection
(
RtlImageNtHeader
(
hmod
),
hmod
,
(
char
*
)
origfun
-
(
char
*
)
hmod
);
sec
=
RtlImageRvaToSection
(
RtlImageNtHeader
(
hmod
),
hmod
,
(
char
*
)
origfun
-
(
char
*
)
hmod
);
if
(
!
sec
||
!
(
sec
->
Characteristics
&
IMAGE_SCN_CNT_CODE
))
return
origfun
;
/* most likely a data reference */
if
(
!
sec
||
!
(
sec
->
Characteristics
&
IMAGE_SCN_CNT_CODE
))
return
origfun
;
/* most likely a data reference */
while
(
dll
)
{
if
(
hmod
==
dll
->
hmod
)
break
;
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
);
if
(
names
)
for
(
i
=
0
;
i
<
exports
->
NumberOfNames
;
i
++
)
while
(
dll
)
{
if
(
hmod
==
dll
->
hmod
)
break
;
dll
=
dll
->
next
;
}
if
(
!
dll
)
/* probably internal */
return
origfun
;
/* try to find a name for it */
ename
=
NULL
;
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
)
{
if
(
ordinals
[
i
]
==
ordinal
)
{
ename
=
(
char
*
)
hmod
+
names
[
i
];
break
;
}
ename
=
(
const
char
*
)
hmod
+
names
[
i
];
break
;
}
if
(
!
SNOOP_ShowDebugmsgSnoop
(
dll
->
name
,
ordinal
,
ename
))
return
origfun
;
assert
(
ordinal
<
dll
->
nrofordinals
);
fun
=
dll
->
funs
+
ordinal
;
if
(
!
fun
->
name
)
{
fun
->
name
=
ename
;
fun
->
lcall
=
0xe8
;
/* NOTE: origreturn struct member MUST come directly after snoopentry */
fun
->
snoopentry
=
(
char
*
)
SNOOP_Entry
-
((
char
*
)(
&
fun
->
nrofargs
));
fun
->
origfun
=
origfun
;
fun
->
nrofargs
=
-
1
;
}
return
(
FARPROC
)
&
(
fun
->
lcall
);
}
if
(
!
SNOOP_ShowDebugmsgSnoop
(
dll
->
name
,
ordinal
,
ename
))
return
origfun
;
assert
(
ordinal
<
dll
->
nrofordinals
);
fun
=
dll
->
funs
+
ordinal
;
if
(
!
fun
->
name
)
{
fun
->
name
=
ename
;
fun
->
lcall
=
0xe8
;
/* NOTE: origreturn struct member MUST come directly after snoopentry */
fun
->
snoopentry
=
(
char
*
)
SNOOP_Entry
-
((
char
*
)(
&
fun
->
nrofargs
));
fun
->
origfun
=
origfun
;
fun
->
nrofargs
=
-
1
;
}
return
(
FARPROC
)
&
(
fun
->
lcall
);
}
static
void
SNOOP_PrintArg
(
DWORD
x
)
...
...
dlls/ntdll/resource.c
View file @
db525887
...
...
@@ -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
,
(
c
har
*
)
root
+
entry
[
pos
].
u2
.
s3
.
OffsetToDirectory
);
return
(
IMAGE_RESOURCE_DIRECTORY
*
)((
char
*
)
root
+
entry
[
pos
].
u2
.
s3
.
OffsetToDirectory
);
root
,
dir
,
id
,
(
c
onst
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
),
(
c
har
*
)
root
+
entry
[
pos
].
u2
.
s3
.
OffsetToDirectory
);
return
(
IMAGE_RESOURCE_DIRECTORY
*
)((
char
*
)
root
+
entry
[
pos
].
u2
.
s3
.
OffsetToDirectory
);
root
,
dir
,
debugstr_w
(
name
),
(
c
onst
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
;
}
...
...
dlls/ntdll/rtl.c
View file @
db525887
...
...
@@ -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
;
}
...
...
dlls/ntdll/rtlbitmap.c
View file @
db525887
...
...
@@ -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
;
}
...
...
dlls/ntdll/virtual.c
View file @
db525887
...
...
@@ -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
((
c
har
*
)
view
->
base
+
view
->
size
>
(
const
char
*
)
addr
)
return
view
;
if
((
c
onst
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
((
c
onst
c
har
*
)
view
->
base
>=
(
const
char
*
)
addr
+
size
)
break
;
if
((
c
onst
c
har
*
)
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
[((
c
har
*
)
addr
-
(
char
*
)
view
->
base
)
>>
page_shift
];
BYTE
vprot
=
view
->
prot
[((
c
onst
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
(((
c
har
*
)
addr
>=
stack
)
&&
((
char
*
)
addr
<
stack
+
(
page_mask
+
1
)))
if
(((
c
onst
char
*
)
addr
>=
stack
)
&&
((
const
char
*
)
addr
<
stack
+
(
page_mask
+
1
)))
ret
=
STATUS_STACK_OVERFLOW
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment