2013-01-25 23:24:46 +00:00
/*
* PROJECT : ReactOS api tests
* LICENSE : GPLv2 + - See COPYING in the top level directory
* PURPOSE : Test for SHExplorerParseCmdLine
2013-10-12 16:05:54 +00:00
* PROGRAMMER : Thomas Faber < thomas . faber @ reactos . org
2013-01-25 23:24:46 +00:00
*/
2013-09-22 17:52:42 +00:00
# include <apitest.h>
//#define UNICODE
2013-01-25 23:24:46 +00:00
# include <strsafe.h>
# include <shlobj.h>
2014-09-08 01:54:29 +00:00
// Macro parameters are only expanded in the second nesting...
# define _WIDEN(x) L##x
# define WIDEN(x) _WIDEN(x)
# define TEST_FILENAMEA "SHExplorerParseCmdLine.test"
# define TEST_FILENAMEW WIDEN(TEST_FILENAMEA)
# define TEST_PATHA "C:\\SHExplorerParseCmdLine.test"
# define TEST_PATHW WIDEN(TEST_PATHA)
2014-09-02 00:50:15 +00:00
# define PADDING_SIZE 0x100
2013-01-25 23:24:46 +00:00
typedef struct _EXPLORER_INFO
{
PWSTR FileName ;
PIDLIST_ABSOLUTE pidl ;
2014-09-02 00:50:15 +00:00
DWORD dwFlags ;
ULONG Unknown1 [ 5 ] ;
PIDLIST_ABSOLUTE pidlRoot ;
ULONG Unknown3 [ 4 ] ;
GUID guidInproc ;
ULONG Padding [ PADDING_SIZE ] ;
2013-01-25 23:24:46 +00:00
} EXPLORER_INFO , * PEXPLORER_INFO ;
2014-09-02 00:50:15 +00:00
UINT
2013-01-25 23:24:46 +00:00
WINAPI
SHExplorerParseCmdLine (
2014-09-02 00:50:15 +00:00
_Out_ PEXPLORER_INFO Info ) ;
2013-01-25 23:24:46 +00:00
# define PIDL_IS_UNTOUCHED -1
# define PIDL_IS_NULL -2
# define PIDL_IS_PATH -3
2014-09-02 00:50:15 +00:00
# define PIDL_IS_EMPTY -4
# define PIDL_PATH_EQUALS_PATH -5
2013-01-25 23:24:46 +00:00
# define InvalidPointer ((PVOID)0x5555555555555555ULL)
static
VOID
TestCommandLine (
2014-09-02 00:50:15 +00:00
_In_ INT ExpectedRet ,
_In_ INT ExpectedCsidl ,
_In_ DWORD ExpectedFlags ,
_In_ PCWSTR ExpectedFileName ,
_In_ PCWSTR PidlPath ,
_Out_opt_ PUINT PWriteEnd )
2013-01-25 23:24:46 +00:00
{
EXPLORER_INFO Info ;
2014-09-02 00:50:15 +00:00
UINT Ret ;
2013-01-25 23:24:46 +00:00
ULONG i ;
2014-09-02 00:50:15 +00:00
PDWORD InfoWords = ( PDWORD ) & Info ;
2013-01-25 23:24:46 +00:00
FillMemory ( & Info , sizeof ( Info ) , 0x55 ) ;
Info . dwFlags = 0x00000000 ;
Ret = SHExplorerParseCmdLine ( & Info ) ;
2014-09-02 00:50:15 +00:00
// Special case for empty cmdline: Ret is the PIDL for the selected folder.
2013-01-25 23:24:46 +00:00
if ( ExpectedRet = = - 1 )
2014-09-02 00:50:15 +00:00
ok ( ( LPITEMIDLIST ) Ret = = Info . pidl , " Ret = %x, expected %p \n " , Ret , Info . pidl ) ;
2013-01-25 23:24:46 +00:00
else
2014-09-02 00:50:15 +00:00
ok ( Ret = = ExpectedRet , " Ret = %x, expected %p \n " , Ret , ( PVOID ) ExpectedRet ) ;
2013-01-25 23:24:46 +00:00
if ( ExpectedFileName = = NULL )
ok ( Info . FileName = = InvalidPointer , " FileName = %p \n " , Info . FileName ) ;
else
{
ok ( Info . FileName ! = NULL & & Info . FileName ! = InvalidPointer , " FileName = %p \n " , Info . FileName ) ;
if ( Info . FileName ! = NULL & & Info . FileName ! = InvalidPointer )
{
ok ( ! wcscmp ( Info . FileName , ExpectedFileName ) , " FileName = %ls, expected %ls \n " , Info . FileName , ExpectedFileName ) ;
LocalFree ( Info . FileName ) ;
}
}
2014-09-08 01:54:29 +00:00
ok ( Info . dwFlags = = ExpectedFlags , " dwFlags = %08lx, expected %08lx \n " , Info . dwFlags , ExpectedFlags ) ;
2013-01-25 23:24:46 +00:00
if ( ExpectedCsidl = = PIDL_IS_UNTOUCHED )
ok ( Info . pidl = = InvalidPointer , " pidl = %p \n " , Info . pidl ) ;
else if ( ExpectedCsidl = = PIDL_IS_NULL )
ok ( Info . pidl = = NULL , " pidl = %p \n " , Info . pidl ) ;
else
{
PIDLIST_ABSOLUTE ExpectedPidl ;
HRESULT hr ;
ok ( Info . pidl ! = NULL , " pidl = %p \n " , Info . pidl ) ;
if ( Info . pidl ! = NULL & & Info . pidl ! = InvalidPointer )
{
2014-09-02 00:50:15 +00:00
WCHAR pidlPathName [ MAX_PATH ] = L " " ;
if ( Info . pidl ! = NULL & & Info . pidl ! = ( LPITEMIDLIST ) 0x55555555 )
2013-01-25 23:24:46 +00:00
{
2014-09-02 00:50:15 +00:00
SHGetPathFromIDListW ( Info . pidl , pidlPathName ) ;
2013-01-25 23:24:46 +00:00
}
2014-09-02 00:50:15 +00:00
if ( ExpectedCsidl = = PIDL_PATH_EQUALS_PATH )
2013-01-25 23:24:46 +00:00
{
2014-09-02 00:50:15 +00:00
ok ( wcsicmp ( pidlPathName , PidlPath ) = = 0 , " Path from pidl does not match; pidlPathName=%S \n " , pidlPathName ) ;
2013-01-25 23:24:46 +00:00
}
2014-09-02 00:50:15 +00:00
else if ( ExpectedCsidl = = PIDL_IS_EMPTY )
{
ok ( wcslen ( pidlPathName ) = = 0 , " Unexpected non-empty path from pidl; pidlPathName=%S \n " , pidlPathName ) ;
}
else
2013-01-25 23:24:46 +00:00
{
2014-09-02 00:50:15 +00:00
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 ) ;
}
}
2013-01-25 23:24:46 +00:00
}
2014-09-08 01:54:29 +00:00
if ( Info . pidl ! = NULL & & Info . pidl ! = ( LPITEMIDLIST ) 0x55555555 )
ILFree ( Info . pidl ) ;
2013-01-25 23:24:46 +00:00
}
}
2014-09-02 00:50:15 +00:00
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 ;
}
}
}
2013-01-25 23:24:46 +00:00
}
START_TEST ( SHExplorerParseCmdLine )
{
2014-09-02 00:50:15 +00:00
static struct
2013-01-25 23:24:46 +00:00
{
2014-09-02 00:50:15 +00:00
INT TestLine ;
2013-01-25 23:24:46 +00:00
PCWSTR CommandLine ;
INT ExpectedRet ;
INT ExpectedCsidl ;
DWORD ExpectedFlags ;
PCWSTR ExpectedFileName ;
PCWSTR PidlPath ;
2014-09-02 00:50:15 +00:00
} Tests [ ] =
2013-01-25 23:24:46 +00:00
{
2014-09-02 00:50:15 +00:00
{ __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/ " } ,
2014-09-08 01:54:29 +00:00
{ __LINE__ , TEST_PATHW , TRUE , PIDL_IS_PATH , 0x00000200 , NULL , TEST_PATHW } ,
2014-09-02 00:50:15 +00:00
{ __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: \\ " } ,
2014-09-08 01:54:29 +00:00
{ __LINE__ , L " /select, " TEST_PATHW , TRUE , PIDL_IS_PATH , 0x00000240 , NULL , TEST_PATHW } ,
2014-09-02 00:50:15 +00:00
{ __LINE__ , L " /select,c: \\ Program Files,c: \\ Documents and settings " , TRUE , PIDL_IS_PATH , 0x00000240 , NULL , L " C: \\ Documents and Settings " } ,
2014-09-08 01:54:29 +00:00
{ __LINE__ , L " c: \\ ,/select, " TEST_FILENAMEW , TRUE , PIDL_IS_NULL , 0x02000240 , TEST_FILENAMEW } ,
{ __LINE__ , L " c: \\ ,/select, " TEST_PATHW , TRUE , PIDL_IS_PATH , 0x00000240 , NULL , TEST_PATHW } ,
{ __LINE__ , L " a: \\ ,/select, " TEST_PATHW , TRUE , PIDL_IS_PATH , 0x00000240 , NULL , TEST_PATHW } ,
{ __LINE__ , L " z: \\ ,/select, " TEST_PATHW , TRUE , PIDL_IS_PATH , 0x02000240 , L " z: \\ " , TEST_PATHW } ,
2014-09-02 00:50:15 +00:00
{ __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 " } ,
2014-09-08 01:54:29 +00:00
{ __LINE__ , L " /root,c: \\ ,/select, " TEST_FILENAMEW , TRUE , PIDL_IS_NULL , 0x02000040 , TEST_FILENAMEW } ,
{ __LINE__ , L " /select, " TEST_FILENAMEW L " ,/root,c: \\ " , TRUE , PIDL_PATH_EQUALS_PATH , 0x02000040 , TEST_FILENAMEW , L " c: \\ " } ,
{ __LINE__ , L " /root,c: \\ ,/select, " TEST_PATHW , TRUE , PIDL_IS_PATH , 0x00000240 , NULL , TEST_PATHW } ,
{ __LINE__ , L " /select, " TEST_PATHW L " ,/root,c: \\ " , TRUE , PIDL_PATH_EQUALS_PATH , 0x00000240 , NULL , L " c: \\ " } ,
{ __LINE__ , L " /e,/select, " TEST_FILENAMEW L " ,/root,c: \\ " , TRUE , PIDL_PATH_EQUALS_PATH , 0x02000048 , TEST_FILENAMEW , L " c: \\ " } ,
{ __LINE__ , L " /e,/root,c: \\ ,/select, " TEST_FILENAMEW , TRUE , PIDL_IS_NULL , 0x02000048 , TEST_FILENAMEW } ,
2014-09-02 00:50:15 +00:00
{ __LINE__ , L " /e,/root,c: \\ " , TRUE , PIDL_PATH_EQUALS_PATH , 0x00000008 , NULL , L " c: \\ " } ,
2014-09-08 01:54:29 +00:00
{ __LINE__ , L " /e,c: \\ ,/select, " TEST_FILENAMEW , TRUE , PIDL_IS_NULL , 0x02000248 , TEST_FILENAMEW } ,
{ __LINE__ , L " c: \\ ,/e,/select, " TEST_FILENAMEW , TRUE , PIDL_IS_NULL , 0x02000248 , TEST_FILENAMEW } ,
{ __LINE__ , L " c: \\ ,/select, " TEST_FILENAMEW L " ,/e " , TRUE , PIDL_IS_NULL , 0x02000248 , TEST_FILENAMEW } ,
2014-09-02 00:50:15 +00:00
{ __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: \\ " } ,
2014-09-08 01:54:29 +00:00
{ __LINE__ , L " = " TEST_PATHW , TRUE , PIDL_IS_PATH , 0x00000200 , NULL , TEST_PATHW } ,
2014-09-02 00:50:15 +00:00
{ __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 } ,
2013-01-25 23:24:46 +00:00
} ;
const int TestCount = sizeof ( Tests ) / sizeof ( Tests [ 0 ] ) ;
PWSTR CommandLine ;
WCHAR OriginalCommandLine [ 1024 ] ;
int i ;
2014-09-02 00:50:15 +00:00
UINT maxWrite = 0 ;
2014-09-08 01:54:29 +00:00
FILE * ff ;
2013-01-25 23:24:46 +00:00
2013-09-22 17:52:42 +00:00
CommandLine = GetCommandLineW ( ) ;
StringCbCopyW ( OriginalCommandLine , sizeof ( OriginalCommandLine ) , CommandLine ) ;
2013-01-25 23:24:46 +00:00
2014-09-08 01:54:29 +00:00
ff = fopen ( TEST_PATHA , " wb " ) ;
fclose ( ff ) ;
2013-01-25 23:24:46 +00:00
for ( i = 0 ; i < TestCount ; i + + )
{
2014-09-02 00:50:15 +00:00
UINT cWrite ;
2013-01-25 23:24:46 +00:00
wcscpy ( CommandLine , L " browseui_apitest.exe " ) ;
wcscat ( CommandLine , Tests [ i ] . CommandLine ) ;
2014-09-02 00:50:15 +00:00
trace ( " Command line (%d): %ls \n " , Tests [ i ] . TestLine , CommandLine ) ;
2013-01-25 23:24:46 +00:00
TestCommandLine ( Tests [ i ] . ExpectedRet ,
Tests [ i ] . ExpectedCsidl ,
Tests [ i ] . ExpectedFlags ,
Tests [ i ] . ExpectedFileName ,
2014-09-02 00:50:15 +00:00
Tests [ i ] . PidlPath ,
& cWrite ) ;
if ( cWrite > maxWrite )
maxWrite = cWrite ;
2013-01-25 23:24:46 +00:00
}
2014-09-02 00:50:15 +00:00
trace ( " Writes reached the byte right before 0x%08x \n " , maxWrite ) ;
2013-01-25 23:24:46 +00:00
wcscpy ( CommandLine , OriginalCommandLine ) ;
2014-09-08 01:54:29 +00:00
remove ( TEST_PATHA ) ;
2013-01-25 23:24:46 +00:00
}