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
2788a95c
Commit
2788a95c
authored
Sep 20, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Support TrueType font files in MsiGetFileVersion.
parent
72000726
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
72 deletions
+79
-72
action.c
dlls/msi/action.c
+1
-1
files.c
dlls/msi/files.c
+1
-1
font.c
dlls/msi/font.c
+9
-2
msi.c
dlls/msi/msi.c
+67
-67
msipriv.h
dlls/msi/msipriv.h
+1
-1
No files found.
dlls/msi/action.c
View file @
2788a95c
...
...
@@ -2196,7 +2196,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
msi_free
(
file_version
);
continue
;
}
else
if
((
font_version
=
font_version_from_file
(
file
->
TargetPath
)))
else
if
((
font_version
=
msi_
font_version_from_file
(
file
->
TargetPath
)))
{
if
(
msi_compare_font_versions
(
font_version
,
file
->
Version
)
<
0
)
{
...
...
dlls/msi/files.c
View file @
2788a95c
...
...
@@ -103,7 +103,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil
msi_free
(
file_version
);
return
state
;
}
else
if
((
font_version
=
font_version_from_file
(
file
->
TargetPath
)))
else
if
((
font_version
=
msi_
font_version_from_file
(
file
->
TargetPath
)))
{
TRACE
(
"new %s old %s
\n
"
,
debugstr_w
(
file
->
Version
),
debugstr_w
(
font_version
));
...
...
dlls/msi/font.c
View file @
2788a95c
...
...
@@ -186,15 +186,22 @@ static WCHAR *font_name_from_file( const WCHAR *filename )
return
ret
;
}
WCHAR
*
font_version_from_file
(
const
WCHAR
*
filename
)
WCHAR
*
msi_
font_version_from_file
(
const
WCHAR
*
filename
)
{
static
const
WCHAR
dotzerodotzeroW
[]
=
{
'.'
,
'0'
,
'.'
,
'0'
,
0
};
WCHAR
*
version
,
*
p
,
*
ret
=
NULL
;
int
len
;
if
((
p
=
version
=
load_ttf_name_id
(
filename
,
NAME_ID_VERSION
)))
{
while
(
*
p
&&
!
isdigitW
(
*
p
))
p
++
;
ret
=
msi_alloc
(
(
strlenW
(
p
)
+
1
)
*
sizeof
(
WCHAR
)
);
len
=
strlenW
(
p
)
+
strlenW
(
dotzerodotzeroW
)
+
1
;
ret
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
strcpyW
(
ret
,
p
);
if
((
p
=
strchrW
(
p
,
'.'
))
&&
!
(
p
=
strchrW
(
p
+
1
,
'.'
)))
{
strcatW
(
ret
,
dotzerodotzeroW
);
}
msi_free
(
version
);
}
return
ret
;
...
...
dlls/msi/msi.c
View file @
2788a95c
...
...
@@ -3017,11 +3017,8 @@ end:
return
ret
;
}
/******************************************************************
* MsiGetFileVersionW [MSI.@]
*/
UINT
WINAPI
MsiGetFileVersionW
(
LPCWSTR
szFilePath
,
LPWSTR
lpVersionBuf
,
LPDWORD
pcchVersionBuf
,
LPWSTR
lpLangBuf
,
LPDWORD
pcchLangBuf
)
static
UINT
get_file_version
(
const
WCHAR
*
path
,
WCHAR
*
verbuf
,
DWORD
*
verlen
,
WCHAR
*
langbuf
,
DWORD
*
langlen
)
{
static
const
WCHAR
szVersionResource
[]
=
{
'\\'
,
0
};
static
const
WCHAR
szVersionFormat
[]
=
{
...
...
@@ -3030,91 +3027,94 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
'\\'
,
'V'
,
'a'
,
'r'
,
'F'
,
'i'
,
'l'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
'\\'
,
'T'
,
'r'
,
'a'
,
'n'
,
's'
,
'l'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
szLangFormat
[]
=
{
'%'
,
'd'
,
0
};
UINT
ret
=
0
;
DWORD
dwVerLen
,
gle
;
LPVOID
lpVer
=
NULL
;
UINT
ret
=
ERROR_SUCCESS
;
DWORD
len
,
error
;
LPVOID
version
;
VS_FIXEDFILEINFO
*
ffi
;
USHORT
*
lang
;
UINT
puLen
;
WCHAR
tmp
[
32
];
TRACE
(
"%s %p %d %p %d
\n
"
,
debugstr_w
(
szFilePath
),
lpVersionBuf
,
pcchVersionBuf
?*
pcchVersionBuf
:
0
,
lpLangBuf
,
pcchLangBuf
?*
pcchLangBuf
:
0
);
if
((
lpVersionBuf
&&
!
pcchVersionBuf
)
||
(
lpLangBuf
&&
!
pcchLangBuf
))
return
ERROR_INVALID_PARAMETER
;
dwVerLen
=
GetFileVersionInfoSizeW
(
szFilePath
,
NULL
);
if
(
!
dwVerLen
)
if
(
!
(
len
=
GetFileVersionInfoSizeW
(
path
,
NULL
)))
{
gle
=
GetLastError
();
if
(
gle
==
ERROR_BAD_PATHNAME
)
return
ERROR_FILE_NOT_FOUND
;
else
if
(
gle
==
ERROR_RESOURCE_DATA_NOT_FOUND
)
return
ERROR_FILE_INVALID
;
return
gle
;
error
=
GetLastError
();
if
(
error
==
ERROR_BAD_PATHNAME
)
return
ERROR_FILE_NOT_FOUND
;
return
error
;
}
lpVer
=
msi_alloc
(
dwVerLen
);
if
(
!
lpVer
)
if
(
!
(
version
=
msi_alloc
(
len
)))
return
ERROR_OUTOFMEMORY
;
if
(
!
GetFileVersionInfoW
(
path
,
0
,
len
,
version
))
{
ret
=
ERROR_OUTOFMEMORY
;
goto
end
;
msi_free
(
version
)
;
return
GetLastError
()
;
}
if
(
!
GetFileVersionInfoW
(
szFilePath
,
0
,
dwVerLen
,
lpVer
)
)
if
(
verlen
)
{
ret
=
GetLastError
();
goto
end
;
}
if
(
pcchVersionBuf
)
{
if
(
VerQueryValueW
(
lpVer
,
szVersionResource
,
(
LPVOID
*
)
&
ffi
,
&
puLen
)
&&
(
puLen
>
0
)
)
if
(
VerQueryValueW
(
version
,
szVersionResource
,
(
LPVOID
*
)
&
ffi
,
&
len
)
&&
len
>
0
)
{
wsprintfW
(
tmp
,
szVersionFormat
,
HIWORD
(
ffi
->
dwFileVersionMS
),
LOWORD
(
ffi
->
dwFileVersionMS
),
HIWORD
(
ffi
->
dwFileVersionLS
),
LOWORD
(
ffi
->
dwFileVersionLS
));
if
(
lpVersionBuf
)
lstrcpynW
(
lpVersionBuf
,
tmp
,
*
pcchVersionBuf
);
if
(
strlenW
(
tmp
)
>=
*
pcchVersionBuf
)
ret
=
ERROR_MORE_DATA
;
*
pcchVersionBuf
=
lstrlenW
(
tmp
);
sprintfW
(
tmp
,
szVersionFormat
,
HIWORD
(
ffi
->
dwFileVersionMS
),
LOWORD
(
ffi
->
dwFileVersionMS
),
HIWORD
(
ffi
->
dwFileVersionLS
),
LOWORD
(
ffi
->
dwFileVersionLS
)
);
if
(
verbuf
)
lstrcpynW
(
verbuf
,
tmp
,
*
verlen
);
len
=
strlenW
(
tmp
);
if
(
len
>=
*
verlen
)
ret
=
ERROR_MORE_DATA
;
*
verlen
=
len
;
}
else
{
if
(
lpVersionBuf
)
*
lpVersionB
uf
=
0
;
*
pcchVersionBuf
=
0
;
if
(
verbuf
)
*
verb
uf
=
0
;
*
verlen
=
0
;
}
}
if
(
pcchLangBuf
)
if
(
langlen
)
{
if
(
VerQueryValueW
(
lpVer
,
szLangResource
,
(
LPVOID
*
)
&
lang
,
&
puLen
)
&&
(
puLen
>
0
))
if
(
VerQueryValueW
(
version
,
szLangResource
,
(
LPVOID
*
)
&
lang
,
&
len
)
&&
len
>
0
)
{
wsprintfW
(
tmp
,
szLangFormat
,
*
lang
);
if
(
lpLangBuf
)
lstrcpynW
(
lpLangBuf
,
tmp
,
*
pcchLangBuf
);
if
(
strlenW
(
tmp
)
>=
*
pcchLangBuf
)
ret
=
ERROR_MORE_DATA
;
*
pcchLangBuf
=
lstrlenW
(
tmp
);
sprintfW
(
tmp
,
szLangFormat
,
*
lang
);
if
(
langbuf
)
lstrcpynW
(
langbuf
,
tmp
,
*
langlen
);
len
=
strlenW
(
tmp
);
if
(
len
>=
*
langlen
)
ret
=
ERROR_MORE_DATA
;
*
langlen
=
len
;
}
else
{
if
(
l
pLangBuf
)
*
lpLangB
uf
=
0
;
*
pcchLangBuf
=
0
;
if
(
l
angbuf
)
*
langb
uf
=
0
;
*
langlen
=
0
;
}
}
msi_free
(
version
);
return
ret
;
}
end:
msi_free
(
lpVer
);
/******************************************************************
* MsiGetFileVersionW [MSI.@]
*/
UINT
WINAPI
MsiGetFileVersionW
(
LPCWSTR
path
,
LPWSTR
verbuf
,
LPDWORD
verlen
,
LPWSTR
langbuf
,
LPDWORD
langlen
)
{
UINT
ret
;
TRACE
(
"%s %p %u %p %u
\n
"
,
debugstr_w
(
path
),
verbuf
,
verlen
?
*
verlen
:
0
,
langbuf
,
langlen
?
*
langlen
:
0
);
if
((
verbuf
&&
!
verlen
)
||
(
langbuf
&&
!
langlen
))
return
ERROR_INVALID_PARAMETER
;
ret
=
get_file_version
(
path
,
verbuf
,
verlen
,
langbuf
,
langlen
);
if
(
ret
==
ERROR_RESOURCE_DATA_NOT_FOUND
)
{
int
len
;
WCHAR
*
version
=
msi_font_version_from_file
(
path
);
if
(
!
version
)
return
ERROR_FILE_INVALID
;
len
=
strlenW
(
version
);
if
(
*
verlen
>
len
)
{
strcpyW
(
verbuf
,
version
);
ret
=
ERROR_SUCCESS
;
}
else
ret
=
ERROR_MORE_DATA
;
*
verlen
=
len
;
msi_free
(
version
);
}
return
ret
;
}
...
...
dlls/msi/msipriv.h
View file @
2788a95c
...
...
@@ -1022,7 +1022,7 @@ extern MSIASSEMBLY *msi_load_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HID
extern
UINT
msi_install_assembly
(
MSIPACKAGE
*
,
MSICOMPONENT
*
)
DECLSPEC_HIDDEN
;
extern
BOOL
msi_init_assembly_caches
(
MSIPACKAGE
*
)
DECLSPEC_HIDDEN
;
extern
void
msi_destroy_assembly_caches
(
MSIPACKAGE
*
)
DECLSPEC_HIDDEN
;
extern
WCHAR
*
font_version_from_file
(
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
WCHAR
*
msi_
font_version_from_file
(
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
WCHAR
**
msi_split_string
(
const
WCHAR
*
,
WCHAR
)
DECLSPEC_HIDDEN
;
/* media */
...
...
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