Commit 3a78ec67 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

kernel32: GetShortPathName should fail when called with a wildcard.

parent 9bc60688
......@@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
static int path_safe_mode = -1; /* path mode set by SetSearchPathMode */
static const WCHAR wildcardsW[] = {'*','?',0};
/* check if a file name is for an executable file (.exe or .com) */
static inline BOOL is_executable( const WCHAR *name )
{
......@@ -445,7 +447,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
WIN32_FIND_DATAW wfd;
HANDLE goit;
TRACE("%s\n", debugstr_w(longpath));
TRACE("%s,%p,%u\n", debugstr_w(longpath), shortpath, shortlen);
if (!longpath)
{
......@@ -474,6 +476,13 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
sp = lp = 4;
}
if (strpbrkW(longpath + lp, wildcardsW))
{
HeapFree(GetProcessHeap(), 0, tmpshortpath);
SetLastError(ERROR_INVALID_NAME);
return 0;
}
/* check for drive letter */
if (longpath[lp] != '/' && longpath[lp + 1] == ':' )
{
......
......@@ -1477,9 +1477,7 @@ static void test_GetShortPathNameW(void)
lstrcpyW(ptr, wildW);
SetLastError(0xdeadbeef);
length = GetShortPathNameW( path, short_path, ARRAY_SIZE( short_path ) );
todo_wine
ok(!length, "GetShortPathNameW should fail\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %d\n", GetLastError());
lstrcpyW(ptr, a_bcdeW);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment