Commit 49e1b691 authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Change SHChangeNotify to be Unicode and ANSI indifferent, as the type

of parameters is really defined by uFlags parameter.
parent 5f66cf3a
......@@ -185,8 +185,7 @@ SHChangeNotifyRegister(
* SHChangeNotifyDeregister [SHELL32.4]
*/
BOOL WINAPI
SHChangeNotifyDeregister(
HANDLE hNotify)
SHChangeNotifyDeregister(HANDLE hNotify)
{
TRACE("(%p)\n",hNotify);
......@@ -209,76 +208,44 @@ SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2,
/*************************************************************************
* SHChangeNotify [SHELL32.@]
*/
void WINAPI SHChangeNotifyW (LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
{
LPITEMIDLIST pidl1=(LPITEMIDLIST)dwItem1, pidl2=(LPITEMIDLIST)dwItem2;
LPNOTIFICATIONLIST ptr;
TRACE("(0x%08lx,0x%08x,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
/* convert paths in IDLists*/
if(uFlags & SHCNF_PATHA)
{
DWORD dummy;
if (dwItem1) SHILCreateFromPathA((LPCSTR)dwItem1, &pidl1, &dummy);
if (dwItem2) SHILCreateFromPathA((LPCSTR)dwItem2, &pidl2, &dummy);
}
EnterCriticalSection(&SHELL32_ChangenotifyCS);
/* loop through the list */
ptr = head.next;
while(ptr != &tail)
{
TRACE("trying %p\n", ptr);
if(wEventId & ptr->wEventMask)
{
TRACE("notifying\n");
SendMessageA(ptr->hwnd, ptr->uMsg, (WPARAM)pidl1, (LPARAM)pidl2);
}
ptr = ptr->next;
}
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
if(uFlags & SHCNF_PATHA)
{
if (pidl1) SHFree(pidl1);
if (pidl2) SHFree(pidl2);
}
}
/*************************************************************************
* SHChangeNotify [SHELL32.@]
*/
void WINAPI SHChangeNotifyA (LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
{
LPITEMIDLIST Pidls[2];
LPNOTIFICATIONLIST ptr;
DWORD dummy;
UINT typeFlag = uFlags & SHCNF_TYPE;
Pidls[0] = (LPITEMIDLIST)dwItem1;
Pidls[1] = (LPITEMIDLIST)dwItem2;
TRACE("(0x%08lx,0x%08x,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
TRACE("(0x%08lx,0x%08x,%p,%p):stub.\n", wEventId, uFlags, dwItem1, dwItem2);
/* convert paths in IDLists*/
if(uFlags & SHCNF_PATHA)
switch (typeFlag)
{
DWORD dummy;
if (Pidls[0]) SHILCreateFromPathA((LPCSTR)dwItem1, &Pidls[0], &dummy);
if (Pidls[1]) SHILCreateFromPathA((LPCSTR)dwItem2, &Pidls[1], &dummy);
case SHCNF_PATHA:
if (dwItem1) SHILCreateFromPathA((LPCSTR)dwItem1, &Pidls[0], &dummy);
if (dwItem2) SHILCreateFromPathA((LPCSTR)dwItem2, &Pidls[1], &dummy);
break;
case SHCNF_PATHW:
if (dwItem1) SHILCreateFromPathW((LPCWSTR)dwItem1, &Pidls[0], &dummy);
if (dwItem2) SHILCreateFromPathW((LPCWSTR)dwItem2, &Pidls[1], &dummy);
break;
case SHCNF_PRINTERA:
case SHCNF_PRINTERW:
FIXME("SHChangeNotify with (uFlags & SHCNF_PRINTER)");
break;
}
EnterCriticalSection(&SHELL32_ChangenotifyCS);
/* loop through the list */
ptr = head.next;
while(ptr != &tail)
while (ptr != &tail)
{
TRACE("trying %p\n", ptr);
if(wEventId & ptr->wEventMask)
if (wEventId & ptr->wEventMask)
{
TRACE("notifying\n");
SendMessageA(ptr->hwnd, ptr->uMsg, (WPARAM)&Pidls, (LPARAM)wEventId);
......@@ -289,25 +256,14 @@ void WINAPI SHChangeNotifyA (LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVO
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
/* if we allocated it, free it */
if(uFlags & SHCNF_PATHA)
if ((typeFlag == SHCNF_PATHA) || (typeFlag == SHCNF_PATHW))
{
if (Pidls[0]) SHFree(Pidls[0]);
if (Pidls[1]) SHFree(Pidls[1]);
if (Pidls[0]) SHFree(Pidls[0]);
if (Pidls[1]) SHFree(Pidls[1]);
}
}
/*************************************************************************
* SHChangeNotify [SHELL32.@]
*/
void WINAPI SHChangeNotifyAW (LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
{
if(SHELL_OsIsUnicode())
SHChangeNotifyW (wEventId, uFlags, dwItem1, dwItem2);
else
SHChangeNotifyA (wEventId, uFlags, dwItem1, dwItem2);
}
/*************************************************************************
* NTSHChangeNotifyRegister [SHELL32.640]
* NOTES
* Idlist is an array of structures and Count specifies how many items in the array
......
......@@ -68,7 +68,7 @@
74 stdcall SHCreateStdEnumFmtEtc(long ptr ptr) SHCreateStdEnumFmtEtc
75 stdcall PathYetAnotherMakeUniqueName(ptr ptr ptr ptr) PathYetAnotherMakeUniqueNameA
76 stub DragQueryInfo
77 stdcall SHMapPIDLToSystemImageListIndex(long long long) SHMapPIDLToSystemImageListIndex
77 stdcall SHMapPIDLToSystemImageListIndex(ptr ptr ptr) SHMapPIDLToSystemImageListIndex
78 stdcall OleStrToStrN(str long wstr long) OleStrToStrNAW
79 stdcall StrToOleStrN(wstr long str long) StrToOleStrNAW
80 stdcall DragFinish(long) DragFinish
......@@ -79,7 +79,7 @@
85 forward OpenRegStream shlwapi.SHOpenRegStreamA
86 stdcall SHRegisterDragDrop(long ptr) SHRegisterDragDrop
87 stdcall SHRevokeDragDrop(long) SHRevokeDragDrop
88 stdcall SHDoDragDrop(long long long long long) SHDoDragDrop
88 stdcall SHDoDragDrop(long ptr ptr long ptr) SHDoDragDrop
89 stdcall SHCloneSpecialIDList(long long long) SHCloneSpecialIDList
90 stub SHFindFiles
91 stub SHFindComputer
......@@ -87,7 +87,7 @@
93 stub Win32CreateDirectory
94 stub Win32RemoveDirectory
95 stdcall SHLogILFromFSIL (ptr) SHLogILFromFSIL
96 stdcall StrRetToStrN (long long long long) StrRetToStrNAW
96 stdcall StrRetToStrN (ptr long ptr ptr) StrRetToStrNAW
97 stdcall SHWaitForFileToOpen (long long long) SHWaitForFileToOpen
98 stdcall SHGetRealIDL (long long long) SHGetRealIDL
99 stdcall SetAppStartingCursor (long long) SetAppStartingCursor
......@@ -354,7 +354,7 @@
@ stdcall SHBrowseForFolder(ptr) SHBrowseForFolderA
@ stdcall SHBrowseForFolderA(ptr) SHBrowseForFolderA
@ stdcall SHBrowseForFolderW(ptr) SHBrowseForFolderW
@ stdcall SHChangeNotify (long long ptr ptr) SHChangeNotifyAW
@ stdcall SHChangeNotify (long long ptr ptr) SHChangeNotify
@ stub ShellHookProc
@ stub SHEmptyRecycleBinA@12
@ stub SHEmptyRecycleBinW@12
......@@ -371,8 +371,8 @@
@ stdcall SHGetMalloc(ptr)SHGetMalloc
@ stub SHGetNewLinkInfo@20
@ stdcall SHGetPathFromIDList(ptr ptr)SHGetPathFromIDListAW
@ stdcall SHGetPathFromIDListA(long long)SHGetPathFromIDListA
@ stdcall SHGetPathFromIDListW(long long)SHGetPathFromIDListW
@ stdcall SHGetPathFromIDListA(ptr ptr)SHGetPathFromIDListA
@ stdcall SHGetPathFromIDListW(ptr ptr)SHGetPathFromIDListW
@ stdcall SHGetSettings(ptr long) SHGetSettings
@ stdcall SHGetSpecialFolderLocation(long long ptr)SHGetSpecialFolderLocation
@ stdcall SHHelpShortcuts_RunDLL(long long long long) SHHelpShortcuts_RunDLL
......
......@@ -706,7 +706,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, HWND hwnd
if (MoveFileA (szSrc, szDest)) {
if (pPidlOut)
*pPidlOut = SHSimpleIDListFromPathA (szDest);
SHChangeNotifyA (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest);
SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest);
return S_OK;
}
return E_FAIL;
......@@ -940,7 +940,7 @@ static HRESULT WINAPI ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCST
pidlitem = SHSimpleIDListFromPathA (lpstrNewDir);
pidl = ILCombine (This->pidlRoot, pidlitem);
SHChangeNotifyA (SHCNE_MKDIR, SHCNF_IDLIST, pidl, NULL);
SHChangeNotify (SHCNE_MKDIR, SHCNF_IDLIST, pidl, NULL);
SHFree (pidl);
if (ppidlOut)
......@@ -999,7 +999,7 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPC
return E_FAIL;
}
pidl = ILCombine (This->pidlRoot, apidl[i]);
SHChangeNotifyA (SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL);
SHChangeNotify (SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL);
SHFree (pidl);
} else if (_ILIsValue (apidl[i])) {
LPITEMIDLIST pidl;
......@@ -1010,7 +1010,7 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPC
return E_FAIL;
}
pidl = ILCombine (This->pidlRoot, apidl[i]);
SHChangeNotifyA (SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL);
SHChangeNotify (SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL);
SHFree (pidl);
}
......
......@@ -141,7 +141,7 @@ DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path)
TRACE("(%p,%s)\n",sec,path);
if ((ret = CreateDirectoryA(path,sec)))
{
SHChangeNotifyA(SHCNE_MKDIR, SHCNF_PATHA, path, NULL);
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHA, path, NULL);
}
return ret;
}
......@@ -152,17 +152,15 @@ DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path)
* Deletes a file. Also triggers a change notify if one exists.
*
* FIXME:
* Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be
* ANSI. Is this Unicode on NT?
*
* Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be ANSI.
* This is Unicode on NT/2000
*/
BOOL WINAPI Win32DeleteFile(LPSTR fName)
{
TRACE("%p(%s)\n", fName, fName);
DeleteFileA(fName);
SHChangeNotifyA(SHCNE_DELETE, SHCNF_PATHA, fName, NULL);
SHChangeNotify(SHCNE_DELETE, SHCNF_PATHA, fName, NULL);
return TRUE;
}
......
......@@ -495,9 +495,7 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
#define SHCNF_FLUSH 0x1000
#define SHCNF_FLUSHNOWAIT 0x2000
void WINAPI SHChangeNotifyA(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
void WINAPI SHChangeNotifyW(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
#define SHChangeNotify WINELIB_NAME_AW(SHChangeNotify)
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
/****************************************************************************
* SHGetSpecialFolderLocation API
......
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