[BROWSEUI_APITEST]
authorDavid Quintana <gigaherz@gmail.com>
Tue, 2 Sep 2014 00:50:15 +0000 (00:50 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Tue, 2 Sep 2014 00:50:15 +0000 (00:50 +0000)
* Improve SHExplorerParseCmdLine tests with whole bunch of new lines, and update the EXPLORER_INFO struct to match the findings.

svn path=/trunk/; revision=64029

rostests/apitests/browseui/SHExplorerParseCmdLine.c

index 7352776..8fcec22 100644 (file)
 #include <strsafe.h>
 #include <shlobj.h>
 
-#define UNKNOWN_SIZE 0x100
+#define PADDING_SIZE 0x100
 
 typedef struct _EXPLORER_INFO
 {
     PWSTR FileName;
     PIDLIST_ABSOLUTE pidl;
-    DWORD dwFlags; /* TODO: make some constants */
-    ULONG Unknown[UNKNOWN_SIZE]; /* TODO: find out more */
+    DWORD dwFlags;
+    ULONG Unknown1[5];
+    PIDLIST_ABSOLUTE pidlRoot;
+    ULONG Unknown3[4];
+    GUID guidInproc;
+    ULONG Padding[PADDING_SIZE];
 } EXPLORER_INFO, *PEXPLORER_INFO;
 
-PVOID
+UINT
 WINAPI
 SHExplorerParseCmdLine(
-    _Out_ PEXPLORER_INFO Info);
+_Out_ PEXPLORER_INFO Info);
 
 #define PIDL_IS_UNTOUCHED -1
 #define PIDL_IS_NULL -2
 #define PIDL_IS_PATH -3
+#define PIDL_IS_EMPTY -4
+#define PIDL_PATH_EQUALS_PATH -5
 
 #define InvalidPointer ((PVOID)0x5555555555555555ULL)
 
 static
 VOID
 TestCommandLine(
-    _In_ INT ExpectedRet,
-    _In_ INT ExpectedCsidl,
-    _In_ DWORD ExpectedFlags,
-    _In_ PCWSTR ExpectedFileName,
-    _In_ PCWSTR PidlPath)
+_In_ INT ExpectedRet,
+_In_ INT ExpectedCsidl,
+_In_ DWORD ExpectedFlags,
+_In_ PCWSTR ExpectedFileName,
+_In_ PCWSTR PidlPath,
+_Out_opt_ PUINT PWriteEnd)
 {
     EXPLORER_INFO Info;
-    PVOID Ret;
+    UINT Ret;
     ULONG i;
+    PDWORD InfoWords = (PDWORD) &Info;
 
     FillMemory(&Info, sizeof(Info), 0x55);
     Info.dwFlags = 0x00000000;
     Ret = SHExplorerParseCmdLine(&Info);
 
+    // Special case for empty cmdline: Ret is the PIDL for the selected folder.
     if (ExpectedRet == -1)
-        ok(Ret == Info.pidl, "Ret = %p, expected %p\n", Ret, Info.pidl);
+        ok((LPITEMIDLIST) Ret == Info.pidl, "Ret = %x, expected %p\n", Ret, Info.pidl);
     else
-        ok(Ret == (PVOID)ExpectedRet, "Ret = %p, expected %p\n", Ret, (PVOID)ExpectedRet);
+        ok(Ret == ExpectedRet, "Ret = %x, expected %p\n", Ret, (PVOID) ExpectedRet);
 
     if (ExpectedFileName == NULL)
         ok(Info.FileName == InvalidPointer, "FileName = %p\n", Info.FileName);
@@ -78,76 +87,273 @@ TestCommandLine(
         ok(Info.pidl != NULL, "pidl = %p\n", Info.pidl);
         if (Info.pidl != NULL && Info.pidl != InvalidPointer)
         {
-            if (ExpectedCsidl == PIDL_IS_PATH)
+            WCHAR pidlPathName[MAX_PATH] = L"";
+
+            if (Info.pidl != NULL && Info.pidl != (LPITEMIDLIST) 0x55555555)
             {
-                ExpectedPidl = SHSimpleIDListFromPath(PidlPath);
-                hr = ExpectedPidl == NULL ? E_FAIL : S_OK;
-                ok(ExpectedPidl != NULL, "SHSimpleIDListFromPath failed\n");
+                SHGetPathFromIDListW(Info.pidl, pidlPathName);
             }
-            else
+
+            if (ExpectedCsidl == PIDL_PATH_EQUALS_PATH)
             {
-                hr = SHGetFolderLocation(NULL, ExpectedCsidl, NULL, 0, &ExpectedPidl);
-                ok(hr == S_OK, "SHGetFolderLocation returned %08lx\n", hr);
+                ok(wcsicmp(pidlPathName, PidlPath) == 0, "Path from pidl does not match; pidlPathName=%S\n", pidlPathName);
             }
-            if (SUCCEEDED(hr))
+            else if (ExpectedCsidl == PIDL_IS_EMPTY)
+            {
+                ok(wcslen(pidlPathName) == 0, "Unexpected non-empty path from pidl; pidlPathName=%S\n", pidlPathName);
+            }
+            else
             {
-                ok(ILIsEqual(Info.pidl, ExpectedPidl), "Unexpected pidl value\n");
-                ILFree(ExpectedPidl);
+                if (ExpectedCsidl == PIDL_IS_PATH)
+                {
+                    ExpectedPidl = SHSimpleIDListFromPath(PidlPath);
+                    hr = ExpectedPidl == NULL ? E_FAIL : S_OK;
+                    ok(ExpectedPidl != NULL, "SHSimpleIDListFromPath(%S) failed. pidlPathName=%S\n", PidlPath, pidlPathName);
+                    if (SUCCEEDED(hr))
+                    {
+                        ok(ILIsEqual(Info.pidl, ExpectedPidl), "Unexpected pidl value %p; pidlPathName=%S PidlPath=%S\n", Info.pidl, pidlPathName, PidlPath);
+                        ILFree(ExpectedPidl);
+                    }
+                }
+                else
+                {
+                    hr = SHGetFolderLocation(NULL, ExpectedCsidl, NULL, 0, &ExpectedPidl);
+                    ok(hr == S_OK, "SHGetFolderLocation returned %08lx\n", hr);
+                    if (SUCCEEDED(hr))
+                    {
+                        BOOL eq = ILIsEqual(Info.pidl, ExpectedPidl);
+                        ILFree(ExpectedPidl);
+
+                        ok(eq, "Unexpected pidl value %p; pidlPathName=%S CSIDL=%d\n", Info.pidl, pidlPathName, ExpectedCsidl);
+                    }
+                }
             }
             ILFree(Info.pidl);
         }
     }
 
     ok(Info.dwFlags == ExpectedFlags, "dwFlags = %08lx, expected %08lx\n", Info.dwFlags, ExpectedFlags);
-    for (i = 0; i < sizeof(Info.Unknown) / sizeof(Info.Unknown[0]); i++)
-        ok(Info.Unknown[i] == 0x55555555, "Unknown[%lu] = %08lx\n", i, Info.Unknown[i]);
+    for (i = 0; i < sizeof(Info) / sizeof(DWORD); i++)
+    {
+        switch (i*4)
+        {
+        case 0x00: // FileName
+        case 0x04: // pidl
+        case 0x08: // dwFlags
+        case 0x20: // pidlRoot
+        case 0x34: // guidInproc (1/4)
+        case 0x38: // guidInproc (2/4)
+        case 0x3C: // guidInproc (3/4)
+        case 0x40: // guidInproc (4/4)
+            break;
+        default:
+            ok(InfoWords[i] == 0x55555555, "Word 0x%02lx has been set to 0x%08lx\n", i * 4, InfoWords[i]);
+        }
+    }
+
+    if (PWriteEnd)
+    {
+        PBYTE data = (PBYTE)&Info;
+
+        *PWriteEnd = 0;
+
+        for (i = sizeof(Info); i > 0; i--)
+        {
+            if (data[i - 1] != 0x55)
+            {
+                *PWriteEnd = i;
+                break;
+            }
+        }
+    }
 }
 
 START_TEST(SHExplorerParseCmdLine)
 {
-    struct
+    static struct
     {
+        INT TestLine;
         PCWSTR CommandLine;
         INT ExpectedRet;
         INT ExpectedCsidl;
         DWORD ExpectedFlags;
         PCWSTR ExpectedFileName;
         PCWSTR PidlPath;
-    } Tests[] =
+    } Tests [] =
     {
-        { L"",                                                    -1, CSIDL_MYDOCUMENTS, 0x00000009 },
-        { L"/e",                                                TRUE, PIDL_IS_UNTOUCHED, 0x00000008 },
-        { L"/n",                                                TRUE, PIDL_IS_UNTOUCHED, 0x00004001 },
-        { L"/x",                                                TRUE, PIDL_IS_NULL,      0x02000000, L"/x" },
-        { L"-e",                                                TRUE, PIDL_IS_NULL,      0x02000000, L"-e" },
-        { L"C:\\",                                              TRUE, PIDL_IS_PATH,      0x00000200, NULL, L"C:\\" },
-        { L"/e,C:\\",                                           TRUE, PIDL_IS_PATH,      0x00000208, NULL, L"C:\\" },
-        { L"/select,C:\\",                                      TRUE, PIDL_IS_PATH,      0x00000240, NULL, L"C:\\" },
-        { L"/e,::{20d04fe0-3aea-1069-a2d8-08002b30309d}",       TRUE, PIDL_IS_PATH,      0x00000208, NULL, L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}" },
-        { L"::{645ff040-5081-101b-9f08-00aa002f954e}",          TRUE, PIDL_IS_PATH,      0x00000200, NULL, L"::{645ff040-5081-101b-9f08-00aa002f954e}" },
-        { L"/select,::{450d8fba-ad25-11d0-98a8-0800361b1103}",  TRUE, PIDL_IS_PATH,      0x00000240, NULL, L"::{450d8fba-ad25-11d0-98a8-0800361b1103}" },
-        { L"=",                                                 TRUE, PIDL_IS_PATH,      0x00000200, NULL, L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}" },
-        /* TODO: needs a lot more testcases */
+        { __LINE__, L"", -1, CSIDL_MYDOCUMENTS, 0x00000009 },
+        { __LINE__, L"/e", TRUE, PIDL_IS_UNTOUCHED, 0x00000008 },
+        { __LINE__, L"/n", TRUE, PIDL_IS_UNTOUCHED, 0x00004001 },
+        { __LINE__, L"/x", TRUE, PIDL_IS_NULL, 0x02000000, L"/x" },
+        { __LINE__, L"-e", TRUE, PIDL_IS_NULL, 0x02000000, L"-e" },
+        { __LINE__, L"C:\\", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"/e,C:\\", TRUE, PIDL_IS_PATH, 0x00000208, NULL, L"C:\\" },
+        { __LINE__, L"/select,C:\\", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\" },
+        { __LINE__, L"/e,::{20d04fe0-3aea-1069-a2d8-08002b30309d}", TRUE, PIDL_IS_PATH, 0x00000208, NULL, L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}" },
+        { __LINE__, L"::{645ff040-5081-101b-9f08-00aa002f954e}", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"::{645ff040-5081-101b-9f08-00aa002f954e}" },
+        { __LINE__, L"/select,::{450d8fba-ad25-11d0-98a8-0800361b1103}", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"::{450d8fba-ad25-11d0-98a8-0800361b1103}" },
+        { __LINE__, L"=", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}" },
+        { __LINE__, L".", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Documents and Settings\\gigaherz\\Desktop" },
+        { __LINE__, L"..", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Documents and Settings\\gigaherz" },
+        { __LINE__, L"wrongpath", TRUE, PIDL_IS_NULL, 0x02000000, L"wrongpath"},
+        { __LINE__, L"%wrongdir%", TRUE, PIDL_IS_NULL, 0x02000000, L"%wrongdir%"},
+        { __LINE__, L"%programfiles#", TRUE, PIDL_IS_NULL, 0x02000000, L"%programfiles#"},
+        { __LINE__, L",", TRUE, PIDL_IS_EMPTY, 0x00000200},
+        { __LINE__, L"c:\\", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"c:", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"c", TRUE, PIDL_IS_NULL, 0x02000000, L"c"},
+        { __LINE__, L"c:\\Program Files", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"c:\\Program Files\\", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"c:\\Program Files/", TRUE, PIDL_IS_NULL, 0x02000000, L"c:\\Program Files/"},
+        { __LINE__, L"c:/Program Files/", TRUE, PIDL_IS_NULL, 0x02000000, L"c:/Program Files/"},
+        { __LINE__, L"c:\\ntldr", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\ntldr" },
+        { __LINE__, L"\"c:\\\"\"program files\"", TRUE, PIDL_IS_NULL, 0x02000000, L"c:\\\"program files"},
+        { __LINE__, L"\"c:\\\"program files", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"\"c:\\ \"program files", TRUE, PIDL_IS_NULL, 0x02000000, L"c:\\ program files"},
+        { __LINE__, L"\"c:\\\" program files", TRUE, PIDL_IS_NULL, 0x02000000, L"c:\\ program files"},
+        { __LINE__, L"\"c:\\\", \"c:\\program files\"", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"c:\\,c:\\program files", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/root", 0, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"\"/root\"", 0, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"/root,", TRUE, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"/root,c", TRUE, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"/root,\"\"", TRUE, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"/root,wrong", TRUE, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"/root,0", TRUE, CSIDL_MYDOCUMENTS, 0x00000000},
+        { __LINE__, L"/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000000, NULL, L"c:\\" },
+        { __LINE__, L"/root,\"c:\\\"", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000000, NULL, L"c:\\" },
+        { __LINE__, L"/root \"c:\\\"", TRUE, PIDL_IS_NULL, 0x02000000, L"/root c:\\"},
+        { __LINE__, L"/root,\"c:\\\"\"program files\"", TRUE, PIDL_IS_PATH, 0x00000000},
+        { __LINE__, L"/root,\"c:\\\"program files", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000000, NULL, L"c:\\Program Files" },
+        { __LINE__, L"/root,c:\\,c:\\Program Files", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/root,c:\\,Program Files", TRUE, PIDL_IS_NULL, 0x02000000, L"Program Files"},
+        { __LINE__, L"/root,\"c:\\\"", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000000, NULL, L"c:\\" },
+        { __LINE__, L"c:\\Program Files,/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000200, NULL, L"c:\\" },
+        { __LINE__, L"a:\\,/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000200, NULL, L"c:\\" },
+        { __LINE__, L"a:\\,/root,c", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"A:\\" },
+        { __LINE__, L"c:\\,/root,c", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"/select", TRUE, CSIDL_MYDOCUMENTS, 0x00000040},
+        { __LINE__, L"/select,", TRUE, CSIDL_DRIVES, 0x00000240 },
+        { __LINE__, L"/select,c", TRUE, PIDL_IS_NULL, 0x02000040, L"c"},
+        { __LINE__, L"/select,0", TRUE, PIDL_IS_NULL, 0x02000040, L"0"},
+        { __LINE__, L"/select,c:\\", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\" },
+        { __LINE__, L"c:\\,/select", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\" },
+        { __LINE__, L"/select,c:\\ntldr", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\ntldr" },
+        { __LINE__, L"/select,c:\\Program Files,c:\\Documents and settings", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\Documents and Settings" },
+        { __LINE__, L"c:\\,/select,ntldr", TRUE, PIDL_IS_NULL, 0x02000240, L"ntldr"},
+        { __LINE__, L"c:\\,/select,c:\\ntldr", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\ntldr" },
+        { __LINE__, L"a:\\,/select,c:\\ntldr", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\ntldr" },
+        { __LINE__, L"z:\\,/select,c:\\ntldr", TRUE, PIDL_IS_PATH, 0x02000240, L"z:\\", L"C:\\ntldr" },
+        { __LINE__, L"select,c:\\ ", TRUE, PIDL_IS_PATH, 0x02000200, L"select", L"C:\\" },
+        { __LINE__, L"/select c:\\ ", TRUE, PIDL_IS_NULL, 0x02000000, L"/select c:\\"},
+        { __LINE__, L"a:\\,/select,c:\\", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\" },
+        { __LINE__, L"a:\\,/select,c", TRUE, PIDL_IS_NULL, 0x02000240, L"c"},
+        { __LINE__, L"c:\\,/select,c", TRUE, PIDL_IS_NULL, 0x02000240, L"c"},
+        { __LINE__, L"/e", TRUE, CSIDL_MYDOCUMENTS, 0x00000008},
+        { __LINE__, L"/e,", TRUE, CSIDL_DRIVES, 0x00000208 },
+        { __LINE__, L"/e,\"", TRUE, CSIDL_DRIVES, 0x00000208 },
+        { __LINE__, L"/e,\"\"", TRUE, CSIDL_DRIVES, 0x00000208 },
+        { __LINE__, L"/e,c:\\", TRUE, PIDL_IS_PATH, 0x00000208, NULL, L"C:\\" },
+        { __LINE__, L"c:\\,/e", TRUE, PIDL_IS_PATH, 0x00000208, NULL, L"C:\\" },
+        { __LINE__, L"/e,c", TRUE, PIDL_IS_NULL, 0x02000008, L"c"},
+        { __LINE__, L"/root,c:\\,/select,ntldr", TRUE, PIDL_IS_NULL, 0x02000040, L"ntldr"},
+        { __LINE__, L"/select,ntldr,/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x02000040, L"ntldr", L"c:\\" },
+        { __LINE__, L"/root,c:\\,/select,c:\\ntldr", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\ntldr" },
+        { __LINE__, L"/select,c:\\ntldr,/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000240, NULL, L"c:\\" },
+        { __LINE__, L"/e,/select,ntldr,/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x02000048, L"ntldr", L"c:\\" },
+        { __LINE__, L"/e,/root,c:\\,/select,ntldr", TRUE, PIDL_IS_NULL, 0x02000048, L"ntldr"},
+        { __LINE__, L"/e,/root,c:\\", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000008, NULL, L"c:\\" },
+        { __LINE__, L"/e,c:\\,/select,ntldr", TRUE, PIDL_IS_NULL, 0x02000248, L"ntldr"},
+        { __LINE__, L"c:\\,/e,/select,ntldr", TRUE, PIDL_IS_NULL, 0x02000248, L"ntldr"},
+        { __LINE__, L"c:\\,/select,ntldr,/e", TRUE, PIDL_IS_NULL, 0x02000248, L"ntldr"},
+        { __LINE__, L"http:\\\\www.reactos.org", TRUE, PIDL_IS_NULL, 0x02000000, L"http:\\\\www.reactos.org"},
+        { __LINE__, L"/e,http:\\\\www.reactos.org", TRUE, PIDL_IS_NULL, 0x02000008, L"http:\\\\www.reactos.org"},
+        { __LINE__, L"/root,c:\\,http:\\\\www.reactos.org", TRUE, PIDL_IS_NULL, 0x02000000, L"http:\\\\www.reactos.org"},
+        { __LINE__, L"/separate ", TRUE, CSIDL_MYDOCUMENTS, 0x00020000},
+        { __LINE__, L"/separate,c:\\ program files", TRUE, PIDL_IS_NULL, 0x02020000, L"c:\\ program files"},
+        { __LINE__, L"/separate,           c:\\program files", TRUE, PIDL_IS_PATH, 0x00020200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/separate,           c:\\program files           ,/e", TRUE, PIDL_IS_PATH, 0x00020208, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/separate,           c:\\program files           ,\\e", TRUE, PIDL_IS_NULL, 0x02020200, L"\\e"},
+        { __LINE__, L"c:\\Documents and settings,/separate,/n,/e,/root,c:\\,/select,c:\\Program files,", TRUE, CSIDL_DRIVES, 0x00024249 },
+        { __LINE__, L"c:\\Documents and settings,/separate,/n,/e,/root,{450D8FBA-AD25-11D0-98A8-0800361B1103, 0},test,/select,c:\\Program files,", TRUE, CSIDL_DRIVES, 0x02024249, L"test" },
+        { __LINE__, L"c:\\Documents and settings,/inproc,/noui,/s,/separate,/n,/e,/root,{450D8FBA-AD25-11D0-98A8-0800361B1103, 0},test,/select,c:\\Program files,", FALSE, PIDL_PATH_EQUALS_PATH, 0x00000200, NULL, L"C:\\Documents and Settings" },
+        { __LINE__, L"=", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"=c:\\", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"=c:\\ntldr", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\ntldr" },
+        { __LINE__, L"/root,=", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"/root=c:\\", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"/root=c:\\Program files", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/root=\"c:\\Program files\"", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/root=\"\"c:\\Program files\"\"", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"c:\\=/root=\"c:\\Program files\"", TRUE, PIDL_PATH_EQUALS_PATH, 0x00000000, NULL, L"C:\\Program Files" },
+        { __LINE__, L"/select=c:\\", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\" },
+        { __LINE__, L"/select=c:\\Program files", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\Program Files" },
+        { __LINE__, L"=,/select,c:\\", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\" },
+        { __LINE__, L"/select,c:\\,=", TRUE, CSIDL_DRIVES, 0x00000240 },
+        { __LINE__, L"c:\\=/select=c:\\windows\\system32", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\WINDOWS\\system32" },
+        { __LINE__, L"/select=c:\\windows\\system32", TRUE, PIDL_IS_PATH, 0x00000200, NULL, L"C:\\WINDOWS\\system32" },
+        { __LINE__, L"=/select=c:\\windows\\system32", TRUE, PIDL_IS_PATH, 0x00000240, NULL, L"C:\\WINDOWS\\system32" },
+        { __LINE__, L"/e,=", TRUE, CSIDL_DRIVES, 0x00000208 },
+        { __LINE__, L"/e=", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"/e=\"", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"/e=\"\"", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"=\"=\"", TRUE, PIDL_IS_NULL, 0x02000000, L"="},
+        { __LINE__, L"==\"=\"", TRUE, PIDL_IS_NULL, 0x02000200, L"="},
+        { __LINE__, L"===\"=\"", TRUE, PIDL_IS_NULL, 0x02000200, L"="},
+        { __LINE__, L"=\"=\"", TRUE, PIDL_IS_NULL, 0x02000000, L"="},
+        { __LINE__, L"==\"==\"", TRUE, PIDL_IS_NULL, 0x02000200, L"=="},
+        { __LINE__, L"===\"===\"", TRUE, PIDL_IS_NULL, 0x02000200, L"==="},
+        { __LINE__, L"=\"=a\"", TRUE, PIDL_IS_NULL, 0x02000000, L"=a"},
+        { __LINE__, L"==\"=a=\"", TRUE, PIDL_IS_NULL, 0x02000200, L"=a="},
+        { __LINE__, L"===\"=a=a=\"", TRUE, PIDL_IS_NULL, 0x02000200, L"=a=a="},
+        { __LINE__, L"=\"=a\"==", TRUE, CSIDL_DRIVES, 0x02000200, L"=a" },
+        { __LINE__, L"==\"=a=\"=", TRUE, CSIDL_DRIVES, 0x02000200, L"=a=" },
+        { __LINE__, L"===\"=a=a=\"===", TRUE, CSIDL_DRIVES, 0x02000200, L"=a=a=" },
+        { __LINE__, L"=,=,=,\"=a=a=\",=,=,=", TRUE, CSIDL_DRIVES, 0x02000200, L"=a=a=" },
+        { __LINE__, L"\"", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"\"\"", TRUE, CSIDL_DRIVES, 0x00000200 },
+        { __LINE__, L"\"\"\"", TRUE, PIDL_IS_NULL, 0x02000000, L"\""},
+        { __LINE__, L"\"\"\"\"", TRUE, PIDL_IS_NULL, 0x02000000, L"\""},
+        { __LINE__, L"\"\"\"\"\"", TRUE, PIDL_IS_NULL, 0x02000000, L"\"\""},
+        { __LINE__, L"/s", TRUE, CSIDL_MYDOCUMENTS, 0x00000002},
+        { __LINE__, L"/noui", TRUE, CSIDL_MYDOCUMENTS, 0x00001000},
+        { __LINE__, L"/idlist", TRUE, PIDL_IS_UNTOUCHED, 0x00000000},
+        { __LINE__, L"-embedding", TRUE, CSIDL_MYDOCUMENTS, 0x00000080 },
+        { __LINE__, L"/inproc", FALSE, PIDL_IS_UNTOUCHED, 0x00000000 },
+        { __LINE__, L"/inproc,1", FALSE, PIDL_IS_UNTOUCHED, 0x00000000 },
+        { __LINE__, L"/inproc,a", FALSE, PIDL_IS_UNTOUCHED, 0x00000000 },
+        { __LINE__, L"/inproc,c:\\", FALSE, PIDL_IS_UNTOUCHED, 0x00000000 },
+        { __LINE__, L"/inproc,\"c:\\\"", FALSE, PIDL_IS_UNTOUCHED, 0x00000000 },
+        { __LINE__, L"/inproc,{20d04fe0-3aea-1069-a2d8-08002b30309d}", TRUE, PIDL_IS_UNTOUCHED, 0x00000400 },
     };
     const int TestCount = sizeof(Tests) / sizeof(Tests[0]);
     PWSTR CommandLine;
     WCHAR OriginalCommandLine[1024];
     int i;
+    UINT maxWrite = 0;
 
     CommandLine = GetCommandLineW();
     StringCbCopyW(OriginalCommandLine, sizeof(OriginalCommandLine), CommandLine);
 
     for (i = 0; i < TestCount; i++)
     {
+        UINT cWrite;
+
         wcscpy(CommandLine, L"browseui_apitest.exe ");
         wcscat(CommandLine, Tests[i].CommandLine);
-        trace("Command line: %ls\n", CommandLine);
+        trace("Command line (%d): %ls\n", Tests[i].TestLine, CommandLine);
         TestCommandLine(Tests[i].ExpectedRet,
                         Tests[i].ExpectedCsidl,
                         Tests[i].ExpectedFlags,
                         Tests[i].ExpectedFileName,
-                        Tests[i].PidlPath);
+                        Tests[i].PidlPath,
+                        &cWrite);
+
+        if (cWrite > maxWrite)
+            maxWrite = cWrite;
     }
 
+    trace("Writes reached the byte right before 0x%08x\n", maxWrite);
+
     wcscpy(CommandLine, OriginalCommandLine);
 }