Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
73d6c134
Commit
73d6c134
authored
Oct 16, 1998
by
Uwe Bonnes
Committed by
Alexandre Julliard
Oct 16, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed all LPIMAGE_* types to PIMAGE_*.
parent
bbf2efe3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
126 additions
and
126 deletions
+126
-126
dbgmain.c
debugger/dbgmain.c
+2
-2
msc.c
debugger/msc.c
+10
-10
neexe.h
include/neexe.h
+2
-2
pe_image.h
include/pe_image.h
+5
-5
peexe.h
include/peexe.h
+24
-24
elf.c
loader/elf.c
+5
-5
module.c
loader/module.c
+2
-2
pe_image.c
loader/pe_image.c
+16
-16
pe_resource.c
loader/pe_resource.c
+36
-36
shell.c
misc/shell.c
+16
-16
ver.c
misc/ver.c
+6
-6
version.c
misc/version.c
+1
-1
cursoricon.c
objects/cursoricon.c
+1
-1
No files found.
debugger/dbgmain.c
View file @
73d6c134
...
...
@@ -159,9 +159,9 @@ struct deferred_debug_info
char
*
module_name
;
char
*
dbg_info
;
int
dbg_size
;
L
PIMAGE_DEBUG_DIRECTORY
dbgdir
;
PIMAGE_DEBUG_DIRECTORY
dbgdir
;
struct
pe_data
*
pe
;
L
PIMAGE_SECTION_HEADER
sectp
;
PIMAGE_SECTION_HEADER
sectp
;
int
nsect
;
short
int
dbg_index
;
char
loaded
;
...
...
debugger/msc.c
View file @
73d6c134
...
...
@@ -510,8 +510,8 @@ struct deferred_debug_info
char
*
dbg_info
;
int
dbg_size
;
HMODULE32
module
;
L
PIMAGE_DEBUG_DIRECTORY
dbgdir
;
L
PIMAGE_SECTION_HEADER
sectp
;
PIMAGE_DEBUG_DIRECTORY
dbgdir
;
PIMAGE_SECTION_HEADER
sectp
;
int
nsect
;
short
int
dbg_index
;
char
loaded
;
...
...
@@ -887,11 +887,11 @@ DEBUG_RegisterDebugInfo( HMODULE32 hModule, const char *module_name,
int
has_codeview
=
FALSE
;
int
rtn
=
FALSE
;
int
orig_size
;
L
PIMAGE_DEBUG_DIRECTORY
dbgptr
;
PIMAGE_DEBUG_DIRECTORY
dbgptr
;
struct
deferred_debug_info
*
deefer
;
orig_size
=
size
;
dbgptr
=
(
L
PIMAGE_DEBUG_DIRECTORY
)
(
hModule
+
v_addr
);
dbgptr
=
(
PIMAGE_DEBUG_DIRECTORY
)
(
hModule
+
v_addr
);
for
(;
size
>=
sizeof
(
*
dbgptr
);
size
-=
sizeof
(
*
dbgptr
),
dbgptr
++
)
{
switch
(
dbgptr
->
Type
)
...
...
@@ -904,7 +904,7 @@ DEBUG_RegisterDebugInfo( HMODULE32 hModule, const char *module_name,
}
size
=
orig_size
;
dbgptr
=
(
L
PIMAGE_DEBUG_DIRECTORY
)
(
hModule
+
v_addr
);
dbgptr
=
(
PIMAGE_DEBUG_DIRECTORY
)
(
hModule
+
v_addr
);
for
(;
size
>=
sizeof
(
*
dbgptr
);
size
-=
sizeof
(
*
dbgptr
),
dbgptr
++
)
{
switch
(
dbgptr
->
Type
)
...
...
@@ -2126,14 +2126,14 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
char
*
codeview
;
struct
CV4_DirHead
*
codeview_dir
;
struct
CV4_DirEnt
*
codeview_dent
;
L
PIMAGE_DEBUG_DIRECTORY
dbghdr
;
PIMAGE_DEBUG_DIRECTORY
dbghdr
;
struct
deferred_debug_info
deefer2
;
int
fd
=
-
1
;
int
i
;
int
j
;
struct
codeview_linetab_hdr
*
linetab
;
int
nsect
;
L
PIMAGE_SEPARATE_DEBUG_HEADER
pdbg
=
NULL
;
PIMAGE_SEPARATE_DEBUG_HEADER
pdbg
=
NULL
;
IMAGE_SECTION_HEADER
*
sectp
;
struct
stat
statbuf
;
int
status
;
...
...
@@ -2167,7 +2167,7 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
goto
leave
;
}
pdbg
=
(
L
PIMAGE_SEPARATE_DEBUG_HEADER
)
addr
;
pdbg
=
(
PIMAGE_SEPARATE_DEBUG_HEADER
)
addr
;
if
(
pdbg
->
TimeDateStamp
!=
deefer
->
dbgdir
->
TimeDateStamp
)
{
...
...
@@ -2178,11 +2178,11 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
fprintf
(
stderr
,
"Processing symbols from %s...
\n
"
,
filename
);
dbghdr
=
(
L
PIMAGE_DEBUG_DIRECTORY
)
(
addr
+
sizeof
(
*
pdbg
)
dbghdr
=
(
PIMAGE_DEBUG_DIRECTORY
)
(
addr
+
sizeof
(
*
pdbg
)
+
pdbg
->
NumberOfSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
+
pdbg
->
ExportedNamesSize
);
sectp
=
(
L
PIMAGE_SECTION_HEADER
)
((
char
*
)
pdbg
+
sizeof
(
*
pdbg
));
sectp
=
(
PIMAGE_SECTION_HEADER
)
((
char
*
)
pdbg
+
sizeof
(
*
pdbg
));
nsect
=
pdbg
->
NumberOfSections
;
for
(
i
=
0
;
i
<
pdbg
->
DebugDirectorySize
/
sizeof
(
*
pdbg
);
i
++
,
dbghdr
++
)
...
...
include/neexe.h
View file @
73d6c134
...
...
@@ -32,7 +32,7 @@ typedef struct
WORD
e_oeminfo
;
/* 26: OEM information; e_oemid specific */
WORD
e_res2
[
10
];
/* 28: Reserved words */
DWORD
e_lfanew
;
/* 3c: Offset to extended header */
}
IMAGE_DOS_HEADER
,
*
L
PIMAGE_DOS_HEADER
;
}
IMAGE_DOS_HEADER
,
*
PIMAGE_DOS_HEADER
;
#define IMAGE_DOS_SIGNATURE 0x5A4D
/* MZ */
#define IMAGE_OS2_SIGNATURE 0x454E
/* NE */
...
...
@@ -79,7 +79,7 @@ typedef struct
WORD
fastload_length
;
/* 3a Length of fast load area */
WORD
reserved2
;
/* 3c Reserved by Microsoft */
WORD
expect_version
;
/* 3e Expected Windows version number */
}
IMAGE_OS2_HEADER
,
*
L
PIMAGE_OS2_HEADER
;
}
IMAGE_OS2_HEADER
,
*
PIMAGE_OS2_HEADER
;
/*
* NE Header FORMAT FLAGS
...
...
include/pe_image.h
View file @
73d6c134
...
...
@@ -10,10 +10,10 @@
* all section are calculated here, relocations etc.
*/
typedef
struct
{
L
PIMAGE_IMPORT_DESCRIPTOR
pe_import
;
L
PIMAGE_EXPORT_DIRECTORY
pe_export
;
L
PIMAGE_RESOURCE_DIRECTORY
pe_resource
;
L
PIMAGE_BASE_RELOCATION
pe_reloc
;
PIMAGE_IMPORT_DESCRIPTOR
pe_import
;
PIMAGE_EXPORT_DIRECTORY
pe_export
;
PIMAGE_RESOURCE_DIRECTORY
pe_resource
;
PIMAGE_BASE_RELOCATION
pe_reloc
;
int
flags
;
#define PE_MODREF_PROCESS_ATTACHED 0x00000001
#define PE_MODREF_NO_DLL_CALLS 0x00000002
...
...
@@ -48,7 +48,7 @@ struct _THDB; /* forward definition */
extern
void
PE_InitTls
(
struct
_THDB
*
);
extern
void
PE_InitDLL
(
struct
_wine_modref
*
wm
,
DWORD
type
,
LPVOID
lpReserved
);
extern
LPIMAGE_RESOURCE_DIRECTORY
GetResDirEntryW
(
L
PIMAGE_RESOURCE_DIRECTORY
,
LPCWSTR
,
DWORD
,
BOOL32
);
extern
PIMAGE_RESOURCE_DIRECTORY
GetResDirEntryW
(
PIMAGE_RESOURCE_DIRECTORY
,
LPCWSTR
,
DWORD
,
BOOL32
);
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC32
)(
HMODULE32
,
DWORD
,
LPVOID
);
...
...
include/peexe.h
View file @
73d6c134
...
...
@@ -15,7 +15,7 @@ typedef struct _IMAGE_FILE_HEADER {
DWORD
NumberOfSymbols
;
/* 0c */
WORD
SizeOfOptionalHeader
;
/* 10 */
WORD
Characteristics
;
/* 12 */
}
IMAGE_FILE_HEADER
,
*
L
PIMAGE_FILE_HEADER
;
}
IMAGE_FILE_HEADER
,
*
PIMAGE_FILE_HEADER
;
#define IMAGE_SIZEOF_FILE_HEADER 20
...
...
@@ -48,7 +48,7 @@ typedef struct _IMAGE_DATA_DIRECTORY
{
DWORD
VirtualAddress
;
DWORD
Size
;
}
IMAGE_DATA_DIRECTORY
,
*
L
PIMAGE_DATA_DIRECTORY
;
}
IMAGE_DATA_DIRECTORY
,
*
PIMAGE_DATA_DIRECTORY
;
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
...
...
@@ -96,7 +96,7 @@ typedef struct _IMAGE_OPTIONAL_HEADER
DWORD
NumberOfRvaAndSizes
;
/* 5C */
/* 60: */
IMAGE_DATA_DIRECTORY
DataDirectory
[
IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
}
IMAGE_OPTIONAL_HEADER
,
*
L
PIMAGE_OPTIONAL_HEADER
;
}
IMAGE_OPTIONAL_HEADER
,
*
PIMAGE_OPTIONAL_HEADER
;
/* Possible Magic values */
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
...
...
@@ -145,7 +145,7 @@ typedef struct _IMAGE_NT_HEADERS {
DWORD
Signature
;
/* 00: PE\0\0 */
IMAGE_FILE_HEADER
FileHeader
;
/* 04: Fileheader */
IMAGE_OPTIONAL_HEADER
OptionalHeader
;
/* 18: Optional Header */
}
IMAGE_NT_HEADERS
,
*
L
PIMAGE_NT_HEADERS
;
}
IMAGE_NT_HEADERS
,
*
PIMAGE_NT_HEADERS
;
#define PE_HEADER(module) \
...
...
@@ -177,7 +177,7 @@ typedef struct _IMAGE_SECTION_HEADER {
WORD
NumberOfLinenumbers
;
/* 1E: */
DWORD
Characteristics
;
/* 20: */
/* 24: */
}
IMAGE_SECTION_HEADER
,
*
L
PIMAGE_SECTION_HEADER
;
}
IMAGE_SECTION_HEADER
,
*
PIMAGE_SECTION_HEADER
;
#define IMAGE_SIZEOF_SECTION_HEADER 40
...
...
@@ -234,7 +234,7 @@ typedef struct _IMAGE_SECTION_HEADER {
typedef
struct
_IMAGE_IMPORT_BY_NAME
{
WORD
Hint
;
BYTE
Name
[
1
];
}
IMAGE_IMPORT_BY_NAME
,
*
L
PIMAGE_IMPORT_BY_NAME
;
}
IMAGE_IMPORT_BY_NAME
,
*
PIMAGE_IMPORT_BY_NAME
;
/* Import thunk */
typedef
struct
_IMAGE_THUNK_DATA
{
...
...
@@ -242,16 +242,16 @@ typedef struct _IMAGE_THUNK_DATA {
LPBYTE
ForwarderString
;
FARPROC32
Function
;
DWORD
Ordinal
;
L
PIMAGE_IMPORT_BY_NAME
AddressOfData
;
PIMAGE_IMPORT_BY_NAME
AddressOfData
;
}
u1
;
}
IMAGE_THUNK_DATA
,
*
L
PIMAGE_THUNK_DATA
;
}
IMAGE_THUNK_DATA
,
*
PIMAGE_THUNK_DATA
;
/* Import module directory */
typedef
struct
_IMAGE_IMPORT_DESCRIPTOR
{
union
{
DWORD
Characteristics
;
/* 0 for terminating null import descriptor */
L
PIMAGE_THUNK_DATA
OriginalFirstThunk
;
/* RVA to original unbound IAT */
PIMAGE_THUNK_DATA
OriginalFirstThunk
;
/* RVA to original unbound IAT */
}
u
;
DWORD
TimeDateStamp
;
/* 0 if not bound,
* -1 if bound, and real date\time stamp
...
...
@@ -263,8 +263,8 @@ typedef struct _IMAGE_IMPORT_DESCRIPTOR {
DWORD
ForwarderChain
;
/* -1 if no forwarders */
DWORD
Name
;
/* RVA to IAT (if bound this IAT has actual addresses) */
L
PIMAGE_THUNK_DATA
FirstThunk
;
}
IMAGE_IMPORT_DESCRIPTOR
,
*
L
PIMAGE_IMPORT_DESCRIPTOR
;
PIMAGE_THUNK_DATA
FirstThunk
;
}
IMAGE_IMPORT_DESCRIPTOR
,
*
PIMAGE_IMPORT_DESCRIPTOR
;
#define IMAGE_ORDINAL_FLAG 0x80000000
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
...
...
@@ -285,7 +285,7 @@ typedef struct _IMAGE_EXPORT_DIRECTORY {
LPDWORD
*
AddressOfNames
;
LPWORD
*
AddressOfNameOrdinals
;
/* u_char ModuleName[1]; */
}
IMAGE_EXPORT_DIRECTORY
,
*
L
PIMAGE_EXPORT_DIRECTORY
;
}
IMAGE_EXPORT_DIRECTORY
,
*
PIMAGE_EXPORT_DIRECTORY
;
/*
...
...
@@ -299,7 +299,7 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY {
WORD
NumberOfNamedEntries
;
WORD
NumberOfIdEntries
;
/* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
}
IMAGE_RESOURCE_DIRECTORY
,
*
L
PIMAGE_RESOURCE_DIRECTORY
;
}
IMAGE_RESOURCE_DIRECTORY
,
*
PIMAGE_RESOURCE_DIRECTORY
;
#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
...
...
@@ -320,32 +320,32 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
DWORD
DataIsDirectory
:
1
;
}
s
;
}
u2
;
}
IMAGE_RESOURCE_DIRECTORY_ENTRY
,
*
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
}
IMAGE_RESOURCE_DIRECTORY_ENTRY
,
*
PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
typedef
struct
_IMAGE_RESOURCE_DIRECTORY_STRING
{
WORD
Length
;
CHAR
NameString
[
1
];
}
IMAGE_RESOURCE_DIRECTORY_STRING
,
*
L
PIMAGE_RESOURCE_DIRECTORY_STRING
;
}
IMAGE_RESOURCE_DIRECTORY_STRING
,
*
PIMAGE_RESOURCE_DIRECTORY_STRING
;
typedef
struct
_IMAGE_RESOURCE_DIR_STRING_U
{
WORD
Length
;
WCHAR
NameString
[
1
];
}
IMAGE_RESOURCE_DIR_STRING_U
,
*
L
PIMAGE_RESOURCE_DIR_STRING_U
;
}
IMAGE_RESOURCE_DIR_STRING_U
,
*
PIMAGE_RESOURCE_DIR_STRING_U
;
typedef
struct
_IMAGE_RESOURCE_DATA_ENTRY
{
DWORD
OffsetToData
;
DWORD
Size
;
DWORD
CodePage
;
DWORD
ResourceHandle
;
}
IMAGE_RESOURCE_DATA_ENTRY
,
*
L
PIMAGE_RESOURCE_DATA_ENTRY
;
}
IMAGE_RESOURCE_DATA_ENTRY
,
*
PIMAGE_RESOURCE_DATA_ENTRY
;
typedef
struct
_IMAGE_BASE_RELOCATION
{
DWORD
VirtualAddress
;
DWORD
SizeOfBlock
;
WORD
TypeOffset
[
1
];
}
IMAGE_BASE_RELOCATION
,
*
L
PIMAGE_BASE_RELOCATION
;
}
IMAGE_BASE_RELOCATION
,
*
PIMAGE_BASE_RELOCATION
;
typedef
struct
_IMAGE_LOAD_CONFIG_DIRECTORY
{
DWORD
Characteristics
;
...
...
@@ -362,9 +362,9 @@ typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
DWORD
VirtualMemoryThreshold
;
DWORD
ProcessHeapFlags
;
DWORD
Reserved
[
4
];
}
IMAGE_LOAD_CONFIG_DIRECTORY
,
*
L
PIMAGE_LOAD_CONFIG_DIRECTORY
;
}
IMAGE_LOAD_CONFIG_DIRECTORY
,
*
PIMAGE_LOAD_CONFIG_DIRECTORY
;
typedef
VOID
(
CALLBACK
*
L
PIMAGE_TLS_CALLBACK
)(
typedef
VOID
(
CALLBACK
*
PIMAGE_TLS_CALLBACK
)(
LPVOID
DllHandle
,
DWORD
Reason
,
LPVOID
Reserved
);
...
...
@@ -372,10 +372,10 @@ typedef struct _IMAGE_TLS_DIRECTORY {
DWORD
StartAddressOfRawData
;
DWORD
EndAddressOfRawData
;
LPDWORD
AddressOfIndex
;
L
PIMAGE_TLS_CALLBACK
*
AddressOfCallBacks
;
PIMAGE_TLS_CALLBACK
*
AddressOfCallBacks
;
DWORD
SizeOfZeroFill
;
DWORD
Characteristics
;
}
IMAGE_TLS_DIRECTORY
,
*
L
PIMAGE_TLS_DIRECTORY
;
}
IMAGE_TLS_DIRECTORY
,
*
PIMAGE_TLS_DIRECTORY
;
/*
* The IMAGE_DEBUG_DIRECTORY data directory points to an array of
...
...
@@ -390,7 +390,7 @@ typedef struct _IMAGE_DEBUG_DIRECTORY {
DWORD
SizeOfData
;
DWORD
AddressOfRawData
;
DWORD
PointerToRawData
;
}
IMAGE_DEBUG_DIRECTORY
,
*
L
PIMAGE_DEBUG_DIRECTORY
;
}
IMAGE_DEBUG_DIRECTORY
,
*
PIMAGE_DEBUG_DIRECTORY
;
/*
* The type field above can take these (plus a few other
...
...
@@ -430,7 +430,7 @@ typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
DWORD
ExportedNamesSize
;
DWORD
DebugDirectorySize
;
DWORD
Reserved
[
3
];
}
IMAGE_SEPARATE_DEBUG_HEADER
,
*
L
PIMAGE_SEPARATE_DEBUG_HEADER
;
}
IMAGE_SEPARATE_DEBUG_HEADER
,
*
PIMAGE_SEPARATE_DEBUG_HEADER
;
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
...
...
loader/elf.c
View file @
73d6c134
...
...
@@ -38,9 +38,9 @@ ELF_LoadLibraryEx32A(LPCSTR libname,PDB32 *process,HANDLE32 hf,DWORD flags) {
WINE_MODREF
*
wm
;
char
*
modname
,
*
s
,
*
t
,
*
x
;
LPVOID
*
dlhandle
;
L
PIMAGE_DOS_HEADER
dh
;
L
PIMAGE_NT_HEADERS
nth
;
L
PIMAGE_SECTION_HEADER
sh
;
PIMAGE_DOS_HEADER
dh
;
PIMAGE_NT_HEADERS
nth
;
PIMAGE_SECTION_HEADER
sh
;
HMODULE32
hmod
;
t
=
HeapAlloc
(
process
->
heap
,
HEAP_ZERO_MEMORY
,
strlen
(
libname
)
+
strlen
(
"lib.so"
)
+
1
);
...
...
@@ -88,7 +88,7 @@ ELF_LoadLibraryEx32A(LPCSTR libname,PDB32 *process,HANDLE32 hf,DWORD flags) {
wm
->
longname
=
HEAP_strdupA
(
process
->
heap
,
0
,
t
);
hmod
=
(
HMODULE32
)
HeapAlloc
(
process
->
heap
,
HEAP_ZERO_MEMORY
,
sizeof
(
IMAGE_DOS_HEADER
)
+
sizeof
(
IMAGE_NT_HEADERS
)
+
sizeof
(
IMAGE_SECTION_HEADER
)
+
100
);
dh
=
(
L
PIMAGE_DOS_HEADER
)
hmod
;
dh
=
(
PIMAGE_DOS_HEADER
)
hmod
;
dh
->
e_magic
=
IMAGE_DOS_SIGNATURE
;
dh
->
e_lfanew
=
sizeof
(
IMAGE_DOS_HEADER
);
nth
=
PE_HEADER
(
hmod
);
...
...
@@ -117,7 +117,7 @@ ELF_LoadLibraryEx32A(LPCSTR libname,PDB32 *process,HANDLE32 hf,DWORD flags) {
/* allocate one code section that crosses the whole process range
* (we could find out from internal tables ... hmm )
*/
sh
=
(
L
PIMAGE_SECTION_HEADER
)(
nth
+
1
);
sh
=
(
PIMAGE_SECTION_HEADER
)(
nth
+
1
);
strcpy
(
sh
->
Name
,
".text"
);
sh
->
Misc
.
VirtualSize
=
0x7fffffff
;
sh
->
VirtualAddress
=
0x42
;
/* so snoop can use it ... */
...
...
loader/module.c
View file @
73d6c134
...
...
@@ -1105,7 +1105,7 @@ FARPROC32 MODULE_GetProcAddress32(
/***********************************************************************
* RtlImageNtHeaders (NTDLL)
*/
L
PIMAGE_NT_HEADERS
WINAPI
RtlImageNtHeader
(
HMODULE32
hModule
)
PIMAGE_NT_HEADERS
WINAPI
RtlImageNtHeader
(
HMODULE32
hModule
)
{
/* basically:
* return hModule+(((IMAGE_DOS_HEADER*)hModule)->e_lfanew);
...
...
@@ -1113,7 +1113,7 @@ LPIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE32 hModule)
*/
WINE_MODREF
*
wm
=
MODULE32_LookupHMODULE
(
PROCESS_Current
(),
hModule
);
if
(
!
wm
||
(
wm
->
type
!=
MODULE32_PE
))
return
(
L
PIMAGE_NT_HEADERS
)
0
;
if
(
!
wm
||
(
wm
->
type
!=
MODULE32_PE
))
return
(
PIMAGE_NT_HEADERS
)
0
;
return
PE_HEADER
(
wm
->
module
);
}
...
...
loader/pe_image.c
View file @
73d6c134
...
...
@@ -254,7 +254,7 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
for
(
i
=
0
,
pe_imp
=
pem
->
pe_import
;
pe_imp
->
Name
;
pe_imp
++
)
{
HMODULE32
hImpModule
;
IMAGE_IMPORT_BY_NAME
*
pe_name
;
L
PIMAGE_THUNK_DATA
import_list
,
thunk_list
;
PIMAGE_THUNK_DATA
import_list
,
thunk_list
;
char
*
name
=
(
char
*
)
RVA
(
pe_imp
->
Name
);
/* don't use MODULE_Load, Win32 creates new task differently */
...
...
@@ -281,8 +281,8 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
if
(
pe_imp
->
u
.
OriginalFirstThunk
!=
0
)
{
/* original MS style */
TRACE
(
win32
,
"Microsoft style imports used
\n
"
);
import_list
=
(
L
PIMAGE_THUNK_DATA
)
RVA
(
pe_imp
->
u
.
OriginalFirstThunk
);
thunk_list
=
(
L
PIMAGE_THUNK_DATA
)
RVA
(
pe_imp
->
FirstThunk
);
import_list
=
(
PIMAGE_THUNK_DATA
)
RVA
(
pe_imp
->
u
.
OriginalFirstThunk
);
thunk_list
=
(
PIMAGE_THUNK_DATA
)
RVA
(
pe_imp
->
FirstThunk
);
while
(
import_list
->
u1
.
Ordinal
)
{
if
(
IMAGE_SNAP_BY_ORDINAL
(
import_list
->
u1
.
Ordinal
))
{
...
...
@@ -298,7 +298,7 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
thunk_list
->
u1
.
Function
=
(
FARPROC32
)
0xdeadbeef
;
}
}
else
{
/* import by name */
pe_name
=
(
L
PIMAGE_IMPORT_BY_NAME
)
RVA
(
import_list
->
u1
.
AddressOfData
);
pe_name
=
(
PIMAGE_IMPORT_BY_NAME
)
RVA
(
import_list
->
u1
.
AddressOfData
);
TRACE
(
win32
,
"--- %s %s.%d
\n
"
,
pe_name
->
Name
,
name
,
pe_name
->
Hint
);
thunk_list
->
u1
.
Function
=
MODULE_GetProcAddress32
(
process
,
hImpModule
,
pe_name
->
Name
,
TRUE
...
...
@@ -314,7 +314,7 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
}
}
else
{
/* Borland style */
TRACE
(
win32
,
"Borland style imports used
\n
"
);
thunk_list
=
(
L
PIMAGE_THUNK_DATA
)
RVA
(
pe_imp
->
FirstThunk
);
thunk_list
=
(
PIMAGE_THUNK_DATA
)
RVA
(
pe_imp
->
FirstThunk
);
while
(
thunk_list
->
u1
.
Ordinal
)
{
if
(
IMAGE_SNAP_BY_ORDINAL
(
thunk_list
->
u1
.
Ordinal
))
{
/* not sure about this branch, but it seems to work */
...
...
@@ -330,7 +330,7 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
thunk_list
->
u1
.
Function
=
(
FARPROC32
)
0xdeadbeef
;
}
}
else
{
pe_name
=
(
L
PIMAGE_IMPORT_BY_NAME
)
RVA
(
thunk_list
->
u1
.
AddressOfData
);
pe_name
=
(
PIMAGE_IMPORT_BY_NAME
)
RVA
(
thunk_list
->
u1
.
AddressOfData
);
TRACE
(
win32
,
"--- %s %s.%d
\n
"
,
pe_name
->
Name
,
name
,
pe_name
->
Hint
);
thunk_list
->
u1
.
Function
=
MODULE_GetProcAddress32
(
...
...
@@ -613,16 +613,16 @@ static BOOL32 PE_MapImage( PDB32 *process,WINE_MODREF *wm, OFSTRUCT *ofs, DWORD
#endif
if
(
strcmp
(
pe_seg
->
Name
,
".idata"
)
==
0
)
pem
->
pe_import
=
(
L
PIMAGE_IMPORT_DESCRIPTOR
)
result
;
pem
->
pe_import
=
(
PIMAGE_IMPORT_DESCRIPTOR
)
result
;
if
(
strcmp
(
pe_seg
->
Name
,
".edata"
)
==
0
)
pem
->
pe_export
=
(
L
PIMAGE_EXPORT_DIRECTORY
)
result
;
pem
->
pe_export
=
(
PIMAGE_EXPORT_DIRECTORY
)
result
;
if
(
strcmp
(
pe_seg
->
Name
,
".rsrc"
)
==
0
)
pem
->
pe_resource
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
result
;
pem
->
pe_resource
=
(
PIMAGE_RESOURCE_DIRECTORY
)
result
;
if
(
strcmp
(
pe_seg
->
Name
,
".reloc"
)
==
0
)
pem
->
pe_reloc
=
(
L
PIMAGE_BASE_RELOCATION
)
result
;
pem
->
pe_reloc
=
(
PIMAGE_BASE_RELOCATION
)
result
;
}
/* There is word that the actual loader does not care about the
...
...
@@ -633,7 +633,7 @@ static BOOL32 PE_MapImage( PDB32 *process,WINE_MODREF *wm, OFSTRUCT *ofs, DWORD
if
(
pem
->
pe_export
&&
(
int
)
pem
->
pe_export
!=
RVA
(
dir
.
VirtualAddress
))
WARN
(
win32
,
"wrong export directory??
\n
"
);
/* always trust the directory */
pem
->
pe_export
=
(
L
PIMAGE_EXPORT_DIRECTORY
)
RVA
(
dir
.
VirtualAddress
);
pem
->
pe_export
=
(
PIMAGE_EXPORT_DIRECTORY
)
RVA
(
dir
.
VirtualAddress
);
}
dir
=
nt_header
->
OptionalHeader
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_IMPORT
];
...
...
@@ -643,7 +643,7 @@ static BOOL32 PE_MapImage( PDB32 *process,WINE_MODREF *wm, OFSTRUCT *ofs, DWORD
if(pem->pe_import && (int)pem->pe_import!=RVA(dir.VirtualAddress))
WARN(win32,"wrong import directory??\n");
*/
pem
->
pe_import
=
(
L
PIMAGE_IMPORT_DESCRIPTOR
)
RVA
(
dir
.
VirtualAddress
);
pem
->
pe_import
=
(
PIMAGE_IMPORT_DESCRIPTOR
)
RVA
(
dir
.
VirtualAddress
);
}
dir
=
nt_header
->
OptionalHeader
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_RESOURCE
];
...
...
@@ -651,7 +651,7 @@ static BOOL32 PE_MapImage( PDB32 *process,WINE_MODREF *wm, OFSTRUCT *ofs, DWORD
{
if
(
pem
->
pe_resource
&&
(
int
)
pem
->
pe_resource
!=
RVA
(
dir
.
VirtualAddress
))
WARN
(
win32
,
"wrong resource directory??
\n
"
);
pem
->
pe_resource
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
RVA
(
dir
.
VirtualAddress
);
pem
->
pe_resource
=
(
PIMAGE_RESOURCE_DIRECTORY
)
RVA
(
dir
.
VirtualAddress
);
}
if
(
nt_header
->
OptionalHeader
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_EXCEPTION
].
Size
)
...
...
@@ -934,7 +934,7 @@ void PE_InitTls(THDB *thdb)
IMAGE_NT_HEADERS
*
peh
;
DWORD
size
,
datasize
;
LPVOID
mem
;
L
PIMAGE_TLS_DIRECTORY
pdir
;
PIMAGE_TLS_DIRECTORY
pdir
;
PDB32
*
pdb
=
thdb
->
process
;
int
delta
;
...
...
@@ -965,8 +965,8 @@ void PE_InitTls(THDB *thdb)
/* don't use TlsSetValue, we are in the wrong thread */
if
(
pdir
->
AddressOfCallBacks
)
{
L
PIMAGE_TLS_CALLBACK
*
cbs
=
(
L
PIMAGE_TLS_CALLBACK
*
)
PIMAGE_TLS_CALLBACK
*
cbs
=
(
PIMAGE_TLS_CALLBACK
*
)
AdjustPtr
(
pdir
->
AddressOfCallBacks
,
delta
);
if
(
*
cbs
)
{
...
...
loader/pe_resource.c
View file @
73d6c134
...
...
@@ -46,12 +46,12 @@ HMODULE32toPE_MODREF(HMODULE32 hmod) {
* Helper function - goes down one level of PE resource tree
*
*/
LPIMAGE_RESOURCE_DIRECTORY
GetResDirEntryW
(
L
PIMAGE_RESOURCE_DIRECTORY
resdirptr
,
PIMAGE_RESOURCE_DIRECTORY
GetResDirEntryW
(
PIMAGE_RESOURCE_DIRECTORY
resdirptr
,
LPCWSTR
name
,
DWORD
root
,
BOOL32
allowdefault
)
{
int
entrynum
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
entryTable
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
entryTable
;
int
namelen
;
if
(
HIWORD
(
name
))
{
...
...
@@ -61,36 +61,36 @@ LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
lstrcpynWtoA
(
buf
,
name
+
1
,
10
);
return
GetResDirEntryW
(
resdirptr
,(
LPCWSTR
)
atoi
(
buf
),
root
,
allowdefault
);
}
entryTable
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)
(
entryTable
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)
(
(
BYTE
*
)
resdirptr
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
namelen
=
lstrlen32W
(
name
);
for
(
entrynum
=
0
;
entrynum
<
resdirptr
->
NumberOfNamedEntries
;
entrynum
++
)
{
L
PIMAGE_RESOURCE_DIR_STRING_U
str
=
(
L
PIMAGE_RESOURCE_DIR_STRING_U
)
(
root
+
PIMAGE_RESOURCE_DIR_STRING_U
str
=
(
PIMAGE_RESOURCE_DIR_STRING_U
)
(
root
+
entryTable
[
entrynum
].
u1
.
s
.
NameOffset
);
if
(
namelen
!=
str
->
Length
)
continue
;
if
(
lstrncmpi32W
(
name
,
str
->
NameString
,
str
->
Length
)
==
0
)
return
(
L
PIMAGE_RESOURCE_DIRECTORY
)
(
return
(
PIMAGE_RESOURCE_DIRECTORY
)
(
root
+
entryTable
[
entrynum
].
u2
.
s
.
OffsetToDirectory
);
}
return
NULL
;
}
else
{
entryTable
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)
(
entryTable
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)
(
(
BYTE
*
)
resdirptr
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
)
+
resdirptr
->
NumberOfNamedEntries
*
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
));
for
(
entrynum
=
0
;
entrynum
<
resdirptr
->
NumberOfIdEntries
;
entrynum
++
)
if
((
DWORD
)
entryTable
[
entrynum
].
u1
.
Name
==
(
DWORD
)
name
)
return
(
L
PIMAGE_RESOURCE_DIRECTORY
)
(
return
(
PIMAGE_RESOURCE_DIRECTORY
)
(
root
+
entryTable
[
entrynum
].
u2
.
s
.
OffsetToDirectory
);
/* just use first entry if no default can be found */
if
(
allowdefault
&&
!
name
&&
resdirptr
->
NumberOfIdEntries
)
return
(
L
PIMAGE_RESOURCE_DIRECTORY
)
(
return
(
PIMAGE_RESOURCE_DIRECTORY
)
(
root
+
entryTable
[
0
].
u2
.
s
.
OffsetToDirectory
);
return
NULL
;
...
...
@@ -103,7 +103,7 @@ LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
HANDLE32
PE_FindResourceEx32W
(
WINE_MODREF
*
wm
,
LPCWSTR
name
,
LPCWSTR
type
,
WORD
lang
)
{
L
PIMAGE_RESOURCE_DIRECTORY
resdirptr
;
PIMAGE_RESOURCE_DIRECTORY
resdirptr
;
DWORD
root
;
HANDLE32
result
;
PE_MODREF
*
pem
=
&
(
wm
->
binfmt
.
pe
);
...
...
@@ -132,7 +132,7 @@ HANDLE32 PE_LoadResource32( WINE_MODREF *wm, HANDLE32 hRsrc )
{
if
(
!
hRsrc
||
!
wm
||
wm
->
type
!=
MODULE32_PE
)
return
0
;
return
(
HANDLE32
)
(
wm
->
module
+
((
L
PIMAGE_RESOURCE_DATA_ENTRY
)
hRsrc
)
->
OffsetToData
);
return
(
HANDLE32
)
(
wm
->
module
+
((
PIMAGE_RESOURCE_DATA_ENTRY
)
hRsrc
)
->
OffsetToData
);
}
...
...
@@ -144,7 +144,7 @@ DWORD PE_SizeofResource32( HINSTANCE32 hModule, HANDLE32 hRsrc )
/* we don't need hModule */
if
(
!
hRsrc
)
return
0
;
return
((
L
PIMAGE_RESOURCE_DATA_ENTRY
)
hRsrc
)
->
Size
;
return
((
PIMAGE_RESOURCE_DATA_ENTRY
)
hRsrc
)
->
Size
;
}
/**********************************************************************
...
...
@@ -154,16 +154,16 @@ BOOL32
PE_EnumResourceTypes32A
(
HMODULE32
hmod
,
ENUMRESTYPEPROC32A
lpfun
,
LONG
lparam
)
{
PE_MODREF
*
pem
=
HMODULE32toPE_MODREF
(
hmod
);
int
i
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL32
ret
;
HANDLE32
heap
=
GetProcessHeap
();
if
(
!
pem
||
!
pem
->
pe_resource
)
return
FALSE
;
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
et
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPSTR
name
;
...
...
@@ -188,15 +188,15 @@ BOOL32
PE_EnumResourceTypes32W
(
HMODULE32
hmod
,
ENUMRESTYPEPROC32W
lpfun
,
LONG
lparam
)
{
PE_MODREF
*
pem
=
HMODULE32toPE_MODREF
(
hmod
);
int
i
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL32
ret
;
if
(
!
pem
||
!
pem
->
pe_resource
)
return
FALSE
;
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
et
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPWSTR
type
;
...
...
@@ -221,15 +221,15 @@ PE_EnumResourceNames32A(
)
{
PE_MODREF
*
pem
=
HMODULE32toPE_MODREF
(
hmod
);
int
i
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL32
ret
;
HANDLE32
heap
=
GetProcessHeap
();
LPWSTR
typeW
;
if
(
!
pem
||
!
pem
->
pe_resource
)
return
FALSE
;
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
if
(
HIWORD
(
type
))
typeW
=
HEAP_strdupAtoW
(
heap
,
0
,
type
);
else
...
...
@@ -239,7 +239,7 @@ PE_EnumResourceNames32A(
HeapFree
(
heap
,
0
,
typeW
);
if
(
!
resdir
)
return
FALSE
;
et
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPSTR
name
;
...
...
@@ -265,18 +265,18 @@ PE_EnumResourceNames32W(
)
{
PE_MODREF
*
pem
=
HMODULE32toPE_MODREF
(
hmod
);
int
i
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL32
ret
;
if
(
!
pem
||
!
pem
->
pe_resource
)
return
FALSE
;
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
resdir
=
GetResDirEntryW
(
resdir
,
type
,(
DWORD
)
pem
->
pe_resource
,
FALSE
);
if
(
!
resdir
)
return
FALSE
;
et
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPWSTR
name
;
...
...
@@ -301,8 +301,8 @@ PE_EnumResourceLanguages32A(
)
{
PE_MODREF
*
pem
=
HMODULE32toPE_MODREF
(
hmod
);
int
i
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL32
ret
;
HANDLE32
heap
=
GetProcessHeap
();
LPWSTR
nameW
,
typeW
;
...
...
@@ -310,7 +310,7 @@ PE_EnumResourceLanguages32A(
if
(
!
pem
||
!
pem
->
pe_resource
)
return
FALSE
;
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
if
(
HIWORD
(
name
))
nameW
=
HEAP_strdupAtoW
(
heap
,
0
,
name
);
else
...
...
@@ -329,7 +329,7 @@ PE_EnumResourceLanguages32A(
HeapFree
(
heap
,
0
,
typeW
);
if
(
!
resdir
)
return
FALSE
;
et
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
/* languages are just ids... I hopem */
...
...
@@ -350,21 +350,21 @@ PE_EnumResourceLanguages32W(
)
{
PE_MODREF
*
pem
=
HMODULE32toPE_MODREF
(
hmod
);
int
i
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL32
ret
;
if
(
!
pem
||
!
pem
->
pe_resource
)
return
FALSE
;
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)
pem
->
pe_resource
;
resdir
=
GetResDirEntryW
(
resdir
,
name
,(
DWORD
)
pem
->
pe_resource
,
FALSE
);
if
(
!
resdir
)
return
FALSE
;
resdir
=
GetResDirEntryW
(
resdir
,
type
,(
DWORD
)
pem
->
pe_resource
,
FALSE
);
if
(
!
resdir
)
return
FALSE
;
et
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)((
LPBYTE
)
resdir
+
sizeof
(
IMAGE_RESOURCE_DIRECTORY
));
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
ret
=
lpfun
(
hmod
,
name
,
type
,
et
[
i
].
u1
.
Id
,
lparam
);
...
...
misc/shell.c
View file @
73d6c134
...
...
@@ -602,14 +602,14 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
if
(
sig
==
IMAGE_NT_SIGNATURE
)
{
LPBYTE
peimage
,
idata
,
igdata
;
L
PIMAGE_DOS_HEADER
dheader
;
L
PIMAGE_NT_HEADERS
pe_header
;
L
PIMAGE_SECTION_HEADER
pe_sections
;
L
PIMAGE_RESOURCE_DIRECTORY
rootresdir
,
iconresdir
,
icongroupresdir
;
L
PIMAGE_RESOURCE_DATA_ENTRY
idataent
,
igdataent
;
PIMAGE_DOS_HEADER
dheader
;
PIMAGE_NT_HEADERS
pe_header
;
PIMAGE_SECTION_HEADER
pe_sections
;
PIMAGE_RESOURCE_DIRECTORY
rootresdir
,
iconresdir
,
icongroupresdir
;
PIMAGE_RESOURCE_DATA_ENTRY
idataent
,
igdataent
;
HANDLE32
fmapping
;
int
i
,
j
;
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
xresent
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
xresent
;
CURSORICONDIR
**
cids
;
fmapping
=
CreateFileMapping32A
(
hFile
,
NULL
,
PAGE_READONLY
|
SEC_COMMIT
,
0
,
0
,
NULL
);
...
...
@@ -625,20 +625,20 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
_lclose32
(
hFile
);
return
0
;
}
dheader
=
(
L
PIMAGE_DOS_HEADER
)
peimage
;
dheader
=
(
PIMAGE_DOS_HEADER
)
peimage
;
/* it is a pe header, SHELL_GetResourceTable checked that */
pe_header
=
(
L
PIMAGE_NT_HEADERS
)(
peimage
+
dheader
->
e_lfanew
);
pe_header
=
(
PIMAGE_NT_HEADERS
)(
peimage
+
dheader
->
e_lfanew
);
/* probably makes problems with short PE headers... but I haven't seen
* one yet...
*/
pe_sections
=
(
L
PIMAGE_SECTION_HEADER
)(((
char
*
)
pe_header
)
+
sizeof
(
*
pe_header
));
pe_sections
=
(
PIMAGE_SECTION_HEADER
)(((
char
*
)
pe_header
)
+
sizeof
(
*
pe_header
));
rootresdir
=
NULL
;
for
(
i
=
0
;
i
<
pe_header
->
FileHeader
.
NumberOfSections
;
i
++
)
{
if
(
pe_sections
[
i
].
Characteristics
&
IMAGE_SCN_CNT_UNINITIALIZED_DATA
)
continue
;
/* FIXME: doesn't work when the resources are not in a seperate section */
if
(
pe_sections
[
i
].
VirtualAddress
==
pe_header
->
OptionalHeader
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_RESOURCE
].
VirtualAddress
)
{
rootresdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)((
char
*
)
peimage
+
pe_sections
[
i
].
PointerToRawData
);
rootresdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)((
char
*
)
peimage
+
pe_sections
[
i
].
PointerToRawData
);
break
;
}
}
...
...
@@ -682,7 +682,7 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
/* caller just wanted the number of entries */
xresent
=
(
L
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
icongroupresdir
+
1
);
xresent
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
icongroupresdir
+
1
);
/* assure we don't get too much ... */
if
(
n
>
iconDirCount
-
nIconIndex
)
n
=
iconDirCount
-
nIconIndex
;
...
...
@@ -691,13 +691,13 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
for
(
i
=
0
;
i
<
n
;
i
++
,
xresent
++
)
{
CURSORICONDIR
*
cid
;
L
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
/* go down this resource entry, name */
resdir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)((
DWORD
)
rootresdir
+
(
xresent
->
u2
.
s
.
OffsetToDirectory
));
resdir
=
(
PIMAGE_RESOURCE_DIRECTORY
)((
DWORD
)
rootresdir
+
(
xresent
->
u2
.
s
.
OffsetToDirectory
));
/* default language (0) */
resdir
=
GetResDirEntryW
(
resdir
,(
LPWSTR
)
0
,(
DWORD
)
rootresdir
,
TRUE
);
igdataent
=
(
L
PIMAGE_RESOURCE_DATA_ENTRY
)
resdir
;
igdataent
=
(
PIMAGE_RESOURCE_DATA_ENTRY
)
resdir
;
/* lookup address in mapped image for virtual address */
igdata
=
NULL
;
...
...
@@ -730,12 +730,12 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
return
0
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
L
PIMAGE_RESOURCE_DIRECTORY
xresdir
;
PIMAGE_RESOURCE_DIRECTORY
xresdir
;
xresdir
=
GetResDirEntryW
(
iconresdir
,(
LPWSTR
)
RetPtr
[
i
],(
DWORD
)
rootresdir
,
FALSE
);
xresdir
=
GetResDirEntryW
(
xresdir
,(
LPWSTR
)
0
,(
DWORD
)
rootresdir
,
TRUE
);
idataent
=
(
L
PIMAGE_RESOURCE_DATA_ENTRY
)
xresdir
;
idataent
=
(
PIMAGE_RESOURCE_DATA_ENTRY
)
xresdir
;
idata
=
NULL
;
/* map virtual to address in image */
...
...
misc/ver.c
View file @
73d6c134
...
...
@@ -439,9 +439,9 @@ find_pe_resource(
DWORD
imagesize
,
pehdoffset
;
BYTE
*
image
;
IMAGE_DATA_DIRECTORY
resdir
;
L
PIMAGE_RESOURCE_DIRECTORY
resourcedir
,
xresdir
;
L
PIMAGE_RESOURCE_DATA_ENTRY
xresdata
;
L
PIMAGE_SECTION_HEADER
sections
;
PIMAGE_RESOURCE_DIRECTORY
resourcedir
,
xresdir
;
PIMAGE_RESOURCE_DATA_ENTRY
xresdata
;
PIMAGE_SECTION_HEADER
sections
;
pehdoffset
=
LZTELL
(
lzfd
);
LZREAD
(
&
pehd
);
...
...
@@ -455,7 +455,7 @@ find_pe_resource(
image
=
HeapAlloc
(
GetProcessHeap
(),
0
,
imagesize
);
nrofsections
=
pehd
.
FileHeader
.
NumberOfSections
;
sections
=
(
L
PIMAGE_SECTION_HEADER
)
HeapAlloc
(
GetProcessHeap
(),
0
,
pehd
.
FileHeader
.
NumberOfSections
*
sizeof
(
IMAGE_SECTION_HEADER
));
sections
=
(
PIMAGE_SECTION_HEADER
)
HeapAlloc
(
GetProcessHeap
(),
0
,
pehd
.
FileHeader
.
NumberOfSections
*
sizeof
(
IMAGE_SECTION_HEADER
));
LZSeek32
(
lzfd
,
pehdoffset
+
sizeof
(
DWORD
)
+
/* Signature */
...
...
@@ -480,7 +480,7 @@ find_pe_resource(
return
0
;
}
}
resourcedir
=
(
L
PIMAGE_RESOURCE_DIRECTORY
)(
image
+
resdir
.
VirtualAddress
);
resourcedir
=
(
PIMAGE_RESOURCE_DIRECTORY
)(
image
+
resdir
.
VirtualAddress
);
xresdir
=
GetResDirEntryW
(
resourcedir
,
typeid
,(
DWORD
)
resourcedir
,
FALSE
);
if
(
!
xresdir
)
{
TRACE
(
ver
,
"...no typeid entry found for %p
\n
"
,
typeid
);
...
...
@@ -500,7 +500,7 @@ find_pe_resource(
HeapFree
(
GetProcessHeap
(),
0
,
image
);
return
0
;
}
xresdata
=
(
L
PIMAGE_RESOURCE_DATA_ENTRY
)
xresdir
;
xresdata
=
(
PIMAGE_RESOURCE_DATA_ENTRY
)
xresdir
;
*
reslen
=
xresdata
->
Size
;
*
resdata
=
(
LPBYTE
)
xmalloc
(
*
reslen
);
memcpy
(
*
resdata
,
image
+
xresdata
->
OffsetToData
,
*
reslen
);
...
...
misc/version.c
View file @
73d6c134
...
...
@@ -105,7 +105,7 @@ void VERSION_ParseVersion( char *arg )
*/
WINDOWS_VERSION
VERSION_GetVersion
(
void
)
{
L
PIMAGE_NT_HEADERS
peheader
;
PIMAGE_NT_HEADERS
peheader
;
if
(
versionForced
)
/* user has overridden any sensible checks */
return
defaultVersion
;
...
...
objects/cursoricon.c
View file @
73d6c134
...
...
@@ -567,7 +567,7 @@ static HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name,
/* Hack to keep LoadCursor/Icon32() from spawning multiple
* copies of the same object.
*/
#define pRsrcEntry ((
L
PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)
#define pRsrcEntry ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)
if
(
!
pRsrcEntry
->
ResourceHandle
)
{
LPBYTE
bits
=
(
LPBYTE
)
LockResource32
(
handle
);
...
...
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