Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f0ddaedc
Commit
f0ddaedc
authored
Mar 13, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleview: Use standard APIs in SaveIdl and avoid overflows.
parent
ea8e8609
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
typelib.c
programs/oleview/typelib.c
+9
-15
No files found.
programs/oleview/typelib.c
View file @
f0ddaedc
...
...
@@ -117,8 +117,9 @@ static void SaveIdl(WCHAR *wszFileName)
HTREEITEM
hIDL
;
TVITEM
tvi
;
HANDLE
hFile
;
DWORD
dwNumWrite
;
DWORD
len
,
dwNumWrite
;
char
*
wszIdl
;
TYPELIB_DATA
*
data
;
hIDL
=
TreeView_GetChild
(
typelib
.
hTree
,
TVI_ROOT
);
...
...
@@ -126,31 +127,24 @@ static void SaveIdl(WCHAR *wszFileName)
tvi
.
hItem
=
hIDL
;
SendMessage
(
typelib
.
hTree
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
data
=
(
TYPELIB_DATA
*
)
tvi
.
lParam
;
hFile
=
CreateFile
(
wszFileName
,
GENERIC_WRITE
,
FILE_SHARE_WRITE
,
NULL
,
OPEN
_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
NULL
,
CREATE
_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
ShowLastError
();
return
;
}
wszIdl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
((
TYPELIB_DATA
*
)(
tvi
.
lParam
))
->
idlLen
);
wine_utf8_wcstombs
(((
TYPELIB_DATA
*
)(
tvi
.
lParam
))
->
idl
,
((
TYPELIB_DATA
*
)(
tvi
.
lParam
))
->
idlLen
,
wszIdl
,
((
TYPELIB_DATA
*
)(
tvi
.
lParam
))
->
idlLen
);
len
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
data
->
idl
,
data
->
idlLen
,
NULL
,
0
,
NULL
,
NULL
);
wszIdl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
WideCharToMultiByte
(
CP_UTF8
,
0
,
data
->
idl
,
data
->
idlLen
,
wszIdl
,
len
,
NULL
,
NULL
);
if
(
!
WriteFile
(
hFile
,
wszIdl
,
((
TYPELIB_DATA
*
)(
tvi
.
lParam
))
->
idlLen
,
&
dwNumWrite
,
NULL
))
{
ShowLastError
();
HeapFree
(
GetProcessHeap
(),
0
,
wszIdl
);
return
;
}
if
(
!
WriteFile
(
hFile
,
wszIdl
,
len
,
&
dwNumWrite
,
NULL
))
ShowLastError
();
HeapFree
(
GetProcessHeap
(),
0
,
wszIdl
);
SetEndOfFile
(
hFile
);
CloseHandle
(
hFile
);
}
...
...
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