*/
#include "wshom_private.h"
+#include "wshom.h"
-#include <shellapi.h>
-#include <shlobj.h>
-#include <dispex.h>
-#include <winreg.h>
+#include "shellapi.h"
+#include "shlobj.h"
+#include "dispex.h"
-#include <wine/unicode.h>
+#include "wine/debug.h"
+#include "wine/heap.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wshom);
typedef struct
{
if (!ref) {
CloseHandle(This->info.hThread);
CloseHandle(This->info.hProcess);
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
}
return ref;
*ret = NULL;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ This = heap_alloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
This->ref = 1;
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());
}
TRACE("(%p) ref = %d\n", This, ref);
if (!ref)
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
return ref;
}
{
WshEnvironment *This;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshEnvironment_iface.lpVtbl = &WshEnvironmentVtbl;
TRACE("(%p) ref = %d\n", This, ref);
if (!ref)
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
return ref;
}
{
WshCollection *This;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshCollection_iface.lpVtbl = &WshCollectionVtbl;
{
SysFreeString(This->path_link);
IShellLinkW_Release(This->link);
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
}
return ref;
*Arguments = NULL;
- hr = IShellLinkW_GetArguments(This->link, buffW, sizeof(buffW)/sizeof(WCHAR));
+ hr = IShellLinkW_GetArguments(This->link, buffW, ARRAY_SIZE(buffW));
if (FAILED(hr))
return hr;
if (!IconPath)
return E_POINTER;
- hr = IShellLinkW_GetIconLocation(This->link, buffW, sizeof(buffW)/sizeof(WCHAR), &icon);
+ hr = IShellLinkW_GetIconLocation(This->link, buffW, ARRAY_SIZE(buffW), &icon);
if (FAILED(hr)) return hr;
sprintfW(pathW, fmtW, buffW, icon);
return E_POINTER;
*WorkingDirectory = NULL;
- hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, sizeof(buffW)/sizeof(WCHAR));
+ hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, ARRAY_SIZE(buffW));
if (FAILED(hr)) return hr;
*WorkingDirectory = SysAllocString(buffW);
*shortcut = NULL;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl;
&IID_IShellLinkW, (void**)&This->link);
if (FAILED(hr))
{
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
return hr;
}
if (!This->path_link)
{
IShellLinkW_Release(This->link);
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
return E_OUTOFMEMORY;
}
};
int i;
- for (i = 0; i < sizeof(rootkeys)/sizeof(rootkeys[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(rootkeys); i++) {
if (!strncmpW(path, rootkeys[i].full, strlenW(rootkeys[i].full)))
return rootkeys[i].hkey;
if (rootkeys[i].abbrev[0] && !strncmpW(path, rootkeys[i].abbrev, strlenW(rootkeys[i].abbrev)))
unsigned int len = *value - *subkey - 1;
WCHAR *ret;
- ret = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
+ ret = heap_alloc((len + 1)*sizeof(WCHAR));
if (!ret)
return E_OUTOFMEMORY;
if (ret == ERROR_SUCCESS) {
void *data;
- data = HeapAlloc(GetProcessHeap(), 0, datalen);
+ data = heap_alloc(datalen);
if (!data) {
hr = E_OUTOFMEMORY;
goto fail;
ret = RegGetValueW(root, subkey, val, RRF_RT_ANY, &type, data, &datalen);
if (ret) {
- HeapFree(GetProcessHeap(), 0, data);
+ heap_free(data);
hr = HRESULT_FROM_WIN32(ret);
goto fail;
}
hr = E_FAIL;
};
- HeapFree(GetProcessHeap(), 0, data);
+ heap_free(data);
if (FAILED(hr))
VariantInit(value);
}
fail:
if (val)
- HeapFree(GetProcessHeap(), 0, subkey);
+ heap_free(subkey);
return hr;
}
fail:
VariantClear(&v);
if (val)
- HeapFree(GetProcessHeap(), 0, subkey);
+ heap_free(subkey);
return hr;
}