Stub implementations for SHUpdateImageA, SHHandleUpdateImage,

SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog,
SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}.
'HeapAlloc can fail' fix for ExtractIconExA.
Implement ExtractAssociatedIconA -> W.
Correct prototype for SHObjectProperties.
Forward SHGetNewLinkInfo to SHGetNewLinkInfoA.
This commit is contained in:
Hans Leidekker 2005-01-03 20:26:06 +00:00 committed by Alexandre Julliard
parent 8facd46877
commit c1236fd120
5 changed files with 180 additions and 54 deletions

View File

@ -420,15 +420,18 @@ UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge
*/ */
UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons) UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons)
{ {
UINT ret; UINT ret = 0;
INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0); INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len); if (lpwstrFile)
ret = ExtractIconExW (lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons); {
HeapFree(GetProcessHeap(), 0, lpwstrFile); MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
ret = ExtractIconExW(lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
HeapFree(GetProcessHeap(), 0, lpwstrFile);
}
return ret; return ret;
} }
@ -440,43 +443,55 @@ UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge,
*/ */
HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon) HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon)
{ {
HICON hIcon; HICON hIcon = NULL;
WORD wDummyIcon = 0; INT len = MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, NULL, 0);
LPWSTR lpIconPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
TRACE("\n");
if(lpiIcon == NULL) TRACE("%p %s %p\n", hInst, debugstr_a(lpIconPath), lpiIcon);
lpiIcon = &wDummyIcon;
hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon); if (lpIconPathW)
{
MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, lpIconPathW, len);
hIcon = ExtractAssociatedIconW(hInst, lpIconPathW, lpiIcon);
HeapFree(GetProcessHeap(), 0, lpIconPathW);
}
return hIcon;
}
if( hIcon < (HICON)2 ) HICON WINAPI ExtractAssociatedIconW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIcon)
{ if( hIcon == (HICON)1 ) /* no icons found in given file */ {
{ char tempPath[0x80]; HICON hIcon = NULL;
HINSTANCE uRet = FindExecutableA(lpIconPath,NULL,tempPath); WORD wDummyIcon = 0;
if( uRet > (HINSTANCE)32 && tempPath[0] ) TRACE("%p %s %p\n", hInst, debugstr_w(lpIconPath), lpiIcon);
{ strcpy(lpIconPath,tempPath);
hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
if( hIcon > (HICON)2 )
return hIcon;
}
else hIcon = 0;
}
if( hIcon == (HICON)1 ) if(lpiIcon == NULL)
*lpiIcon = 2; /* MSDOS icon - we found .exe but no icons in it */ lpiIcon = &wDummyIcon;
else
*lpiIcon = 6; /* generic icon - found nothing */
if (GetModuleFileNameA(hInst, lpIconPath, 0x80)) hIcon = ExtractIconW(hInst, lpIconPath, *lpiIcon);
{
/* terminate string (GetModuleFileName doesn't do if buffer is too small) */ if( hIcon < (HICON)2 )
lpIconPath[0x80 - 1] = '\0'; { if( hIcon == (HICON)1 ) /* no icons found in given file */
hIcon = LoadIconA( hInst, MAKEINTRESOURCEA(*lpiIcon)); { WCHAR tempPath[MAX_PATH];
} HINSTANCE uRet = FindExecutableW(lpIconPath,NULL,tempPath);
}
return hIcon; if( uRet > (HINSTANCE)32 && tempPath[0] )
{ lstrcpyW(lpIconPath,tempPath);
hIcon = ExtractIconW(hInst, lpIconPath, *lpiIcon);
if( hIcon > (HICON)2 )
return hIcon;
}
}
if( hIcon == (HICON)1 )
*lpiIcon = 2; /* MSDOS icon - we found .exe but no icons in it */
else
*lpiIcon = 6; /* generic icon - found nothing */
if (GetModuleFileNameW(hInst, lpIconPath, MAX_PATH))
hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(*lpiIcon));
}
return hIcon;
} }
/************************************************************************* /*************************************************************************

View File

@ -169,9 +169,9 @@
175 stdcall SHGetSpecialFolderPath(long long long long) SHGetSpecialFolderPathAW 175 stdcall SHGetSpecialFolderPath(long long long long) SHGetSpecialFolderPathAW
176 stdcall SHSetInstanceExplorer (long) 176 stdcall SHSetInstanceExplorer (long)
177 stub DAD_SetDragImageFromListView 177 stub DAD_SetDragImageFromListView
178 stub SHObjectProperties 178 stdcall SHObjectProperties(long long wstr wstr)
179 stub SHGetNewLinkInfoA 179 stdcall SHGetNewLinkInfoA(str str ptr long long)
180 stub SHGetNewLinkInfoW 180 stdcall SHGetNewLinkInfoW(wstr wstr ptr long long)
181 stdcall RegisterShellHook(long long) 181 stdcall RegisterShellHook(long long)
182 varargs ShellMessageBoxW(long long long str long) 182 varargs ShellMessageBoxW(long long long str long)
183 varargs ShellMessageBoxA(long long long str long) 183 varargs ShellMessageBoxA(long long long str long)
@ -182,9 +182,9 @@
188 stdcall ShellDDEInit(long) 188 stdcall ShellDDEInit(long)
189 stdcall ILCreateFromPathA(str) 189 stdcall ILCreateFromPathA(str)
190 stdcall ILCreateFromPathW(wstr) 190 stdcall ILCreateFromPathW(wstr)
191 stub SHUpdateImageA 191 stdcall SHUpdateImageA(str long long long)
192 stdcall SHUpdateImageW(wstr long long long) 192 stdcall SHUpdateImageW(wstr long long long)
193 stub SHHandleUpdateImage 193 stdcall SHHandleUpdateImage(ptr)
194 stub SHCreatePropSheetExtArrayEx 194 stub SHCreatePropSheetExtArrayEx
195 stdcall SHFree(ptr) 195 stdcall SHFree(ptr)
196 stdcall SHAlloc(long) 196 stdcall SHAlloc(long)
@ -206,7 +206,7 @@
212 stub Printers_AddPrinterPropPages 212 stub Printers_AddPrinterPropPages
213 stub Printers_RegisterWindowW 213 stub Printers_RegisterWindowW
214 stub Printers_UnregisterWindow 214 stub Printers_UnregisterWindow
215 stub SHStartNetConnectionDialog 215 stdcall SHStartNetConnectionDialog(long str long)
243 stdcall @(long long) shell32_243 243 stdcall @(long long) shell32_243
244 stdcall SHInitRestricted(ptr ptr) 244 stdcall SHInitRestricted(ptr ptr)
247 stdcall SHGetDataFromIDListA (ptr ptr long ptr long) 247 stdcall SHGetDataFromIDListA (ptr ptr long ptr long)
@ -242,8 +242,8 @@
296 stdcall Shell_NotifyIcon(long ptr) Shell_NotifyIconA 296 stdcall Shell_NotifyIcon(long ptr) Shell_NotifyIconA
297 stdcall Shell_NotifyIconA(long ptr) 297 stdcall Shell_NotifyIconA(long ptr)
298 stdcall Shell_NotifyIconW(long ptr) 298 stdcall Shell_NotifyIconW(long ptr)
299 stub Shl1632_ThunkData32 #299 stub Shl1632_ThunkData32
300 stub Shl3216_ThunkData32 #300 stub Shl3216_ThunkData32
301 stdcall StrChrA(str long) shlwapi.StrChrA 301 stdcall StrChrA(str long) shlwapi.StrChrA
302 stdcall StrChrIA(str long) shlwapi.StrChrIA 302 stdcall StrChrIA(str long) shlwapi.StrChrIA
303 stdcall StrChrIW(wstr long) shlwapi.StrChrIW 303 stdcall StrChrIW(wstr long) shlwapi.StrChrIW
@ -338,10 +338,10 @@
@ stdcall DoEnvironmentSubstW(wstr wstr) @ stdcall DoEnvironmentSubstW(wstr wstr)
@ stub DragQueryFileAorW @ stub DragQueryFileAorW
@ stdcall DuplicateIcon(long long) @ stdcall DuplicateIcon(long long)
@ stdcall ExtractAssociatedIconA(long ptr long) @ stdcall ExtractAssociatedIconA(long str ptr)
@ stdcall ExtractAssociatedIconExA(long str long long) @ stdcall ExtractAssociatedIconExA(long str long long)
@ stdcall ExtractAssociatedIconExW(long wstr long long) @ stdcall ExtractAssociatedIconExW(long wstr long long)
@ stub ExtractAssociatedIconW @ stdcall ExtractAssociatedIconW(long wstr ptr)
@ stdcall ExtractIconA(long str long) @ stdcall ExtractIconA(long str long)
@ stdcall ExtractIconEx(ptr long ptr ptr long) ExtractIconExA @ stdcall ExtractIconEx(ptr long ptr ptr long) ExtractIconExA
@ stdcall ExtractIconExA(str long ptr ptr long) @ stdcall ExtractIconExA(str long ptr ptr long)
@ -376,12 +376,12 @@
@ stdcall SHCreateDirectoryExA(long str ptr) @ stdcall SHCreateDirectoryExA(long str ptr)
@ stdcall SHCreateDirectoryExW(long wstr ptr) @ stdcall SHCreateDirectoryExW(long wstr ptr)
@ stub ShellHookProc @ stub ShellHookProc
@ stub SHEmptyRecycleBinA @ stdcall SHEmptyRecycleBinA(long str long)
@ stub SHEmptyRecycleBinW @ stdcall SHEmptyRecycleBinW(long wstr long)
@ stdcall SHFileOperation(ptr) SHFileOperationA @ stdcall SHFileOperation(ptr) SHFileOperationA
@ stdcall SHFileOperationA(ptr) @ stdcall SHFileOperationA(ptr)
@ stdcall SHFileOperationW(ptr) @ stdcall SHFileOperationW(ptr)
@ stub SHFormatDrive @ stdcall SHFormatDrive(long long long long)
@ stdcall SHFreeNameMappings(ptr) @ stdcall SHFreeNameMappings(ptr)
@ stdcall SHGetDesktopFolder(ptr) @ stdcall SHGetDesktopFolder(ptr)
@ stdcall SHGetFileInfo(ptr long ptr long long) SHGetFileInfoA @ stdcall SHGetFileInfo(ptr long ptr long long) SHGetFileInfoA
@ -389,7 +389,7 @@
@ stdcall SHGetFileInfoW(ptr long ptr long long) @ stdcall SHGetFileInfoW(ptr long ptr long long)
@ stdcall SHGetInstanceExplorer(long) @ stdcall SHGetInstanceExplorer(long)
@ stdcall SHGetMalloc(ptr) @ stdcall SHGetMalloc(ptr)
@ stub SHGetNewLinkInfo @ stdcall SHGetNewLinkInfo(str str ptr long long) SHGetNewLinkInfoA
@ stdcall SHGetPathFromIDList(ptr ptr) SHGetPathFromIDListA @ stdcall SHGetPathFromIDList(ptr ptr) SHGetPathFromIDListA
@ stdcall SHGetPathFromIDListA(ptr ptr) @ stdcall SHGetPathFromIDListA(ptr ptr)
@ stdcall SHGetPathFromIDListW(ptr ptr) @ stdcall SHGetPathFromIDListW(ptr ptr)
@ -399,8 +399,8 @@
@ stub SHHelpShortcuts_RunDLLA @ stub SHHelpShortcuts_RunDLLA
@ stub SHHelpShortcuts_RunDLLW @ stub SHHelpShortcuts_RunDLLW
@ stdcall SHLoadInProc(long) @ stdcall SHLoadInProc(long)
@ stub SHQueryRecycleBinA @ stdcall SHQueryRecycleBinA(str ptr)
@ stub SHQueryRecycleBinW @ stdcall SHQueryRecycleBinW(wstr ptr)
@ stub SHUpdateRecycleBinIcon @ stub SHUpdateRecycleBinIcon
@ stub WOWShellExecute @ stub WOWShellExecute

View File

@ -1546,5 +1546,90 @@ BOOL WINAPI SHFindFiles( LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile )
*/ */
void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex) void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex)
{ {
FIXME("%s, %d, 0x%x, %d\n", debugstr_w(pszHashItem), iIndex, uFlags, iImageIndex); FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_w(pszHashItem), iIndex, uFlags, iImageIndex);
}
VOID WINAPI SHUpdateImageA(LPCSTR pszHashItem, INT iIndex, UINT uFlags, INT iImageIndex)
{
FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_a(pszHashItem), iIndex, uFlags, iImageIndex);
}
INT WINAPI SHHandleUpdateImage(LPCITEMIDLIST pidlExtra)
{
FIXME("%p - stub\n", pidlExtra);
return -1;
}
BOOL WINAPI SHObjectProperties(HWND hwnd, DWORD dwType, LPCWSTR szObject, LPCWSTR szPage)
{
FIXME("%p, 0x%08lx, %s, %s - stub\n", hwnd, dwType, debugstr_w(szObject), debugstr_w(szPage));
return TRUE;
}
BOOL WINAPI SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName, BOOL *pfMustCopy,
UINT uFlags)
{
FIXME("%s, %s, %p, %p, 0x%08x - stub\n", debugstr_a(pszLinkTo), debugstr_a(pszDir),
pszName, pfMustCopy, uFlags);
return FALSE;
}
BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy,
UINT uFlags)
{
FIXME("%s, %s, %p, %p, 0x%08x - stub\n", debugstr_w(pszLinkTo), debugstr_w(pszDir),
pszName, pfMustCopy, uFlags);
return FALSE;
}
HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType)
{
FIXME("%p, %s, 0x%08lx - stub\n", hwnd, debugstr_a(pszRemoteName), dwType);
return S_OK;
}
HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags)
{
FIXME("%p, %s, 0x%08lx - stub\n", hwnd, debugstr_a(pszRootPath), dwFlags);
return S_OK;
}
HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags)
{
FIXME("%p, %s, 0x%08lx - stub\n", hwnd, debugstr_w(pszRootPath), dwFlags);
return S_OK;
}
DWORD WINAPI SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
{
FIXME("%p, 0x%08x, 0x%08x, 0x%08x - stub\n", hwnd, drive, fmtID, options);
return SHFMT_NOFORMAT;
}
HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
{
FIXME("%s, %p - stub\n", debugstr_a(pszRootPath), pSHQueryRBInfo);
pSHQueryRBInfo->i64Size = 0;
pSHQueryRBInfo->i64NumItems = 0;
return S_OK;
}
HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
{
FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
pSHQueryRBInfo->i64Size = 0;
pSHQueryRBInfo->i64NumItems = 0;
return S_OK;
} }

View File

@ -399,6 +399,24 @@ BOOL WINAPI SHGetNewLinkInfoA(LPCSTR,LPCSTR,LPSTR,BOOL*,UINT);
BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR,LPCWSTR,LPWSTR,BOOL*,UINT); BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR,LPCWSTR,LPWSTR,BOOL*,UINT);
#define SHGetNewLinkInfo WINELIB_NAME_AW(SHGetNewLinkInfo) #define SHGetNewLinkInfo WINELIB_NAME_AW(SHGetNewLinkInfo)
/******************************************
* Recycle bin
*/
typedef struct _SHQUERYRBINFO
{
DWORD cbSize;
DWORDLONG i64Size;
DWORDLONG i64NumItems;
} SHQUERYRBINFO, *LPSHQUERYRBINFO;
HRESULT WINAPI SHEmptyRecycleBinA(HWND,LPCSTR,DWORD);
HRESULT WINAPI SHEmptyRecycleBinW(HWND,LPCWSTR,DWORD);
#define SHEmptyRecycleBin WINELIB_NAME_AW(SHEmptyRecycleBin)
HRESULT WINAPI SHQueryRecycleBinA(LPCSTR,LPSHQUERYRBINFO);
HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR,LPSHQUERYRBINFO);
#define SHQueryRecycleBin WINELIB_NAME_AW(SHQueryRecycleBin)
/****************************************** /******************************************
* Misc * Misc
*/ */

View File

@ -41,26 +41,34 @@ DWORD WINAPI SHCLSIDFromStringW(LPCWSTR,CLSID*);
#define SHCLSIDFromString WINELIB_NAME_AW(SHCLSIDFromString) #define SHCLSIDFromString WINELIB_NAME_AW(SHCLSIDFromString)
HRESULT WINAPI SHCreateStdEnumFmtEtc(DWORD,const FORMATETC *,IEnumFORMATETC**); HRESULT WINAPI SHCreateStdEnumFmtEtc(DWORD,const FORMATETC *,IEnumFORMATETC**);
BOOL WINAPI SHFindFiles(LPCITEMIDLIST,LPCITEMIDLIST); BOOL WINAPI SHFindFiles(LPCITEMIDLIST,LPCITEMIDLIST);
DWORD WINAPI SHFormatDrive(HWND,UINT,UINT,UINT);
void WINAPI SHFree(LPVOID); void WINAPI SHFree(LPVOID);
BOOL WINAPI GetFileNameFromBrowse(HWND,LPSTR,DWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR); BOOL WINAPI GetFileNameFromBrowse(HWND,LPSTR,DWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST,LPSTR); BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST,LPSTR);
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST,LPWSTR); BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST,LPWSTR);
#define SHGetPathFromIDList WINELIB_NAME_AW(SHGetPathFromIDList) #define SHGetPathFromIDList WINELIB_NAME_AW(SHGetPathFromIDList)
INT WINAPI SHHandleUpdateImage(LPCITEMIDLIST);
HRESULT WINAPI SHILCreateFromPath(LPCWSTR,LPITEMIDLIST*,DWORD*); HRESULT WINAPI SHILCreateFromPath(LPCWSTR,LPITEMIDLIST*,DWORD*);
HRESULT WINAPI SHLoadOLE(LPARAM); HRESULT WINAPI SHLoadOLE(LPARAM);
LPITEMIDLIST WINAPI SHSimpleIDListFromPath(LPCWSTR); LPITEMIDLIST WINAPI SHSimpleIDListFromPath(LPCWSTR);
int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder*,LPCITEMIDLIST,int*); int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder*,LPCITEMIDLIST,int*);
HRESULT WINAPI SHStartNetConnectionDialog(HWND,LPCSTR,DWORD);
VOID WINAPI SHUpdateImageA(LPCSTR,INT,UINT,INT);
VOID WINAPI SHUpdateImageW(LPCWSTR,INT,UINT,INT);
#define SHUpdateImage WINELIB_NAME_AW(SHUpdateImage)
int WINAPI RestartDialog(HWND,LPCWSTR,DWORD); int WINAPI RestartDialog(HWND,LPCWSTR,DWORD);
int WINAPI RestartDialogEx(HWND,LPCWSTR,DWORD,DWORD); int WINAPI RestartDialogEx(HWND,LPCWSTR,DWORD,DWORD);
#define SHFMT_ERROR 0xFFFFFFFFL /* Error on last format, drive may be formatable */
#define SHFMT_CANCEL 0xFFFFFFFEL /* Last format was canceled */
#define SHFMT_NOFORMAT 0xFFFFFFFDL /* Drive is not formatable */
/* SHObjectProperties flags */ /* SHObjectProperties flags */
#define SHOP_PRINTERNAME 0x01 #define SHOP_PRINTERNAME 0x01
#define SHOP_FILEPATH 0x02 #define SHOP_FILEPATH 0x02
#define SHOP_VOLUMEGUID 0x04 #define SHOP_VOLUMEGUID 0x04
BOOL WINAPI SHObjectProperties(HWND,UINT,LPCWSTR,LPCWSTR); BOOL WINAPI SHObjectProperties(HWND,DWORD,LPCWSTR,LPCWSTR);
#define PCS_FATAL 0x80000000 #define PCS_FATAL 0x80000000
#define PCS_REPLACEDCHAR 0x00000001 #define PCS_REPLACEDCHAR 0x00000001