Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
cc466f33
Commit
cc466f33
authored
Mar 27, 2016
by
Dmitry Timoshkov
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Factor out stream creation from OleLoadPicturePath.
parent
dfbeea04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
35 deletions
+41
-35
olepicture.c
dlls/oleaut32/olepicture.c
+41
-35
No files found.
dlls/oleaut32/olepicture.c
View file @
cc466f33
...
...
@@ -2396,6 +2396,45 @@ HRESULT WINAPI OleLoadPictureFile(VARIANT file, LPDISPATCH *picture)
return
E_NOTIMPL
;
}
static
HRESULT
create_stream
(
const
WCHAR
*
filename
,
IStream
**
stream
)
{
HANDLE
hFile
;
DWORD
dwFileSize
;
HGLOBAL
hGlobal
=
NULL
;
DWORD
dwBytesRead
;
HRESULT
hr
=
S_OK
;
hFile
=
CreateFileW
(
filename
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
dwFileSize
=
GetFileSize
(
hFile
,
NULL
);
if
(
dwFileSize
!=
INVALID_FILE_SIZE
)
{
hGlobal
=
GlobalAlloc
(
GMEM_FIXED
,
dwFileSize
);
if
(
!
hGlobal
)
hr
=
E_OUTOFMEMORY
;
else
{
if
(
!
ReadFile
(
hFile
,
hGlobal
,
dwFileSize
,
&
dwBytesRead
,
NULL
))
{
GlobalFree
(
hGlobal
);
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
}
}
}
CloseHandle
(
hFile
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
CreateStreamOnHGlobal
(
hGlobal
,
TRUE
,
stream
);
if
(
FAILED
(
hr
))
GlobalFree
(
hGlobal
);
return
hr
;
}
/***********************************************************************
* OleSavePictureFile (OLEAUT32.423)
*/
...
...
@@ -2412,13 +2451,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
DWORD
dwReserved
,
OLE_COLOR
clrReserved
,
REFIID
riid
,
LPVOID
*
ppvRet
)
{
IPicture
*
ipicture
;
HANDLE
hFile
;
DWORD
dwFileSize
;
HGLOBAL
hGlobal
=
NULL
;
DWORD
dwBytesRead
;
IStream
*
stream
;
BOOL
bRead
;
HRESULT
hRes
;
WCHAR
*
file_candidate
;
WCHAR
path_buf
[
MAX_PATH
];
...
...
@@ -2446,36 +2479,9 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
/* Handle candidate DOS paths separately. */
if
(
file_candidate
[
1
]
==
':'
)
{
hFile
=
CreateFileW
(
file_candidate
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
INET_E_RESOURCE_NOT_FOUND
;
dwFileSize
=
GetFileSize
(
hFile
,
NULL
);
if
(
dwFileSize
!=
INVALID_FILE_SIZE
)
{
hGlobal
=
GlobalAlloc
(
GMEM_FIXED
,
dwFileSize
);
if
(
hGlobal
)
{
bRead
=
ReadFile
(
hFile
,
hGlobal
,
dwFileSize
,
&
dwBytesRead
,
NULL
)
&&
dwBytesRead
==
dwFileSize
;
if
(
!
bRead
)
{
GlobalFree
(
hGlobal
);
hGlobal
=
0
;
}
}
}
CloseHandle
(
hFile
);
if
(
!
hGlobal
)
hRes
=
create_stream
(
file_candidate
,
&
stream
);
if
(
FAILED
(
hRes
))
return
INET_E_RESOURCE_NOT_FOUND
;
hRes
=
CreateStreamOnHGlobal
(
hGlobal
,
TRUE
,
&
stream
);
if
(
FAILED
(
hRes
))
{
GlobalFree
(
hGlobal
);
return
hRes
;
}
}
else
{
IMoniker
*
pmnk
;
IBindCtx
*
pbc
;
...
...
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