From dbf222f3aa70b6a7c55ee98d67c10f6713ffc724 Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Thu, 17 Mar 2005 20:53:37 +0000 Subject: [PATCH] Use LMEM_ flags for LocalAlloc(), not GMEM_ (GlobalAlloc). --- dlls/kernel/format_msg.c | 4 ++-- dlls/kernel/tests/heap.c | 8 ++++---- dlls/mapi32/imalloc.c | 6 +++--- dlls/ole32/ifs.c | 4 ++-- dlls/shell32/cpanelfolder.c | 2 +- dlls/shell32/dragdrophelper.c | 2 +- dlls/shell32/shelllink.c | 2 +- dlls/shell32/shellole.c | 6 +++--- dlls/shell32/shellord.c | 2 +- dlls/shell32/shfldr_desktop.c | 2 +- dlls/shell32/shfldr_fs.c | 2 +- dlls/shell32/shfldr_mycomp.c | 2 +- dlls/shlwapi/reg.c | 8 ++++---- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dlls/kernel/format_msg.c b/dlls/kernel/format_msg.c index d1144ea9f3b..cf287eefb0c 100644 --- a/dlls/kernel/format_msg.c +++ b/dlls/kernel/format_msg.c @@ -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); diff --git a/dlls/kernel/tests/heap.c b/dlls/kernel/tests/heap.c index 358b00d0a5e..9571617d550 100644 --- a/dlls/kernel/tests/heap.c +++ b/dlls/kernel/tests/heap.c @@ -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"); } diff --git a/dlls/mapi32/imalloc.c b/dlls/mapi32/imalloc.c index 52ea5a72af3..ffe20edd154 100644 --- a/dlls/mapi32/imalloc.c +++ b/dlls/mapi32/imalloc.c @@ -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; diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c index 60baf55b38d..3d8ffea385d 100644 --- a/dlls/ole32/ifs.c +++ b/dlls/ole32/ifs.c @@ -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; diff --git a/dlls/shell32/cpanelfolder.c b/dlls/shell32/cpanelfolder.c index 6a918017ef2..cd8cdfcccb3 100644 --- a/dlls/shell32/cpanelfolder.c +++ b/dlls/shell32/cpanelfolder.c @@ -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; diff --git a/dlls/shell32/dragdrophelper.c b/dlls/shell32/dragdrophelper.c index 53a879f186b..f46823049b9 100644 --- a/dlls/shell32/dragdrophelper.c +++ b/dlls/shell32/dragdrophelper.c @@ -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; diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index ebb8287585f..cf31a117768 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -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; diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 3f888736f0a..b572fcd9490 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -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; } diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 403afe2e855..85e29e4bb71 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -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; diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index 69c4c153c6e..c8fa6363f38 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -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; diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index 41c6e1d543e..ab8fd0a30f0 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -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; diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index ef6a23eb206..a3bb5bc34cb 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -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; diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c index 398d87fe5c9..f2932b5b1e8 100644 --- a/dlls/shlwapi/reg.c +++ b/dlls/shlwapi/reg.c @@ -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;