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).
diff --git a/dlls/shell32/dataobject.c b/dlls/shell32/dataobject.c
index ce4926c..e5ad445 100644
--- a/dlls/shell32/dataobject.c
+++ b/dlls/shell32/dataobject.c
@@ -313,9 +313,11 @@
{ 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);
diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c
index 365be32..10f430e 100644
--- a/dlls/shell32/enumidlist.c
+++ b/dlls/shell32/enumidlist.c
@@ -220,7 +220,7 @@
if (lpszPath && lpszPath[0]!='\0')
{ strcpy(szPath, lpszPath);
- PathAddBackslash(szPath);
+ PathAddBackslash32A(szPath);
strcat(szPath,"*.*");
}
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index afb16b0..a08e18f 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -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 @@
* 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 @@
}
pText = _ILGetTextPointer(pData->type,pData);
strcat(lpszPath, pText);
- PathAddBackslash(lpszPath);
+ PathAddBackslash32A(lpszPath);
dwCopied += strlen(pText) + 1;
pidlTemp = ILGetNext(pidlTemp);
@@ -873,7 +878,7 @@
}
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 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 @@
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 @@
{ ILFree(IDLList_GetElement(this,i));
}
- DPA_Destroy(this->dpa);
+ pDPA_Destroy(this->dpa);
this->dpa=NULL;
}
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 6c2bb6b..c7fac5c 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -483,6 +483,7 @@
tFolder=FT_DESKTOP;
break;
case CSIDL_DESKTOPDIRECTORY:
+ case CSIDL_COMMON_DESKTOPDIRECTORY:
strcpy (buffer,"Desktop");
break;
case CSIDL_DRIVES:
@@ -496,11 +497,17 @@
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 @@
case CSIDL_PRINTERS:
strcpy (buffer,"PrintHood");
break;
+ case CSIDL_COMMON_PROGRAMS:
case CSIDL_PROGRAMS:
strcpy (buffer,"Programs");
break;
@@ -519,9 +527,11 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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_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 @@
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 @@
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
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index da0d843..4c4656c 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -21,7 +21,11 @@
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)))
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 9b6bc02..9326ee0 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -30,6 +30,8 @@
#include "shlobj.h"
#include "debug.h"
#include "winreg.h"
+#include "winnls.h"
+#include "winversion.h"
#include "shell32_main.h"
/*************************************************************************
@@ -62,25 +64,48 @@
/*************************************************************************
* PathIsRoot [SHELL32.29]
*/
-BOOL32 WINAPI PathIsRoot(LPCSTR x) {
- TRACE(shell,"%s\n",x);
- if (!strcmp(x+1,":\\")) /* "X:\" */
- return 1;
- if (!strcmp(x,"\\")) /* "\" */
- return 1;
- if (x[0]=='\\' && x[1]=='\\') { /* UNC "\\<xx>\" */
- int foundbackslash = 0;
- x=x+2;
- while (*x) {
- if (*x++=='\\')
- foundbackslash++;
- }
- if (foundbackslash<=1) /* max 1 \ more ... */
- return 1;
+BOOL32 WINAPI PathIsRoot32A(LPCSTR x)
+{ TRACE(shell,"%s\n",x);
+ if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
+ return 1;
+ if (*x=='\\') /* "\" */
+ return 0;
+ if (x[0]=='\\' && x[1]=='\\') /* UNC "\\<xx>\" */
+ { int foundbackslash = 0;
+ x=x+2;
+ while (*x)
+ { if (*x++=='\\')
+ foundbackslash++;
+ }
+ if (foundbackslash<=1) /* max 1 \ more ... */
+ return 1;
}
return 0;
}
+BOOL32 WINAPI PathIsRoot32W(LPCWSTR x)
+{ TRACE(shell,"%s\n",debugstr_w(x));
+ if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
+ return 1;
+ if (*x == (WCHAR) '\\') /* "\" */
+ return 0;
+ if (x[0]==(WCHAR)'\\' && x[1]==(WCHAR)'\\') /* UNC "\\<xx>\" */
+ { int foundbackslash = 0;
+ x=x+2;
+ while (*x)
+ { if (*x++==(WCHAR)'\\')
+ foundbackslash++;
+ }
+ if (foundbackslash<=1) /* max 1 \ more ... */
+ return 1;
+ }
+ return 0;
+}
+BOOL32 WINAPI PathIsRoot32AW(LPCVOID x)
+{ if (VERSION_OsIsUnicode())
+ return PathIsRoot32W(x);
+ return PathIsRoot32A(x);
+}
/*************************************************************************
* PathBuildRoot [SHELL32.30]
*/
@@ -97,17 +122,35 @@
* NOTES
* returns pointer to last . in last pathcomponent or at \0.
*/
-LPSTR WINAPI PathFindExtension(LPSTR path) {
- LPSTR lastpoint = NULL;
- TRACE(shell,"%p %s\n",path,path);
- while (*path) {
- if (*path=='\\'||*path==' ')
+LPCSTR WINAPI PathFindExtension32A(LPCSTR path)
+{ LPCSTR lastpoint = NULL;
+ TRACE(shell,"%p %s\n",path,path);
+ while (*path)
+ { if (*path=='\\'||*path==' ')
lastpoint=NULL;
- if (*path=='.')
+ if (*path=='.')
lastpoint=path;
- path++;
- }
- return lastpoint?lastpoint:path;
+ path++;
+ }
+ return lastpoint?lastpoint:path;
+}
+LPCWSTR WINAPI PathFindExtension32W(LPCWSTR path)
+{ LPCWSTR lastpoint = NULL;
+ TRACE(shell,"%p L%s\n",path,debugstr_w(path));
+ while (*path)
+ { if (*path==(WCHAR)'\\'||*path==(WCHAR)' ')
+ lastpoint=NULL;
+ if (*path==(WCHAR)'.')
+ lastpoint=path;
+ path++;
+ }
+ return lastpoint?lastpoint:path;
+}
+LPCVOID WINAPI PathFindExtension32AW(LPCVOID path)
+{ if (VERSION_OsIsUnicode())
+ return PathFindExtension32W(path);
+ return PathFindExtension32A(path);
+
}
/*************************************************************************
@@ -116,7 +159,7 @@
* NOTES
* append \ if there is none
*/
-LPSTR WINAPI PathAddBackslash(LPSTR path)
+LPSTR WINAPI PathAddBackslash32A(LPSTR path)
{ int len;
TRACE(shell,"%p->%s\n",path,path);
@@ -128,6 +171,23 @@
}
return path+len;
}
+LPWSTR WINAPI PathAddBackslash32W(LPWSTR path)
+{ int len;
+ TRACE(shell,"%p->%s\n",path,debugstr_w(path));
+
+ len = lstrlen32W(path);
+ if (len && path[len-1]!=(WCHAR)'\\')
+ { path[len] = (WCHAR)'\\';
+ path[len+1]= 0x00;
+ return path+len+1;
+ }
+ return path+len;
+}
+LPVOID WINAPI PathAddBackslash32AW(LPVOID path)
+{ if(VERSION_OsIsUnicode())
+ return PathAddBackslash32W(path);
+ return PathAddBackslash32A(path);
+}
/*************************************************************************
* PathRemoveBlanks [SHELL32.33]
@@ -158,16 +218,28 @@
* NOTES
* basename(char *fn);
*/
-LPSTR WINAPI PathFindFilename(LPSTR fn)
-{ LPSTR basefn;
- TRACE(shell,"%s\n",fn);
- basefn = fn;
- while (fn[0])
- { if (((fn[0]=='\\') || (fn[0]==':')) && fn[1] && fn[1]!='\\')
- basefn = fn+1;
- fn++;
- }
- return basefn;
+LPVOID WINAPI PathFindFilename(LPVOID fn)
+{ LPSTR aslash,aptr;
+ LPWSTR wslash,wptr;
+
+ if(VERSION_OsIsUnicode())
+ { wslash = wptr = (LPWSTR) fn;
+ TRACE(shell,"L%s\n",debugstr_w(wslash));
+ while (wptr[0])
+ { if (((wptr[0]=='\\') || (wptr[0]==':')) && wptr[1] && wptr[1]!='\\')
+ wslash = wptr+1;
+ wptr++;
+ }
+ return (LPVOID) wslash;
+ }
+ aslash = aptr = (LPSTR) fn;
+ TRACE(shell,"%s\n",aslash);
+ while (aptr[0])
+ { if (((aptr[0]=='\\') || (aptr[0]==':')) && aptr[1] && aptr[1]!='\\')
+ aslash = aptr+1;
+ aptr++;
+ }
+ return (LPVOID) aslash;
}
/*************************************************************************
@@ -224,7 +296,7 @@
LPSTR WINAPI PathAppend(LPSTR x1,LPSTR x2) {
TRACE(shell,"%s %s\n",x1,x2);
while (x2[0]=='\\') x2++;
- return PathCombine(x1,x1,x2);
+ return PathCombine32A(x1,x1,x2);
}
/*************************************************************************
@@ -234,25 +306,52 @@
* if lpszFile='.' skip it
* szDest can be equal to lpszFile. Thats why we use sTemp
*/
-LPSTR WINAPI PathCombine(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile)
+LPSTR WINAPI PathCombine32A(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile)
{ char sTemp[MAX_PATH];
TRACE(shell,"%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile);
-
+
+
if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) )
{ strcpy(szDest,lpszDir);
return szDest;
}
/* if lpszFile is a complete path don't care about lpszDir */
- if (PathIsRoot(lpszFile))
+ if (PathIsRoot32A(lpszFile))
{ strcpy(szDest,lpszFile);
}
strcpy(sTemp,lpszDir);
- PathAddBackslash(sTemp);
+ PathAddBackslash32A(sTemp);
strcat(sTemp,lpszFile);
strcpy(szDest,sTemp);
return szDest;
}
+LPWSTR WINAPI PathCombine32W(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
+{ WCHAR sTemp[MAX_PATH];
+ TRACE(shell,"%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),
+ lpszFile, debugstr_w(lpszFile));
+
+
+ if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
+ { lstrcpy32W(szDest,lpszDir);
+ return szDest;
+ }
+
+ /* if lpszFile is a complete path don't care about lpszDir */
+ if (PathIsRoot32W(lpszFile))
+ { lstrcpy32W(szDest,lpszFile);
+ }
+ lstrcpy32W(sTemp,lpszDir);
+ PathAddBackslash32W(sTemp);
+ lstrcat32W(sTemp,lpszFile);
+ lstrcpy32W(szDest,sTemp);
+ return szDest;
+}
+LPVOID WINAPI PathCombine32AW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile)
+{ if (VERSION_OsIsUnicode())
+ return PathCombine32W( szDest, lpszDir, lpszFile );
+ return PathCombine32A( szDest, lpszDir, lpszFile );
+}
/*************************************************************************
* PathIsUNC [SHELL32.39]
@@ -315,17 +414,33 @@
* look for next arg in string. handle "quoted" strings
* returns pointer to argument *AFTER* the space. Or to the \0.
*/
-LPSTR WINAPI PathGetArgs(LPSTR cmdline) {
- BOOL32 qflag = FALSE;
- TRACE(shell,"%s\n",cmdline);
- while (*cmdline) {
- if ((*cmdline==' ') && !qflag)
- return cmdline+1;
- if (*cmdline=='"')
+LPVOID WINAPI PathGetArgs(LPVOID cmdline)
+{ BOOL32 qflag = FALSE;
+ LPWSTR wptr;
+ LPSTR aptr;
+
+ if (VERSION_OsIsUnicode())
+ { TRACE(shell,"%sL\n",debugstr_w((LPWSTR)cmdline));
+ wptr=(LPWSTR) cmdline;
+ while (*wptr)
+ { if ((*wptr==' ') && !qflag)
+ return wptr+1;
+ if (*wptr=='"')
qflag=!qflag;
- cmdline++;
- }
- return cmdline;
+ wptr++;
+ }
+ return (LPVOID) wptr;
+ }
+ TRACE(shell,"%s\n",(LPSTR)cmdline);
+ aptr=(LPSTR) cmdline;
+ while (*aptr)
+ { if ((*aptr==' ') && !qflag)
+ return aptr+1;
+ if (*aptr=='"')
+ qflag=!qflag;
+ aptr++;
+ }
+ return (LPVOID) aptr;
}
/*************************************************************************
@@ -395,8 +510,13 @@
* Shell_GetCachedImageIndex [SHELL32.72]
*
*/
-void WINAPI Shell_GetCachedImageIndex(LPSTR x,DWORD y,DWORD z)
-{ FIXME(shell,"(%s,%08lx,%08lx):stub.\n",x,y,z);
+void WINAPI Shell_GetCachedImageIndex(LPVOID x,DWORD y,DWORD z)
+{ if( VERSION_OsIsUnicode())
+ { FIXME(shell,"(L%s,%08lx,%08lx):stub.\n",debugstr_w((LPWSTR)x),y,z);
+ }
+ else
+ { FIXME(shell,"(%s,%08lx,%08lx):stub.\n",debugstr_a((LPSTR)x),y,z);
+ }
}
/*************************************************************************
@@ -606,10 +726,21 @@
* NOTES
* exported by ordinal
*/
-LPSTR WINAPI PathGetExtension(LPSTR path,DWORD y,DWORD z)
-{ TRACE(shell,"(%s,%08lx,%08lx)\n",path,y,z);
- path = PathFindExtension(path);
- return *path?(path+1):path;
+LPCSTR WINAPI PathGetExtension32A(LPCSTR path,DWORD y,DWORD z)
+{ TRACE(shell,"(%s,%08lx,%08lx)\n",path,y,z);
+ path = PathFindExtension32A(path);
+ return *path?(path+1):path;
+}
+LPCWSTR WINAPI PathGetExtension32W(LPCWSTR path,DWORD y,DWORD z)
+{ TRACE(shell,"(L%s,%08lx,%08lx)\n",debugstr_w(path),y,z);
+ path = PathFindExtension32W(path);
+ return *path?(path+1):path;
+}
+LPCVOID WINAPI PathGetExtension32AW(LPCVOID path,DWORD y,DWORD z)
+{ if (VERSION_OsIsUnicode())
+ return PathGetExtension32W(path,y,z);
+ return PathGetExtension32A(path,y,z);
+
}
/*************************************************************************
@@ -1094,20 +1225,67 @@
* at the moment only CSTR
* the pidl is for STRRET OFFSET
*/
-HRESULT WINAPI StrRetToStrN (LPSTR dest, DWORD len, LPSTRRET src, LPITEMIDLIST x)
-{ FIXME(shell,"dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,x);
- strncpy(dest,src->u.cStr,len);
- return S_OK;
+HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
+{ TRACE(shell,"dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
+
+ switch (src->uType)
+ { case STRRET_WSTR:
+ WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
+ SHFree(src->u.pOleStr);
+ break;
+
+ case STRRET_CSTRA:
+ if (VERSION_OsIsUnicode())
+ lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
+ else
+ strncpy((LPSTR)dest, src->u.cStr, len);
+ break;
+
+ case STRRET_OFFSETA:
+ if (pidl)
+ { if(VERSION_OsIsUnicode())
+ lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
+ else
+ strncpy((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
+ break;
+ }
+
+ default:
+ FIXME(shell,"unknown type!\n");
+ if (len)
+ { *(LPSTR)dest = '\0';
+ }
+ return(FALSE);
+ }
+ return(TRUE);
}
/*************************************************************************
* StrChrW [NT 4.0:SHELL32.651]
*
*/
-HRESULT WINAPI StrChrW (LPWSTR u, DWORD v)
-{ FIXME(shell,"%s 0x%lx stub\n",debugstr_w(u),v);
+LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
+{ LPWSTR ptr=str;
+
+ TRACE(shell,"%s 0x%04x\n",debugstr_w(str),x);
+ do
+ { if (*ptr==x)
+ { return ptr;
+ }
+ ptr++;
+ } while (*ptr);
+ return NULL;
+}
+
+/*************************************************************************
+ * StrCmpNIW [NT 4.0:SHELL32.*]
+ *
+ */
+INT32 WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT32 len)
+{ FIXME( shell,"%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
return 0;
}
+
/*************************************************************************
* SHAllocShared [SHELL32.520]
*
@@ -1368,3 +1546,33 @@
{ FIXME(shell,"stub\n");
return 1;
}
+/*************************************************************************
+ * SheGetDirW [SHELL32.281]
+ *
+ */
+HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v)
+{ FIXME(shell,"%s %s stub\n",debugstr_w(u),debugstr_w(v) );
+ return 0;
+}
+/*************************************************************************
+ * StrRChrW [SHELL32.320]
+ *
+ */
+LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
+{ LPWSTR wptr=NULL;
+ TRACE(shell,"%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
+
+ /* if the end not given, search*/
+ if (!lpEnd)
+ { lpEnd=lpStart;
+ while (*lpEnd)
+ lpEnd++;
+ }
+
+ do
+ { if (*lpStart==(WCHAR)wMatch)
+ wptr = lpStart;
+ lpStart++;
+ } while ( lpStart<=lpEnd );
+ return wptr;
+}
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index e1b1334..1faedbd 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -126,7 +126,7 @@
{ *(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 @@
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 @@
strcat (szDrive,")");
}
else
- { PathAddBackslash (szTemp);
+ { PathAddBackslash32A (szTemp);
strcpy(szDrive,szTemp);
}
}
@@ -673,7 +675,7 @@
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 @@
if(!(lpName))
{ return E_OUTOFMEMORY;
}
- lpName->uType = STRRET_CSTR;
+ lpName->uType = STRRET_CSTRA;
strcpy(lpName->u.cStr,szText);
return S_OK;
}
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index c6d2773..26ea728 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -283,25 +283,25 @@
}
/* 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 @@
UpdateWindow32(this->hWndList);
pEnumIDList->lpvtbl->fnRelease(pEnumIDList); /* destroy the list*/
- DPA_Destroy(hdpa);
+ pDPA_Destroy(hdpa);
return S_OK;
}
@@ -727,26 +727,21 @@
}
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 @@
}
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 @@
{ 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 @@
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_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 @@
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;
}
diff --git a/include/shell.h b/include/shell.h
index b619fc9..c5d063e 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -227,10 +227,28 @@
/****************************************************************************
* 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 @@
#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 */
diff --git a/include/shlobj.h b/include/shlobj.h
index 9d5b58a..63ee03a 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -108,16 +108,22 @@
/****************************************************************************
* 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;
diff --git a/memory/string.c b/memory/string.c
index decad7a..e7c83cc 100644
--- a/memory/string.c
+++ b/memory/string.c
@@ -408,6 +408,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
diff --git a/ole/ole2nls.c b/ole/ole2nls.c
index 8cb23b3..9b3331b 100644
--- a/ole/ole2nls.c
+++ b/ole/ole2nls.c
@@ -362,7 +362,6 @@
{
/* 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 @@
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 @@
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 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 @@
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 @@
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 @@
SYSTEMTIME t;
LPSYSTEMTIME thistime;
LCID thislocale;
-
INT32 ret;
TRACE(ole,"(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",
@@ -2847,9 +2839,25 @@
}
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 @@
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 @@
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 @@
* 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);
+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);
- /* Enforce the Windows behavior */
- flags |= ~LOCALE_TIMEDATEBOTH;
- flags |= TIME_TIMEVARSONLY;
+ thislocale = OLE2NLS_CheckLocale ( locale );
- /* 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;
+ 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*/
- 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();
+ 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;
+ }
- realtime = xtime;
- if (!realtime) {
- realtime = &t;
- GetSystemTime(realtime);
- }
-
- retval = OLE_GetFormatW(locale, flags, 0, realtime, realformat, timestr, timelen);
- if (fmt_buf)
- free(fmt_buf);
- return retval;
-
-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;
}
diff --git a/relay32/shell32.spec b/relay32/shell32.spec
index c1436b7..89b4990 100644
--- a/relay32/shell32.spec
+++ b/relay32/shell32.spec
@@ -34,15 +34,15 @@
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 @@
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 @@
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 @@
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 @@
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