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
a9cc6f02
Commit
a9cc6f02
authored
Mar 27, 2016
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Implement OleLoadPictureFile.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
parent
176fa9ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
9 deletions
+80
-9
olepicture.c
dlls/oleaut32/olepicture.c
+27
-9
olepicture.c
dlls/oleaut32/tests/olepicture.c
+53
-0
No files found.
dlls/oleaut32/olepicture.c
View file @
a9cc6f02
...
...
@@ -2297,15 +2297,6 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
return
hr
;
}
/***********************************************************************
* OleLoadPictureFile (OLEAUT32.422)
*/
HRESULT
WINAPI
OleLoadPictureFile
(
VARIANT
file
,
LPDISPATCH
*
picture
)
{
FIXME
(
"(%s %p): stub
\n
"
,
wine_dbgstr_variant
(
&
file
),
picture
);
return
E_NOTIMPL
;
}
static
HRESULT
create_stream
(
const
WCHAR
*
filename
,
IStream
**
stream
)
{
HANDLE
hFile
;
...
...
@@ -2346,6 +2337,33 @@ static HRESULT create_stream(const WCHAR *filename, IStream **stream)
}
/***********************************************************************
* OleLoadPictureFile (OLEAUT32.422)
*/
HRESULT
WINAPI
OleLoadPictureFile
(
VARIANT
filename
,
IDispatch
**
picture
)
{
IStream
*
stream
;
HRESULT
hr
;
TRACE
(
"(%s,%p)
\n
"
,
wine_dbgstr_variant
(
&
filename
),
picture
);
if
(
V_VT
(
&
filename
)
!=
VT_BSTR
)
return
CTL_E_FILENOTFOUND
;
hr
=
create_stream
(
V_BSTR
(
&
filename
),
&
stream
);
if
(
hr
!=
S_OK
)
{
if
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
))
return
CTL_E_FILENOTFOUND
;
return
CTL_E_PATHFILEACCESSERROR
;
}
hr
=
OleLoadPicture
(
stream
,
0
,
FALSE
,
&
IID_IDispatch
,
(
void
**
)
picture
);
IStream_Release
(
stream
);
return
hr
;
}
/***********************************************************************
* OleSavePictureFile (OLEAUT32.423)
*/
HRESULT
WINAPI
OleSavePictureFile
(
IDispatch
*
picture
,
BSTR
filename
)
...
...
dlls/oleaut32/tests/olepicture.c
View file @
a9cc6f02
...
...
@@ -948,6 +948,7 @@ static void test_OleLoadPicturePath(void)
HANDLE
file
;
DWORD
size
;
WCHAR
*
ptr
;
VARIANT
var
;
const
struct
{
...
...
@@ -1014,6 +1015,14 @@ static void test_OleLoadPicturePath(void)
if
(
pic
)
IPicture_Release
(
pic
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
temp_fileW
+
8
);
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
S_OK
,
"OleLoadPictureFile error %#lx
\n
"
,
hres
);
IPicture_Release
(
pic
);
VariantClear
(
&
var
);
/* Try a DOS path with tacked on "file:". */
hres
=
OleLoadPicturePath
(
temp_fileW
,
NULL
,
0
,
0
,
&
IID_IPicture
,
(
void
**
)
&
pic
);
ok
(
hres
==
S_OK
||
...
...
@@ -1022,6 +1031,13 @@ static void test_OleLoadPicturePath(void)
if
(
pic
)
IPicture_Release
(
pic
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
temp_fileW
);
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
CTL_E_PATHFILEACCESSERROR
,
"wrong error %#lx
\n
"
,
hres
);
VariantClear
(
&
var
);
DeleteFileA
(
temp_file
);
/* Try with a nonexistent file. */
...
...
@@ -1031,12 +1047,26 @@ static void test_OleLoadPicturePath(void)
broken
(
hres
==
E_FAIL
),
/*Win2k */
"Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08lx
\n
"
,
hres
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
temp_fileW
+
8
);
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
CTL_E_FILENOTFOUND
,
"wrong error %#lx
\n
"
,
hres
);
VariantClear
(
&
var
);
hres
=
OleLoadPicturePath
(
temp_fileW
,
NULL
,
0
,
0
,
&
IID_IPicture
,
(
void
**
)
&
pic
);
ok
(
hres
==
INET_E_RESOURCE_NOT_FOUND
||
/* XP+ */
broken
(
hres
==
E_UNEXPECTED
)
||
/* NT4 */
broken
(
hres
==
E_FAIL
),
/* Win2k */
"Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08lx
\n
"
,
hres
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
temp_fileW
);
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
CTL_E_PATHFILEACCESSERROR
,
"wrong error %#lx
\n
"
,
hres
);
VariantClear
(
&
var
);
file
=
CreateFileA
(
temp_file
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
WriteFile
(
file
,
bmpimage
,
sizeof
(
bmpimage
),
&
size
,
NULL
);
...
...
@@ -1058,6 +1088,13 @@ static void test_OleLoadPicturePath(void)
if
(
pic
)
IPicture_Release
(
pic
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
temp_fileW
);
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
CTL_E_PATHFILEACCESSERROR
,
"wrong error %#lx
\n
"
,
hres
);
VariantClear
(
&
var
);
DeleteFileA
(
temp_file
);
/* Try with a nonexistent file. */
...
...
@@ -1066,6 +1103,22 @@ static void test_OleLoadPicturePath(void)
broken
(
hres
==
E_UNEXPECTED
)
||
/* NT4 */
broken
(
hres
==
E_FAIL
),
/* Win2k */
"Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08lx
\n
"
,
hres
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
temp_fileW
);
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
CTL_E_PATHFILEACCESSERROR
,
"wrong error %#lx
\n
"
,
hres
);
VariantClear
(
&
var
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_INT
;
V_INT
(
&
var
)
=
762
;
hres
=
OleLoadPictureFile
(
var
,
(
IDispatch
**
)
&
pic
);
ok
(
hres
==
CTL_E_FILENOTFOUND
,
"wrong error %#lx
\n
"
,
hres
);
if
(
0
)
/* crashes under Windows */
hres
=
OleLoadPictureFile
(
var
,
NULL
);
}
static
void
test_himetric
(
void
)
...
...
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