[SHELL32_WINETEST] Sync with Wine Staging 3.3. CORE-14434
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 3 Apr 2018 12:47:46 +0000 (13:47 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 3 Apr 2018 12:47:46 +0000 (13:47 +0100)
22 files changed:
modules/rostests/winetests/shell32/CMakeLists.txt
modules/rostests/winetests/shell32/appbar.c
modules/rostests/winetests/shell32/assoc.c
modules/rostests/winetests/shell32/autocomplete.c
modules/rostests/winetests/shell32/brsfolder.c
modules/rostests/winetests/shell32/ebrowser.c
modules/rostests/winetests/shell32/generated.c
modules/rostests/winetests/shell32/msg.h
modules/rostests/winetests/shell32/precomp.h
modules/rostests/winetests/shell32/progman_dde.c
modules/rostests/winetests/shell32/recyclebin.c
modules/rostests/winetests/shell32/shelldispatch.c
modules/rostests/winetests/shell32/shelllink.c
modules/rostests/winetests/shell32/shellole.c
modules/rostests/winetests/shell32/shellpath.c
modules/rostests/winetests/shell32/shfldr_special.c
modules/rostests/winetests/shell32/shlexec.c
modules/rostests/winetests/shell32/shlfileop.c
modules/rostests/winetests/shell32/shlfolder.c
modules/rostests/winetests/shell32/shlview.c
modules/rostests/winetests/shell32/string.c
modules/rostests/winetests/shell32/systray.c

index ded63d7..e459d95 100644 (file)
@@ -32,7 +32,7 @@ add_executable(shell32_winetest
 
 target_link_libraries(shell32_winetest uuid)
 set_module_type(shell32_winetest win32cui)
-add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 gdi32 advapi32 msvcrt kernel32)
+add_importlibs(shell32_winetest shell32 shlwapi ole32 oleaut32 user32 gdi32 advapi32 msvcrt kernel32)
 
 if(MSVC)
     add_importlibs(shell32_winetest ntdll)
index f25fed9..1505a40 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+
+#include <windows.h>
+#include "shellapi.h"
+
+#include "wine/test.h"
 
 #define MSG_APPBAR WM_APP
 
index ac6edef..5e93750 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#define COBJMACROS
+
+#include <stdarg.h>
+
+#include "shlwapi.h"
+#include "shlguid.h"
+#include "shobjidl.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
 
-#include <shobjidl.h>
 
 static void test_IQueryAssociations_QueryInterface(void)
 {
@@ -114,7 +122,7 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
             return;
         }
 
-        buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        buffer = heap_alloc(len * sizeof(WCHAR));
         ok_(__FILE__, line)(buffer != NULL, "out of memory\n");
         hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len);
         ok_(__FILE__, line)(hr == S_OK, "GetString returned 0x%x, expected S_OK\n", hr);
@@ -126,7 +134,7 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
     }
 
     IQueryAssociations_Release(assoc);
-    HeapFree(GetProcessHeap(), 0, buffer);
+    heap_free(buffer);
 }
 
 static void test_IQueryAssociations_GetString(void)
index c2c02e2..859734c 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#define COBJMACROS
+
+#include <stdarg.h>
+
+#include "windows.h"
+#include "shobjidl.h"
+#include "shlguid.h"
+#include "initguid.h"
+#include "shldisp.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
 
 static HWND hMainWnd, hEdit;
 static HINSTANCE hinst;
@@ -216,6 +227,171 @@ static void createMainWnd(void)
       CW_USEDEFAULT, CW_USEDEFAULT, 130, 105, NULL, NULL, GetModuleHandleA(NULL), 0);
 }
 
+struct string_enumerator
+{
+    IEnumString IEnumString_iface;
+    LONG ref;
+    WCHAR **data;
+    int data_len;
+    int cur;
+};
+
+static struct string_enumerator *impl_from_IEnumString(IEnumString *iface)
+{
+    return CONTAINING_RECORD(iface, struct string_enumerator, IEnumString_iface);
+}
+
+static HRESULT WINAPI string_enumerator_QueryInterface(IEnumString *iface, REFIID riid, void **ppv)
+{
+    if (IsEqualGUID(riid, &IID_IEnumString) || IsEqualGUID(riid, &IID_IUnknown))
+    {
+        IUnknown_AddRef(iface);
+        *ppv = iface;
+        return S_OK;
+    }
+
+    *ppv = NULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI string_enumerator_AddRef(IEnumString *iface)
+{
+    struct string_enumerator *this = impl_from_IEnumString(iface);
+
+    ULONG ref = InterlockedIncrement(&this->ref);
+
+    return ref;
+}
+
+static ULONG WINAPI string_enumerator_Release(IEnumString *iface)
+{
+    struct string_enumerator *this = impl_from_IEnumString(iface);
+
+    ULONG ref = InterlockedDecrement(&this->ref);
+
+    if (!ref)
+        heap_free(this);
+
+    return ref;
+}
+
+static HRESULT WINAPI string_enumerator_Next(IEnumString *iface, ULONG num, LPOLESTR *strings, ULONG *num_returned)
+{
+    struct string_enumerator *this = impl_from_IEnumString(iface);
+    int i, len;
+
+    *num_returned = 0;
+    for (i = 0; i < num; i++)
+    {
+        if (this->cur >= this->data_len)
+            return S_FALSE;
+
+        len = lstrlenW(this->data[this->cur]) + 1;
+
+        strings[i] = CoTaskMemAlloc(len * sizeof(WCHAR));
+        memcpy(strings[i], this->data[this->cur], len * sizeof(WCHAR));
+
+        (*num_returned)++;
+        this->cur++;
+    }
+
+    return S_OK;
+}
+
+static HRESULT WINAPI string_enumerator_Reset(IEnumString *iface)
+{
+    struct string_enumerator *this = impl_from_IEnumString(iface);
+
+    this->cur = 0;
+
+    return S_OK;
+}
+
+static HRESULT WINAPI string_enumerator_Skip(IEnumString *iface, ULONG num)
+{
+    struct string_enumerator *this = impl_from_IEnumString(iface);
+
+    this->cur += num;
+
+    return S_OK;
+}
+
+static HRESULT WINAPI string_enumerator_Clone(IEnumString *iface, IEnumString **out)
+{
+    *out = NULL;
+    return E_NOTIMPL;
+}
+
+static IEnumStringVtbl string_enumerator_vtlb =
+{
+    string_enumerator_QueryInterface,
+    string_enumerator_AddRef,
+    string_enumerator_Release,
+    string_enumerator_Next,
+    string_enumerator_Skip,
+    string_enumerator_Reset,
+    string_enumerator_Clone
+};
+
+static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int count)
+{
+    struct string_enumerator *object;
+
+    object = heap_alloc_zero(sizeof(*object));
+    object->IEnumString_iface.lpVtbl = &string_enumerator_vtlb;
+    object->ref = 1;
+    object->data = suggestions;
+    object->data_len = count;
+    object->cur = 0;
+
+    *ppv = &object->IEnumString_iface;
+
+    return S_OK;
+}
+
+static void test_custom_source(void)
+{
+    static WCHAR str_alpha[] = {'t','e','s','t','1',0};
+    static WCHAR str_alpha2[] = {'t','e','s','t','2',0};
+    static WCHAR str_beta[] = {'a','u','t','o',' ','c','o','m','p','l','e','t','e',0};
+    static WCHAR *suggestions[] = { str_alpha, str_alpha2, str_beta };
+    IUnknown *enumerator;
+    IAutoComplete2 *autocomplete;
+    HWND hwnd_edit;
+    WCHAR buffer[20];
+    HRESULT hr;
+    MSG msg;
+
+    ShowWindow(hMainWnd, SW_SHOW);
+
+    hwnd_edit = CreateWindowA("Edit", "", WS_OVERLAPPED | WS_VISIBLE | WS_CHILD | WS_BORDER, 50, 5, 200, 20, hMainWnd, 0, NULL, 0);
+
+    hr = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (void**)&autocomplete);
+    ok(hr == S_OK, "CoCreateInstance failed: %x\n", hr);
+
+    string_enumerator_create((void**)&enumerator, suggestions, sizeof(suggestions) / sizeof(*suggestions));
+
+    hr = IAutoComplete2_SetOptions(autocomplete, ACO_AUTOSUGGEST | ACO_AUTOAPPEND);
+    ok(hr == S_OK, "IAutoComplete2_SetOptions failed: %x\n", hr);
+    hr = IAutoComplete2_Init(autocomplete, hwnd_edit, enumerator, NULL, NULL);
+    ok(hr == S_OK, "IAutoComplete_Init failed: %x\n", hr);
+
+    SendMessageW(hwnd_edit, WM_CHAR, 'a', 1);
+    /* Send a keyup message since wine doesn't handle WM_CHAR yet */
+    SendMessageW(hwnd_edit, WM_KEYUP, 'u', 1);
+    Sleep(100);
+    while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
+    {
+        TranslateMessage(&msg);
+        DispatchMessageA(&msg);
+    }
+    SendMessageW(hwnd_edit, WM_GETTEXT, sizeof(buffer) / sizeof(*buffer), (LPARAM)buffer);
+    ok(lstrcmpW(str_beta, buffer) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str_beta), wine_dbgstr_w(buffer));
+
+    ShowWindow(hMainWnd, SW_HIDE);
+    DestroyWindow(hwnd_edit);
+}
+
 START_TEST(autocomplete)
 {
     HRESULT r;
@@ -237,6 +413,8 @@ START_TEST(autocomplete)
         goto cleanup;
     test_killfocus();
 
+    test_custom_source();
+
     PostQuitMessage(0);
     while(GetMessageA(&msg,0,0,0)) {
         TranslateMessage(&msg);
index d564ed5..bf29d11 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#define COBJMACROS
 
+#include <windows.h>
+#include <shlobj.h>
+#include <shobjidl.h>
+#include <string.h>
+#include "shellapi.h"
+
+#include "wine/test.h"
 #define IDD_MAKENEWFOLDER 0x3746 /* From "../shresdef.h" */
 #define TIMER_WAIT_MS 50 /* Should be long enough for slow systems */
 
index 27beff5..3e89b90 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
 
-#include <initguid.h>
-#include <mshtml.h>
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include "shlobj.h"
+#include "shlwapi.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
+#include "initguid.h"
+#include "mshtml.h"
 
 /**********************************************************************
  * Some IIDs for test_SetSite.
@@ -231,7 +240,7 @@ static ULONG WINAPI IExplorerPaneVisibility_fnRelease(IExplorerPaneVisibility *i
     ULONG ref = InterlockedDecrement(&This->ref);
 
     if(!ref)
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
 
     return ref;
 }
@@ -277,7 +286,7 @@ static IExplorerPaneVisibilityImpl *create_explorerpanevisibility(void)
 {
     IExplorerPaneVisibilityImpl *epv;
 
-    epv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IExplorerPaneVisibilityImpl));
+    epv = heap_alloc_zero(sizeof(*epv));
     epv->IExplorerPaneVisibility_iface.lpVtbl = &epvvt;
     epv->ref = 1;
 
@@ -320,7 +329,7 @@ static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
     ULONG ref = InterlockedDecrement(&This->ref);
 
     if(!ref)
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
 
     return ref;
 }
@@ -431,7 +440,7 @@ static ICommDlgBrowser3Impl *create_commdlgbrowser3(void)
 {
     ICommDlgBrowser3Impl *cdb;
 
-    cdb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICommDlgBrowser3Impl));
+    cdb = heap_alloc_zero(sizeof(*cdb));
     cdb->ICommDlgBrowser3_iface.lpVtbl = &cdbvtbl;
     cdb->ref = 1;
 
@@ -489,7 +498,7 @@ static ULONG WINAPI IServiceProvider_fnRelease(IServiceProvider *iface)
     LONG ref = InterlockedDecrement(&This->ref);
 
     if(!ref)
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
 
     return ref;
 }
@@ -540,7 +549,7 @@ static const IServiceProviderVtbl spvtbl =
 
 static IServiceProviderImpl *create_serviceprovider(void)
 {
-    IServiceProviderImpl *sp = HeapAlloc(GetProcessHeap(), 0, sizeof(IServiceProviderImpl));
+    IServiceProviderImpl *sp = heap_alloc(sizeof(*sp));
     sp->IServiceProvider_iface.lpVtbl = &spvtbl;
     sp->ref = 1;
     return sp;
index b18fdec..d30857b 100755 (executable)
@@ -5,7 +5,24 @@
  * Unit tests for data structure packing
  */
 
-#include "precomp.h"
+#ifndef __REACTOS__
+#define WINVER 0x0501
+#define _WIN32_IE 0x0501
+#define _WIN32_WINNT 0x0501
+#endif
+
+#define WINE_NOWINSOCK
+
+#include <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "wtypes.h"
+#include "shellapi.h"
+#include "winuser.h"
+#include "wingdi.h"
+#include "shlobj.h"
+
+#include "wine/test.h"
 
 /***********************************************************************
  * Compatibility macros
index 7afdc7a..720e693 100644 (file)
 
 #pragma once
 
+#include <assert.h>
+#include <windows.h>
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
 /* undocumented SWP flags - from SDK 3.1 */
 #define SWP_NOCLIENTSIZE       0x0800
 #define SWP_NOCLIENTMOVE       0x1000
@@ -64,16 +70,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
     if (!msg_seq->sequence)
     {
         msg_seq->size = 10;
-        msg_seq->sequence = HeapAlloc(GetProcessHeap(), 0,
-                                      msg_seq->size * sizeof (struct message));
+        msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (struct message));
     }
 
     if (msg_seq->count == msg_seq->size)
     {
         msg_seq->size *= 2;
-        msg_seq->sequence = HeapReAlloc(GetProcessHeap(), 0,
-                                        msg_seq->sequence,
-                                        msg_seq->size * sizeof (struct message));
+        msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message));
     }
 
     assert(msg_seq->sequence);
@@ -90,7 +93,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
 static void flush_sequence(struct msg_sequence **seg, int sequence_index)
 {
     struct msg_sequence *msg_seq = seg[sequence_index];
-    HeapFree(GetProcessHeap(), 0, msg_seq->sequence);
+    heap_free(msg_seq->sequence);
     msg_seq->sequence = NULL;
     msg_seq->count = msg_seq->size = 0;
 }
@@ -288,5 +291,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n)
     int i;
 
     for (i = 0; i < n; i++)
-        seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct msg_sequence));
+        seq[i] = heap_alloc_zero(sizeof(struct msg_sequence));
 }
index ffa1f86..f69af2a 100644 (file)
@@ -1,3 +1,4 @@
+
 #ifndef _SHELL32_WINETEST_PRECOMP_H_
 #define _SHELL32_WINETEST_PRECOMP_H_
 
@@ -5,23 +6,19 @@
 #include <stdio.h>
 
 #define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
 
 #define COBJMACROS
 #define CONST_VTABLE
 
+#include <windows.h>
+
+#include <wine/heap.h>
 #include <wine/test.h>
 
-#include <winreg.h>
-#include <winnls.h>
-#include <winuser.h>
-#include <wincon.h>
 #include <shellapi.h>
 #include <shlwapi.h>
 #include <shlguid.h>
 #include <shlobj.h>
-#include <ddeml.h>
 #include <commoncontrols.h>
 #include <reactos/undocshell.h>
 
index bb566ba..62ed413 100644 (file)
  *         Tests for Invalid Characters in Names / Invalid Parameters
  */
 
-#include "precomp.h"
-
-/* Timeout on DdeClientTransaction Call */
-#define MS_TIMEOUT_VAL 1000
-/* # of times to poll for window creation */
-#define PDDE_POLL_NUM 150
-/* time to sleep between polls */
-#define PDDE_POLL_TIME 300
-
-/* Call Info */
-#define DDE_TEST_MISC            0x00010000
-#define DDE_TEST_CREATEGROUP     0x00020000
-#define DDE_TEST_DELETEGROUP     0x00030000
-#define DDE_TEST_SHOWGROUP       0x00040000
-#define DDE_TEST_ADDITEM         0x00050000
-#define DDE_TEST_DELETEITEM      0x00060000
-#define DDE_TEST_COMPOUND        0x00070000
-#define DDE_TEST_CALLMASK        0x00ff0000
-
-#define DDE_TEST_NUMMASK           0x0000ffff
+#include <stdio.h>
+#include <wine/test.h>
+#include <winbase.h>
+#include "dde.h"
+#include "ddeml.h"
+#include "winuser.h"
+#include "shlobj.h"
 
 static HRESULT (WINAPI *pSHGetLocalizedName)(LPCWSTR, LPWSTR, UINT, int *);
-static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
-static BOOL (WINAPI *pReadCabinetState)(CABINETSTATE *, int);
 
 static void init_function_pointers(void)
 {
@@ -57,10 +42,6 @@ static void init_function_pointers(void)
 
     hmod = GetModuleHandleA("shell32.dll");
     pSHGetLocalizedName = (void*)GetProcAddress(hmod, "SHGetLocalizedName");
-    pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA");
-    pReadCabinetState = (void*)GetProcAddress(hmod, "ReadCabinetState");
-    if (!pReadCabinetState)
-        pReadCabinetState = (void*)GetProcAddress(hmod, (LPSTR)651);
 }
 
 static BOOL use_common(void)
@@ -101,63 +82,20 @@ static BOOL full_title(void)
     CABINETSTATE cs;
 
     memset(&cs, 0, sizeof(cs));
-    if (pReadCabinetState)
-    {
-        pReadCabinetState(&cs, sizeof(cs));
-    }
-    else
-    {
-        HKEY key;
-        DWORD size;
-
-        win_skip("ReadCabinetState is not available, reading registry directly\n");
-        RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &key);
-        size = sizeof(cs);
-        RegQueryValueExA(key, "Settings", NULL, NULL, (LPBYTE)&cs, &size);
-        RegCloseKey(key);
-    }
+    ReadCabinetState(&cs, sizeof(cs));
 
     return (cs.fFullPathTitle == -1);
 }
 
 static char ProgramsDir[MAX_PATH];
 
-static char Group1Title[MAX_PATH]  = "Group1";
-static char Group2Title[MAX_PATH]  = "Group2";
-static char Group3Title[MAX_PATH]  = "Group3";
-static char StartupTitle[MAX_PATH] = "Startup";
-
 static void init_strings(void)
 {
-    char startup[MAX_PATH];
     char commonprograms[MAX_PATH];
     char programs[MAX_PATH];
 
-    if (pSHGetSpecialFolderPathA)
-    {
-        pSHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE);
-        pSHGetSpecialFolderPathA(NULL, commonprograms, CSIDL_COMMON_PROGRAMS, FALSE);
-        pSHGetSpecialFolderPathA(NULL, startup, CSIDL_STARTUP, FALSE);
-    }
-    else
-    {
-        HKEY key;
-        DWORD size;
-
-        /* Older Win9x and NT4 */
-
-        RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
-        size = sizeof(programs);
-        RegQueryValueExA(key, "Programs", NULL, NULL, (LPBYTE)&programs, &size);
-        size = sizeof(startup);
-        RegQueryValueExA(key, "Startup", NULL, NULL, (LPBYTE)&startup, &size);
-        RegCloseKey(key);
-
-        RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
-        size = sizeof(commonprograms);
-        RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&commonprograms, &size);
-        RegCloseKey(key);
-    }
+    SHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE);
+    SHGetSpecialFolderPathA(NULL, commonprograms, CSIDL_COMMON_PROGRAMS, FALSE);
 
     /* ProgramsDir on Vista+ is always the users one (CSIDL_PROGRAMS). Before Vista
      * it depends on whether the user is an administrator (CSIDL_COMMON_PROGRAMS) or
@@ -167,55 +105,6 @@ static void init_strings(void)
         lstrcpyA(ProgramsDir, commonprograms);
     else
         lstrcpyA(ProgramsDir, programs);
-
-    if (full_title())
-    {
-        lstrcpyA(Group1Title, ProgramsDir);
-        lstrcatA(Group1Title, "\\Group1");
-        lstrcpyA(Group2Title, ProgramsDir);
-        lstrcatA(Group2Title, "\\Group2");
-        lstrcpyA(Group3Title, ProgramsDir);
-        lstrcatA(Group3Title, "\\Group3");
-
-        lstrcpyA(StartupTitle, startup);
-    }
-    else
-    {
-        /* Vista has the nice habit of displaying the full path in English
-         * and the short one localized. CSIDL_STARTUP on Vista gives us the
-         * English version so we have to 'translate' this one.
-         *
-         * MSDN claims it should be used for files not folders but this one
-         * suits our purposes just fine.
-         */
-        if (pSHGetLocalizedName)
-        {
-            WCHAR startupW[MAX_PATH];
-            WCHAR module[MAX_PATH];
-            WCHAR module_expanded[MAX_PATH];
-            WCHAR localized[MAX_PATH];
-            HRESULT hr;
-            int id;
-
-            MultiByteToWideChar(CP_ACP, 0, startup, -1, startupW, sizeof(startupW)/sizeof(WCHAR));
-            hr = pSHGetLocalizedName(startupW, module, MAX_PATH, &id);
-            todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
-            /* check to be removed when SHGetLocalizedName is implemented */
-            if (hr == S_OK)
-            {
-                ExpandEnvironmentStringsW(module, module_expanded, MAX_PATH);
-                LoadStringW(GetModuleHandleW(module_expanded), id, localized, MAX_PATH);
-
-                WideCharToMultiByte(CP_ACP, 0, localized, -1, StartupTitle, sizeof(StartupTitle), NULL, NULL);
-            }
-            else
-                lstrcpyA(StartupTitle, (strrchr(startup, '\\') + 1));
-        }
-        else
-        {
-            lstrcpyA(StartupTitle, (strrchr(startup, '\\') + 1));
-        }
-    }
 }
 
 static HDDEDATA CALLBACK DdeCallback(UINT type, UINT format, HCONV hConv, HSZ hsz1, HSZ hsz2,
@@ -225,472 +114,305 @@ static HDDEDATA CALLBACK DdeCallback(UINT type, UINT format, HCONV hConv, HSZ hs
     return NULL;
 }
 
-/*
- * Encoded String for Error Messages so that inner failures can determine
- * what test is failing.  Format is: [Code:TestNum]
- */
-static const char * GetStringFromTestParams(int testParams)
+static UINT dde_execute(DWORD instance, HCONV hconv, const char *command_str)
 {
-    int testNum;
-    static char testParamString[64];
-    const char *callId;
+    HDDEDATA command, hdata;
+    DWORD result;
+    UINT ret;
 
-    testNum = testParams & DDE_TEST_NUMMASK;
-    switch (testParams & DDE_TEST_CALLMASK)
-    {
-    default:
-    case DDE_TEST_MISC:
-        callId = "MISC";
-        break;
-    case DDE_TEST_CREATEGROUP:
-        callId = "C_G";
-        break;
-    case DDE_TEST_DELETEGROUP:
-        callId = "D_G";
-        break;
-    case DDE_TEST_SHOWGROUP:
-        callId = "S_G";
-        break;
-    case DDE_TEST_ADDITEM:
-        callId = "A_I";
-        break;
-    case DDE_TEST_DELETEITEM:
-        callId = "D_I";
-        break;
-    case DDE_TEST_COMPOUND:
-        callId = "CPD";
-        break;
-    }
+    command = DdeCreateDataHandle(instance, (BYTE *)command_str, strlen(command_str)+1, 0, 0, 0, 0);
+    ok(command != NULL, "DdeCreateDataHandle() failed: %u\n", DdeGetLastError(instance));
 
-    sprintf(testParamString, "  [%s:%i]", callId, testNum);
-    return testParamString;
-}
+    hdata = DdeClientTransaction((BYTE *)command, -1, hconv, 0, 0, XTYP_EXECUTE, 2000, &result);
+    ret = DdeGetLastError(instance);
+    /* PROGMAN always returns 1 on success */
+    ok((UINT_PTR)hdata == !ret, "expected %u, got %p\n", !ret, hdata);
 
-/* Transfer DMLERR's into text readable strings for Error Messages */
-#define DMLERR_TO_STR(x) case x: return#x;
-static const char * GetStringFromError(UINT err)
-{
-    switch (err)
-    {
-    DMLERR_TO_STR(DMLERR_NO_ERROR);
-    DMLERR_TO_STR(DMLERR_ADVACKTIMEOUT);
-    DMLERR_TO_STR(DMLERR_BUSY);
-    DMLERR_TO_STR(DMLERR_DATAACKTIMEOUT);
-    DMLERR_TO_STR(DMLERR_DLL_NOT_INITIALIZED);
-    DMLERR_TO_STR(DMLERR_DLL_USAGE);
-    DMLERR_TO_STR(DMLERR_EXECACKTIMEOUT);
-    DMLERR_TO_STR(DMLERR_INVALIDPARAMETER);
-    DMLERR_TO_STR(DMLERR_LOW_MEMORY);
-    DMLERR_TO_STR(DMLERR_MEMORY_ERROR);
-    DMLERR_TO_STR(DMLERR_NOTPROCESSED);
-    DMLERR_TO_STR(DMLERR_NO_CONV_ESTABLISHED);
-    DMLERR_TO_STR(DMLERR_POKEACKTIMEOUT);
-    DMLERR_TO_STR(DMLERR_POSTMSG_FAILED);
-    DMLERR_TO_STR(DMLERR_REENTRANCY);
-    DMLERR_TO_STR(DMLERR_SERVER_DIED);
-    DMLERR_TO_STR(DMLERR_SYS_ERROR);
-    DMLERR_TO_STR(DMLERR_UNADVACKTIMEOUT);
-    DMLERR_TO_STR(DMLERR_UNFOUND_QUEUE_ID);
-    default:
-        return "Unknown DML Error";
-    }
+    return ret;
 }
 
-/* Helper Function to Transfer DdeGetLastError into a String */
-static const char * GetDdeLastErrorStr(DWORD instance)
+static char *dde_request(DWORD instance, HCONV hconv, const char *request_str)
 {
-    UINT err = DdeGetLastError(instance);
+    static char data[2000];
+    HDDEDATA hdata;
+    HSZ item;
+    DWORD result;
 
-    return GetStringFromError(err);
-}
+    item = DdeCreateStringHandleA(instance, request_str, CP_WINANSI);
+    ok(item != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
 
-/* Execute a Dde Command and return the error & result */
-/* Note: Progman DDE always returns a pointer to 0x00000001 on a successful result */
-static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, HDDEDATA *hData, UINT *err, int testParams)
-{
-    HDDEDATA command;
-
-    command = DdeCreateDataHandle(instance, (LPBYTE) strCmd, strlen(strCmd)+1, 0, 0L, 0, 0);
-    ok (command != NULL, "DdeCreateDataHandle Error %s.%s\n",
-        GetDdeLastErrorStr(instance), GetStringFromTestParams(testParams));
-    *hData = DdeClientTransaction((void *) command,
-                                  -1,
-                                  hConv,
-                                  0,
-                                  0,
-                                  XTYP_EXECUTE,
-                                  MS_TIMEOUT_VAL,
-                                  NULL);
-
-    /* hData is technically a pointer, but for Program Manager,
-     * it is NULL (error) or 1 (success)
-     * TODO: Check other versions of Windows to verify 1 is returned.
-     * While it is unlikely that anyone is actually testing that the result is 1
-     * if all versions of windows return 1, Wine should also.
-     */
-    if (*hData == NULL)
-    {
-        *err = DdeGetLastError(instance);
-    }
-    else
-    {
-        *err = DMLERR_NO_ERROR;
-        todo_wine
-        {
-            ok(*hData == (HDDEDATA) 1, "Expected HDDEDATA Handle == 1, actually %p.%s\n",
-               *hData, GetStringFromTestParams(testParams));
-        }
-    }
-    DdeFreeDataHandle(command);
+    hdata = DdeClientTransaction(NULL, -1, hconv, item, CF_TEXT, XTYP_REQUEST, 2000, &result);
+    if (hdata == NULL) return NULL;
+
+    DdeGetData(hdata, (BYTE *)data, 2000, 0);
+
+    return data;
 }
 
-/*
- * Check if Window is onscreen with the appropriate name.
- *
- * Windows are not created synchronously.  So we do not know
- * when and if the window will be created/shown on screen.
- * This function implements a polling mechanism to determine
- * creation.
- * A more complicated method would be to use SetWindowsHookEx.
- * Since polling worked fine in my testing, no reason to implement
- * the other.  Comments about other methods of determining when
- * window creation happened were not encouraging (not including
- * SetWindowsHookEx).
- */
-static HWND CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams)
+static BOOL check_window_exists(const char *name)
 {
+    char title[MAX_PATH];
     HWND window = NULL;
     int i;
 
-    /* Poll for Window Creation */
-    for (i = 0; window == NULL && i < PDDE_POLL_NUM; i++)
+    if (full_title())
     {
-        Sleep(PDDE_POLL_TIME);
-        /* Specify the window class name to make sure what we find is really an
-         * Explorer window. Explorer used two different window classes so try
-         * both.
-         */
-        window = FindWindowA("ExplorerWClass", winName);
-        if (!window)
-            window = FindWindowA("CabinetWClass", winName);
+        strcpy(title, ProgramsDir);
+        strcat(title, "\\");
+        strcat(title, name);
     }
-    ok (window != NULL, "Window \"%s\" was not created in %i seconds - assumed failure.%s\n",
-        winName, PDDE_POLL_NUM*PDDE_POLL_TIME/1000, GetStringFromTestParams(testParams));
+    else
+        strcpy(title, name);
 
-    /* Close Window as desired. */
-    if (window != NULL && closeWindow)
+    for (i = 0; i < 20; i++)
     {
-        SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
-        window = NULL;
+        Sleep(100);
+        if ((window = FindWindowA("ExplorerWClass", title)) ||
+            (window = FindWindowA("CabinetWClass", title)))
+        {
+            SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
+            break;
+        }
     }
-    return window;
+
+    return (window != NULL);
 }
 
-/* Check for Existence (or non-existence) of a file or group
- *   When testing for existence of a group, groupName is not needed
- */
-static void CheckFileExistsInProgramGroups(const char *nameToCheck, BOOL shouldExist, BOOL isGroup,
-                                           const char *groupName, int testParams)
+static BOOL check_exists(const char *name)
 {
     char path[MAX_PATH];
-    DWORD attributes;
-    int len;
-
-    lstrcpyA(path, ProgramsDir);
 
-    len = strlen(path) + strlen(nameToCheck)+1;
-    if (groupName != NULL)
-    {
-        len += strlen(groupName)+1;
-    }
-    ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams));
-    if (len <= MAX_PATH)
-    {
-        if (groupName != NULL)
-        {
-            strcat(path, "\\");
-            strcat(path, groupName);
-        }
-        strcat(path, "\\");
-        strcat(path, nameToCheck);
-        attributes = GetFileAttributesA(path);
-        if (!shouldExist)
-        {
-            ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
-                path, GetStringFromTestParams(testParams));
-        } else {
-            if (attributes == INVALID_FILE_ATTRIBUTES)
-            {
-                ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams));
-            } else if (isGroup) {
-                ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n",
-                    path, attributes, GetStringFromTestParams(testParams));
-            } else {
-                ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n",
-                    path, attributes, GetStringFromTestParams(testParams));
-            }
-        }
-    }
+    strcpy(path, ProgramsDir);
+    strcat(path, "\\");
+    strcat(path, name);
+    return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
 }
 
-/* Create Group Test.
- *   command and expected_result.
- *   if expected_result is DMLERR_NO_ERROR, test
- *        1. group was created
- *        2. window is open
- */
-static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                            const char *groupName, const char *windowTitle, int testParams)
+static void test_parser(DWORD instance, HCONV hConv)
 {
-    HDDEDATA hData;
     UINT error;
 
-    /* Execute Command & Check Result */
-    DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-    todo_wine
-    {
-        ok (expected_result == error, "CreateGroup %s: Expected Error %s, received %s.%s\n",
-            groupName, GetStringFromError(expected_result), GetStringFromError(error),
-            GetStringFromTestParams(testParams));
-    }
+    /* Invalid Command */
+    error = dde_execute(instance, hConv, "[InvalidCommand()]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-    /* No Error */
-    if (error == DMLERR_NO_ERROR)
-    {
+    /* test parsing */
+    error = dde_execute(instance, hConv, "");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-        /* Check if Group Now Exists */
-        CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
-        /* Check if Window is Open (polling) */
-        CheckWindowCreated(windowTitle, TRUE, testParams);
-    }
-}
+    error = dde_execute(instance, hConv, "CreateGroup");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-/* Show Group Test.
- *   DDE command, expected_result, and the group name to check for existence
- *   if expected_result is DMLERR_NO_ERROR, test
- *        1. window is open
- */
-static HWND ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                          const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams)
-{
-    HDDEDATA hData;
-    UINT error;
-    HWND hwnd = 0;
+    error = dde_execute(instance, hConv, "[CreateGroup");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-    DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-/* todo_wine...  Is expected to fail, wine stubbed functions DO fail */
-/* TODO REMOVE THIS CODE!!! */
-    todo_wine_if (expected_result != DMLERR_NOTPROCESSED)
-        ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n",
-            groupName, GetStringFromError(expected_result), GetStringFromError(error),
-            GetStringFromTestParams(testParams));
+    error = dde_execute(instance, hConv, "[CreateGroup]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-    if (error == DMLERR_NO_ERROR)
-    {
-        /* Check if Window is Open (polling) */
-        hwnd = CheckWindowCreated(windowTitle, closeAfterShowing, testParams);
-    }
-    return hwnd;
-}
+    error = dde_execute(instance, hConv, "[CreateGroup()]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-/* Delete Group Test.
- *   DDE command, expected_result, and the group name to check for existence
- *   if expected_result is DMLERR_NO_ERROR, test
- *        1. group does not exist
- */
-static void DeleteGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                            const char *groupName, int testParams)
-{
-    HDDEDATA hData;
-    UINT error;
+    error = dde_execute(instance, hConv, "[cREATEgROUP(test)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("test"), "directory not created\n");
+    ok(check_window_exists("test"), "window not created\n");
 
-    DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-    todo_wine
-    {
-        ok (expected_result == error, "DeleteGroup %s: Expected Error %s, received %s.%s\n",
-            groupName, GetStringFromError(expected_result), GetStringFromError(error),
-            GetStringFromTestParams(testParams));
-    }
+    error = dde_execute(instance, hConv, "[AddItem(notepad,foobar)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("test/foobar.lnk"), "link not created\n");
 
-    if (error == DMLERR_NO_ERROR)
-    {
-        /* Check that Group does not exist */
-        CheckFileExistsInProgramGroups(groupName, FALSE, TRUE, NULL, testParams);
-    }
-}
+    error = dde_execute(instance, hConv, "[AddItem(notepad,foo bar)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("test/foo bar.lnk"), "link not created\n");
 
-/* Add Item Test
- *   DDE command, expected result, and group and file name where it should exist.
- *   checks to make sure error code matches expected error code
- *   checks to make sure item exists if successful
- */
-static void AddItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                        const char *fileName, const char *groupName, int testParams)
-{
-    HDDEDATA hData;
-    UINT error;
+    error = dde_execute(instance, hConv, "[AddItem(notepad,a[b,c]d)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
 
-    DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-    todo_wine
-    {
-        ok (expected_result == error, "AddItem %s: Expected Error %s, received %s.%s\n",
-            fileName, GetStringFromError(expected_result), GetStringFromError(error),
-            GetStringFromTestParams(testParams));
-    }
+    error = dde_execute(instance, hConv, "[AddItem(notepad,\"a[b,c]d\")]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("test/a[b,c]d.lnk"), "link not created\n");
 
-    if (error == DMLERR_NO_ERROR)
-    {
-        /* Check that File exists */
-        CheckFileExistsInProgramGroups(fileName, TRUE, FALSE, groupName, testParams);
-    }
-}
+    error = dde_execute(instance, hConv, "  [  AddItem  (  notepad  ,  test  )  ]  ");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("test/test.lnk"), "link not created\n");
 
-/* Delete Item Test.
- *   DDE command, expected result, and group and file name where it should exist.
- *   checks to make sure error code matches expected error code
- *   checks to make sure item does not exist if successful
- */
-static void DeleteItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                           const char *fileName, const char *groupName, int testParams)
-{
-    HDDEDATA hData;
-    UINT error;
+    error = dde_execute(instance, hConv, "[AddItem(notepad,one)][AddItem(notepad,two)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("test/one.lnk"), "link not created\n");
+    ok(check_exists("test/two.lnk"), "link not created\n");
 
-    DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-    todo_wine
-    {
-        ok (expected_result == error, "DeleteItem %s: Expected Error %s, received %s.%s\n",
-            fileName, GetStringFromError(expected_result), GetStringFromError(error),
-            GetStringFromTestParams(testParams));
-    }
+    error = dde_execute(instance, hConv, "[FakeCommand(test)][DeleteGroup(test)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+    ok(check_exists("test"), "directory should exist\n");
 
-    if (error == DMLERR_NO_ERROR)
-    {
-        /* Check that File does not exist */
-        CheckFileExistsInProgramGroups(fileName, FALSE, FALSE, groupName, testParams);
-    }
+    error = dde_execute(instance, hConv, "[DeleteGroup(test)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(!check_exists("test"), "directory should not exist\n");
+
+    error = dde_execute(instance, hConv, "[ExitProgman()]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[ExitProgman]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
 }
 
-/* Compound Command Test.
- *   not really generic, assumes command of the form:
- *          [CreateGroup ...][AddItem ...][AddItem ...]
- *   All samples I've seen using Compound were of this form (CreateGroup,
- *   AddItems) so this covers minimum expected functionality.
- */
-static HWND CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                                const char *groupName, const char *windowTitle, const char *fileName1,
-                                const char *fileName2, int testParams)
+/* 1st set of tests */
+static void test_progman_dde(DWORD instance, HCONV hConv)
 {
-    HDDEDATA hData;
     UINT error;
-    HWND hwnd = 0;
 
-    DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-    todo_wine
-    {
-        ok (expected_result == error, "Compound String %s: Expected Error %s, received %s.%s\n",
-            command, GetStringFromError(expected_result), GetStringFromError(error),
-            GetStringFromTestParams(testParams));
-    }
+    /* test creating and deleting groups and items */
+    error = dde_execute(instance, hConv, "[CreateGroup(Group1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1"), "directory not created\n");
+    ok(check_window_exists("Group1"), "window not created\n");
 
-    if (error == DMLERR_NO_ERROR)
-    {
-        /* Check that File exists */
-        CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
-        hwnd = CheckWindowCreated(windowTitle, FALSE, testParams);
-        CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams);
-        CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams);
-    }
-    return hwnd;
+    error = dde_execute(instance, hConv, "[AddItem]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[AddItem(test)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad.exe)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/notepad.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[DeleteItem(notepad.exe)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(!check_exists("Group1/notepad.lnk"), "link should not exist\n");
+
+    error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/notepad.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+
+    /* XP allows any valid path even if it does not exist; Vista+ requires that
+     * the path both exist and be a file (directories are invalid). */
+
+    error = dde_execute(instance, hConv, "[AddItem(C:\\windows\\system.ini)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/system.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad,test1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/test1.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[DeleteItem(test1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(!check_exists("Group1/test1.lnk"), "link should not exist\n");
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad,test1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/test1.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[ReplaceItem(test1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(!check_exists("Group1/test1.lnk"), "link should not exist\n");
+
+    error = dde_execute(instance, hConv, "[AddItem(regedit)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/regedit.lnk"), "link not created\n");
+
+    /* test ShowGroup() and test which group an item gets added to */
+    error = dde_execute(instance, hConv, "[ShowGroup(Group1)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_window_exists("Group1"), "window not created\n");
+
+    error = dde_execute(instance, hConv, "[CreateGroup(Group2)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group2"), "directory not created\n");
+    ok(check_window_exists("Group2"), "window not created\n");
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad,test2)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group2/test2.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_window_exists("Group1"), "window not created\n");
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad,test3)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group1/test3.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(!check_exists("Group1"), "directory should not exist\n");
+
+    error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
+    ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[ShowGroup(Group2, 0)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_window_exists("Group2"), "window not created\n");
+
+    error = dde_execute(instance, hConv, "[ExitProgman(1)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+
+    error = dde_execute(instance, hConv, "[AddItem(notepad,test4)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group2/test4.lnk"), "link not created\n");
 }
 
-static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name)
+/* 2nd set of tests - 2nd connection */
+static void test_progman_dde2(DWORD instance, HCONV hConv)
 {
-    lstrcpyA(itemtext, "[AddItem(");
-    lstrcatA(itemtext, cmdline);
-    lstrcatA(itemtext, ",");
-    lstrcatA(itemtext, name);
-    lstrcatA(itemtext, ")]");
+    UINT error;
+
+    /* last open group is retained across connections */
+    error = dde_execute(instance, hConv, "[AddItem(notepad)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(check_exists("Group2/notepad.lnk"), "link not created\n");
+
+    error = dde_execute(instance, hConv, "[DeleteGroup(Group2)]");
+    ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+    ok(!check_exists("Group2"), "directory should not exist\n");
 }
 
-/* 1st set of tests */
-static int DdeTestProgman(DWORD instance, HCONV hConv)
+static BOOL check_in_programs_list(const char *list, const char *group)
 {
-    HDDEDATA hData;
-    UINT error;
-    int testnum;
-    char temppath[MAX_PATH];
-    char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH];
-    char itemtext[MAX_PATH + 20];
-    char comptext[2 * (MAX_PATH + 20) + 21];
-    HWND hwnd;
-
-    testnum = 1;
-    /* Invalid Command */
-    DdeExecuteCommand(instance, hConv, "[InvalidCommand()]", &hData, &error, DDE_TEST_MISC|testnum++);
-    ok (error == DMLERR_NOTPROCESSED, "InvalidCommand(), expected error %s, received %s.\n",
-        GetStringFromError(DMLERR_NOTPROCESSED), GetStringFromError(error));
-
-    /* On Vista+ the files have to exist when adding a link */
-    GetTempPathA(MAX_PATH, temppath);
-    GetTempFileNameA(temppath, "dde", 0, f1g1);
-    GetTempFileNameA(temppath, "dde", 0, f2g1);
-    GetTempFileNameA(temppath, "dde", 0, f3g1);
-    GetTempFileNameA(temppath, "dde", 0, f1g3);
-    GetTempFileNameA(temppath, "dde", 0, f2g3);
-
-    /* CreateGroup Tests (including AddItem, DeleteItem) */
-    CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++);
-    CreateAddItemText(itemtext, f1g1, "f1g1Name");
-    AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f1g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
-    CreateAddItemText(itemtext, f2g1, "f2g1Name");
-    AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
-    DeleteItemTest(instance, hConv, "[DeleteItem(f2g1Name)]", DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
-    CreateAddItemText(itemtext, f3g1, "f3g1Name");
-    AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
-    CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++);
-    /* Create Group that already exists - same instance */
-    CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++);
-
-    /* ShowGroup Tests */
-    ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, "Group1", Group1Title, TRUE, DDE_TEST_SHOWGROUP|testnum++);
-    DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
-    ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, "Startup", StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++);
-    hwnd = ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++);
-
-    /* DeleteGroup Test - Note that Window is Open for this test */
-    DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++);
-    if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
-
-    /* Compound Execute String Command */
-    lstrcpyA(comptext, "[CreateGroup(Group3)]");
-    CreateAddItemText(itemtext, f1g3, "f1g3Name");
-    lstrcatA(comptext, itemtext);
-    CreateAddItemText(itemtext, f2g3, "f2g3Name");
-    lstrcatA(comptext, itemtext);
-    hwnd = CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMPOUND|testnum++);
-
-    DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++);
-    if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
-
-    /* Full Parameters of Add Item */
-    /* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */
-
-    DeleteFileA(f1g1);
-    DeleteFileA(f2g1);
-    DeleteFileA(f3g1);
-    DeleteFileA(f1g3);
-    DeleteFileA(f2g3);
-
-    return testnum;
+    while (1)
+    {
+        if (!strncmp(list, group, strlen(group)) && list[strlen(group)] == '\r')
+            return TRUE;
+        if (!(list = strchr(list, '\r'))) break;
+        list += 2;
+    }
+    return FALSE;
 }
 
-/* 2nd set of tests - 2nd connection */
-static void DdeTestProgman2(DWORD instance, HCONV hConv, int testnum)
+static void test_request_groups(DWORD instance, HCONV hconv)
 {
-    /* Create Group that already exists on a separate connection */
-    CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++);
-    DeleteGroupTest(instance, hConv, "[DeleteGroup(Group2)]", DMLERR_NO_ERROR, "Group2", DDE_TEST_DELETEGROUP|testnum++);
+    char *list;
+    char programs[MAX_PATH];
+    WIN32_FIND_DATAA finddata;
+    HANDLE hfind;
+
+    list = dde_request(instance, hconv, "Groups");
+    ok(list != NULL, "request failed: %u\n", DdeGetLastError(instance));
+    strcpy(programs, ProgramsDir);
+    strcat(programs, "/*");
+    hfind = FindFirstFileA(programs, &finddata);
+    do
+    {
+        if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && finddata.cFileName[0] != '.')
+        {
+            ok(check_in_programs_list(list, finddata.cFileName),
+               "directory '%s' missing from group list\n", finddata.cFileName);
+        }
+    } while (FindNextFileA(hfind, &finddata));
+    FindClose(hfind);
 }
 
 START_TEST(progman_dde)
@@ -699,20 +421,21 @@ START_TEST(progman_dde)
     UINT err;
     HSZ hszProgman;
     HCONV hConv;
-    int testnum;
+    BOOL ret;
 
     init_function_pointers();
     init_strings();
 
     /* Initialize DDE Instance */
     err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
-    ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
+    ok(err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err);
 
     /* Create Connection */
     hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
-    ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
+    ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
     hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
-    ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
+    ret = DdeFreeStringHandle(instance, hszProgman);
+    ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
     /* Seeing failures on early versions of Windows Connecting to progman, exit if connection fails */
     if (hConv == NULL)
     {
@@ -720,30 +443,36 @@ START_TEST(progman_dde)
         return;
     }
 
-    /* Run Tests */
-    testnum = DdeTestProgman(instance, hConv);
+    test_parser(instance, hConv);
+    test_progman_dde(instance, hConv);
+    test_request_groups(instance, hConv);
 
     /* Cleanup & Exit */
-    ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
-    ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
+    ret = DdeDisconnect(hConv);
+    ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
+    ret = DdeUninitialize(instance);
+    ok(ret, "DdeUninitialize() failed: %u\n", DdeGetLastError(instance));
 
     /* 2nd Instance (Followup Tests) */
     /* Initialize DDE Instance */
     instance = 0;
     err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
-    ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
+    ok (err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err);
 
     /* Create Connection */
     hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
-    ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
+    ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
     hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
-    ok (hConv != NULL, "DdeConnect Error %s\n", GetDdeLastErrorStr(instance));
-    ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
+    ok(hConv != NULL, "DdeConnect() failed: %u\n", DdeGetLastError(instance));
+    ret = DdeFreeStringHandle(instance, hszProgman);
+    ok(ret, "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
 
     /* Run Tests */
-    DdeTestProgman2(instance, hConv, testnum);
+    test_progman_dde2(instance, hConv);
 
     /* Cleanup & Exit */
-    ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
-    ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
+    ret = DdeDisconnect(hConv);
+    ok(ret, "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
+    ret = DdeUninitialize(instance);
+    ok(ret, "DdeUninitialize() failed: %u\n", DdeGetLastError(instance));
 }
index 7cb8f6e..50e262e 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include "shellapi.h"
+
+#include <stdio.h>
+#include "wine/test.h"
 
 static int (WINAPI *pSHQueryRecycleBinA)(LPCSTR,LPSHQUERYRBINFO);
 static int (WINAPI *pSHFileOperationA)(LPSHFILEOPSTRUCTA);
index 30b3133..cc00757 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
 
-#include <winsvc.h>
-#include <initguid.h>
+#include "shldisp.h"
+#include "shlobj.h"
+#include "shlwapi.h"
+#include "winsvc.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
+#include "initguid.h"
 
 #define EXPECT_HR(hr,hr_exp) \
     ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
 
+#define EXPECT_REF(obj,ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
+static void _expect_ref(IUnknown *obj, ULONG ref, int line)
+{
+    ULONG rc;
+    IUnknown_AddRef(obj);
+    rc = IUnknown_Release(obj);
+    ok_(__FILE__,line)(rc == ref, "Unexpected refcount %d, expected %d\n", rc, ref);
+}
+
 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
 
-static HRESULT (WINAPI *pSHGetFolderPathW)(HWND, int, HANDLE, DWORD, LPWSTR);
 static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
-static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
-static DWORD (WINAPI *pGetLongPathNameW)(LPCWSTR, LPWSTR, DWORD);
 
 /* Updated Windows 7 has a new IShellDispatch6 in its typelib */
 DEFINE_GUID(IID_IWin7ShellDispatch6, 0x34936ba1, 0x67ad, 0x4c41, 0x99,0xb8, 0x8c,0x12,0xdf,0xf1,0xe9,0x74);
 
+static BSTR a2bstr(const char *str)
+{
+    BSTR ret;
+    int len;
+
+    len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+    ret = SysAllocStringLen(NULL, len);
+    MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
+
+    return ret;
+}
+
+static void variant_set_string(VARIANT *v, const char *s)
+{
+    V_VT(v) = VT_BSTR;
+    V_BSTR(v) = a2bstr(s);
+}
+
 static void init_function_pointers(void)
 {
-    HMODULE hshell32, hkernel32;
+    HMODULE hshell32;
 
     hshell32 = GetModuleHandleA("shell32.dll");
-    hkernel32 = GetModuleHandleA("kernel32.dll");
-    pSHGetFolderPathW = (void*)GetProcAddress(hshell32, "SHGetFolderPathW");
     pSHGetNameFromIDList = (void*)GetProcAddress(hshell32, "SHGetNameFromIDList");
-    pSHGetSpecialFolderLocation = (void*)GetProcAddress(hshell32,
-     "SHGetSpecialFolderLocation");
-    pGetLongPathNameW = (void*)GetProcAddress(hkernel32, "GetLongPathNameW");
 }
 
 static void test_namespace(void)
@@ -108,18 +136,23 @@ static void test_namespace(void)
     FolderItem *item;
     VARIANT var;
     BSTR title, item_path;
+    IDispatch *disp;
     int len, i;
 
-    r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
-     &IID_IShellDispatch, (LPVOID*)&sd);
-    if (r == REGDB_E_CLASSNOTREG) /* NT4 */
-    {
-        win_skip("skipping IShellDispatch tests\n");
-        return;
-    }
-    ok(SUCCEEDED(r), "CoCreateInstance failed: %08x\n", r);
-    if (FAILED(r))
-        return;
+    r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void **)&sd);
+    ok(SUCCEEDED(r), "Failed to create ShellDispatch object: %#x.\n", r);
+
+    disp = NULL;
+    r = IShellDispatch_get_Application(sd, &disp);
+    ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r);
+    ok(disp == (IDispatch *)sd, "Unexpected application pointer %p.\n", disp);
+    IDispatch_Release(disp);
+
+    disp = NULL;
+    r = IShellDispatch_get_Parent(sd, &disp);
+    ok(r == S_OK, "Failed to get Shell object parent, hr %#x.\n", r);
+    ok(disp == (IDispatch *)sd, "Unexpected parent pointer %p.\n", disp);
+    IDispatch_Release(disp);
 
     VariantInit(&var);
     folder = (void*)0xdeadbeef;
@@ -135,6 +168,7 @@ static void test_namespace(void)
         folder = (void*)0xdeadbeef;
         r = IShellDispatch_NameSpace(sd, var, &folder);
         if (special_folders[i] == ssfALTSTARTUP || special_folders[i] == ssfCOMMONALTSTARTUP)
+        todo_wine
             ok(r == S_OK || broken(r == S_FALSE) /* winxp */, "Failed to get folder for index %#x, got %08x\n", special_folders[i], r);
         else
             ok(r == S_OK, "Failed to get folder for index %#x, got %08x\n", special_folders[i], r);
@@ -144,32 +178,23 @@ static void test_namespace(void)
 
     V_VT(&var) = VT_I4;
     V_I4(&var) = -1;
-    folder = (void*)0xdeadbeef;
+    folder = (void *)0xdeadbeef;
     r = IShellDispatch_NameSpace(sd, var, &folder);
-    todo_wine {
-    ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
-    ok(folder == NULL, "got %p\n", folder);
-    if (r == S_OK)
-        Folder_Release(folder);
-}
+    ok(r == S_FALSE, "Unexpected hr %#x.\n", r);
+    ok(folder == NULL, "Unexpected folder instance %p\n", folder);
+
     V_VT(&var) = VT_I4;
     V_I4(&var) = ssfPROGRAMFILES;
     r = IShellDispatch_NameSpace(sd, var, &folder);
-    ok(r == S_OK ||
-     broken(r == S_FALSE), /* NT4 */
-     "IShellDispatch::NameSpace failed: %08x\n", r);
+    ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r);
     if (r == S_OK)
     {
         static WCHAR path[MAX_PATH];
 
-        if (pSHGetFolderPathW)
-        {
-            r = pSHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL,
-             SHGFP_TYPE_CURRENT, path);
-            ok(r == S_OK, "SHGetFolderPath failed: %08x\n", r);
-        }
+        r = SHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, path);
+        ok(r == S_OK, "Failed to get folder path: %#x.\n", r);
+
         r = Folder_get_Title(folder, &title);
-        todo_wine
         ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
         if (r == S_OK)
         {
@@ -177,22 +202,20 @@ static void test_namespace(void)
                HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir.
                On newer Windows it seems constant and is not changed
                if the program files directory name is changed */
-            if (pSHGetSpecialFolderLocation && pSHGetNameFromIDList)
+            if (pSHGetNameFromIDList)
             {
                 LPITEMIDLIST pidl;
                 PWSTR name;
 
-                r = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl);
+                r = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl);
                 ok(r == S_OK, "SHGetSpecialFolderLocation failed: %08x\n", r);
                 r = pSHGetNameFromIDList(pidl, SIGDN_NORMALDISPLAY, &name);
                 ok(r == S_OK, "SHGetNameFromIDList failed: %08x\n", r);
-                todo_wine
-                ok(!lstrcmpW(title, name), "expected %s, got %s\n",
-                 wine_dbgstr_w(name), wine_dbgstr_w(title));
+                ok(!lstrcmpW(title, name), "expected %s, got %s\n", wine_dbgstr_w(name), wine_dbgstr_w(title));
                 CoTaskMemFree(name);
                 CoTaskMemFree(pidl);
             }
-            else if (pSHGetFolderPathW)
+            else
             {
                 WCHAR *p;
 
@@ -202,7 +225,6 @@ static void test_namespace(void)
                 ok(!lstrcmpiW(title, p), "expected %s, got %s\n",
                  wine_dbgstr_w(p), wine_dbgstr_w(title));
             }
-            else skip("skipping Folder::get_Title test\n");
             SysFreeString(title);
         }
         r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2);
@@ -215,9 +237,7 @@ static void test_namespace(void)
             {
                 r = FolderItem_get_Path(item, &item_path);
                 ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
-                if (pSHGetFolderPathW)
-                    ok(!lstrcmpiW(item_path, path), "expected %s, got %s\n",
-                     wine_dbgstr_w(path), wine_dbgstr_w(item_path));
+                ok(!lstrcmpiW(item_path, path), "expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(item_path));
                 SysFreeString(item_path);
                 FolderItem_Release(item);
             }
@@ -229,34 +249,21 @@ static void test_namespace(void)
     V_VT(&var) = VT_I4;
     V_I4(&var) = ssfBITBUCKET;
     r = IShellDispatch_NameSpace(sd, var, &folder);
-    ok(r == S_OK ||
-     broken(r == S_FALSE), /* NT4 */
-     "IShellDispatch::NameSpace failed: %08x\n", r);
-    if (r == S_OK)
-    {
-        r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2);
-        ok(r == S_OK ||
-         broken(r == E_NOINTERFACE), /* NT4 */
-         "Folder::QueryInterface failed: %08x\n", r);
-        if (r == S_OK)
-        {
-            r = Folder2_get_Self(folder2, &item);
-            ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
-            if (r == S_OK)
-            {
-                r = FolderItem_get_Path(item, &item_path);
-                todo_wine
-                ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
-                todo_wine
-                ok(!lstrcmpW(item_path, clsidW), "expected %s, got %s\n",
-                 wine_dbgstr_w(clsidW), wine_dbgstr_w(item_path));
-                SysFreeString(item_path);
-                FolderItem_Release(item);
-            }
-            Folder2_Release(folder2);
-        }
-        Folder_Release(folder);
-    }
+    ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r);
+
+    r = Folder_QueryInterface(folder, &IID_Folder2, (void **)&folder2);
+    ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r);
+    r = Folder2_get_Self(folder2, &item);
+    ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
+    r = FolderItem_get_Path(item, &item_path);
+    ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
+    /* TODO: we return lowercase GUID here */
+    ok(!lstrcmpiW(item_path, clsidW), "expected %s, got %s\n", wine_dbgstr_w(clsidW), wine_dbgstr_w(item_path));
+
+    SysFreeString(item_path);
+    FolderItem_Release(item);
+    Folder2_Release(folder2);
+    Folder_Release(folder);
 
     GetTempPathW(MAX_PATH, tempW);
     GetCurrentDirectoryW(MAX_PATH, curW);
@@ -269,51 +276,39 @@ static void test_namespace(void)
     SysFreeString(V_BSTR(&var));
 
     GetFullPathNameW(winetestW, MAX_PATH, tempW, NULL);
-    if (pGetLongPathNameW)
-    {
-        len = pGetLongPathNameW(tempW, NULL, 0);
-        long_pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-        if (long_pathW)
-            pGetLongPathNameW(tempW, long_pathW, len);
-    }
+
+    len = GetLongPathNameW(tempW, NULL, 0);
+    long_pathW = heap_alloc(len * sizeof(WCHAR));
+    GetLongPathNameW(tempW, long_pathW, len);
+
     V_VT(&var) = VT_BSTR;
     V_BSTR(&var) = SysAllocString(tempW);
     r = IShellDispatch_NameSpace(sd, var, &folder);
     ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r);
-    if (r == S_OK)
-    {
-        r = Folder_get_Title(folder, &title);
-        ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
-        if (r == S_OK)
-        {
-            ok(!lstrcmpW(title, winetestW), "bad title: %s\n",
-             wine_dbgstr_w(title));
-            SysFreeString(title);
-        }
-        r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2);
-        ok(r == S_OK ||
-         broken(r == E_NOINTERFACE), /* NT4 */
-         "Folder::QueryInterface failed: %08x\n", r);
-        if (r == S_OK)
-        {
-            r = Folder2_get_Self(folder2, &item);
-            ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
-            if (r == S_OK)
-            {
-                r = FolderItem_get_Path(item, &item_path);
-                ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
-                if (long_pathW)
-                    ok(!lstrcmpW(item_path, long_pathW),
-                     "expected %s, got %s\n", wine_dbgstr_w(long_pathW),
-                     wine_dbgstr_w(item_path));
-                SysFreeString(item_path);
-                FolderItem_Release(item);
-            }
-            Folder2_Release(folder2);
-        }
-        Folder_Release(folder);
-    }
-    SysFreeString(V_BSTR(&var));
+
+    disp = (void *)0xdeadbeef;
+    r = Folder_get_Parent(folder, &disp);
+    ok(r == E_NOTIMPL, "Unexpected hr %#x.\n", r);
+    ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
+
+    r = Folder_get_Title(folder, &title);
+    ok(r == S_OK, "Failed to get folder title: %#x.\n", r);
+    ok(!lstrcmpW(title, winetestW), "Unexpected title: %s\n",  wine_dbgstr_w(title));
+    SysFreeString(title);
+
+    r = Folder_QueryInterface(folder, &IID_Folder2, (void **)&folder2);
+    ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r);
+    r = Folder2_get_Self(folder2, &item);
+    ok(r == S_OK, "Folder::get_Self failed: %08x\n", r);
+    r = FolderItem_get_Path(item, &item_path);
+    ok(r == S_OK, "Failed to get item path: %#x.\n", r);
+    ok(!lstrcmpW(item_path, long_pathW), "Unexpected path %s, got %s\n", wine_dbgstr_w(item_path), wine_dbgstr_w(long_pathW));
+    SysFreeString(item_path);
+    FolderItem_Release(item);
+    Folder2_Release(folder2);
+
+    Folder_Release(folder);
+    VariantClear(&var);
 
     len = lstrlenW(tempW);
     if (len < MAX_PATH - 1)
@@ -334,9 +329,7 @@ static void test_namespace(void)
                 SysFreeString(title);
             }
             r = Folder_QueryInterface(folder, &IID_Folder2, (LPVOID*)&folder2);
-            ok(r == S_OK ||
-             broken(r == E_NOINTERFACE), /* NT4 */
-             "Folder::QueryInterface failed: %08x\n", r);
+            ok(r == S_OK, "Failed to get Folder2 interface: %#x.\n", r);
             if (r == S_OK)
             {
                 r = Folder2_get_Self(folder2, &item);
@@ -345,10 +338,8 @@ static void test_namespace(void)
                 {
                     r = FolderItem_get_Path(item, &item_path);
                     ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
-                    if (long_pathW)
-                        ok(!lstrcmpW(item_path, long_pathW),
-                         "expected %s, got %s\n", wine_dbgstr_w(long_pathW),
-                         wine_dbgstr_w(item_path));
+                    ok(!lstrcmpW(item_path, long_pathW), "Unexpected path %s, got %s\n", wine_dbgstr_w(item_path),
+                        wine_dbgstr_w(long_pathW));
                     SysFreeString(item_path);
                     FolderItem_Release(item);
                 }
@@ -359,7 +350,7 @@ static void test_namespace(void)
         SysFreeString(V_BSTR(&var));
     }
 
-    HeapFree(GetProcessHeap(), 0, long_pathW);
+    heap_free(long_pathW);
     RemoveDirectoryW(winetestW);
     SetCurrentDirectoryW(curW);
     IShellDispatch_Release(sd);
@@ -367,55 +358,110 @@ static void test_namespace(void)
 
 static void test_items(void)
 {
-    WCHAR wstr[MAX_PATH], orig_dir[MAX_PATH];
+    static const struct
+    {
+        char name[32];
+        enum
+        {
+            DIRECTORY,
+            EMPTY_FILE,
+        }
+        type;
+    }
+    file_defs[] =
+    {
+        { "00-Myfolder",        DIRECTORY  },
+        { "01-empty.bin",       EMPTY_FILE },
+    };
+    WCHAR path[MAX_PATH], cur_dir[MAX_PATH], orig_dir[MAX_PATH];
     HRESULT r;
     IShellDispatch *sd = NULL;
     Folder *folder = NULL;
-    FolderItems *items = NULL;
+    FolderItems *items;
     FolderItems2 *items2 = NULL;
     FolderItems3 *items3 = NULL;
-    FolderItem *item = (FolderItem*)0xdeadbeef;
-    IDispatch *disp = NULL;
-    IUnknown *unk = NULL;
+    FolderItem *item = (FolderItem*)0xdeadbeef, *item2;
     FolderItemVerbs *verbs = (FolderItemVerbs*)0xdeadbeef;
-    VARIANT var;
-    LONG lcount = -1;
+    VARIANT var, int_index, str_index, str_index2;
+    IDispatch *disp, *disp2;
+    LONG count = -1;
+    IUnknown *unk;
+    HANDLE file;
+    BSTR bstr;
+    char cstr[64];
+    BOOL ret;
+    int i;
 
     r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void**)&sd);
     ok(SUCCEEDED(r), "CoCreateInstance failed: %08x\n", r);
     ok(!!sd, "sd is null\n");
 
-    GetTempPathW(MAX_PATH, wstr);
+    /* create and enter a temporary directory and a folder object for it */
+    GetTempPathW(MAX_PATH, path);
     GetCurrentDirectoryW(MAX_PATH, orig_dir);
-    SetCurrentDirectoryW(wstr);
-    CreateDirectoryW(winetestW, NULL);
-    GetFullPathNameW(winetestW, MAX_PATH, wstr, NULL);
+    SetCurrentDirectoryW(path);
+    ret = CreateDirectoryW(winetestW, NULL);
+    ok(ret, "CreateDirectory failed: %08x\n", GetLastError());
+    GetFullPathNameW(winetestW, MAX_PATH, path, NULL);
     V_VT(&var) = VT_BSTR;
-    V_BSTR(&var) = SysAllocString(wstr);
+    V_BSTR(&var) = SysAllocString(path);
+
+    EXPECT_REF(sd, 1);
     r = IShellDispatch_NameSpace(sd, var, &folder);
     ok(r == S_OK, "IShellDispatch::NameSpace failed: %08x\n", r);
     ok(!!folder, "folder is null\n");
-    SysFreeString(V_BSTR(&var));
-    IShellDispatch_Release(sd);
+    EXPECT_REF(folder, 1);
+    EXPECT_REF(sd, 1);
+
+    VariantClear(&var);
     SetCurrentDirectoryW(winetestW);
+    GetCurrentDirectoryW(MAX_PATH, path);
+    GetLongPathNameW(path, cur_dir, MAX_PATH);
 
+    /* FolderItems grabs its Folder reference */
+    items = NULL;
     r = Folder_Items(folder, &items);
     ok(r == S_OK, "Folder::Items failed: %08x\n", r);
     ok(!!items, "items is null\n");
-    r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2);
-    ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r);
-    ok(!!items2 || broken(!items2) /* xp and later */, "items2 is null\n");
-    r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3);
-    ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r);
-    ok(!!items3, "items3 is null\n");
-    Folder_Release(folder);
+    EXPECT_REF(folder, 2);
+    EXPECT_REF(items, 1);
+
+    unk = NULL;
+    r = Folder_Items(folder, (FolderItems **)&unk);
+    ok(r == S_OK, "Folder::Items failed: %08x\n", r);
+    EXPECT_REF(folder, 3);
+    IUnknown_Release(unk);
+    EXPECT_REF(folder, 2);
+
+    FolderItems_AddRef(items);
+    EXPECT_REF(folder, 2);
+    FolderItems_Release(items);
+
+    /* Application property */
+    disp = NULL;
+    EXPECT_REF(sd, 1);
+    r = Folder_get_Application(folder, &disp);
+    ok(r == S_OK, "Failed to get application %#x.\n", r);
+    ok(disp != (IDispatch *)sd, "Unexpected application pointer\n");
+    EXPECT_REF(sd, 1);
+
+    disp2 = NULL;
+    r = Folder_get_Application(folder, &disp2);
+    ok(r == S_OK, "Failed to get application %#x.\n", r);
+    ok(disp2 == disp, "Unexpected application pointer\n");
+    IDispatch_Release(disp2);
+
+    r = IDispatch_QueryInterface(disp, &IID_IShellDispatch, (void **)&disp2);
+    ok(r == S_OK, "Wrong instance, hr %#x.\n", r);
+    IDispatch_Release(disp2);
+    IDispatch_Release(disp);
 
     if (0) /* crashes on all versions of Windows */
         r = FolderItems_get_Count(items, NULL);
 
-    r = FolderItems_get_Count(items, &lcount);
+    r = FolderItems_get_Count(items, &count);
     ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
-    ok(!lcount, "expected 0 files, got %d\n", lcount);
+    ok(!count, "expected 0 files, got %d\n", count);
 
     V_VT(&var) = VT_I4;
     V_I4(&var) = 0;
@@ -424,7 +470,269 @@ static void test_items(void)
         r = FolderItems_Item(items, var, NULL);
 
     r = FolderItems_Item(items, var, &item);
-todo_wine
+    ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
+    ok(!item, "item is not null\n");
+
+    /* create test files */
+    for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++)
+    {
+        switch (file_defs[i].type)
+        {
+            case DIRECTORY:
+                r = CreateDirectoryA(file_defs[i].name, NULL);
+                ok(r, "CreateDirectory failed: %08x\n", GetLastError());
+                PathCombineA(cstr, file_defs[i].name, "foo.txt");
+                file = CreateFileA(cstr, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+                ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %08x\n", GetLastError());
+                CloseHandle(file);
+                break;
+
+            case EMPTY_FILE:
+                file = CreateFileA(file_defs[i].name, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+                ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %08x\n", GetLastError());
+                CloseHandle(file);
+                break;
+        }
+    }
+
+    /* test that get_Count is not aware of the newly created files */
+    count = -1;
+    r = FolderItems_get_Count(items, &count);
+    ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
+    ok(!count, "expected 0 files, got %d\n", count);
+
+    /* test that the newly created files CAN be retrieved by string index */
+    variant_set_string(&var, file_defs[0].name);
+    item = NULL;
+    r = FolderItems_Item(items, var, &item);
+    ok(r == S_OK, "FolderItems::Item failed: %08x\n", r);
+    ok(!!item, "item is null\n");
+
+    disp = (void *)0xdeadbeef;
+    r = FolderItems_get_Parent(items, &disp);
+    ok(r == E_NOTIMPL, "Unexpected hr %#x.\n", r);
+    ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
+
+    r = FolderItem_get_Parent(item, &disp);
+    ok(r == S_OK, "Failed to get parent pointer, hr %#x.\n", r);
+    ok(disp == (IDispatch *)folder, "Unexpected parent pointer %p.\n", disp);
+    IDispatch_Release(disp);
+
+    if (item) FolderItem_Release(item);
+    VariantClear(&var);
+
+    /* recreate the items object */
+    FolderItems_Release(items);
+    items = NULL;
+    r = Folder_Items(folder, &items);
+    ok(r == S_OK, "Folder::Items failed: %08x\n", r);
+    ok(!!items, "items is null\n");
+    r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2);
+    ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r);
+    if (r == S_OK)
+    {
+        ok(!!items2, "items2 is null\n");
+        FolderItems2_Release(items2);
+    }
+    r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3);
+    ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r);
+    ok(!!items3, "items3 is null\n");
+
+    count = -1;
+    r = FolderItems_get_Count(items, &count);
+    ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
+    ok(count == sizeof(file_defs)/sizeof(file_defs[0]),
+       "expected %d files, got %d\n", (LONG)(sizeof(file_defs)/sizeof(file_defs[0])), count);
+
+    V_VT(&var) = VT_EMPTY;
+    item = (FolderItem*)0xdeadbeef;
+    r = FolderItems_Item(items, var, &item);
+    ok(r == E_NOTIMPL, "expected E_NOTIMPL, got %08x\n", r);
+    ok(!item, "item is not null\n");
+
+    V_VT(&var) = VT_I2;
+    V_I2(&var) = 0;
+
+    EXPECT_REF(folder, 2);
+    EXPECT_REF(items, 2);
+    item = NULL;
+    r = FolderItems_Item(items, var, &item);
+    ok(r == S_OK, "FolderItems::Item failed: %08x\n", r);
+    ok(!!item, "item is null\n");
+    EXPECT_REF(folder, 3);
+    EXPECT_REF(items, 2);
+
+    r = Folder_get_Application(folder, &disp);
+    ok(r == S_OK, "Failed to get application pointer %#x.\n", r);
+    r = FolderItem_get_Application(item, &disp2);
+    ok(r == S_OK, "Failed to get application pointer %#x.\n", r);
+    ok(disp == disp2, "Unexpected application pointer.\n");
+    IDispatch_Release(disp2);
+    IDispatch_Release(disp);
+
+    FolderItem_Release(item);
+
+    V_VT(&var) = VT_I4;
+    V_I4(&var) = 0;
+    item = NULL;
+    r = FolderItems_Item(items, var, &item);
+    ok(r == S_OK, "FolderItems::Item failed: %08x\n", r);
+    ok(!!item, "item is null\n");
+    if (item) FolderItem_Release(item);
+
+    V_I4(&var) = -1;
+    item = (FolderItem*)0xdeadbeef;
+    r = FolderItems_Item(items, var, &item);
+    ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
+    ok(!item, "item is not null\n");
+
+    V_VT(&var) = VT_ERROR;
+    V_ERROR(&var) = 0;
+    item = NULL;
+    r = FolderItems_Item(items, var, &item);
+    ok(r == S_OK, "expected S_OK, got %08x\n", r);
+    ok(!!item, "item is null\n");
+    if (item)
+    {
+        bstr = NULL;
+        r = FolderItem_get_Path(item, &bstr);
+        ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
+        ok(!lstrcmpW(bstr, cur_dir),
+           "expected %s, got %s\n", wine_dbgstr_w(cur_dir), wine_dbgstr_w(bstr));
+        SysFreeString(bstr);
+        FolderItem_Release(item);
+    }
+
+    V_VT(&int_index) = VT_I4;
+
+    /* test the folder item corresponding to each file */
+    for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++)
+    {
+        VARIANT_BOOL b;
+        BSTR name;
+
+        V_I4(&int_index) = i;
+        variant_set_string(&str_index, file_defs[i].name);
+
+        item = NULL;
+        r = FolderItems_Item(items, int_index, &item);
+        ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
+        ok(!!item, "file_defs[%d]: item is null\n", i);
+
+        item2 = NULL;
+        r = FolderItems_Item(items, int_index, &item2);
+        ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
+        ok(item2 != item, "file_defs[%d]: item and item2 are the same\n", i);
+        FolderItem_Release(item2);
+
+        bstr = NULL;
+        r = FolderItem_get_Path(item, &bstr);
+        ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r);
+        PathCombineW(path, cur_dir, V_BSTR(&str_index));
+        ok(!lstrcmpW(bstr, path),
+           "file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr));
+        SysFreeString(bstr);
+
+        bstr = a2bstr(file_defs[i].name);
+        r = FolderItem_get_Name(item, &name);
+        ok(r == S_OK, "Failed to get item name, hr %#x.\n", r);
+        /* Returned display name does not have to strictly match file name, e.g. extension could be omitted. */
+        ok(lstrlenW(name) <= lstrlenW(bstr), "file_defs[%d]: unexpected name length.\n", i);
+        ok(!memcmp(bstr, name, lstrlenW(name) * sizeof(WCHAR)), "file_defs[%d]: unexpected name %s.\n", i, wine_dbgstr_w(name));
+        SysFreeString(name);
+        SysFreeString(bstr);
+
+        FolderItem_Release(item);
+
+        item = NULL;
+        r = FolderItems_Item(items, str_index, &item);
+        ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
+        ok(!!item, "file_defs[%d]: item is null\n", i);
+
+        bstr = NULL;
+        r = FolderItem_get_Path(item, &bstr);
+        ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r);
+        PathCombineW(path, cur_dir, V_BSTR(&str_index));
+        ok(!lstrcmpW(bstr, path),
+           "file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr));
+        SysFreeString(bstr);
+
+        b = 0xdead;
+        r = FolderItem_get_IsFolder(item, &b);
+        ok(r == S_OK, "Failed to get IsFolder property, %#x.\n", r);
+        ok(file_defs[i].type == DIRECTORY ? b == VARIANT_TRUE : b == VARIANT_FALSE, "Unexpected prop value %#x.\n", b);
+
+        FolderItem_Release(item);
+
+        if (file_defs[i].type == DIRECTORY)
+        {
+            /* test that getting an item object for a file in a subdirectory succeeds */
+            PathCombineA(cstr, file_defs[i].name, "foo.txt");
+            variant_set_string(&str_index2, cstr);
+            item2 = NULL;
+            r = FolderItems_Item(items, str_index2, &item2);
+            ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
+            ok(!!item2, "file_defs[%d]: item is null\n", i);
+            if (item2) FolderItem_Release(item2);
+            VariantClear(&str_index2);
+
+            /* delete the file in the subdirectory */
+            ret = DeleteFileA(cstr);
+            ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
+
+            /* test that getting an item object via a relative path fails */
+            strcpy(cstr, file_defs[i].name);
+            strcat(cstr, "\\..\\");
+            strcat(cstr, file_defs[i].name);
+            variant_set_string(&str_index2, cstr);
+            item2 = (FolderItem*)0xdeadbeef;
+            r = FolderItems_Item(items, str_index2, &item2);
+       todo_wine {
+            ok(r == S_FALSE, "file_defs[%d]: expected S_FALSE, got %08x\n", i, r);
+            ok(!item2, "file_defs[%d]: item is not null\n", i);
+       }
+            if (item2) FolderItem_Release(item2);
+            VariantClear(&str_index2);
+
+            /* remove the directory */
+            ret = RemoveDirectoryA(file_defs[i].name);
+            ok(ret, "file_defs[%d]: RemoveDirectory failed: %08x\n", i, GetLastError());
+        }
+        else
+        {
+            ret = DeleteFileA(file_defs[i].name);
+            ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
+        }
+
+        /* test that the folder item is still accessible by integer index */
+        item = NULL;
+        r = FolderItems_Item(items, int_index, &item);
+        ok(r == S_OK, "file_defs[%d]: FolderItems::Item failed: %08x\n", i, r);
+        ok(!!item, "file_defs[%d]: item is null\n", i);
+
+        bstr = NULL;
+        r = FolderItem_get_Path(item, &bstr);
+        ok(r == S_OK, "file_defs[%d]: FolderItem::get_Path failed: %08x\n", i, r);
+        PathCombineW(path, cur_dir, V_BSTR(&str_index));
+        ok(!lstrcmpW(bstr, path),
+           "file_defs[%d]: expected %s, got %s\n", i, wine_dbgstr_w(path), wine_dbgstr_w(bstr));
+        SysFreeString(bstr);
+
+        FolderItem_Release(item);
+
+        /* test that the folder item is no longer accessible by string index */
+        item = (FolderItem*)0xdeadbeef;
+        r = FolderItems_Item(items, str_index, &item);
+        ok(r == S_FALSE, "file_defs[%d]: expected S_FALSE, got %08x\n", i, r);
+        ok(!item, "file_defs[%d]: item is not null\n", i);
+
+        VariantClear(&str_index);
+    }
+
+    /* test that there are only as many folder items as there were files */
+    V_I4(&int_index) = sizeof(file_defs)/sizeof(file_defs[0]);
+    item = (FolderItem*)0xdeadbeef;
+    r = FolderItems_Item(items, int_index, &item);
     ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
     ok(!item, "item is not null\n");
 
@@ -435,11 +743,13 @@ todo_wine
     }
 
     r = FolderItems_get_Application(items, &disp);
-todo_wine
     ok(r == S_OK, "FolderItems::get_Application failed: %08x\n", r);
-todo_wine
-    ok(!!disp, "disp is null\n");
-    if (disp) IDispatch_Release(disp);
+
+    r = Folder_get_Application(folder, &disp2);
+    ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r);
+    ok(disp == disp2, "Unexpected application pointer.\n");
+    IDispatch_Release(disp2);
+    IDispatch_Release(disp);
 
     if (0) /* crashes on xp */
     {
@@ -483,14 +793,37 @@ todo_wine
         ok(!verbs, "verbs is not null\n");
     }
 
-    GetTempPathW(MAX_PATH, wstr);
-    SetCurrentDirectoryW(wstr);
-    RemoveDirectoryW(winetestW);
+    /* remove the temporary directory and restore the original working directory */
+    GetTempPathW(MAX_PATH, path);
+    SetCurrentDirectoryW(path);
+    ret = RemoveDirectoryW(winetestW);
+    ok(ret, "RemoveDirectory failed: %08x\n", GetLastError());
     SetCurrentDirectoryW(orig_dir);
 
+    /* test that everything stops working after the directory has been removed */
+    count = -1;
+    r = FolderItems_get_Count(items, &count);
+    ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
+    ok(!count, "expected 0 files, got %d\n", count);
+
+    item = NULL;
+    V_I4(&int_index) = 0;
+    item = (FolderItem*)0xdeadbeef;
+    r = FolderItems_Item(items, int_index, &item);
+    ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
+    ok(!item, "item is not null\n");
+
+    variant_set_string(&str_index, file_defs[0].name);
+    item = (FolderItem*)0xdeadbeef;
+    r = FolderItems_Item(items, str_index, &item);
+    ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r);
+    ok(!item, "item is not null\n");
+    VariantClear(&str_index);
+
     FolderItems_Release(items);
-    if (items2) FolderItems2_Release(items2);
+    Folder_Release(folder);
     if (items3) FolderItems3_Release(items3);
+    IShellDispatch_Release(sd);
 }
 
 static void test_service(void)
@@ -739,7 +1072,7 @@ todo_wine {
     ok(hr == S_OK || broken(hr == S_FALSE), "got 0x%08x\n", hr);
     if (hr == S_FALSE) /* winxp and earlier */ {
         win_skip("SWC_DESKTOP is not supported, some tests will be skipped.\n");
-        /* older versions allowed to regiser SWC_DESKTOP and access it with FindWindowSW */
+        /* older versions allowed to register SWC_DESKTOP and access it with FindWindowSW */
         ok(disp == NULL, "got %p\n", disp);
         ok(ret == 0, "got %d\n", ret);
     }
@@ -763,6 +1096,9 @@ todo_wine {
         IUnknown *unk;
 
         ok(disp != NULL, "got %p\n", disp);
+
+        if (disp == NULL) goto skip_disp_tests;
+
         ok(ret != HandleToUlong(hwnd), "got %d\n", ret);
 
         /* IDispatch-related tests */
@@ -840,6 +1176,7 @@ if (hr == S_OK) {
         IServiceProvider_Release(sp);
         IDispatch_Release(disp);
     }
+skip_disp_tests:
 
     disp = (void*)0xdeadbeef;
     ret = 0xdead;
@@ -934,12 +1271,13 @@ static void test_ParseName(void)
 
 static void test_Verbs(void)
 {
-    FolderItemVerbs *verbs;
+    FolderItemVerbs *verbs, *verbs2;
     WCHAR pathW[MAX_PATH];
     FolderItemVerb *verb;
     IShellDispatch *sd;
     FolderItem *item;
     Folder2 *folder2;
+    IDispatch *disp;
     Folder *folder;
     HRESULT hr;
     LONG count, i;
@@ -972,6 +1310,21 @@ if (0) { /* crashes on some systems */
     hr = FolderItem_Verbs(item, &verbs);
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
+    hr = FolderItem_Verbs(item, &verbs2);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(verbs2 != verbs, "Unexpected verbs pointer.\n");
+    FolderItemVerbs_Release(verbs2);
+
+    disp = (void *)0xdeadbeef;
+    hr = FolderItemVerbs_get_Application(verbs, &disp);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(disp == NULL, "Unexpected application pointer.\n");
+
+    disp = (void *)0xdeadbeef;
+    hr = FolderItemVerbs_get_Parent(verbs, &disp);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
+
 if (0) { /* crashes on winxp/win2k3 */
     hr = FolderItemVerbs_get_Count(verbs, NULL);
     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
@@ -998,7 +1351,17 @@ if (0) { /* crashes on winxp/win2k3 */
         ok(hr == S_OK, "got 0x%08x\n", hr);
         ok(str != NULL, "%d: name %s\n", i, wine_dbgstr_w(str));
         if (i == count)
-            ok(str[0] == 0, "%d: got teminating item %s\n", i, wine_dbgstr_w(str));
+            ok(str[0] == 0, "%d: got terminating item %s\n", i, wine_dbgstr_w(str));
+
+        disp = (void *)0xdeadbeef;
+        hr = FolderItemVerb_get_Parent(verb, &disp);
+        ok(hr == E_NOTIMPL, "got %#x.\n", hr);
+        ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
+
+        disp = (void *)0xdeadbeef;
+        hr = FolderItemVerb_get_Application(verb, &disp);
+        ok(hr == E_NOTIMPL, "got %#x.\n", hr);
+        ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
 
         SysFreeString(str);
         FolderItemVerb_Release(verb);
@@ -1054,6 +1417,7 @@ static void test_ShellExecute(void)
     ok(hr == S_OK, "ShellExecute failed: %08x\n", hr);
 
     SysFreeString(name);
+    IShellDispatch2_Release(sd);
 }
 
 START_TEST(shelldispatch)
index 5e995db..444fdcc 100755 (executable)
  *
  */
 
-#include "precomp.h"
+#define COBJMACROS
+
+#include "initguid.h"
+#include "windows.h"
+#include "shlguid.h"
+#include "shobjidl.h"
+#include "shlobj.h"
+#include "shellapi.h"
+#include "commoncontrols.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
+#include "shell32_test.h"
+
+#ifdef __REACTOS__
+#include <reactos/undocshell.h>
+#endif
 
 #ifndef SLDF_HAS_LOGO3ID
 #  define SLDF_HAS_LOGO3ID 0x00000800 /* not available in the Vista SDK */
@@ -28,6 +45,7 @@
 static void (WINAPI *pILFree)(LPITEMIDLIST);
 static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
 static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
+static HRESULT (WINAPI *pSHGetFolderLocation)(HWND,INT,HANDLE,DWORD,PIDLIST_ABSOLUTE*);
 static HRESULT (WINAPI *pSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT);
 static HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID, UINT, SHSTOCKICONINFO *);
 static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
@@ -71,12 +89,12 @@ static LPITEMIDLIST path_to_pidl(const char* path)
         int len;
 
         len=MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
-        pathW=HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+        pathW = heap_alloc(len * sizeof(WCHAR));
         MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len);
 
         r=pSHILCreateFromPath(pathW, &pidl, NULL);
         ok(r == S_OK, "SHILCreateFromPath failed (0x%08x)\n", r);
-        HeapFree(GetProcessHeap(), 0, pathW);
+        heap_free(pathW);
     }
     return pidl;
 }
@@ -93,6 +111,7 @@ static void test_get_set(void)
     IShellLinkW *slW = NULL;
     char mypath[MAX_PATH];
     char buffer[INFOTIPSIZE];
+    WIN32_FIND_DATAA finddata;
     LPITEMIDLIST pidl, tmp_pidl;
     const char * str;
     int i;
@@ -145,11 +164,20 @@ static void test_get_set(void)
     /* Test Getting / Setting the path */
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
-    todo_wine ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
+    ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
+    ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
+
+    strcpy(buffer,"garbage");
+    memset(&finddata, 0xaa, sizeof(finddata));
+    r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
+    ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
     ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
+    ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
+    ok(finddata.cFileName[0] == 0, "unexpected filename '%s'\n", finddata.cFileName);
 
-    CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
-                     &IID_IShellLinkW, (LPVOID*)&slW);
+    r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+                         &IID_IShellLinkW, (LPVOID*)&slW);
+    ok(r == S_OK, "CoCreateInstance failed (0x%08x)\n", r);
     if (!slW /* Win9x */ || !pGetLongPathNameA /* NT4 */)
         skip("SetPath with NULL parameter crashes on Win9x and some NT4\n");
     else
@@ -166,7 +194,7 @@ static void test_get_set(void)
 
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
-    todo_wine ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
+    ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
     ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
 
     /* Win98 returns S_FALSE, but WinXP returns S_OK */
@@ -179,6 +207,14 @@ static void test_get_set(void)
     ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
     ok(lstrcmpiA(buffer,str)==0, "GetPath returned '%s'\n", buffer);
 
+    strcpy(buffer,"garbage");
+    memset(&finddata, 0xaa, sizeof(finddata));
+    r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
+    ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
+    ok(lstrcmpiA(buffer,str)==0, "GetPath returned '%s'\n", buffer);
+    ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
+    ok(lstrcmpiA(finddata.cFileName, "file") == 0, "unexpected filename '%s'\n", finddata.cFileName);
+
     /* Get some real path to play with */
     GetWindowsDirectoryA( mypath, sizeof(mypath)-12 );
     strcat(mypath, "\\regedit.exe");
@@ -228,8 +264,41 @@ static void test_get_set(void)
         strcpy(buffer,"garbage");
         r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
         ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
-        todo_wine
         ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
+
+        strcpy(buffer,"garbage");
+        memset(&finddata, 0xaa, sizeof(finddata));
+        r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
+        ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
+        ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
+        ok(finddata.dwFileAttributes != 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
+        ok(lstrcmpiA(finddata.cFileName, "regedit.exe") == 0, "unexpected filename '%s'\n", finddata.cFileName);
+    }
+
+    if (pSHGetFolderLocation)
+    {
+        LPITEMIDLIST pidl_controls;
+
+        r = pSHGetFolderLocation(NULL, CSIDL_CONTROLS, NULL, 0, &pidl_controls);
+        ok(r == S_OK, "SHGetFolderLocation failed (0x%08x)\n", r);
+
+        r = IShellLinkA_SetIDList(sl, pidl_controls);
+        ok(r == S_OK, "SetIDList failed (0x%08x)\n", r);
+
+        strcpy(buffer,"garbage");
+        r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
+        ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
+        ok(buffer[0] == 0, "GetPath returned '%s'\n", buffer);
+
+        strcpy(buffer,"garbage");
+        memset(&finddata, 0xaa, sizeof(finddata));
+        r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), &finddata, SLGP_RAWPATH);
+        ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
+        ok(buffer[0] == 0, "GetPath returned '%s'\n", buffer);
+        ok(finddata.dwFileAttributes == 0, "unexpected attributes %x\n", finddata.dwFileAttributes);
+        ok(finddata.cFileName[0] == 0, "unexpected filename '%s'\n", finddata.cFileName);
+
+        pILFree(pidl_controls);
     }
 
     /* test path with quotes (IShellLinkA_SetPath returns S_FALSE on W2K and below and S_OK on XP and above */
@@ -1396,6 +1465,7 @@ START_TEST(shelllink)
     pILFree = (void *)GetProcAddress(hmod, (LPSTR)155);
     pILIsEqual = (void *)GetProcAddress(hmod, (LPSTR)21);
     pSHILCreateFromPath = (void *)GetProcAddress(hmod, (LPSTR)28);
+    pSHGetFolderLocation = (void *)GetProcAddress(hmod, "SHGetFolderLocation");
     pSHDefExtractIconA = (void *)GetProcAddress(hmod, "SHDefExtractIconA");
     pSHGetStockIconInfo = (void *)GetProcAddress(hmod, "SHGetStockIconInfo");
     pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
index f248592..e79d666 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
-
-#include <initguid.h>
+#define COBJMACROS
+#define CONST_VTABLE
+#ifndef __REACTOS__
+#define NONAMELESSUNION
+#endif
+
+#include <stdio.h>
+#include <wine/test.h>
+
+#include "winbase.h"
+#include "shlobj.h"
+#include "shellapi.h"
+#include "initguid.h"
 
 DEFINE_GUID(FMTID_Test,0x12345678,0x1234,0x1234,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12);
 DEFINE_GUID(FMTID_NotExisting, 0x12345678,0x1234,0x1234,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13);
index 02eecb9..f667431 100644 (file)
  * namespace) path for a given folder (CSIDL value).
  */
 
-#include "precomp.h"
+#define COBJMACROS
 
-#include <initguid.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include "windef.h"
+#include "winbase.h"
+#include "shlguid.h"
+#include "shlobj.h"
+#include "shlwapi.h"
+#include "knownfolders.h"
+#include "shellapi.h"
+#include "wine/test.h"
+
+#include "initguid.h"
 
 /* CSIDL_MYDOCUMENTS is now the same as CSIDL_PERSONAL, but what we want
  * here is its original value.
@@ -1887,7 +1898,7 @@ static const struct knownFolderDef known_folders[] = {
     { 0 }
 };
 #undef KNOWN_FOLDER
-BOOL known_folder_found[sizeof(known_folders)/sizeof(known_folders[0])-1];
+BOOL known_folder_found[ARRAY_SIZE(known_folders)-1];
 
 static BOOL is_in_strarray(const WCHAR *needle, const char *hay)
 {
@@ -1903,7 +1914,7 @@ static BOOL is_in_strarray(const WCHAR *needle, const char *hay)
         if(strcmp(hay, "(null)") == 0 && !needle)
             return TRUE;
 
-        ret = MultiByteToWideChar(CP_ACP, 0, hay, -1, wstr, sizeof(wstr)/sizeof(wstr[0]));
+        ret = MultiByteToWideChar(CP_ACP, 0, hay, -1, wstr, ARRAY_SIZE(wstr));
         if(ret == 0)
         {
             ok(0, "Failed to convert string\n");
@@ -1956,7 +1967,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
                 ok_(__FILE__, known_folder->line)(hr == S_OK, "cannot get known folder definition for %s\n", known_folder->sFolderId);
                 if(SUCCEEDED(hr))
                 {
-                    ret = MultiByteToWideChar(CP_ACP, 0, known_folder->sName, -1,  sName, sizeof(sName)/sizeof(sName[0]));
+                    ret = MultiByteToWideChar(CP_ACP, 0, known_folder->sName, -1,  sName, ARRAY_SIZE(sName));
                     ok_(__FILE__, known_folder->line)(ret != 0, "cannot convert known folder name \"%s\" to wide characters\n", known_folder->sName);
 
                     ok_(__FILE__, known_folder->line)(lstrcmpW(kfd.pszName, sName)==0, "invalid known folder name returned for %s: %s expected, but %s retrieved\n", known_folder->sFolderId, wine_dbgstr_w(sName), wine_dbgstr_w(kfd.pszName));
@@ -2052,10 +2063,10 @@ static void test_knownFolders(void)
 
     GetWindowsDirectoryW( sWinDir, MAX_PATH );
 
-    GetTempPathW(sizeof(sExamplePath)/sizeof(sExamplePath[0]), sExamplePath);
+    GetTempPathW(ARRAY_SIZE(sExamplePath), sExamplePath);
     lstrcatW(sExamplePath, sExample);
 
-    GetTempPathW(sizeof(sExample2Path)/sizeof(sExample2Path[0]), sExample2Path);
+    GetTempPathW(ARRAY_SIZE(sExample2Path), sExample2Path);
     lstrcatW(sExample2Path, sExample2);
 
     lstrcpyW(sSubFolderPath, sExamplePath);
@@ -2110,7 +2121,6 @@ static void test_knownFolders(void)
             CoTaskMemFree(folderPath);
 
             hr = IKnownFolder_GetRedirectionCapabilities(folder, &redirectionCapabilities);
-            todo_wine
             ok(hr == S_OK, "failed to get redirection capabilities: 0x%08x\n", hr);
             todo_wine
             ok(redirectionCapabilities==0, "invalid redirection capabilities returned: %d\n", redirectionCapabilities);
@@ -2162,7 +2172,7 @@ static void test_knownFolders(void)
         ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got 0x%08x\n", hr);
         ok(folder == NULL, "got %p\n", folder);
 
-        for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i)
+        for(i=0; i < ARRAY_SIZE(known_folder_found); ++i)
             known_folder_found[i] = FALSE;
 
         hr = IKnownFolderManager_GetFolderIds(mgr, &folders, &nCount);
@@ -2170,7 +2180,7 @@ static void test_knownFolders(void)
         for(i=0;i<nCount;++i)
             check_known_folder(mgr, &folders[i]);
 
-        for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i)
+        for(i=0; i < ARRAY_SIZE(known_folder_found); ++i)
             if(!known_folder_found[i])
                 trace("Known folder %s not found on current platform\n", known_folders[i].sFolderId);
 
@@ -2544,7 +2554,7 @@ static void test_DoEnvironmentSubst(void)
         memset(bufferA, '#', MAX_PATH - 1);
         bufferA[MAX_PATH - 1] = 0;
         lstrcpyA(bufferA, names[i]);
-        MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
+        MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW));
 
         res2 = ExpandEnvironmentStringsA(names[i], expectedA, MAX_PATH);
         res = DoEnvironmentSubstA(bufferA, MAX_PATH);
@@ -2575,7 +2585,7 @@ static void test_DoEnvironmentSubst(void)
     memset(bufferA, '#', MAX_PATH - 1);
     bufferA[len + 2] = 0;
     lstrcpyA(bufferA, names[i]);
-    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW));
 
     res2 = ExpandEnvironmentStringsA(bufferA, expectedA, MAX_PATH);
     res = DoEnvironmentSubstA(bufferA, len + 1);
@@ -2596,7 +2606,7 @@ static void test_DoEnvironmentSubst(void)
     memset(bufferA, '#', MAX_PATH - 1);
     bufferA[len + 2] = 0;
     lstrcpyA(bufferA, names[i]);
-    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW));
 
     /* ANSI version failed without an extra byte, as documented on msdn */
     res = DoEnvironmentSubstA(bufferA, len);
@@ -2619,7 +2629,7 @@ static void test_DoEnvironmentSubst(void)
     memset(bufferA, '#', MAX_PATH - 1);
     bufferA[len + 2] = 0;
     lstrcpyA(bufferA, names[i]);
-    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW));
 
     res = DoEnvironmentSubstA(bufferA, len - 1);
     ok(!HIWORD(res) && (LOWORD(res) == (len - 1)),
@@ -2640,7 +2650,7 @@ static void test_DoEnvironmentSubst(void)
     memset(bufferA, '#', MAX_PATH - 1);
     bufferA[MAX_PATH - 1] = 0;
     lstrcpyA(bufferA, does_not_existA);
-    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, ARRAY_SIZE(bufferW));
 
     res2 = lstrlenA(does_not_existA) + 1;
     res = DoEnvironmentSubstA(bufferA, MAX_PATH);
@@ -2691,7 +2701,7 @@ if (0)
     ok(!ret, "got %d\n", ret);
 }
 
-    GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW);
+    GetTempPathW(ARRAY_SIZE(pathW), pathW);
 
     /* Using short name only first */
     nameW[0] = 0;
index 08efed9..09d82f0 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+#ifndef __REACTOS__
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include "shellapi.h"
+#include "shlobj.h"
+
+#include "wine/test.h"
 
 static inline BOOL SHELL_OsIsUnicode(void)
 {
index 34f76e3..a8aabac 100755 (executable)
  *   we could check
  */
 
-#include "precomp.h"
+/* Needed to get SEE_MASK_NOZONECHECKS with the PSDK */
+#ifndef __REACTOS__
+#define NTDDI_WINXPSP1 0x05010100
+#define NTDDI_VERSION NTDDI_WINXPSP1
+#define _WIN32_WINNT 0x0501
+#endif
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "wtypes.h"
+#include "winbase.h"
+#include "windef.h"
+#include "shellapi.h"
+#include "shlwapi.h"
+#include "ddeml.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
+#include "shell32_test.h"
+
 
 static char argv0[MAX_PATH];
 static int myARGC;
@@ -742,7 +763,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
     if (dwMaxLen > sizeof(szNameBuf)/sizeof(CHAR))
     {
         /* Name too big: alloc a buffer for it */
-        if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(CHAR))))
+        if (!(lpszName = heap_alloc(dwMaxLen*sizeof(CHAR))))
         {
             ret = ERROR_NOT_ENOUGH_MEMORY;
             goto cleanup;
@@ -777,7 +798,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
 cleanup:
     /* Free buffer if allocated */
     if (lpszName != szNameBuf)
-        HeapFree( GetProcessHeap(), 0, lpszName);
+        heap_free(lpszName);
     if(lpszSubKey)
         RegCloseKey(hSubKey);
     return ret;
@@ -837,11 +858,11 @@ static void create_test_verb_dde(const char* classname, const char* verb,
     }
     else
     {
-        cmd=HeapAlloc(GetProcessHeap(), 0, strlen(argv0)+10+strlen(child_file)+2+strlen(cmdtail)+1);
+        cmd = heap_alloc(strlen(argv0) + 10 + strlen(child_file) + 2 + strlen(cmdtail) + 1);
         sprintf(cmd,"%s shlexec \"%s\" %s", argv0, child_file, cmdtail);
         rc=RegSetValueExA(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmd, strlen(cmd)+1);
         ok(rc == ERROR_SUCCESS, "setting command failed with %d\n", rc);
-        HeapFree(GetProcessHeap(), 0, cmd);
+        heap_free(cmd);
     }
 
     if (ddeexec)
index 4e89858..72ca1e7 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+#define WINE_NOWINSOCK
+#include <windows.h>
+#include "shellapi.h"
+#include "shlobj.h"
+#include "commoncontrols.h"
+
+#include "wine/test.h"
+
+#ifdef __REACTOS__
+#include <reactos/undocshell.h>
+#endif
 
 #ifndef FOF_NORECURSION
 #define FOF_NORECURSION 0x1000
index 8d2481f..2ee91ef 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include "windef.h"
+#include "winbase.h"
+#include "wtypes.h"
+#include "shellapi.h"
+
+
+#include "shlguid.h"
+#include "shlobj.h"
+#include "shobjidl.h"
+#include "shlwapi.h"
+#include "ocidl.h"
+#include "oleauto.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
 
 #include <initguid.h>
 DEFINE_GUID(IID_IParentAndItem, 0xB3A4B685, 0xB685, 0x4805, 0x99,0xD9, 0x5D,0xEA,0xD2,0x87,0x32,0x36);
@@ -26,17 +46,6 @@ DEFINE_GUID(CLSID_ShellDocObjView, 0xe7e4bc40, 0xe76a, 0x11ce, 0xa9,0xbb, 0x00,0
 
 static IMalloc *ppM;
 
-static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*);
-static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
-static HRESULT (WINAPI *pSHGetFolderPathAndSubDirA)(HWND, int, HANDLE, DWORD, LPCSTR, LPSTR);
-static BOOL (WINAPI *pSHGetPathFromIDListW)(LPCITEMIDLIST,LPWSTR);
-static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
-static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
-static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
-static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
-static LPITEMIDLIST (WINAPI *pILFindLastID)(LPCITEMIDLIST);
-static void (WINAPI *pILFree)(LPITEMIDLIST);
-static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
 static HRESULT (WINAPI *pSHCreateItemFromIDList)(PCIDLIST_ABSOLUTE pidl, REFIID riid, void **ppv);
 static HRESULT (WINAPI *pSHCreateItemFromParsingName)(PCWSTR,IBindCtx*,REFIID,void**);
 static HRESULT (WINAPI *pSHCreateItemFromRelativeName)(IShellItem*,PCWSTR,IBindCtx*,REFIID,void**);
@@ -46,18 +55,13 @@ static HRESULT (WINAPI *pSHCreateShellItemArray)(LPCITEMIDLIST,IShellFolder*,UIN
 static HRESULT (WINAPI *pSHCreateShellItemArrayFromIDLists)(UINT, PCIDLIST_ABSOLUTE*, IShellItemArray**);
 static HRESULT (WINAPI *pSHCreateShellItemArrayFromDataObject)(IDataObject*, REFIID, void **);
 static HRESULT (WINAPI *pSHCreateShellItemArrayFromShellItem)(IShellItem*, REFIID, void **);
-static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
-static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*);
-static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPathAW)(LPCVOID);
 static HRESULT (WINAPI *pSHGetKnownFolderPath)(REFKNOWNFOLDERID,DWORD,HANDLE,PWSTR*);
 static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
 static HRESULT (WINAPI *pSHGetItemFromDataObject)(IDataObject*,DATAOBJ_GET_ITEM_FLAGS,REFIID,void**);
 static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*);
 static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**);
 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
-static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
 static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**);
-static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
 static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS);
 
 static WCHAR *make_wstr(const char *str)
@@ -72,7 +76,7 @@ static WCHAR *make_wstr(const char *str)
     if(!len || len < 0)
         return NULL;
 
-    ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+    ret = heap_alloc(len * sizeof(WCHAR));
     if(!ret)
         return NULL;
 
@@ -96,7 +100,6 @@ static void init_function_pointers(void)
     hmod = GetModuleHandleA("shell32.dll");
 
 #define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
-    MAKEFUNC(SHBindToParent);
     MAKEFUNC(SHCreateItemFromIDList);
     MAKEFUNC(SHCreateItemFromParsingName);
     MAKEFUNC(SHCreateItemFromRelativeName);
@@ -106,13 +109,6 @@ static void init_function_pointers(void)
     MAKEFUNC(SHCreateShellItemArrayFromIDLists);
     MAKEFUNC(SHCreateShellItemArrayFromDataObject);
     MAKEFUNC(SHCreateShellItemArrayFromShellItem);
-    MAKEFUNC(SHGetFolderPathA);
-    MAKEFUNC(SHGetFolderPathAndSubDirA);
-    MAKEFUNC(SHGetPathFromIDListW);
-    MAKEFUNC(SHGetSpecialFolderPathA);
-    MAKEFUNC(SHGetSpecialFolderPathW);
-    MAKEFUNC(SHGetSpecialFolderLocation);
-    MAKEFUNC(SHParseDisplayName);
     MAKEFUNC(SHGetKnownFolderPath);
     MAKEFUNC(SHGetNameFromIDList);
     MAKEFUNC(SHGetItemFromDataObject);
@@ -122,15 +118,6 @@ static void init_function_pointers(void)
     MAKEFUNC(SHGetPathFromIDListEx);
 #undef MAKEFUNC
 
-#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
-    MAKEFUNC_ORD(ILFindLastID, 16);
-    MAKEFUNC_ORD(ILIsEqual, 21);
-    MAKEFUNC_ORD(ILCombine, 25);
-    MAKEFUNC_ORD(SHILCreateFromPath, 28);
-    MAKEFUNC_ORD(ILFree, 155);
-    MAKEFUNC_ORD(SHSimpleIDListFromPathAW, 162);
-#undef MAKEFUNC_ORD
-
     /* test named exports */
     ptr = GetProcAddress(hmod, "ILFree");
     ok(broken(ptr == 0) || ptr != 0, "expected named export for ILFree\n");
@@ -158,12 +145,8 @@ static void init_function_pointers(void)
 #undef TESTNAMED
     }
 
-    hmod = GetModuleHandleA("shlwapi.dll");
-    pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
-
     hmod = GetModuleHandleA("kernel32.dll");
     pIsWow64Process = (void*)GetProcAddress(hmod, "IsWow64Process");
-    pGetSystemWow64DirectoryW = (void*)GetProcAddress(hmod, "GetSystemWow64DirectoryW");
 
     hr = SHGetMalloc(&ppM);
     ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr);
@@ -206,12 +189,11 @@ static void test_ParseDisplayName(void)
     ok(hr == S_OK, "Expected SHGetDesktopFolder to return S_OK, got 0x%08x\n", hr);
     if(hr != S_OK) return;
 
-    /* Tests crash on W2K and below (SHCreateShellItem available as of XP) */
     if (pSHCreateShellItem)
     {
         if (0)
         {
-            /* null name and pidl, also crashes on Windows 8 */
+            /* null name and pidl, crashes on Windows 8 */
             hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL,
                                                NULL, NULL, NULL, 0);
             ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
@@ -225,29 +207,26 @@ static void test_ParseDisplayName(void)
         ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
     }
     else
-        win_skip("Tests would crash on W2K and below\n");
+        win_skip("SHCreateShellItem requires XP SP1 or later\n");
 
     MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH);
-    hr = IShellFolder_ParseDisplayName(IDesktopFolder,
-        NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
-    todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
-        "ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
+    hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
+    todo_wine ok(hr == S_OK, "ParseDisplayName returned %08x, expected SUCCESS\n", hr);
     if (hr == S_OK)
     {
-        ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
-           "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
+        ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
+           "PT_IESPECIAL1, but is: %02x\n", ILFindLastID(newPIDL)->mkid.abID[0]);
         IMalloc_Free(ppM, newPIDL);
     }
 
     MultiByteToWideChar(CP_ACP, 0, cInetTest2A, -1, cTestDirW, MAX_PATH);
     hr = IShellFolder_ParseDisplayName(IDesktopFolder,
         NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
-    todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
-        "ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
+    todo_wine ok(hr == S_OK, "ParseDisplayName returned %08x, expected SUCCESS\n", hr);
     if (hr == S_OK)
     {
-        ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
-           "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
+        ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
+           "PT_IESPECIAL1, but is: %02x\n", ILFindLastID(newPIDL)->mkid.abID[0]);
         IMalloc_Free(ppM, newPIDL);
     }
 
@@ -259,10 +238,10 @@ static void test_ParseDisplayName(void)
     }
 
     MultiByteToWideChar(CP_ACP, 0, cNonExistDir1A, -1, cTestDirW, MAX_PATH);
-    hr = IShellFolder_ParseDisplayName(IDesktopFolder, 
+    hr = IShellFolder_ParseDisplayName(IDesktopFolder,
         NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
-    ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL), 
-        "ParseDisplayName returned %08x, expected 80070002 or E_FAIL\n", hr);
+    ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
+        "ParseDisplayName returned %08x, expected 0x80070002\n", hr);
 
     res = GetFileAttributesA(cNonExistDir2A);
     if(res != INVALID_FILE_ATTRIBUTES)
@@ -272,21 +251,15 @@ static void test_ParseDisplayName(void)
     }
 
     MultiByteToWideChar(CP_ACP, 0, cNonExistDir2A, -1, cTestDirW, MAX_PATH);
-    hr = IShellFolder_ParseDisplayName(IDesktopFolder, 
+    hr = IShellFolder_ParseDisplayName(IDesktopFolder,
         NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
-    ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL) || (hr == E_INVALIDARG), 
-        "ParseDisplayName returned %08x, expected 80070002, E_FAIL or E_INVALIDARG\n", hr);
+    todo_wine ok(hr == E_INVALIDARG, "ParseDisplayName returned %08x, expected E_INVALIDARG\n", hr);
 
     /* I thought that perhaps the DesktopFolder's ParseDisplayName would recognize the
      * path corresponding to CSIDL_PERSONAL and return a CLSID_MyDocuments PIDL. Turns
      * out it doesn't. The magic seems to happen in the file dialogs, then. */
-    if (!pSHGetSpecialFolderPathW || !pILFindLastID)
-    {
-        win_skip("SHGetSpecialFolderPathW and/or ILFindLastID are not available\n");
-        goto finished;
-    }
 
-    bRes = pSHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE);
+    bRes = SHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE);
     ok(bRes, "SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %u\n", GetLastError());
     if (!bRes) goto finished;
 
@@ -294,12 +267,11 @@ static void test_ParseDisplayName(void)
     ok(hr == S_OK, "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr);
     if (hr != S_OK) goto finished;
 
-    ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 ||
-       pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */
-       "Last pidl should be of type PT_FOLDER or PT_IESPECIAL2, but is: %02x\n",
-       pILFindLastID(newPIDL)->mkid.abID[0]);
+    ok(ILFindLastID(newPIDL)->mkid.abID[0] == 0x31,
+       "Last pidl should be of type PT_FOLDER, but is: %02x\n",
+       ILFindLastID(newPIDL)->mkid.abID[0]);
     IMalloc_Free(ppM, newPIDL);
-    
+
 finished:
     IShellFolder_Release(IDesktopFolder);
 }
@@ -422,7 +394,6 @@ static void test_EnumObjects(IShellFolder *iFolder)
         flags &= SFGAO_testfor;
         ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr);
         ok(flags == (attrs[i]) ||
-           flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR) || /* Win9x, NT4 */
            flags == ((attrs[i] & ~SFGAO_CAPABILITYMASK) | SFGAO_VISTA), /* Vista and higher */
            "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
 
@@ -430,9 +401,7 @@ static void test_EnumObjects(IShellFolder *iFolder)
         hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
         flags &= SFGAO_testfor;
         ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr);
-        ok(flags == attrs[i] ||
-           flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR), /* Win9x, NT4 */
-           "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
+        ok(flags == attrs[i], "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
 
         flags = ~0u;
         hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
@@ -493,12 +462,8 @@ static void test_BindToObject(void)
     hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
     ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
 
-if (0)
-{
-    /* this call segfaults on 98SE */
     hr = IShellFolder_BindToObject(psfMyComputer, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
     ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
-}
 
     cChars = GetSystemDirectoryA(szSystemDir, MAX_PATH);
     ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryA failed! LastError: %u\n", GetLastError());
@@ -525,13 +490,9 @@ if (0)
     ok (hr == E_INVALIDARG, 
         "FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
 
-if (0)
-{
-    /* this call segfaults on 98SE */
     hr = IShellFolder_BindToObject(psfSystemDir, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
     ok (hr == E_INVALIDARG,
         "FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
-}
 
     IShellFolder_Release(psfSystemDir);
 
@@ -567,23 +528,19 @@ if (0)
             {
                 IPersist *pp;
                 hr = IShellFolder_QueryInterface(psfChild, &IID_IPersist, (void**)&pp);
-                ok(hr == S_OK ||
-                   broken(hr == E_NOINTERFACE), /* Win9x, NT4, W2K */
-                   "Got 0x%08x\n", hr);
+                ok(hr == S_OK, "Got 0x%08x\n", hr);
                 if(SUCCEEDED(hr))
                 {
                     CLSID id;
                     hr = IPersist_GetClassID(pp, &id);
                     ok(hr == S_OK, "Got 0x%08x\n", hr);
-                    /* CLSID_ShellFSFolder on some w2k systems */
-                    ok(IsEqualIID(&id, &CLSID_ShellDocObjView) || broken(IsEqualIID(&id, &CLSID_ShellFSFolder)),
-                        "Unexpected classid %s\n", wine_dbgstr_guid(&id));
+                    ok(IsEqualIID(&id, &CLSID_ShellDocObjView), "Unexpected classid %s\n", wine_dbgstr_guid(&id));
                     IPersist_Release(pp);
                 }
 
                 IShellFolder_Release(psfChild);
             }
-            pILFree(pidl);
+            ILFree(pidl);
         }
         DeleteFileA(pathA);
     }
@@ -604,12 +561,10 @@ if (0)
         {
             hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
             ok(hr == E_FAIL || /* Vista+ */
-               hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
-               hr == E_INVALIDARG || /* W2K item in top dir */
-               broken(hr == S_OK), /* Win9x, NT4, W2K */
+               hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
                "Got 0x%08x\n", hr);
             if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
-            pILFree(pidl);
+            ILFree(pidl);
         }
         DeleteFileA(pathA);
     }
@@ -630,12 +585,10 @@ if (0)
         {
             hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
             ok(hr == E_FAIL || /* Vista+ */
-               hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
-               hr == E_INVALIDARG || /* W2K item in top dir */
-               broken(hr == S_OK), /* Win9x, NT4, W2K */
+               hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
                "Got 0x%08x\n", hr);
             if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
-            pILFree(pidl);
+            ILFree(pidl);
         }
         DeleteFileA(pathA);
     }
@@ -643,59 +596,42 @@ if (0)
         win_skip("Failed to create .foo testfile.\n");
 
     /* And on the desktop */
-    if(pSHGetSpecialFolderPathA)
-    {
-        pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
-        lstrcatA(pathA, "\\");
-        lstrcatA(pathA, filename_html);
-        hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-        if(hfile != INVALID_HANDLE_VALUE)
-        {
-            CloseHandle(hfile);
-            MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
-            hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
-            ok(hr == S_OK, "Got 0x%08x\n", hr);
-            if(SUCCEEDED(hr))
-            {
-                hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
-                ok(hr == S_OK ||
-                   hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
-                   "Got 0x%08x\n", hr);
-                if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
-                pILFree(pidl);
-            }
-            if(!DeleteFileA(pathA))
-                trace("Failed to delete: %d\n", GetLastError());
+    SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
+    lstrcatA(pathA, "\\");
+    lstrcatA(pathA, filename_html);
+    hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
 
-        }
-        else
-            win_skip("Failed to create .html testfile.\n");
+    CloseHandle(hfile);
+    MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
+    hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
 
-        pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
-        lstrcatA(pathA, "\\");
-        lstrcatA(pathA, filename_foo);
-        hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-        if(hfile != INVALID_HANDLE_VALUE)
-        {
-            CloseHandle(hfile);
-            MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
-            hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
-            ok(hr == S_OK, "Got 0x%08x\n", hr);
-            if(SUCCEEDED(hr))
-            {
-                hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
-                ok(hr == E_FAIL || /* Vista+ */
-                   hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
-                   broken(hr == S_OK), /* Win9x, NT4, W2K */
-                   "Got 0x%08x\n", hr);
-                if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
-                pILFree(pidl);
-            }
-            DeleteFileA(pathA);
-        }
-        else
-            win_skip("Failed to create .foo testfile.\n");
-    }
+    hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild);
+    ok(hr == S_OK ||
+       hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
+       "Got 0x%08x\n", hr);
+    if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
+    ILFree(pidl);
+    if(!DeleteFileA(pathA))
+        trace("Failed to delete: %d\n", GetLastError());
+
+    SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
+    lstrcatA(pathA, "\\");
+    lstrcatA(pathA, filename_foo);
+    hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+
+    CloseHandle(hfile);
+    MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
+    hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild);
+    ok(hr == E_FAIL || /* Vista+ */
+       hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
+       "Got 0x%08x\n", hr);
+    if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
+    ILFree(pidl);
+    DeleteFileA(pathA);
 
     IShellFolder_Release(psfDesktop);
 }
@@ -718,6 +654,10 @@ static void test_GetDisplayName(void)
     static const WCHAR wszFileName[] = { 'w','i','n','e','t','e','s','t','.','f','o','o',0 };
     static const WCHAR wszDirName[] = { 'w','i','n','e','t','e','s','t',0 };
 
+    /* It's ok to use this fixed path. Call will fail anyway. */
+    WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
+    LPITEMIDLIST pidlNew;
+
     /* I'm trying to figure if there is a functional difference between calling
      * SHGetPathFromIDListW and calling GetDisplayNameOf(SHGDN_FORPARSING) after
      * binding to the shellfolder. One thing I thought of was that perhaps 
@@ -726,13 +666,8 @@ static void test_GetDisplayName(void)
      * no functional difference in this respect.
      */
 
-    if(!pSHGetSpecialFolderPathA) {
-        win_skip("SHGetSpecialFolderPathA is not available\n");
-        return;
-    }
-
     /* First creating a directory in MyDocuments and a file in this directory. */
-    result = pSHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE);
+    result = SHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE);
     ok(result, "SHGetSpecialFolderPathA failed! Last error: %u\n", GetLastError());
     if (!result) return;
 
@@ -768,11 +703,8 @@ static void test_GetDisplayName(void)
         return;
     }
 
-    pidlLast = pILFindLastID(pidlTestFile);
-    ok(pidlLast->mkid.cb >=76 ||
-        broken(pidlLast->mkid.cb == 28) || /* W2K */
-        broken(pidlLast->mkid.cb == 40), /* Win9x, WinME */
-        "Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb);
+    pidlLast = ILFindLastID(pidlTestFile);
+    ok(pidlLast->mkid.cb >= 76, "Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb);
     if (pidlLast->mkid.cb >= 28) {
         ok(!lstrcmpA((CHAR*)&pidlLast->mkid.abID[12], szFileName),
             "Filename should be stored as ansi-string at this position!\n");
@@ -790,95 +722,70 @@ static void test_GetDisplayName(void)
      */
     hr = IShellFolder_BindToObject(psfDesktop, pidlTestFile, NULL, &IID_IUnknown, (VOID**)&psfFile);
     ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
-        hr == E_NOTIMPL || /* Vista */
-        broken(hr == S_OK), /* Win9x, W2K */
+        hr == E_NOTIMPL, /* Vista */
         "hr = %08x\n", hr);
     if (hr == S_OK) {
         IUnknown_Release(psfFile);
     }
 
-    if (!pSHBindToParent)
-    {
-        win_skip("SHBindToParent is missing\n");
-        DeleteFileA(szTestFile);
-        RemoveDirectoryA(szTestDir);
-        return;
-    }
-  
     /* Some tests for IShellFolder::SetNameOf */
-    if (pSHGetFolderPathAndSubDirA)
-    {
-        hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
-        ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
-        if (hr == S_OK) {
-            /* It's ok to use this fixed path. Call will fail anyway. */
-            WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
-            LPITEMIDLIST pidlNew;
-
-            /* The pidl returned through the last parameter of SetNameOf is a simple one. */
-            hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
-            ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
-            if (hr == S_OK)
-            {
-                ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
-                    "pidl returned from SetNameOf should be simple!\n");
+    hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
+    ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
 
-                /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
-                 * is implemented on top of SHFileOperation in WinXP. */
-                hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
-                        SHGDN_FORPARSING, NULL);
-                ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
+    /* The pidl returned through the last parameter of SetNameOf is a simple one. */
+    hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
+    ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
 
-                /* Rename the file back to its original name. SetNameOf ignores the fact, that the
-                 * SHGDN flags specify an absolute path. */
-                hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
-                ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
+    ok (((ITEMIDLIST *)((BYTE *)pidlNew + pidlNew->mkid.cb))->mkid.cb == 0,
+        "pidl returned from SetNameOf should be simple!\n");
 
-                pILFree(pidlNew);
-            }
+    /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
+     * is implemented on top of SHFileOperation in WinXP. */
+    hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename, SHGDN_FORPARSING, NULL);
+    ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
 
-            IShellFolder_Release(psfPersonal);
-        }
-    }
-    else
-        win_skip("Avoid needs of interaction on Win2k\n");
+    /* Rename the file back to its original name. SetNameOf ignores the fact, that the
+     * SHGDN flags specify an absolute path. */
+    hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
+    ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
+
+    ILFree(pidlNew);
+    IShellFolder_Release(psfPersonal);
 
     /* Deleting the file and the directory */
     DeleteFileA(szTestFile);
     RemoveDirectoryA(szTestDir);
 
     /* SHGetPathFromIDListW still works, although the file is not present anymore. */
-    if (pSHGetPathFromIDListW)
-    {
-        result = pSHGetPathFromIDListW(pidlTestFile, wszTestFile2);
-        ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
-        ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
-    }
+    result = SHGetPathFromIDListW(pidlTestFile, wszTestFile2);
+    ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
+    ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
 
     /* SHBindToParent fails, if called with a NULL PIDL. */
-    hr = pSHBindToParent(NULL, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
-    ok (hr != S_OK, "SHBindToParent(NULL) should fail!\n");
+    hr = SHBindToParent(NULL, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
+    ok (hr == E_INVALIDARG || broken(hr == E_OUTOFMEMORY) /* XP */,
+        "SHBindToParent(NULL) should fail! hr = %08x\n", hr);
 
     /* But it succeeds with an empty PIDL. */
-    hr = pSHBindToParent(pidlEmpty, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
+    hr = SHBindToParent(pidlEmpty, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
     ok (hr == S_OK, "SHBindToParent(empty PIDL) should succeed! hr = %08x\n", hr);
     ok (pidlLast == pidlEmpty, "The last element of an empty PIDL should be the PIDL itself!\n");
     if (hr == S_OK)
         IShellFolder_Release(psfPersonal);
-    
+
     /* Binding to the folder and querying the display name of the file also works. */
-    hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 
+    hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
     ok (hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
     if (hr != S_OK) {
         IShellFolder_Release(psfDesktop);
         return;
     }
 
-    /* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into 
+    /* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into
      * pidlTestFile (In accordance with MSDN). */
-    ok (pILFindLastID(pidlTestFile) == pidlLast, 
+    ok (ILFindLastID(pidlTestFile) == pidlLast,
                                 "SHBindToParent doesn't return the last id of the pidl param!\n");
-    
+
     hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret);
     ok (hr == S_OK, "Personal->GetDisplayNameOf failed! hr = %08x\n", hr);
     if (hr != S_OK) {
@@ -887,13 +794,10 @@ static void test_GetDisplayName(void)
         return;
     }
 
-    if (pStrRetToBufW)
-    {
-        hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
-        ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
-        ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
-    }
-    
+    hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
+    ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+    ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
+
     ILFree(pidlTestFile);
     IShellFolder_Release(psfDesktop);
     IShellFolder_Release(psfPersonal);
@@ -931,11 +835,10 @@ static void test_CallForAttributes(void)
     hr = SHGetDesktopFolder(&psfDesktop);
     ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
     if (hr != S_OK) return;
-    
-    hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL, 
+
+    hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
                                        &pidlMyDocuments, NULL);
-    ok (hr == S_OK ||
-        broken(hr == E_INVALIDARG), /* Win95, NT4 */
+    ok (hr == S_OK,
         "Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n", hr);
     if (hr != S_OK) {
         IShellFolder_Release(psfDesktop);
@@ -1030,32 +933,11 @@ static void test_GetAttributesOf(void)
     LPCITEMIDLIST pidlEmpty = (LPCITEMIDLIST)&emptyitem;
     LPITEMIDLIST pidlMyComputer;
     DWORD dwFlags;
-    static const DWORD desktopFlags[] = {
-        /* WinXP */
-        SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR |
-        SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER,
-        /* Win2k */
-        SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_STREAM | SFGAO_FILESYSANCESTOR |
-        SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER,
-        /* WinMe, Win9x, WinNT*/
-        SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSANCESTOR |
-        SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER
-    };
-    static const DWORD myComputerFlags[] = {
-        /* WinXP */
-        SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET |
-        SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
-        /* Win2k */
-        SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_STREAM |
-        SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
-        /* WinMe, Win9x, WinNT */
-        SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR |
-        SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
-        /* Win95, WinNT when queried directly */
-        SFGAO_CANLINK | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR |
-        SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER
-    };
-    WCHAR wszMyComputer[] = { 
+    static const DWORD desktopFlags = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
+        SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
+    static const DWORD myComputerFlags = SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
+        SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
+    WCHAR wszMyComputer[] = {
         ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
         'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
     char  cCurrDirA [MAX_PATH] = {0};
@@ -1063,8 +945,7 @@ static void test_GetAttributesOf(void)
     static WCHAR cTestDirW[] = {'t','e','s','t','d','i','r',0};
     IShellFolder *IDesktopFolder, *testIShellFolder;
     ITEMIDLIST *newPIDL;
-    int len, i;
-    BOOL foundFlagsMatch;
+    int len;
 
     hr = SHGetDesktopFolder(&psfDesktop);
     ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
@@ -1074,26 +955,14 @@ static void test_GetAttributesOf(void)
     dwFlags = 0xffffffff;
     hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &dwFlags);
     ok (hr == S_OK, "Desktop->GetAttributesOf(empty pidl) failed! hr = %08x\n", hr);
-    for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
-         i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
-    {
-        if (desktopFlags[i] == dwFlags)
-            foundFlagsMatch = TRUE;
-    }
-    ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags);
+    ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags);
 
     /* .. or with no itemidlist at all. */
     dwFlags = 0xffffffff;
     hr = IShellFolder_GetAttributesOf(psfDesktop, 0, NULL, &dwFlags);
     ok (hr == S_OK, "Desktop->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
-    for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
-         i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
-    {
-        if (desktopFlags[i] == dwFlags)
-            foundFlagsMatch = TRUE;
-    }
-    ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags);
-   
+    ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags);
+
     /* Testing the attributes of the MyComputer shellfolder */
     hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
     ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
@@ -1108,14 +977,8 @@ static void test_GetAttributesOf(void)
     dwFlags = 0xffffffff;
     hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
     ok (hr == S_OK, "Desktop->GetAttributesOf(MyComputer) failed! hr = %08x\n", hr);
-    for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
-         i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
-    {
-        if ((myComputerFlags[i] | SFGAO_CANLINK) == dwFlags)
-            foundFlagsMatch = TRUE;
-    }
     todo_wine
-    ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
+    ok (dwFlags == (myComputerFlags | SFGAO_CANLINK), "Wrong MyComputer attributes: %08x\n", dwFlags);
 
     hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
     ok (hr == S_OK, "Desktop failed to bind to MyComputer object! hr = %08x\n", hr);
@@ -1125,21 +988,13 @@ static void test_GetAttributesOf(void)
 
     hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags);
     todo_wine
-    ok (hr == E_INVALIDARG ||
-        broken(hr == S_OK), /* W2K and earlier */
-        "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr);
+    ok (hr == E_INVALIDARG, "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr);
 
     dwFlags = 0xffffffff;
     hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags);
     ok (hr == S_OK, "MyComputer->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
-    for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
-         i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
-    {
-        if (myComputerFlags[i] == dwFlags)
-            foundFlagsMatch = TRUE;
-    }
     todo_wine
-    ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
+    ok (dwFlags == myComputerFlags, "Wrong MyComputer attributes: %08x\n", dwFlags);
 
     IShellFolder_Release(psfMyComputer);
 
@@ -1227,34 +1082,19 @@ static void test_SHGetPathFromIDList(void)
         'w','i','n','e','t','e','s','t','.','f','o','o',0 };
     LPITEMIDLIST pidlPrograms;
 
-    if(!pSHGetPathFromIDListW || !pSHGetSpecialFolderPathW)
-    {
-        win_skip("SHGetPathFromIDListW() or SHGetSpecialFolderPathW() is missing\n");
-        return;
-    }
-
     /* Calling SHGetPathFromIDListW with no pidl should return the empty string */
     wszPath[0] = 'a';
     wszPath[1] = '\0';
-    result = pSHGetPathFromIDListW(NULL, wszPath);
+    result = SHGetPathFromIDListW(NULL, wszPath);
     ok(!result, "Expected failure\n");
     ok(!wszPath[0], "Expected empty string\n");
 
     /* Calling SHGetPathFromIDListW with an empty pidl should return the desktop folder's path. */
-    result = pSHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
+    result = SHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
     ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u\n", GetLastError());
     if (!result) return;
 
-    /* Check if we are on Win9x */
-    SetLastError(0xdeadbeef);
-    lstrcmpiW(wszDesktop, wszDesktop);
-    if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
-    {
-        win_skip("Most W-calls are not implemented\n");
-        return;
-    }
-
-    result = pSHGetPathFromIDListW(pidlEmpty, wszPath);
+    result = SHGetPathFromIDListW(pidlEmpty, wszPath);
     ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
     if (!result) return;
     ok(!lstrcmpiW(wszDesktop, wszPath), "SHGetPathFromIDListW didn't return desktop path for empty pidl!\n");
@@ -1274,7 +1114,7 @@ static void test_SHGetPathFromIDList(void)
     SetLastError(0xdeadbeef);
     wszPath[0] = 'a';
     wszPath[1] = '\0';
-    result = pSHGetPathFromIDListW(pidlMyComputer, wszPath);
+    result = SHGetPathFromIDListW(pidlMyComputer, wszPath);
     ok (!result, "SHGetPathFromIDListW succeeded where it shouldn't!\n");
     ok (GetLastError()==0xdeadbeef ||
         GetLastError()==ERROR_SUCCESS, /* Vista and higher */
@@ -1287,7 +1127,7 @@ static void test_SHGetPathFromIDList(void)
 
     IMalloc_Free(ppM, pidlMyComputer);
 
-    result = pSHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE);
+    result = SHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE);
     ok(result, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError());
     if (!result) {
         IShellFolder_Release(psfDesktop);
@@ -1322,15 +1162,12 @@ static void test_SHGetPathFromIDList(void)
         IMalloc_Free(ppM, pidlTestFile);
         return;
     }
-    if (pStrRetToBufW)
-    {
-        pStrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
-        ok(0 == lstrcmpW(wszFileName, wszPath), 
-           "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
-           "returned incorrect path for file placed on desktop\n");
-    }
+    StrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
+    ok(0 == lstrcmpW(wszFileName, wszPath),
+       "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
+       "returned incorrect path for file placed on desktop\n");
 
-    result = pSHGetPathFromIDListW(pidlTestFile, wszPath);
+    result = SHGetPathFromIDListW(pidlTestFile, wszPath);
     ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
     ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n");
 
@@ -1362,11 +1199,11 @@ static void test_SHGetPathFromIDList(void)
     IMalloc_Free(ppM, pidlTestFile);
 
     /* Test if we can get the path from the start menu "program files" PIDL. */
-    hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
+    hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
     ok(hr == S_OK, "SHGetFolderLocation failed: 0x%08x\n", hr);
 
     SetLastError(0xdeadbeef);
-    result = pSHGetPathFromIDListW(pidlPrograms, wszPath);
+    result = SHGetPathFromIDListW(pidlPrograms, wszPath);
     IMalloc_Free(ppM, pidlPrograms);
     ok(result, "SHGetPathFromIDListW failed\n");
 }
@@ -1459,11 +1296,9 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
         'T','a','r','g','e','t','K','n','o','w','n','F','o','l','d','e','r',0 };
     static const WCHAR wszCLSID[] = {
         'C','L','S','I','D',0 };
-       
+
     if (!lstrcmpW(pszPropName, wszTargetSpecialFolder)) {
-        ok(V_VT(pVar) == VT_I4 ||
-           broken(V_VT(pVar) == VT_BSTR),   /* Win2k */
-           "Wrong variant type for 'TargetSpecialFolder' property!\n");
+        ok(V_VT(pVar) == VT_I4, "Wrong variant type for 'TargetSpecialFolder' property!\n");
         return E_INVALIDARG;
     }
     
@@ -1476,13 +1311,11 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
     if (!lstrcmpW(pszPropName, wszTarget)) {
         WCHAR wszPath[MAX_PATH];
         BOOL result;
-        
-        ok(V_VT(pVar) == VT_BSTR ||
-           broken(V_VT(pVar) == VT_EMPTY),  /* Win2k */
-           "Wrong variant type for 'Target' property!\n");
+
+        ok(V_VT(pVar) == VT_BSTR, "Wrong variant type for 'Target' property!\n");
         if (V_VT(pVar) != VT_BSTR) return E_INVALIDARG;
 
-        result = pSHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE);
+        result = SHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE);
         ok(result, "SHGetSpecialFolderPathW(DESKTOPDIRECTORY) failed! %u\n", GetLastError());
         if (!result) return E_INVALIDARG;
 
@@ -1559,17 +1392,6 @@ static void test_FolderShortcut(void) {
     static const GUID CLSID_UnixDosFolder = 
         {0x9d20aae8, 0x0625, 0x44b0, {0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9}};
 
-    if (!pSHGetSpecialFolderPathW || !pStrRetToBufW) {
-        win_skip("SHGetSpecialFolderPathW and/or StrRetToBufW are not available\n");
-        return;
-    }
-
-    if (!pSHGetFolderPathAndSubDirA)
-    {
-        win_skip("FolderShortcut test doesn't work on Win2k\n");
-        return;
-    }
-
     /* These tests basically show, that CLSID_FolderShortcuts are initialized
      * via their IPersistPropertyBag interface. And that the target folder
      * is taken from the IPropertyBag's 'Target' property.
@@ -1604,11 +1426,11 @@ static void test_FolderShortcut(void) {
         return;
     }
 
-    result = pSHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);
+    result = SHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);
     ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u\n", GetLastError());
     if (!result) return;
 
-    pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
+    StrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
     ok(!lstrcmpiW(wszDesktopPath, wszBuffer), "FolderShortcut returned incorrect folder!\n");
 
     hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (LPVOID*)&pPersistFolder3);
@@ -1649,16 +1471,16 @@ static void test_FolderShortcut(void) {
     ok (hr == S_OK, "IPersistFolder3::Initialize failed! hr = %08x\n", hr);
     if (hr != S_OK) {
         IPersistFolder3_Release(pPersistFolder3);
-        pILFree(pidlWineTestFolder);
+        ILFree(pidlWineTestFolder);
         return;
     }
 
     hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder);
     ok(hr == S_OK, "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr);
-    ok(pILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
+    ok(ILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
         "IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n");
-    pILFree(pidlCurrentFolder);
-    pILFree(pidlWineTestFolder);
+    ILFree(pidlCurrentFolder);
+    ILFree(pidlWineTestFolder);
 
     hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (LPVOID*)&pShellFolder);
     IPersistFolder3_Release(pPersistFolder3);
@@ -1672,7 +1494,7 @@ static void test_FolderShortcut(void) {
         return;
     }
 
-    pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
+    StrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
     ok(!lstrcmpiW(wszDesktopPath, wszBuffer), "FolderShortcut returned incorrect folder!\n");
 
     /* Next few lines are meant to show that children of FolderShortcuts are not FolderShortcuts,
@@ -1696,7 +1518,7 @@ static void test_FolderShortcut(void) {
     hr = IShellFolder_BindToObject(pShellFolder, pidlSubFolder, NULL, &IID_IPersistFolder3,
                                    (LPVOID*)&pPersistFolder3);
     IShellFolder_Release(pShellFolder);
-    pILFree(pidlSubFolder);
+    ILFree(pidlSubFolder);
     ok (hr == S_OK, "IShellFolder::BindToObject failed! hr = %08x\n", hr);
     if (hr != S_OK)
         return;
@@ -1748,9 +1570,7 @@ static void test_ITEMIDLIST_format(void) {
         { 'l','o','n','g','e','r','_','t','h','a','n','.','8','_','3',0 } };
     int i;
 
-    if (!pSHGetSpecialFolderPathW) return;
-
-    bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
+    bResult = SHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
     ok(bResult, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError());
     if (!bResult) return;
 
@@ -1777,7 +1597,7 @@ static void test_ITEMIDLIST_format(void) {
     hr = IShellFolder_BindToObject(psfDesktop, pidlPersonal, NULL, &IID_IShellFolder,
         (LPVOID*)&psfPersonal);
     IShellFolder_Release(psfDesktop);
-    pILFree(pidlPersonal);
+    ILFree(pidlPersonal);
     ok(hr == S_OK, "psfDesktop->BindToObject failed! hr = %08x\n", hr);
     if (hr != S_OK) return;
 
@@ -1818,13 +1638,10 @@ static void test_ITEMIDLIST_format(void) {
              * current habit of storing the long filename here, which seems to work
              * just fine. */
             todo_wine
-            ok(pidlFile->mkid.abID[18] == '~' ||
-               broken(pidlFile->mkid.abID[34] == '~'),  /* Win2k */
-               "Should be derived 8.3 name!\n");
+            ok(pidlFile->mkid.abID[18] == '~', "Should be derived 8.3 name!\n");
 
         if (i == 0) /* First file name has an even number of chars. No need for alignment. */
-            ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0' ||
-               broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1),    /* Win2k */
+            ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0',
                 "Alignment byte, where there shouldn't be!\n");
 
         if (i == 1) /* Second file name has an uneven number of chars => alignment byte */
@@ -1834,9 +1651,7 @@ static void test_ITEMIDLIST_format(void) {
         /* The offset of the FileStructW member is stored as a WORD at the end of the pidl. */
         cbOffset = *(WORD*)(((LPBYTE)pidlFile)+pidlFile->mkid.cb-sizeof(WORD));
         ok ((cbOffset >= sizeof(struct FileStructA) &&
-            cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)) ||
-            broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1) ||     /* Win2k on short names */
-            broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 12 + 1),  /* Win2k on long names */
+            cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)),
             "Wrong offset value (%d) stored at the end of the PIDL\n", cbOffset);
 
         if (cbOffset >= sizeof(struct FileStructA) &&
@@ -1888,7 +1703,7 @@ static void test_ITEMIDLIST_format(void) {
             }
         }
 
-        pILFree(pidlFile);
+        ILFree(pidlFile);
     }
 
     IShellFolder_Release(psfPersonal);
@@ -1904,16 +1719,11 @@ static void test_SHGetFolderPathA(void)
     HRESULT hr;
     HKEY key;
 
-    if (!pSHGetFolderPathA)
-    {
-        win_skip("SHGetFolderPathA not present\n");
-        return;
-    }
     if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
 
-    hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path );
+    hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path );
     ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr );
-    hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
+    hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
     if (hr == E_FAIL)
     {
         win_skip( "Program Files (x86) not supported\n" );
@@ -1946,9 +1756,9 @@ static void test_SHGetFolderPathA(void)
         RegCloseKey( key );
     }
 
-    hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path );
+    hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path );
     ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr );
-    hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
+    hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
     if (hr == E_FAIL)
     {
         win_skip( "Common Files (x86) not supported\n" );
@@ -1993,17 +1803,7 @@ static void test_SHGetFolderPathAndSubDirA(void)
     static char testpath[MAX_PATH];
     static char toolongpath[MAX_PATH+1];
 
-    if(!pSHGetFolderPathAndSubDirA)
-    {
-        win_skip("SHGetFolderPathAndSubDirA not present!\n");
-        return;
-    }
-
-    if(!pSHGetFolderPathA) {
-        win_skip("SHGetFolderPathA not present!\n");
-        return;
-    }
-    if(FAILED(pSHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata)))
+    if(FAILED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata)))
     {
         win_skip("SHGetFolderPathA failed for CSIDL_LOCAL_APPDATA!\n");
         return;
@@ -2024,11 +1824,11 @@ static void test_SHGetFolderPathAndSubDirA(void)
     }
 
     /* test invalid second parameter */
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath);
     ok(E_INVALIDARG == ret, "expected E_INVALIDARG, got  %x\n", ret);
 
     /* test fourth parameter */
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath);
     switch(ret) {
         case S_OK: /* winvista */
             ok(!strncmp(appdata, testpath, strlen(appdata)),
@@ -2044,40 +1844,40 @@ static void test_SHGetFolderPathAndSubDirA(void)
 
     /* test fifth parameter */
     testpath[0] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath);
     ok(S_OK == ret, "expected S_OK, got %x\n", ret);
     ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
 
     testpath[0] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath);
     ok(S_OK == ret, "expected S_OK, got %x\n", ret);
     ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
 
     testpath[0] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath);
     ok(S_OK == ret, "expected S_OK, got %x\n", ret);
     ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
 
     for(i=0; i< MAX_PATH; i++)
         toolongpath[i] = '0' + i % 10;
     toolongpath[MAX_PATH] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath);
     ok(HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) == ret,
         "expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), ret);
 
     testpath[0] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL);
     ok((S_OK == ret) || (E_INVALIDARG == ret), "expected S_OK or E_INVALIDARG, got %x\n", ret);
 
     /* test a not existing path */
     testpath[0] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
     ok(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == ret,
         "expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), ret);
 
     /* create a directory inside a not existing directory */
     testpath[0] = '\0';
-    ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
+    ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
     ok(S_OK == ret, "expected S_OK, got %x\n", ret);
     ok(!strncmp(appdata, testpath, strlen(appdata)),
         "expected %s to start with %s\n", testpath, appdata);
@@ -2162,40 +1962,27 @@ static void test_LocalizedNames(void)
     hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER, &strret);
     ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
 
-    if (hr == S_OK && pStrRetToBufW)
-    {
-        hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
-        ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
-        todo_wine
-        ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
-            broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
-            "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
-    }
+    hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
+    ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+    todo_wine
+    ok (!lstrcmpiW(tempbufW, folderdisplayW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
 
     /* editing name is also read from the resource */
     hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FOREDITING, &strret);
     ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
 
-    if (hr == S_OK && pStrRetToBufW)
-    {
-        hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
-        ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
-        todo_wine
-        ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
-            broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
-            "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
-    }
+    hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
+    ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+    todo_wine
+    ok (!lstrcmpiW(tempbufW, folderdisplayW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
 
     /* parsing name is unchanged */
     hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FORPARSING, &strret);
     ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
 
-    if (hr == S_OK && pStrRetToBufW)
-    {
-        hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
-        ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
-        ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
-    }
+    hr = StrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
+    ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+    ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
 
     IShellFolder_Release(IDesktopFolder);
     IShellFolder_Release(testIShellFolder);
@@ -2234,16 +2021,8 @@ static void test_SHCreateShellItem(void)
         return;
     }
 
-    if(pSHGetSpecialFolderLocation)
-    {
-        ret = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
-        ok(ret == S_OK, "Got 0x%08x\n", ret);
-    }
-    else
-    {
-        win_skip("pSHGetSpecialFolderLocation missing.\n");
-        pidl_desktop = NULL;
-    }
+    ret = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+    ok(ret == S_OK, "Got 0x%08x\n", ret);
 
     MultiByteToWideChar(CP_ACP, 0, curdirA, -1, curdirW, MAX_PATH);
 
@@ -2261,7 +2040,7 @@ static void test_SHCreateShellItem(void)
     ret = IShellFolder_ParseDisplayName(currentfolder, NULL, NULL, testfileW, NULL, &pidl_testfile, NULL);
     ok(SUCCEEDED(ret), "ParseDisplayName returned %x\n", ret);
 
-    pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile);
+    pidl_abstestfile = ILCombine(pidl_cwd, pidl_testfile);
 
     shellitem = (void*)0xdeadbeef;
     ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem);
@@ -2289,7 +2068,7 @@ static void test_SHCreateShellItem(void)
             if (SUCCEEDED(ret))
             {
                 ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n");
-                pILFree(pidl_test);
+                ILFree(pidl_test);
             }
             IPersistIDList_Release(persistidl);
         }
@@ -2309,7 +2088,7 @@ static void test_SHCreateShellItem(void)
             if (SUCCEEDED(ret))
             {
                 ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n");
-                pILFree(pidl_test);
+                ILFree(pidl_test);
             }
             IPersistIDList_Release(persistidl);
         }
@@ -2327,7 +2106,7 @@ static void test_SHCreateShellItem(void)
                 if (SUCCEEDED(ret))
                 {
                     ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n");
-                    pILFree(pidl_test);
+                    ILFree(pidl_test);
                 }
                 IPersistIDList_Release(persistidl);
             }
@@ -2350,7 +2129,7 @@ static void test_SHCreateShellItem(void)
             if (SUCCEEDED(ret))
             {
                 ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n");
-                pILFree(pidl_test);
+                ILFree(pidl_test);
             }
             IPersistIDList_Release(persistidl);
         }
@@ -2371,7 +2150,7 @@ static void test_SHCreateShellItem(void)
             if (SUCCEEDED(ret))
             {
                 ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n");
-                pILFree(pidl_test);
+                ILFree(pidl_test);
             }
             IPersistIDList_Release(persistidl);
         }
@@ -2391,7 +2170,7 @@ static void test_SHCreateShellItem(void)
             if (SUCCEEDED(ret))
             {
                 ok(ILIsEqual(pidl_testfile, pidl_test), "id lists are not equal\n");
-                pILFree(pidl_test);
+                ILFree(pidl_test);
             }
             IPersistIDList_Release(persistidl);
         }
@@ -2476,7 +2255,7 @@ static void test_SHCreateShellItem(void)
                 if (SUCCEEDED(ret))
                 {
                     ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n");
-                    pILFree(pidl_test);
+                    ILFree(pidl_test);
                 }
                 IPersistIDList_Release(persistidl);
             }
@@ -2496,7 +2275,7 @@ static void test_SHCreateShellItem(void)
                 if (SUCCEEDED(ret))
                 {
                     ok(ILIsEqual(pidl_testfile, pidl_test), "id lists are not equal\n");
-                    pILFree(pidl_test);
+                    ILFree(pidl_test);
                 }
                 IPersistIDList_Release(persistidl);
             }
@@ -2573,7 +2352,7 @@ static void test_SHCreateShellItem(void)
             ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
             ok(ret == S_OK, "IShellItem_Compare fail: 0x%08x.\n", ret);
             ok(!order, "order got wrong value: %d.\n", order);
-            pILFree(pidl_desktop_testfile);
+            ILFree(pidl_desktop_testfile);
             IShellItem_Release(shellitem2);
 
             IShellItem_Release(shellitem);
@@ -2664,7 +2443,7 @@ static void test_SHCreateShellItem(void)
             ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
             ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret);
             ok(!order, "order got wrong value: %d.\n", order);
-            pILFree(pidl_desktop_testfile);
+            ILFree(pidl_desktop_testfile);
             IShellItem_Release(shellitem2);
 
             IShellItem_Release(shellitem);
@@ -2696,10 +2475,10 @@ static void test_SHCreateShellItem(void)
         win_skip("No SHCreateItemInKnownFolder or SHGetKnownFolderPath\n");
 
     DeleteFileA(".\\testfile");
-    pILFree(pidl_abstestfile);
-    pILFree(pidl_testfile);
-    pILFree(pidl_desktop);
-    pILFree(pidl_cwd);
+    ILFree(pidl_abstestfile);
+    ILFree(pidl_testfile);
+    ILFree(pidl_desktop);
+    ILFree(pidl_cwd);
     IShellFolder_Release(currentfolder);
     IShellFolder_Release(desktopfolder);
 }
@@ -2723,11 +2502,8 @@ static void test_SHGetNameFromIDList(void)
         return;
     }
 
-    /* These should be available on any platform that passed the above test. */
+    /* This should be available on any platform that passed the above test. */
     ok(pSHCreateShellItem != NULL, "SHCreateShellItem missing.\n");
-    ok(pSHBindToParent != NULL, "SHBindToParent missing.\n");
-    ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
-    ok(pStrRetToBufW != NULL, "StrRetToBufW missing.\n");
 
     if(0)
     {
@@ -2739,7 +2515,7 @@ static void test_SHGetNameFromIDList(void)
     ok(hres == E_INVALIDARG, "Got 0x%08x\n", hres);
 
     /* Test the desktop */
-    hres = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
+    hres = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
     ok(hres == S_OK, "Got 0x%08x\n", hres);
     hres = pSHCreateShellItem(NULL, NULL, pidl, &shellitem);
     ok(hres == S_OK, "Got 0x%08x\n", hres);
@@ -2767,7 +2543,7 @@ static void test_SHGetNameFromIDList(void)
 
             if(SUCCEEDED(hrSF))
             {
-                pStrRetToBufW(&strret, NULL, buf, MAX_PATH);
+                StrRetToBufW(&strret, NULL, buf, MAX_PATH);
                 if(SUCCEEDED(hrSI))
                     ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
                 if(SUCCEEDED(hrSF))
@@ -2778,16 +2554,13 @@ static void test_SHGetNameFromIDList(void)
         }
         IShellFolder_Release(psf);
 
-        if(pSHGetPathFromIDListW){
-            hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
-            ok(hrSI == S_OK, "Got 0x%08x\n", hrSI);
-            res = pSHGetPathFromIDListW(pidl, buf);
-            ok(res == TRUE, "Got %d\n", res);
-            if(SUCCEEDED(hrSI) && res)
-                ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
-            if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
-        }else
-            win_skip("pSHGetPathFromIDListW not available\n");
+        hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
+        ok(hrSI == S_OK, "Got 0x%08x\n", hrSI);
+        res = SHGetPathFromIDListW(pidl, buf);
+        ok(res == TRUE, "Got %d\n", res);
+        if(SUCCEEDED(hrSI) && res)
+            ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
+        if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
 
         hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string);
         todo_wine ok(hres == S_OK, "Got 0x%08x\n", hres);
@@ -2795,10 +2568,10 @@ static void test_SHGetNameFromIDList(void)
 
         IShellItem_Release(shellitem);
     }
-    pILFree(pidl);
+    ILFree(pidl);
 
     /* Test the control panel */
-    hres = pSHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl);
+    hres = SHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl);
     ok(hres == S_OK, "Got 0x%08x\n", hres);
     hres = pSHCreateShellItem(NULL, NULL, pidl, &shellitem);
     ok(hres == S_OK, "Got 0x%08x\n", hres);
@@ -2826,7 +2599,7 @@ static void test_SHGetNameFromIDList(void)
 
             if(SUCCEEDED(hrSF))
             {
-                pStrRetToBufW(&strret, NULL, buf, MAX_PATH);
+                StrRetToBufW(&strret, NULL, buf, MAX_PATH);
                 if(SUCCEEDED(hrSI))
                     ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
                 if(SUCCEEDED(hrSF))
@@ -2837,16 +2610,13 @@ static void test_SHGetNameFromIDList(void)
         }
         IShellFolder_Release(psf);
 
-        if(pSHGetPathFromIDListW){
-            hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
-            ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI);
-            res = pSHGetPathFromIDListW(pidl, buf);
-            ok(res == FALSE, "Got %d\n", res);
-            if(SUCCEEDED(hrSI) && res)
-                ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
-            if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
-        }else
-            win_skip("pSHGetPathFromIDListW not available\n");
+        hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
+        ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI);
+        res = SHGetPathFromIDListW(pidl, buf);
+        ok(res == FALSE, "Got %d\n", res);
+        if(SUCCEEDED(hrSI) && res)
+            ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
+        if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
 
         hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string);
         todo_wine ok(hres == E_NOTIMPL /* Win7 */ || hres == S_OK /* Vista */,
@@ -2855,7 +2625,7 @@ static void test_SHGetNameFromIDList(void)
 
         IShellItem_Release(shellitem);
     }
-    pILFree(pidl);
+    ILFree(pidl);
 }
 
 static void test_SHGetItemFromDataObject(void)
@@ -2960,7 +2730,7 @@ static void test_SHGetItemFromDataObject(void)
                 skip("zero or one file found - skipping multi-file test.\n");
 
             for(i = 0; i < count; i++)
-                pILFree(apidl[i]);
+                ILFree(apidl[i]);
 
             IEnumIDList_Release(peidl);
         }
@@ -3035,7 +2805,7 @@ static void test_ShellItemCompare(void)
         {
             hr = pSHCreateShellItem(NULL, NULL, pidl_testfile, &psi[i]);
             ok(hr == S_OK, "Got 0x%08x\n", hr);
-            pILFree(pidl_testfile);
+            ILFree(pidl_testfile);
         }
         if(FAILED(hr)) failed = TRUE;
     }
@@ -3270,8 +3040,6 @@ static void test_SHGetIDListFromObject(void)
         return;
     }
 
-    ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
-
     if(0)
     {
         /* Crashes native */
@@ -3282,7 +3050,7 @@ static void test_SHGetIDListFromObject(void)
     hres = pSHGetIDListFromObject(NULL, &pidl);
     ok(hres == E_NOINTERFACE, "Got %x\n", hres);
 
-    punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl));
+    punkimpl = heap_alloc(sizeof(*punkimpl));
     punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown;
     punkimpl->ifaces = ifaces;
     punkimpl->unknown = 0;
@@ -3299,10 +3067,10 @@ static void test_SHGetIDListFromObject(void)
        "interface not requested.\n");
 
     ok(!punkimpl->unknown, "Got %d unknown.\n", punkimpl->unknown);
-    HeapFree(GetProcessHeap(), 0, punkimpl);
+    heap_free(punkimpl);
 
     pidl_desktop = NULL;
-    pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+    SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
     ok(pidl_desktop != NULL, "Failed to get desktop pidl.\n");
 
     SHGetDesktopFolder(&psfdesktop);
@@ -3320,7 +3088,7 @@ static void test_SHGetIDListFromObject(void)
             if(SUCCEEDED(hres))
             {
                 ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n");
-                pILFree(pidl);
+                ILFree(pidl);
             }
             IShellItem_Release(shellitem);
         }
@@ -3334,7 +3102,7 @@ static void test_SHGetIDListFromObject(void)
     if(SUCCEEDED(hres))
     {
         ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n");
-        pILFree(pidl);
+        ILFree(pidl);
     }
 
     hres = IShellFolder_CreateViewObject(psfdesktop, NULL, &IID_IShellView, (void**)&psv);
@@ -3351,7 +3119,7 @@ static void test_SHGetIDListFromObject(void)
         if(SUCCEEDED(hres))
         {
             ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n");
-            pILFree(pidl);
+            ILFree(pidl);
         }
 
         /* Test IDataObject */
@@ -3378,7 +3146,7 @@ static void test_SHGetIDListFromObject(void)
                     ok(hres == S_OK, "got 0x%08x\n", hres);
                     ok(pidl != NULL, "pidl is NULL.\n");
                     ok(ILIsEqual(pidl, apidl[0]), "pidl not equal.\n");
-                    pILFree(pidl);
+                    ILFree(pidl);
 
                     IDataObject_Release(pdo);
                 }
@@ -3406,7 +3174,7 @@ static void test_SHGetIDListFromObject(void)
                 skip("zero or one file found - skipping multi-file test.\n");
 
             for(i = 0; i < count; i++)
-                pILFree(apidl[i]);
+                ILFree(apidl[i]);
 
             IEnumIDList_Release(peidl);
         }
@@ -3415,7 +3183,7 @@ static void test_SHGetIDListFromObject(void)
     }
 
     IShellFolder_Release(psfdesktop);
-    pILFree(pidl_desktop);
+    ILFree(pidl_desktop);
 }
 
 static void test_SHGetItemFromObject(void)
@@ -3453,7 +3221,7 @@ static void test_SHGetItemFromObject(void)
     hres = pSHGetItemFromObject(NULL, &IID_IUnknown, (void**)&punk);
     ok(hres == E_NOINTERFACE, "Got 0x%08x\n", hres);
 
-    punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl));
+    punkimpl = heap_alloc(sizeof(*punkimpl));
     punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown;
     punkimpl->ifaces = ifaces;
     punkimpl->unknown = 0;
@@ -3471,7 +3239,7 @@ static void test_SHGetItemFromObject(void)
        "interface not requested.\n");
 
     ok(!punkimpl->unknown, "Got %d unknown.\n", punkimpl->unknown);
-    HeapFree(GetProcessHeap(), 0, punkimpl);
+    heap_free(punkimpl);
 
     /* Test IShellItem */
     hres = pSHGetItemFromObject((IUnknown*)psfdesktop, &IID_IShellItem, (void**)&psi);
@@ -3508,8 +3276,6 @@ static void test_SHCreateShellItemArray(void)
         return;
     }
 
-    ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
-
     if(0)
     {
         /* Crashes under native */
@@ -3529,10 +3295,10 @@ static void test_SHCreateShellItemArray(void)
     hr = pSHCreateShellItemArray(NULL, pdesktopsf, 1, NULL, &psia);
     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
 
-    pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
+    SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
     hr = pSHCreateShellItemArray(pidl, NULL, 0, NULL, &psia);
     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
-    pILFree(pidl);
+    ILFree(pidl);
 
     GetCurrentDirectoryW(MAX_PATH, cTestDirW);
     myPathAddBackslashW(cTestDirW);
@@ -3553,7 +3319,7 @@ static void test_SHCreateShellItemArray(void)
     if(FAILED(hr))
     {
         skip("Failed to set up environment for SHCreateShellItemArray tests.\n");
-        pILFree(pidl_testdir);
+        ILFree(pidl_testdir);
         Cleanup();
         return;
     }
@@ -3605,14 +3371,14 @@ static void test_SHCreateShellItemArray(void)
                     if(SUCCEEDED(hr))
                     {
                         ok(ILIsEqual(pidl_abs, pidl), "Pidl not equal.\n");
-                        pILFree(pidl);
+                        ILFree(pidl);
                     }
                     IShellItem_Release(psi);
                 }
-                pILFree(pidl_abs);
+                ILFree(pidl_abs);
             }
             for(i = 0; i < done; i++)
-                pILFree(apidl[i]);
+                ILFree(apidl[i]);
             IShellItemArray_Release(psia);
         }
     }
@@ -3657,8 +3423,8 @@ static void test_SHCreateShellItemArray(void)
                     ok(hr == S_OK, "Got 0x%08x\n", hr);
                     ok(pidl2 != NULL, "pidl2 was null.\n");
                     ok(ILIsEqual(pidl1, pidl2), "pidls not equal.\n");
-                    pILFree(pidl1);
-                    pILFree(pidl2);
+                    ILFree(pidl1);
+                    ILFree(pidl2);
                     IShellItem_Release(psi2);
                 }
                 hr = IShellItemArray_GetItemAt(psia, 1, &psi2);
@@ -3733,10 +3499,10 @@ static void test_SHCreateShellItemArray(void)
                                     ok(hr == S_OK, "Got 0x%08x\n", hr);
                                     ok(pidl != NULL, "pidl as NULL.\n");
                                     ok(ILIsEqual(pidl, pidl_abs), "pidls differ.\n");
-                                    pILFree(pidl);
+                                    ILFree(pidl);
                                     IShellItem_Release(psi);
                                 }
-                                pILFree(pidl_abs);
+                                ILFree(pidl_abs);
                             }
 
                             IShellItemArray_Release(psia);
@@ -3745,7 +3511,7 @@ static void test_SHCreateShellItemArray(void)
                         IDataObject_Release(pdo);
                     }
                     for(i = 0; i < count; i++)
-                        pILFree(apidl[i]);
+                        ILFree(apidl[i]);
                 }
                 else
                     skip("No files found - skipping test.\n");
@@ -3824,7 +3590,7 @@ static void test_SHCreateShellItemArray(void)
                 WCHAR desktoppath[MAX_PATH];
                 BOOL result;
 
-                result = pSHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE);
+                result = SHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE);
                 ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u\n", GetLastError());
 
                 hr = IShellItem_GetDisplayName(psi, SIGDN_DESKTOPABSOLUTEPARSING, &path);
@@ -3929,7 +3695,7 @@ static void test_SHCreateShellItemArray(void)
                 IShellItemArray_Release(psia);
             }
 
-            pILFree(pidltest1);
+            ILFree(pidltest1);
         }
 
         IShellFolder_Release(pdesktopsf);
@@ -3938,7 +3704,7 @@ static void test_SHCreateShellItemArray(void)
         skip("No SHCreateShellItemArrayFromIDLists.\n");
 
     IShellFolder_Release(psf);
-    pILFree(pidl_testdir);
+    ILFree(pidl_testdir);
     Cleanup();
 }
 
@@ -3972,7 +3738,7 @@ static void test_ShellItemArrayEnumItems(void)
         hr = IShellFolder_BindToObject(pdesktopsf, pidl_testdir, NULL, (REFIID)&IID_IShellFolder,
                                        (void**)&psf);
         ok(hr == S_OK, "Got 0x%08x\n", hr);
-        pILFree(pidl_testdir);
+        ILFree(pidl_testdir);
     }
     IShellFolder_Release(pdesktopsf);
     if (FAILED(hr)) return;
@@ -4091,7 +3857,7 @@ static void test_ShellItemArrayEnumItems(void)
         }
 
         for(i = 0; i < done; i++)
-            pILFree(apidl[i]);
+            ILFree(apidl[i]);
     }
 }
 
@@ -4108,7 +3874,7 @@ static void test_ShellItemBindToHandler(void)
         return;
     }
 
-    hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+    hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
     ok(hr == S_OK, "Got 0x%08x\n", hr);
     if(SUCCEEDED(hr))
     {
@@ -4143,7 +3909,7 @@ static void test_ShellItemBindToHandler(void)
             if(SUCCEEDED(hr))
             {
                 ok(ILIsEqual(pidl_desktop, pidl_tmp), "Pidl not equal (%p, %p)\n", pidl_desktop, pidl_tmp);
-                pILFree(pidl_tmp);
+                ILFree(pidl_tmp);
             }
             IPersistFolder2_Release(ppf2);
         }
@@ -4257,7 +4023,7 @@ static void test_ShellItemBindToHandler(void)
     else
         skip("Failed to create ShellItem.\n");
 
-    pILFree(pidl_desktop);
+    ILFree(pidl_desktop);
 }
 
 static void test_ShellItemGetAttributes(void)
@@ -4278,13 +4044,13 @@ static void test_ShellItemGetAttributes(void)
         return;
     }
 
-    hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+    hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
     ok(hr == S_OK, "Got 0x%08x\n", hr);
     if(SUCCEEDED(hr))
     {
         hr = pSHCreateShellItem(NULL, NULL, pidl_desktop, &psi);
         ok(hr == S_OK, "Got 0x%08x\n", hr);
-        pILFree(pidl_desktop);
+        ILFree(pidl_desktop);
     }
     if(FAILED(hr))
     {
@@ -4319,7 +4085,7 @@ static void test_ShellItemGetAttributes(void)
     ok(hr == S_OK, "got 0x%08x\n", hr);
     hr = pSHCreateShellItem(NULL, NULL, pidl, &psi_folder1);
     ok(hr == S_OK, "Got 0x%08x\n", sfgao);
-    pILFree(pidl);
+    ILFree(pidl);
 
     lstrcpyW(buf, curdirW);
     lstrcatW(buf, testfile1W);
@@ -4327,7 +4093,7 @@ static void test_ShellItemGetAttributes(void)
     ok(hr == S_OK, "got 0x%08x\n", hr);
     hr = pSHCreateShellItem(NULL, NULL, pidl, &psi_file1);
     ok(hr == S_OK, "Got 0x%08x\n", sfgao);
-    pILFree(pidl);
+    ILFree(pidl);
 
     IShellFolder_Release(pdesktopsf);
 
@@ -4402,7 +4168,7 @@ static void test_ShellItemArrayGetAttributes(void)
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
     for(i = 0; i < 5; i++)
-        pILFree((LPITEMIDLIST)pidl_array[i]);
+        ILFree((LPITEMIDLIST)pidl_array[i]);
 
     /* [testfolder/, testfolder/testfolder2] seems to break in Vista */
     attr = 0xdeadbeef;
@@ -4480,71 +4246,65 @@ static void test_SHParseDisplayName(void)
     HRESULT hr;
     BOOL ret, is_wow64;
 
-    if (!pSHParseDisplayName)
-    {
-        win_skip("SHParseDisplayName isn't available\n");
-        return;
-    }
-
 if (0)
 {
     /* crashes on native */
-    pSHParseDisplayName(NULL, NULL, NULL, 0, NULL);
+    SHParseDisplayName(NULL, NULL, NULL, 0, NULL);
     nameW[0] = 0;
-    pSHParseDisplayName(nameW, NULL, NULL, 0, NULL);
+    SHParseDisplayName(nameW, NULL, NULL, 0, NULL);
 }
 
     pidl1 = (LPITEMIDLIST)0xdeadbeef;
-    hr = pSHParseDisplayName(NULL, NULL, &pidl1, 0, NULL);
+    hr = SHParseDisplayName(NULL, NULL, &pidl1, 0, NULL);
     ok(broken(hr == E_OUTOFMEMORY) /* < Vista */ ||
        hr == E_INVALIDARG, "failed %08x\n", hr);
     ok(pidl1 == 0, "expected null ptr, got %p\n", pidl1);
 
     /* dummy name */
     nameW[0] = 0;
-    hr = pSHParseDisplayName(nameW, NULL, &pidl1, 0, NULL);
+    hr = SHParseDisplayName(nameW, NULL, &pidl1, 0, NULL);
     ok(hr == S_OK, "failed %08x\n", hr);
     hr = SHGetDesktopFolder(&desktop);
     ok(hr == S_OK, "failed %08x\n", hr);
     hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, nameW, NULL, &pidl2, NULL);
     ok(hr == S_OK, "failed %08x\n", hr);
-    ret = pILIsEqual(pidl1, pidl2);
+    ret = ILIsEqual(pidl1, pidl2);
     ok(ret == TRUE, "expected equal idls\n");
-    pILFree(pidl1);
-    pILFree(pidl2);
+    ILFree(pidl1);
+    ILFree(pidl2);
 
     /* with path */
     GetWindowsDirectoryW( dirW, MAX_PATH );
 
-    hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
+    hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
     ok(hr == S_OK, "failed %08x\n", hr);
     hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, dirW, NULL, &pidl2, NULL);
     ok(hr == S_OK, "failed %08x\n", hr);
 
-    ret = pILIsEqual(pidl1, pidl2);
+    ret = ILIsEqual(pidl1, pidl2);
     ok(ret == TRUE, "expected equal idls\n");
-    pILFree(pidl1);
-    pILFree(pidl2);
+    ILFree(pidl1);
+    ILFree(pidl2);
 
     /* system32 is not redirected to syswow64 on WOW64 */
     if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
-    if (is_wow64 && pGetSystemWow64DirectoryW)
+    if (is_wow64)
     {
         UINT len;
         *dirW = 0;
         len = GetSystemDirectoryW(dirW, MAX_PATH);
         ok(len > 0, "GetSystemDirectoryW failed: %u\n", GetLastError());
-        hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
+        hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
         ok(hr == S_OK, "failed %08x\n", hr);
         *dirW = 0;
-        len = pGetSystemWow64DirectoryW(dirW, MAX_PATH);
+        len = GetSystemWow64DirectoryW(dirW, MAX_PATH);
         ok(len > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError());
-        hr = pSHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
+        hr = SHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
         ok(hr == S_OK, "failed %08x\n", hr);
-        ret = pILIsEqual(pidl1, pidl2);
+        ret = ILIsEqual(pidl1, pidl2);
         ok(ret == FALSE, "expected different idls\n");
-        pILFree(pidl1);
-        pILFree(pidl2);
+        ILFree(pidl1);
+        ILFree(pidl2);
     }
 
     IShellFolder_Release(desktop);
@@ -4554,9 +4314,9 @@ if (0)
         skip("No empty cdrom drive found, skipping test\n");
     else
     {
-        hr = pSHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
+        hr = SHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
         ok(hr == S_OK, "failed %08x\n", hr);
-        if (SUCCEEDED(hr)) pILFree(pidl1);
+        if (SUCCEEDED(hr)) ILFree(pidl1);
     }
 }
 
@@ -4572,7 +4332,7 @@ static void test_desktop_IPersist(void)
     ok(hr == S_OK, "failed %08x\n", hr);
 
     hr = IShellFolder_QueryInterface(desktop, &IID_IPersist, (void**)&persist);
-    ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* NT4, W9X */, "failed %08x\n", hr);
+    ok(hr == S_OK, "failed %08x\n", hr);
 
     if (hr == S_OK)
     {
@@ -4608,7 +4368,7 @@ static void test_desktop_IPersist(void)
         hr = IPersistFolder2_GetCurFolder(ppf2, &pidl);
         ok(hr == S_OK, "got %08x\n", hr);
         ok(pidl != NULL, "pidl was NULL.\n");
-        if(SUCCEEDED(hr)) pILFree(pidl);
+        if(SUCCEEDED(hr)) ILFree(pidl);
 
         IPersistFolder2_Release(ppf2);
     }
@@ -4616,6 +4376,103 @@ static void test_desktop_IPersist(void)
     IShellFolder_Release(desktop);
 }
 
+static void test_contextmenu_qi(IContextMenu *menu, BOOL todo)
+{
+    IUnknown *unk;
+    HRESULT hr;
+
+    hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk);
+todo_wine_if(todo)
+    ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
+if (hr == S_OK)
+    IUnknown_Release(unk);
+
+    hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk);
+todo_wine_if(todo)
+    ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
+if (hr == S_OK)
+    IUnknown_Release(unk);
+}
+
+static void test_contextmenu(IContextMenu *menu, BOOL background)
+{
+    HMENU hmenu = CreatePopupMenu();
+    const int id_upper_limit = 32767;
+    const int baseItem = 0x40;
+    INT max_id, max_id_check;
+    UINT count, i;
+    HRESULT hr;
+
+    test_contextmenu_qi(menu, FALSE);
+
+    hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
+    ok(SUCCEEDED(hr), "Failed to query the menu, hr %#x.\n", hr);
+
+    max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */
+    ok(max_id <= id_upper_limit, "Got %d\n", max_id);
+    count = GetMenuItemCount(hmenu);
+    ok(count, "Got %d\n", count);
+
+    max_id_check = 0;
+    for (i = 0; i < count; i++)
+    {
+        MENUITEMINFOA mii;
+        INT res;
+        char buf[255], buf2[255];
+        ZeroMemory(&mii, sizeof(MENUITEMINFOA));
+        mii.cbSize = sizeof(MENUITEMINFOA);
+        mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
+        mii.dwTypeData = buf2;
+        mii.cch = sizeof(buf2);
+
+        res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
+        ok(res, "Failed to get menu item info, error %d.\n", GetLastError());
+
+        ok((mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR),
+            "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType);
+        if (!(mii.fType & MFT_SEPARATOR))
+        {
+            max_id_check = (mii.wID > max_id_check) ? mii.wID : max_id_check;
+            hr = IContextMenu_GetCommandString(menu, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf));
+        todo_wine_if(background)
+            ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData);
+            if (SUCCEEDED(hr))
+                trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData);
+            else if (hr == E_NOTIMPL)
+                trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData);
+        }
+    }
+    max_id_check -= baseItem;
+    ok((max_id_check == max_id) ||
+       (max_id_check == max_id-1) || /* Win 7 */
+       (max_id_check == max_id-2) || /* Win 8 */
+       (max_id_check == max_id-3),
+       "Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
+
+    if (count)
+    {
+        CMINVOKECOMMANDINFO cmi;
+
+        memset(&cmi, 0, sizeof(CMINVOKECOMMANDINFO));
+        cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
+
+        /* Attempt to execute a nonexistent command */
+        cmi.lpVerb = MAKEINTRESOURCEA(9999);
+        hr = IContextMenu_InvokeCommand(menu, &cmi);
+    todo_wine_if(background)
+        ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
+
+        cmi.lpVerb = "foobar_wine_test";
+        hr = IContextMenu_InvokeCommand(menu, &cmi);
+    todo_wine_if(background)
+        ok((hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) ||
+           (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */),
+            "Unexpected hr %#x.\n", hr);
+    }
+
+    DestroyMenu(hmenu);
+}
+
 static void test_GetUIObject(void)
 {
     IShellFolder *psf_desktop;
@@ -4625,12 +4482,8 @@ static void test_GetUIObject(void)
     WCHAR path[MAX_PATH];
     const WCHAR filename[] =
         {'\\','t','e','s','t','d','i','r','\\','t','e','s','t','1','.','t','x','t',0};
-
-    if(!pSHBindToParent)
-    {
-        win_skip("SHBindToParent missing.\n");
-        return;
-    }
+    LPCITEMIDLIST pidl_child;
+    IShellFolder *psf;
 
     GetCurrentDirectoryW(MAX_PATH, path);
     if (!path[0])
@@ -4644,95 +4497,25 @@ static void test_GetUIObject(void)
     CreateFilesFolders();
 
     hr = IShellFolder_ParseDisplayName(psf_desktop, NULL, NULL, path, NULL, &pidl, 0);
-    ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr);
-    if(SUCCEEDED(hr))
-    {
-        IShellFolder *psf;
-        LPCITEMIDLIST pidl_child;
-        hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&psf, &pidl_child);
-        ok(hr == S_OK, "Got 0x%08x\n", hr);
-        if(SUCCEEDED(hr))
-        {
-            hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL,
-                                            (void**)&pcm);
-            ok(hr == S_OK, "Got 0x%08x\n", hr);
-            if(SUCCEEDED(hr))
-            {
-                const int baseItem = 0x40;
-                HMENU hmenu = CreatePopupMenu();
-                INT max_id, max_id_check;
-                UINT count, i;
-                const int id_upper_limit = 32767;
-                hr = IContextMenu_QueryContextMenu(pcm, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
-                ok(SUCCEEDED(hr), "Got 0x%08x\n", hr);
-                max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */
-                ok(max_id <= id_upper_limit, "Got %d\n", max_id);
-                count = GetMenuItemCount(hmenu);
-                ok(count, "Got %d\n", count);
-
-                max_id_check = 0;
-                for(i = 0; i < count; i++)
-                {
-                    MENUITEMINFOA mii;
-                    INT res;
-                    char buf[255], buf2[255];
-                    ZeroMemory(&mii, sizeof(MENUITEMINFOA));
-                    mii.cbSize = sizeof(MENUITEMINFOA);
-                    mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
-                    mii.dwTypeData = buf2;
-                    mii.cch = sizeof(buf2);
-
-                    SetLastError(0);
-                    res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
-                    ok(res, "Failed (last error: %d).\n", GetLastError());
-
-                    ok( (mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR),
-                        "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType);
-                    if(!(mii.fType & MFT_SEPARATOR))
-                    {
-                        max_id_check = (mii.wID>max_id_check)?mii.wID:max_id_check;
-                        hr = IContextMenu_GetCommandString(pcm, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf));
-                        ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData);
-                        if (SUCCEEDED(hr))
-                            trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData);
-                        else if (hr == E_NOTIMPL)
-                            trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData);
-                    }
-                }
-                max_id_check -= baseItem;
-                ok((max_id_check == max_id) ||
-                   (max_id_check == max_id-1) || /* Win 7 */
-                   (max_id_check == max_id-2),   /* Win 8 */
-                   "Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
 
-#define is_win2k() (pSHGetFolderPathA && !pSHGetFolderPathAndSubDirA)
+    hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&psf, &pidl_child);
+    ok(hr == S_OK, "Failed to bind to folder, hr %#x.\n", hr);
 
-                if(count && !is_win2k())   /* Test is interactive on w2k, so skip */
-                {
-                    CMINVOKECOMMANDINFO cmi;
-                    ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO));
-                    cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
-
-                    /* Attempt to execute a nonexistent command */
-                    cmi.lpVerb = MAKEINTRESOURCEA(9999);
-                    hr = IContextMenu_InvokeCommand(pcm, &cmi);
-                    ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
-
-                    cmi.lpVerb = "foobar_wine_test";
-                    hr = IContextMenu_InvokeCommand(pcm, &cmi);
-                    ok( (hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) ||
-                        (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */),
-                        "Got 0x%08x\n", hr);
-                }
-#undef is_win2k
+    /* Item menu */
+    hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, (void **)&pcm);
+    ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr);
+    test_contextmenu(pcm, FALSE);
+    IContextMenu_Release(pcm);
 
-                DestroyMenu(hmenu);
-                IContextMenu_Release(pcm);
-            }
-            IShellFolder_Release(psf);
-        }
-        if(pILFree) pILFree(pidl);
-    }
+    /* Background menu */
+    hr = IShellFolder_GetUIObjectOf(psf_desktop, NULL, 0, NULL, &IID_IContextMenu, NULL, (void **)&pcm);
+    ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr);
+    test_contextmenu(pcm, TRUE);
+    IContextMenu_Release(pcm);
+
+    IShellFolder_Release(psf);
+    ILFree(pidl);
 
     IShellFolder_Release(psf_desktop);
     Cleanup();
@@ -4746,22 +4529,13 @@ static void r_verify_pidl(unsigned l, LPCITEMIDLIST pidl, const WCHAR *path)
     STRRET filename;
     HRESULT hr;
 
-    if(!pSHBindToParent){
-        win_skip("SHBindToParent is not available, not performing full PIDL verification\n");
-        if(path)
-            ok_(__FILE__,l)(pidl != NULL, "Expected PIDL to be non-NULL\n");
-        else
-            ok_(__FILE__,l)(pidl == NULL, "Expected PIDL to be NULL\n");
-        return;
-    }
-
     if(path){
         if(!pidl){
             ok_(__FILE__,l)(0, "didn't get expected path (%s), instead: NULL\n", wine_dbgstr_w(path));
             return;
         }
 
-        hr = pSHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&parent, &child);
+        hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&parent, &child);
         ok_(__FILE__,l)(hr == S_OK, "SHBindToParent failed: 0x%08x\n", hr);
         if(FAILED(hr))
             return;
@@ -4799,30 +4573,25 @@ static void test_SHSimpleIDListFromPath(void)
 
     LPITEMIDLIST pidl = NULL;
 
-    if(!pSHSimpleIDListFromPathAW){
-        win_skip("SHSimpleIDListFromPathAW not available\n");
-        return;
-    }
-
     br = CreateDirectoryA(adirA, NULL);
     ok(br == TRUE, "CreateDirectory failed: %d\n", GetLastError());
 
     if(is_unicode)
-        pidl = pSHSimpleIDListFromPathAW(adirW);
+        pidl = SHSimpleIDListFromPath(adirW);
     else
-        pidl = pSHSimpleIDListFromPathAW(adirA);
+        pidl = SHSimpleIDListFromPath((const WCHAR *)adirA);
     verify_pidl(pidl, adirW);
-    pILFree(pidl);
+    ILFree(pidl);
 
     br = RemoveDirectoryA(adirA);
     ok(br == TRUE, "RemoveDirectory failed: %d\n", GetLastError());
 
     if(is_unicode)
-        pidl = pSHSimpleIDListFromPathAW(adirW);
+        pidl = SHSimpleIDListFromPath(adirW);
     else
-        pidl = pSHSimpleIDListFromPathAW(adirA);
+        pidl = SHSimpleIDListFromPath((const WCHAR *)adirA);
     verify_pidl(pidl, adirW);
-    pILFree(pidl);
+    ILFree(pidl);
 }
 
 /* IFileSystemBindData impl */
@@ -4933,28 +4702,22 @@ static void test_ParseDisplayNamePBC(void)
 
     /* fails on unknown dir with no IBindCtx */
     hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, adirW, NULL, &pidl, NULL);
-    ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+    ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
     hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, afileW, NULL, &pidl, NULL);
-    ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+    ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
     hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, afile2W, NULL, &pidl, NULL);
-    ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+    ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
 
     /* fails on unknown dir with IBindCtx with no IFileSystemBindData */
     hres = CreateBindCtx(0, &pbc);
     ok(hres == S_OK, "CreateBindCtx failed: 0x%08x\n", hres);
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
-    ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+    ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
-    ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+    ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
-    ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+    ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
 
     /* unknown dir with IBindCtx with IFileSystemBindData */
     hres = IBindCtx_RegisterObjectParam(pbc, wFileSystemBindData, (IUnknown*)&fsbd);
@@ -4964,24 +4727,21 @@ static void test_ParseDisplayNamePBC(void)
     pidl = (ITEMIDLIST*)0xdeadbeef;
     fsbdVtbl.GetFindData = fsbd_GetFindData_fail;
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, adirW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afileW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afile2W);
         ILFree(pidl);
@@ -4991,24 +4751,21 @@ static void test_ParseDisplayNamePBC(void)
     pidl = (ITEMIDLIST*)0xdeadbeef;
     fsbdVtbl.GetFindData = fsbd_GetFindData_nul;
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, adirW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afileW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afile2W);
         ILFree(pidl);
@@ -5018,24 +4775,21 @@ static void test_ParseDisplayNamePBC(void)
     pidl = (ITEMIDLIST*)0xdeadbeef;
     fsbdVtbl.GetFindData = fsbd_GetFindData_junk;
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, adirW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afileW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afile2W);
         ILFree(pidl);
@@ -5045,24 +4799,21 @@ static void test_ParseDisplayNamePBC(void)
     pidl = (ITEMIDLIST*)0xdeadbeef;
     fsbdVtbl.GetFindData = fsbd_GetFindData_invalid;
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, adirW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afileW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afile2W);
         ILFree(pidl);
@@ -5072,24 +4823,21 @@ static void test_ParseDisplayNamePBC(void)
     pidl = (ITEMIDLIST*)0xdeadbeef;
     fsbdVtbl.GetFindData = fsbd_GetFindData_valid;
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, adirW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afileW);
         ILFree(pidl);
     }
 
     hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
-            "ParseDisplayName failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
     if(SUCCEEDED(hres)){
         verify_pidl(pidl, afile2W);
         ILFree(pidl);
@@ -5143,8 +4891,8 @@ static LRESULT CALLBACK testwindow_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L
             path2 = make_wstr(exp_data->path_2);
             verify_pidl(pidls[0], path1);
             verify_pidl(pidls[1], path2);
-            HeapFree(GetProcessHeap(), 0, path1);
-            HeapFree(GetProcessHeap(), 0, path2);
+            heap_free(path1);
+            heap_free(path2);
 
             exp_data->missing_events--;
 
@@ -5220,9 +4968,9 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
 
     entries[0].pidl = NULL;
     if(has_unicode)
-        hr = pSHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
+        hr = SHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
     else
-        hr = pSHILCreateFromPath((LPCVOID)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0);
+        hr = SHILCreateFromPath((const void *)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0);
     ok(hr == S_OK, "SHILCreateFromPath failed: 0x%08x\n", hr);
     entries[0].fRecursive = TRUE;
 
@@ -5251,8 +4999,8 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
             do_events();
             ok(exp_data->missing_events == 0, "%s: Expected wndproc to be called\n", exp_data->id);
 
-            HeapFree(GetProcessHeap(), 0, path1);
-            HeapFree(GetProcessHeap(), 0, path2);
+            heap_free(path1);
+            heap_free(path2);
         }
     }
 
@@ -5284,12 +5032,6 @@ static void test_SHCreateDefaultContextMenu(void)
         return;
     }
 
-    if(!pSHBindToParent)
-    {
-        skip("SHBindToParent missing.\n");
-        return;
-    }
-
     GetCurrentDirectoryW(MAX_PATH, path);
     if (!path[0])
     {
@@ -5302,11 +5044,10 @@ static void test_SHCreateDefaultContextMenu(void)
     CreateFilesFolders();
 
     hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, path, NULL, &pidl, 0);
-    ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
     if(SUCCEEDED(hr))
     {
-
-        hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&folder, (LPCITEMIDLIST*)&pidl_child);
+        hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&folder, (const ITEMIDLIST **)&pidl_child);
         ok(hr == S_OK, "Got 0x%08x\n", hr);
 
         IShellFolder_QueryInterface(folder,&IID_IPersistFolder2,(void**)&persist);
@@ -5314,7 +5055,6 @@ static void test_SHCreateDefaultContextMenu(void)
         IPersistFolder2_Release(persist);
         if(SUCCEEDED(hr))
         {
-
             cminfo.hwnd=NULL;
             cminfo.pcmcb=NULL;
             cminfo.psf=folder;
@@ -5324,13 +5064,18 @@ static void test_SHCreateDefaultContextMenu(void)
             cminfo.aKeys=NULL;
             cminfo.cKeys=0;
             cminfo.punkAssociationInfo=NULL;
+
             hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu);
             ok(hr==S_OK,"Got 0x%08x\n", hr);
+            test_contextmenu_qi(cmenu, TRUE);
             IContextMenu_Release(cmenu);
+
             cminfo.pidlFolder=pidlFolder;
             hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu);
             ok(hr==S_OK,"Got 0x%08x\n", hr);
+            test_contextmenu_qi(cmenu, TRUE);
             IContextMenu_Release(cmenu);
+
             status = RegOpenKeyExA(HKEY_CLASSES_ROOT,"*",0,KEY_READ,keys);
             if(status==ERROR_SUCCESS){
                 for(i=1;i<16;i++)
@@ -5379,7 +5124,7 @@ static void test_DataObject(void)
     hres = IShellFolder_GetUIObjectOf(desktop, NULL, 1, (LPCITEMIDLIST*)&apidl,
             &IID_IDataObject, NULL, (void**)&data_obj);
     ok(hres == S_OK, "got %x\n", hres);
-    pILFree(apidl);
+    ILFree(apidl);
     IShellFolder_Release(desktop);
 
     cf_shellidlist = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
@@ -5408,11 +5153,110 @@ static void test_DataObject(void)
     IDataObject_Release(data_obj);
 }
 
+static void test_GetDefaultColumn(void)
+{
+    static const CLSID *folders[] =
+    {
+        &CLSID_MyComputer,
+        &CLSID_MyDocuments,
+        &CLSID_ControlPanel,
+        &CLSID_NetworkPlaces,
+        &CLSID_Printers,
+        &CLSID_RecycleBin,
+        &CLSID_ShellDesktop,
+    };
+    HRESULT hr;
+    int i;
+
+    CoInitialize(NULL);
+
+    for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++)
+    {
+        IShellFolder2 *folder;
+        ULONG sort, display;
+
+        hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder);
+        if (hr != S_OK)
+        {
+            win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr);
+            continue;
+        }
+
+        hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, NULL);
+        ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+
+        sort = display = 123;
+        hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, &display);
+        ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+        ok(sort == 123 && display == 123, "Unexpected default column.\n");
+
+        display = 123;
+        hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, &display);
+        ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+        ok(display == 123, "Unexpected default column.\n");
+
+        sort = 123;
+        hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, NULL);
+        ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+        ok(sort == 123, "Unexpected default column.\n");
+    }
+
+    CoUninitialize();
+}
+
+static void test_GetDefaultSearchGUID(void)
+{
+    static const CLSID *folders[] =
+    {
+        &CLSID_MyComputer,
+        &CLSID_MyDocuments,
+        &CLSID_ControlPanel,
+        &CLSID_NetworkPlaces,
+        &CLSID_Printers,
+        &CLSID_RecycleBin,
+        &CLSID_ShellDesktop,
+    };
+    HRESULT hr;
+    int i;
+
+    CoInitialize(NULL);
+
+    for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++)
+    {
+        IShellFolder2 *folder;
+        GUID guid;
+
+        hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder);
+        if (hr != S_OK)
+        {
+            win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr);
+            continue;
+        }
+
+        if (0)
+        {
+            /* crashes on XP */
+            hr = IShellFolder2_GetDefaultSearchGUID(folder, NULL);
+            ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+        }
+
+        memcpy(&guid, &CLSID_MyComputer, sizeof(guid));
+        hr = IShellFolder2_GetDefaultSearchGUID(folder, &guid);
+        ok(hr == E_NOTIMPL || broken(hr == S_OK) /* Method was last supported on XP */, "Unexpected hr %#x.\n", hr);
+        if (hr == E_NOTIMPL)
+            ok(IsEqualGUID(&guid, &CLSID_MyComputer), "Unexpected guid %s.\n", wine_dbgstr_guid(&guid));
+
+        IShellFolder2_Release(folder);
+    }
+
+    CoUninitialize();
+}
+
 START_TEST(shlfolder)
 {
     init_function_pointers();
     /* if OleInitialize doesn't get called, ParseDisplayName returns
-       CO_E_NOTINITIALIZED for malformed directory names on win2k. */
+       CO_E_NOTINITIALIZED for malformed directory names */
     OleInitialize(NULL);
 
     test_ParseDisplayName();
@@ -5447,6 +5291,8 @@ START_TEST(shlfolder)
     test_ShellItemArrayGetAttributes();
     test_SHCreateDefaultContextMenu();
     test_DataObject();
+    test_GetDefaultColumn();
+    test_GetDefaultSearchGUID();
 
     OleUninitialize();
 }
index 5b08473..36fa759 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include "windef.h"
+#include "winbase.h"
+#include "wtypes.h"
+#include "shellapi.h"
+
+#include "shlguid.h"
+#include "shlobj.h"
+#include "shobjidl.h"
+#include "shlwapi.h"
+#include "ocidl.h"
+#include "oleauto.h"
+
+#include "initguid.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
 
 #include "msg.h"
 
+#ifdef __REACTOS__
+#include <reactos/undocshell.h>
+#endif
+
 #define LISTVIEW_SEQ_INDEX  0
 #define NUM_MSG_SEQUENCES   1
 
@@ -129,7 +154,7 @@ static IDataObject* IDataObjectImpl_Construct(void)
 {
     IDataObjectImpl *obj;
 
-    obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj));
+    obj = heap_alloc(sizeof(*obj));
     obj->IDataObject_iface.lpVtbl = &IDataObjectImpl_Vtbl;
     obj->ref = 1;
 
@@ -143,7 +168,7 @@ static HRESULT WINAPI IDataObjectImpl_QueryInterface(IDataObject *iface, REFIID
     if (IsEqualIID(riid, &IID_IUnknown) ||
         IsEqualIID(riid, &IID_IDataObject))
     {
-        *ppvObj = This;
+        *ppvObj = &This->IDataObject_iface;
     }
 
     if(*ppvObj)
@@ -167,10 +192,8 @@ static ULONG WINAPI IDataObjectImpl_Release(IDataObject * iface)
     ULONG ref = InterlockedDecrement(&This->ref);
 
     if (!ref)
-    {
-        HeapFree(GetProcessHeap(), 0, This);
-        return 0;
-    }
+        heap_free(This);
+
     return ref;
 }
 
@@ -256,7 +279,7 @@ static IShellBrowser* IShellBrowserImpl_Construct(void)
 {
     IShellBrowserImpl *browser;
 
-    browser = HeapAlloc(GetProcessHeap(), 0, sizeof(*browser));
+    browser = heap_alloc(sizeof(*browser));
     browser->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
     browser->ref = 1;
 
@@ -275,7 +298,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
        IsEqualIID(riid, &IID_IOleWindow) ||
        IsEqualIID(riid, &IID_IShellBrowser))
     {
-        *ppvObj = This;
+        *ppvObj = &This->IShellBrowser_iface;
     }
 
     if(*ppvObj)
@@ -299,10 +322,8 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
     ULONG ref = InterlockedDecrement(&This->ref);
 
     if (!ref)
-    {
-        HeapFree(GetProcessHeap(), 0, This);
-        return 0;
-    }
+        heap_free(This);
+
     return ref;
 }
 
@@ -1456,6 +1477,35 @@ if (0)
     IShellFolder_Release(desktop);
 }
 
+static void test_newmenu(void)
+{
+    IUnknown *unk, *unk2;
+    HRESULT hr;
+
+    hr = CoCreateInstance(&CLSID_NewMenu, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
+todo_wine
+    ok(hr == S_OK, "Failed to create NewMenu object, hr %#x.\n", hr);
+    if (hr != S_OK)
+    {
+        skip("NewMenu is not supported.\n");
+        return;
+    }
+
+    hr = IUnknown_QueryInterface(unk, &IID_IShellExtInit, (void **)&unk2);
+    ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
+    IUnknown_Release(unk2);
+
+    hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2);
+    ok(hr == S_OK, "Failed to get IContextMenu3, hr %#x.\n", hr);
+    IUnknown_Release(unk2);
+
+    hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&unk2);
+    ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#x.\n", hr);
+    IUnknown_Release(unk2);
+
+    IUnknown_Release(unk);
+}
+
 START_TEST(shlview)
 {
     OleInitialize(NULL);
@@ -1471,6 +1521,7 @@ START_TEST(shlview)
     test_IOleCommandTarget();
     test_SHCreateShellFolderView();
     test_SHCreateShellFolderViewEx();
+    test_newmenu();
 
     OleUninitialize();
 }
index 4d70962..6cdb386 100755 (executable)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+#include <stdio.h>
+
+#define WINE_NOWINSOCK
+#include "windef.h"
+#include "winbase.h"
+#include "wtypes.h"
+#include "shellapi.h"
+#include "shtypes.h"
+#include "objbase.h"
+
+#include "wine/test.h"
 
 static HMODULE hShell32;
 static BOOL (WINAPI *pStrRetToStrNAW)(LPVOID,DWORD,LPSTRRET,const ITEMIDLIST *);
index 5473868..c0f9634 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#ifndef __REACTOS__
+#define _WIN32_IE 0x600
+#endif
+#include <stdarg.h>
+
+#include <windows.h>
+#include "shellapi.h"
+
+#include "wine/test.h"
+
 
 static HWND hMainWnd;
 static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);