Commit e8d281d4 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

Changed some string-shell32 functions to 32AW, parameter are

os depending 32A or 32W (-winver nt351 or nt40), some new functions. Some fixes in ole2nls. New OLE2NLS_CheckLocale() to handle Locale_User_Default and Locale_System_Default. Shell32 now dynamicly links to DPA_*(), comdlg32 works again (comctl32 heap alloc patch broke it).
parent a29dab2e
......@@ -313,9 +313,11 @@ static HRESULT WINAPI IDataObject_GetData (LPDATAOBJECT this, LPFORMATETC32 pfor
{ return(E_UNEXPECTED);
}
pidl = this->lpill->lpvtbl->fnGetElement(this->lpill, 0);
pdump(this->pidl);
pdump(pidl);
/*hack*/
/*hack consider only the first item*/
cItems = 2;
size = sizeof(CIDA) + sizeof (UINT32)*(cItems-1);
size1 = ILGetSize (this->pidl);
......
......@@ -220,7 +220,7 @@ static BOOL32 WINAPI IEnumIDList_CreateEnumList(LPENUMIDLIST this, LPCSTR lpszPa
if (lpszPath && lpszPath[0]!='\0')
{ strcpy(szPath, lpszPath);
PathAddBackslash(szPath);
PathAddBackslash32A(szPath);
strcat(szPath,"*.*");
}
......
......@@ -22,6 +22,7 @@
#include "winnls.h"
#include "winproc.h"
#include "commctrl.h"
#include "winversion.h"
#include "shell32_main.h"
#include "pidl.h"
......@@ -313,17 +314,21 @@ DWORD WINAPI ILFree(LPVOID pidl)
* ILCreateFromPath [SHELL32.157]
*
*/
LPITEMIDLIST WINAPI ILCreateFromPath(LPSTR path)
LPITEMIDLIST WINAPI ILCreateFromPath(LPVOID path)
{ LPSHELLFOLDER shellfolder;
LPITEMIDLIST pidlnew;
CHAR pszTemp[MAX_PATH*2];
LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0];
WCHAR lpszDisplayName[MAX_PATH];
DWORD pchEaten;
TRACE(pidl,"(path=%s)\n",path);
LocalToWideChar32(lpszDisplayName, path, MAX_PATH);
if ( !VERSION_OsIsUnicode())
{ TRACE(pidl,"(path=%s)\n",(LPSTR)path);
LocalToWideChar32(lpszDisplayName, path, MAX_PATH);
}
else
{ TRACE(pidl,"(path=L%s)\n",debugstr_w(path));
lstrcpy32W(lpszDisplayName, path);
}
if (SHGetDesktopFolder(&shellfolder)==S_OK)
{ shellfolder->lpvtbl->fnParseDisplayName(shellfolder,0, NULL,lpszDisplayName,&pchEaten,&pidlnew,NULL);
shellfolder->lpvtbl->fnRelease(shellfolder);
......@@ -532,7 +537,7 @@ DWORD WINAPI _ILGetFolderText(LPCITEMIDLIST pidl,LPSTR lpszPath, DWORD dwSize)
}
pText = _ILGetTextPointer(pData->type,pData);
strcat(lpszPath, pText);
PathAddBackslash(lpszPath);
PathAddBackslash32A(lpszPath);
dwCopied += strlen(pText) + 1;
pidlTemp = ILGetNext(pidlTemp);
......@@ -873,7 +878,7 @@ static UINT32 WINAPI IDLList_GetState(LPIDLLIST this)
}
static LPITEMIDLIST WINAPI IDLList_GetElement(LPIDLLIST this, UINT32 nIndex)
{ TRACE (shell,"(%p)->(index=%u)\n",this, nIndex);
return((LPITEMIDLIST)DPA_GetPtr(this->dpa, nIndex));
return((LPITEMIDLIST)pDPA_GetPtr(this->dpa, nIndex));
}
static UINT32 WINAPI IDLList_GetCount(LPIDLLIST this)
{ TRACE (shell,"(%p)\n",this);
......@@ -882,7 +887,7 @@ static UINT32 WINAPI IDLList_GetCount(LPIDLLIST this)
static BOOL32 WINAPI IDLList_StoreItem(LPIDLLIST this, LPITEMIDLIST pidl)
{ TRACE (shell,"(%p)->(pidl=%p)\n",this, pidl);
if (pidl)
{ if (IDLList_InitList(this) && DPA_InsertPtr(this->dpa, 0x7fff, (LPSTR)pidl)>=0)
{ if (IDLList_InitList(this) && pDPA_InsertPtr(this->dpa, 0x7fff, (LPSTR)pidl)>=0)
return(TRUE);
ILFree(pidl);
}
......@@ -910,7 +915,7 @@ static BOOL32 WINAPI IDLList_InitList(LPIDLLIST this)
case State_UnInit:
default:
this->dpa = DPA_Create(this->uStep);
this->dpa = pDPA_Create(this->uStep);
this->uStep = 0;
return(IDLList_InitList(this));
}
......@@ -933,6 +938,6 @@ static void WINAPI IDLList_CleanList(LPIDLLIST this)
{ ILFree(IDLList_GetElement(this,i));
}
DPA_Destroy(this->dpa);
pDPA_Destroy(this->dpa);
this->dpa=NULL;
}
......@@ -483,6 +483,7 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
tFolder=FT_DESKTOP;
break;
case CSIDL_DESKTOPDIRECTORY:
case CSIDL_COMMON_DESKTOPDIRECTORY:
strcpy (buffer,"Desktop");
break;
case CSIDL_DRIVES:
......@@ -496,11 +497,17 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
case CSIDL_NETHOOD:
strcpy (buffer,"NetHood");
break;
case CSIDL_PRINTHOOD:
strcpy (buffer,"PrintHood");
break;
case CSIDL_NETWORK:
strcpy (buffer,"xxx"); /*virtual folder*/
TRACE (shell,"looking for Network\n");
tFolder=FT_UNKNOWN;
break;
case CSIDL_APPDATA:
strcpy (buffer,"Appdata");
break;
case CSIDL_PERSONAL:
strcpy (buffer,"Personal");
break;
......@@ -510,6 +517,7 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
case CSIDL_PRINTERS:
strcpy (buffer,"PrintHood");
break;
case CSIDL_COMMON_PROGRAMS:
case CSIDL_PROGRAMS:
strcpy (buffer,"Programs");
break;
......@@ -519,9 +527,11 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
case CSIDL_SENDTO:
strcpy (buffer,"SendTo");
break;
case CSIDL_COMMON_STARTMENU:
case CSIDL_STARTMENU:
strcpy (buffer,"Start Menu");
break;
case CSIDL_COMMON_STARTUP:
case CSIDL_STARTUP:
strcpy (buffer,"Startup");
break;
......@@ -529,7 +539,7 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
strcpy (buffer,"Templates");
break;
default:
ERR (shell,"unknown CSIDL\n");
ERR (shell,"unknown CSIDL 0x%08x\n", nFolder);
tFolder=FT_UNKNOWN;
break;
}
......@@ -544,9 +554,10 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
create it and the directory*/
if (RegQueryValueEx32A(key,buffer,NULL,&type,tpath,&tpathlen))
{ GetWindowsDirectory32A(npath,MAX_PATH);
PathAddBackslash(npath);
PathAddBackslash32A(npath);
switch (nFolder)
{ case CSIDL_DESKTOPDIRECTORY:
case CSIDL_COMMON_DESKTOPDIRECTORY:
strcat (npath,"Desktop");
break;
case CSIDL_FONTS:
......@@ -555,6 +566,12 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
case CSIDL_NETHOOD:
strcat (npath,"NetHood");
break;
case CSIDL_PRINTHOOD:
strcat (npath,"PrintHood");
break;
case CSIDL_APPDATA:
strcat (npath,"Appdata");
break;
case CSIDL_PERSONAL:
strcpy (npath,"C:\\Personal");
break;
......@@ -564,6 +581,7 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
case CSIDL_PRINTERS:
strcat (npath,"PrintHood");
break;
case CSIDL_COMMON_PROGRAMS:
case CSIDL_PROGRAMS:
strcat (npath,"Start Menu");
CreateDirectory32A(npath,NULL);
......@@ -575,9 +593,11 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE
case CSIDL_SENDTO:
strcat (npath,"SendTo");
break;
case CSIDL_COMMON_STARTMENU:
case CSIDL_STARTMENU:
strcat (npath,"Start Menu");
break;
case CSIDL_COMMON_STARTUP:
case CSIDL_STARTUP:
strcat (npath,"Start Menu");
CreateDirectory32A(npath,NULL);
......@@ -887,7 +907,7 @@ DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath)
strcpy (buffer,"Desktop"); /*registry name*/
if ( RegQueryValueEx32A(key,buffer,NULL,&type,tpath,&tpathlen))
{ GetWindowsDirectory32A(tpath,MAX_PATH);
PathAddBackslash(tpath);
PathAddBackslash32A(tpath);
strcat (tpath,"Desktop"); /*folder name*/
RegSetValueEx32A(key,buffer,0,REG_SZ,tpath,tpathlen);
CreateDirectory32A(tpath,NULL);
......@@ -927,6 +947,11 @@ INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
INT32(CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
HDPA (CALLBACK* pDPA_Create) (INT32);
INT32 (CALLBACK* pDPA_InsertPtr) (const HDPA, INT32, LPVOID);
BOOL32 (CALLBACK* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
LPVOID (CALLBACK* pDPA_GetPtr) (const HDPA, INT32);
BOOL32 (CALLBACK* pDPA_Destroy) (const HDPA);
/*************************************************************************
* SHELL32 LibMain
......@@ -950,7 +975,7 @@ BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRe
shell32_hInstance = hinstDLL;
GetWindowsDirectory32A(szShellPath,MAX_PATH);
PathAddBackslash(szShellPath);
PathAddBackslash32A(szShellPath);
strcat(szShellPath,"system\\shell32.dll");
if (fdwReason==DLL_PROCESS_ATTACH)
......@@ -964,6 +989,13 @@ BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRe
pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon");
pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon");
pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon");
/* imports by ordinal, pray that it works*/
pDPA_Create=GetProcAddress32(hComctl32, (LPCSTR)328L);
pDPA_Destroy=GetProcAddress32(hComctl32, (LPCSTR)329L);
pDPA_GetPtr=GetProcAddress32(hComctl32, (LPCSTR)332L);
pDPA_InsertPtr=GetProcAddress32(hComctl32, (LPCSTR)334L);
pDPA_Sort=GetProcAddress32(hComctl32, (LPCSTR)338L);
FreeLibrary32(hComctl32);
}
else
......
......@@ -21,7 +21,11 @@ extern INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
extern INT32(CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
extern HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
extern HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
extern HDPA (CALLBACK* pDPA_Create) (INT32);
extern INT32 (CALLBACK* pDPA_InsertPtr) (const HDPA, INT32, LPVOID);
extern BOOL32 (CALLBACK* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
extern LPVOID (CALLBACK* pDPA_GetPtr) (const HDPA, INT32);
extern BOOL32 (CALLBACK* pDPA_Destroy) (const HDPA);
/* FIXME should be moved to a header file. IsEqualGUID
is declared but not exported in compobj.c !!!*/
#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
......
......@@ -126,7 +126,7 @@ LPSHELLFOLDER IShellFolder_Constructor(LPSHELLFOLDER pParent,LPITEMIDLIST pidl)
{ *(sf->mlpszFolder)=0x00;
if(sf->mpSFParent->mlpszFolder) /* if the parent has a path, get it*/
{ strcpy(sf->mlpszFolder, sf->mpSFParent->mlpszFolder);
PathAddBackslash (sf->mlpszFolder);
PathAddBackslash32A (sf->mlpszFolder);
}
_ILGetFolderText(sf->mpidl, sf->mlpszFolder+strlen(sf->mlpszFolder), dwSize-strlen(sf->mlpszFolder));
TRACE(shell,"-- (%p)->(my path=%s)\n",sf, debugstr_a(sf->mlpszFolder));
......@@ -218,21 +218,23 @@ static HRESULT WINAPI IShellFolder_ParseDisplayName(
LPSHELLFOLDER this,
HWND32 hwndOwner,
LPBC pbcReserved,
LPOLESTR32 lpszDisplayName,
DWORD *pchEaten,
LPITEMIDLIST *ppidl,
LPOLESTR32 lpszDisplayName,
DWORD *pchEaten,
LPITEMIDLIST *ppidl,
DWORD *pdwAttributes)
{ HRESULT hr=E_OUTOFMEMORY;
LPITEMIDLIST pidlFull=NULL, pidlTemp = NULL, pidlOld = NULL;
LPSTR pszNext=NULL;
CHAR szElement[MAX_PATH];
BOOL32 bType;
DWORD dwChars=lstrlen32W(lpszDisplayName) + 1;
LPSTR pszTemp=(LPSTR)HeapAlloc(GetProcessHeap(),0,dwChars * sizeof(CHAR));
LPITEMIDLIST pidlFull=NULL, pidlTemp = NULL, pidlOld = NULL;
LPSTR pszTemp, pszNext=NULL;
CHAR szElement[MAX_PATH];
BOOL32 bType;
DWORD dwChars;
TRACE(shell,"(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
this,hwndOwner,pbcReserved,lpszDisplayName,debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
TRACE(shell,"(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
this,hwndOwner,pbcReserved,lpszDisplayName,
debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
dwChars=lstrlen32W(lpszDisplayName) + 1;
pszTemp=(LPSTR)HeapAlloc(GetProcessHeap(),0,dwChars);
if(pszTemp)
{ hr = E_FAIL;
......@@ -647,7 +649,7 @@ static HRESULT WINAPI IShellFolder_GetDisplayNameOf( LPSHELLFOLDER this, LPCITEM
strcat (szDrive,")");
}
else
{ PathAddBackslash (szTemp);
{ PathAddBackslash32A (szTemp);
strcpy(szDrive,szTemp);
}
}
......@@ -673,7 +675,7 @@ static HRESULT WINAPI IShellFolder_GetDisplayNameOf( LPSHELLFOLDER this, LPCITEM
if (this->mlpszFolder && strlen (this->mlpszFolder))
{ if (strcmp(this->mlpszFolder,"My Computer"))
{ strcpy (szText,this->mlpszFolder);
PathAddBackslash (szText);
PathAddBackslash32A (szText);
}
}
pidlTemp = ILFindLastID(pidl);
......@@ -704,7 +706,7 @@ static HRESULT WINAPI IShellFolder_GetDisplayNameOf( LPSHELLFOLDER this, LPCITEM
if(!(lpName))
{ return E_OUTOFMEMORY;
}
lpName->uType = STRRET_CSTR;
lpName->uType = STRRET_CSTRA;
strcpy(lpName->u.cStr,szText);
return S_OK;
}
......
......@@ -283,25 +283,25 @@ static HRESULT ShellView_FillList(LPSHELLVIEW this)
}
/* create a pointer array */
hdpa = DPA_Create(16);
hdpa = pDPA_Create(16);
if (!hdpa)
{ return(E_OUTOFMEMORY);
}
/* copy the items into the array*/
while((S_OK == pEnumIDList->lpvtbl->fnNext(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
{ if (DPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
{ if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
{ SHFree(pidl);
}
}
/*sort the array*/
DPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)this->pSFParent);
pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)this->pSFParent);
/*turn the listview's redrawing off*/
SendMessage32A(this->hWndList, WM_SETREDRAW, FALSE, 0);
for (i=0; i < DPA_GetPtrCount(hdpa); ++i)
for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/
{ pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i);
if (IncludeObject(this, pidl) == S_OK) /* in a commdlg this works as a filemask*/
{ ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/
......@@ -322,7 +322,7 @@ static HRESULT ShellView_FillList(LPSHELLVIEW this)
UpdateWindow32(this->hWndList);
pEnumIDList->lpvtbl->fnRelease(pEnumIDList); /* destroy the list*/
DPA_Destroy(hdpa);
pDPA_Destroy(hdpa);
return S_OK;
}
......@@ -727,26 +727,21 @@ LRESULT ShellView_OnSettingChange(LPSHELLVIEW this, LPCSTR lpszSection)
}
return 0;
}
/**************************************************************************
* ShellView_DoContextMenu()
* ShellView_GetSelections()
*
* RETURNS
* number of selected items
*/
void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault)
{ UINT32 uCommand, i;
DWORD wFlags;
HMENU32 hMenu;
BOOL32 fExplore = FALSE;
HWND32 hwndTree = 0;
INT32 nMenuIndex;
LVITEM32A lvItem;
MENUITEMINFO32A mii;
LPCONTEXTMENU pContextMenu = NULL;
CMINVOKECOMMANDINFO32 cmi;
TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",this, x, y, fDefault);
UINT32 ShellView_GetSelections(LPSHELLVIEW this)
{ LVITEM32A lvItem;
UINT32 i;
this->uSelected = ListView_GetSelectedCount(this->hWndList);
this->aSelectedItems = (LPITEMIDLIST*)SHAlloc(this->uSelected * sizeof(LPITEMIDLIST));
TRACE(shell,"selected=%i\n", this->uSelected);
if(this->aSelectedItems)
{ TRACE(shell,"-- Items selected =%u\n", this->uSelected);
ZeroMemory(&lvItem, sizeof(lvItem));
......@@ -764,8 +759,30 @@ void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault)
}
lvItem.iItem++;
}
}
return this->uSelected;
this->pSFParent->lpvtbl->fnGetUIObjectOf( this->pSFParent,
}
/**************************************************************************
* ShellView_DoContextMenu()
*/
void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault)
{ UINT32 uCommand;
DWORD wFlags;
HMENU32 hMenu;
BOOL32 fExplore = FALSE;
HWND32 hwndTree = 0;
INT32 nMenuIndex;
MENUITEMINFO32A mii;
LPCONTEXTMENU pContextMenu = NULL;
CMINVOKECOMMANDINFO32 cmi;
TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",this, x, y, fDefault);
this->uSelected = ListView_GetSelectedCount(this->hWndList);
this->aSelectedItems = (LPITEMIDLIST*)SHAlloc(this->uSelected * sizeof(LPITEMIDLIST));
if(ShellView_GetSelections(this))
{ this->pSFParent->lpvtbl->fnGetUIObjectOf( this->pSFParent,
this->hWndParent,
this->uSelected,
this->aSelectedItems,
......@@ -953,9 +970,12 @@ LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh)
{ WideCharToLocal32(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax);
SHFree(str.u.pOleStr);
}
if(STRRET_CSTR == str.uType)
else if(STRRET_CSTRA == str.uType)
{ strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax);
}
else
{ FIXME(shell,"type wrong\n");
}
}
}
......@@ -980,8 +1000,9 @@ LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh)
break;
case LVN_ITEMCHANGED:
WARN(shell,"-- LVN_ITEMCHANGED %p\n",this);
OnStateChange(this, CDBOSC_SELCHANGE);
TRACE(shell,"-- LVN_ITEMCHANGED %p\n",this);
ShellView_GetSelections(this);
OnStateChange(this, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
break;
case LVN_DELETEALLITEMS:
......@@ -1234,10 +1255,11 @@ static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW this,BOOL32 fE
*/
static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW this,LPMSG32 lpmsg)
{ FIXME(shell,"(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",this,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
/* switch (lpmsg->message)
{ case WM_RBUTTONDOWN:
return SendMessage32A ( lpmsg->hwnd, WM_NOTIFY, );
}*/
switch (lpmsg->message)
{ case WM_KEYDOWN: TRACE(shell,"-- key=0x04%x",lpmsg->wParam) ;
}
return S_FALSE;
}
static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW this,BOOL32 fEnable)
......@@ -1395,21 +1417,25 @@ static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW this, LPCITEMIDLIST pidl
return E_NOTIMPL;
}
static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW this, UINT32 uItem, REFIID riid, LPVOID *ppvOut)
{ LPDATAOBJECT pDataObject;
{ LPUNKNOWN pObj = NULL;
char xriid[50];
HRESULT hr;
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",this, uItem, xriid, ppvOut);
*ppvOut = NULL;
pDataObject = IDataObject_Constructor(this->hWndParent, this->pSFParent,this->aSelectedItems,this->uSelected);
if(!pDataObject)
return E_OUTOFMEMORY;
hr = pDataObject->lpvtbl->fnQueryInterface(pDataObject, riid, ppvOut);
pDataObject->lpvtbl->fnRelease(pDataObject);
if(IsEqualIID(riid, &IID_IContextMenu))
{ TRACE(shell,"-- (%p)->IID_IContextMenu not implemented\n",this);
return(E_NOTIMPL);
}
else if (IsEqualIID(riid, &IID_IDataObject))
{ pObj =(LPUNKNOWN)IDataObject_Constructor(this->hWndParent, this->pSFParent,this->aSelectedItems,this->uSelected);
}
TRACE(shell,"-- (%p)->(interface=%p)\n",this, ppvOut);
return hr;
if(!pObj)
return E_OUTOFMEMORY;
*ppvOut = pObj;
return S_OK;
}
......@@ -227,10 +227,28 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32, INT32, LPITEMIDLIST *);
/****************************************************************************
* string and path functions
*/
LPSTR WINAPI PathAddBackslash(LPSTR path);
LPSTR WINAPI PathCombine(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile);
LPSTR WINAPI PathAddBackslash32A(LPSTR path);
LPWSTR WINAPI PathAddBackslash32W(LPWSTR path);
#define PathAddBackslash WINELIB_NAME_AW(PathAddBackslash)
LPVOID WINAPI PathAddBackslash32AW(LPVOID path);
LPSTR WINAPI PathCombine32A(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile);
LPWSTR WINAPI PathCombine32W(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile);
#define PathCombine WINELIB_NAME_AW(PathCombine)
LPVOID WINAPI PathCombine32AW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile);
LPCSTR WINAPI PathFindExtension32A(LPCSTR path);
LPCWSTR WINAPI PathFindExtension32W(LPCWSTR path);
#define PathFindExtension WINELIB_NAME_AW(PathFindExtension)
LPCVOID WINAPI PathFindExtension32AW(LPCVOID path);
LPCSTR WINAPI PathGetExtension32A(LPCSTR path, DWORD y, DWORD x);
LPCWSTR WINAPI PathGetExtension32W(LPCWSTR path, DWORD y, DWORD x);
#define PathGetExtension WINELIB_NAME_AW(PathGetExtension)
LPCVOID WINAPI PathGetExtension32AW(LPCVOID path, DWORD y, DWORD x);
LPSTR WINAPI PathRemoveBlanks(LPSTR str);
LPSTR WINAPI PathFindFilename(LPSTR fn);
LPVOID WINAPI PathFindFilename(LPVOID fn);
/****************************************************************************
* other functions
*/
......@@ -261,6 +279,12 @@ DWORD WINAPI SHFree(LPVOID x);
#define CSIDL_NETHOOD 0x0013
#define CSIDL_FONTS 0x0014
#define CSIDL_TEMPLATES 0x0015
#define CSIDL_COMMON_STARTMENU 0x0016
#define CSIDL_COMMON_PROGRAMS 0X0017
#define CSIDL_COMMON_STARTUP 0x0018
#define CSIDL_COMMON_DESKTOPDIRECTORY 0x0019
#define CSIDL_APPDATA 0x001a
#define CSIDL_PRINTHOOD 0x001b
#endif /* __WINE_SHELL_H */
......@@ -108,16 +108,22 @@ DEFINE_SHLGUID(IID_IShellCopyHookW, 0x000214FCL, 0, 0);
/****************************************************************************
* STRRET
*/
#define STRRET_WSTR 0x0000
#define STRRET_OFFSET 0x0001
#define STRRET_CSTR 0x0002
#define STRRET_WSTR 0x0000
#define STRRET_OFFSETA 0x0001
#define STRRET_CSTRA 0x0002
#define STRRET_ASTR 0X0003
#define STRRET_OFFSETW 0X0004
#define STRRET_CSTRW 0X0005
typedef struct _STRRET
{ UINT32 uType; /* STRRET_xxx */
union
{ LPWSTR pOleStr; /* OLESTR that will be freed */
LPSTR pStr;
UINT32 uOffset; /* OffsetINT32o SHITEMID (ANSI) */
char cStr[MAX_PATH]; /* Buffer to fill in */
WCHAR cStrW[MAX_PATH];
}u;
} STRRET,*LPSTRRET;
......
......@@ -408,6 +408,9 @@ INT32 WINAPI lstrncmpi32W( LPCWSTR str1, LPCWSTR str2, INT32 n )
LPWSTR WINAPI lstrcpyAtoW( LPWSTR dst, LPCSTR src )
{
register LPWSTR p = dst;
TRACE(string,"%s\n",src);
while ((*p++ = (WCHAR)(unsigned char)*src++));
return dst;
}
......@@ -419,6 +422,9 @@ LPWSTR WINAPI lstrcpyAtoW( LPWSTR dst, LPCSTR src )
LPSTR WINAPI lstrcpyWtoA( LPSTR dst, LPCWSTR src )
{
register LPSTR p = dst;
TRACE(string,"L%s\n",debugstr_w(src));
while ((*p++ = (CHAR)*src++));
return dst;
}
......@@ -432,6 +438,9 @@ LPSTR WINAPI lstrcpyWtoA( LPSTR dst, LPCWSTR src )
LPWSTR WINAPI lstrcpynAtoW( LPWSTR dst, LPCSTR src, INT32 n )
{
LPWSTR p = dst;
TRACE(string,"%s %i\n",src, n);
while ((n-- > 1) && *src) *p++ = (WCHAR)(unsigned char)*src++;
if (n >= 0) *p = 0;
return dst;
......@@ -446,6 +455,9 @@ LPWSTR WINAPI lstrcpynAtoW( LPWSTR dst, LPCSTR src, INT32 n )
LPSTR WINAPI lstrcpynWtoA( LPSTR dst, LPCWSTR src, INT32 n )
{
LPSTR p = dst;
TRACE(string,"L%s %i\n",debugstr_w(src), n);
while ((n-- > 1) && *src) *p++ = (CHAR)*src++;
if (n >= 0) *p = 0;
return dst;
......@@ -631,7 +643,7 @@ INT32 WINAPI WideCharToLocal32(
LPWSTR pWide,
INT32 dwChars)
{ *pLocal = 0;
TRACE(string,"(%p, %s, %li)\n", pLocal, debugstr_w(pWide),dwChars);
TRACE(string,"(%p, %s, %i)\n", pLocal, debugstr_w(pWide),dwChars);
WideCharToMultiByte(CP_ACP,0,pWide,-1,pLocal,dwChars,NULL,NULL);
return strlen(pLocal);
}
......@@ -647,7 +659,7 @@ INT32 WINAPI LocalToWideChar32(
LPSTR pLocal,
INT32 dwChars)
{ *pWide = 0;
TRACE(string,"(%p, %s, %li)\n",pWide, pLocal, dwChars);
TRACE(string,"(%p, %s, %i)\n",pWide, pLocal, dwChars);
MultiByteToWideChar(CP_ACP,0,pLocal,-1,pWide,dwChars);
return lstrlen32W(pWide);
}
......@@ -362,7 +362,6 @@ LANGID WINAPI GetUserDefaultLangID()
{
/* caching result, if defined from environment, which should (?) not change during a WINE session */
static LANGID userLCID = 0;
if (Options.language) {
return Languages[Options.language].langid;
}
......@@ -2233,8 +2232,9 @@ INT32 WINAPI OLE_GetFormatA(LCID locale,
DWORD flags,
DWORD tflags,
LPSYSTEMTIME xtime,
LPCSTR _format,
LPSTR date, INT32 datelen)
LPCSTR _format, /*in*/
LPSTR date, /*out*/
INT32 datelen)
{
INT32 inpos, outpos;
int count, type, inquote, Overflow;
......@@ -2247,10 +2247,10 @@ INT32 WINAPI OLE_GetFormatA(LCID locale,
const char ** dgfmt = _dgfmt - 1;
/* report, for debugging */
TRACE(ole, "(0x%lx,0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:\'%s\' (at %p), %p (%s), len=%d)\n",
TRACE(ole, "(0x%lx,0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt=%p \'%s\' , %p, len=%d)\n",
locale, flags, tflags,
xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
format, format, date, date, datelen);
_format, _format, date, datelen);
/* initalize state variables and output buffer */
inpos = outpos = 0;
......@@ -2443,21 +2443,19 @@ INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
INT32 inpos, outpos;
int count, type=0, inquote;
int Overflow; /* loop check */
int usedate, usetime;
WCHAR buf[40];
int buflen=0;
char abuf[40];
WCHAR arg0[] = {0}, arg1[] = {'%','d',0};
WCHAR arg2[] = {'%','0','2','d',0};
WCHAR *argarr[] = {arg0, arg1, arg2};
int datevars=0, timevars=0;
/* make a debug report */
lstrcpynWtoA(abuf, format, sizeof(format));
TRACE(ole, "args: 0x%lx, 0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:\'%s\' (at %p), %p with max len %d\n",
TRACE(ole, "args: 0x%lx, 0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:%s (at %p),
%p with max len %d\n",
locale, flags, tflags,
xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
abuf, format, output, outlen);
debugstr_w(format), format, output, outlen);
/* initialize state variables */
......@@ -2466,10 +2464,6 @@ INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
inquote = Overflow = 0;
/* this is really just a sanity check */
output[0] = buf[0] = 0;
abuf[0] = '\0';
/* for compatibility with official Windows behavior */
usedate = flags & DATE_DATEVARSONLY;
usetime = flags & TIME_TIMEVARSONLY;
/* this loop is the core of the function */
for (inpos = 0; /* we have several break points */ ; inpos++) {
......@@ -2631,8 +2625,7 @@ INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
if (outpos > outlen-1) outpos = outlen-1;
output[outpos] = '0';
lstrcpynWtoA(abuf, output, sizeof(abuf) );
TRACE(ole, " returning string \'%s\'\n", abuf);
TRACE(ole, " returning %s\n", debugstr_w(output));
return (!Overflow) ? outlen : 0;
......@@ -2671,7 +2664,6 @@ INT32 WINAPI GetDateFormat32A(LCID locale,DWORD flags,
SYSTEMTIME t;
LPSYSTEMTIME thistime;
LCID thislocale;
INT32 ret;
TRACE(ole,"(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",
......@@ -2847,9 +2839,25 @@ INT32 WINAPI GetNumberFormat32A(LCID locale, DWORD dwflags,
}
return n;
}
/******************************************************************************
* OLE2NLS_CheckLocale [intern]
*/
static LCID OLE2NLS_CheckLocale (LCID locale)
{
if (!locale)
{ locale = LOCALE_SYSTEM_DEFAULT;
}
if (locale == LOCALE_SYSTEM_DEFAULT)
{ return GetSystemDefaultLCID();
}
else if (locale == LOCALE_USER_DEFAULT)
{ return GetUserDefaultLCID();
}
else
{ return locale;
}
}
/******************************************************************************
* GetTimeFormat32A [KERNEL32.422]
* Makes an ASCII string of the time
......@@ -2881,27 +2889,17 @@ GetTimeFormat32A(LCID locale, /* in */
SYSTEMTIME t;
LPSYSTEMTIME thistime;
LCID thislocale=0;
DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */;
DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
INT32 ret;
TRACE(ole,"GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,xtime,format,timestr,timelen);
if (!locale)
{ locale = LOCALE_SYSTEM_DEFAULT;
}
if (locale == LOCALE_SYSTEM_DEFAULT)
{ thislocale = GetSystemDefaultLCID();
}
else if (locale == LOCALE_USER_DEFAULT)
{ thislocale = GetUserDefaultLCID();
}
else
{ thislocale = locale;
}
thislocale = OLE2NLS_CheckLocale ( locale );
if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT ))
{ FIXME(ole,"TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n");
}
flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/
if (format == NULL)
......@@ -2922,7 +2920,10 @@ GetTimeFormat32A(LCID locale, /* in */
else
{ thistime = xtime;
}
return OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat, timestr, timelen);
ret = OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat,
timestr, timelen);
SetLastError(ret);
return ret;
}
......@@ -2931,67 +2932,52 @@ GetTimeFormat32A(LCID locale, /* in */
* Makes a Unicode string of the time
*/
INT32 WINAPI
GetTimeFormat32W(LCID locale,DWORD flags,
LPSYSTEMTIME xtime,
LPCWSTR format,
LPWSTR timestr,INT32 timelen)
{
char debugbuf[40];
WCHAR buf[20];
LPCWSTR realformat=0;
SYSTEMTIME t;
LPSYSTEMTIME realtime;
WCHAR * fmt_buf = NULL;
int fmt_buf_size = 0; /* units of WCHARs */
INT32 retval;
lstrcpynWtoA(debugbuf, format, (sizeof(buf))/2);
TRACE(ole, "GetTimeFormatW len %d flags 0x%lX format >%s<\n",
timelen, flags, debugbuf);
/* Enforce the Windows behavior */
flags |= ~LOCALE_TIMEDATEBOTH;
flags |= TIME_TIMEVARSONLY;
/* take care of the format or locale not being given */
if (format) {
realformat = format;
} else if (locale) {
/* allocate memory */
retval = ERROR_INSUFFICIENT_BUFFER;
fmt_buf = malloc((fmt_buf_size+=7) * sizeof(WCHAR));
if (!fmt_buf)
goto out_nomem;
while(!GetLocaleInfo32W(locale, LOCALE_STIMEFORMAT,
fmt_buf, fmt_buf_size)) {
retval = ERROR_OUTOFMEMORY;
fmt_buf = realloc(fmt_buf,
(fmt_buf_size += 10) * sizeof(WCHAR));
if (!fmt_buf)
goto out_nomem;
}
realformat = fmt_buf;
} else {
FIXME(ole, "caller gave no locale, no format; what should we do?\n");
SetLastError(ERROR_BAD_FORMAT);
}
if (!locale)
locale = GetSystemDefaultLCID();
GetTimeFormat32W(LCID locale, /* in */
DWORD flags, /* in */
LPSYSTEMTIME xtime, /* in */
LPCWSTR format, /* in */
LPWSTR timestr, /* out */
INT32 timelen /* in */)
{ WCHAR format_buf[40];
LPCWSTR thisformat;
SYSTEMTIME t;
LPSYSTEMTIME thistime;
LCID thislocale=0;
DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
INT32 ret;
TRACE(ole,"GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,
xtime,debugstr_w(format),timestr,timelen);
realtime = xtime;
if (!realtime) {
realtime = &t;
GetSystemTime(realtime);
}
thislocale = OLE2NLS_CheckLocale ( locale );
if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT ))
{ FIXME(ole,"TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n");
}
flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/
retval = OLE_GetFormatW(locale, flags, 0, realtime, realformat, timestr, timelen);
if (fmt_buf)
free(fmt_buf);
return retval;
if (format == NULL)
{ if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/
{ thislocale = GetSystemDefaultLCID();
}
GetLocaleInfo32W(thislocale, thisflags, format_buf, 40);
thisformat = format_buf;
}
else
{ thisformat = format;
}
if (xtime == NULL) /* NULL means use the current local time*/
{ GetSystemTime(&t);
thistime = &t;
}
else
{ thistime = xtime;
}
out_nomem:
SetLastError(retval);
WARN(ole, "could not allocate %d chars of memory\n", fmt_buf_size);
return 0;
ret = OLE_GetFormatW(thislocale, thisflags, flags, thistime, thisformat,
timestr, timelen);
SetLastError(ret);
return ret;
}
......@@ -34,15 +34,15 @@ init Shell32LibMain
26 stub ILLoadFromStream@8
27 stub ILSaveToStream@8
28 stub SHILCreateFromPath@12
29 stdcall PathIsRoot(str) PathIsRoot
29 stdcall PathIsRoot(str) PathIsRoot32AW
30 stdcall PathBuildRoot(ptr long) PathBuildRoot
31 stdcall PathFindExtension(str) PathFindExtension
32 stdcall PathAddBackslash(str) PathAddBackslash
31 stdcall PathFindExtension(str) PathFindExtension32AW
32 stdcall PathAddBackslash(str) PathAddBackslash32AW
33 stdcall PathRemoveBlanks(str) PathRemoveBlanks
34 stdcall PathFindFilename(str) PathFindFilename
35 stdcall PathRemoveFileSpec(str) PathRemoveFileSpec
36 stdcall PathAppend(str str) PathAppend
37 stdcall PathCombine(ptr str str) PathCombine
37 stdcall PathCombine(ptr str str) PathCombine32AW
38 stub PathStripPath
39 stdcall PathIsUNC(str) PathIsUNC
40 stub PathIsRelative
......@@ -163,7 +163,7 @@ init Shell32LibMain
155 stdcall ILFree(ptr) ILFree
156 stub ILGlobalFree
157 stdcall ILCreateFromPath (ptr) ILCreateFromPath
158 stdcall PathGetExtension(str long long) PathGetExtension
158 stdcall PathGetExtension(str long long) PathGetExtension32AW
159 stub PathIsDirectory
160 stub SHNetConnectionDialog
161 stdcall SHRunControlPanel (long long) SHRunControlPanel
......@@ -285,9 +285,9 @@ init Shell32LibMain
276 stub SheFullPathA
277 stub SheFullPathW
278 stub SheGetCurDrive
279 stub SheGetDirA
280 stub SheGetDirExW
281 stub SheGetDirW
279 stub SheGetDirA@8
280 stub SheGetDirExW@12
281 stdcall SheGetDirW (long long) SheGetDirW
282 stub SheGetPathOffsetW
283 stub SheRemoveQuotesA
284 stub SheRemoveQuotesW
......@@ -313,7 +313,7 @@ init Shell32LibMain
304 stdcall StrChrW (ptr ptr) StrChrW # proper ordinal unknown
305 stub StrCmpNA # proper ordinal unknown
306 stub StrCmpNIA # proper ordinal unknown
307 stub StrCmpNIW # proper ordinal unknown
307 stdcall StrCmpNIW (wstr wstr long) StrCmpNIW # proper ordinal unknown
308 stub StrCmpNW # proper ordinal unknown
309 stub StrCpyNA # proper ordinal unknown
310 stub StrCpyNW # proper ordinal unknown
......@@ -326,7 +326,7 @@ init Shell32LibMain
317 stub StrRChrA # proper ordinal unknown
318 stub StrRChrIA # proper ordinal unknown
319 stub StrRChrIW # proper ordinal unknown
320 stub StrRChrW # proper ordinal unknown
320 stdcall StrRChrW (wstr wstr long) StrRChrW # proper ordinal unknown
321 stub StrRStrA # proper ordinal unknown
322 stub StrRStrIA # proper ordinal unknown
323 stub StrRStrIW # proper ordinal unknown
......
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