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
b6eaf876
Commit
b6eaf876
authored
Dec 19, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Implement GetFileVersion().
parent
f2eb6d01
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
5 deletions
+85
-5
Makefile.in
dlls/scrrun/Makefile.in
+1
-1
filesystem.c
dlls/scrrun/filesystem.c
+46
-4
filesystem.c
dlls/scrrun/tests/filesystem.c
+38
-0
No files found.
dlls/scrrun/Makefile.in
View file @
b6eaf876
MODULE
=
scrrun.dll
IMPORTS
=
uuid oleaut32
IMPORTS
=
uuid oleaut32
version
C_SRCS
=
\
dictionary.c
\
...
...
dlls/scrrun/filesystem.c
View file @
b6eaf876
...
...
@@ -30,6 +30,7 @@
#include "scrrun_private.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
scrrun
);
...
...
@@ -933,12 +934,53 @@ static HRESULT WINAPI filesys_GetStandardStream(IFileSystem3 *iface,
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
filesys_GetFileVersion
(
IFileSystem3
*
iface
,
BSTR
FileName
,
BSTR
*
FileVersion
)
static
void
get_versionstring
(
VS_FIXEDFILEINFO
*
info
,
WCHAR
*
ver
)
{
FIXME
(
"%p %s %p
\n
"
,
iface
,
debugstr_w
(
FileName
),
FileVersion
);
static
WCHAR
fmtW
[]
=
{
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
0
};
DWORDLONG
version
;
WORD
a
,
b
,
c
,
d
;
return
E_NOTIMPL
;
version
=
(((
DWORDLONG
)
info
->
dwFileVersionMS
)
<<
32
)
+
info
->
dwFileVersionLS
;
a
=
(
WORD
)(
version
>>
48
);
b
=
(
WORD
)((
version
>>
32
)
&
0xffff
);
c
=
(
WORD
)((
version
>>
16
)
&
0xffff
);
d
=
(
WORD
)(
version
&
0xffff
);
sprintfW
(
ver
,
fmtW
,
a
,
b
,
c
,
d
);
}
static
HRESULT
WINAPI
filesys_GetFileVersion
(
IFileSystem3
*
iface
,
BSTR
name
,
BSTR
*
version
)
{
static
const
WCHAR
rootW
[]
=
{
'\\'
,
0
};
VS_FIXEDFILEINFO
*
info
;
WCHAR
ver
[
30
];
void
*
ptr
;
DWORD
len
;
BOOL
ret
;
TRACE
(
"%p %s %p
\n
"
,
iface
,
debugstr_w
(
name
),
version
);
len
=
GetFileVersionInfoSizeW
(
name
,
NULL
);
if
(
!
len
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
ptr
=
heap_alloc
(
len
);
if
(
!
GetFileVersionInfoW
(
name
,
0
,
len
,
ptr
))
{
heap_free
(
ptr
);
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
ret
=
VerQueryValueW
(
ptr
,
rootW
,
(
void
**
)
&
info
,
&
len
);
heap_free
(
ptr
);
if
(
!
ret
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
get_versionstring
(
info
,
ver
);
*
version
=
SysAllocString
(
ver
);
TRACE
(
"version=%s
\n
"
,
debugstr_w
(
ver
));
return
S_OK
;
}
static
const
struct
IFileSystem3Vtbl
filesys_vtbl
=
...
...
dlls/scrrun/tests/filesystem.c
View file @
b6eaf876
...
...
@@ -217,6 +217,43 @@ todo_wine {
DeleteFileW
(
testfileW
);
}
static
void
test_GetFileVersion
(
void
)
{
static
const
WCHAR
k32W
[]
=
{
'\\'
,
'k'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
k33W
[]
=
{
'\\'
,
'k'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'3'
,
'3'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
WCHAR
pathW
[
MAX_PATH
],
filenameW
[
MAX_PATH
];
BSTR
path
,
version
;
HRESULT
hr
;
GetSystemDirectoryW
(
pathW
,
sizeof
(
pathW
)
/
sizeof
(
WCHAR
));
lstrcpyW
(
filenameW
,
pathW
);
lstrcatW
(
filenameW
,
k32W
);
path
=
SysAllocString
(
filenameW
);
hr
=
IFileSystem3_GetFileVersion
(
fs3
,
path
,
&
version
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
*
version
!=
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
version
));
SysFreeString
(
version
);
SysFreeString
(
path
);
lstrcpyW
(
filenameW
,
pathW
);
lstrcatW
(
filenameW
,
k33W
);
path
=
SysAllocString
(
filenameW
);
version
=
(
void
*
)
0xdeadbeef
;
hr
=
IFileSystem3_GetFileVersion
(
fs3
,
path
,
&
version
);
ok
(
broken
(
hr
==
S_OK
)
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
*
version
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
version
));
SysFreeString
(
version
);
}
else
ok
(
version
==
(
void
*
)
0xdeadbeef
,
"got %p
\n
"
,
version
);
SysFreeString
(
path
);
}
START_TEST
(
filesystem
)
{
HRESULT
hr
;
...
...
@@ -233,6 +270,7 @@ START_TEST(filesystem)
test_interfaces
();
test_createfolder
();
test_textstream
();
test_GetFileVersion
();
IFileSystem3_Release
(
fs3
);
...
...
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