mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:42:57 +00:00
Forgot one file
svn path=/trunk/; revision=28614
This commit is contained in:
parent
3a6d290604
commit
a326fd84cb
1 changed files with 77 additions and 75 deletions
|
@ -15,7 +15,7 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
* This is a test program for the SHGet{Special}Folder{Path|Location} functions
|
* This is a test program for the SHGet{Special}Folder{Path|Location} functions
|
||||||
* of shell32, that get either a filesytem path or a LPITEMIDLIST (shell
|
* of shell32, that get either a filesytem path or a LPITEMIDLIST (shell
|
||||||
* namespace) path for a given folder (CSIDL value).
|
* namespace) path for a given folder (CSIDL value).
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "initguid.h"
|
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
#include "shlobj.h"
|
#include "shlobj.h"
|
||||||
#include "shlwapi.h"
|
#include "shlwapi.h"
|
||||||
|
@ -74,7 +73,7 @@ struct shellExpectedValues {
|
||||||
BYTE pidlType;
|
BYTE pidlType;
|
||||||
};
|
};
|
||||||
|
|
||||||
static HMODULE hShell32;
|
static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO *);
|
||||||
static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
|
static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
|
||||||
static HRESULT (WINAPI *pSHGetFolderLocation)(HWND, int, HANDLE, DWORD,
|
static HRESULT (WINAPI *pSHGetFolderLocation)(HWND, int, HANDLE, DWORD,
|
||||||
LPITEMIDLIST *);
|
LPITEMIDLIST *);
|
||||||
|
@ -153,33 +152,30 @@ static const struct shellExpectedValues optionalShellValues[] = {
|
||||||
|
|
||||||
static void loadShell32(void)
|
static void loadShell32(void)
|
||||||
{
|
{
|
||||||
hShell32 = LoadLibraryA("shell32");
|
HMODULE hShell32 = GetModuleHandleA("shell32");
|
||||||
if (hShell32)
|
|
||||||
{
|
|
||||||
HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO *);
|
|
||||||
|
|
||||||
pSHGetFolderPathA = (void *)GetProcAddress(hShell32,
|
#define GET_PROC(func) \
|
||||||
"SHGetFolderPathA");
|
p ## func = (void*)GetProcAddress(hShell32, #func); \
|
||||||
pSHGetFolderLocation = (void *)GetProcAddress(hShell32,
|
if(!p ## func) \
|
||||||
"SHGetFolderLocation");
|
trace("GetProcAddress(%s) failed\n", #func);
|
||||||
pSHGetSpecialFolderPathA = (void *)GetProcAddress(hShell32,
|
|
||||||
"SHGetSpecialFolderPathA");
|
GET_PROC(DllGetVersion)
|
||||||
pSHGetSpecialFolderLocation = (void *)GetProcAddress(hShell32,
|
GET_PROC(SHGetFolderPathA)
|
||||||
"SHGetSpecialFolderLocation");
|
GET_PROC(SHGetFolderLocation)
|
||||||
pDllGetVersion = (void *)GetProcAddress(hShell32, "DllGetVersion");
|
GET_PROC(SHGetSpecialFolderPathA)
|
||||||
pILFindLastID = (void *)GetProcAddress(hShell32, "ILFindLastID");
|
GET_PROC(SHGetSpecialFolderLocation)
|
||||||
|
GET_PROC(ILFindLastID)
|
||||||
if (!pILFindLastID)
|
if (!pILFindLastID)
|
||||||
pILFindLastID = (void *)GetProcAddress(hShell32, (LPCSTR)16);
|
pILFindLastID = (void *)GetProcAddress(hShell32, (LPCSTR)16);
|
||||||
pSHFileOperationA = (void *)GetProcAddress(hShell32,
|
GET_PROC(SHFileOperationA)
|
||||||
"SHFileOperationA");
|
GET_PROC(SHGetMalloc)
|
||||||
pSHGetMalloc = (void *)GetProcAddress(hShell32, "SHGetMalloc");
|
|
||||||
|
|
||||||
ok(pSHGetMalloc != NULL, "shell32 is missing SHGetMalloc\n");
|
ok(pSHGetMalloc != NULL, "shell32 is missing SHGetMalloc\n");
|
||||||
if (pSHGetMalloc)
|
if (pSHGetMalloc)
|
||||||
{
|
{
|
||||||
HRESULT hr = pSHGetMalloc(&pMalloc);
|
HRESULT hr = pSHGetMalloc(&pMalloc);
|
||||||
|
|
||||||
ok(SUCCEEDED(hr), "SHGetMalloc failed: 0x%08lx\n", hr);
|
ok(SUCCEEDED(hr), "SHGetMalloc failed: 0x%08x\n", hr);
|
||||||
ok(pMalloc != NULL, "SHGetMalloc returned a NULL IMalloc\n");
|
ok(pMalloc != NULL, "SHGetMalloc returned a NULL IMalloc\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,20 +184,25 @@ static void loadShell32(void)
|
||||||
shellVersion.cbSize = sizeof(shellVersion);
|
shellVersion.cbSize = sizeof(shellVersion);
|
||||||
pDllGetVersion(&shellVersion);
|
pDllGetVersion(&shellVersion);
|
||||||
if (winetest_interactive)
|
if (winetest_interactive)
|
||||||
printf("shell32 version is %ld.%ld\n",
|
printf("shell32 version is %d.%d\n",
|
||||||
shellVersion.dwMajorVersion, shellVersion.dwMinorVersion);
|
shellVersion.dwMajorVersion, shellVersion.dwMinorVersion);
|
||||||
}
|
}
|
||||||
}
|
#undef GET_PROC
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CSIDL_PROFILES
|
#ifndef CSIDL_PROFILES
|
||||||
#define CSIDL_PROFILES 0x003e
|
#define CSIDL_PROFILES 0x003e
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* CSIDL_MYDOCUMENTS is now the same as CSIDL_PERSONAL, but what we want
|
||||||
|
* here is its original value.
|
||||||
|
*/
|
||||||
|
#define OLD_CSIDL_MYDOCUMENTS 0x000c
|
||||||
|
|
||||||
/* A couple utility printing functions */
|
/* A couple utility printing functions */
|
||||||
static const char *getFolderName(int folder)
|
static const char *getFolderName(int folder)
|
||||||
{
|
{
|
||||||
static char unknown[17];
|
static char unknown[32];
|
||||||
|
|
||||||
#define CSIDL_TO_STR(x) case x: return#x;
|
#define CSIDL_TO_STR(x) case x: return#x;
|
||||||
switch (folder)
|
switch (folder)
|
||||||
|
@ -218,7 +219,7 @@ static const char *getFolderName(int folder)
|
||||||
CSIDL_TO_STR(CSIDL_SENDTO);
|
CSIDL_TO_STR(CSIDL_SENDTO);
|
||||||
CSIDL_TO_STR(CSIDL_BITBUCKET);
|
CSIDL_TO_STR(CSIDL_BITBUCKET);
|
||||||
CSIDL_TO_STR(CSIDL_STARTMENU);
|
CSIDL_TO_STR(CSIDL_STARTMENU);
|
||||||
CSIDL_TO_STR(CSIDL_MYDOCUMENTS);
|
CSIDL_TO_STR(OLD_CSIDL_MYDOCUMENTS);
|
||||||
CSIDL_TO_STR(CSIDL_MYMUSIC);
|
CSIDL_TO_STR(CSIDL_MYMUSIC);
|
||||||
CSIDL_TO_STR(CSIDL_MYVIDEO);
|
CSIDL_TO_STR(CSIDL_MYVIDEO);
|
||||||
CSIDL_TO_STR(CSIDL_DESKTOPDIRECTORY);
|
CSIDL_TO_STR(CSIDL_DESKTOPDIRECTORY);
|
||||||
|
@ -266,7 +267,7 @@ static const char *getFolderName(int folder)
|
||||||
CSIDL_TO_STR(CSIDL_COMPUTERSNEARME);
|
CSIDL_TO_STR(CSIDL_COMPUTERSNEARME);
|
||||||
#undef CSIDL_TO_STR
|
#undef CSIDL_TO_STR
|
||||||
default:
|
default:
|
||||||
wnsprintfA(unknown, sizeof(unknown), "unknown (0x%04x)", folder);
|
sprintf(unknown, "unknown (0x%04x)", folder);
|
||||||
return unknown;
|
return unknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,8 +278,7 @@ static const char *printGUID(const GUID *guid)
|
||||||
|
|
||||||
if (!guid) return NULL;
|
if (!guid) return NULL;
|
||||||
|
|
||||||
wnsprintfA(guidSTR, sizeof(guidSTR),
|
sprintf(guidSTR, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||||
"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
|
||||||
guid->Data1, guid->Data2, guid->Data3,
|
guid->Data1, guid->Data2, guid->Data3,
|
||||||
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
||||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||||
|
@ -297,7 +297,7 @@ static void testSHGetFolderLocationInvalidArgs(void)
|
||||||
hr = pSHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl);
|
hr = pSHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl);
|
||||||
ok(hr == E_INVALIDARG,
|
ok(hr == E_INVALIDARG,
|
||||||
"SHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl)\n"
|
"SHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl)\n"
|
||||||
"returned 0x%08lx, expected E_INVALIDARG\n", hr);
|
"returned 0x%08x, expected E_INVALIDARG\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
IMalloc_Free(pMalloc, pidl);
|
IMalloc_Free(pMalloc, pidl);
|
||||||
/* check a bogus user token: */
|
/* check a bogus user token: */
|
||||||
|
@ -305,7 +305,7 @@ static void testSHGetFolderLocationInvalidArgs(void)
|
||||||
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, (HANDLE)2, 0, &pidl);
|
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, (HANDLE)2, 0, &pidl);
|
||||||
ok(hr == E_FAIL,
|
ok(hr == E_FAIL,
|
||||||
"SHGetFolderLocation(NULL, CSIDL_FAVORITES, 2, 0, &pidl)\n"
|
"SHGetFolderLocation(NULL, CSIDL_FAVORITES, 2, 0, &pidl)\n"
|
||||||
"returned 0x%08lx, expected E_FAIL\n", hr);
|
"returned 0x%08x, expected E_FAIL\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
IMalloc_Free(pMalloc, pidl);
|
IMalloc_Free(pMalloc, pidl);
|
||||||
/* check reserved is not zero: */
|
/* check reserved is not zero: */
|
||||||
|
@ -313,7 +313,7 @@ static void testSHGetFolderLocationInvalidArgs(void)
|
||||||
hr = pSHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 1, &pidl);
|
hr = pSHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 1, &pidl);
|
||||||
ok(hr == E_INVALIDARG,
|
ok(hr == E_INVALIDARG,
|
||||||
"SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 1, &pidl)\n"
|
"SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 1, &pidl)\n"
|
||||||
"returned 0x%08lx, expected E_INVALIDARG\n", hr);
|
"returned 0x%08x, expected E_INVALIDARG\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
IMalloc_Free(pMalloc, pidl);
|
IMalloc_Free(pMalloc, pidl);
|
||||||
/* a NULL pidl pointer crashes, so don't test it */
|
/* a NULL pidl pointer crashes, so don't test it */
|
||||||
|
@ -329,7 +329,7 @@ static void testSHGetSpecialFolderLocationInvalidArgs(void)
|
||||||
/* SHGetSpecialFolderLocation(NULL, 0, NULL) crashes */
|
/* SHGetSpecialFolderLocation(NULL, 0, NULL) crashes */
|
||||||
hr = pSHGetSpecialFolderLocation(NULL, 0xeeee, &pidl);
|
hr = pSHGetSpecialFolderLocation(NULL, 0xeeee, &pidl);
|
||||||
ok(hr == E_INVALIDARG,
|
ok(hr == E_INVALIDARG,
|
||||||
"SHGetSpecialFolderLocation(NULL, 0xeeee, &pidl) returned 0x%08lx, "
|
"SHGetSpecialFolderLocation(NULL, 0xeeee, &pidl) returned 0x%08x, "
|
||||||
"expected E_INVALIDARG\n", hr);
|
"expected E_INVALIDARG\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,11 +345,11 @@ static void testSHGetFolderPathInvalidArgs(void)
|
||||||
SHGFP_TYPE_DEFAULT, path);
|
SHGFP_TYPE_DEFAULT, path);
|
||||||
ok(hr == E_FAIL,
|
ok(hr == E_FAIL,
|
||||||
"SHGetFolderPathA(NULL, CSIDL_DESKTOP, 2, SHGFP_TYPE_DEFAULT, path)\n"
|
"SHGetFolderPathA(NULL, CSIDL_DESKTOP, 2, SHGFP_TYPE_DEFAULT, path)\n"
|
||||||
"returned 0x%08lx, expected E_FAIL\n", hr);
|
"returned 0x%08x, expected E_FAIL\n", hr);
|
||||||
hr = pSHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path);
|
hr = pSHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path);
|
||||||
ok(hr == E_INVALIDARG,
|
ok(hr == E_INVALIDARG,
|
||||||
"SHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path)\n"
|
"SHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path)\n"
|
||||||
"returned 0x%08lx, expected E_INVALIDARG\n", hr);
|
"returned 0x%08x, expected E_INVALIDARG\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testSHGetSpecialFolderPathInvalidArgs(void)
|
static void testSHGetSpecialFolderPathInvalidArgs(void)
|
||||||
|
@ -359,16 +359,18 @@ static void testSHGetSpecialFolderPathInvalidArgs(void)
|
||||||
|
|
||||||
if (!pSHGetSpecialFolderPathA) return;
|
if (!pSHGetSpecialFolderPathA) return;
|
||||||
|
|
||||||
|
#if 0
|
||||||
ret = pSHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE);
|
ret = pSHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE);
|
||||||
ok(!ret,
|
ok(!ret,
|
||||||
"SHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE)\n"
|
"SHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE)\n"
|
||||||
"returned TRUE, expected FALSE\n");
|
"returned TRUE, expected FALSE\n");
|
||||||
|
#endif
|
||||||
/* odd but true: calling with a NULL path still succeeds if it's a real
|
/* odd but true: calling with a NULL path still succeeds if it's a real
|
||||||
* dir
|
* dir (on some windows platform). on winME it generates exception.
|
||||||
*/
|
*/
|
||||||
ret = pSHGetSpecialFolderPathA(NULL, NULL, CSIDL_PROGRAMS, FALSE);
|
ret = pSHGetSpecialFolderPathA(NULL, path, CSIDL_PROGRAMS, FALSE);
|
||||||
ok(ret,
|
ok(ret,
|
||||||
"SHGetSpecialFolderPathA(NULL, NULL, CSIDL_PROGRAMS, FALSE)\n"
|
"SHGetSpecialFolderPathA(NULL, path, CSIDL_PROGRAMS, FALSE)\n"
|
||||||
"returned FALSE, expected TRUE\n");
|
"returned FALSE, expected TRUE\n");
|
||||||
ret = pSHGetSpecialFolderPathA(NULL, path, 0xeeee, FALSE);
|
ret = pSHGetSpecialFolderPathA(NULL, path, 0xeeee, FALSE);
|
||||||
ok(!ret,
|
ok(!ret,
|
||||||
|
@ -398,7 +400,7 @@ static BYTE testSHGetFolderLocation(BOOL optional, int folder)
|
||||||
hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl);
|
hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl);
|
||||||
ok(SUCCEEDED(hr) || optional,
|
ok(SUCCEEDED(hr) || optional,
|
||||||
"SHGetFolderLocation(NULL, %s, NULL, 0, &pidl)\n"
|
"SHGetFolderLocation(NULL, %s, NULL, 0, &pidl)\n"
|
||||||
"failed: 0x%08lx\n", getFolderName(folder), hr);
|
"failed: 0x%08x\n", getFolderName(folder), hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
ok(pidl != NULL,
|
ok(pidl != NULL,
|
||||||
|
@ -432,7 +434,7 @@ static BYTE testSHGetSpecialFolderLocation(BOOL optional, int folder)
|
||||||
hr = pSHGetSpecialFolderLocation(NULL, folder, &pidl);
|
hr = pSHGetSpecialFolderLocation(NULL, folder, &pidl);
|
||||||
ok(SUCCEEDED(hr) || optional,
|
ok(SUCCEEDED(hr) || optional,
|
||||||
"SHGetSpecialFolderLocation(NULL, %s, &pidl)\n"
|
"SHGetSpecialFolderLocation(NULL, %s, &pidl)\n"
|
||||||
"failed: 0x%08lx\n", getFolderName(folder), hr);
|
"failed: 0x%08x\n", getFolderName(folder), hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
ok(pidl != NULL,
|
ok(pidl != NULL,
|
||||||
|
@ -462,7 +464,7 @@ static void testSHGetFolderPath(BOOL optional, int folder)
|
||||||
hr = pSHGetFolderPathA(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path);
|
hr = pSHGetFolderPathA(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path);
|
||||||
ok(SUCCEEDED(hr) || optional,
|
ok(SUCCEEDED(hr) || optional,
|
||||||
"SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path)\n"
|
"SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path)\n"
|
||||||
"failed: 0x%08lx\n", getFolderName(folder), hr);
|
"failed: 0x%08x\n", getFolderName(folder), hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testSHGetSpecialFolderPath(BOOL optional, int folder)
|
static void testSHGetSpecialFolderPath(BOOL optional, int folder)
|
||||||
|
@ -720,21 +722,21 @@ static void testNonExistentPath1(void)
|
||||||
|
|
||||||
/* test some failure cases first: */
|
/* test some failure cases first: */
|
||||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES, NULL,
|
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES, NULL,
|
||||||
SHGFP_TYPE_CURRENT, NULL);
|
SHGFP_TYPE_CURRENT, path);
|
||||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||||
"SHGetFolderPath returned 0x%08lx, expected 0x80070002\n", hr);
|
"SHGetFolderPath returned 0x%08x, expected 0x80070002\n", hr);
|
||||||
pidl = NULL;
|
pidl = NULL;
|
||||||
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, NULL, 0,
|
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, NULL, 0,
|
||||||
&pidl);
|
&pidl);
|
||||||
ok(hr == E_FAIL,
|
ok(hr == E_FAIL,
|
||||||
"SHGetFolderLocation returned 0x%08lx, expected E_FAIL\n", hr);
|
"SHGetFolderLocation returned 0x%08x, expected E_FAIL\n", hr);
|
||||||
if (SUCCEEDED(hr) && pidl)
|
if (SUCCEEDED(hr) && pidl)
|
||||||
IMalloc_Free(pMalloc, pidl);
|
IMalloc_Free(pMalloc, pidl);
|
||||||
ok(!pSHGetSpecialFolderPathA(NULL, path, CSIDL_FAVORITES, FALSE),
|
ok(!pSHGetSpecialFolderPathA(NULL, path, CSIDL_FAVORITES, FALSE),
|
||||||
"SHGetSpecialFolderPath succeeded, expected failure\n");
|
"SHGetSpecialFolderPath succeeded, expected failure\n");
|
||||||
pidl = NULL;
|
pidl = NULL;
|
||||||
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidl);
|
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidl);
|
||||||
ok(hr == E_FAIL, "SHGetFolderLocation returned 0x%08lx, expected E_FAIL\n",
|
ok(hr == E_FAIL, "SHGetFolderLocation returned 0x%08x, expected E_FAIL\n",
|
||||||
hr);
|
hr);
|
||||||
if (SUCCEEDED(hr) && pidl)
|
if (SUCCEEDED(hr) && pidl)
|
||||||
IMalloc_Free(pMalloc, pidl);
|
IMalloc_Free(pMalloc, pidl);
|
||||||
|
@ -753,13 +755,13 @@ static void testNonExistentPath1(void)
|
||||||
"with ERROR_ALREADY_EXISTS\n");
|
"with ERROR_ALREADY_EXISTS\n");
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ok(GetLastError() == ERROR_ALREADY_EXISTS,
|
ok(GetLastError() == ERROR_ALREADY_EXISTS,
|
||||||
"CreateDirectoryA failed with %ld, "
|
"CreateDirectoryA failed with %d, "
|
||||||
"expected ERROR_ALREADY_EXISTS\n",
|
"expected ERROR_ALREADY_EXISTS\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
}
|
}
|
||||||
ok(SUCCEEDED(hr),
|
ok(SUCCEEDED(hr),
|
||||||
"SHGetFolderPath(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, "
|
"SHGetFolderPath(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, "
|
||||||
"NULL, SHGFP_TYPE_CURRENT, path)\nfailed: 0x%08lx\n", hr);
|
"NULL, SHGFP_TYPE_CURRENT, path)\nfailed: 0x%08x\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Subprocess helper 2: make sure SHGetFolderPath still succeeds when the
|
/* Subprocess helper 2: make sure SHGetFolderPath still succeeds when the
|
||||||
|
@ -768,10 +770,11 @@ static void testNonExistentPath1(void)
|
||||||
static void testNonExistentPath2(void)
|
static void testNonExistentPath2(void)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
char path[MAX_PATH];
|
||||||
|
|
||||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
|
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
|
||||||
SHGFP_TYPE_CURRENT, NULL);
|
SHGFP_TYPE_CURRENT, path);
|
||||||
ok(SUCCEEDED(hr), "SHGetFolderPath failed: 0x%08lx\n", hr);
|
ok(SUCCEEDED(hr), "SHGetFolderPath failed: 0x%08x\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doChild(const char *arg)
|
static void doChild(const char *arg)
|
||||||
|
@ -825,16 +828,15 @@ static void testNonExistentPath(void)
|
||||||
modifiedPath[len++] = '\0';
|
modifiedPath[len++] = '\0';
|
||||||
if (winetest_interactive)
|
if (winetest_interactive)
|
||||||
printf("Changing CSIDL_FAVORITES to %s\n", modifiedPath);
|
printf("Changing CSIDL_FAVORITES to %s\n", modifiedPath);
|
||||||
if (!RegSetValueExA(key, "Favorites", 0, type, (LPBYTE) modifiedPath, len))
|
if (!RegSetValueExA(key, "Favorites", 0, type,
|
||||||
|
(LPBYTE)modifiedPath, len))
|
||||||
{
|
{
|
||||||
char buffer[MAX_PATH];
|
char buffer[MAX_PATH+20];
|
||||||
STARTUPINFOA startup;
|
STARTUPINFOA startup;
|
||||||
PROCESS_INFORMATION info;
|
PROCESS_INFORMATION info;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
wnsprintfA(buffer, sizeof(buffer), "%s tests/shellpath.c 1",
|
sprintf(buffer, "%s tests/shellpath.c 1", selfname);
|
||||||
selfname);
|
|
||||||
memset(&startup, 0, sizeof(startup));
|
memset(&startup, 0, sizeof(startup));
|
||||||
startup.cb = sizeof(startup);
|
startup.cb = sizeof(startup);
|
||||||
startup.dwFlags = STARTF_USESHOWWINDOW;
|
startup.dwFlags = STARTF_USESHOWWINDOW;
|
||||||
|
@ -847,7 +849,7 @@ static void testNonExistentPath(void)
|
||||||
/* Query the path to be able to delete it below */
|
/* Query the path to be able to delete it below */
|
||||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES, NULL,
|
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES, NULL,
|
||||||
SHGFP_TYPE_CURRENT, modifiedPath);
|
SHGFP_TYPE_CURRENT, modifiedPath);
|
||||||
ok(SUCCEEDED(hr), "SHGetFolderPathA failed: 0x%08lx\n", hr);
|
ok(SUCCEEDED(hr), "SHGetFolderPathA failed: 0x%08x\n", hr);
|
||||||
|
|
||||||
/* restore original values: */
|
/* restore original values: */
|
||||||
if (winetest_interactive)
|
if (winetest_interactive)
|
||||||
|
@ -856,8 +858,7 @@ static void testNonExistentPath(void)
|
||||||
strlen(originalPath) + 1);
|
strlen(originalPath) + 1);
|
||||||
RegFlushKey(key);
|
RegFlushKey(key);
|
||||||
|
|
||||||
wnsprintfA(buffer, sizeof(buffer), "%s tests/shellpath.c 2",
|
sprintf(buffer, "%s tests/shellpath.c 2", selfname);
|
||||||
selfname);
|
|
||||||
memset(&startup, 0, sizeof(startup));
|
memset(&startup, 0, sizeof(startup));
|
||||||
startup.cb = sizeof(startup);
|
startup.cb = sizeof(startup);
|
||||||
startup.dwFlags = STARTF_USESHOWWINDOW;
|
startup.dwFlags = STARTF_USESHOWWINDOW;
|
||||||
|
@ -867,8 +868,10 @@ static void testNonExistentPath(void)
|
||||||
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0,
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0,
|
||||||
"child process termination\n");
|
"child process termination\n");
|
||||||
|
|
||||||
ret = RemoveDirectoryA(modifiedPath);
|
strcpy(buffer, modifiedPath);
|
||||||
ok( ret, "RemoveDirectoryA failed: %ld\n", GetLastError());
|
strcat(buffer, "\\desktop.ini");
|
||||||
|
DeleteFileA(buffer);
|
||||||
|
RemoveDirectoryA(modifiedPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (winetest_interactive)
|
else if (winetest_interactive)
|
||||||
|
@ -886,7 +889,6 @@ START_TEST(shellpath)
|
||||||
if (!init()) return;
|
if (!init()) return;
|
||||||
|
|
||||||
loadShell32();
|
loadShell32();
|
||||||
if (!hShell32) return;
|
|
||||||
|
|
||||||
if (myARGC >= 3)
|
if (myARGC >= 3)
|
||||||
doChild(myARGV[2]);
|
doChild(myARGV[2]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue