wshom: Use global memory allocation helpers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1db5170f49
commit
f6bf269065
|
@ -24,6 +24,7 @@
|
||||||
#include "dispex.h"
|
#include "dispex.h"
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
#include "wine/heap.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(wshom);
|
WINE_DEFAULT_DEBUG_CHANNEL(wshom);
|
||||||
|
@ -130,7 +131,7 @@ static ULONG WINAPI WshExec_Release(IWshExec *iface)
|
||||||
if (!ref) {
|
if (!ref) {
|
||||||
CloseHandle(This->info.hThread);
|
CloseHandle(This->info.hThread);
|
||||||
CloseHandle(This->info.hProcess);
|
CloseHandle(This->info.hProcess);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -325,7 +326,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret)
|
||||||
|
|
||||||
*ret = NULL;
|
*ret = NULL;
|
||||||
|
|
||||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
This = heap_alloc(sizeof(*This));
|
||||||
if (!This)
|
if (!This)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -333,7 +334,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret)
|
||||||
This->ref = 1;
|
This->ref = 1;
|
||||||
|
|
||||||
if (!CreateProcessW(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &This->info)) {
|
if (!CreateProcessW(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &This->info)) {
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
return HRESULT_FROM_WIN32(GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +384,7 @@ static ULONG WINAPI WshEnvironment_Release(IWshEnvironment *iface)
|
||||||
TRACE("(%p) ref = %d\n", This, ref);
|
TRACE("(%p) ref = %d\n", This, ref);
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +520,7 @@ static HRESULT WshEnvironment_Create(IWshEnvironment **env)
|
||||||
{
|
{
|
||||||
WshEnvironment *This;
|
WshEnvironment *This;
|
||||||
|
|
||||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
This = heap_alloc(sizeof(*This));
|
||||||
if (!This) return E_OUTOFMEMORY;
|
if (!This) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
This->IWshEnvironment_iface.lpVtbl = &WshEnvironmentVtbl;
|
This->IWshEnvironment_iface.lpVtbl = &WshEnvironmentVtbl;
|
||||||
|
@ -572,7 +573,7 @@ static ULONG WINAPI WshCollection_Release(IWshCollection *iface)
|
||||||
TRACE("(%p) ref = %d\n", This, ref);
|
TRACE("(%p) ref = %d\n", This, ref);
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +722,7 @@ static HRESULT WshCollection_Create(IWshCollection **collection)
|
||||||
{
|
{
|
||||||
WshCollection *This;
|
WshCollection *This;
|
||||||
|
|
||||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
This = heap_alloc(sizeof(*This));
|
||||||
if (!This) return E_OUTOFMEMORY;
|
if (!This) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
This->IWshCollection_iface.lpVtbl = &WshCollectionVtbl;
|
This->IWshCollection_iface.lpVtbl = &WshCollectionVtbl;
|
||||||
|
@ -778,7 +779,7 @@ static ULONG WINAPI WshShortcut_Release(IWshShortcut *iface)
|
||||||
{
|
{
|
||||||
SysFreeString(This->path_link);
|
SysFreeString(This->path_link);
|
||||||
IShellLinkW_Release(This->link);
|
IShellLinkW_Release(This->link);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -1077,7 +1078,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
|
||||||
|
|
||||||
*shortcut = NULL;
|
*shortcut = NULL;
|
||||||
|
|
||||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
This = heap_alloc(sizeof(*This));
|
||||||
if (!This) return E_OUTOFMEMORY;
|
if (!This) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl;
|
This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl;
|
||||||
|
@ -1087,7 +1088,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
|
||||||
&IID_IShellLinkW, (void**)&This->link);
|
&IID_IShellLinkW, (void**)&This->link);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1095,7 +1096,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
|
||||||
if (!This->path_link)
|
if (!This->path_link)
|
||||||
{
|
{
|
||||||
IShellLinkW_Release(This->link);
|
IShellLinkW_Release(This->link);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1427,7 @@ static HRESULT split_reg_path(const WCHAR *path, WCHAR **subkey, WCHAR **value)
|
||||||
unsigned int len = *value - *subkey - 1;
|
unsigned int len = *value - *subkey - 1;
|
||||||
WCHAR *ret;
|
WCHAR *ret;
|
||||||
|
|
||||||
ret = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
|
ret = heap_alloc((len + 1)*sizeof(WCHAR));
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -1466,7 +1467,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
|
||||||
if (ret == ERROR_SUCCESS) {
|
if (ret == ERROR_SUCCESS) {
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
data = HeapAlloc(GetProcessHeap(), 0, datalen);
|
data = heap_alloc(datalen);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1474,7 +1475,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
|
||||||
|
|
||||||
ret = RegGetValueW(root, subkey, val, RRF_RT_ANY, &type, data, &datalen);
|
ret = RegGetValueW(root, subkey, val, RRF_RT_ANY, &type, data, &datalen);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
HeapFree(GetProcessHeap(), 0, data);
|
heap_free(data);
|
||||||
hr = HRESULT_FROM_WIN32(ret);
|
hr = HRESULT_FROM_WIN32(ret);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -1564,7 +1565,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
};
|
};
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, data);
|
heap_free(data);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
VariantInit(value);
|
VariantInit(value);
|
||||||
}
|
}
|
||||||
|
@ -1573,7 +1574,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (val)
|
if (val)
|
||||||
HeapFree(GetProcessHeap(), 0, subkey);
|
heap_free(subkey);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1661,7 +1662,7 @@ static HRESULT WINAPI WshShell3_RegWrite(IWshShell3 *iface, BSTR name, VARIANT *
|
||||||
fail:
|
fail:
|
||||||
VariantClear(&v);
|
VariantClear(&v);
|
||||||
if (val)
|
if (val)
|
||||||
HeapFree(GetProcessHeap(), 0, subkey);
|
heap_free(subkey);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue