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
e446a7c7
Commit
e446a7c7
authored
Aug 02, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Rename some variables to reflect the fact that we no longer use XPM format.
parent
300536d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
33 deletions
+25
-33
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+25
-33
No files found.
programs/winemenubuilder/winemenubuilder.c
View file @
e446a7c7
...
...
@@ -372,7 +372,7 @@ static BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR l
return
TRUE
;
}
static
BOOL
extract_icon
32
(
LPCWSTR
szFileName
,
int
nIndex
,
char
*
szXPMFileN
ame
)
static
BOOL
extract_icon
_from_module
(
LPCWSTR
szFileName
,
int
nIndex
,
const
char
*
icon_n
ame
)
{
HMODULE
hModule
;
HRSRC
hResInfo
;
...
...
@@ -452,7 +452,7 @@ static BOOL extract_icon32(LPCWSTR szFileName, int nIndex, char *szXPMFileName)
{
if
((
pIcon
=
LockResource
(
hResData
)))
{
if
(
reassemble_and_save_to_png
(
&
iconDirEntry
,
pIcon
,
szXPMFileN
ame
,
szFileName
))
if
(
reassemble_and_save_to_png
(
&
iconDirEntry
,
pIcon
,
icon_n
ame
,
szFileName
))
ret
=
TRUE
;
else
ret
=
FALSE
;
...
...
@@ -466,24 +466,16 @@ static BOOL extract_icon32(LPCWSTR szFileName, int nIndex, char *szXPMFileName)
return
ret
;
}
static
BOOL
ExtractFromEXEDLL
(
LPCWSTR
szFileName
,
int
nIndex
,
char
*
szXPMFileN
ame
)
static
int
ExtractFromICO
(
LPCWSTR
szFileName
,
const
char
*
icon_n
ame
)
{
if
(
!
extract_icon32
(
szFileName
,
nIndex
,
szXPMFileName
)
/*&&
!extract_icon16(szFileName, szXPMFileName)*/
)
return
FALSE
;
return
TRUE
;
}
static
int
ExtractFromICO
(
LPCWSTR
szFileName
,
char
*
szXPMFileName
)
{
FILE
*
fICOFile
=
NULL
;
FILE
*
fICOFile
;
ICONDIR
iconDir
;
ICONDIRENTRY
*
pIconDirEntry
=
NULL
;
int
nMax
=
0
,
nMaxBits
=
0
;
int
nIndex
=
0
;
void
*
pIcon
=
NULL
;
int
i
;
char
*
filename
=
NULL
;
char
*
filename
;
IStream
*
icoStream
=
NULL
;
HRESULT
hr
;
...
...
@@ -536,7 +528,7 @@ static int ExtractFromICO(LPCWSTR szFileName, char *szXPMFileName)
goto
error
;
}
if
(
!
SaveIconStreamAsPNG
(
icoStream
,
nIndex
,
szXPMFileN
ame
,
szFileName
))
if
(
!
SaveIconStreamAsPNG
(
icoStream
,
nIndex
,
icon_n
ame
,
szFileName
))
goto
error
;
HeapFree
(
GetProcessHeap
(),
0
,
pIcon
);
...
...
@@ -556,7 +548,7 @@ static int ExtractFromICO(LPCWSTR szFileName, char *szXPMFileName)
return
0
;
}
static
int
ExtractFromFileType
(
LPCWSTR
szFileName
,
c
har
*
szXPMFileN
ame
)
static
int
ExtractFromFileType
(
LPCWSTR
szFileName
,
c
onst
char
*
icon_n
ame
)
{
int
ret
=
0
;
WCHAR
*
extension
;
...
...
@@ -590,7 +582,7 @@ static int ExtractFromFileType(LPCWSTR szFileName, char *szXPMFileName)
WINE_TRACE
(
"executable %s -> icon %s
\n
"
,
wine_dbgstr_w
(
executable
),
wine_dbgstr_a
(
output_path
));
}
if
(
output_path
)
ret
=
(
rename
(
output_path
,
szXPMFileN
ame
)
==
0
);
ret
=
(
rename
(
output_path
,
icon_n
ame
)
==
0
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
icon
);
...
...
@@ -599,11 +591,11 @@ end:
return
ret
;
}
static
BOOL
create_default_icon
(
char
*
filename
)
static
BOOL
create_default_icon
(
c
onst
c
har
*
filename
)
{
static
const
WCHAR
user32W
[]
=
{
'u'
,
's'
,
'e'
,
'r'
,
'3'
,
'2'
,
0
};
return
extract_icon
32
(
user32W
,
-
(
INT_PTR
)
IDI_WINLOGO
,
filename
);
return
extract_icon
_from_module
(
user32W
,
-
(
INT_PTR
)
IDI_WINLOGO
,
filename
);
}
static
unsigned
short
crc16
(
const
char
*
string
)
...
...
@@ -737,7 +729,7 @@ static WCHAR* utf8_chars_to_wchars(LPCSTR string)
static
char
*
extract_icon
(
LPCWSTR
path
,
int
index
,
const
char
*
destFilename
,
BOOL
bWait
)
{
unsigned
short
crc
;
char
*
iconsdir
=
NULL
,
*
ico_path
=
NULL
,
*
ico_name
,
*
xpm
_path
=
NULL
;
char
*
iconsdir
=
NULL
,
*
ico_path
=
NULL
,
*
ico_name
,
*
png
_path
=
NULL
;
char
*
s
;
int
n
;
...
...
@@ -781,37 +773,37 @@ static char *extract_icon( LPCWSTR path, int index, const char *destFilename, BO
/* Try to treat the source file as an exe */
if
(
destFilename
)
xpm
_path
=
heap_printf
(
"%s/%s.png"
,
iconsdir
,
destFilename
);
png
_path
=
heap_printf
(
"%s/%s.png"
,
iconsdir
,
destFilename
);
else
xpm
_path
=
heap_printf
(
"%s/%04x_%s.%d.png"
,
iconsdir
,
crc
,
ico_name
,
index
);
if
(
xpm
_path
==
NULL
)
png
_path
=
heap_printf
(
"%s/%04x_%s.%d.png"
,
iconsdir
,
crc
,
ico_name
,
index
);
if
(
png
_path
==
NULL
)
{
WINE_ERR
(
"could not extract icon %s, out of memory
\n
"
,
wine_dbgstr_a
(
ico_name
));
return
NULL
;
}
if
(
ExtractFromEXEDLL
(
path
,
index
,
xpm
_path
))
if
(
extract_icon_from_module
(
path
,
index
,
png
_path
))
goto
end
;
/* Must be something else, ignore the index in that case */
if
(
destFilename
)
sprintf
(
xpm
_path
,
"%s/%s.png"
,
iconsdir
,
destFilename
);
sprintf
(
png
_path
,
"%s/%s.png"
,
iconsdir
,
destFilename
);
else
sprintf
(
xpm
_path
,
"%s/%04x_%s.png"
,
iconsdir
,
crc
,
ico_name
);
if
(
ExtractFromICO
(
path
,
xpm
_path
))
sprintf
(
png
_path
,
"%s/%04x_%s.png"
,
iconsdir
,
crc
,
ico_name
);
if
(
ExtractFromICO
(
path
,
png
_path
))
goto
end
;
if
(
ExtractFromFileType
(
path
,
xpm
_path
))
if
(
ExtractFromFileType
(
path
,
png
_path
))
goto
end
;
if
(
!
bWait
&&
create_default_icon
(
xpm
_path
))
if
(
!
bWait
&&
create_default_icon
(
png
_path
))
goto
end
;
HeapFree
(
GetProcessHeap
(),
0
,
xpm
_path
);
xpm
_path
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
png
_path
);
png
_path
=
NULL
;
end:
HeapFree
(
GetProcessHeap
(),
0
,
iconsdir
);
HeapFree
(
GetProcessHeap
(),
0
,
ico_path
);
return
xpm
_path
;
return
png
_path
;
}
static
HKEY
open_menus_reg_key
(
void
)
...
...
@@ -2815,12 +2807,12 @@ static void thumbnail_lnk(LPCWSTR lnkPath, LPCWSTR outputPath)
if
(
szIconPath
[
0
])
{
if
(
!
ExtractFromEXEDLL
(
szIconPath
,
iconId
,
utf8OutputPath
))
if
(
!
extract_icon_from_module
(
szIconPath
,
iconId
,
utf8OutputPath
))
ExtractFromICO
(
szIconPath
,
utf8OutputPath
);
}
else
{
if
(
!
ExtractFromEXEDLL
(
szPath
,
iconId
,
utf8OutputPath
))
if
(
!
extract_icon_from_module
(
szPath
,
iconId
,
utf8OutputPath
))
ExtractFromICO
(
szPath
,
utf8OutputPath
);
}
...
...
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