[SHELL32]

* Move shell32_main.cpp to the wine folder.
* Rename shell32_main.cpp to shell32_main.c.
* Partially sync shell32_main.c with Wine 1.7.27.
* Update the location of shell32_main.h in inclusions.
CORE-8540

svn path=/branches/shell-experiments/; revision=65217
This commit is contained in:
Amine Khaldi 2014-11-03 12:17:30 +00:00
parent 8b3a691a5b
commit ebaefd4cf3
5 changed files with 101 additions and 77 deletions

View file

@ -42,7 +42,6 @@ list(APPEND SOURCE
iconcache.cpp iconcache.cpp
pidl.cpp pidl.cpp
shell32.cpp shell32.cpp
shell32_main.cpp
shellitem.cpp shellitem.cpp
shelllink.cpp shelllink.cpp
shellord.cpp shellord.cpp
@ -76,6 +75,7 @@ list(APPEND SOURCE
add_library(shell32 SHARED add_library(shell32 SHARED
${SOURCE} ${SOURCE}
wine/shell32_main.c
wine/shellole.c wine/shellole.c
wine/shellstring.c wine/shellstring.c
vista.c vista.c

View file

@ -37,7 +37,7 @@
#include "pidl.h" #include "pidl.h"
#include "debughlp.h" #include "debughlp.h"
#include "undocshell.h" #include "undocshell.h"
#include "shell32_main.h" #include "wine/shell32_main.h"
#include "shresdef.h" #include "shresdef.h"
#include "cpanel.h" #include "cpanel.h"
#include "enumidlist.h" #include "enumidlist.h"

View file

@ -19,7 +19,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "precomp.h" #include <wine/config.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COBJMACROS
#include <windef.h>
#include <winbase.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#include "undocshell.h"
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
#include <wine/debug.h>
#include <wine/unicode.h>
#include <reactos/version.h> #include <reactos/version.h>
@ -27,7 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
const char * const SHELL_Authors[] = { "Copyright 1993-"COPYRIGHT_YEAR" WINE team", "Copyright 1998-"COPYRIGHT_YEAR" ReactOS Team", 0 }; const char * const SHELL_Authors[] = { "Copyright 1993-"COPYRIGHT_YEAR" WINE team", "Copyright 1998-"COPYRIGHT_YEAR" ReactOS Team", 0 };
#define MORE_DEBUG 1
/************************************************************************* /*************************************************************************
* CommandLineToArgvW [SHELL32.@] * CommandLineToArgvW [SHELL32.@]
* *
@ -75,11 +92,11 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
/* Return the path to the executable */ /* Return the path to the executable */
DWORD len, deslen=MAX_PATH, size; DWORD len, deslen=MAX_PATH, size;
size = sizeof(LPWSTR) + deslen*sizeof(WCHAR) + sizeof(LPWSTR); size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR);
for (;;) for (;;)
{ {
if (!(argv = (LPWSTR *)LocalAlloc(LMEM_FIXED, size))) return NULL; if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL;
len = GetModuleFileNameW(0, (LPWSTR)(argv+1), deslen); len = GetModuleFileNameW(0, (LPWSTR)(argv+2), deslen);
if (!len) if (!len)
{ {
LocalFree(argv); LocalFree(argv);
@ -87,10 +104,11 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
} }
if (len < deslen) break; if (len < deslen) break;
deslen*=2; deslen*=2;
size = sizeof(LPWSTR) + deslen*sizeof(WCHAR) + sizeof(LPWSTR); size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR);
LocalFree( argv ); LocalFree( argv );
} }
argv[0]=(LPWSTR)(argv+1); argv[0]=(LPWSTR)(argv+2);
argv[1]=NULL;
*numargs=1; *numargs=1;
return argv; return argv;
@ -168,10 +186,10 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
* with it. This way the caller can make a single LocalFree() call to free * with it. This way the caller can make a single LocalFree() call to free
* both, as per MSDN. * both, as per MSDN.
*/ */
argv=(LPWSTR *)LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR)); argv=LocalAlloc(LMEM_FIXED, (argc+1)*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
if (!argv) if (!argv)
return NULL; return NULL;
cmdline=(LPWSTR)(argv+argc); cmdline=(LPWSTR)(argv+argc+1);
strcpyW(cmdline, lpCmdline); strcpyW(cmdline, lpCmdline);
/* --- Then split and copy the arguments */ /* --- Then split and copy the arguments */
@ -209,6 +227,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
if (!*s) if (!*s)
{ {
/* There are no parameters so we are all done */ /* There are no parameters so we are all done */
argv[argc]=NULL;
*numargs=argc; *numargs=argc;
return argv; return argv;
} }
@ -280,6 +299,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
} }
} }
*d='\0'; *d='\0';
argv[argc]=NULL;
*numargs=argc; *numargs=argc;
return argv; return argv;
@ -319,20 +339,17 @@ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ); SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
ReadFile( hfile, magic, sizeof(magic), &len, NULL ); ReadFile( hfile, magic, sizeof(magic), &len, NULL );
if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE ) if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
{ {
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ); SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
ReadFile( hfile, &nt, sizeof(nt), &len, NULL ); ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
CloseHandle( hfile ); CloseHandle( hfile );
/* DLL files are not executable and should return 0 */ /* DLL files are not executable and should return 0 */
if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL) if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL)
return 0; return 0;
if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
{ {
return IMAGE_NT_SIGNATURE | return IMAGE_NT_SIGNATURE |
(nt.OptionalHeader.MajorSubsystemVersion << 24) | (nt.OptionalHeader.MajorSubsystemVersion << 24) |
(nt.OptionalHeader.MinorSubsystemVersion << 16); (nt.OptionalHeader.MinorSubsystemVersion << 16);
} }
@ -344,7 +361,6 @@ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ); SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
ReadFile( hfile, &ne, sizeof(ne), &len, NULL ); ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
CloseHandle( hfile ); CloseHandle( hfile );
if (ne.ne_exetyp == 2) if (ne.ne_exetyp == 2)
return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16); return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
return 0; return 0;
@ -354,7 +370,7 @@ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
} }
/************************************************************************* /*************************************************************************
* SHELL_IsShortcut [internal] * SHELL_IsShortcut [internal]
* *
* Decide if an item id list points to a shell shortcut * Decide if an item id list points to a shell shortcut
*/ */
@ -397,8 +413,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
int iIndex; int iIndex;
DWORD_PTR ret = TRUE; DWORD_PTR ret = TRUE;
DWORD dwAttributes = 0; DWORD dwAttributes = 0;
CComPtr<IShellFolder> psfParent; IShellFolder * psfParent = NULL;
CComPtr<IExtractIconW> pei; IExtractIconW * pei = NULL;
LPITEMIDLIST pidlLast = NULL, pidl = NULL; LPITEMIDLIST pidlLast = NULL, pidl = NULL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
BOOL IconNotYetLoaded=TRUE; BOOL IconNotYetLoaded=TRUE;
@ -409,7 +425,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
psfi, psfi->dwAttributes, sizeofpsfi, flags); psfi, psfi->dwAttributes, sizeofpsfi, flags);
if (!path) if (!path)
return FALSE; return FALSE;
/* windows initializes these values regardless of the flags */ /* windows initializes these values regardless of the flags */
if (psfi != NULL) if (psfi != NULL)
@ -467,7 +483,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
/* get the parent shellfolder */ /* get the parent shellfolder */
if (pidl) if (pidl)
{ {
hr = SHBindToParent( pidl, IID_PPV_ARG(IShellFolder, &psfParent), hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
(LPCITEMIDLIST*)&pidlLast ); (LPCITEMIDLIST*)&pidlLast );
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
pidlLast = ILClone(pidlLast); pidlLast = ILClone(pidlLast);
@ -487,22 +503,22 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
{ {
psfi->dwAttributes = 0xffffffff; psfi->dwAttributes = 0xffffffff;
} }
if (psfParent != NULL) if (psfParent)
psfParent->GetAttributesOf(1, (LPCITEMIDLIST*)&pidlLast, IShellFolder_GetAttributesOf( psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
&(psfi->dwAttributes) ); &(psfi->dwAttributes) );
} }
/* get the displayname */ /* get the displayname */
if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME)) if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
{ {
if (flags & SHGFI_USEFILEATTRIBUTES) if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
{ {
wcscpy (psfi->szDisplayName, PathFindFileNameW(szFullPath)); lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
} }
else else
{ {
STRRET str; STRRET str;
hr = psfParent->GetDisplayNameOf(pidlLast, hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
SHGDN_INFOLDER, &str); SHGDN_INFOLDER, &str);
StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast); StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
} }
@ -514,7 +530,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
static const WCHAR szFile[] = { 'F','i','l','e',0 }; static const WCHAR szFile[] = { 'F','i','l','e',0 };
static const WCHAR szDashFile[] = { '-','f','i','l','e',0 }; static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
if (!(flags & SHGFI_USEFILEATTRIBUTES)) if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL))
{ {
char ftype[80]; char ftype[80];
@ -524,17 +540,17 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
else else
{ {
if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
wcscat (psfi->szTypeName, szFile); strcatW (psfi->szTypeName, szFile);
else else
{ {
WCHAR sTemp[64]; WCHAR sTemp[64];
wcscpy(sTemp,PathFindExtensionW(szFullPath)); lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) && if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE ))) HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
{ {
lstrcpynW (psfi->szTypeName, sTemp, 64); lstrcpynW (psfi->szTypeName, sTemp, 64);
wcscat (psfi->szTypeName, szDashFile); strcatW (psfi->szTypeName, szDashFile);
} }
} }
} }
@ -565,13 +581,13 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
/* get the iconlocation */ /* get the iconlocation */
if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION )) if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
{ {
UINT uFlags; UINT uDummy,uFlags;
if (flags & SHGFI_USEFILEATTRIBUTES) if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
{ {
if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
wcscpy(psfi->szDisplayName, swShell32Name); lstrcpyW(psfi->szDisplayName, swShell32Name);
psfi->iIcon = -IDI_SHELL_FOLDER; psfi->iIcon = -IDI_SHELL_FOLDER;
} }
else else
@ -587,11 +603,11 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon)) HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
{ {
if (lstrcmpW(p1W, sTemp)) if (lstrcmpW(p1W, sTemp))
wcscpy(psfi->szDisplayName, sTemp); strcpyW(psfi->szDisplayName, sTemp);
else else
{ {
/* the icon is in the file */ /* the icon is in the file */
wcscpy(psfi->szDisplayName, szFullPath); strcpyW(psfi->szDisplayName, szFullPath);
} }
} }
else else
@ -600,20 +616,22 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
} }
else else
{ {
hr = psfParent->GetUIObjectOf(0, 1, hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
(LPCITEMIDLIST*)&pidlLast, IID_NULL_PPV_ARG(IExtractIconW, &pei)); (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
&uDummy, (LPVOID*)&pei);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = pei->GetIconLocation(uGilFlags, hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
szLocation, MAX_PATH, &iIndex, &uFlags); szLocation, MAX_PATH, &iIndex, &uFlags);
if (uFlags & GIL_NOTFILENAME) if (uFlags & GIL_NOTFILENAME)
ret = FALSE; ret = FALSE;
else else
{ {
wcscpy (psfi->szDisplayName, szLocation); lstrcpyW (psfi->szDisplayName, szLocation);
psfi->iIcon = iIndex; psfi->iIcon = iIndex;
} }
IExtractIconW_Release(pei);
} }
} }
} }
@ -642,15 +660,15 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx)) HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
{ {
if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */ if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
wcscpy(sTemp, szFullPath); strcpyW(sTemp, szFullPath);
if (flags & SHGFI_SYSICONINDEX) if (flags & SHGFI_SYSICONINDEX)
{ {
psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0); psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
if (psfi->iIcon == -1) if (psfi->iIcon == -1)
psfi->iIcon = 0; psfi->iIcon = 0;
} }
else else
{ {
UINT ret; UINT ret;
if (flags & SHGFI_SMALLICON) if (flags & SHGFI_SMALLICON)
@ -663,8 +681,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
GetSystemMetrics( SM_CXICON), GetSystemMetrics( SM_CXICON),
GetSystemMetrics( SM_CYICON), GetSystemMetrics( SM_CYICON),
&psfi->hIcon, 0, 1, 0); &psfi->hIcon, 0, 1, 0);
if (ret != 0 && ret != (UINT)-1)
if (ret != 0 && ret != 0xFFFFFFFF)
{ {
IconNotYetLoaded=FALSE; IconNotYetLoaded=FALSE;
psfi->iIcon = icon_idx; psfi->iIcon = icon_idx;
@ -707,11 +724,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
SHFree(pidlLast); SHFree(pidlLast);
#ifdef MORE_DEBUG
TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n", TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret); debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
#endif
return ret; return ret;
} }
@ -731,7 +746,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
INT len; INT len;
LPWSTR temppath = NULL; LPWSTR temppath = NULL;
LPCWSTR pathW; LPCWSTR pathW;
DWORD ret; DWORD_PTR ret;
SHFILEINFOW temppsfi; SHFILEINFOW temppsfi;
if (flags & SHGFI_PIDL) if (flags & SHGFI_PIDL)
@ -742,7 +757,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
else else
{ {
len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
temppath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len); MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
pathW = temppath; pathW = temppath;
} }
@ -783,7 +798,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
/************************************************************************* /*************************************************************************
* DuplicateIcon [SHELL32.@] * DuplicateIcon [SHELL32.@]
*/ */
EXTERN_C HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon) HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
{ {
ICONINFO IconInfo; ICONINFO IconInfo;
HICON hDupIcon = 0; HICON hDupIcon = 0;
@ -806,10 +821,10 @@ EXTERN_C HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
* ExtractIconA [SHELL32.@] * ExtractIconA [SHELL32.@]
*/ */
HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex) HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
{ {
HICON ret; HICON ret;
INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0); INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
LPWSTR lpwstrFile = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex); TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
@ -831,17 +846,17 @@ HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex
TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex); TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
if (nIconIndex == 0xFFFFFFFF) if (nIconIndex == (UINT)-1)
{ {
ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR); ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
if (ret != 0xFFFFFFFF && ret) if (ret != (UINT)-1 && ret)
return (HICON)(UINT_PTR)ret; return (HICON)(UINT_PTR)ret;
return NULL; return NULL;
} }
else else
ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR); ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
if (ret == 0xFFFFFFFF) if (ret == (UINT)-1)
return (HICON)1; return (HICON)1;
else if (ret > 0 && hIcon) else if (ret > 0 && hIcon)
return hIcon; return hIcon;
@ -852,7 +867,7 @@ HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex
/************************************************************************* /*************************************************************************
* Printer_LoadIconsW [SHELL32.205] * Printer_LoadIconsW [SHELL32.205]
*/ */
EXTERN_C VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIcon, HICON * pSmallIcon) VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIcon, HICON * pSmallIcon)
{ {
INT iconindex=IDI_SHELL_PRINTERS_FOLDER; INT iconindex=IDI_SHELL_PRINTERS_FOLDER;
@ -870,12 +885,12 @@ EXTERN_C VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIco
} }
if(pLargeIcon != NULL) if(pLargeIcon != NULL)
*pLargeIcon = (HICON)LoadImageW(shell32_hInstance, *pLargeIcon = LoadImageW(shell32_hInstance,
(LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON, (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
0, 0, LR_DEFAULTCOLOR|LR_DEFAULTSIZE); 0, 0, LR_DEFAULTCOLOR|LR_DEFAULTSIZE);
if(pSmallIcon != NULL) if(pSmallIcon != NULL)
*pSmallIcon = (HICON)LoadImageW(shell32_hInstance, *pSmallIcon = LoadImageW(shell32_hInstance,
(LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON, (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
16, 16, LR_DEFAULTCOLOR); 16, 16, LR_DEFAULTCOLOR);
} }
@ -883,10 +898,10 @@ EXTERN_C VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIco
/************************************************************************* /*************************************************************************
* Printers_RegisterWindowW [SHELL32.213] * Printers_RegisterWindowW [SHELL32.213]
* used by "printui.dll": * used by "printui.dll":
* find the Window of the given Type for the specific Printer and * find the Window of the given Type for the specific Printer and
* return the already existent hwnd or open a new window * return the already existent hwnd or open a new window
*/ */
EXTERN_C BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType, BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType,
HANDLE * phClassPidl, HWND * phwnd) HANDLE * phClassPidl, HWND * phwnd)
{ {
FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType, FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
@ -894,12 +909,12 @@ EXTERN_C BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType,
phwnd, (phwnd != NULL) ? *(phwnd) : NULL); phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
return FALSE; return FALSE;
} }
/************************************************************************* /*************************************************************************
* Printers_UnregisterWindow [SHELL32.214] * Printers_UnregisterWindow [SHELL32.214]
*/ */
EXTERN_C VOID WINAPI Printers_UnregisterWindow(HANDLE hClassPidl, HWND hwnd) VOID WINAPI Printers_UnregisterWindow(HANDLE hClassPidl, HWND hwnd)
{ {
FIXME("(%p, %p) stub!\n", hClassPidl, hwnd); FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
} }
@ -983,7 +998,7 @@ UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
* SHHelpShortcuts_RunDLLA [SHELL32.@] * SHHelpShortcuts_RunDLLA [SHELL32.@]
* *
*/ */
EXTERN_C DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4) DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
{ {
FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4); FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
return 0; return 0;
@ -993,7 +1008,7 @@ EXTERN_C DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD
* SHHelpShortcuts_RunDLLA [SHELL32.@] * SHHelpShortcuts_RunDLLA [SHELL32.@]
* *
*/ */
EXTERN_C DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4) DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
{ {
FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4); FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
return 0; return 0;
@ -1004,13 +1019,13 @@ EXTERN_C DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD
* Create an instance of specified object class from within * Create an instance of specified object class from within
* the shell process and release it immediately * the shell process and release it immediately
*/ */
EXTERN_C HRESULT WINAPI SHLoadInProc (REFCLSID rclsid) HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
{ {
CComPtr<IUnknown> ptr; void *ptr = NULL;
TRACE("%s\n", debugstr_guid(&rclsid)); TRACE("%s\n", debugstr_guid(rclsid));
CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)&ptr); CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
if (ptr) if (ptr)
return S_OK; return S_OK;
return DISP_E_MEMBERNOTFOUND; return DISP_E_MEMBERNOTFOUND;
@ -1260,7 +1275,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
break; break;
} }
return FALSE; return 0;
} }
@ -1276,13 +1291,13 @@ BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIc
if (szApp) if (szApp)
{ {
len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
appW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len); MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
} }
if (szOtherStuff) if (szOtherStuff)
{ {
len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
otherW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len); MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
} }
@ -1328,7 +1343,7 @@ BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
/************************************************************************* /*************************************************************************
* FreeIconList (SHELL32.@) * FreeIconList (SHELL32.@)
*/ */
EXTERN_C void WINAPI FreeIconList( DWORD dw ) void WINAPI FreeIconList( DWORD dw )
{ {
FIXME("%x: stub\n",dw); FIXME("%x: stub\n",dw);
} }
@ -1336,7 +1351,7 @@ EXTERN_C void WINAPI FreeIconList( DWORD dw )
/************************************************************************* /*************************************************************************
* SHLoadNonloadedIconOverlayIdentifiers (SHELL32.@) * SHLoadNonloadedIconOverlayIdentifiers (SHELL32.@)
*/ */
EXTERN_C HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers(VOID) HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers( VOID )
{ {
FIXME("stub\n"); FIXME("stub\n");
return S_OK; return S_OK;

View file

@ -22,6 +22,10 @@
#ifndef __WINE_SHELL_MAIN_H #ifndef __WINE_SHELL_MAIN_H
#define __WINE_SHELL_MAIN_H #define __WINE_SHELL_MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/******************************************* /*******************************************
* global SHELL32.DLL variables * global SHELL32.DLL variables
*/ */
@ -179,7 +183,7 @@ extern const GUID CLSID_UnixFolder;
extern const GUID CLSID_UnixDosFolder; extern const GUID CLSID_UnixDosFolder;
/* Default shell folder value registration */ /* Default shell folder value registration */
EXTERN_C HRESULT SHELL_RegisterShellFolders(void); HRESULT SHELL_RegisterShellFolders(void);
/* Detect Shell Links */ /* Detect Shell Links */
BOOL SHELL_IsShortcut(LPCITEMIDLIST); BOOL SHELL_IsShortcut(LPCITEMIDLIST);
@ -193,7 +197,11 @@ BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, LPCITEM
BOOL SH_ShowFolderProperties(LPWSTR pwszFolder, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl); BOOL SH_ShowFolderProperties(LPWSTR pwszFolder, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl);
LPWSTR SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf); LPWSTR SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf);
EXTERN_C HRESULT WINAPI DoRegisterServer(void); HRESULT WINAPI DoRegisterServer(void);
EXTERN_C HRESULT WINAPI DoUnregisterServer(void); HRESULT WINAPI DoUnregisterServer(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WINE_SHELL_MAIN_H */ #endif /* __WINE_SHELL_MAIN_H */

View file

@ -36,11 +36,12 @@
#include <shlobj.h> #include <shlobj.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <debughlp.h> #include <debughlp.h>
#include <shell32_main.h>
#include <wine/debug.h> #include <wine/debug.h>
#include <wine/unicode.h> #include <wine/unicode.h>
#include "shell32_main.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
extern INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax); /* shlwapi.24 */ extern INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax); /* shlwapi.24 */