2004-10-21 21:59:46 +02:00
/*
* Unit tests for shell32 SHGet { Special } Folder { Path | Location } functions .
*
* Copyright 2004 Juan Lang
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library ; if not , write to the Free Software
2006-05-18 14:49:52 +02:00
* Foundation , Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 , USA
2004-10-21 21:59:46 +02:00
* This is a test program for the SHGet { Special } Folder { Path | Location } functions
2008-05-06 20:01:59 +02:00
* of shell32 , that get either a filesystem path or a LPITEMIDLIST ( shell
2004-10-21 21:59:46 +02:00
* namespace ) path for a given folder ( CSIDL value ) .
*/
2005-06-06 21:50:35 +02:00
# define COBJMACROS
2004-10-21 21:59:46 +02:00
# include <stdarg.h>
# include <stdio.h>
# include "windef.h"
# include "winbase.h"
# include "shlguid.h"
# include "shlobj.h"
# include "shlwapi.h"
2010-09-14 17:01:44 +02:00
# include "knownfolders.h"
2013-10-26 21:10:26 +02:00
# include "shellapi.h"
2004-10-21 21:59:46 +02:00
# include "wine/test.h"
2011-12-20 09:17:27 +01:00
# include "initguid.h"
2007-09-18 00:40:56 +02:00
/* CSIDL_MYDOCUMENTS is now the same as CSIDL_PERSONAL, but what we want
* here is its original value .
*/
# define OLD_CSIDL_MYDOCUMENTS 0x000c
2011-07-24 13:45:51 +02:00
DEFINE_GUID ( GUID_NULL , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ;
2004-10-21 21:59:46 +02:00
/* from pidl.h, not included here: */
2009-09-28 12:41:50 +02:00
# ifndef PT_CPL /* Guess, Win7 uses this for CSIDL_CONTROLS */
# define PT_CPL 0x01 /* no path */
# endif
2004-10-21 21:59:46 +02:00
# ifndef PT_GUID
# define PT_GUID 0x1f /* no path */
# endif
2005-06-02 21:39:24 +02:00
# ifndef PT_DRIVE
# define PT_DRIVE 0x23 /* has path */
# endif
2004-10-21 21:59:46 +02:00
# ifndef PT_DRIVE2
# define PT_DRIVE2 0x25 /* has path */
# endif
# ifndef PT_SHELLEXT
# define PT_SHELLEXT 0x2e /* no path */
# endif
# ifndef PT_FOLDER
# define PT_FOLDER 0x31 /* has path */
# endif
2009-04-04 13:42:28 +02:00
# ifndef PT_FOLDERW
# define PT_FOLDERW 0x35 /* has path */
# endif
2004-10-21 21:59:46 +02:00
# ifndef PT_WORKGRP
# define PT_WORKGRP 0x41 /* no path */
# endif
2004-10-26 02:17:31 +02:00
# ifndef PT_YAGUID
# define PT_YAGUID 0x70 /* no path */
2004-10-21 21:59:46 +02:00
# endif
/* FIXME: this is used for history/favorites folders; what's a better name? */
# ifndef PT_IESPECIAL2
# define PT_IESPECIAL2 0xb1 /* has path */
# endif
static GUID CLSID_CommonDocuments = { 0x0000000c , 0x0000 , 0x0000 , { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x74 , 0x1a } } ;
struct shellExpectedValues {
2009-02-03 18:45:00 +01:00
int folder ;
int numTypes ;
const BYTE * types ;
2004-10-21 21:59:46 +02:00
} ;
2007-08-15 21:00:06 +02:00
static HRESULT ( WINAPI * pDllGetVersion ) ( DLLVERSIONINFO * ) ;
2004-10-22 22:25:46 +02:00
static HRESULT ( WINAPI * pSHGetFolderPathA ) ( HWND , int , HANDLE , DWORD , LPSTR ) ;
static BOOL ( WINAPI * pSHGetSpecialFolderPathA ) ( HWND , LPSTR , int , BOOL ) ;
static HRESULT ( WINAPI * pSHGetSpecialFolderLocation ) ( HWND , int , LPITEMIDLIST * ) ;
static LPITEMIDLIST ( WINAPI * pILFindLastID ) ( LPCITEMIDLIST ) ;
static int ( WINAPI * pSHFileOperationA ) ( LPSHFILEOPSTRUCTA ) ;
2009-07-07 11:48:25 +02:00
static UINT ( WINAPI * pGetSystemWow64DirectoryA ) ( LPSTR , UINT ) ;
2010-09-14 17:01:44 +02:00
static HRESULT ( WINAPI * pSHGetKnownFolderPath ) ( REFKNOWNFOLDERID , DWORD , HANDLE , PWSTR * ) ;
2011-06-14 13:09:31 +02:00
static HRESULT ( WINAPI * pSHSetKnownFolderPath ) ( REFKNOWNFOLDERID , DWORD , HANDLE , PWSTR ) ;
2010-09-14 17:01:44 +02:00
static HRESULT ( WINAPI * pSHGetFolderPathEx ) ( REFKNOWNFOLDERID , DWORD , HANDLE , LPWSTR , DWORD ) ;
2014-06-28 13:43:06 +02:00
static BOOL ( WINAPI * pPathYetAnotherMakeUniqueName ) ( PWSTR , PCWSTR , PCWSTR , PCWSTR ) ;
2015-05-09 20:46:56 +02:00
static HRESULT ( WINAPI * pSHGetKnownFolderIDList ) ( REFKNOWNFOLDERID , DWORD , HANDLE , PIDLIST_ABSOLUTE * ) ;
2019-12-11 11:16:18 +01:00
static BOOL ( WINAPI * pPathResolve ) ( PWSTR , PZPCWSTR , UINT ) ;
2010-09-14 17:01:44 +02:00
2004-10-21 21:59:46 +02:00
static DLLVERSIONINFO shellVersion = { 0 } ;
2009-02-03 18:45:00 +01:00
static const BYTE guidType [ ] = { PT_GUID } ;
2009-09-28 12:41:50 +02:00
static const BYTE controlPanelType [ ] = { PT_SHELLEXT , PT_GUID , PT_CPL } ;
2009-04-04 13:42:28 +02:00
static const BYTE folderType [ ] = { PT_FOLDER , PT_FOLDERW } ;
static const BYTE favoritesType [ ] = { PT_FOLDER , PT_FOLDERW , 0 , PT_IESPECIAL2 /* Win98 */ } ;
2009-02-03 18:45:00 +01:00
static const BYTE folderOrSpecialType [ ] = { PT_FOLDER , PT_IESPECIAL2 } ;
2009-02-05 16:29:02 +01:00
static const BYTE personalType [ ] = { PT_FOLDER , PT_GUID , PT_DRIVE , 0xff /* Win9x */ ,
2015-03-11 18:11:16 +01:00
PT_IESPECIAL2 /* Win98 */ , 0 /* Vista */ , PT_SHELLEXT /* win8 */ } ;
2009-02-03 18:45:00 +01:00
/* FIXME: don't know the type of 0x71 returned by Vista/2008 for printers */
static const BYTE printersType [ ] = { PT_YAGUID , PT_SHELLEXT , 0x71 } ;
static const BYTE ieSpecialType [ ] = { PT_IESPECIAL2 } ;
static const BYTE shellExtType [ ] = { PT_SHELLEXT } ;
static const BYTE workgroupType [ ] = { PT_WORKGRP } ;
2018-06-15 00:04:42 +02:00
# define DECLARE_TYPE(x, y) { x, ARRAY_SIZE(y), y }
2004-10-21 21:59:46 +02:00
static const struct shellExpectedValues requiredShellValues [ ] = {
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_BITBUCKET , guidType ) ,
DECLARE_TYPE ( CSIDL_CONTROLS , controlPanelType ) ,
DECLARE_TYPE ( CSIDL_COOKIES , folderType ) ,
DECLARE_TYPE ( CSIDL_DESKTOPDIRECTORY , folderType ) ,
DECLARE_TYPE ( CSIDL_DRIVES , guidType ) ,
DECLARE_TYPE ( CSIDL_FAVORITES , favoritesType ) ,
DECLARE_TYPE ( CSIDL_FONTS , folderOrSpecialType ) ,
2004-10-21 21:59:46 +02:00
/* FIXME: the following fails in Wine, returns type PT_FOLDER
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_HISTORY , ieSpecialType ) ,
2004-10-21 21:59:46 +02:00
*/
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_INTERNET , guidType ) ,
DECLARE_TYPE ( CSIDL_NETHOOD , folderType ) ,
DECLARE_TYPE ( CSIDL_NETWORK , guidType ) ,
2009-02-03 19:15:35 +01:00
DECLARE_TYPE ( CSIDL_PERSONAL , personalType ) ,
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_PRINTERS , printersType ) ,
DECLARE_TYPE ( CSIDL_PRINTHOOD , folderType ) ,
DECLARE_TYPE ( CSIDL_PROGRAMS , folderType ) ,
DECLARE_TYPE ( CSIDL_RECENT , folderOrSpecialType ) ,
DECLARE_TYPE ( CSIDL_SENDTO , folderType ) ,
DECLARE_TYPE ( CSIDL_STARTMENU , folderType ) ,
DECLARE_TYPE ( CSIDL_STARTUP , folderType ) ,
DECLARE_TYPE ( CSIDL_TEMPLATES , folderType ) ,
2004-10-21 21:59:46 +02:00
} ;
static const struct shellExpectedValues optionalShellValues [ ] = {
/* FIXME: the following only semi-succeed; they return NULL PIDLs on XP.. hmm.
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_ALTSTARTUP , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_ALTSTARTUP , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_OEM_LINKS , folderType ) ,
2004-10-21 21:59:46 +02:00
*/
/* Windows NT-only: */
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_COMMON_DESKTOPDIRECTORY , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_DOCUMENTS , shellExtType ) ,
DECLARE_TYPE ( CSIDL_COMMON_FAVORITES , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_PROGRAMS , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_STARTMENU , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_STARTUP , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_TEMPLATES , folderType ) ,
2004-10-21 21:59:46 +02:00
/* first appearing in shell32 version 4.71: */
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_APPDATA , folderType ) ,
2004-10-21 21:59:46 +02:00
/* first appearing in shell32 version 4.72: */
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_INTERNET_CACHE , ieSpecialType ) ,
2004-10-21 21:59:46 +02:00
/* first appearing in shell32 version 5.0: */
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_ADMINTOOLS , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_APPDATA , folderType ) ,
DECLARE_TYPE ( CSIDL_LOCAL_APPDATA , folderType ) ,
DECLARE_TYPE ( OLD_CSIDL_MYDOCUMENTS , folderType ) ,
DECLARE_TYPE ( CSIDL_MYMUSIC , folderType ) ,
DECLARE_TYPE ( CSIDL_MYPICTURES , folderType ) ,
DECLARE_TYPE ( CSIDL_MYVIDEO , folderType ) ,
DECLARE_TYPE ( CSIDL_PROFILE , folderType ) ,
DECLARE_TYPE ( CSIDL_PROGRAM_FILES , folderType ) ,
DECLARE_TYPE ( CSIDL_PROGRAM_FILESX86 , folderType ) ,
DECLARE_TYPE ( CSIDL_PROGRAM_FILES_COMMON , folderType ) ,
DECLARE_TYPE ( CSIDL_PROGRAM_FILES_COMMONX86 , folderType ) ,
DECLARE_TYPE ( CSIDL_SYSTEM , folderType ) ,
DECLARE_TYPE ( CSIDL_WINDOWS , folderType ) ,
2004-10-21 21:59:46 +02:00
/* first appearing in shell32 6.0: */
2009-02-03 18:45:00 +01:00
DECLARE_TYPE ( CSIDL_CDBURN_AREA , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_MUSIC , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_PICTURES , folderType ) ,
DECLARE_TYPE ( CSIDL_COMMON_VIDEO , folderType ) ,
DECLARE_TYPE ( CSIDL_COMPUTERSNEARME , workgroupType ) ,
DECLARE_TYPE ( CSIDL_RESOURCES , folderType ) ,
DECLARE_TYPE ( CSIDL_RESOURCES_LOCALIZED , folderType ) ,
2004-10-21 21:59:46 +02:00
} ;
2009-02-03 18:45:00 +01:00
# undef DECLARE_TYPE
2004-10-21 21:59:46 +02:00
static void loadShell32 ( void )
{
2007-08-15 21:00:06 +02:00
HMODULE hShell32 = GetModuleHandleA ( " shell32 " ) ;
# define GET_PROC(func) \
p # # func = ( void * ) GetProcAddress ( hShell32 , # func ) ; \
if ( ! p # # func ) \
trace ( " GetProcAddress(%s) failed \n " , # func ) ;
GET_PROC ( DllGetVersion )
GET_PROC ( SHGetFolderPathA )
2010-09-14 17:01:44 +02:00
GET_PROC ( SHGetFolderPathEx )
GET_PROC ( SHGetKnownFolderPath )
2011-06-14 13:09:31 +02:00
GET_PROC ( SHSetKnownFolderPath )
2007-08-15 21:00:06 +02:00
GET_PROC ( SHGetSpecialFolderPathA )
GET_PROC ( SHGetSpecialFolderLocation )
GET_PROC ( ILFindLastID )
if ( ! pILFindLastID )
pILFindLastID = ( void * ) GetProcAddress ( hShell32 , ( LPCSTR ) 16 ) ;
GET_PROC ( SHFileOperationA )
2014-06-28 13:43:06 +02:00
GET_PROC ( PathYetAnotherMakeUniqueName )
2015-05-09 20:46:56 +02:00
GET_PROC ( SHGetKnownFolderIDList )
2019-12-11 11:16:18 +01:00
GET_PROC ( PathResolve ) ;
2007-08-15 21:00:06 +02:00
if ( pDllGetVersion )
{
shellVersion . cbSize = sizeof ( shellVersion ) ;
pDllGetVersion ( & shellVersion ) ;
2008-11-14 11:18:34 +01:00
trace ( " shell32 version is %d.%d \n " ,
shellVersion . dwMajorVersion , shellVersion . dwMinorVersion ) ;
2004-10-21 21:59:46 +02:00
}
2007-08-15 21:00:06 +02:00
# undef GET_PROC
2004-10-21 21:59:46 +02:00
}
2004-10-22 22:25:46 +02:00
# ifndef CSIDL_PROFILES
# define CSIDL_PROFILES 0x003e
# endif
2004-10-21 21:59:46 +02:00
/* A couple utility printing functions */
static const char * getFolderName ( int folder )
{
2007-02-09 12:37:59 +01:00
static char unknown [ 32 ] ;
2004-10-21 21:59:46 +02:00
# define CSIDL_TO_STR(x) case x: return#x;
switch ( folder )
{
CSIDL_TO_STR ( CSIDL_DESKTOP ) ;
CSIDL_TO_STR ( CSIDL_INTERNET ) ;
CSIDL_TO_STR ( CSIDL_PROGRAMS ) ;
CSIDL_TO_STR ( CSIDL_CONTROLS ) ;
CSIDL_TO_STR ( CSIDL_PRINTERS ) ;
CSIDL_TO_STR ( CSIDL_PERSONAL ) ;
CSIDL_TO_STR ( CSIDL_FAVORITES ) ;
CSIDL_TO_STR ( CSIDL_STARTUP ) ;
CSIDL_TO_STR ( CSIDL_RECENT ) ;
CSIDL_TO_STR ( CSIDL_SENDTO ) ;
CSIDL_TO_STR ( CSIDL_BITBUCKET ) ;
CSIDL_TO_STR ( CSIDL_STARTMENU ) ;
2007-05-27 13:37:14 +02:00
CSIDL_TO_STR ( OLD_CSIDL_MYDOCUMENTS ) ;
2004-10-21 21:59:46 +02:00
CSIDL_TO_STR ( CSIDL_MYMUSIC ) ;
CSIDL_TO_STR ( CSIDL_MYVIDEO ) ;
CSIDL_TO_STR ( CSIDL_DESKTOPDIRECTORY ) ;
CSIDL_TO_STR ( CSIDL_DRIVES ) ;
CSIDL_TO_STR ( CSIDL_NETWORK ) ;
CSIDL_TO_STR ( CSIDL_NETHOOD ) ;
CSIDL_TO_STR ( CSIDL_FONTS ) ;
CSIDL_TO_STR ( CSIDL_TEMPLATES ) ;
CSIDL_TO_STR ( CSIDL_COMMON_STARTMENU ) ;
CSIDL_TO_STR ( CSIDL_COMMON_PROGRAMS ) ;
CSIDL_TO_STR ( CSIDL_COMMON_STARTUP ) ;
CSIDL_TO_STR ( CSIDL_COMMON_DESKTOPDIRECTORY ) ;
CSIDL_TO_STR ( CSIDL_APPDATA ) ;
CSIDL_TO_STR ( CSIDL_PRINTHOOD ) ;
CSIDL_TO_STR ( CSIDL_LOCAL_APPDATA ) ;
CSIDL_TO_STR ( CSIDL_ALTSTARTUP ) ;
CSIDL_TO_STR ( CSIDL_COMMON_ALTSTARTUP ) ;
CSIDL_TO_STR ( CSIDL_COMMON_FAVORITES ) ;
CSIDL_TO_STR ( CSIDL_INTERNET_CACHE ) ;
CSIDL_TO_STR ( CSIDL_COOKIES ) ;
CSIDL_TO_STR ( CSIDL_HISTORY ) ;
CSIDL_TO_STR ( CSIDL_COMMON_APPDATA ) ;
CSIDL_TO_STR ( CSIDL_WINDOWS ) ;
CSIDL_TO_STR ( CSIDL_SYSTEM ) ;
CSIDL_TO_STR ( CSIDL_PROGRAM_FILES ) ;
CSIDL_TO_STR ( CSIDL_MYPICTURES ) ;
CSIDL_TO_STR ( CSIDL_PROFILE ) ;
CSIDL_TO_STR ( CSIDL_SYSTEMX86 ) ;
CSIDL_TO_STR ( CSIDL_PROGRAM_FILESX86 ) ;
CSIDL_TO_STR ( CSIDL_PROGRAM_FILES_COMMON ) ;
CSIDL_TO_STR ( CSIDL_PROGRAM_FILES_COMMONX86 ) ;
CSIDL_TO_STR ( CSIDL_COMMON_TEMPLATES ) ;
CSIDL_TO_STR ( CSIDL_COMMON_DOCUMENTS ) ;
CSIDL_TO_STR ( CSIDL_COMMON_ADMINTOOLS ) ;
CSIDL_TO_STR ( CSIDL_ADMINTOOLS ) ;
CSIDL_TO_STR ( CSIDL_CONNECTIONS ) ;
CSIDL_TO_STR ( CSIDL_PROFILES ) ;
CSIDL_TO_STR ( CSIDL_COMMON_MUSIC ) ;
CSIDL_TO_STR ( CSIDL_COMMON_PICTURES ) ;
CSIDL_TO_STR ( CSIDL_COMMON_VIDEO ) ;
CSIDL_TO_STR ( CSIDL_RESOURCES ) ;
CSIDL_TO_STR ( CSIDL_RESOURCES_LOCALIZED ) ;
CSIDL_TO_STR ( CSIDL_COMMON_OEM_LINKS ) ;
CSIDL_TO_STR ( CSIDL_CDBURN_AREA ) ;
CSIDL_TO_STR ( CSIDL_COMPUTERSNEARME ) ;
# undef CSIDL_TO_STR
default :
2007-02-09 12:37:59 +01:00
sprintf ( unknown , " unknown (0x%04x) " , folder ) ;
2004-10-21 21:59:46 +02:00
return unknown ;
}
}
2018-06-22 13:34:01 +02:00
/* Standard CSIDL values (and their flags) uses only two less-significant bytes */
# define NO_CSIDL 0x10000
# define WINE_ATTRIBUTES_OPTIONAL 0x20000
# define KNOWN_FOLDER(id, csidl, name, category, parent1, parent2, relative_path, parsing_name, attributes, definitionFlags) \
{ & id , # id , csidl , # csidl , name , category , { & parent1 , & parent2 } , relative_path , parsing_name , attributes , definitionFlags , __LINE__ }
2004-10-21 21:59:46 +02:00
2018-06-22 13:34:01 +02:00
/* non-published known folders test */
static const GUID _FOLDERID_CryptoKeys = { 0xB88F4DAA , 0xE7BD , 0x49A9 , { 0xB7 , 0x4D , 0x02 , 0x88 , 0x5A , 0x5D , 0xC7 , 0x65 } } ;
static const GUID _FOLDERID_DpapiKeys = { 0x10C07CD0 , 0xEF91 , 0x4567 , { 0xB8 , 0x50 , 0x44 , 0x8B , 0x77 , 0xCB , 0x37 , 0xF9 } } ;
static const GUID _FOLDERID_SystemCertificates = { 0x54EED2E0 , 0xE7CA , 0x4FDB , { 0x91 , 0x48 , 0x0F , 0x42 , 0x47 , 0x29 , 0x1C , 0xFA } } ;
static const GUID _FOLDERID_CredentialManager = { 0x915221FB , 0x9EFE , 0x4BDA , { 0x8F , 0xD7 , 0xF7 , 0x8D , 0xCA , 0x77 , 0x4F , 0x87 } } ;
2004-10-21 21:59:46 +02:00
2018-06-22 13:34:01 +02:00
struct knownFolderDef {
const KNOWNFOLDERID * folderId ;
const char * sFolderId ;
const int csidl ;
const char * sCsidl ;
const char * sName ;
const KF_CATEGORY category ;
const KNOWNFOLDERID * fidParents [ 2 ] ;
const char * sRelativePath ;
const char * sParsingName ;
const DWORD attributes ;
const KF_DEFINITION_FLAGS definitionFlags ;
const int line ;
} ;
2004-10-21 21:59:46 +02:00
2018-06-22 13:34:01 +02:00
/* Note: content of parsing name may vary between Windows versions.
* As a base , values from 6.0 ( Vista ) were used . Some entries may contain
* alternative values . In that case , Windows version where the value was
* found is noted .
*
* The list of values for parsing name was encoded as a number of null -
* terminated strings placed one by one ( separated by null byte only ) .
* End of list is marked by two consecutive null bytes .
2011-08-03 18:11:58 +02:00
*/
2011-06-14 13:08:59 +02:00
static const struct knownFolderDef known_folders [ ] = {
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_AddNewPrograms ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" AddNewProgramsFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{15eae92e-f17a-4431-9f28-805e482dafd4} \0 "
2011-08-04 16:25:17 +02:00
" shell:::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{15eae92e-f17a-4431-9f28-805e482dafd4} \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_AdminTools ,
2015-04-08 17:59:37 +02:00
CSIDL_ADMINTOOLS ,
2011-08-03 18:11:58 +02:00
" Administrative Tools " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Programs , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" Administrative Tools " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_AppUpdates ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" AppUpdatesFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{7b81be6a-ce2b-4676-a29e-eb907a5126c5} \\ ::{d450a8a1-9568-45c7-9c0e-b4f9fb4537bd} \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{7b81be6a-ce2b-4676-a29e-eb907a5126c5} \\ ::{d450a8a1-9568-45c7-9c0e-b4f9fb4537bd} \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CDBurning ,
2015-04-09 22:28:26 +02:00
CSIDL_CDBURN_AREA ,
2011-08-03 18:11:58 +02:00
" CD Burning " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" Microsoft \\ Windows \\ Burn \\ Burn " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_LOCAL_REDIRECT_ONLY ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ChangeRemovePrograms ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" ChangeRemoveProgramsFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{7b81be6a-ce2b-4676-a29e-eb907a5126c5} \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{7b81be6a-ce2b-4676-a29e-eb907a5126c5} \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CommonAdminTools ,
2015-04-08 17:59:37 +02:00
CSIDL_COMMON_ADMINTOOLS ,
2011-08-03 18:11:58 +02:00
" Common Administrative Tools " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_CommonPrograms , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" Administrative Tools " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CommonOEMLinks ,
2015-04-09 22:28:26 +02:00
CSIDL_COMMON_OEM_LINKS ,
2015-03-17 16:03:23 +01:00
" OEM Links " ,
2011-08-03 18:11:58 +02:00
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramData , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" OEM Links " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CommonPrograms ,
CSIDL_COMMON_PROGRAMS ,
" Common Programs " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_CommonStartMenu , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" Programs " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CommonStartMenu ,
CSIDL_COMMON_STARTMENU ,
" Common Start Menu " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Start Menu \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CommonStartup ,
2015-04-08 17:59:37 +02:00
CSIDL_COMMON_STARTUP ,
2011-08-03 18:11:58 +02:00
" Common Startup " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_CommonPrograms , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" StartUp " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_CommonTemplates ,
2015-04-08 17:59:37 +02:00
CSIDL_COMMON_TEMPLATES ,
2011-08-03 18:11:58 +02:00
" Common Templates " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Templates \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ComputerFolder ,
2015-04-08 17:59:37 +02:00
CSIDL_DRIVES ,
2011-08-03 18:11:58 +02:00
" MyComputerFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{20D04FE0-3AEA-1069-A2D8-08002B30309D} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ConflictFolder ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" ConflictFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \\ ::{E413D040-6788-4C22-957E-175D1C513A34}, \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \\ ::{E413D040-6788-4C22-957E-175D1C513A34}, \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ConnectionsFolder ,
2015-04-08 17:59:37 +02:00
CSIDL_CONNECTIONS ,
2011-08-03 18:11:58 +02:00
" ConnectionsFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{7007ACC7-3202-11D1-AAD2-00805FC1270E} \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{7007ACC7-3202-11D1-AAD2-00805FC1270E} \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Contacts ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Contacts " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" Contacts " ,
2011-08-04 16:25:17 +02:00
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {56784854-C6CB-462B-8169-88E350ACB882} \0 \0 " ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ControlPanelFolder ,
2015-04-08 15:55:46 +02:00
CSIDL_CONTROLS ,
2011-08-03 18:11:58 +02:00
" ControlPanelFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Cookies ,
2015-04-08 17:59:37 +02:00
CSIDL_COOKIES ,
2011-08-03 18:11:58 +02:00
" Cookies " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , FOLDERID_LocalAppData ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Cookies \0 Microsoft \\ Windows \\ INetCookies \0 " /* win8 */ ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Desktop ,
CSIDL_DESKTOP ,
" Desktop " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2011-08-03 18:11:58 +02:00
" Desktop " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_DeviceMetadataStore ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Device Metadata Store " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ DeviceMetadataStore \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Documents ,
2015-04-08 15:55:46 +02:00
CSIDL_MYDOCUMENTS ,
2011-08-03 18:11:58 +02:00
" Personal " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Documents \0 " ,
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {FDD39AD0-238F-46AF-ADB4-6C85480369C7} \0 shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D} \\ ::{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0} \0 \0 " , /* win8 */
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_DocumentsLibrary ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" DocumentsLibrary " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Libraries , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Documents.library-ms \0 " ,
2011-08-04 16:25:17 +02:00
" ::{031E4825-7B94-4dc3-B131-E946B44C8DD5} \\ {7b0db17d-9cd2-4a93-9733-46cc89022e7c} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE | KFDF_STREAM ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Downloads ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Downloads " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Downloads \0 " ,
" (null) \0 shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D} \\ ::{374DE290-123F-4565-9164-39C4925E467B} \0 \0 " , /* win8 */
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Favorites ,
2015-04-08 15:55:46 +02:00
CSIDL_FAVORITES ,
2011-08-03 18:11:58 +02:00
" Favorites " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Favorites \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Fonts ,
CSIDL_FONTS ,
" Fonts " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
FOLDERID_Windows , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Games ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Games " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{ED228FDF-9EA8-4870-83b1-96b02CFE0D52} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_GameTasks ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" GameTasks " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ GameExplorer \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_LOCAL_REDIRECT_ONLY ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_History ,
2015-04-08 17:59:37 +02:00
CSIDL_HISTORY ,
2011-08-03 18:11:58 +02:00
" History " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ History \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_LOCAL_REDIRECT_ONLY ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_HomeGroup ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" HomeGroupFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ImplicitAppShortcuts ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" ImplicitAppShortcuts " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_UserPinned , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" ImplicitAppShortcuts \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_InternetCache ,
2015-04-08 17:59:37 +02:00
CSIDL_INTERNET_CACHE ,
2011-08-03 18:11:58 +02:00
" Cache " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Temporary Internet Files \0 Microsoft \\ Windows \\ INetCache \0 \0 " , /* win8 */
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_LOCAL_REDIRECT_ONLY ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_InternetFolder ,
2015-04-08 15:55:46 +02:00
CSIDL_INTERNET ,
2011-08-03 18:11:58 +02:00
" InternetFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{871C5380-42A0-1069-A2EA-08002B30309D} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Libraries ,
2015-04-09 22:28:26 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Libraries " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Libraries \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Links ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Links " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Links \0 " ,
2011-08-04 16:25:17 +02:00
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968} \0 \0 " ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_LocalAppData ,
2015-04-08 17:59:37 +02:00
CSIDL_LOCAL_APPDATA ,
2011-08-03 18:11:58 +02:00
" Local AppData " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" AppData \\ Local \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_LOCAL_REDIRECT_ONLY | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_LocalAppDataLow ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" LocalAppDataLow " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" AppData \\ LocalLow \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED ,
KFDF_LOCAL_REDIRECT_ONLY | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_LocalizedResourcesDir ,
2015-04-09 22:28:26 +02:00
CSIDL_RESOURCES_LOCALIZED ,
2011-08-03 18:11:58 +02:00
" LocalizedResourcesDir " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Music ,
2015-04-08 17:59:37 +02:00
CSIDL_MYMUSIC ,
2011-08-03 18:11:58 +02:00
" My Music " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Music \0 " ,
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {4BD8D571-6D19-48D3-BE97-422220080E43} \0 shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D} \\ ::{1CF1260C-4DD0-4EBB-811F-33C572699FDE} \0 \0 " , /* win8 */
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_MusicLibrary ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" MusicLibrary " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Libraries , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Music.library-ms \0 " ,
2011-08-04 16:25:17 +02:00
" ::{031E4825-7B94-4dc3-B131-E946B44C8DD5} \\ {2112AB0A-C86A-4ffe-A368-0DE96E47012E} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE | KFDF_STREAM ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_NetHood ,
2015-04-08 17:59:37 +02:00
CSIDL_NETHOOD ,
2011-08-03 18:11:58 +02:00
" NetHood " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Network Shortcuts \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_NetworkFolder ,
2015-04-08 17:59:37 +02:00
CSIDL_NETWORK ,
2011-08-03 18:11:58 +02:00
" NetworkPlacesFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_OriginalImages ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Original Images " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows Photo Gallery \\ Original Images \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PhotoAlbums ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" PhotoAlbums " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Pictures , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Slide Shows \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Pictures ,
2015-04-08 17:59:37 +02:00
CSIDL_MYPICTURES ,
2011-08-03 18:11:58 +02:00
" My Pictures " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Pictures \0 " ,
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {33E28130-4E1E-4676-835A-98395C3BC3BB} \0 shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D} \\ ::{3ADD1653-EB32-4CB0-BBD7-DFA0ABB5ACCA} \0 \0 " , /* win8 */
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PicturesLibrary ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" PicturesLibrary " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Libraries , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Pictures.library-ms \0 " ,
2011-08-04 16:25:17 +02:00
" ::{031E4825-7B94-4dc3-B131-E946B44C8DD5} \\ {A990AE9F-A03B-4e80-94BC-9912D7504104} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE | KFDF_STREAM ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Playlists ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Playlists " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Music , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Playlists \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PrintersFolder ,
2015-04-08 15:55:46 +02:00
CSIDL_PRINTERS ,
2011-08-03 18:11:58 +02:00
" PrintersFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{2227A280-3AEA-1069-A2DE-08002B30309D} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PrintHood ,
2015-04-08 17:59:37 +02:00
CSIDL_PRINTHOOD ,
2011-08-03 18:11:58 +02:00
" PrintHood " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Printer Shortcuts \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Profile ,
2015-04-08 17:59:37 +02:00
CSIDL_PROFILE ,
2011-08-03 18:11:58 +02:00
" Profile " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramData ,
CSIDL_COMMON_APPDATA ,
" Common AppData " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramFiles ,
CSIDL_PROGRAM_FILES ,
" ProgramFiles " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE
) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramFilesCommon ,
CSIDL_PROGRAM_FILES_COMMON ,
" ProgramFilesCommon " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-04 16:25:47 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramFilesCommonX64 ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-04 16:25:47 +02:00
" ProgramFilesCommonX64 " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-04 16:25:47 +02:00
NULL ,
NULL ,
0 ,
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramFilesCommonX86 ,
2015-04-08 17:59:37 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" ProgramFilesCommonX86 " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-04 16:25:47 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramFilesX64 ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-04 16:25:47 +02:00
" ProgramFilesX64 " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-04 16:25:47 +02:00
NULL ,
NULL ,
0 ,
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ProgramFilesX86 ,
2015-04-08 17:59:37 +02:00
CSIDL_PROGRAM_FILESX86 ,
2011-08-03 18:11:58 +02:00
" ProgramFilesX86 " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Programs ,
2015-04-08 15:55:46 +02:00
CSIDL_PROGRAMS ,
2011-08-03 18:11:58 +02:00
" Programs " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_StartMenu , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Programs \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Public ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Public " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{4336a54d-038b-4685-ab02-99bb52d3fb8b} \0 "
2011-08-04 16:25:17 +02:00
" (null) \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicDesktop ,
2015-04-08 17:59:37 +02:00
CSIDL_COMMON_DESKTOPDIRECTORY ,
2011-08-03 18:11:58 +02:00
" Common Desktop " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Desktop \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicDocuments ,
2015-04-08 17:59:37 +02:00
CSIDL_COMMON_DOCUMENTS ,
2011-08-03 18:11:58 +02:00
" Common Documents " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Documents \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicDownloads ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" CommonDownloads " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Downloads \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicGameTasks ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" PublicGameTasks " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ GameExplorer \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_LOCAL_REDIRECT_ONLY ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicLibraries ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" PublicLibraries " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Libraries \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicMusic ,
2015-04-09 22:28:26 +02:00
CSIDL_COMMON_MUSIC ,
2011-08-03 18:11:58 +02:00
" CommonMusic " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Music \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicPictures ,
2015-04-09 22:28:26 +02:00
CSIDL_COMMON_PICTURES ,
2011-08-03 18:11:58 +02:00
" CommonPictures " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Pictures \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicRingtones ,
2015-04-10 20:10:48 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" CommonRingtones " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Ringtones \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_PublicVideos ,
2015-04-09 22:28:26 +02:00
CSIDL_COMMON_VIDEO ,
2011-08-03 18:11:58 +02:00
" CommonVideo " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_Public , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Videos \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_QuickLaunch ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Quick Launch " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Internet Explorer \\ Quick Launch \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Recent ,
2015-04-08 15:55:46 +02:00
CSIDL_RECENT ,
2011-08-03 18:11:58 +02:00
" Recent " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Recent \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_RecordedTVLibrary ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" RecordedTVLibrary " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_PublicLibraries , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" RecordedTV.library-ms \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE | KFDF_STREAM ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_RecycleBinFolder ,
2015-04-08 15:55:46 +02:00
CSIDL_BITBUCKET ,
2011-08-03 18:11:58 +02:00
" RecycleBinFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{645FF040-5081-101B-9F08-00AA002F954E} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_ResourceDir ,
2015-04-09 22:28:26 +02:00
CSIDL_RESOURCES ,
2011-08-03 18:11:58 +02:00
" ResourceDir " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Ringtones ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Ringtones " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Ringtones \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_RoamingAppData ,
2015-04-08 17:59:37 +02:00
CSIDL_APPDATA ,
2011-08-03 18:11:58 +02:00
" AppData " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" AppData \\ Roaming \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SampleMusic ,
2015-04-13 15:21:17 +02:00
NO_CSIDL | WINE_ATTRIBUTES_OPTIONAL /* win8 */ ,
2011-08-03 18:11:58 +02:00
" SampleMusic " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_PublicMusic , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Sample Music \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SamplePictures ,
2015-04-13 15:21:17 +02:00
NO_CSIDL | WINE_ATTRIBUTES_OPTIONAL /* win8 */ ,
2011-08-03 18:11:58 +02:00
" SamplePictures " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_PublicPictures , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Sample Pictures \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SamplePlaylists ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SamplePlaylists " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_PublicMusic , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Sample Playlists \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SampleVideos ,
2015-04-13 15:21:17 +02:00
NO_CSIDL | WINE_ATTRIBUTES_OPTIONAL /* win8 */ ,
2011-08-03 18:11:58 +02:00
" SampleVideos " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_PublicVideos , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Sample Videos \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SavedGames ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SavedGames " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Saved Games \0 " ,
2011-08-04 16:25:17 +02:00
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4} \0 \0 " ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SavedSearches ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Searches " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Searches \0 " ,
2011-08-04 16:25:17 +02:00
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {7d1d3a04-debb-4115-95cf-2f29da2920da} \0 \0 " ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE | KFDF_PUBLISHEXPANDEDPATH ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SEARCH_CSC ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" CSCFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" shell:::{BD7A2E7B-21CB-41b2-A086-B309680C6B7E} \\ * \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SearchHome ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SearchHomeFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{9343812e-1c37-4a49-a12e-4b2d810d956b} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SEARCH_MAPI ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" MAPIFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" shell:::{89D83576-6BD1-4C86-9454-BEB04E94C819} \\ * \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SendTo ,
2015-04-08 15:55:46 +02:00
CSIDL_SENDTO ,
2011-08-03 18:11:58 +02:00
" SendTo " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ SendTo \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SidebarDefaultParts ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Default Gadgets " ,
KF_CATEGORY_COMMON ,
2015-03-11 18:12:54 +01:00
FOLDERID_ProgramFiles , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Windows Sidebar \\ Gadgets \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SidebarParts ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" Gadgets " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows Sidebar \\ Gadgets \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_StartMenu ,
2015-04-08 17:59:37 +02:00
CSIDL_STARTMENU ,
2011-08-03 18:11:58 +02:00
" Start Menu " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Start Menu \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Startup ,
2015-04-08 15:55:46 +02:00
CSIDL_STARTUP ,
2011-08-03 18:11:58 +02:00
" Startup " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Programs , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" StartUp \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SyncManagerFolder ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SyncCenterFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SyncResultsFolder ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SyncResultsFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \\ ::{BC48B32F-5910-47F5-8570-5074A8A5636A}, \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \\ ::{BC48B32F-5910-47F5-8570-5074A8A5636A}, \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SyncSetupFolder ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SyncSetupFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
" ::{21EC2020-3AEA-1069-A2DD-08002B30309D} \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \\ ::{F1390A9A-A3F4-4E5D-9C5F-98F3BD8D935C}, \0 "
2011-08-04 16:25:17 +02:00
" ::{26EE0668-A00A-44D7-9371-BEB064C98683} \\ 0 \\ ::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF} \\ ::{F1390A9A-A3F4-4E5D-9C5F-98F3BD8D935C}, \0 \0 " /* 6.1 */ ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_System ,
CSIDL_SYSTEM ,
" System " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_SystemX86 ,
2015-04-08 17:59:37 +02:00
CSIDL_SYSTEMX86 ,
2011-08-03 18:11:58 +02:00
" SystemX86 " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Templates ,
2015-04-08 17:59:37 +02:00
CSIDL_TEMPLATES ,
2011-08-03 18:11:58 +02:00
" Templates " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_RoamingAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Microsoft \\ Windows \\ Templates \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_UserPinned ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" User Pinned " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_QuickLaunch , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" User Pinned \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_HIDDEN ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_UserProfiles ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" UserProfiles " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_UserProgramFiles ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" UserProgramFiles " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_LocalAppData , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Programs \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_UserProgramFilesCommon ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" UserProgramFilesCommon " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_UserProgramFiles , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Common \0 " ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_UsersFiles ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" UsersFilesFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_UsersLibraries ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" UsersLibrariesFolder " ,
KF_CATEGORY_VIRTUAL ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
" ::{031E4825-7B94-4dc3-B131-E946B44C8DD5} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Videos ,
2015-04-08 17:59:37 +02:00
CSIDL_MYVIDEO ,
2011-08-03 18:11:58 +02:00
" My Video " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Profile , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Videos \0 " ,
" ::{59031a47-3f72-44a7-89c5-5595fe6b30ee} \\ {18989B1D-99B5-455B-841C-AB7C74E4DDFC} \0 shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D} \\ ::{A0953C92-50DC-43BF-BE83-3742FED03C9C} \0 \0 " , /* win8 */
2011-08-04 16:25:25 +02:00
FILE_ATTRIBUTE_READONLY ,
KFDF_ROAMABLE | KFDF_PRECREATE ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_VideosLibrary ,
2015-04-08 15:55:46 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" VideosLibrary " ,
KF_CATEGORY_PERUSER ,
2015-03-11 18:12:54 +01:00
FOLDERID_Libraries , GUID_NULL ,
2015-03-11 18:11:48 +01:00
" Videos.library-ms \0 " ,
2011-08-04 16:25:17 +02:00
" ::{031E4825-7B94-4dc3-B131-E946B44C8DD5} \\ {491E922F-5643-4af4-A7EB-4E7A138D8174} \0 \0 " ,
2011-08-04 16:25:25 +02:00
0 ,
KFDF_PRECREATE | KFDF_STREAM ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( FOLDERID_Windows ,
CSIDL_WINDOWS ,
" Windows " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( _FOLDERID_CredentialManager ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" CredentialManager " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( _FOLDERID_CryptoKeys ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" CryptoKeys " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( _FOLDERID_DpapiKeys ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" DpapiKeys " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-08-03 18:11:58 +02:00
KNOWN_FOLDER ( _FOLDERID_SystemCertificates ,
2015-04-13 15:21:17 +02:00
NO_CSIDL ,
2011-08-03 18:11:58 +02:00
" SystemCertificates " ,
KF_CATEGORY_FIXED ,
2015-03-11 18:12:54 +01:00
GUID_NULL , GUID_NULL ,
2011-08-03 18:11:58 +02:00
NULL ,
2011-08-04 16:25:17 +02:00
NULL ,
2011-08-04 16:25:25 +02:00
0 ,
2011-08-04 16:25:17 +02:00
0 ) ,
2011-06-14 13:08:59 +02:00
} ;
# undef KNOWN_FOLDER
2018-06-22 13:34:03 +02:00
BOOL known_folder_found [ ARRAY_SIZE ( known_folders ) ] ;
2011-06-14 13:08:59 +02:00
2018-06-22 13:34:01 +02:00
static void test_parameters ( void )
{
LPITEMIDLIST pidl = NULL ;
char path [ MAX_PATH ] ;
HRESULT hr ;
2020-01-06 22:08:21 +01:00
/* check a bogus CSIDL: */
pidl = NULL ;
hr = SHGetFolderLocation ( NULL , 0xeeee , NULL , 0 , & pidl ) ;
ok ( hr = = E_INVALIDARG , " got 0x%08x, expected E_INVALIDARG \n " , hr ) ;
2018-06-22 13:34:01 +02:00
2020-01-06 22:08:21 +01:00
/* check a bogus user token: */
pidl = NULL ;
hr = SHGetFolderLocation ( NULL , CSIDL_FAVORITES , ( HANDLE ) 2 , 0 , & pidl ) ;
ok ( hr = = E_FAIL | | hr = = E_HANDLE , " got 0x%08x, expected E_FAIL or E_HANDLE \n " , hr ) ;
2018-06-22 13:34:01 +02:00
2020-01-06 22:08:21 +01:00
/* a NULL pidl pointer crashes, so don't test it */
2018-06-22 13:34:01 +02:00
if ( pSHGetSpecialFolderLocation )
{
if ( 0 )
/* crashes */
SHGetSpecialFolderLocation ( NULL , 0 , NULL ) ;
hr = pSHGetSpecialFolderLocation ( NULL , 0xeeee , & pidl ) ;
ok ( hr = = E_INVALIDARG , " got returned 0x%08x \n " , hr ) ;
}
if ( pSHGetFolderPathA )
{
/* expect 2's a bogus handle, especially since we didn't open it */
hr = pSHGetFolderPathA ( NULL , CSIDL_DESKTOP , ( HANDLE ) 2 , SHGFP_TYPE_DEFAULT , path ) ;
ok ( hr = = E_FAIL | | hr = = E_HANDLE | | /* Vista and 2k8 */
broken ( hr = = S_OK ) , /* W2k and Me */ " got 0x%08x, expected E_FAIL \n " , hr ) ;
hr = pSHGetFolderPathA ( NULL , 0xeeee , NULL , SHGFP_TYPE_DEFAULT , path ) ;
ok ( hr = = E_INVALIDARG , " got 0x%08x, expected E_INVALIDARG \n " , hr ) ;
}
if ( pSHGetSpecialFolderPathA )
{
BOOL ret ;
if ( 0 )
pSHGetSpecialFolderPathA ( NULL , NULL , CSIDL_BITBUCKET , FALSE ) ;
/* odd but true: calling with a NULL path still succeeds if it's a real
* dir ( on some windows platform ) . on winME it generates exception .
*/
ret = pSHGetSpecialFolderPathA ( NULL , path , CSIDL_PROGRAMS , FALSE ) ;
ok ( ret , " got %d \n " , ret ) ;
ret = pSHGetSpecialFolderPathA ( NULL , path , 0xeeee , FALSE ) ;
ok ( ! ret , " got %d \n " , ret ) ;
}
}
/* Returns the folder's PIDL type, or 0xff if one can't be found. */
static BYTE testSHGetFolderLocation ( int folder )
{
LPITEMIDLIST pidl ;
HRESULT hr ;
BYTE ret = 0xff ;
pidl = NULL ;
2020-01-06 22:08:21 +01:00
hr = SHGetFolderLocation ( NULL , folder , NULL , 0 , & pidl ) ;
2018-06-22 13:34:01 +02:00
if ( hr = = S_OK )
{
if ( pidl )
{
LPITEMIDLIST pidlLast = pILFindLastID ( pidl ) ;
ok ( pidlLast ! = NULL , " %s: ILFindLastID failed \n " ,
getFolderName ( folder ) ) ;
if ( pidlLast )
ret = pidlLast - > mkid . abID [ 0 ] ;
2020-01-06 22:08:22 +01:00
ILFree ( pidl ) ;
2018-06-22 13:34:01 +02:00
}
}
2020-01-06 22:08:21 +01:00
2018-06-22 13:34:01 +02:00
return ret ;
}
/* Returns the folder's PIDL type, or 0xff if one can't be found. */
static BYTE testSHGetSpecialFolderLocation ( int folder )
{
LPITEMIDLIST pidl ;
HRESULT hr ;
BYTE ret = 0xff ;
/* treat absence of function as success */
if ( ! pSHGetSpecialFolderLocation ) return TRUE ;
pidl = NULL ;
hr = pSHGetSpecialFolderLocation ( NULL , folder , & pidl ) ;
if ( hr = = S_OK )
{
if ( pidl )
{
LPITEMIDLIST pidlLast = pILFindLastID ( pidl ) ;
ok ( pidlLast ! = NULL ,
" %s: ILFindLastID failed \n " , getFolderName ( folder ) ) ;
if ( pidlLast )
ret = pidlLast - > mkid . abID [ 0 ] ;
2020-01-06 22:08:22 +01:00
ILFree ( pidl ) ;
2018-06-22 13:34:01 +02:00
}
}
return ret ;
}
static void test_SHGetFolderPath ( BOOL optional , int folder )
{
char path [ MAX_PATH ] ;
HRESULT hr ;
if ( ! pSHGetFolderPathA ) return ;
hr = pSHGetFolderPathA ( NULL , folder , NULL , SHGFP_TYPE_CURRENT , path ) ;
ok ( hr = = S_OK | | optional ,
" SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x \n " , getFolderName ( folder ) , hr ) ;
}
static void test_SHGetSpecialFolderPath ( BOOL optional , int folder )
{
char path [ MAX_PATH ] ;
BOOL ret ;
if ( ! pSHGetSpecialFolderPathA ) return ;
ret = pSHGetSpecialFolderPathA ( NULL , path , folder , FALSE ) ;
if ( ret & & winetest_interactive )
printf ( " %s: %s \n " , getFolderName ( folder ) , path ) ;
ok ( ret | | optional ,
" SHGetSpecialFolderPathA(NULL, path, %s, FALSE) failed \n " ,
getFolderName ( folder ) ) ;
}
static void test_ShellValues ( const struct shellExpectedValues testEntries [ ] ,
int numEntries , BOOL optional )
{
int i ;
for ( i = 0 ; i < numEntries ; i + + )
{
BYTE type ;
int j ;
BOOL foundTypeMatch = FALSE ;
2020-01-06 22:08:21 +01:00
type = testSHGetFolderLocation ( testEntries [ i ] . folder ) ;
for ( j = 0 ; ! foundTypeMatch & & j < testEntries [ i ] . numTypes ; j + + )
if ( testEntries [ i ] . types [ j ] = = type )
foundTypeMatch = TRUE ;
ok ( foundTypeMatch | | optional | | broken ( type = = 0xff ) /* Win9x */ ,
" %s has unexpected type %d (0x%02x) \n " ,
getFolderName ( testEntries [ i ] . folder ) , type , type ) ;
2018-06-22 13:34:01 +02:00
type = testSHGetSpecialFolderLocation ( testEntries [ i ] . folder ) ;
for ( j = 0 , foundTypeMatch = FALSE ; ! foundTypeMatch & &
j < testEntries [ i ] . numTypes ; j + + )
if ( testEntries [ i ] . types [ j ] = = type )
foundTypeMatch = TRUE ;
ok ( foundTypeMatch | | optional | | broken ( type = = 0xff ) /* Win9x */ ,
" %s has unexpected type %d (0x%02x) \n " ,
getFolderName ( testEntries [ i ] . folder ) , type , type ) ;
switch ( type )
{
case PT_FOLDER :
case PT_DRIVE :
case PT_DRIVE2 :
case PT_IESPECIAL2 :
test_SHGetFolderPath ( optional , testEntries [ i ] . folder ) ;
test_SHGetSpecialFolderPath ( optional , testEntries [ i ] . folder ) ;
break ;
}
}
}
/* Attempts to verify that the folder path corresponding to the folder CSIDL
* value has the same value as the environment variable with name envVar .
* Doesn ' t mind if SHGetSpecialFolderPath fails for folder or if envVar isn ' t
* set in this environment ; different OS and shell version behave differently .
* However , if both are present , fails if envVar ' s value is not the same
* ( byte - for - byte ) as what SHGetSpecialFolderPath returns .
*/
static void matchSpecialFolderPathToEnv ( int folder , const char * envVar )
{
char path [ MAX_PATH ] ;
if ( ! pSHGetSpecialFolderPathA ) return ;
if ( pSHGetSpecialFolderPathA ( NULL , path , folder , FALSE ) )
{
char * envVal = getenv ( envVar ) ;
ok ( ! envVal | | ! lstrcmpiA ( envVal , path ) ,
" %%%s%% does not match SHGetSpecialFolderPath: \n "
" %%%s%% is %s \n SHGetSpecialFolderPath returns %s \n " ,
envVar , envVar , envVal , path ) ;
}
}
/* Attempts to match the GUID returned by SHGetFolderLocation for folder with
* GUID . Assumes the type of the returned PIDL is in fact a GUID , but doesn ' t
* fail if it isn ' t - - that check should already have been done .
* Fails if the returned PIDL is a GUID whose value does not match guid .
*/
static void matchGUID ( int folder , const GUID * guid , const GUID * guid_alt )
{
LPITEMIDLIST pidl ;
HRESULT hr ;
if ( ! guid ) return ;
pidl = NULL ;
2020-01-06 22:08:21 +01:00
hr = SHGetFolderLocation ( NULL , folder , NULL , 0 , & pidl ) ;
2018-06-22 13:34:01 +02:00
if ( hr = = S_OK )
{
LPITEMIDLIST pidlLast = pILFindLastID ( pidl ) ;
if ( pidlLast & & ( pidlLast - > mkid . abID [ 0 ] = = PT_SHELLEXT | |
pidlLast - > mkid . abID [ 0 ] = = PT_GUID ) )
{
GUID * shellGuid = ( GUID * ) ( pidlLast - > mkid . abID + 2 ) ;
if ( ! guid_alt )
ok ( IsEqualIID ( shellGuid , guid ) ,
" %s: got GUID %s, expected %s \n " , getFolderName ( folder ) ,
wine_dbgstr_guid ( shellGuid ) , wine_dbgstr_guid ( guid ) ) ;
else
ok ( IsEqualIID ( shellGuid , guid ) | |
IsEqualIID ( shellGuid , guid_alt ) ,
" %s: got GUID %s, expected %s or %s \n " , getFolderName ( folder ) ,
wine_dbgstr_guid ( shellGuid ) , wine_dbgstr_guid ( guid ) , wine_dbgstr_guid ( guid_alt ) ) ;
}
2020-01-06 22:08:22 +01:00
ILFree ( pidl ) ;
2018-06-22 13:34:01 +02:00
}
}
/* Checks the PIDL type of all the known values. */
static void test_PidlTypes ( void )
{
/* Desktop */
test_SHGetFolderPath ( FALSE , CSIDL_DESKTOP ) ;
test_SHGetSpecialFolderPath ( FALSE , CSIDL_DESKTOP ) ;
test_ShellValues ( requiredShellValues , ARRAY_SIZE ( requiredShellValues ) , FALSE ) ;
test_ShellValues ( optionalShellValues , ARRAY_SIZE ( optionalShellValues ) , TRUE ) ;
}
/* FIXME: Should be in shobjidl.idl */
DEFINE_GUID ( CLSID_NetworkExplorerFolder , 0xF02C1A0D , 0xBE21 , 0x4350 , 0x88 , 0xB0 , 0x73 , 0x67 , 0xFC , 0x96 , 0xEF , 0x3C ) ;
DEFINE_GUID ( _CLSID_Documents , 0xA8CDFF1C , 0x4878 , 0x43be , 0xB5 , 0xFD , 0xF8 , 0x09 , 0x1C , 0x1C , 0x60 , 0xD0 ) ;
/* Verifies various shell virtual folders have the correct well-known GUIDs. */
static void test_GUIDs ( void )
{
matchGUID ( CSIDL_BITBUCKET , & CLSID_RecycleBin , NULL ) ;
matchGUID ( CSIDL_CONTROLS , & CLSID_ControlPanel , NULL ) ;
matchGUID ( CSIDL_DRIVES , & CLSID_MyComputer , NULL ) ;
matchGUID ( CSIDL_INTERNET , & CLSID_Internet , NULL ) ;
matchGUID ( CSIDL_NETWORK , & CLSID_NetworkPlaces , & CLSID_NetworkExplorerFolder ) ; /* Vista and higher */
matchGUID ( CSIDL_PERSONAL , & CLSID_MyDocuments , & _CLSID_Documents /* win8 */ ) ;
matchGUID ( CSIDL_COMMON_DOCUMENTS , & CLSID_CommonDocuments , NULL ) ;
matchGUID ( CSIDL_PRINTERS , & CLSID_Printers , NULL ) ;
}
/* Verifies various shell paths match the environment variables to which they
* correspond .
*/
static void test_EnvVars ( void )
{
matchSpecialFolderPathToEnv ( CSIDL_PROGRAM_FILES , " ProgramFiles " ) ;
matchSpecialFolderPathToEnv ( CSIDL_APPDATA , " APPDATA " ) ;
matchSpecialFolderPathToEnv ( CSIDL_PROFILE , " USERPROFILE " ) ;
matchSpecialFolderPathToEnv ( CSIDL_WINDOWS , " SystemRoot " ) ;
matchSpecialFolderPathToEnv ( CSIDL_WINDOWS , " windir " ) ;
matchSpecialFolderPathToEnv ( CSIDL_PROGRAM_FILES_COMMON , " CommonProgramFiles " ) ;
/* this is only set on Wine, but can't hurt to verify it: */
matchSpecialFolderPathToEnv ( CSIDL_SYSTEM , " winsysdir " ) ;
}
/* Loosely based on PathRemoveBackslashA from dlls/shlwapi/path.c */
static BOOL myPathIsRootA ( LPCSTR lpszPath )
{
if ( lpszPath & & * lpszPath & &
lpszPath [ 1 ] = = ' : ' & & lpszPath [ 2 ] = = ' \\ ' & & lpszPath [ 3 ] = = ' \0 ' )
return TRUE ; /* X:\ */
return FALSE ;
}
static LPSTR myPathRemoveBackslashA ( LPSTR lpszPath )
{
LPSTR szTemp = NULL ;
if ( lpszPath )
{
szTemp = CharPrevA ( lpszPath , lpszPath + strlen ( lpszPath ) ) ;
if ( ! myPathIsRootA ( lpszPath ) & & * szTemp = = ' \\ ' )
* szTemp = ' \0 ' ;
}
return szTemp ;
}
/* Verifies the shell path for CSIDL_WINDOWS matches the return from
* GetWindowsDirectory . If SHGetSpecialFolderPath fails , no harm , no foul - - not
* every shell32 version supports CSIDL_WINDOWS .
*/
static void testWinDir ( void )
{
char windowsShellPath [ MAX_PATH ] , windowsDir [ MAX_PATH ] = { 0 } ;
if ( ! pSHGetSpecialFolderPathA ) return ;
if ( pSHGetSpecialFolderPathA ( NULL , windowsShellPath , CSIDL_WINDOWS , FALSE ) )
{
myPathRemoveBackslashA ( windowsShellPath ) ;
GetWindowsDirectoryA ( windowsDir , sizeof ( windowsDir ) ) ;
myPathRemoveBackslashA ( windowsDir ) ;
ok ( ! lstrcmpiA ( windowsDir , windowsShellPath ) ,
" GetWindowsDirectory returns %s SHGetSpecialFolderPath returns %s \n " ,
windowsDir , windowsShellPath ) ;
}
}
/* Verifies the shell path for CSIDL_SYSTEM matches the return from
* GetSystemDirectory . If SHGetSpecialFolderPath fails , no harm ,
* no foul - - not every shell32 version supports CSIDL_SYSTEM .
*/
static void testSystemDir ( void )
{
char systemShellPath [ MAX_PATH ] , systemDir [ MAX_PATH ] , systemDirx86 [ MAX_PATH ] ;
if ( ! pSHGetSpecialFolderPathA ) return ;
GetSystemDirectoryA ( systemDir , sizeof ( systemDir ) ) ;
myPathRemoveBackslashA ( systemDir ) ;
if ( pSHGetSpecialFolderPathA ( NULL , systemShellPath , CSIDL_SYSTEM , FALSE ) )
{
myPathRemoveBackslashA ( systemShellPath ) ;
ok ( ! lstrcmpiA ( systemDir , systemShellPath ) ,
" GetSystemDirectory returns %s SHGetSpecialFolderPath returns %s \n " ,
systemDir , systemShellPath ) ;
}
if ( ! pGetSystemWow64DirectoryA | | ! pGetSystemWow64DirectoryA ( systemDirx86 , sizeof ( systemDirx86 ) ) )
GetSystemDirectoryA ( systemDirx86 , sizeof ( systemDirx86 ) ) ;
myPathRemoveBackslashA ( systemDirx86 ) ;
if ( pSHGetSpecialFolderPathA ( NULL , systemShellPath , CSIDL_SYSTEMX86 , FALSE ) )
{
myPathRemoveBackslashA ( systemShellPath ) ;
ok ( ! lstrcmpiA ( systemDirx86 , systemShellPath ) | | broken ( ! lstrcmpiA ( systemDir , systemShellPath ) ) ,
" GetSystemDirectory returns %s SHGetSpecialFolderPath returns %s \n " ,
systemDir , systemShellPath ) ;
}
}
/* Globals used by subprocesses */
static int myARGC ;
static char * * myARGV ;
static char base [ MAX_PATH ] ;
static char selfname [ MAX_PATH ] ;
static BOOL init ( void )
{
myARGC = winetest_get_mainargs ( & myARGV ) ;
if ( ! GetCurrentDirectoryA ( sizeof ( base ) , base ) ) return FALSE ;
strcpy ( selfname , myARGV [ 0 ] ) ;
return TRUE ;
}
static void doChild ( const char * arg )
{
char path [ MAX_PATH ] ;
HRESULT hr ;
if ( arg [ 0 ] = = ' 1 ' )
{
LPITEMIDLIST pidl ;
char * p ;
/* test what happens when CSIDL_FAVORITES is set to a nonexistent directory */
/* test some failure cases first: */
hr = pSHGetFolderPathA ( NULL , CSIDL_FAVORITES , NULL , SHGFP_TYPE_CURRENT , path ) ;
ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) ,
" SHGetFolderPath returned 0x%08x, expected 0x80070002 \n " , hr ) ;
pidl = NULL ;
2020-01-06 22:08:21 +01:00
hr = SHGetFolderLocation ( NULL , CSIDL_FAVORITES , NULL , 0 , & pidl ) ;
2018-06-22 13:34:01 +02:00
ok ( hr = = E_FAIL | | hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) ,
" SHGetFolderLocation returned 0x%08x \n " , hr ) ;
ok ( ! pSHGetSpecialFolderPathA ( NULL , path , CSIDL_FAVORITES , FALSE ) ,
" SHGetSpecialFolderPath succeeded, expected failure \n " ) ;
pidl = NULL ;
hr = pSHGetSpecialFolderLocation ( NULL , CSIDL_FAVORITES , & pidl ) ;
ok ( hr = = E_FAIL | | hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) ,
" SHGetFolderLocation returned 0x%08x \n " , hr ) ;
/* now test success: */
hr = pSHGetFolderPathA ( NULL , CSIDL_FAVORITES | CSIDL_FLAG_CREATE , NULL ,
SHGFP_TYPE_CURRENT , path ) ;
ok ( hr = = S_OK , " got 0x%08x \n " , hr ) ;
if ( hr = = S_OK )
{
BOOL ret ;
trace ( " CSIDL_FAVORITES was changed to %s \n " , path ) ;
ret = CreateDirectoryA ( path , NULL ) ;
ok ( ! ret , " expected failure with ERROR_ALREADY_EXISTS \n " ) ;
if ( ! ret )
ok ( GetLastError ( ) = = ERROR_ALREADY_EXISTS ,
" got %d, expected ERROR_ALREADY_EXISTS \n " , GetLastError ( ) ) ;
p = path + strlen ( path ) ;
strcpy ( p , " \\ desktop.ini " ) ;
DeleteFileA ( path ) ;
* p = 0 ;
SetFileAttributesA ( path , FILE_ATTRIBUTE_NORMAL ) ;
ret = RemoveDirectoryA ( path ) ;
ok ( ret , " failed to remove %s error %u \n " , path , GetLastError ( ) ) ;
}
}
else if ( arg [ 0 ] = = ' 2 ' )
{
/* make sure SHGetFolderPath still succeeds when the
original value of CSIDL_FAVORITES is restored . */
hr = pSHGetFolderPathA ( NULL , CSIDL_FAVORITES | CSIDL_FLAG_CREATE , NULL ,
SHGFP_TYPE_CURRENT , path ) ;
ok ( hr = = S_OK , " SHGetFolderPath failed: 0x%08x \n " , hr ) ;
}
}
/* Tests the return values from the various shell functions both with and
* without the use of the CSIDL_FLAG_CREATE flag . This flag only appeared in
* version 5 of the shell , so don ' t test unless it ' s at least version 5.
* The test reads a value from the registry , modifies it , calls
* SHGetFolderPath once with the CSIDL_FLAG_CREATE flag , and immediately
* afterward without it . Then it restores the registry and deletes the folder
* that was created .
* One oddity with respect to restoration : shell32 caches somehow , so it needs
* to be reloaded in order to see the correct ( restored ) value .
* Some APIs unrelated to the ones under test may fail , but I expect they ' re
* covered by other unit tests ; I just print out something about failure to
* help trace what ' s going on .
*/
static void test_NonExistentPath ( void )
{
static const char userShellFolders [ ] =
" Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Explorer \\ User Shell Folders " ;
char originalPath [ MAX_PATH ] , modifiedPath [ MAX_PATH ] ;
HKEY key ;
if ( ! pSHGetFolderPathA ) return ;
if ( ! pSHGetSpecialFolderPathA ) return ;
if ( ! pSHGetSpecialFolderLocation ) return ;
if ( ! pSHFileOperationA ) return ;
if ( shellVersion . dwMajorVersion < 5 ) return ;
if ( ! RegOpenKeyExA ( HKEY_CURRENT_USER , userShellFolders , 0 , KEY_ALL_ACCESS ,
& key ) )
{
DWORD len , type ;
len = sizeof ( originalPath ) ;
if ( ! RegQueryValueExA ( key , " Favorites " , NULL , & type ,
( LPBYTE ) & originalPath , & len ) )
{
size_t len = strlen ( originalPath ) ;
memcpy ( modifiedPath , originalPath , len ) ;
modifiedPath [ len + + ] = ' 2 ' ;
modifiedPath [ len + + ] = ' \0 ' ;
trace ( " Changing CSIDL_FAVORITES to %s \n " , modifiedPath ) ;
if ( ! RegSetValueExA ( key , " Favorites " , 0 , type ,
( LPBYTE ) modifiedPath , len ) )
{
char buffer [ MAX_PATH + 20 ] ;
STARTUPINFOA startup ;
PROCESS_INFORMATION info ;
2020-02-21 08:08:49 +01:00
sprintf ( buffer , " %s shellpath 1 " , selfname ) ;
2018-06-22 13:34:01 +02:00
memset ( & startup , 0 , sizeof ( startup ) ) ;
startup . cb = sizeof ( startup ) ;
startup . dwFlags = STARTF_USESHOWWINDOW ;
startup . wShowWindow = SW_SHOWNORMAL ;
CreateProcessA ( NULL , buffer , NULL , NULL , FALSE , 0L , NULL , NULL ,
& startup , & info ) ;
2020-03-16 23:52:21 +01:00
wait_child_process ( info . hProcess ) ;
2018-06-22 13:34:01 +02:00
/* restore original values: */
trace ( " Restoring CSIDL_FAVORITES to %s \n " , originalPath ) ;
RegSetValueExA ( key , " Favorites " , 0 , type , ( LPBYTE ) originalPath ,
strlen ( originalPath ) + 1 ) ;
RegFlushKey ( key ) ;
2020-02-21 08:08:49 +01:00
sprintf ( buffer , " %s shellpath 2 " , selfname ) ;
2018-06-22 13:34:01 +02:00
memset ( & startup , 0 , sizeof ( startup ) ) ;
startup . cb = sizeof ( startup ) ;
startup . dwFlags = STARTF_USESHOWWINDOW ;
startup . wShowWindow = SW_SHOWNORMAL ;
CreateProcessA ( NULL , buffer , NULL , NULL , FALSE , 0L , NULL , NULL ,
& startup , & info ) ;
ok ( WaitForSingleObject ( info . hProcess , 30000 ) = = WAIT_OBJECT_0 ,
" child process termination \n " ) ;
}
}
else skip ( " RegQueryValueExA(key, Favorites, ...) failed \ n " ) ;
if ( key )
RegCloseKey ( key ) ;
}
else skip ( " RegOpenKeyExA(HKEY_CURRENT_USER, %s, ...) failed \ n " , userShellFolders) ;
}
static void test_SHGetFolderPathEx ( void )
{
2018-06-22 13:34:02 +02:00
WCHAR buffer [ MAX_PATH ] , * path , * path2 ;
unsigned int i ;
2018-06-22 13:34:01 +02:00
HRESULT hr ;
DWORD len ;
if ( ! pSHGetKnownFolderPath | | ! pSHGetFolderPathEx )
{
win_skip ( " SHGetKnownFolderPath or SHGetFolderPathEx not available \n " ) ;
return ;
}
if ( 0 ) { /* crashes */
hr = pSHGetKnownFolderPath ( & FOLDERID_Desktop , 0 , NULL , NULL ) ;
ok ( hr = = E_INVALIDARG , " expected E_INVALIDARG, got 0x%08x \n " , hr ) ;
}
/* non-existent folder id */
path = ( void * ) 0xdeadbeef ;
hr = pSHGetKnownFolderPath ( & IID_IOleObject , 0 , NULL , & path ) ;
ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) , " got 0x%08x \n " , hr ) ;
ok ( path = = NULL , " got %p \n " , path ) ;
path = NULL ;
hr = pSHGetKnownFolderPath ( & FOLDERID_Desktop , KF_FLAG_DEFAULT_PATH , NULL , & path ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( path ! = NULL , " expected path != NULL \n " ) ;
CoTaskMemFree ( path ) ;
2018-06-22 13:34:02 +02:00
for ( i = 0 ; i < ARRAY_SIZE ( known_folders ) ; + + i )
{
const KNOWNFOLDERID * folder_id = known_folders [ i ] . folderId ;
path = NULL ;
hr = pSHGetKnownFolderPath ( folder_id , KF_FLAG_DEFAULT , NULL , & path ) ;
if ( FAILED ( hr ) )
2019-02-06 11:48:17 +01:00
{
ok ( path = = NULL , " expected path == NULL \n " ) ;
2018-06-22 13:34:02 +02:00
continue ;
2019-02-06 11:48:17 +01:00
}
2018-06-22 13:34:02 +02:00
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( path ! = NULL , " expected path != NULL \n " ) ;
path2 = NULL ;
hr = pSHGetKnownFolderPath ( folder_id , KF_FLAG_SIMPLE_IDLIST , NULL , & path2 ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
2019-01-12 21:38:41 +01:00
ok ( path2 ! = NULL , " expected path != NULL \n " ) ;
2018-06-22 13:34:02 +02:00
ok ( ! lstrcmpiW ( path , path2 ) , " expected equal paths: %s, %s \n " , wine_dbgstr_w ( path ) , wine_dbgstr_w ( path2 ) ) ;
CoTaskMemFree ( path2 ) ;
path2 = NULL ;
hr = pSHGetKnownFolderPath ( folder_id , KF_FLAG_DONT_UNEXPAND , NULL , & path2 ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( path2 ! = NULL , " expected path != NULL \n " ) ;
ok ( ! lstrcmpiW ( path , path2 ) , " expected equal paths: %s, %s \n " , wine_dbgstr_w ( path ) , wine_dbgstr_w ( path2 ) ) ;
CoTaskMemFree ( path2 ) ;
path2 = NULL ;
hr = pSHGetKnownFolderPath ( folder_id , KF_FLAG_SIMPLE_IDLIST | KF_FLAG_DONT_UNEXPAND , NULL , & path2 ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( path2 ! = NULL , " expected path != NULL \n " ) ;
ok ( ! lstrcmpiW ( path , path2 ) , " expected equal paths: %s, %s \n " , wine_dbgstr_w ( path ) , wine_dbgstr_w ( path2 ) ) ;
CoTaskMemFree ( path2 ) ;
CoTaskMemFree ( path ) ;
}
2018-06-22 13:34:01 +02:00
path = NULL ;
hr = pSHGetKnownFolderPath ( & FOLDERID_Desktop , 0 , NULL , & path ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( path ! = NULL , " expected path != NULL \n " ) ;
hr = pSHGetFolderPathEx ( & FOLDERID_Desktop , 0 , NULL , buffer , MAX_PATH ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( ! lstrcmpiW ( path , buffer ) , " expected equal paths \n " ) ;
len = lstrlenW ( buffer ) ;
CoTaskMemFree ( path ) ;
hr = pSHGetFolderPathEx ( & FOLDERID_Desktop , 0 , NULL , buffer , 0 ) ;
ok ( hr = = E_INVALIDARG , " expected E_INVALIDARG, got 0x%08x \n " , hr ) ;
if ( 0 ) { /* crashes */
hr = pSHGetFolderPathEx ( & FOLDERID_Desktop , 0 , NULL , NULL , len + 1 ) ;
ok ( hr = = E_INVALIDARG , " expected E_INVALIDARG, got 0x%08x \n " , hr ) ;
hr = pSHGetFolderPathEx ( NULL , 0 , NULL , buffer , MAX_PATH ) ;
ok ( hr = = E_INVALIDARG , " expected E_INVALIDARG, got 0x%08x \n " , hr ) ;
}
hr = pSHGetFolderPathEx ( & FOLDERID_Desktop , 0 , NULL , buffer , len ) ;
ok ( hr = = E_NOT_SUFFICIENT_BUFFER , " expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x \n " , hr ) ;
hr = pSHGetFolderPathEx ( & FOLDERID_Desktop , 0 , NULL , buffer , len + 1 ) ;
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
2019-11-14 13:24:09 +01:00
path = NULL ;
hr = pSHGetKnownFolderPath ( & FOLDERID_ProgramFilesX64 , 0 , NULL , & path ) ;
# ifdef _WIN64
ok ( hr = = S_OK , " got 0x%08x \n " , hr ) ;
ok ( path ! = NULL , " path not set \n " ) ;
CoTaskMemFree ( path ) ;
# else
todo_wine ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) , " got 0x%08x \n " , hr ) ;
ok ( path = = NULL , " path set \n " ) ;
# endif
path = NULL ;
hr = pSHGetKnownFolderPath ( & FOLDERID_ProgramFilesCommonX64 , 0 , NULL , & path ) ;
# ifdef _WIN64
ok ( hr = = S_OK , " expected S_OK, got 0x%08x \n " , hr ) ;
ok ( path ! = NULL , " path not set \n " ) ;
CoTaskMemFree ( path ) ;
# else
todo_wine ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) , " got 0x%08x \n " , hr ) ;
ok ( path = = NULL , " path set \n " ) ;
# endif
2018-06-22 13:34:01 +02:00
}
2015-03-11 18:11:48 +01:00
static BOOL is_in_strarray ( const WCHAR * needle , const char * hay )
{
WCHAR wstr [ MAX_PATH ] ;
if ( ! needle & & ! hay )
return TRUE ;
while ( hay & & * hay )
{
DWORD ret ;
if ( strcmp ( hay , " (null) " ) = = 0 & & ! needle )
return TRUE ;
2017-12-28 00:50:32 +01:00
ret = MultiByteToWideChar ( CP_ACP , 0 , hay , - 1 , wstr , ARRAY_SIZE ( wstr ) ) ;
2015-03-11 18:11:48 +01:00
if ( ret = = 0 )
{
ok ( 0 , " Failed to convert string \n " ) ;
return FALSE ;
}
if ( lstrcmpW ( wstr , needle ) = = 0 )
return TRUE ;
hay + = strlen ( hay ) + 1 ;
}
return FALSE ;
}
2011-06-14 13:08:59 +02:00
static void check_known_folder ( IKnownFolderManager * mgr , KNOWNFOLDERID * folderId )
{
HRESULT hr ;
2011-07-19 16:17:54 +02:00
int csidl , expectedCsidl , ret ;
KNOWNFOLDER_DEFINITION kfd ;
IKnownFolder * folder ;
2015-03-11 18:11:48 +01:00
WCHAR sName [ 1024 ] ;
2011-07-29 19:07:49 +02:00
BOOL found = FALSE ;
2018-06-22 13:34:03 +02:00
unsigned int i ;
2011-06-14 13:08:59 +02:00
2018-06-22 13:34:03 +02:00
for ( i = 0 ; i < ARRAY_SIZE ( known_folders ) ; + + i )
2011-06-14 13:08:59 +02:00
{
2018-06-22 13:34:03 +02:00
const struct knownFolderDef * known_folder = & known_folders [ i ] ;
2011-06-14 13:08:59 +02:00
if ( IsEqualGUID ( known_folder - > folderId , folderId ) )
{
2018-06-22 13:34:03 +02:00
known_folder_found [ i ] = TRUE ;
2011-07-29 19:07:49 +02:00
found = TRUE ;
2011-06-14 13:08:59 +02:00
/* verify CSIDL */
2015-03-11 18:12:04 +01:00
if ( ! ( known_folder - > csidl & NO_CSIDL ) )
2011-06-14 13:08:59 +02:00
{
2015-03-11 18:12:04 +01:00
/* mask off winetest flags */
expectedCsidl = known_folder - > csidl & 0xFFFF ;
2011-06-14 13:08:59 +02:00
hr = IKnownFolderManager_FolderIdToCsidl ( mgr , folderId , & csidl ) ;
ok_ ( __FILE__ , known_folder - > line ) ( hr = = S_OK , " cannot retrieve CSIDL for folder %s \n " , known_folder - > sFolderId ) ;
2015-03-11 18:12:04 +01:00
ok_ ( __FILE__ , known_folder - > line ) ( csidl = = expectedCsidl , " invalid CSIDL retrieved for folder %s. %d (%s) expected, but %d found \n " , known_folder - > sFolderId , expectedCsidl , known_folder - > sCsidl , csidl ) ;
2011-07-24 13:43:30 +02:00
}
2011-07-19 16:17:54 +02:00
2011-07-24 13:43:30 +02:00
hr = IKnownFolderManager_GetFolder ( mgr , folderId , & folder ) ;
ok_ ( __FILE__ , known_folder - > line ) ( hr = = S_OK , " cannot get known folder for %s \n " , known_folder - > sFolderId ) ;
if ( SUCCEEDED ( hr ) )
{
hr = IKnownFolder_GetFolderDefinition ( folder , & kfd ) ;
2015-04-13 15:21:17 +02:00
ok_ ( __FILE__ , known_folder - > line ) ( hr = = S_OK , " cannot get known folder definition for %s \n " , known_folder - > sFolderId ) ;
2011-07-19 16:17:54 +02:00
if ( SUCCEEDED ( hr ) )
{
2017-12-28 00:50:32 +01:00
ret = MultiByteToWideChar ( CP_ACP , 0 , known_folder - > sName , - 1 , sName , ARRAY_SIZE ( sName ) ) ;
2011-07-24 13:43:30 +02:00
ok_ ( __FILE__ , known_folder - > line ) ( ret ! = 0 , " cannot convert known folder name \" %s \" to wide characters \n " , known_folder - > sName ) ;
2011-07-19 16:17:54 +02:00
2011-07-24 13:43:30 +02:00
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 ) ) ;
2011-07-19 16:17:54 +02:00
2011-07-24 13:44:54 +02:00
ok_ ( __FILE__ , known_folder - > line ) ( kfd . category = = known_folder - > category , " invalid known folder category for %s: %d expected, but %d retrieved \n " , known_folder - > sFolderId , known_folder - > category , kfd . category ) ;
2015-03-11 18:12:54 +01:00
ok_ ( __FILE__ , known_folder - > line ) ( IsEqualGUID ( known_folder - > fidParents [ 0 ] , & kfd . fidParent ) | |
IsEqualGUID ( known_folder - > fidParents [ 1 ] , & kfd . fidParent ) ,
" invalid known folder parent for %s: %s retrieved \n " ,
known_folder - > sFolderId , wine_dbgstr_guid ( & kfd . fidParent ) ) ;
2011-07-24 13:45:51 +02:00
2015-03-11 18:11:48 +01:00
ok_ ( __FILE__ , known_folder - > line ) ( is_in_strarray ( kfd . pszRelativePath , known_folder - > sRelativePath ) , " invalid known folder relative path returned for %s: %s expected, but %s retrieved \n " , known_folder - > sFolderId , known_folder - > sRelativePath , wine_dbgstr_w ( kfd . pszRelativePath ) ) ;
2011-08-03 18:11:58 +02:00
2015-03-11 18:11:48 +01:00
ok_ ( __FILE__ , known_folder - > line ) ( is_in_strarray ( kfd . pszParsingName , known_folder - > sParsingName ) , " invalid known folder parsing name returned for %s: %s retrieved \n " , known_folder - > sFolderId , wine_dbgstr_w ( kfd . pszParsingName ) ) ;
2011-08-03 18:11:58 +02:00
2015-03-11 18:12:43 +01:00
ok_ ( __FILE__ , known_folder - > line ) ( known_folder - > attributes = = kfd . dwAttributes | |
( known_folder - > csidl & WINE_ATTRIBUTES_OPTIONAL & & kfd . dwAttributes = = 0 ) ,
" invalid known folder attributes for %s: 0x%08x expected, but 0x%08x retrieved \n " , known_folder - > sFolderId , known_folder - > attributes , kfd . dwAttributes ) ;
2011-08-04 16:25:17 +02:00
2011-08-04 16:25:25 +02:00
ok_ ( __FILE__ , known_folder - > line ) ( ! ( kfd . kfdFlags & ( ~ known_folder - > definitionFlags ) ) , " invalid known folder flags for %s: 0x%08x expected, but 0x%08x retrieved \n " , known_folder - > sFolderId , known_folder - > definitionFlags , kfd . kfdFlags ) ;
2011-07-24 13:43:30 +02:00
FreeKnownFolderDefinitionFields ( & kfd ) ;
2011-07-19 16:17:54 +02:00
}
2011-07-24 13:43:30 +02:00
IKnownFolder_Release ( folder ) ;
2011-06-14 13:08:59 +02:00
}
break ;
}
}
2011-07-29 19:07:49 +02:00
if ( ! found )
{
2014-01-30 02:41:06 +01:00
trace ( " unknown known folder found: %s \n " , wine_dbgstr_guid ( folderId ) ) ;
2011-07-29 19:07:49 +02:00
hr = IKnownFolderManager_GetFolder ( mgr , folderId , & folder ) ;
2014-01-30 02:41:06 +01:00
ok ( hr = = S_OK , " cannot get known folder for %s \n " , wine_dbgstr_guid ( folderId ) ) ;
2011-07-29 19:07:49 +02:00
if ( SUCCEEDED ( hr ) )
{
hr = IKnownFolder_GetFolderDefinition ( folder , & kfd ) ;
todo_wine
2014-01-30 02:41:06 +01:00
ok ( hr = = S_OK , " cannot get known folder definition for %s \n " , wine_dbgstr_guid ( folderId ) ) ;
2011-07-29 19:07:49 +02:00
if ( SUCCEEDED ( hr ) )
{
trace ( " category: %d \n " , kfd . category ) ;
trace ( " name: %s \n " , wine_dbgstr_w ( kfd . pszName ) ) ;
trace ( " description: %s \n " , wine_dbgstr_w ( kfd . pszDescription ) ) ;
2014-01-30 02:41:06 +01:00
trace ( " parent: %s \n " , wine_dbgstr_guid ( & kfd . fidParent ) ) ;
2011-07-29 19:07:49 +02:00
trace ( " relative path: %s \n " , wine_dbgstr_w ( kfd . pszRelativePath ) ) ;
trace ( " parsing name: %s \n " , wine_dbgstr_w ( kfd . pszParsingName ) ) ;
trace ( " tooltip: %s \n " , wine_dbgstr_w ( kfd . pszTooltip ) ) ;
trace ( " localized name: %s \n " , wine_dbgstr_w ( kfd . pszLocalizedName ) ) ;
trace ( " icon: %s \n " , wine_dbgstr_w ( kfd . pszIcon ) ) ;
trace ( " security: %s \n " , wine_dbgstr_w ( kfd . pszSecurity ) ) ;
trace ( " attributes: 0x%08x \n " , kfd . dwAttributes ) ;
trace ( " flags: 0x%08x \n " , kfd . kfdFlags ) ;
2014-01-30 02:41:06 +01:00
trace ( " type: %s \n " , wine_dbgstr_guid ( & kfd . ftidType ) ) ;
2011-07-29 19:07:49 +02:00
FreeKnownFolderDefinitionFields ( & kfd ) ;
}
IKnownFolder_Release ( folder ) ;
}
}
2011-06-14 13:08:59 +02:00
}
# undef NO_CSIDL
2011-06-09 10:40:02 +02:00
static void test_knownFolders ( void )
{
2011-06-09 10:41:04 +02:00
static const WCHAR sWindows [ ] = { ' W ' , ' i ' , ' n ' , ' d ' , ' o ' , ' w ' , ' s ' , 0 } ;
2016-11-22 16:27:07 +01:00
static const WCHAR sWindows2 [ ] = { ' w ' , ' i ' , ' n ' , ' d ' , ' o ' , ' w ' , ' s ' , 0 } ;
2011-06-14 13:09:14 +02:00
static const WCHAR sExample [ ] = { ' E ' , ' x ' , ' a ' , ' m ' , ' p ' , ' l ' , ' e ' , 0 } ;
2011-06-14 13:09:25 +02:00
static const WCHAR sExample2 [ ] = { ' E ' , ' x ' , ' a ' , ' m ' , ' p ' , ' l ' , ' e ' , ' 2 ' , 0 } ;
2011-06-29 19:34:24 +02:00
static const WCHAR sSubFolder [ ] = { ' S ' , ' u ' , ' b ' , ' F ' , ' o ' , ' l ' , ' d ' , ' e ' , ' r ' , 0 } ;
2016-11-22 16:27:07 +01:00
static const WCHAR sNoSuch [ ] = { ' N ' , ' o ' , ' S ' , ' u ' , ' c ' , ' h ' , 0 } ;
2011-06-29 19:34:24 +02:00
static const WCHAR sBackslash [ ] = { ' \\ ' , 0 } ;
2011-06-14 13:09:14 +02:00
static const KNOWNFOLDERID newFolderId = { 0x01234567 , 0x89AB , 0xCDEF , { 0xFE , 0xDC , 0xBA , 0x98 , 0x76 , 0x54 , 0x32 , 0x01 } } ;
2011-06-29 19:34:24 +02:00
static const KNOWNFOLDERID subFolderId = { 0xFEDCBA98 , 0x7654 , 0x3210 , { 0x01 , 0x23 , 0x45 , 0x67 , 0x89 , 0xAB , 0xCD , 0xEF } } ;
2011-06-09 10:40:02 +02:00
HRESULT hr ;
IKnownFolderManager * mgr = NULL ;
2011-06-29 19:34:24 +02:00
IKnownFolder * folder = NULL , * subFolder = NULL ;
2011-06-14 13:08:59 +02:00
KNOWNFOLDERID folderId , * folders ;
2011-06-09 10:40:44 +02:00
KF_CATEGORY cat = 0 ;
2011-06-29 19:34:24 +02:00
KNOWNFOLDER_DEFINITION kfDefinition , kfSubDefinition ;
2011-06-14 13:08:59 +02:00
int csidl , i ;
UINT nCount = 0 ;
2011-06-29 19:34:24 +02:00
LPWSTR folderPath , errorMsg ;
2011-06-09 10:40:44 +02:00
KF_REDIRECTION_CAPABILITIES redirectionCapabilities = 1 ;
2011-06-29 19:34:24 +02:00
WCHAR sWinDir [ MAX_PATH ] , sExamplePath [ MAX_PATH ] , sExample2Path [ MAX_PATH ] , sSubFolderPath [ MAX_PATH ] , sSubFolder2Path [ MAX_PATH ] ;
2011-06-14 13:09:14 +02:00
BOOL bRes ;
2011-06-29 19:34:24 +02:00
DWORD dwAttributes ;
2011-06-09 10:40:44 +02:00
GetWindowsDirectoryW ( sWinDir , MAX_PATH ) ;
2011-06-09 10:40:02 +02:00
2017-12-28 00:50:32 +01:00
GetTempPathW ( ARRAY_SIZE ( sExamplePath ) , sExamplePath ) ;
2011-06-14 13:09:14 +02:00
lstrcatW ( sExamplePath , sExample ) ;
2017-12-28 00:50:32 +01:00
GetTempPathW ( ARRAY_SIZE ( sExample2Path ) , sExample2Path ) ;
2011-06-14 13:09:25 +02:00
lstrcatW ( sExample2Path , sExample2 ) ;
2011-06-29 19:34:24 +02:00
lstrcpyW ( sSubFolderPath , sExamplePath ) ;
lstrcatW ( sSubFolderPath , sBackslash ) ;
lstrcatW ( sSubFolderPath , sSubFolder ) ;
lstrcpyW ( sSubFolder2Path , sExample2Path ) ;
lstrcatW ( sSubFolder2Path , sBackslash ) ;
lstrcatW ( sSubFolder2Path , sSubFolder ) ;
2011-06-09 10:40:02 +02:00
CoInitialize ( NULL ) ;
hr = CoCreateInstance ( & CLSID_KnownFolderManager , NULL , CLSCTX_INPROC_SERVER ,
& IID_IKnownFolderManager , ( LPVOID * ) & mgr ) ;
if ( hr = = REGDB_E_CLASSNOTREG )
win_skip ( " IKnownFolderManager unavailable \n " ) ;
else
{
2015-05-09 18:37:53 +02:00
IUnknown * unk ;
2011-06-09 10:40:02 +02:00
ok ( hr = = S_OK , " failed to create KnownFolderManager instance: 0x%08x \n " , hr ) ;
2015-05-09 18:37:53 +02:00
hr = IKnownFolderManager_QueryInterface ( mgr , & IID_IMarshal , ( void * * ) & unk ) ;
ok ( hr = = E_NOINTERFACE , " got 0x%08x \n " , hr ) ;
2011-06-09 10:40:02 +02:00
hr = IKnownFolderManager_FolderIdFromCsidl ( mgr , CSIDL_WINDOWS , & folderId ) ;
ok ( hr = = S_OK , " failed to convert CSIDL to KNOWNFOLDERID: 0x%08x \n " , hr ) ;
ok ( IsEqualGUID ( & folderId , & FOLDERID_Windows ) = = TRUE , " invalid KNOWNFOLDERID returned \n " ) ;
hr = IKnownFolderManager_FolderIdToCsidl ( mgr , & FOLDERID_Windows , & csidl ) ;
ok ( hr = = S_OK , " failed to convert CSIDL to KNOWNFOLDERID: 0x%08x \n " , hr ) ;
ok ( csidl = = CSIDL_WINDOWS , " invalid CSIDL returned \n " ) ;
2011-06-09 10:40:44 +02:00
hr = IKnownFolderManager_GetFolder ( mgr , & FOLDERID_Windows , & folder ) ;
ok ( hr = = S_OK , " failed to get known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
2015-05-09 18:37:53 +02:00
hr = IKnownFolder_QueryInterface ( folder , & IID_IMarshal , ( void * * ) & unk ) ;
ok ( hr = = E_NOINTERFACE , " got 0x%08x \n " , hr ) ;
2011-06-09 10:40:44 +02:00
hr = IKnownFolder_GetCategory ( folder , & cat ) ;
ok ( hr = = S_OK , " failed to get folder category: 0x%08x \n " , hr ) ;
ok ( cat = = KF_CATEGORY_FIXED , " invalid folder category: %d \n " , cat ) ;
hr = IKnownFolder_GetId ( folder , & folderId ) ;
ok ( hr = = S_OK , " failed to get folder id: 0x%08x \n " , hr ) ;
ok ( IsEqualGUID ( & folderId , & FOLDERID_Windows ) = = TRUE , " invalid KNOWNFOLDERID returned \n " ) ;
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
2015-03-04 09:50:59 +01:00
ok ( hr = = S_OK , " failed to get path from known folder: 0x%08x \n " , hr ) ;
2011-06-09 10:40:44 +02:00
ok ( lstrcmpiW ( sWinDir , folderPath ) = = 0 , " invalid path returned: \" %s \" , expected: \" %s \" \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sWinDir ) ) ;
CoTaskMemFree ( folderPath ) ;
hr = IKnownFolder_GetRedirectionCapabilities ( folder , & redirectionCapabilities ) ;
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 ) ;
hr = IKnownFolder_SetPath ( folder , 0 , sWinDir ) ;
todo_wine
ok ( hr = = E_INVALIDARG , " unexpected value from SetPath: 0x%08x \n " , hr ) ;
2011-06-09 10:41:04 +02:00
hr = IKnownFolder_GetFolderDefinition ( folder , & kfDefinition ) ;
ok ( hr = = S_OK , " failed to get folder definition: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
ok ( kfDefinition . category = = KF_CATEGORY_FIXED , " invalid folder category: 0x%08x \n " , kfDefinition . category ) ;
ok ( lstrcmpW ( kfDefinition . pszName , sWindows ) = = 0 , " invalid folder name: %s \n " , wine_dbgstr_w ( kfDefinition . pszName ) ) ;
ok ( kfDefinition . dwAttributes = = 0 , " invalid folder attributes: %d \n " , kfDefinition . dwAttributes ) ;
FreeKnownFolderDefinitionFields ( & kfDefinition ) ;
}
2011-06-13 12:36:50 +02:00
hr = IKnownFolder_Release ( folder ) ;
ok ( hr = = S_OK , " failed to release KnownFolder instance: 0x%08x \n " , hr ) ;
}
hr = IKnownFolderManager_GetFolderByName ( mgr , sWindows , & folder ) ;
ok ( hr = = S_OK , " failed to get known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
hr = IKnownFolder_GetId ( folder , & folderId ) ;
ok ( hr = = S_OK , " failed to get folder id: 0x%08x \n " , hr ) ;
ok ( IsEqualGUID ( & folderId , & FOLDERID_Windows ) = = TRUE , " invalid KNOWNFOLDERID returned \n " ) ;
2011-06-09 10:40:44 +02:00
hr = IKnownFolder_Release ( folder ) ;
ok ( hr = = S_OK , " failed to release KnownFolder instance: 0x%08x \n " , hr ) ;
}
2016-11-22 16:27:07 +01:00
hr = IKnownFolderManager_GetFolderByName ( mgr , sWindows2 , & folder ) ;
ok ( hr = = S_OK , " failed to get known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
hr = IKnownFolder_GetId ( folder , & folderId ) ;
ok ( hr = = S_OK , " failed to get folder id: 0x%08x \n " , hr ) ;
ok ( IsEqualGUID ( & folderId , & FOLDERID_Windows ) = = TRUE , " invalid KNOWNFOLDERID returned \n " ) ;
hr = IKnownFolder_Release ( folder ) ;
ok ( hr = = S_OK , " failed to release KnownFolder instance: 0x%08x \n " , hr ) ;
}
folder = ( IKnownFolder * ) 0xdeadbeef ;
hr = IKnownFolderManager_GetFolderByName ( mgr , sNoSuch , & folder ) ;
ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) , " got 0x%08x \n " , hr ) ;
ok ( folder = = NULL , " got %p \n " , folder ) ;
2017-12-28 00:50:32 +01:00
for ( i = 0 ; i < ARRAY_SIZE ( known_folder_found ) ; + + i )
2011-07-29 19:07:55 +02:00
known_folder_found [ i ] = FALSE ;
2011-06-14 13:08:59 +02:00
hr = IKnownFolderManager_GetFolderIds ( mgr , & folders , & nCount ) ;
ok ( hr = = S_OK , " failed to get known folders: 0x%08x \n " , hr ) ;
for ( i = 0 ; i < nCount ; + + i )
check_known_folder ( mgr , & folders [ i ] ) ;
2017-12-28 00:50:32 +01:00
for ( i = 0 ; i < ARRAY_SIZE ( known_folder_found ) ; + + i )
2011-07-29 19:07:55 +02:00
if ( ! known_folder_found [ i ] )
trace ( " Known folder %s not found on current platform \n " , known_folders [ i ] . sFolderId ) ;
2011-06-14 13:08:59 +02:00
CoTaskMemFree ( folders ) ;
2011-06-14 13:09:14 +02:00
/* test of registering new known folders */
bRes = CreateDirectoryW ( sExamplePath , NULL ) ;
ok ( bRes , " cannot create example directory: %s \n " , wine_dbgstr_w ( sExamplePath ) ) ;
2011-06-14 13:09:25 +02:00
bRes = CreateDirectoryW ( sExample2Path , NULL ) ;
2011-06-29 19:34:24 +02:00
ok ( bRes , " cannot create example directory: %s \n " , wine_dbgstr_w ( sExample2Path ) ) ;
bRes = CreateDirectoryW ( sSubFolderPath , NULL ) ;
ok ( bRes , " cannot create example directory: %s \n " , wine_dbgstr_w ( sSubFolderPath ) ) ;
2011-06-14 13:09:14 +02:00
ZeroMemory ( & kfDefinition , sizeof ( kfDefinition ) ) ;
kfDefinition . category = KF_CATEGORY_PERUSER ;
kfDefinition . pszName = CoTaskMemAlloc ( sizeof ( sExample ) ) ;
lstrcpyW ( kfDefinition . pszName , sExample ) ;
kfDefinition . pszDescription = CoTaskMemAlloc ( sizeof ( sExample ) ) ;
lstrcpyW ( kfDefinition . pszDescription , sExample ) ;
kfDefinition . pszRelativePath = CoTaskMemAlloc ( sizeof ( sExamplePath ) ) ;
lstrcpyW ( kfDefinition . pszRelativePath , sExamplePath ) ;
hr = IKnownFolderManager_RegisterFolder ( mgr , & newFolderId , & kfDefinition ) ;
if ( hr = = HRESULT_FROM_WIN32 ( ERROR_ACCESS_DENIED ) )
win_skip ( " No permissions required to register custom known folder \n " ) ;
else
{
ok ( hr = = S_OK , " failed to register known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
hr = IKnownFolderManager_GetFolder ( mgr , & newFolderId , & folder ) ;
ok ( hr = = S_OK , " failed to get known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
2011-06-23 18:49:48 +02:00
hr = IKnownFolder_GetCategory ( folder , & cat ) ;
ok ( hr = = S_OK , " failed to get folder category: hr=0x%0x \n " , hr ) ;
ok ( cat = = KF_CATEGORY_PERUSER , " invalid category returned: %d, while %d (KF_CATEGORY_PERUSER) expected \n " , cat , KF_CATEGORY_PERUSER ) ;
2011-06-14 13:09:14 +02:00
hr = IKnownFolder_GetId ( folder , & folderId ) ;
ok ( hr = = S_OK , " failed to get folder id: 0x%08x \n " , hr ) ;
ok ( IsEqualGUID ( & folderId , & newFolderId ) = = TRUE , " invalid KNOWNFOLDERID returned \n " ) ;
2011-06-29 19:34:24 +02:00
/* current path should be Temp\Example */
2011-06-14 13:09:14 +02:00
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get path from known folder: 0x%08x \n " , hr ) ;
2011-06-25 13:49:27 +02:00
ok ( lstrcmpiW ( folderPath , sExamplePath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExamplePath ) ) ;
2011-06-14 13:09:14 +02:00
CoTaskMemFree ( folderPath ) ;
2011-06-29 19:34:24 +02:00
/* register sub-folder and mark it as child of Example folder */
ZeroMemory ( & kfSubDefinition , sizeof ( kfSubDefinition ) ) ;
kfSubDefinition . category = KF_CATEGORY_PERUSER ;
kfSubDefinition . pszName = CoTaskMemAlloc ( sizeof ( sSubFolder ) ) ;
lstrcpyW ( kfSubDefinition . pszName , sSubFolder ) ;
kfSubDefinition . pszDescription = CoTaskMemAlloc ( sizeof ( sSubFolder ) ) ;
lstrcpyW ( kfSubDefinition . pszDescription , sSubFolder ) ;
kfSubDefinition . pszRelativePath = CoTaskMemAlloc ( sizeof ( sSubFolder ) ) ;
lstrcpyW ( kfSubDefinition . pszRelativePath , sSubFolder ) ;
kfSubDefinition . fidParent = newFolderId ;
hr = IKnownFolderManager_RegisterFolder ( mgr , & subFolderId , & kfSubDefinition ) ;
ok ( hr = = S_OK , " failed to register known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
2011-06-14 13:09:31 +02:00
{
2011-06-29 19:34:24 +02:00
hr = IKnownFolderManager_GetFolder ( mgr , & subFolderId , & subFolder ) ;
ok ( hr = = S_OK , " failed to get known folder: 0x%08x \n " , hr ) ;
if ( SUCCEEDED ( hr ) )
{
/* check sub folder path */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolderPath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolderPath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* try to redirect Example to Temp\Example2 */
hr = IKnownFolderManager_Redirect ( mgr , & newFolderId , NULL , 0 , sExample2Path , 0 , NULL , & errorMsg ) ;
ok ( hr = = S_OK , " failed to redirect known folder: 0x%08x, errorMsg: %s \n " , hr , wine_dbgstr_w ( errorMsg ) ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExample2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExample2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
2014-02-07 22:42:49 +01:00
/* verify sub folder - it should fail now, as we redirected its parent folder, but we have no sub folder in new location */
2011-06-29 19:34:24 +02:00
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) , " unexpected value from GetPath(): 0x%08x \n " , hr ) ;
ok ( folderPath = = NULL , " invalid known folder path retrieved: \" %s \" when NULL pointer was expected \n " , wine_dbgstr_w ( folderPath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* set Example path to original. Using SetPath() is valid here, as it also uses redirection internally */
hr = IKnownFolder_SetPath ( folder , 0 , sExamplePath ) ;
ok ( hr = = S_OK , " SetPath() failed: 0x%08x \n " , hr ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExamplePath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExamplePath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* create sub folder in Temp\Example2 */
bRes = CreateDirectoryW ( sSubFolder2Path , NULL ) ;
ok ( bRes , " cannot create example directory: %s \n " , wine_dbgstr_w ( sSubFolder2Path ) ) ;
/* again perform that same redirection */
hr = IKnownFolderManager_Redirect ( mgr , & newFolderId , NULL , 0 , sExample2Path , 0 , NULL , & errorMsg ) ;
ok ( hr = = S_OK , " failed to redirect known folder: 0x%08x, errorMsg: %s \n " , hr , wine_dbgstr_w ( errorMsg ) ) ;
/* verify sub folder. It should succeed now, as the required sub folder exists */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolder2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolder2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* remove newly created directory */
RemoveDirectoryW ( sSubFolder2Path ) ;
2016-04-22 00:38:00 +02:00
/* verify subfolder. It still succeeds, so Windows does not check folder presence each time */
2011-06-29 19:34:24 +02:00
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
2011-06-30 14:59:46 +02:00
todo_wine
2011-06-29 19:34:24 +02:00
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
2011-06-30 14:59:46 +02:00
todo_wine
2011-06-29 19:34:24 +02:00
ok ( lstrcmpiW ( folderPath , sSubFolder2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolder2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* set Example path to original */
hr = IKnownFolder_SetPath ( folder , 0 , sExamplePath ) ;
ok ( hr = = S_OK , " SetPath() failed: 0x%08x \n " , hr ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExamplePath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExamplePath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolderPath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolderPath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* create sub folder in Temp\Example2 */
bRes = CreateDirectoryW ( sSubFolder2Path , NULL ) ;
ok ( bRes , " cannot create example directory: %s \n " , wine_dbgstr_w ( sSubFolder2Path ) ) ;
/* do that same redirection, but try to exclude sub-folder */
hr = IKnownFolderManager_Redirect ( mgr , & newFolderId , NULL , 0 , sExample2Path , 1 , & subFolderId , & errorMsg ) ;
ok ( hr = = S_OK , " failed to redirect known folder: 0x%08x, errorMsg: %s \n " , hr , wine_dbgstr_w ( errorMsg ) ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExample2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExample2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder. Unexpectedly, this path was also changed. So, exclusion seems to be ignored (Windows bug)? This test however will let us know, if this behavior is changed */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolder2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolder2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* remove newly created directory */
RemoveDirectoryW ( sSubFolder2Path ) ;
/* set Example path to original */
hr = IKnownFolder_SetPath ( folder , 0 , sExamplePath ) ;
ok ( hr = = S_OK , " SetPath() failed: 0x%08x \n " , hr ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExamplePath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExamplePath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolderPath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolderPath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* do that same redirection again, but set it to copy content. It should also copy the sub folder, so checking it would succeed now */
hr = IKnownFolderManager_Redirect ( mgr , & newFolderId , NULL , KF_REDIRECT_COPY_CONTENTS , sExample2Path , 0 , NULL , & errorMsg ) ;
ok ( hr = = S_OK , " failed to redirect known folder: 0x%08x, errorMsg: %s \n " , hr , wine_dbgstr_w ( errorMsg ) ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExample2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExample2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolder2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolder2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* remove copied directory */
RemoveDirectoryW ( sSubFolder2Path ) ;
/* set Example path to original */
hr = IKnownFolder_SetPath ( folder , 0 , sExamplePath ) ;
ok ( hr = = S_OK , " SetPath() failed: 0x%08x \n " , hr ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExamplePath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExamplePath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolderPath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolderPath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* redirect again, set it to copy content and remove originals */
hr = IKnownFolderManager_Redirect ( mgr , & newFolderId , NULL , KF_REDIRECT_COPY_CONTENTS | KF_REDIRECT_DEL_SOURCE_CONTENTS , sExample2Path , 0 , NULL , & errorMsg ) ;
ok ( hr = = S_OK , " failed to redirect known folder: 0x%08x, errorMsg: %s \n " , hr , wine_dbgstr_w ( errorMsg ) ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExample2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExample2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolder2Path ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolder2Path ) ) ;
CoTaskMemFree ( folderPath ) ;
/* check if original directory was really removed */
dwAttributes = GetFileAttributesW ( sExamplePath ) ;
ok ( dwAttributes = = INVALID_FILE_ATTRIBUTES , " directory should not exist, but has attributes: 0x%08x \n " , dwAttributes ) ;
/* redirect (with copy) to original path */
hr = IKnownFolderManager_Redirect ( mgr , & newFolderId , NULL , KF_REDIRECT_COPY_CONTENTS , sExamplePath , 0 , NULL , & errorMsg ) ;
ok ( hr = = S_OK , " failed to redirect known folder: 0x%08x, errorMsg: %s \n " , hr , wine_dbgstr_w ( errorMsg ) ) ;
/* verify */
hr = IKnownFolder_GetPath ( folder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sExamplePath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sExamplePath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* verify sub folder */
hr = IKnownFolder_GetPath ( subFolder , 0 , & folderPath ) ;
ok ( hr = = S_OK , " failed to get known folder path: 0x%08x \n " , hr ) ;
ok ( lstrcmpiW ( folderPath , sSubFolderPath ) = = 0 , " invalid known folder path retrieved: \" %s \" when \" %s \" was expected \n " , wine_dbgstr_w ( folderPath ) , wine_dbgstr_w ( sSubFolderPath ) ) ;
CoTaskMemFree ( folderPath ) ;
/* check shell utility functions */
if ( ! pSHGetKnownFolderPath | | ! pSHSetKnownFolderPath )
todo_wine
win_skip ( " cannot get SHGet/SetKnownFolderPath routines \n " ) ;
else
{
/* try to get current known folder path */
hr = pSHGetKnownFolderPath ( & newFolderId , 0 , NULL , & folderPath ) ;
todo_wine
ok ( hr = = S_OK , " cannot get known folder path: hr=0x%0x \n " , hr ) ;
todo_wine
ok ( lstrcmpW ( folderPath , sExamplePath ) = = 0 , " invalid path returned: %s \n " , wine_dbgstr_w ( folderPath ) ) ;
/* set it to new value */
hr = pSHSetKnownFolderPath ( & newFolderId , 0 , NULL , sExample2Path ) ;
todo_wine
ok ( hr = = S_OK , " cannot set known folder path: hr=0x%0x \n " , hr ) ;
/* check if it changed */
hr = pSHGetKnownFolderPath ( & newFolderId , 0 , NULL , & folderPath ) ;
todo_wine
ok ( hr = = S_OK , " cannot get known folder path: hr=0x%0x \n " , hr ) ;
todo_wine
ok ( lstrcmpW ( folderPath , sExample2Path ) = = 0 , " invalid path returned: %s \n " , wine_dbgstr_w ( folderPath ) ) ;
/* set it back */
hr = pSHSetKnownFolderPath ( & newFolderId , 0 , NULL , sExamplePath ) ;
todo_wine
ok ( hr = = S_OK , " cannot set known folder path: hr=0x%0x \n " , hr ) ;
}
IKnownFolder_Release ( subFolder ) ;
}
hr = IKnownFolderManager_UnregisterFolder ( mgr , & subFolderId ) ;
ok ( hr = = S_OK , " failed to unregister folder: 0x%08x \n " , hr ) ;
2011-06-14 13:09:31 +02:00
}
2011-06-29 19:34:24 +02:00
FreeKnownFolderDefinitionFields ( & kfSubDefinition ) ;
2011-06-14 13:09:14 +02:00
hr = IKnownFolder_Release ( folder ) ;
ok ( hr = = S_OK , " failed to release KnownFolder instance: 0x%08x \n " , hr ) ;
2015-03-17 16:03:13 +01:00
/* update the folder */
CoTaskMemFree ( kfDefinition . pszName ) ;
kfDefinition . pszName = CoTaskMemAlloc ( sizeof ( sExample2 ) ) ;
lstrcpyW ( kfDefinition . pszName , sExample2 ) ;
hr = IKnownFolderManager_RegisterFolder ( mgr , & newFolderId , & kfDefinition ) ;
ok ( hr = = S_OK , " failed to re-register known folder: 0x%08x \n " , hr ) ;
hr = IKnownFolderManager_GetFolder ( mgr , & newFolderId , & folder ) ;
ok ( hr = = S_OK , " failed to get known folder: 0x%08x \n " , hr ) ;
hr = IKnownFolder_GetFolderDefinition ( folder , & kfSubDefinition ) ;
ok ( hr = = S_OK , " failed to get folder definition: 0x%08x \n " , hr ) ;
ok ( ! memcmp ( kfDefinition . pszName , kfSubDefinition . pszName , sizeof ( sExample2 ) ) ,
" Got wrong updated name: %s \n " , wine_dbgstr_w ( kfSubDefinition . pszName ) ) ;
FreeKnownFolderDefinitionFields ( & kfSubDefinition ) ;
hr = IKnownFolder_Release ( folder ) ;
ok ( hr = = S_OK , " failed to release KnownFolder instance: 0x%08x \n " , hr ) ;
2011-06-14 13:09:14 +02:00
}
hr = IKnownFolderManager_UnregisterFolder ( mgr , & newFolderId ) ;
ok ( hr = = S_OK , " failed to unregister folder: 0x%08x \n " , hr ) ;
}
}
FreeKnownFolderDefinitionFields ( & kfDefinition ) ;
2011-06-29 19:34:24 +02:00
RemoveDirectoryW ( sSubFolder2Path ) ;
RemoveDirectoryW ( sSubFolderPath ) ;
2011-06-14 13:09:14 +02:00
RemoveDirectoryW ( sExamplePath ) ;
2011-06-14 13:09:25 +02:00
RemoveDirectoryW ( sExample2Path ) ;
2011-06-14 13:09:14 +02:00
2011-06-09 10:40:02 +02:00
hr = IKnownFolderManager_Release ( mgr ) ;
ok ( hr = = S_OK , " failed to release KnownFolderManager instance: 0x%08x \n " , hr ) ;
}
CoUninitialize ( ) ;
}
2012-12-04 11:38:02 +01:00
static void test_DoEnvironmentSubst ( void )
{
WCHAR expectedW [ MAX_PATH ] ;
WCHAR bufferW [ MAX_PATH ] ;
CHAR expectedA [ MAX_PATH ] ;
CHAR bufferA [ MAX_PATH ] ;
DWORD res ;
DWORD res2 ;
DWORD len ;
INT i ;
static const WCHAR does_not_existW [ ] = { ' % ' , ' D ' , ' O ' , ' E ' , ' S ' , ' _ ' , ' N ' , ' O ' , ' T ' , ' _ ' , ' E ' , ' X ' , ' I ' , ' S ' , ' T ' , ' % ' , 0 } ;
static const CHAR does_not_existA [ ] = " %DOES_NOT_EXIST% " ;
static const CHAR * names [ ] = {
/* interactive apps and services (works on all windows versions) */
" %ALLUSERSPROFILE% " , " %APPDATA% " , " %LOCALAPPDATA% " ,
" %NUMBER_OF_PROCESSORS% " , " %OS% " , " %PROCESSOR_ARCHITECTURE% " ,
" %PROCESSOR_IDENTIFIER% " , " %PROCESSOR_LEVEL% " , " %PROCESSOR_REVISION% " ,
" %ProgramFiles% " , " %SystemDrive% " ,
" %SystemRoot% " , " %USERPROFILE% " , " %windir% " ,
/* todo_wine: "%COMPUTERNAME%", "%ProgramData%", "%PUBLIC%", */
/* replace more than one var is allowed */
" %HOMEDRIVE%%HOMEPATH% " ,
" %OS% %windir% " } ; /* always the last entry in the table */
2018-06-15 00:04:42 +02:00
for ( i = 0 ; i < ( ARRAY_SIZE ( names ) ) ; i + + )
2012-12-04 11:38:02 +01:00
{
memset ( bufferA , ' # ' , MAX_PATH - 1 ) ;
bufferA [ MAX_PATH - 1 ] = 0 ;
lstrcpyA ( bufferA , names [ i ] ) ;
2017-12-28 00:50:32 +01:00
MultiByteToWideChar ( CP_ACP , 0 , bufferA , MAX_PATH , bufferW , ARRAY_SIZE ( bufferW ) ) ;
2012-12-04 11:38:02 +01:00
res2 = ExpandEnvironmentStringsA ( names [ i ] , expectedA , MAX_PATH ) ;
res = DoEnvironmentSubstA ( bufferA , MAX_PATH ) ;
/* is the space for the terminating 0 included? */
if ( ! i & & HIWORD ( res ) & & ( LOWORD ( res ) = = ( lstrlenA ( bufferA ) ) ) )
{
win_skip ( " DoEnvironmentSubstA/W are broken on NT 4 \n " ) ;
return ;
}
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" %d: got %d/%d (expected TRUE/%d) \n " , i , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpA ( bufferA , expectedA ) ,
" %d: got %s (expected %s) \n " , i , bufferA , expectedA ) ;
res2 = ExpandEnvironmentStringsW ( bufferW , expectedW , MAX_PATH ) ;
res = DoEnvironmentSubstW ( bufferW , MAX_PATH ) ;
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" %d: got %d/%d (expected TRUE/%d) \n " , i , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpW ( bufferW , expectedW ) ,
" %d: got %s (expected %s) \n " , i , wine_dbgstr_w ( bufferW ) , wine_dbgstr_w ( expectedW ) ) ;
}
i - - ; /* reuse data in the last table entry */
len = LOWORD ( res ) ; /* needed length */
/* one character extra is fine */
memset ( bufferA , ' # ' , MAX_PATH - 1 ) ;
bufferA [ len + 2 ] = 0 ;
lstrcpyA ( bufferA , names [ i ] ) ;
2017-12-28 00:50:32 +01:00
MultiByteToWideChar ( CP_ACP , 0 , bufferA , MAX_PATH , bufferW , ARRAY_SIZE ( bufferW ) ) ;
2012-12-04 11:38:02 +01:00
res2 = ExpandEnvironmentStringsA ( bufferA , expectedA , MAX_PATH ) ;
res = DoEnvironmentSubstA ( bufferA , len + 1 ) ;
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" +1: got %d/%d (expected TRUE/%d) \n " , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpA ( bufferA , expectedA ) ,
" +1: got %s (expected %s) \n " , bufferA , expectedA ) ;
res2 = ExpandEnvironmentStringsW ( bufferW , expectedW , MAX_PATH ) ;
res = DoEnvironmentSubstW ( bufferW , len + 1 ) ;
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" +1: got %d/%d (expected TRUE/%d) \n " , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpW ( bufferW , expectedW ) ,
" +1: got %s (expected %s) \n " , wine_dbgstr_w ( bufferW ) , wine_dbgstr_w ( expectedW ) ) ;
/* minimal buffer length (result string and terminating 0) */
memset ( bufferA , ' # ' , MAX_PATH - 1 ) ;
bufferA [ len + 2 ] = 0 ;
lstrcpyA ( bufferA , names [ i ] ) ;
2017-12-28 00:50:32 +01:00
MultiByteToWideChar ( CP_ACP , 0 , bufferA , MAX_PATH , bufferW , ARRAY_SIZE ( bufferW ) ) ;
2012-12-04 11:38:02 +01:00
/* ANSI version failed without an extra byte, as documented on msdn */
res = DoEnvironmentSubstA ( bufferA , len ) ;
ok ( ! HIWORD ( res ) & & ( LOWORD ( res ) = = len ) ,
" 0: got %d/%d (expected FALSE/%d) \n " , HIWORD ( res ) , LOWORD ( res ) , len ) ;
ok ( ! lstrcmpA ( bufferA , names [ i ] ) ,
" 0: got %s (expected %s) \n " , bufferA , names [ i ] ) ;
/* DoEnvironmentSubstW works as expected */
res2 = ExpandEnvironmentStringsW ( bufferW , expectedW , MAX_PATH ) ;
res = DoEnvironmentSubstW ( bufferW , len ) ;
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" 0: got %d/%d (expected TRUE/%d) \n " , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpW ( bufferW , expectedW ) ,
" 0: got %s (expected %s) \n " , wine_dbgstr_w ( bufferW ) , wine_dbgstr_w ( expectedW ) ) ;
2014-01-06 02:13:41 +01:00
/* Buffer too small */
2012-12-04 11:38:02 +01:00
/* result: FALSE / provided buffer length / the buffer is untouched */
memset ( bufferA , ' # ' , MAX_PATH - 1 ) ;
bufferA [ len + 2 ] = 0 ;
lstrcpyA ( bufferA , names [ i ] ) ;
2017-12-28 00:50:32 +01:00
MultiByteToWideChar ( CP_ACP , 0 , bufferA , MAX_PATH , bufferW , ARRAY_SIZE ( bufferW ) ) ;
2012-12-04 11:38:02 +01:00
res = DoEnvironmentSubstA ( bufferA , len - 1 ) ;
ok ( ! HIWORD ( res ) & & ( LOWORD ( res ) = = ( len - 1 ) ) ,
" -1: got %d/%d (expected FALSE/%d) \n " , HIWORD ( res ) , LOWORD ( res ) , len - 1 ) ;
ok ( ! lstrcmpA ( bufferA , names [ i ] ) ,
" -1: got %s (expected %s) \n " , bufferA , names [ i ] ) ;
lstrcpyW ( expectedW , bufferW ) ;
res = DoEnvironmentSubstW ( bufferW , len - 1 ) ;
ok ( ! HIWORD ( res ) & & ( LOWORD ( res ) = = ( len - 1 ) ) ,
" -1: got %d/%d (expected FALSE/%d) \n " , HIWORD ( res ) , LOWORD ( res ) , len - 1 ) ;
ok ( ! lstrcmpW ( bufferW , expectedW ) ,
" -1: got %s (expected %s) \n " , wine_dbgstr_w ( bufferW ) , wine_dbgstr_w ( expectedW ) ) ;
/* unknown variable */
/* result: TRUE / string length including terminating 0 / the buffer is untouched */
memset ( bufferA , ' # ' , MAX_PATH - 1 ) ;
bufferA [ MAX_PATH - 1 ] = 0 ;
lstrcpyA ( bufferA , does_not_existA ) ;
2017-12-28 00:50:32 +01:00
MultiByteToWideChar ( CP_ACP , 0 , bufferA , MAX_PATH , bufferW , ARRAY_SIZE ( bufferW ) ) ;
2012-12-04 11:38:02 +01:00
res2 = lstrlenA ( does_not_existA ) + 1 ;
res = DoEnvironmentSubstA ( bufferA , MAX_PATH ) ;
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" %d: got %d/%d (expected TRUE/%d) \n " , i , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpA ( bufferA , does_not_existA ) ,
" %d: got %s (expected %s) \n " , i , bufferA , does_not_existA ) ;
res = DoEnvironmentSubstW ( bufferW , MAX_PATH ) ;
ok ( HIWORD ( res ) & & ( LOWORD ( res ) = = res2 ) ,
" %d: got %d/%d (expected TRUE/%d) \n " , i , HIWORD ( res ) , LOWORD ( res ) , res2 ) ;
ok ( ! lstrcmpW ( bufferW , does_not_existW ) ,
" %d: got %s (expected %s) \n " , i , wine_dbgstr_w ( bufferW ) , wine_dbgstr_w ( does_not_existW ) ) ;
if ( 0 )
{
/* NULL crashes on windows */
res = DoEnvironmentSubstA ( NULL , MAX_PATH ) ;
res = DoEnvironmentSubstW ( NULL , MAX_PATH ) ;
}
}
2014-06-28 13:43:06 +02:00
static void test_PathYetAnotherMakeUniqueName ( void )
{
static const WCHAR shortW [ ] = { ' f ' , ' i ' , ' l ' , ' e ' , ' . ' , ' t ' , ' s ' , ' t ' , 0 } ;
static const WCHAR short2W [ ] = { ' f ' , ' i ' , ' l ' , ' e ' , ' ' , ' ( ' , ' 2 ' , ' ) ' , ' . ' , ' t ' , ' s ' , ' t ' , 0 } ;
static const WCHAR tmpW [ ] = { ' t ' , ' m ' , ' p ' , 0 } ;
static const WCHAR longW [ ] = { ' n ' , ' a ' , ' m ' , ' e ' , 0 } ;
static const WCHAR long2W [ ] = { ' n ' , ' a ' , ' m ' , ' e ' , ' ' , ' ( ' , ' 2 ' , ' ) ' , 0 } ;
WCHAR nameW [ MAX_PATH ] , buffW [ MAX_PATH ] , pathW [ MAX_PATH ] ;
HANDLE file ;
BOOL ret ;
if ( ! pPathYetAnotherMakeUniqueName )
{
win_skip ( " PathYetAnotherMakeUniqueName() is not available. \n " ) ;
return ;
}
if ( 0 )
{
/* crashes on Windows */
ret = pPathYetAnotherMakeUniqueName ( NULL , NULL , NULL , NULL ) ;
ok ( ! ret , " got %d \n " , ret ) ;
ret = pPathYetAnotherMakeUniqueName ( nameW , NULL , NULL , NULL ) ;
ok ( ! ret , " got %d \n " , ret ) ;
}
2017-12-28 00:50:32 +01:00
GetTempPathW ( ARRAY_SIZE ( pathW ) , pathW ) ;
2014-06-28 13:43:06 +02:00
/* Using short name only first */
nameW [ 0 ] = 0 ;
ret = pPathYetAnotherMakeUniqueName ( nameW , pathW , shortW , NULL ) ;
ok ( ret , " got %d \n " , ret ) ;
lstrcpyW ( buffW , pathW ) ;
lstrcatW ( buffW , shortW ) ;
ok ( ! lstrcmpW ( nameW , buffW ) , " got %s, expected %s \n " , wine_dbgstr_w ( nameW ) , wine_dbgstr_w ( buffW ) ) ;
/* now create a file with this name and get next name */
file = CreateFileW ( nameW , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS , FILE_FLAG_DELETE_ON_CLOSE , NULL ) ;
ok ( file ! = NULL , " got %p \n " , file ) ;
nameW [ 0 ] = 0 ;
ret = pPathYetAnotherMakeUniqueName ( nameW , pathW , shortW , NULL ) ;
ok ( ret , " got %d \n " , ret ) ;
lstrcpyW ( buffW , pathW ) ;
lstrcatW ( buffW , short2W ) ;
ok ( ! lstrcmpW ( nameW , buffW ) , " got %s, expected %s \n " , wine_dbgstr_w ( nameW ) , wine_dbgstr_w ( buffW ) ) ;
CloseHandle ( file ) ;
/* Using short and long */
nameW [ 0 ] = 0 ;
ret = pPathYetAnotherMakeUniqueName ( nameW , pathW , tmpW , longW ) ;
ok ( ret , " got %d \n " , ret ) ;
lstrcpyW ( buffW , pathW ) ;
lstrcatW ( buffW , longW ) ;
ok ( ! lstrcmpW ( nameW , buffW ) , " got %s, expected %s \n " , wine_dbgstr_w ( nameW ) , wine_dbgstr_w ( buffW ) ) ;
file = CreateFileW ( nameW , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS , FILE_FLAG_DELETE_ON_CLOSE , NULL ) ;
ok ( file ! = NULL , " got %p \n " , file ) ;
nameW [ 0 ] = 0 ;
ret = pPathYetAnotherMakeUniqueName ( nameW , pathW , tmpW , longW ) ;
ok ( ret , " got %d \n " , ret ) ;
lstrcpyW ( buffW , pathW ) ;
lstrcatW ( buffW , long2W ) ;
ok ( ! lstrcmpW ( nameW , buffW ) , " got %s, expected %s \n " , wine_dbgstr_w ( nameW ) , wine_dbgstr_w ( buffW ) ) ;
CloseHandle ( file ) ;
/* Using long only */
nameW [ 0 ] = 0 ;
ret = pPathYetAnotherMakeUniqueName ( nameW , pathW , NULL , longW ) ;
ok ( ret , " got %d \n " , ret ) ;
lstrcpyW ( buffW , pathW ) ;
lstrcatW ( buffW , longW ) ;
ok ( ! lstrcmpW ( nameW , buffW ) , " got %s, expected %s \n " , wine_dbgstr_w ( nameW ) , wine_dbgstr_w ( buffW ) ) ;
}
2015-05-09 20:46:56 +02:00
static void test_SHGetKnownFolderIDList ( void )
{
PIDLIST_ABSOLUTE pidl ;
HRESULT hr ;
if ( ! pSHGetKnownFolderIDList )
{
win_skip ( " SHGetKnownFolderIDList is not available. \n " ) ;
return ;
}
hr = pSHGetKnownFolderIDList ( NULL , 0 , NULL , NULL ) ;
ok ( hr = = E_INVALIDARG , " got 0x%08x \n " , hr ) ;
if ( 0 ) { /* crashes on native */
pidl = ( void * ) 0xdeadbeef ;
hr = pSHGetKnownFolderIDList ( NULL , 0 , NULL , & pidl ) ;
}
/* not a known folder */
pidl = ( void * ) 0xdeadbeef ;
hr = pSHGetKnownFolderIDList ( & IID_IUnknown , 0 , NULL , & pidl ) ;
ok ( hr = = HRESULT_FROM_WIN32 ( ERROR_FILE_NOT_FOUND ) , " got 0x%08x \n " , hr ) ;
ok ( pidl = = NULL , " got %p \n " , pidl ) ;
hr = pSHGetKnownFolderIDList ( & FOLDERID_Desktop , 0 , NULL , NULL ) ;
ok ( hr = = E_INVALIDARG , " got 0x%08x \n " , hr ) ;
2017-08-14 15:34:10 +02:00
pidl = ( void * ) 0xdeadbeef ;
2015-05-09 20:46:56 +02:00
hr = pSHGetKnownFolderIDList ( & FOLDERID_Desktop , 0 , NULL , & pidl ) ;
2017-08-14 15:34:10 +02:00
ok ( hr = = S_OK , " SHGetKnownFolderIDList failed: 0x%08x \n " , hr ) ;
ok ( ILIsEmpty ( pidl ) , " pidl should be empty. \n " ) ;
ok ( pidl - > mkid . cb = = 0 , " get wrong value: %d \n " , pidl - > mkid . cb ) ;
ILFree ( pidl ) ;
pidl = ( void * ) 0xdeadbeef ;
hr = pSHGetKnownFolderIDList ( & FOLDERID_Desktop , KF_FLAG_NO_ALIAS , NULL , & pidl ) ;
ok ( hr = = S_OK , " SHGetKnownFolderIDList failed: 0x%08x \n " , hr ) ;
todo_wine ok ( ! ILIsEmpty ( pidl ) , " pidl should not be empty. \n " ) ;
todo_wine ok ( pidl - > mkid . cb = = 20 , " get wrong value: %d \n " , pidl - > mkid . cb ) ;
ILFree ( pidl ) ;
pidl = ( void * ) 0xdeadbeef ;
hr = pSHGetKnownFolderIDList ( & FOLDERID_Documents , 0 , NULL , & pidl ) ;
ok ( hr = = S_OK , " SHGetKnownFolderIDList failed: 0x%08x \n " , hr ) ;
ok ( ! ILIsEmpty ( pidl ) , " pidl should not be empty. \n " ) ;
ok ( pidl - > mkid . cb = = 20 , " get wrong value: %d \n " , pidl - > mkid . cb ) ;
ILFree ( pidl ) ;
pidl = ( void * ) 0xdeadbeef ;
hr = pSHGetKnownFolderIDList ( & FOLDERID_Documents , KF_FLAG_NO_ALIAS , NULL , & pidl ) ;
ok ( hr = = S_OK , " SHGetKnownFolderIDList failed: 0x%08x \n " , hr ) ;
ok ( ! ILIsEmpty ( pidl ) , " pidl should not be empty. \n " ) ;
ok ( pidl - > mkid . cb = = 20 , " get wrong value: %d \n " , pidl - > mkid . cb ) ;
ILFree ( pidl ) ;
2015-05-09 20:46:56 +02:00
}
2019-12-11 11:16:18 +01:00
static void test_PathResolve ( void )
{
WCHAR testfile [ MAX_PATH ] , testfile_lnk [ MAX_PATH ] , regedit_in_testdir [ MAX_PATH ] , regedit_cmd [ MAX_PATH ] ;
WCHAR tempdir [ MAX_PATH ] , path [ MAX_PATH ] ;
const WCHAR * dirs [ 2 ] = { tempdir , NULL } ;
HANDLE file , file2 ;
BOOL ret ;
int i ;
struct {
const WCHAR * path ;
UINT flags ;
BOOL expected ;
const WCHAR * expected_path ;
} tests [ ] = {
/* no flags */
{ L " test " , 0 , FALSE , L " test " } ,
{ L " C: \\ test " , 0 , TRUE , L " C: \\ test " } ,
{ L " regedit " , 0 , FALSE , L " regedit " } ,
{ testfile , 0 , TRUE , testfile } ,
/* PRF_VERIFYEXISTS */
{ L " test " , PRF_VERIFYEXISTS , TRUE , testfile_lnk } ,
{ L " C: \\ test " , PRF_VERIFYEXISTS , FALSE , L " C: \\ test " } ,
/* common extensions are tried even if PRF_TRYPROGRAMEXTENSIONS isn't passed */
/* directories in dirs parameter are always searched first even if PRF_FIRSTDIRDEF isn't passed */
{ L " regedit " , PRF_VERIFYEXISTS , TRUE , regedit_cmd } ,
/* .dll is not tried */
{ L " bcrypt " , PRF_VERIFYEXISTS , FALSE , L " bcrypt " } ,
{ testfile , PRF_VERIFYEXISTS , TRUE , testfile_lnk } ,
{ regedit_in_testdir , PRF_VERIFYEXISTS , TRUE , regedit_cmd } ,
/* PRF_FIRSTDIRDEF */
{ L " regedit " , PRF_FIRSTDIRDEF , FALSE , L " regedit " } ,
/* RF_VERIFYEXISTS | PRF_FIRSTDIRDEF */
{ L " regedit " , PRF_VERIFYEXISTS | PRF_FIRSTDIRDEF , TRUE , regedit_cmd } ,
/* PRF_DONTFINDLNK */
{ testfile , PRF_DONTFINDLNK , TRUE , testfile } ,
{ regedit_in_testdir , PRF_DONTFINDLNK , TRUE , regedit_in_testdir } ,
/* RF_VERIFYEXISTS | PRF_DONTFINDLNK */
{ testfile , PRF_VERIFYEXISTS | PRF_DONTFINDLNK , FALSE , testfile } ,
/* cmd is also ignored when passing PRF_VERIFYEXISTS | PRF_DONTFINDLNK */
{ regedit_in_testdir , PRF_VERIFYEXISTS | PRF_DONTFINDLNK , FALSE , regedit_in_testdir } ,
/* PRF_VERIFYEXISTS | PRF_REQUIREABSOLUTE */
/* only PRF_VERIFYEXISTS matters*/
{ L " test " , PRF_VERIFYEXISTS | PRF_REQUIREABSOLUTE , TRUE , testfile_lnk } ,
{ L " C: \\ test " , PRF_VERIFYEXISTS | PRF_REQUIREABSOLUTE , FALSE , L " C: \\ test " } ,
{ L " regedit " , PRF_VERIFYEXISTS | PRF_REQUIREABSOLUTE , TRUE , regedit_cmd } ,
{ testfile , PRF_VERIFYEXISTS | PRF_REQUIREABSOLUTE , TRUE , testfile_lnk } ,
/* PRF_TRYPROGRAMEXTENSIONS */
{ L " test " , PRF_TRYPROGRAMEXTENSIONS , TRUE , testfile_lnk } ,
{ L " C: \\ test " , PRF_TRYPROGRAMEXTENSIONS , FALSE , L " C: \\ test " } ,
{ L " regedit " , PRF_TRYPROGRAMEXTENSIONS , TRUE , regedit_cmd } ,
/* .dll is not tried */
{ L " bcrypt " , PRF_TRYPROGRAMEXTENSIONS , FALSE , L " bcrypt " } ,
{ testfile , PRF_TRYPROGRAMEXTENSIONS , TRUE , testfile_lnk } ,
{ regedit_in_testdir , PRF_TRYPROGRAMEXTENSIONS , TRUE , regedit_cmd } ,
/* PRF_TRYPROGRAMEXTENSIONS | PRF_DONTFINDLNK */
{ testfile , PRF_TRYPROGRAMEXTENSIONS | PRF_DONTFINDLNK , FALSE , testfile } ,
/* cmd is also ignored when passing PRF_TRYPROGRAMEXTENSIONS | PRF_DONTFINDLNK */
{ regedit_in_testdir , PRF_TRYPROGRAMEXTENSIONS | PRF_DONTFINDLNK , FALSE , regedit_in_testdir }
} ;
if ( ! pPathResolve )
{
win_skip ( " PathResolve not available \n " ) ;
return ;
}
GetTempPathW ( MAX_PATH , tempdir ) ;
lstrcpyW ( testfile , tempdir ) ;
lstrcatW ( testfile , L " test " ) ;
lstrcpyW ( testfile_lnk , testfile ) ;
lstrcatW ( testfile_lnk , L " .lnk " ) ;
file = CreateFileW ( testfile_lnk , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS , FILE_FLAG_DELETE_ON_CLOSE , NULL ) ;
ok ( file ! = INVALID_HANDLE_VALUE , " got %p \n " , file ) ;
lstrcpyW ( regedit_in_testdir , tempdir ) ;
lstrcatW ( regedit_in_testdir , L " regedit " ) ;
lstrcpyW ( regedit_cmd , regedit_in_testdir ) ;
lstrcatW ( regedit_cmd , L " .cmd " ) ;
file2 = CreateFileW ( regedit_cmd , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS , FILE_FLAG_DELETE_ON_CLOSE , NULL ) ;
ok ( file2 ! = INVALID_HANDLE_VALUE , " got %p \n " , file ) ;
/* show that resolving regedit with NULL dirs returns regedit.exe */
lstrcpyW ( path , L " regedit " ) ;
ret = pPathResolve ( path , NULL , PRF_VERIFYEXISTS ) ;
ok ( ret , " resolving regedit failed unexpectedly \n " ) ;
ok ( ! lstrcmpiW ( path , L " C: \\ windows \\ regedit.exe " ) | | ! lstrcmpiW ( path , L " C: \\ windows \\ system32 \\ regedit.exe " ) ,
" unexpected path %s \n " , wine_dbgstr_w ( path ) ) ;
for ( i = 0 ; i < ARRAY_SIZE ( tests ) ; i + + )
{
lstrcpyW ( path , tests [ i ] . path ) ;
if ( ! tests [ i ] . expected ) SetLastError ( 0xdeadbeef ) ;
ret = pPathResolve ( path , dirs , tests [ i ] . flags ) ;
ok ( ret = = tests [ i ] . expected , " test %d: expected %d, got %d \n " , i , tests [ i ] . expected , ret ) ;
ok ( ! lstrcmpiW ( path , tests [ i ] . expected_path ) ,
" test %d: expected %s, got %s \n " , i , wine_dbgstr_w ( tests [ i ] . expected_path ) , wine_dbgstr_w ( path ) ) ;
if ( ! tests [ i ] . expected )
ok ( GetLastError ( ) = = ERROR_FILE_NOT_FOUND , " expected ERROR_ALREADY_EXISTS, got %d \n " , GetLastError ( ) ) ;
}
CloseHandle ( file ) ;
CloseHandle ( file2 ) ;
}
2004-10-21 21:59:46 +02:00
START_TEST ( shellpath )
{
if ( ! init ( ) ) return ;
loadShell32 ( ) ;
2009-07-07 11:48:25 +02:00
pGetSystemWow64DirectoryA = ( void * ) GetProcAddress ( GetModuleHandleA ( " kernel32.dll " ) ,
" GetSystemWow64DirectoryA " ) ;
2004-10-21 21:59:46 +02:00
if ( myARGC > = 3 )
doChild ( myARGV [ 2 ] ) ;
else
{
/* first test various combinations of parameters: */
2010-04-18 16:31:52 +02:00
test_parameters ( ) ;
2004-10-21 21:59:46 +02:00
/* check known values: */
2010-04-18 16:31:52 +02:00
test_PidlTypes ( ) ;
test_GUIDs ( ) ;
test_EnvVars ( ) ;
2004-10-21 21:59:46 +02:00
testWinDir ( ) ;
testSystemDir ( ) ;
2010-04-18 16:31:52 +02:00
test_NonExistentPath ( ) ;
2010-09-14 17:01:44 +02:00
test_SHGetFolderPathEx ( ) ;
2011-06-09 10:40:02 +02:00
test_knownFolders ( ) ;
2012-12-04 11:38:02 +01:00
test_DoEnvironmentSubst ( ) ;
2014-06-28 13:43:06 +02:00
test_PathYetAnotherMakeUniqueName ( ) ;
2015-05-09 20:46:56 +02:00
test_SHGetKnownFolderIDList ( ) ;
2019-12-11 11:16:18 +01:00
test_PathResolve ( ) ;
2004-10-21 21:59:46 +02:00
}
}