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
9f6d4bc0
Commit
9f6d4bc0
authored
Aug 20, 2000
by
Dusan Lacko
Committed by
Alexandre Julliard
Aug 20, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass the type/name as a C string instead of an
IMAGE_RESOURCE_DIR_STRING_U structure to the callback function.
parent
2a2321bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
62 deletions
+77
-62
pe_resource.c
loader/pe_resource.c
+77
-62
No files found.
loader/pe_resource.c
View file @
9f6d4bc0
...
@@ -263,22 +263,32 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG lpara
...
@@ -263,22 +263,32 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG lpara
PIMAGE_RESOURCE_DIRECTORY
resdir
=
get_resdir
(
hmod
);
PIMAGE_RESOURCE_DIRECTORY
resdir
=
get_resdir
(
hmod
);
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL
ret
;
BOOL
ret
;
HANDLE
heap
=
GetProcessHeap
();
if
(
!
resdir
)
return
FALSE
;
if
(
!
resdir
)
return
FALSE
;
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
ret
=
FALSE
;
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPSTR
name
;
LPSTR
type
;
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
name
=
HEAP_strdupWtoA
(
heap
,
0
,(
LPWSTR
)((
LPBYTE
)
resdir
+
et
[
i
].
u1
.
s
.
NameOffset
));
{
else
PIMAGE_RESOURCE_DIR_STRING_U
pResString
=
(
PIMAGE_RESOURCE_DIR_STRING_U
)
((
LPBYTE
)
resdir
+
et
[
i
].
u1
.
s
.
NameOffset
);
name
=
(
LPSTR
)(
int
)
et
[
i
].
u1
.
Id
;
DWORD
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
pResString
->
NameString
,
pResString
->
Length
,
ret
=
lpfun
(
hmod
,
name
,
lparam
);
NULL
,
0
,
NULL
,
NULL
);
if
(
HIWORD
(
name
))
if
(
!
(
type
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
)))
HeapFree
(
heap
,
0
,
name
);
return
FALSE
;
WideCharToMultiByte
(
CP_ACP
,
0
,
pResString
->
NameString
,
pResString
->
Length
,
type
,
len
,
NULL
,
NULL
);
type
[
len
]
=
'\0'
;
ret
=
lpfun
(
hmod
,
type
,
lparam
);
HeapFree
(
GetProcessHeap
(),
0
,
type
);
}
else
{
type
=
(
LPSTR
)(
int
)
et
[
i
].
u1
.
Id
;
ret
=
lpfun
(
hmod
,
type
,
lparam
);
}
if
(
!
ret
)
if
(
!
ret
)
break
;
break
;
}
}
...
@@ -302,12 +312,22 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG lpara
...
@@ -302,12 +312,22 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG lpara
ret
=
FALSE
;
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPWSTR
type
;
LPWSTR
type
;
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
type
=
(
LPWSTR
)((
LPBYTE
)
resdir
+
et
[
i
].
u1
.
s
.
NameOffset
);
else
type
=
(
LPWSTR
)(
int
)
et
[
i
].
u1
.
Id
;
ret
=
lpfun
(
hmod
,
type
,
lparam
);
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
{
PIMAGE_RESOURCE_DIR_STRING_U
pResString
=
(
PIMAGE_RESOURCE_DIR_STRING_U
)
((
LPBYTE
)
resdir
+
et
[
i
].
u1
.
s
.
NameOffset
);
if
(
!
(
type
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
pResString
->
Length
+
1
)
*
sizeof
(
WCHAR
))))
return
FALSE
;
memcpy
(
type
,
pResString
->
NameString
,
pResString
->
Length
*
sizeof
(
WCHAR
));
type
[
pResString
->
Length
]
=
'\0'
;
ret
=
lpfun
(
hmod
,
type
,
lparam
);
HeapFree
(
GetProcessHeap
(),
0
,
type
);
}
else
{
type
=
(
LPWSTR
)(
int
)
et
[
i
].
u1
.
Id
;
ret
=
lpfun
(
hmod
,
type
,
lparam
);
}
if
(
!
ret
)
if
(
!
ret
)
break
;
break
;
}
}
...
@@ -325,31 +345,34 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
...
@@ -325,31 +345,34 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL
ret
;
BOOL
ret
;
HANDLE
heap
=
GetProcessHeap
();
LPWSTR
typeW
;
if
(
!
basedir
)
return
FALSE
;
if
(
!
basedir
)
return
FALSE
;
if
(
HIWORD
(
type
))
if
(
!
(
resdir
=
GetResDirEntryA
(
basedir
,
type
,(
DWORD
)
basedir
,
FALSE
)))
return
FALSE
;
typeW
=
HEAP_strdupAtoW
(
heap
,
0
,
type
);
else
typeW
=
(
LPWSTR
)
type
;
resdir
=
GetResDirEntryW
(
basedir
,
typeW
,(
DWORD
)
basedir
,
FALSE
);
if
(
HIWORD
(
typeW
))
HeapFree
(
heap
,
0
,
typeW
);
if
(
!
resdir
)
return
FALSE
;
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
ret
=
FALSE
;
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPSTR
name
;
LPSTR
name
;
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
name
=
HEAP_strdupWtoA
(
heap
,
0
,(
LPWSTR
)((
LPBYTE
)
basedir
+
et
[
i
].
u1
.
s
.
NameOffset
));
{
else
PIMAGE_RESOURCE_DIR_STRING_U
pResString
=
(
PIMAGE_RESOURCE_DIR_STRING_U
)
((
LPBYTE
)
basedir
+
et
[
i
].
u1
.
s
.
NameOffset
);
name
=
(
LPSTR
)(
int
)
et
[
i
].
u1
.
Id
;
DWORD
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
pResString
->
NameString
,
pResString
->
Length
,
ret
=
lpfun
(
hmod
,
type
,
name
,
lparam
);
NULL
,
0
,
NULL
,
NULL
);
if
(
HIWORD
(
name
))
HeapFree
(
heap
,
0
,
name
);
if
(
!
(
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
)))
return
FALSE
;
WideCharToMultiByte
(
CP_ACP
,
0
,
pResString
->
NameString
,
pResString
->
Length
,
name
,
len
,
NULL
,
NULL
);
name
[
len
]
=
'\0'
;
ret
=
lpfun
(
hmod
,
type
,
name
,
lparam
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
}
else
{
name
=
(
LPSTR
)(
int
)
et
[
i
].
u1
.
Id
;
ret
=
lpfun
(
hmod
,
type
,
name
,
lparam
);
}
if
(
!
ret
)
if
(
!
ret
)
break
;
break
;
}
}
...
@@ -376,12 +399,23 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
...
@@ -376,12 +399,23 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
ret
=
FALSE
;
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
LPWSTR
name
;
LPWSTR
name
;
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
name
=
(
LPWSTR
)((
LPBYTE
)
basedir
+
et
[
i
].
u1
.
s
.
NameOffset
);
if
(
et
[
i
].
u1
.
s
.
NameIsString
)
else
{
name
=
(
LPWSTR
)(
int
)
et
[
i
].
u1
.
Id
;
PIMAGE_RESOURCE_DIR_STRING_U
pResString
=
(
PIMAGE_RESOURCE_DIR_STRING_U
)
((
LPBYTE
)
basedir
+
et
[
i
].
u1
.
s
.
NameOffset
);
ret
=
lpfun
(
hmod
,
type
,
name
,
lparam
);
if
(
!
(
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
pResString
->
Length
+
1
)
*
sizeof
(
WCHAR
))))
return
FALSE
;
memcpy
(
name
,
pResString
->
NameString
,
pResString
->
Length
*
sizeof
(
WCHAR
));
name
[
pResString
->
Length
]
=
'\0'
;
ret
=
lpfun
(
hmod
,
type
,
name
,
lparam
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
}
else
{
name
=
(
LPWSTR
)(
int
)
et
[
i
].
u1
.
Id
;
ret
=
lpfun
(
hmod
,
type
,
name
,
lparam
);
}
if
(
!
ret
)
if
(
!
ret
)
break
;
break
;
}
}
...
@@ -400,34 +434,15 @@ BOOL WINAPI EnumResourceLanguagesA( HMODULE hmod, LPCSTR type, LPCSTR name,
...
@@ -400,34 +434,15 @@ BOOL WINAPI EnumResourceLanguagesA( HMODULE hmod, LPCSTR type, LPCSTR name,
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY
resdir
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
PIMAGE_RESOURCE_DIRECTORY_ENTRY
et
;
BOOL
ret
;
BOOL
ret
;
HANDLE
heap
=
GetProcessHeap
();
if
(
!
basedir
)
return
FALSE
;
if
(
!
basedir
)
return
FALSE
;
if
(
!
(
resdir
=
GetResDirEntryA
(
basedir
,
type
,(
DWORD
)
basedir
,
FALSE
)))
return
FALSE
;
if
(
HIWORD
(
type
))
if
(
!
(
resdir
=
GetResDirEntryA
(
resdir
,
name
,(
DWORD
)
basedir
,
FALSE
)))
return
FALSE
;
{
LPWSTR
typeW
=
HEAP_strdupAtoW
(
heap
,
0
,
type
);
resdir
=
GetResDirEntryW
(
basedir
,
typeW
,(
DWORD
)
basedir
,
FALSE
);
HeapFree
(
heap
,
0
,
typeW
);
}
else
resdir
=
GetResDirEntryW
(
basedir
,(
LPWSTR
)
type
,(
DWORD
)
basedir
,
FALSE
);
if
(
!
resdir
)
return
FALSE
;
if
(
HIWORD
(
name
))
{
LPWSTR
nameW
=
HEAP_strdupAtoW
(
heap
,
0
,
name
);
resdir
=
GetResDirEntryW
(
resdir
,
nameW
,(
DWORD
)
basedir
,
FALSE
);
HeapFree
(
heap
,
0
,
nameW
);
}
else
resdir
=
GetResDirEntryW
(
resdir
,(
LPWSTR
)
name
,(
DWORD
)
basedir
,
FALSE
);
if
(
!
resdir
)
return
FALSE
;
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
et
=
(
PIMAGE_RESOURCE_DIRECTORY_ENTRY
)(
resdir
+
1
);
ret
=
FALSE
;
ret
=
FALSE
;
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
/* languages are just ids... I hope */
/* languages are just ids... I hope */
ret
=
lpfun
(
hmod
,
type
,
name
,
et
[
i
].
u1
.
Id
,
lparam
);
ret
=
lpfun
(
hmod
,
type
,
name
,
et
[
i
].
u1
.
Id
,
lparam
);
if
(
!
ret
)
if
(
!
ret
)
break
;
break
;
...
...
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