Stub implementations for SHUpdateImageA, SHHandleUpdateImage,
authorHans Leidekker <hans@it.vu.nl>
Mon, 3 Jan 2005 20:26:06 +0000 (20:26 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 3 Jan 2005 20:26:06 +0000 (20:26 +0000)
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.

dlls/shell32/iconcache.c
dlls/shell32/shell32.spec
dlls/shell32/shellord.c
include/shellapi.h
include/shlobj.h

index 410cc86220f10ec812fea023fd1ab7eb52a667ad..af4b2f519a90e0a0432b12b05a61a3a61f2f3750 100644 (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 ret;
+    UINT ret = 0;
     INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
     LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
 
     TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
 
-    MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
-    ret = ExtractIconExW (lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
-    HeapFree(GetProcessHeap(), 0, lpwstrFile);
+    if (lpwstrFile)
+    {
+        MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
+        ret = ExtractIconExW(lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
+        HeapFree(GetProcessHeap(), 0, lpwstrFile);
+    }
     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 hIcon;
-       WORD wDummyIcon = 0;
-       
-       TRACE("\n");
-
-       if(lpiIcon == NULL)
-           lpiIcon = &wDummyIcon;
-
-       hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
-
-       if( hIcon < (HICON)2 )
-       { if( hIcon == (HICON)1 ) /* no icons found in given file */
-         { char  tempPath[0x80];
-           HINSTANCE uRet = FindExecutableA(lpIconPath,NULL,tempPath);
-
-           if( uRet > (HINSTANCE)32 && tempPath[0] )
-           { strcpy(lpIconPath,tempPath);
-             hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
-             if( hIcon > (HICON)2 )
-               return hIcon;
-           }
-           else hIcon = 0;
-         }
+    HICON hIcon = NULL;
+    INT len = MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, NULL, 0);
+    LPWSTR lpIconPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+
+    TRACE("%p %s %p\n", hInst, debugstr_a(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)1 )
-           *lpiIcon = 2;   /* MSDOS icon - we found .exe but no icons in it */
-         else
-           *lpiIcon = 6;   /* generic icon - found nothing */
-
-         if (GetModuleFileNameA(hInst, lpIconPath, 0x80))
-          {
-              /* terminate string (GetModuleFileName doesn't do if buffer is too small) */
-              lpIconPath[0x80 - 1] = '\0';
-              hIcon = LoadIconA( hInst, MAKEINTRESOURCEA(*lpiIcon));
-          }
-       }
-       return hIcon;
+HICON WINAPI ExtractAssociatedIconW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIcon)
+{
+    HICON hIcon = NULL;
+    WORD wDummyIcon = 0;
+
+    TRACE("%p %s %p\n", hInst, debugstr_w(lpIconPath), lpiIcon);
+
+    if(lpiIcon == NULL)
+        lpiIcon = &wDummyIcon;
+
+    hIcon = ExtractIconW(hInst, lpIconPath, *lpiIcon);
+
+    if( hIcon < (HICON)2 )
+    { if( hIcon == (HICON)1 ) /* no icons found in given file */
+      { WCHAR tempPath[MAX_PATH];
+        HINSTANCE uRet = FindExecutableW(lpIconPath,NULL,tempPath);
+
+        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;
 }
 
 /*************************************************************************
index 894924c976f4290f9afabc95c74cbe5d111a070f..17e70984602e35fe822cb773c4e7602919babaa2 100644 (file)
  175 stdcall SHGetSpecialFolderPath(long long long long) SHGetSpecialFolderPathAW
  176 stdcall SHSetInstanceExplorer (long)
  177 stub DAD_SetDragImageFromListView
- 178 stub SHObjectProperties
- 179 stub SHGetNewLinkInfoA
- 180 stub SHGetNewLinkInfoW
+ 178 stdcall SHObjectProperties(long long wstr wstr)
+ 179 stdcall SHGetNewLinkInfoA(str str ptr long long)
+ 180 stdcall SHGetNewLinkInfoW(wstr wstr ptr long long)
  181 stdcall RegisterShellHook(long long)
  182 varargs ShellMessageBoxW(long long long str long)
  183 varargs ShellMessageBoxA(long long long str long)
  188 stdcall ShellDDEInit(long)
  189 stdcall ILCreateFromPathA(str)
  190 stdcall ILCreateFromPathW(wstr)
- 191 stub SHUpdateImageA
+ 191 stdcall SHUpdateImageA(str long long long)
  192 stdcall SHUpdateImageW(wstr long long long)
- 193 stub SHHandleUpdateImage
+ 193 stdcall SHHandleUpdateImage(ptr)
  194 stub SHCreatePropSheetExtArrayEx
  195 stdcall SHFree(ptr)
  196 stdcall SHAlloc(long)
  212 stub Printers_AddPrinterPropPages
  213 stub Printers_RegisterWindowW
  214 stub Printers_UnregisterWindow
- 215 stub SHStartNetConnectionDialog
+ 215 stdcall SHStartNetConnectionDialog(long str long)
  243 stdcall @(long long) shell32_243
  244 stdcall SHInitRestricted(ptr ptr)
  247 stdcall SHGetDataFromIDListA (ptr ptr long ptr long)
  296 stdcall Shell_NotifyIcon(long ptr) Shell_NotifyIconA
  297 stdcall Shell_NotifyIconA(long ptr)
  298 stdcall Shell_NotifyIconW(long ptr)
- 299 stub Shl1632_ThunkData32
- 300 stub Shl3216_ThunkData32
+#299 stub Shl1632_ThunkData32
+#300 stub Shl3216_ThunkData32
  301 stdcall StrChrA(str long) shlwapi.StrChrA
  302 stdcall StrChrIA(str long) shlwapi.StrChrIA
  303 stdcall StrChrIW(wstr long) shlwapi.StrChrIW
 @ stdcall DoEnvironmentSubstW(wstr wstr)
 @ stub DragQueryFileAorW
 @ stdcall DuplicateIcon(long long)
-@ stdcall ExtractAssociatedIconA(long ptr long)
+@ stdcall ExtractAssociatedIconA(long str ptr)
 @ stdcall ExtractAssociatedIconExA(long str long long)
 @ stdcall ExtractAssociatedIconExW(long wstr long long)
-@ stub ExtractAssociatedIconW
+@ stdcall ExtractAssociatedIconW(long wstr ptr)
 @ stdcall ExtractIconA(long str long)
 @ stdcall ExtractIconEx(ptr long ptr ptr long) ExtractIconExA
 @ stdcall ExtractIconExA(str long ptr ptr long)
 @ stdcall SHCreateDirectoryExA(long str ptr)
 @ stdcall SHCreateDirectoryExW(long wstr ptr)
 @ stub ShellHookProc
-@ stub SHEmptyRecycleBinA
-@ stub SHEmptyRecycleBinW
+@ stdcall SHEmptyRecycleBinA(long str long)
+@ stdcall SHEmptyRecycleBinW(long wstr long)
 @ stdcall SHFileOperation(ptr) SHFileOperationA
 @ stdcall SHFileOperationA(ptr)
 @ stdcall SHFileOperationW(ptr)
-@ stub SHFormatDrive
+@ stdcall SHFormatDrive(long long long long)
 @ stdcall SHFreeNameMappings(ptr)
 @ stdcall SHGetDesktopFolder(ptr)
 @ stdcall SHGetFileInfo(ptr long ptr long long) SHGetFileInfoA
 @ stdcall SHGetFileInfoW(ptr long ptr long long)
 @ stdcall SHGetInstanceExplorer(long)
 @ stdcall SHGetMalloc(ptr)
-@ stub SHGetNewLinkInfo
+@ stdcall SHGetNewLinkInfo(str str ptr long long) SHGetNewLinkInfoA
 @ stdcall SHGetPathFromIDList(ptr ptr) SHGetPathFromIDListA
 @ stdcall SHGetPathFromIDListA(ptr ptr)
 @ stdcall SHGetPathFromIDListW(ptr ptr)
 @ stub SHHelpShortcuts_RunDLLA
 @ stub SHHelpShortcuts_RunDLLW
 @ stdcall SHLoadInProc(long)
-@ stub SHQueryRecycleBinA
-@ stub SHQueryRecycleBinW
+@ stdcall SHQueryRecycleBinA(str ptr)
+@ stdcall SHQueryRecycleBinW(wstr ptr)
 @ stub SHUpdateRecycleBinIcon
 @ stub WOWShellExecute
 
index 13f3d7ac540087b11d4df859011165386ad4d250..ad6261e510f40e800e9f733a28a22f905245d2d8 100644 (file)
@@ -1546,5 +1546,90 @@ BOOL WINAPI SHFindFiles( LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile )
  */
 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;
 }
index e5d4ecc8f6b184877c96e1bad9308884d7faf683..50960baf5135bed213a2b6869fccc7abb9f40b60 100644 (file)
@@ -399,6 +399,24 @@ BOOL WINAPI SHGetNewLinkInfoA(LPCSTR,LPCSTR,LPSTR,BOOL*,UINT);
 BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR,LPCWSTR,LPWSTR,BOOL*,UINT);
 #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
  */
index 839f8bfd2bb56b32d5a684ee600d9e98f47b1ed3..259e66cff6ad91169f8d9893226251ec34270877 100644 (file)
@@ -41,26 +41,34 @@ DWORD        WINAPI SHCLSIDFromStringW(LPCWSTR,CLSID*);
 #define             SHCLSIDFromString WINELIB_NAME_AW(SHCLSIDFromString)
 HRESULT      WINAPI SHCreateStdEnumFmtEtc(DWORD,const FORMATETC *,IEnumFORMATETC**);
 BOOL         WINAPI SHFindFiles(LPCITEMIDLIST,LPCITEMIDLIST);
+DWORD        WINAPI SHFormatDrive(HWND,UINT,UINT,UINT);
 void         WINAPI SHFree(LPVOID);
 BOOL         WINAPI GetFileNameFromBrowse(HWND,LPSTR,DWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR);
 BOOL         WINAPI SHGetPathFromIDListA(LPCITEMIDLIST,LPSTR);
 BOOL         WINAPI SHGetPathFromIDListW(LPCITEMIDLIST,LPWSTR);
 #define             SHGetPathFromIDList WINELIB_NAME_AW(SHGetPathFromIDList)
+INT          WINAPI SHHandleUpdateImage(LPCITEMIDLIST);
 HRESULT      WINAPI SHILCreateFromPath(LPCWSTR,LPITEMIDLIST*,DWORD*);
 HRESULT      WINAPI SHLoadOLE(LPARAM);
 LPITEMIDLIST WINAPI SHSimpleIDListFromPath(LPCWSTR);
 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 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 */
 #define SHOP_PRINTERNAME 0x01
 #define SHOP_FILEPATH    0x02
 #define SHOP_VOLUMEGUID  0x04
 
-BOOL WINAPI SHObjectProperties(HWND,UINT,LPCWSTR,LPCWSTR);
+BOOL WINAPI SHObjectProperties(HWND,DWORD,LPCWSTR,LPCWSTR);
 
 #define PCS_FATAL           0x80000000
 #define PCS_REPLACEDCHAR    0x00000001