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
38898e93
Commit
38898e93
authored
Mar 20, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Use memory allocation helpers.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
402fce15
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
130 deletions
+122
-130
cdlg32.c
dlls/comdlg32/cdlg32.c
+12
-10
colordlg.c
dlls/comdlg32/colordlg.c
+10
-7
filedlg.c
dlls/comdlg32/filedlg.c
+62
-78
filedlg31.c
dlls/comdlg32/filedlg31.c
+28
-27
finddlg.c
dlls/comdlg32/finddlg.c
+3
-2
fontdlg.c
dlls/comdlg32/fontdlg.c
+7
-6
No files found.
dlls/comdlg32/cdlg32.c
View file @
38898e93
...
...
@@ -32,6 +32,7 @@
#include "commdlg.h"
#include "cderr.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
commdlg
);
...
...
@@ -128,16 +129,17 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
* Success: Pointer to a heap block
* Failure: null
*/
LPVOID
COMDLG32_AllocMem
(
int
size
/* [in] Block size to allocate */
)
{
LPVOID
ptr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
if
(
!
ptr
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMALLOCFAILURE
);
return
NULL
;
}
return
ptr
;
void
*
COMDLG32_AllocMem
(
int
size
)
{
void
*
ptr
=
heap_alloc_zero
(
size
);
if
(
!
ptr
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMALLOCFAILURE
);
return
NULL
;
}
return
ptr
;
}
...
...
dlls/comdlg32/colordlg.c
View file @
38898e93
...
...
@@ -31,10 +31,12 @@
#include "winuser.h"
#include "commdlg.h"
#include "dlgs.h"
#include "wine/debug.h"
#include "cderr.h"
#include "cdlg.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
commdlg
);
static
INT_PTR
CALLBACK
ColorDlgProc
(
HWND
hWnd
,
UINT
wMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
...
...
@@ -858,7 +860,7 @@ static LRESULT CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam )
return
FALSE
;
}
lpp
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
CCPRIVATE
)
);
lpp
=
heap_alloc_zero
(
sizeof
(
*
lpp
)
);
lpp
->
lpcc
=
cc
;
lpp
->
hwndSelf
=
hDlg
;
...
...
@@ -1215,7 +1217,7 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
case
WM_NCDESTROY
:
DeleteDC
(
lpp
->
hdcMem
);
DeleteObject
(
lpp
->
hbmMem
);
HeapFree
(
GetProcessHeap
(),
0
,
lpp
);
heap_free
(
lpp
);
RemovePropW
(
hDlg
,
szColourDialogProp
);
break
;
case
WM_COMMAND
:
...
...
@@ -1326,7 +1328,7 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
LPWSTR
template_name
=
NULL
;
BOOL
ret
;
LPCHOOSECOLORW
lpcc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
CHOOSECOLORW
));
CHOOSECOLORW
*
lpcc
=
heap_alloc_zero
(
sizeof
(
*
lpcc
));
lpcc
->
lStructSize
=
sizeof
(
*
lpcc
);
lpcc
->
hwndOwner
=
lpChCol
->
hwndOwner
;
lpcc
->
hInstance
=
lpChCol
->
hInstance
;
...
...
@@ -1338,7 +1340,7 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
if
((
lpcc
->
Flags
&
CC_ENABLETEMPLATE
)
&&
(
lpChCol
->
lpTemplateName
))
{
if
(
!
IS_INTRESOURCE
(
lpChCol
->
lpTemplateName
))
{
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpChCol
->
lpTemplateName
,
-
1
,
NULL
,
0
);
template_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
template_name
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
lpChCol
->
lpTemplateName
,
-
1
,
template_name
,
len
);
lpcc
->
lpTemplateName
=
template_name
;
}
else
{
...
...
@@ -1350,7 +1352,8 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
if
(
ret
)
lpChCol
->
rgbResult
=
lpcc
->
rgbResult
;
HeapFree
(
GetProcessHeap
(),
0
,
template_name
);
HeapFree
(
GetProcessHeap
(),
0
,
lpcc
);
heap_free
(
template_name
);
heap_free
(
lpcc
);
return
ret
;
}
dlls/comdlg32/filedlg.c
View file @
38898e93
...
...
@@ -75,6 +75,7 @@
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
commdlg
);
...
...
@@ -236,10 +237,6 @@ static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl);
static
UINT
GetNumSelected
(
IDataObject
*
doSelected
);
static
void
COMCTL32_ReleaseStgMedium
(
STGMEDIUM
medium
);
/* Shell memory allocation */
static
void
*
MemAlloc
(
UINT
size
);
static
void
MemFree
(
void
*
mem
);
static
INT_PTR
CALLBACK
FileOpenDlgProc95
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
static
INT_PTR
FILEDLG95_HandleCustomDialogMessages
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
static
BOOL
FILEDLG95_OnOpenMultipleFiles
(
HWND
hwnd
,
LPWSTR
lpstrFileList
,
UINT
nFileCount
,
UINT
sizeUsed
);
...
...
@@ -349,7 +346,7 @@ static WCHAR *heap_strdupAtoW(const char *str)
return
NULL
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
0
,
0
);
ret
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
));
ret
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
...
...
@@ -379,7 +376,7 @@ static void init_filedlg_infoW(OPENFILENAMEW *ofn, FileOpenDlgInfos *info)
if
(
ofn
->
lpstrFile
)
{
info
->
filename
=
MemA
lloc
(
ofn
->
nMaxFile
*
sizeof
(
WCHAR
));
info
->
filename
=
heap_a
lloc
(
ofn
->
nMaxFile
*
sizeof
(
WCHAR
));
lstrcpynW
(
info
->
filename
,
ofn
->
lpstrFile
,
ofn
->
nMaxFile
);
}
...
...
@@ -388,7 +385,7 @@ static void init_filedlg_infoW(OPENFILENAMEW *ofn, FileOpenDlgInfos *info)
DWORD
len
=
ExpandEnvironmentStringsW
(
ofn
->
lpstrInitialDir
,
NULL
,
0
);
if
(
len
)
{
info
->
initdir
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
));
info
->
initdir
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
));
ExpandEnvironmentStringsW
(
ofn
->
lpstrInitialDir
,
info
->
initdir
,
len
);
}
}
...
...
@@ -410,7 +407,7 @@ static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info)
if
(
ofn
->
lpstrFile
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
->
lpstrFile
,
ofn
->
nMaxFile
,
NULL
,
0
);
ofnW
.
lpstrFile
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
));
ofnW
.
lpstrFile
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
->
lpstrFile
,
ofn
->
nMaxFile
,
ofnW
.
lpstrFile
,
len
);
ofnW
.
nMaxFile
=
len
;
}
...
...
@@ -426,7 +423,7 @@ static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info)
s
++
;
n
=
s
-
ofn
->
lpstrFilter
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
->
lpstrFilter
,
n
,
NULL
,
0
);
ofnW
.
lpstrFilter
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
));
ofnW
.
lpstrFilter
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
->
lpstrFilter
,
n
,
(
WCHAR
*
)
ofnW
.
lpstrFilter
,
len
);
}
...
...
@@ -442,7 +439,7 @@ static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info)
if
(
*
s
)
s
=
s
+
strlen
(
s
)
+
1
;
n
=
s
-
ofn
->
lpstrCustomFilter
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
->
lpstrCustomFilter
,
n
,
NULL
,
0
);
ofnW
.
lpstrCustomFilter
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
));
ofnW
.
lpstrCustomFilter
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
->
lpstrCustomFilter
,
n
,
ofnW
.
lpstrCustomFilter
,
len
);
}
...
...
@@ -453,8 +450,8 @@ static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info)
info
->
unicode
=
FALSE
;
/* free what was duplicated */
MemFree
((
WCHAR
*
)
ofnW
.
lpstrInitialDir
);
MemFree
((
WCHAR
*
)
ofnW
.
lpstrFile
);
heap_free
((
void
*
)
ofnW
.
lpstrInitialDir
);
heap_free
(
ofnW
.
lpstrFile
);
}
/***********************************************************************
...
...
@@ -470,7 +467,7 @@ static BOOL GetFileDialog95(FileOpenDlgInfos *info, UINT dlg_type)
/* save current directory */
if
(
info
->
ofnInfos
->
Flags
&
OFN_NOCHANGEDIR
)
{
current_dir
=
MemA
lloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
current_dir
=
heap_a
lloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
GetCurrentDirectoryW
(
MAX_PATH
,
current_dir
);
}
...
...
@@ -490,19 +487,19 @@ static BOOL GetFileDialog95(FileOpenDlgInfos *info, UINT dlg_type)
if
(
current_dir
)
{
SetCurrentDirectoryW
(
current_dir
);
MemF
ree
(
current_dir
);
heap_f
ree
(
current_dir
);
}
if
(
!
info
->
unicode
)
{
MemFree
((
WCHAR
*
)
info
->
defext
);
MemFree
((
WCHAR
*
)
info
->
title
);
MemFree
((
WCHAR
*
)
info
->
filter
);
MemFree
((
WCHAR
*
)
info
->
customfilter
);
heap_free
((
void
*
)
info
->
defext
);
heap_free
((
void
*
)
info
->
title
);
heap_free
((
void
*
)
info
->
filter
);
heap_free
((
void
*
)
info
->
customfilter
);
}
MemF
ree
(
info
->
filename
);
MemF
ree
(
info
->
initdir
);
heap_f
ree
(
info
->
filename
);
heap_f
ree
(
info
->
initdir
);
return
ret
;
}
...
...
@@ -580,7 +577,7 @@ int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileLis
/* we might get single filename without any '"',
* so we need nStrLen + terminating \0 + end-of-list \0 */
*
lpstrFileList
=
MemAlloc
(
(
nStrLen
+
2
)
*
sizeof
(
WCHAR
)
);
*
lpstrFileList
=
heap_alloc
((
nStrLen
+
2
)
*
sizeof
(
WCHAR
)
);
*
sizeUsed
=
0
;
/* build delimited file list from filenames */
...
...
@@ -908,7 +905,7 @@ static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result
/* get path and filenames */
len
=
SendMessageW
(
fodInfos
->
DlgInfos
.
hwndFileName
,
WM_GETTEXTLENGTH
,
0
,
0
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
2
+
MAX_PATH
)
*
sizeof
(
WCHAR
)
);
buffer
=
heap_alloc
(
(
len
+
2
+
MAX_PATH
)
*
sizeof
(
WCHAR
)
);
COMDLG32_GetDisplayNameOf
(
fodInfos
->
ShellInfos
.
pidlAbsCurrent
,
buffer
);
if
(
len
)
{
...
...
@@ -928,7 +925,7 @@ static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result
if
(
total
<=
size
)
WideCharToMultiByte
(
CP_ACP
,
0
,
buffer
,
-
1
,
result
,
size
,
NULL
,
NULL
);
TRACE
(
"CDM_GETFILEPATH: returning %u %s
\n
"
,
total
,
debugstr_a
(
result
));
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
heap_free
(
buffer
);
return
total
;
}
...
...
@@ -1589,8 +1586,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
else
*
fodInfos
->
filename
=
'\0'
;
MemF
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
MemA
lloc
((
lstrlenW
(
tmpBuf
)
+
1
)
*
sizeof
(
WCHAR
));
heap_f
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
heap_a
lloc
((
lstrlenW
(
tmpBuf
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
fodInfos
->
initdir
,
tmpBuf
);
handledPath
=
TRUE
;
TRACE
(
"Value in Filename includes path, overriding InitialDir: %s, %s
\n
"
,
...
...
@@ -1624,8 +1621,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
result
=
GetFullPathNameW
(
tmpBuf
,
MAX_PATH
,
tmpBuf2
,
&
nameBit
);
if
(
result
)
{
*
nameBit
=
0x00
;
MemF
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
MemA
lloc
((
lstrlenW
(
tmpBuf2
)
+
1
)
*
sizeof
(
WCHAR
));
heap_f
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
heap_a
lloc
((
lstrlenW
(
tmpBuf2
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
fodInfos
->
initdir
,
tmpBuf2
);
handledPath
=
TRUE
;
TRACE
(
"Value in InitDir changed to %s
\n
"
,
debugstr_w
(
fodInfos
->
initdir
));
...
...
@@ -1633,7 +1630,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
}
else
if
(
fodInfos
->
initdir
)
{
MemF
ree
(
fodInfos
->
initdir
);
heap_f
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
NULL
;
TRACE
(
"Value in InitDir is not an existing path, changed to (nil)
\n
"
);
}
...
...
@@ -1659,8 +1656,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
*
nameBit
=
0x00
;
len
=
lstrlenW
(
tmpBuf
);
MemF
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
MemA
lloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
heap_f
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
heap_a
lloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
fodInfos
->
initdir
,
tmpBuf
);
handledPath
=
TRUE
;
...
...
@@ -1672,7 +1669,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
/* 4. Win2000+: Recently used */
if
(
!
handledPath
&&
win2000plus
)
{
fodInfos
->
initdir
=
MemA
lloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
fodInfos
->
initdir
=
heap_a
lloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
fodInfos
->
initdir
[
0
]
=
'\0'
;
FILEDLG95_MRU_load_filename
(
fodInfos
->
initdir
);
...
...
@@ -1680,7 +1677,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
if
(
fodInfos
->
initdir
[
0
]
&&
PathFileExistsW
(
fodInfos
->
initdir
)){
handledPath
=
TRUE
;
}
else
{
MemF
ree
(
fodInfos
->
initdir
);
heap_f
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
NULL
;
}
}
...
...
@@ -1712,8 +1709,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
}
else
{
MemF
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
MemAlloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
heap_f
ree
(
fodInfos
->
initdir
);
fodInfos
->
initdir
=
heap_alloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
GetCurrentDirectoryW
(
MAX_PATH
,
fodInfos
->
initdir
);
handledPath
=
TRUE
;
...
...
@@ -1727,7 +1724,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
/* 6. Win98+ and 2000+: Use personal files dir, others use current dir */
if
(
!
handledPath
&&
(
win2000plus
||
win98plus
))
{
fodInfos
->
initdir
=
MemAlloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
fodInfos
->
initdir
=
heap_alloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
if
(
!
COMDLG32_SHGetFolderPathW
(
hwnd
,
CSIDL_PERSONAL
,
0
,
0
,
fodInfos
->
initdir
))
{
...
...
@@ -1744,7 +1741,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
}
handledPath
=
TRUE
;
}
else
if
(
!
handledPath
)
{
fodInfos
->
initdir
=
MemAlloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
fodInfos
->
initdir
=
heap_alloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
GetCurrentDirectoryW
(
MAX_PATH
,
fodInfos
->
initdir
);
handledPath
=
TRUE
;
TRACE
(
"No initial dir specified, using current dir of %s
\n
"
,
debugstr_w
(
fodInfos
->
initdir
));
...
...
@@ -2264,7 +2261,7 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
final_len
=
path_len
+
lstrlenW
(
module_name
)
+
2
;
final
=
MemA
lloc
(
final_len
*
sizeof
(
WCHAR
));
final
=
heap_a
lloc
(
final_len
*
sizeof
(
WCHAR
));
if
(
!
final
)
return
;
lstrcpyW
(
final
,
module_name
);
...
...
@@ -2275,12 +2272,12 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
final_len
*
sizeof
(
WCHAR
));
if
(
ret
){
WARN
(
"Error saving MRU data to slot %s: %d
\n
"
,
wine_dbgstr_w
(
slot_name
),
ret
);
MemF
ree
(
final
);
heap_f
ree
(
final
);
RegCloseKey
(
hkey
);
return
;
}
MemF
ree
(
final
);
heap_f
ree
(
final
);
}
{
/* update MRUList value */
...
...
@@ -2517,7 +2514,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
*/
COMDLG32_GetCanonicalPath
(
fodInfos
->
ShellInfos
.
pidlAbsCurrent
,
lpstrFileList
,
lpstrPathAndFile
);
MemF
ree
(
lpstrFileList
);
heap_f
ree
(
lpstrFileList
);
/*
Step 2: here we have a cleaned up path
...
...
@@ -2564,9 +2561,9 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
DWORD
len
;
/* replace the current filter */
MemF
ree
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
);
heap_f
ree
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
);
len
=
lstrlenW
(
lpszTemp
)
+
1
;
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
));
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
));
lstrcpyW
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
,
lpszTemp
);
/* set the filter cb to the extension when possible */
...
...
@@ -2641,7 +2638,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
if
(
lpstrFilter
!=
(
LPWSTR
)
CB_ERR
)
/* control is not empty */
{
WCHAR
*
filterSearchIndex
;
filterExt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpstrFilter
)
+
1
)
*
sizeof
(
WCHAR
));
filterExt
=
heap_alloc
(
(
lstrlenW
(
lpstrFilter
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
filterExt
,
lpstrFilter
);
/* if a semicolon-separated list of file extensions was given, do not include the
...
...
@@ -2663,7 +2660,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
filterExt
);
heap_free
(
filterExt
);
filterExt
=
NULL
;
}
}
...
...
@@ -2671,7 +2668,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
if
(
!
filterExt
)
{
/* use the default file extension */
filterExt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
fodInfos
->
defext
)
+
1
)
*
sizeof
(
WCHAR
));
filterExt
=
heap_alloc
(
(
lstrlenW
(
fodInfos
->
defext
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
filterExt
,
fodInfos
->
defext
);
}
...
...
@@ -2683,7 +2680,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
lstrcatW
(
lpstrPathAndFile
,
filterExt
);
}
HeapFree
(
GetProcessHeap
(),
0
,
filterExt
);
heap_free
(
filterExt
);
/* In Open dialog: if file does not exist try without extension */
if
(
!
(
fodInfos
->
DlgInfos
.
dwDlgProp
&
FODPROP_SAVEDLG
)
&&
!
PathFileExistsW
(
lpstrPathAndFile
))
...
...
@@ -2996,7 +2993,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
/* Copy the extensions */
if
(
!
*
lpstrPos
)
return
E_FAIL
;
/* malformed filter */
if
(
!
(
lpstrExt
=
MemA
lloc
((
lstrlenW
(
lpstrPos
)
+
1
)
*
sizeof
(
WCHAR
))))
return
E_FAIL
;
if
(
!
(
lpstrExt
=
heap_a
lloc
((
lstrlenW
(
lpstrPos
)
+
1
)
*
sizeof
(
WCHAR
))))
return
E_FAIL
;
lstrcpyW
(
lpstrExt
,
lpstrPos
);
/* Add the item at the end of the combo */
...
...
@@ -3027,7 +3024,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
nFilters
++
;
/* Copy the extensions */
if
(
!
(
lpstrExt
=
MemA
lloc
((
lstrlenW
(
lpstrPos
)
+
1
)
*
sizeof
(
WCHAR
))))
return
E_FAIL
;
if
(
!
(
lpstrExt
=
heap_a
lloc
((
lstrlenW
(
lpstrPos
)
+
1
)
*
sizeof
(
WCHAR
))))
return
E_FAIL
;
lstrcpyW
(
lpstrExt
,
lpstrPos
);
lpstrPos
+=
lstrlenW
(
lpstrPos
)
+
1
;
...
...
@@ -3076,7 +3073,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
DWORD
len
;
CharLowerW
(
lpstrFilter
);
/* lowercase */
len
=
lstrlenW
(
lpstrFilter
)
+
1
;
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
)
);
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
,
lpstrFilter
);
}
}
else
...
...
@@ -3108,7 +3105,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
(
fodInfos
->
customfilter
==
NULL
?
1
:
0
);
/* Set the current filter with the current selection */
MemF
ree
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
);
heap_f
ree
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
);
lpstrFilter
=
(
LPWSTR
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
iItem
);
...
...
@@ -3117,7 +3114,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
DWORD
len
;
CharLowerW
(
lpstrFilter
);
/* lowercase */
len
=
lstrlenW
(
lpstrFilter
)
+
1
;
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
=
MemA
lloc
(
len
*
sizeof
(
WCHAR
)
);
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
=
heap_a
lloc
(
len
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
,
lpstrFilter
);
if
(
fodInfos
->
ofnInfos
->
Flags
&
OFN_EXPLORER
)
SendCustomDlgNotificationMessage
(
hwnd
,
CDN_TYPECHANGE
);
...
...
@@ -3170,13 +3167,12 @@ static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
{
for
(
iPos
=
iCount
-
1
;
iPos
>=
0
;
iPos
--
)
{
MemFree
((
LPSTR
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
iPos
));
heap_free
((
void
*
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
iPos
));
CBDeleteString
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
iPos
);
}
}
/* Current filter */
MemFree
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
);
heap_free
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
);
}
/***********************************************************************
...
...
@@ -3212,7 +3208,7 @@ static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
LPITEMIDLIST
pidlDrives
,
pidlTmp
,
pidlTmp1
,
pidlAbsTmp
;
HDC
hdc
;
TEXTMETRICW
tm
;
LookInInfos
*
liInfos
=
MemAlloc
(
sizeof
(
LookIn
Infos
));
LookInInfos
*
liInfos
=
heap_alloc_zero
(
sizeof
(
*
li
Infos
));
TRACE
(
"%p
\n
"
,
hwndCombo
);
...
...
@@ -3441,7 +3437,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
if
(
!
(
liInfos
=
GetPropA
(
hwnd
,
LookInInfosStr
)))
return
-
1
;
tmpFolder
=
MemAlloc
(
sizeof
(
SFOLDER
));
tmpFolder
=
heap_alloc_zero
(
sizeof
(
*
tmpFolder
));
tmpFolder
->
m_iIndent
=
0
;
/* Calculate the indentation of the item in the lookin*/
...
...
@@ -3487,7 +3483,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
}
COMDLG32_SHFree
(
tmpFolder
->
pidlItem
);
MemF
ree
(
tmpFolder
);
heap_f
ree
(
tmpFolder
);
return
-
1
;
}
...
...
@@ -3584,7 +3580,7 @@ static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
{
SFOLDER
*
tmpFolder
=
(
LPSFOLDER
)
CBGetItemDataPtr
(
hwnd
,
iItemPos
);
COMDLG32_SHFree
(
tmpFolder
->
pidlItem
);
MemF
ree
(
tmpFolder
);
heap_f
ree
(
tmpFolder
);
CBDeleteString
(
hwnd
,
iItemPos
);
liInfos
->
iMaxIndentation
--
;
...
...
@@ -3644,13 +3640,13 @@ static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
{
SFOLDER
*
tmpFolder
=
(
LPSFOLDER
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndLookInCB
,
iPos
);
COMDLG32_SHFree
(
tmpFolder
->
pidlItem
);
MemF
ree
(
tmpFolder
);
heap_f
ree
(
tmpFolder
);
CBDeleteString
(
fodInfos
->
DlgInfos
.
hwndLookInCB
,
iPos
);
}
}
/* LookInInfos structure */
MemF
ree
(
liInfos
);
heap_f
ree
(
liInfos
);
RemovePropA
(
fodInfos
->
DlgInfos
.
hwndLookInCB
,
LookInInfosStr
);
}
...
...
@@ -3698,7 +3694,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
/* Allocate a buffer */
nAllFilesMaxLength
=
MAX_PATH
+
3
;
lpstrAllFiles
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
nAllFilesMaxLength
*
sizeof
(
WCHAR
));
lpstrAllFiles
=
heap_alloc_zero
(
nAllFilesMaxLength
*
sizeof
(
WCHAR
));
if
(
!
lpstrAllFiles
)
goto
ret
;
...
...
@@ -3745,7 +3741,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
}
ret:
HeapFree
(
GetProcessHeap
(),
0
,
lpstrAllFiles
);
heap_free
(
lpstrAllFiles
);
COMCTL32_ReleaseStgMedium
(
medium
);
}
...
...
@@ -3797,13 +3793,13 @@ static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR * lpstrFileList, U
/* get the filenames from the filename control */
nStrLen
=
GetWindowTextLengthW
(
fodInfos
->
DlgInfos
.
hwndFileName
);
lpstrEdit
=
MemA
lloc
(
(
nStrLen
+
1
)
*
sizeof
(
WCHAR
)
);
lpstrEdit
=
heap_a
lloc
(
(
nStrLen
+
1
)
*
sizeof
(
WCHAR
)
);
GetWindowTextW
(
fodInfos
->
DlgInfos
.
hwndFileName
,
lpstrEdit
,
nStrLen
+
1
);
TRACE
(
"nStrLen=%u str=%s
\n
"
,
nStrLen
,
debugstr_w
(
lpstrEdit
));
nFileCount
=
COMDLG32_SplitFileNames
(
lpstrEdit
,
nStrLen
,
lpstrFileList
,
sizeUsed
);
MemF
ree
(
lpstrEdit
);
heap_f
ree
(
lpstrEdit
);
return
nFileCount
;
}
...
...
@@ -4052,18 +4048,6 @@ static BOOL BrowseSelectedFolder(HWND hwnd)
return
bBrowseSelFolder
;
}
/*
* Memory allocation methods */
static
void
*
MemAlloc
(
UINT
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
}
static
void
MemFree
(
void
*
mem
)
{
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
BOOL
valid_struct_size
(
DWORD
size
)
{
return
(
size
==
OPENFILENAME_SIZE_VERSION_400W
)
||
...
...
@@ -4220,11 +4204,11 @@ short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, WORD cbBuf)
LPWSTR
lpWTitle
;
RtlCreateUnicodeStringFromAsciiz
(
&
strWFile
,
lpFile
);
lpWTitle
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
cbBuf
*
sizeof
(
WCHAR
));
lpWTitle
=
heap_alloc
(
cbBuf
*
sizeof
(
WCHAR
));
ret
=
GetFileTitleW
(
strWFile
.
Buffer
,
lpWTitle
,
cbBuf
);
if
(
!
ret
)
WideCharToMultiByte
(
CP_ACP
,
0
,
lpWTitle
,
-
1
,
lpTitle
,
cbBuf
,
NULL
,
NULL
);
RtlFreeUnicodeString
(
&
strWFile
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
lpWTitle
);
heap_free
(
lpWTitle
);
return
ret
;
}
...
...
dlls/comdlg32/filedlg31.c
View file @
38898e93
...
...
@@ -30,6 +30,7 @@
#include "winuser.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "winreg.h"
#include "winternl.h"
#include "commdlg.h"
...
...
@@ -231,7 +232,7 @@ static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
if
(
lpdis
->
CtlType
==
ODT_LISTBOX
&&
lpdis
->
CtlID
==
lst1
)
{
if
(
!
(
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BUFFILEALLOC
)))
return
FALSE
;
if
(
!
(
str
=
heap_alloc
(
BUFFILEALLOC
)))
return
FALSE
;
SendMessageW
(
lpdis
->
hwndItem
,
LB_GETTEXT
,
lpdis
->
itemID
,
(
LPARAM
)
str
);
...
...
@@ -255,13 +256,13 @@ static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
SetBkColor
(
lpdis
->
hDC
,
oldBk
);
SetTextColor
(
lpdis
->
hDC
,
oldText
);
}
HeapFree
(
GetProcessHeap
(),
0
,
str
);
heap_free
(
str
);
return
TRUE
;
}
if
(
lpdis
->
CtlType
==
ODT_LISTBOX
&&
lpdis
->
CtlID
==
lst2
)
{
if
(
!
(
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BUFFILEALLOC
)))
if
(
!
(
str
=
heap_alloc
(
BUFFILEALLOC
)))
return
FALSE
;
SendMessageW
(
lpdis
->
hwndItem
,
LB_GETTEXT
,
lpdis
->
itemID
,
(
LPARAM
)
str
);
...
...
@@ -284,13 +285,13 @@ static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
SetTextColor
(
lpdis
->
hDC
,
oldText
);
}
DrawIconEx
(
lpdis
->
hDC
,
lpdis
->
rcItem
.
left
,
lpdis
->
rcItem
.
top
,
hFolder
,
16
,
16
,
0
,
0
,
DI_NORMAL
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
heap_free
(
str
);
return
TRUE
;
}
if
(
lpdis
->
CtlType
==
ODT_COMBOBOX
&&
lpdis
->
CtlID
==
cmb2
)
{
char
root
[]
=
"a:"
;
if
(
!
(
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BUFFILEALLOC
)))
if
(
!
(
str
=
heap_alloc
(
BUFFILEALLOC
)))
return
FALSE
;
SendMessageW
(
lpdis
->
hwndItem
,
CB_GETLBTEXT
,
lpdis
->
itemID
,
(
LPARAM
)
str
);
...
...
@@ -318,7 +319,7 @@ static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
SetTextColor
(
lpdis
->
hDC
,
oldText
);
}
DrawIconEx
(
lpdis
->
hDC
,
lpdis
->
rcItem
.
left
,
lpdis
->
rcItem
.
top
,
hIcon
,
16
,
16
,
0
,
0
,
DI_NORMAL
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
heap_free
(
str
);
return
TRUE
;
}
return
FALSE
;
...
...
@@ -418,11 +419,11 @@ static LRESULT FD31_DirListDblClick( const FD31_DATA *lfs )
/* get the raw string (with brackets) */
lRet
=
SendDlgItemMessageW
(
hWnd
,
lst2
,
LB_GETCURSEL
,
0
,
0
);
if
(
lRet
==
LB_ERR
)
return
TRUE
;
pstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BUFFILEALLOC
);
pstr
=
heap_alloc
(
BUFFILEALLOC
);
SendDlgItemMessageW
(
hWnd
,
lst2
,
LB_GETTEXT
,
lRet
,
(
LPARAM
)
pstr
);
strcpyW
(
tmpstr
,
pstr
);
HeapFree
(
GetProcessHeap
(),
0
,
pstr
);
heap_free
(
pstr
);
/* get the selected directory in tmpstr */
if
(
tmpstr
[
0
]
==
'['
)
{
...
...
@@ -457,12 +458,12 @@ static LRESULT FD31_FileListSelect( const FD31_DATA *lfs )
return
TRUE
;
/* set the edit control to the chosen file */
if
((
pstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BUFFILEALLOC
)))
if
((
pstr
=
heap_alloc
(
BUFFILEALLOC
)))
{
SendDlgItemMessageW
(
hWnd
,
lst1
,
LB_GETTEXT
,
lRet
,
(
LPARAM
)
pstr
);
SetDlgItemTextW
(
hWnd
,
edt1
,
pstr
);
HeapFree
(
GetProcessHeap
(),
0
,
pstr
);
heap_free
(
pstr
);
}
if
(
lfs
->
hook
)
{
...
...
@@ -624,11 +625,11 @@ static LRESULT FD31_DiskChange( const FD31_DATA *lfs )
lRet
=
SendDlgItemMessageW
(
hWnd
,
cmb2
,
CB_GETCURSEL
,
0
,
0L
);
if
(
lRet
==
LB_ERR
)
return
0
;
pstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BUFFILEALLOC
);
pstr
=
heap_alloc
(
BUFFILEALLOC
);
SendDlgItemMessageW
(
hWnd
,
cmb2
,
CB_GETLBTEXT
,
lRet
,
(
LPARAM
)
pstr
);
wsprintfW
(
diskname
,
FILE_specc
,
pstr
[
2
]);
HeapFree
(
GetProcessHeap
(),
0
,
pstr
);
heap_free
(
pstr
);
return
FD31_Validate
(
lfs
,
diskname
,
cmb2
,
lRet
,
TRUE
);
}
...
...
@@ -729,7 +730,7 @@ static LPWSTR FD31_MapStringPairsToW(LPCSTR strA, UINT size)
if
(
n
<
size
)
n
=
size
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
strA
,
n
,
NULL
,
0
);
x
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
x
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
strA
,
n
,
x
,
len
);
return
x
;
}
...
...
@@ -744,7 +745,7 @@ static LPWSTR FD31_DupToW(LPCSTR str, DWORD size)
LPWSTR
strW
=
NULL
;
if
(
str
&&
(
size
>
0
))
{
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
strW
=
heap_alloc
(
size
*
sizeof
(
WCHAR
));
if
(
strW
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
strW
,
size
);
}
return
strW
;
...
...
@@ -786,7 +787,7 @@ static void FD31_MapOfnStructA(const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW,
LoadStringW
(
COMDLG32_hInstance
,
open
?
IDS_OPEN_FILE
:
IDS_SAVE_AS
,
buf
,
sizeof
(
buf
)
/
sizeof
(
WCHAR
));
len
=
lstrlenW
(
buf
)
+
1
;
title_tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
title_tmp
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
memcpy
(
title_tmp
,
buf
,
len
*
sizeof
(
WCHAR
));
ofnW
->
lpstrTitle
=
title_tmp
;
}
...
...
@@ -819,14 +820,14 @@ static void FD31_MapOfnStructA(const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW,
*/
static
void
FD31_FreeOfnW
(
OPENFILENAMEW
*
ofnW
)
{
HeapFree
(
GetProcessHeap
(),
0
,
(
LPWSTR
)
ofnW
->
lpstrFilter
);
HeapFree
(
GetProcessHeap
(),
0
,
ofnW
->
lpstrCustomFilter
);
HeapFree
(
GetProcessHeap
(),
0
,
ofnW
->
lpstrFile
);
HeapFree
(
GetProcessHeap
(),
0
,
ofnW
->
lpstrFileTitle
);
HeapFree
(
GetProcessHeap
(),
0
,
(
LPWSTR
)
ofnW
->
lpstrInitialDir
);
HeapFree
(
GetProcessHeap
(),
0
,
(
LPWSTR
)
ofnW
->
lpstrTitle
);
if
(
!
IS_INTRESOURCE
(
ofnW
->
lpTemplateName
))
HeapFree
(
GetProcessHeap
(),
0
,
(
LPWSTR
)
ofnW
->
lpTemplateName
);
heap_free
((
void
*
)
ofnW
->
lpstrFilter
);
heap_free
(
ofnW
->
lpstrCustomFilter
);
heap_free
(
ofnW
->
lpstrFile
);
heap_free
(
ofnW
->
lpstrFileTitle
);
heap_free
((
void
*
)
ofnW
->
lpstrInitialDir
);
heap_free
((
void
*
)
ofnW
->
lpstrTitle
);
if
(
!
IS_INTRESOURCE
(
ofnW
->
lpTemplateName
))
heap_free
((
void
*
)
ofnW
->
lpTemplateName
);
}
/************************************************************************
...
...
@@ -844,9 +845,9 @@ static void FD31_DestroyPrivate(PFD31_DATA lfs)
if
(
lfs
->
ofnA
)
{
FD31_FreeOfnW
(
lfs
->
ofnW
);
HeapFree
(
GetProcessHeap
(),
0
,
lfs
->
ofnW
);
heap_free
(
lfs
->
ofnW
);
}
HeapFree
(
GetProcessHeap
(),
0
,
lfs
);
heap_free
(
lfs
);
RemovePropA
(
hwnd
,
FD31_OFN_PROP
);
}
...
...
@@ -918,7 +919,7 @@ static BOOL FD31_GetTemplate(PFD31_DATA lfs)
*/
static
PFD31_DATA
FD31_AllocPrivate
(
LPARAM
lParam
,
UINT
dlgType
,
BOOL
IsUnicode
)
{
PFD31_DATA
lfs
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
FD31_DATA
));
FD31_DATA
*
lfs
=
heap_alloc_zero
(
sizeof
(
*
lfs
));
TRACE
(
"alloc private buf %p
\n
"
,
lfs
);
if
(
!
lfs
)
return
NULL
;
...
...
@@ -940,7 +941,7 @@ static PFD31_DATA FD31_AllocPrivate(LPARAM lParam, UINT dlgType, BOOL IsUnicode)
if
(
lfs
->
ofnA
->
Flags
&
OFN_ENABLEHOOK
)
if
(
lfs
->
ofnA
->
lpfnHook
)
lfs
->
hook
=
TRUE
;
lfs
->
ofnW
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lfs
->
ofnA
->
lStructSize
);
lfs
->
ofnW
=
heap_alloc_zero
(
lfs
->
ofnA
->
lStructSize
);
lfs
->
ofnW
->
lStructSize
=
lfs
->
ofnA
->
lStructSize
;
FD31_MapOfnStructA
(
lfs
->
ofnA
,
lfs
->
ofnW
,
lfs
->
open
);
}
...
...
dlls/comdlg32/finddlg.c
View file @
38898e93
...
...
@@ -30,6 +30,7 @@
#include "cderr.h"
#include "dlgs.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
commdlg
);
...
...
@@ -284,7 +285,7 @@ static INT_PTR CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPA
if
(
iMsg
==
WM_DESTROY
)
{
RemovePropA
(
hDlgWnd
,
(
LPSTR
)
COMDLG32_Atom
);
HeapFree
(
GetProcessHeap
(),
0
,
pdata
);
heap_free
(
pdata
);
}
return
retval
;
...
...
@@ -427,7 +428,7 @@ static HWND COMDLG32_FR_DoFindReplace(
error
=
CDERR_DIALOGFAILURE
;
cleanup:
COMDLG32_SetCommDlgExtendedError
(
error
);
HeapFree
(
GetProcessHeap
(),
0
,
pdata
);
heap_free
(
pdata
);
}
return
hdlgwnd
;
}
...
...
dlls/comdlg32/fontdlg.c
View file @
38898e93
...
...
@@ -32,6 +32,7 @@
#include "commdlg.h"
#include "dlgs.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "cderr.h"
#include "cdlg.h"
...
...
@@ -1151,11 +1152,11 @@ static LRESULT CFn_WMDestroy(HWND hwnd, LPCHOOSEFONTW lpcfw)
if
((
lpcfw
->
Flags
&
CF_USESTYLE
)
&&
lpcfw
->
lpszStyle
)
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpcfw
->
lpszStyle
,
-
1
,
NULL
,
0
,
0
,
0
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpcfw
->
lpszStyle
,
-
1
,
lpcfa
->
lpszStyle
,
len
,
0
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
lpcfw
->
lpszStyle
);
heap_free
(
lpcfw
->
lpszStyle
);
}
HeapFree
(
GetProcessHeap
(),
0
,
lpcfw
->
lpLogFont
);
HeapFree
(
GetProcessHeap
(),
0
,
lpcfw
);
heap_free
(
lpcfw
->
lpLogFont
);
heap_free
(
lpcfw
);
SetPropW
(
hwnd
,
strWineFontData
,
0
);
return
TRUE
;
...
...
@@ -1217,16 +1218,16 @@ static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
lpcfa
=
(
LPCHOOSEFONTA
)
lParam
;
SetPropW
(
hDlg
,
strWineFontData_a
,
(
HANDLE
)
lParam
);
lpcfw
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CHOOSEFONTW
));
lpcfw
=
heap_alloc
(
sizeof
(
*
lpcfw
));
memcpy
(
lpcfw
,
lpcfa
,
sizeof
(
CHOOSEFONTA
));
lpcfw
->
lpLogFont
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
LOGFONTW
));
lpcfw
->
lpLogFont
=
heap_alloc
(
sizeof
(
*
lpcfw
->
lpLogFont
));
memcpy
(
lpcfw
->
lpLogFont
,
lpcfa
->
lpLogFont
,
sizeof
(
LOGFONTA
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpcfa
->
lpLogFont
->
lfFaceName
,
LF_FACESIZE
,
lpcfw
->
lpLogFont
->
lfFaceName
,
LF_FACESIZE
);
if
((
lpcfa
->
Flags
&
CF_USESTYLE
)
&&
lpcfa
->
lpszStyle
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpcfa
->
lpszStyle
,
-
1
,
NULL
,
0
);
lpcfw
->
lpszStyle
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
lpcfw
->
lpszStyle
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpcfa
->
lpszStyle
,
-
1
,
lpcfw
->
lpszStyle
,
len
);
}
...
...
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