*
* Copyright 1998 Marcus Meissner
* Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
+ * Copyright 2017 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
HRESULT hr = S_OK;
BOOL IconNotYetLoaded=TRUE;
UINT uGilFlags = 0;
+ HIMAGELIST big_icons, small_icons;
TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
(flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
- psfi, psfi->dwAttributes, sizeofpsfi, flags);
+ psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
if (!path)
return FALSE;
{
psfi->szDisplayName[0] = '\0';
psfi->szTypeName[0] = '\0';
- psfi->iIcon = 0;
+ psfi->hIcon = NULL;
}
if (!(flags & SHGFI_PIDL))
lstrcpynW(szFullPath, path, MAX_PATH);
}
}
+ else
+ {
+ SHGetPathFromIDListW((LPITEMIDLIST)path, szFullPath);
+ }
if (flags & SHGFI_EXETYPE)
{
- if (flags != SHGFI_EXETYPE)
- return 0;
- return shgfi_get_exe_type(szFullPath);
+ if (!(flags & SHGFI_SYSICONINDEX))
+ {
+ if (flags & SHGFI_USEFILEATTRIBUTES)
+ {
+ return TRUE;
+ }
+ else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
+ {
+ return shgfi_get_exe_type(szFullPath);
+ }
+ }
}
/*
(LPCITEMIDLIST*)&pidlLast );
if (SUCCEEDED(hr))
pidlLast = ILClone(pidlLast);
+ else
+ hr = S_OK;
ILFree(pidl);
}
else
psfi->dwAttributes = 0xffffffff;
}
if (psfParent)
- IShellFolder_GetAttributesOf( psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
- &(psfi->dwAttributes) );
+ {
+ IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
+ &(psfi->dwAttributes));
+ }
+ }
+
+ if (flags & SHGFI_USEFILEATTRIBUTES)
+ {
+ if (flags & SHGFI_ICON)
+ {
+ psfi->dwAttributes = 0;
+ }
}
/* get the displayname */
{
lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
}
- else
+ else if (psfParent)
{
STRRET str;
hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
/* get the type name */
if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
{
+ static const WCHAR szFolder[] = { 'F','o','l','d','e','r',0 };
static const WCHAR szFile[] = { 'F','i','l','e',0 };
- static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
+ static const WCHAR szSpaceFile[] = { ' ','f','i','l','e',0 };
if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL))
{
else
{
if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- strcatW (psfi->szTypeName, szFile);
+ strcatW (psfi->szTypeName, szFolder);
else
{
WCHAR sTemp[64];
lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
- if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
+ if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
+ {
+ /* "name" or "name." => "File" */
+ lstrcpynW (psfi->szTypeName, szFile, 64);
+ }
+ else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
{
- lstrcpynW (psfi->szTypeName, sTemp, 64);
- strcatW (psfi->szTypeName, szDashFile);
+ if (sTemp[0])
+ {
+ lstrcpynW (psfi->szTypeName, sTemp, 64);
+ strcatW (psfi->szTypeName, szSpaceFile);
+ }
+ else
+ {
+ lstrcpynW (psfi->szTypeName, szFile, 64);
+ }
}
}
}
}
/* ### icons ###*/
+
+ Shell_GetImageLists( &big_icons, &small_icons );
+
if (flags & SHGFI_OPENICON)
uGilFlags |= GIL_OPENICON;
ret = FALSE;
}
}
- else
+ else if (psfParent)
{
hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
(LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
}
}
}
- else
+ else if (psfParent)
{
if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
uGilFlags, &(psfi->iIcon))))
if (ret && (flags & SHGFI_SYSICONINDEX))
{
if (flags & SHGFI_SMALLICON)
- ret = (DWORD_PTR) ShellSmallIconList;
+ ret = (DWORD_PTR)small_icons;
else
- ret = (DWORD_PTR) ShellBigIconList;
+ ret = (DWORD_PTR)big_icons;
}
}
if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
{
if (flags & SHGFI_SMALLICON)
- psfi->hIcon = ImageList_GetIcon( ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
+ psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
else
- psfi->hIcon = ImageList_GetIcon( ShellBigIconList, psfi->iIcon, ILD_NORMAL);
+ psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
}
if (flags & ~SHGFI_KNOWN_FLAGS)
FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
+ if (psfParent)
+ IShellFolder_Release(psfParent);
+
if (hr != S_OK)
ret = FALSE;
pathW = temppath;
}
- if (psfi && (flags & SHGFI_ATTR_SPECIFIED))
- temppsfi.dwAttributes=psfi->dwAttributes;
+ if (psfi)
+ {
+ temppsfi.hIcon = psfi->hIcon;
+ temppsfi.iIcon = psfi->iIcon;
+ temppsfi.dwAttributes = psfi->dwAttributes;
- if (psfi == NULL)
- ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, 0, flags);
- else
ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
+ psfi->hIcon = temppsfi.hIcon;
+ psfi->iIcon = temppsfi.iIcon;
+ psfi->dwAttributes = temppsfi.dwAttributes;
- if (psfi)
- {
- if(flags & SHGFI_ICON)
- psfi->hIcon=temppsfi.hIcon;
- if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
- psfi->iIcon=temppsfi.iIcon;
- if(flags & SHGFI_ATTRIBUTES)
- psfi->dwAttributes=temppsfi.dwAttributes;
- if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
- {
- WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
- psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
- }
- if(flags & SHGFI_TYPENAME)
- {
- WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
- psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
- }
+ WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
+ psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
+
+ WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
+ psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
}
+ else
+ ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, 0, flags);
HeapFree(GetProcessHeap(), 0, temppath);
TRACE("%s\n", debugstr_guid(rclsid));
CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
- if (ptr)
+ if(ptr)
+ {
+ IUnknown * pUnk = ptr;
+ IUnknown_Release(pUnk);
return S_OK;
+ }
return DISP_E_MEMBERNOTFOUND;
}
static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
static DWORD cxLogoBmp;
- static DWORD cyLogoBmp;
- static HBITMAP hLogoBmp;
+ static DWORD cyLogoBmp, cyLineBmp;
+ static HBITMAP hLogoBmp, hLineBmp;
static HWND hWndAuthors;
switch(msg)
// Preload the ROS bitmap
hLogoBmp = (HBITMAP)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDB_REACTOS), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
+ hLineBmp = (HBITMAP)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDB_LINEBAR), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
- if(hLogoBmp)
+ if(hLogoBmp && hLineBmp)
{
BITMAP bmpLogo;
cxLogoBmp = bmpLogo.bmWidth;
cyLogoBmp = bmpLogo.bmHeight;
+
+ GetObject( hLineBmp, sizeof(BITMAP), &bmpLogo );
+ cyLineBmp = bmpLogo.bmHeight;
}
// Set App-specific stuff (icon, app name, szOtherStuff string)
case WM_PAINT:
{
- if(hLogoBmp)
+ if(hLogoBmp && hLineBmp)
{
PAINTSTRUCT ps;
HDC hdc;
HDC hdcMem;
+ HGDIOBJ hOldObj;
hdc = BeginPaint(hWnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
if(hdcMem)
{
- SelectObject(hdcMem, hLogoBmp);
+ hOldObj = SelectObject(hdcMem, hLogoBmp);
BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
+ SelectObject(hdcMem, hLineBmp);
+ BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
+
+ SelectObject(hdcMem, hOldObj);
DeleteDC(hdcMem);
}