mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 06:00:45 +00:00
Use LMEM_ flags for LocalAlloc(), not GMEM_ (GlobalAlloc).
This commit is contained in:
parent
e3fe68926c
commit
dbf222f3aa
@ -324,7 +324,7 @@ DWORD WINAPI FormatMessageA(
|
||||
}
|
||||
TRACE("-- %s\n",debugstr_a(target));
|
||||
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
||||
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(GMEM_ZEROINIT,max(nSize, talloced));
|
||||
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(LMEM_ZEROINIT,max(nSize, talloced));
|
||||
memcpy(*(LPSTR*)lpBuffer,target,talloced);
|
||||
} else {
|
||||
lstrcpynA(lpBuffer,target,nSize);
|
||||
@ -537,7 +537,7 @@ DWORD WINAPI FormatMessageW(
|
||||
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
||||
/* nSize is the MINIMUM size */
|
||||
DWORD len = strlenW(target) + 1;
|
||||
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(GMEM_ZEROINIT,len*sizeof(WCHAR));
|
||||
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(LMEM_ZEROINIT,len*sizeof(WCHAR));
|
||||
strcpyW(*(LPWSTR*)lpBuffer, target);
|
||||
}
|
||||
else lstrcpynW(lpBuffer, target, nSize);
|
||||
|
@ -63,17 +63,17 @@ START_TEST(heap)
|
||||
ok(gbl == NULL, "global realloc allocated memory\n");
|
||||
|
||||
/* Local*() functions */
|
||||
gbl = LocalAlloc(GMEM_MOVEABLE, 0);
|
||||
gbl = LocalAlloc(LMEM_MOVEABLE, 0);
|
||||
ok(gbl != NULL, "local memory not allocated for size 0\n");
|
||||
|
||||
gbl = LocalReAlloc(gbl, 10, GMEM_MOVEABLE);
|
||||
gbl = LocalReAlloc(gbl, 10, LMEM_MOVEABLE);
|
||||
ok(gbl != NULL, "Can't realloc local memory\n");
|
||||
size = LocalSize(gbl);
|
||||
ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld\n", size);
|
||||
|
||||
todo_wine
|
||||
{
|
||||
gbl = LocalReAlloc(gbl, 0, GMEM_MOVEABLE);
|
||||
gbl = LocalReAlloc(gbl, 0, LMEM_MOVEABLE);
|
||||
ok(gbl != NULL, "LocalReAlloc should not fail on size 0\n");
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ START_TEST(heap)
|
||||
size = LocalSize(gbl);
|
||||
ok(size == 0, "Memory should have been freed, size=%ld\n", size);
|
||||
|
||||
gbl = LocalReAlloc(0, 10, GMEM_MOVEABLE);
|
||||
gbl = LocalReAlloc(0, 10, LMEM_MOVEABLE);
|
||||
ok(gbl == NULL, "local realloc allocated memory\n");
|
||||
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static LPVOID WINAPI IMAPIMalloc_fnAlloc(LPMALLOC iface, DWORD cb)
|
||||
{
|
||||
TRACE("(%p)->(%ld)\n", iface, cb);
|
||||
|
||||
return LocalAlloc(GMEM_FIXED, cb);
|
||||
return LocalAlloc(LMEM_FIXED, cb);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
@ -123,10 +123,10 @@ static LPVOID WINAPI IMAPIMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, DWORD cb)
|
||||
TRACE("(%p)->(%p, %ld)\n", iface, pv, cb);
|
||||
|
||||
if (!pv)
|
||||
return LocalAlloc(GMEM_FIXED, cb);
|
||||
return LocalAlloc(LMEM_FIXED, cb);
|
||||
|
||||
if (cb)
|
||||
return LocalReAlloc((HANDLE) pv, cb, GMEM_MOVEABLE);
|
||||
return LocalReAlloc((HANDLE) pv, cb, LMEM_MOVEABLE);
|
||||
|
||||
LocalFree((HANDLE) pv);
|
||||
return NULL;
|
||||
|
@ -77,8 +77,8 @@ static int SetSpyedBlockTableLength ( int NewLength )
|
||||
{
|
||||
LPVOID *NewSpyedBlocks;
|
||||
|
||||
if (!Malloc32.SpyedBlocks) NewSpyedBlocks = LocalAlloc(GMEM_ZEROINIT, NewLength * sizeof(PVOID));
|
||||
else NewSpyedBlocks = LocalReAlloc(Malloc32.SpyedBlocks, NewLength * sizeof(PVOID), GMEM_ZEROINIT);
|
||||
if (!Malloc32.SpyedBlocks) NewSpyedBlocks = LocalAlloc(LMEM_ZEROINIT, NewLength * sizeof(PVOID));
|
||||
else NewSpyedBlocks = LocalReAlloc(Malloc32.SpyedBlocks, NewLength * sizeof(PVOID), LMEM_ZEROINIT);
|
||||
if (NewSpyedBlocks) {
|
||||
Malloc32.SpyedBlocks = NewSpyedBlocks;
|
||||
Malloc32.SpyedBlockTableLength = NewLength;
|
||||
|
@ -124,7 +124,7 @@ HRESULT WINAPI IControlPanel_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOI
|
||||
if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
sf = (ICPanelImpl *) LocalAlloc(GMEM_ZEROINIT, sizeof(ICPanelImpl));
|
||||
sf = (ICPanelImpl *) LocalAlloc(LMEM_ZEROINIT, sizeof(ICPanelImpl));
|
||||
if (!sf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -71,7 +71,7 @@ HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid,
|
||||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
dth = (IDropTargetHelperImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
|
||||
dth = (IDropTargetHelperImpl *) LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
|
||||
if (!dth) return E_OUTOFMEMORY;
|
||||
|
||||
dth->ref = 0;
|
||||
|
@ -1093,7 +1093,7 @@ HRESULT WINAPI IShellLink_Constructor (
|
||||
*ppv = NULL;
|
||||
|
||||
if(pUnkOuter) return CLASS_E_NOAGGREGATION;
|
||||
sl = (IShellLinkImpl *) LocalAlloc(GMEM_ZEROINIT,sizeof(IShellLinkImpl));
|
||||
sl = (IShellLinkImpl *) LocalAlloc(LMEM_ZEROINIT,sizeof(IShellLinkImpl));
|
||||
if (!sl) return E_OUTOFMEMORY;
|
||||
|
||||
sl->ref = 1;
|
||||
|
@ -318,7 +318,7 @@ static LPVOID WINAPI IShellMalloc_fnAlloc(LPMALLOC iface, DWORD cb)
|
||||
{
|
||||
LPVOID addr;
|
||||
|
||||
addr = (LPVOID) LocalAlloc(GMEM_ZEROINIT, cb);
|
||||
addr = (LPVOID) LocalAlloc(LMEM_ZEROINIT, cb);
|
||||
TRACE("(%p,%ld);\n",addr,cb);
|
||||
return addr;
|
||||
}
|
||||
@ -332,14 +332,14 @@ static LPVOID WINAPI IShellMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, DWORD cb)
|
||||
|
||||
if (pv) {
|
||||
if (cb) {
|
||||
addr = (LPVOID) LocalReAlloc((HANDLE) pv, cb, GMEM_ZEROINIT | GMEM_MOVEABLE);
|
||||
addr = (LPVOID) LocalReAlloc((HANDLE) pv, cb, LMEM_ZEROINIT | LMEM_MOVEABLE);
|
||||
} else {
|
||||
LocalFree((HANDLE) pv);
|
||||
addr = NULL;
|
||||
}
|
||||
} else {
|
||||
if (cb) {
|
||||
addr = (LPVOID) LocalAlloc(GMEM_ZEROINIT, cb);
|
||||
addr = (LPVOID) LocalAlloc(LMEM_ZEROINIT, cb);
|
||||
} else {
|
||||
addr = NULL;
|
||||
}
|
||||
|
@ -1506,7 +1506,7 @@ HRESULT WINAPI SHELL32_256(LPDWORD lpdw0, LPDWORD lpdw1)
|
||||
ret = E_INVALIDARG;
|
||||
else
|
||||
{
|
||||
LPVOID lpdata = 0;/*LocalAlloc(GMEM_ZEROINIT, 0x4E4);*/
|
||||
LPVOID lpdata = 0;/*LocalAlloc(LMEM_ZEROINIT, 0x4E4);*/
|
||||
|
||||
if (!lpdata)
|
||||
ret = E_OUTOFMEMORY;
|
||||
|
@ -837,7 +837,7 @@ HRESULT WINAPI ISF_Desktop_Constructor (
|
||||
if (!SHGetSpecialFolderPathW( 0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE ))
|
||||
return E_UNEXPECTED;
|
||||
|
||||
sf = LocalAlloc( GMEM_ZEROINIT, sizeof (IGenericSFImpl) );
|
||||
sf = LocalAlloc( LMEM_ZEROINIT, sizeof (IGenericSFImpl) );
|
||||
if (!sf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -233,7 +233,7 @@ IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
|
||||
|
||||
if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
|
||||
sf = (IGenericSFImpl *) LocalAlloc (LMEM_ZEROINIT, sizeof (IGenericSFImpl));
|
||||
if (!sf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -108,7 +108,7 @@ HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LP
|
||||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
sf = LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
|
||||
sf = LocalAlloc (LMEM_ZEROINIT, sizeof (IGenericSFImpl));
|
||||
if (!sf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ DWORD WINAPI SHQueryValueExA( HKEY hKey, LPCSTR lpszValue,
|
||||
char cNull = '\0';
|
||||
nBytesToAlloc = (!pvData || (dwRet == ERROR_MORE_DATA)) ? dwUnExpDataLen : *pcbData;
|
||||
|
||||
szData = (LPSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc);
|
||||
szData = (LPSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
|
||||
RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
|
||||
dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
|
||||
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
||||
@ -1349,7 +1349,7 @@ DWORD WINAPI SHQueryValueExA( HKEY hKey, LPCSTR lpszValue,
|
||||
else
|
||||
{
|
||||
nBytesToAlloc = (lstrlenA(pvData)+1) * sizeof (CHAR);
|
||||
szData = (LPSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc );
|
||||
szData = (LPSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc );
|
||||
lstrcpyA(szData, pvData);
|
||||
dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
|
||||
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
|
||||
@ -1401,7 +1401,7 @@ DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue,
|
||||
WCHAR cNull = '\0';
|
||||
nBytesToAlloc = (!pvData || (dwRet == ERROR_MORE_DATA)) ? dwUnExpDataLen : *pcbData;
|
||||
|
||||
szData = (LPWSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc);
|
||||
szData = (LPWSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
|
||||
RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
|
||||
dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
|
||||
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
||||
@ -1410,7 +1410,7 @@ DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue,
|
||||
else
|
||||
{
|
||||
nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
|
||||
szData = (LPWSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc );
|
||||
szData = (LPWSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc );
|
||||
lstrcpyW(szData, pvData);
|
||||
dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
|
||||
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
|
||||
|
Loading…
Reference in New Issue
Block a user