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
d284fd97
Commit
d284fd97
authored
Feb 28, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscms: Avoid closing a random file when destroying a memory based profile.
parent
54e6aa91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
handle.c
dlls/mscms/handle.c
+3
-3
profile.c
dlls/mscms/profile.c
+20
-12
No files found.
dlls/mscms/handle.c
View file @
d284fd97
...
@@ -44,9 +44,9 @@ static CRITICAL_SECTION MSCMS_handle_cs = { &MSCMS_handle_cs_debug, -1, 0, 0, 0,
...
@@ -44,9 +44,9 @@ static CRITICAL_SECTION MSCMS_handle_cs = { &MSCMS_handle_cs_debug, -1, 0, 0, 0,
/* A simple structure to tie together a pointer to an icc profile, an lcms
/* A simple structure to tie together a pointer to an icc profile, an lcms
* color profile handle and a Windows file handle. Windows color profile
* color profile handle and a Windows file handle. Windows color profile
* handles are built from indexes into an array of these structures. If
* handles are built from indexes into an array of these structures. If
* the profile is memory based the file handle field is
NULL. The 'access'
* the profile is memory based the file handle field is
set to
*
field records the access parameter supplied to an OpenColorProfile()
*
INVALID_HANDLE_VALUE. The 'access' field records the access parameter
* call, i.e. PROFILE_READ or PROFILE_READWRITE.
*
supplied to an OpenColorProfile()
call, i.e. PROFILE_READ or PROFILE_READWRITE.
*/
*/
struct
profile
struct
profile
...
...
dlls/mscms/profile.c
View file @
d284fd97
...
@@ -1370,14 +1370,14 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
...
@@ -1370,14 +1370,14 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
#ifdef HAVE_LCMS
#ifdef HAVE_LCMS
cmsHPROFILE
cmsprofile
=
NULL
;
cmsHPROFILE
cmsprofile
=
NULL
;
icProfile
*
iccprofile
=
NULL
;
icProfile
*
iccprofile
=
NULL
;
HANDLE
handle
=
NULL
;
HANDLE
handle
=
INVALID_HANDLE_VALUE
;
DWORD
size
;
DWORD
size
;
TRACE
(
"( %p, 0x%08x, 0x%08x, 0x%08x )
\n
"
,
profile
,
access
,
sharing
,
creation
);
TRACE
(
"( %p, 0x%08x, 0x%08x, 0x%08x )
\n
"
,
profile
,
access
,
sharing
,
creation
);
if
(
!
profile
||
!
profile
->
pProfileData
)
return
NULL
;
if
(
!
profile
||
!
profile
->
pProfileData
)
return
NULL
;
if
(
profile
->
dwType
&
PROFILE_MEMBUFFER
)
if
(
profile
->
dwType
==
PROFILE_MEMBUFFER
)
{
{
/* FIXME: access flags not implemented for memory based profiles */
/* FIXME: access flags not implemented for memory based profiles */
...
@@ -1386,8 +1386,7 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
...
@@ -1386,8 +1386,7 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
cmsprofile
=
cmsOpenProfileFromMem
(
iccprofile
,
size
);
cmsprofile
=
cmsOpenProfileFromMem
(
iccprofile
,
size
);
}
}
else
if
(
profile
->
dwType
==
PROFILE_FILENAME
)
if
(
profile
->
dwType
&
PROFILE_FILENAME
)
{
{
DWORD
read
,
flags
=
0
;
DWORD
read
,
flags
=
0
;
...
@@ -1432,6 +1431,11 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
...
@@ -1432,6 +1431,11 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
cmsprofile
=
cmsOpenProfileFromMem
(
iccprofile
,
size
);
cmsprofile
=
cmsOpenProfileFromMem
(
iccprofile
,
size
);
}
}
else
{
ERR
(
"Invalid profile type %u
\n
"
,
profile
->
dwType
);
return
NULL
;
}
if
(
cmsprofile
)
if
(
cmsprofile
)
return
MSCMS_create_hprofile_handle
(
handle
,
iccprofile
,
cmsprofile
,
access
);
return
MSCMS_create_hprofile_handle
(
handle
,
iccprofile
,
cmsprofile
,
access
);
...
@@ -1462,19 +1466,23 @@ BOOL WINAPI CloseColorProfile( HPROFILE profile )
...
@@ -1462,19 +1466,23 @@ BOOL WINAPI CloseColorProfile( HPROFILE profile )
TRACE
(
"( %p )
\n
"
,
profile
);
TRACE
(
"( %p )
\n
"
,
profile
);
if
(
file
&&
(
access
&
PROFILE_READWRITE
)
)
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
{
DWORD
written
,
size
=
MSCMS_get_profile_size
(
iccprofile
);
if
(
access
&
PROFILE_READWRITE
)
{
DWORD
written
,
size
=
MSCMS_get_profile_size
(
iccprofile
);
if
(
SetFilePointer
(
file
,
0
,
NULL
,
FILE_BEGIN
)
||
if
(
SetFilePointer
(
file
,
0
,
NULL
,
FILE_BEGIN
)
||
!
WriteFile
(
file
,
iccprofile
,
size
,
&
written
,
NULL
)
||
written
!=
size
)
!
WriteFile
(
file
,
iccprofile
,
size
,
&
written
,
NULL
)
||
written
!=
size
)
ERR
(
"Unable to write color profile
\n
"
);
{
ERR
(
"Unable to write color profile
\n
"
);
}
}
CloseHandle
(
file
);
}
}
ret
=
cmsCloseProfile
(
MSCMS_hprofile2cmsprofile
(
profile
)
);
ret
=
cmsCloseProfile
(
MSCMS_hprofile2cmsprofile
(
profile
)
);
HeapFree
(
GetProcessHeap
(),
0
,
MSCMS_hprofile2iccprofile
(
profile
)
);
HeapFree
(
GetProcessHeap
(),
0
,
iccprofile
);
CloseHandle
(
MSCMS_hprofile2handle
(
profile
)
);
MSCMS_destroy_hprofile_handle
(
profile
);
MSCMS_destroy_hprofile_handle
(
profile
);
#endif
/* HAVE_LCMS */
#endif
/* HAVE_LCMS */
...
...
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