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
0a6ea2d3
Commit
0a6ea2d3
authored
Sep 01, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Sep 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Use CRT allocation functions.
parent
294be173
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
46 deletions
+43
-46
assoc.c
dlls/shlwapi/assoc.c
+10
-13
msgbox.c
dlls/shlwapi/msgbox.c
+2
-2
ordinal.c
dlls/shlwapi/ordinal.c
+16
-16
path.c
dlls/shlwapi/path.c
+4
-4
regstream.c
dlls/shlwapi/regstream.c
+5
-5
string.c
dlls/shlwapi/string.c
+6
-6
No files found.
dlls/shlwapi/assoc.c
View file @
0a6ea2d3
...
...
@@ -55,8 +55,7 @@ static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen,
else
{
/* Create a new buffer big enough for the string */
*
lpszOut
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwStrLen
*
sizeof
(
WCHAR
));
*
lpszOut
=
malloc
(
dwStrLen
*
sizeof
(
WCHAR
));
if
(
!*
lpszOut
)
return
FALSE
;
}
...
...
@@ -197,10 +196,10 @@ HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc
}
if
(
lpszAssocW
!=
szAssocW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszAssocW
);
free
(
lpszAssocW
);
if
(
lpszExtraW
!=
szExtraW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszExtraW
);
free
(
lpszExtraW
);
return
hRet
;
}
...
...
@@ -272,8 +271,7 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc,
DWORD
dwLenOut
=
*
pcchOut
;
if
(
dwLenOut
>=
MAX_PATH
)
lpszReturnW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
dwLenOut
+
1
)
*
sizeof
(
WCHAR
));
lpszReturnW
=
malloc
((
dwLenOut
+
1
)
*
sizeof
(
WCHAR
));
else
dwLenOut
=
ARRAY_SIZE
(
szReturnW
);
...
...
@@ -290,14 +288,14 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc,
*
pcchOut
=
dwLenOut
;
if
(
lpszReturnW
!=
szReturnW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszReturnW
);
free
(
lpszReturnW
);
}
}
if
(
lpszAssocW
!=
szAssocW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszAssocW
);
free
(
lpszAssocW
);
if
(
lpszExtraW
!=
szExtraW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszExtraW
);
free
(
lpszExtraW
);
return
hRet
;
}
...
...
@@ -364,8 +362,7 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc
{
DWORD
dwLenOut
=
*
pcchOut
;
if
(
dwLenOut
>=
MAX_PATH
)
lpszReturnW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
dwLenOut
+
1
)
*
sizeof
(
WCHAR
));
lpszReturnW
=
malloc
((
dwLenOut
+
1
)
*
sizeof
(
WCHAR
));
if
(
lpszReturnW
)
{
...
...
@@ -377,12 +374,12 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc
*
pcchOut
=
dwLenOut
;
if
(
lpszReturnW
!=
szReturnW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszReturnW
);
free
(
lpszReturnW
);
}
}
if
(
lpszExtraW
!=
szExtraW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszExtraW
);
free
(
lpszExtraW
);
return
hRet
;
}
...
...
dlls/shlwapi/msgbox.c
View file @
0a6ea2d3
...
...
@@ -258,7 +258,7 @@ INT_PTR WINAPI SHMessageBoxCheckA(HWND hWnd, LPCSTR lpszText, LPCSTR lpszTitle,
if
(
lpszText
)
{
iLen
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszText
,
-
1
,
NULL
,
0
);
szTextBuff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
iLen
*
sizeof
(
WCHAR
));
szTextBuff
=
malloc
(
iLen
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszText
,
-
1
,
szTextBuff
,
iLen
);
}
...
...
@@ -266,7 +266,7 @@ INT_PTR WINAPI SHMessageBoxCheckA(HWND hWnd, LPCSTR lpszText, LPCSTR lpszTitle,
iRetVal
=
SHMessageBoxCheckW
(
hWnd
,
szTextBuff
,
lpszTitle
?
szTitleBuff
:
NULL
,
dwType
,
iRet
,
szIdBuff
);
HeapFree
(
GetProcessHeap
(),
0
,
szTextBuff
);
free
(
szTextBuff
);
return
iRetVal
;
}
...
...
dlls/shlwapi/ordinal.c
View file @
0a6ea2d3
...
...
@@ -340,7 +340,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
dwNumValues
=
dwCount
;
/* Note: dwCount = number of items + 1; The extra item is the end node */
format
=
formatList
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwCount
*
sizeof
(
FORMATETC
));
format
=
formatList
=
malloc
(
dwCount
*
sizeof
(
FORMATETC
));
if
(
!
formatList
)
{
RegCloseKey
(
hDocs
);
...
...
@@ -364,7 +364,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
(
PBYTE
)
szValueBuff
,
&
dwValueSize
);
if
(
!
dwRet
)
{
HeapFree
(
GetProcessHeap
(),
0
,
formatList
);
free
(
formatList
);
RegCloseKey
(
hDocs
);
hr
=
E_FAIL
;
goto
exit
;
...
...
@@ -392,7 +392,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
/* Create a clipboard enumerator */
hr
=
CreateFormatEnumerator
(
dwNumValues
,
formatList
,
&
pIEnumFormatEtc
);
HeapFree
(
GetProcessHeap
(),
0
,
formatList
);
free
(
formatList
);
if
(
FAILED
(
hr
))
goto
exit
;
/* Set our enumerator as the browsers property */
...
...
@@ -1828,7 +1828,7 @@ BOOL WINAPI FDSA_Destroy(FDSA_info *info)
if
(
info
->
flags
&
FDSA_FLAG_INTERNAL_ALLOC
)
{
HeapFree
(
GetProcessHeap
(),
0
,
info
->
mem
);
free
(
info
->
mem
);
return
FALSE
;
}
...
...
@@ -1850,11 +1850,11 @@ DWORD WINAPI FDSA_InsertItem(FDSA_info *info, DWORD where, const void *block)
{
DWORD
size
=
(
info
->
blocks_alloced
+
info
->
inc
)
*
info
->
block_size
;
if
(
info
->
flags
&
0x1
)
info
->
mem
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
info
->
mem
,
size
);
info
->
mem
=
_recalloc
(
info
->
mem
,
1
,
size
);
else
{
void
*
old_mem
=
info
->
mem
;
info
->
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
info
->
mem
=
calloc
(
1
,
size
);
memcpy
(
info
->
mem
,
old_mem
,
info
->
blocks_alloced
*
info
->
block_size
);
}
info
->
blocks_alloced
+=
info
->
inc
;
...
...
@@ -2678,7 +2678,7 @@ DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out,
if
(
outLen
==
0
)
return
0
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
outLen
*
sizeof
(
WCHAR
));
buf
=
malloc
(
outLen
*
sizeof
(
WCHAR
));
if
(
!
buf
){
*
out
=
0
;
return
0
;
...
...
@@ -2690,7 +2690,7 @@ DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out,
else
*
out
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
return
lstrlenW
(
out
);
}
...
...
@@ -3796,7 +3796,7 @@ HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create)
else
size_user
=
0
;
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size_key
+
size_subkey
+
size_user
+
sizeof
(
WCHAR
));
path
=
malloc
(
size_key
+
size_subkey
+
size_user
+
sizeof
(
WCHAR
));
if
(
!
path
)
{
ERR
(
"Out of memory
\n
"
);
return
NULL
;
...
...
@@ -3816,7 +3816,7 @@ HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create)
RegOpenKeyExW
((
flags
&
0xf
)
==
SHKEY_Root_HKLM
?
HKEY_LOCAL_MACHINE
:
HKEY_CURRENT_USER
,
path
,
0
,
MAXIMUM_ALLOWED
,
&
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
free
(
path
);
return
hkey
;
}
...
...
@@ -4050,7 +4050,7 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
if
(
len
)
{
szText
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
szText
=
malloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
szText
)
LoadStringW
(
hInstance
,
LOWORD
(
lpText
),
szText
,
len
+
1
);
}
pszText
=
szText
;
...
...
@@ -4070,7 +4070,7 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
ret
=
MessageBoxW
(
hWnd
,
pszTemp
,
pszTitle
,
uType
);
HeapFree
(
GetProcessHeap
(),
0
,
szText
);
free
(
szText
);
LocalFree
(
pszTemp
);
return
ret
;
}
...
...
@@ -4138,7 +4138,7 @@ PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(const PSHELL_USER_PERMISS
if
(
apUserPerm
==
NULL
||
cUserPerm
<=
0
)
return
NULL
;
sidlist
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cUserPerm
*
sizeof
(
PSID
));
sidlist
=
malloc
(
cUserPerm
*
sizeof
(
PSID
));
if
(
!
sidlist
)
return
NULL
;
...
...
@@ -4235,7 +4235,7 @@ free_sids:
if
(
!
cur_user
||
sidlist
[
i
]
!=
cur_user
)
FreeSid
(
sidlist
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
sidlist
);
free
(
sidlist
);
return
psd
;
}
...
...
@@ -4355,13 +4355,13 @@ INT WINAPI SHFormatDateTimeA(const FILETIME UNALIGNED *fileTime, DWORD *flags,
if
(
!
buf
||
!
size
)
return
0
;
bufW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
size
);
bufW
=
malloc
(
sizeof
(
WCHAR
)
*
size
);
retval
=
SHFormatDateTimeW
(
fileTime
,
flags
,
bufW
,
size
);
if
(
retval
!=
0
)
retval
=
WideCharToMultiByte
(
CP_ACP
,
0
,
bufW
,
-
1
,
buf
,
size
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
bufW
);
free
(
bufW
);
return
retval
;
}
...
...
dlls/shlwapi/path.c
View file @
0a6ea2d3
...
...
@@ -275,7 +275,7 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
/* Try dirs listed in %PATH% */
dwLenPATH
=
GetEnvironmentVariableW
(
szPath
,
buff
,
MAX_PATH
);
if
(
!
dwLenPATH
||
!
(
lpszPATH
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
dwLenPATH
+
1
)
*
sizeof
(
WCHAR
))))
if
(
!
dwLenPATH
||
!
(
lpszPATH
=
malloc
(
(
dwLenPATH
+
1
)
*
sizeof
(
WCHAR
))))
return
FALSE
;
GetEnvironmentVariableW
(
szPath
,
lpszPATH
,
dwLenPATH
+
1
);
...
...
@@ -298,17 +298,17 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
if
(
!
PathAppendW
(
buff
,
lpszFile
))
{
HeapFree
(
GetProcessHeap
(),
0
,
lpszPATH
);
free
(
lpszPATH
);
return
FALSE
;
}
if
(
PathFileExistsDefExtW
(
buff
,
dwWhich
))
{
lstrcpyW
(
lpszFile
,
buff
);
HeapFree
(
GetProcessHeap
(),
0
,
lpszPATH
);
free
(
lpszPATH
);
return
TRUE
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpszPATH
);
free
(
lpszPATH
);
return
FALSE
;
}
...
...
dlls/shlwapi/regstream.c
View file @
0a6ea2d3
...
...
@@ -99,8 +99,8 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface)
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pbBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
pbBuffer
);
free
(
This
);
return
0
;
}
...
...
@@ -150,7 +150,7 @@ static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb
if
(
newLen
>
This
->
dwLength
)
{
LPBYTE
newBuf
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
This
->
pbBuffer
,
newLen
);
BYTE
*
newBuf
=
_recalloc
(
This
->
pbBuffer
,
1
,
newLen
);
if
(
!
newBuf
)
return
STG_E_INSUFFICIENTMEMORY
;
...
...
@@ -209,7 +209,7 @@ static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewS
/* we cut off the high part here */
newLen
=
libNewSize
.
u
.
LowPart
;
newBuf
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
This
->
pbBuffer
,
newLen
);
newBuf
=
_recalloc
(
This
->
pbBuffer
,
1
,
newLen
);
if
(
!
newBuf
)
return
STG_E_INSUFFICIENTMEMORY
;
...
...
@@ -343,7 +343,7 @@ static ISHRegStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength)
{
ISHRegStream
*
regStream
;
regStream
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ISHRegStream
));
regStream
=
malloc
(
sizeof
(
ISHRegStream
));
if
(
regStream
)
{
...
...
dlls/shlwapi/string.c
View file @
0a6ea2d3
...
...
@@ -376,13 +376,13 @@ static HRESULT _SHStrDupAToBSTR(LPCSTR src, BSTR *pBstrOut)
if
(
src
)
{
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
NULL
,
0
);
WCHAR
*
szTemp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
WCHAR
*
szTemp
=
malloc
(
len
*
sizeof
(
WCHAR
));
if
(
szTemp
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
szTemp
,
len
);
*
pBstrOut
=
SysAllocString
(
szTemp
);
HeapFree
(
GetProcessHeap
(),
0
,
szTemp
);
free
(
szTemp
);
if
(
*
pBstrOut
)
return
S_OK
;
...
...
@@ -1155,7 +1155,7 @@ DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
lenW
=
len
;
hr
=
ConvertINetUnicodeToMultiByte
(
&
dwMode
,
CodePage
,
lpSrcStr
,
&
lenW
,
NULL
,
&
needed
);
needed
++
;
mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
mem
=
malloc
(
needed
);
if
(
!
mem
)
return
0
;
...
...
@@ -1165,7 +1165,7 @@ DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
reqLen
=
SHTruncateString
(
mem
,
dstlen
);
if
(
reqLen
>
0
)
memcpy
(
lpDstStr
,
mem
,
reqLen
-
1
);
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
free
(
mem
);
return
0
;
}
default:
...
...
@@ -1180,7 +1180,7 @@ DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
reqLen
=
WideCharToMultiByte
(
CodePage
,
0
,
lpSrcStr
,
len
,
NULL
,
0
,
NULL
,
NULL
);
if
(
reqLen
)
{
mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
reqLen
);
mem
=
malloc
(
reqLen
);
if
(
mem
)
{
WideCharToMultiByte
(
CodePage
,
0
,
lpSrcStr
,
len
,
mem
,
reqLen
,
NULL
,
NULL
);
...
...
@@ -1189,7 +1189,7 @@ DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
reqLen
++
;
lstrcpynA
(
lpDstStr
,
mem
,
reqLen
);
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
free
(
mem
);
lpDstStr
[
reqLen
-
1
]
=
'\0'
;
}
}
...
...
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