Commit 1ae212a1 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Split SHGetFileInfoW into two functions.

parent ac5b0251
...@@ -236,61 +236,8 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) ...@@ -236,61 +236,8 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
return argv; return argv;
} }
#define SHGFI_KNOWN_FLAGS \ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
(SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \
SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
/*************************************************************************
* SHGetFileInfoW [SHELL32.@]
*
*/
DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags )
{ {
WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
int iIndex;
DWORD ret = TRUE, dwAttributes = 0;
IShellFolder * psfParent = NULL;
IExtractIconW * pei = NULL;
LPITEMIDLIST pidlLast = NULL, pidl = NULL;
HRESULT hr = S_OK;
BOOL IconNotYetLoaded=TRUE;
TRACE("%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x\n",
(flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
psfi, psfi->dwAttributes, sizeofpsfi, flags);
if ( (flags & SHGFI_USEFILEATTRIBUTES) &&
(flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
return FALSE;
/* windows initializes this values regardless of the flags */
if (psfi != NULL)
{
psfi->szDisplayName[0] = '\0';
psfi->szTypeName[0] = '\0';
psfi->iIcon = 0;
}
if (!(flags & SHGFI_PIDL))
{
/* SHGitFileInfo should work with absolute and relative paths */
if (PathIsRelativeW(path))
{
GetCurrentDirectoryW(MAX_PATH, szLocation);
PathCombineW(szFullPath, szLocation, path);
}
else
{
lstrcpynW(szFullPath, path, MAX_PATH);
}
}
if (flags & SHGFI_EXETYPE)
{
BOOL status = FALSE; BOOL status = FALSE;
HANDLE hfile; HANDLE hfile;
DWORD BinaryType; DWORD BinaryType;
...@@ -299,13 +246,10 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, ...@@ -299,13 +246,10 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
DWORD len; DWORD len;
char magic[4]; char magic[4];
if (flags != SHGFI_EXETYPE)
return 0;
status = GetBinaryTypeW (szFullPath, &BinaryType); status = GetBinaryTypeW (szFullPath, &BinaryType);
if (!status) if (!status)
return 0; return 0;
if ((BinaryType == SCS_DOS_BINARY) || (BinaryType == SCS_PIF_BINARY)) if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
return 0x4d5a; return 0x4d5a;
hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ, hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
...@@ -351,6 +295,66 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, ...@@ -351,6 +295,66 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
} }
CloseHandle( hfile ); CloseHandle( hfile );
return 0; return 0;
}
#define SHGFI_KNOWN_FLAGS \
(SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \
SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
/*************************************************************************
* SHGetFileInfoW [SHELL32.@]
*
*/
DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags )
{
WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
int iIndex;
DWORD ret = TRUE, dwAttributes = 0;
IShellFolder * psfParent = NULL;
IExtractIconW * pei = NULL;
LPITEMIDLIST pidlLast = NULL, pidl = NULL;
HRESULT hr = S_OK;
BOOL IconNotYetLoaded=TRUE;
TRACE("%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x\n",
(flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
psfi, psfi->dwAttributes, sizeofpsfi, flags);
if ( (flags & SHGFI_USEFILEATTRIBUTES) &&
(flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
return FALSE;
/* windows initializes this values regardless of the flags */
if (psfi != NULL)
{
psfi->szDisplayName[0] = '\0';
psfi->szTypeName[0] = '\0';
psfi->iIcon = 0;
}
if (!(flags & SHGFI_PIDL))
{
/* SHGetFileInfo should work with absolute and relative paths */
if (PathIsRelativeW(path))
{
GetCurrentDirectoryW(MAX_PATH, szLocation);
PathCombineW(szFullPath, szLocation, path);
}
else
{
lstrcpynW(szFullPath, path, MAX_PATH);
}
}
if (flags & SHGFI_EXETYPE)
{
if (flags != SHGFI_EXETYPE)
return 0;
return shgfi_get_exe_type(szFullPath);
} }
/* /*
......
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