Commit d11efe88 authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Change SHCreateDirectory and Win32DeleteFile to be Unicode or ANSI depending

on OS version. Add ShCreateDirectoryEx API.
parent c306f351
......@@ -151,8 +151,8 @@
161 stdcall SHRunControlPanel (long long) SHRunControlPanel
162 stdcall SHSimpleIDListFromPath (ptr) SHSimpleIDListFromPathAW
163 stdcall StrToOleStr (wstr str) StrToOleStrAW
164 stdcall Win32DeleteFile(str) Win32DeleteFile
165 stdcall SHCreateDirectory(long long) SHCreateDirectory
164 stdcall Win32DeleteFile(str) Win32DeleteFileAW
165 stdcall SHCreateDirectory(long ptr) SHCreateDirectory
166 stdcall CallCPLEntry16(long long long long long long) CallCPLEntry16
167 stdcall SHAddFromPropSheetExtArray(long long long) SHAddFromPropSheetExtArray
168 stdcall SHCreatePropSheetExtArray(long str long) SHCreatePropSheetExtArray
......@@ -355,6 +355,8 @@
@ stdcall SHBrowseForFolderA(ptr) SHBrowseForFolderA
@ stdcall SHBrowseForFolderW(ptr) SHBrowseForFolderW
@ stdcall SHChangeNotify (long long ptr ptr) SHChangeNotify
@ stdcall SHCreateDirectoryExA(long str ptr) SHCreateDirectoryExA
@ stdcall SHCreateDirectoryExW(long wstr ptr) SHCreateDirectoryExW
@ stub ShellHookProc
@ stub SHEmptyRecycleBinA@12
@ stub SHEmptyRecycleBinW@12
......
......@@ -129,33 +129,61 @@ BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI)
}
/*************************************************************************
* SHCreateDirectory [SHELL32.165]
* SHCreateDirectory [SHELL32.165]
*
* NOTES
* exported by ordinal
* not sure about LPSECURITY_ATTRIBUTES
* WinNT/2000 exports Unicode
*/
DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path)
DWORD WINAPI SHCreateDirectory(HWND hWnd, LPCVOID path)
{
if (SHELL_OsIsUnicode())
return SHCreateDirectoryExW(hWnd, path, NULL);
return SHCreateDirectoryExA(hWnd, path, NULL);
}
/*************************************************************************
* SHCreateDirectoryExA [SHELL32.@]
*/
DWORD WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES sec)
{
DWORD ret;
TRACE("(%p,%s)\n",sec,path);
if ((ret = CreateDirectoryA(path,sec)))
TRACE("(%p, %s, %p)\n",hWnd, path, sec);
if ((ret = CreateDirectoryA(path, sec)))
{
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHA, path, NULL);
}
else if (hWnd)
FIXME("Semi-stub, non zero hWnd should be used as parent for error dialog!");
return ret;
}
/*************************************************************************
* SHCreateDirectoryExW [SHELL32.@]
*/
DWORD WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
{
DWORD ret;
TRACE("(%p, %s, %p)\n",hWnd, debugstr_w(path), sec);
if ((ret = CreateDirectoryW(path, sec)))
{
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHW, path, NULL);
}
else if (hWnd)
FIXME("Semi-stub, non zero hWnd should be used as parent for error dialog!");
return ret;
}
/************************************************************************
* Win32DeleteFile [SHELL32.164]
* Win32DeleteFile [SHELL32.164]
*
* Deletes a file. Also triggers a change notify if one exists.
* 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.
* This is Unicode on NT/2000
* NOTES:
* 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)
static BOOL Win32DeleteFileA(LPCSTR fName)
{
TRACE("%p(%s)\n", fName, fName);
......@@ -164,6 +192,22 @@ BOOL WINAPI Win32DeleteFile(LPSTR fName)
return TRUE;
}
static BOOL Win32DeleteFileW(LPCWSTR fName)
{
TRACE("%p(%s)\n", fName, debugstr_w(fName));
DeleteFileW(fName);
SHChangeNotify(SHCNE_DELETE, SHCNF_PATHW, fName, NULL);
return TRUE;
}
DWORD WINAPI Win32DeleteFileAW(LPCVOID fName)
{
if (SHELL_OsIsUnicode())
return Win32DeleteFileW(fName);
return Win32DeleteFileA(fName);
}
/**************************************************************************
* SHELL_FileNamesMatch()
*
......@@ -269,8 +313,8 @@ DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
char *fromfile;
int lenPTo;
if ( ! destisdir) {
TRACE(" creating directory %s\n",pTo);
SHCreateDirectory(NULL,pTo);
TRACE(" creating directory %s\n",pTo);
SHCreateDirectoryExA(NULL, pTo, NULL);
}
lenPTo = strlen(pTo);
while(1) {
......@@ -308,7 +352,7 @@ DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
{
SHFILEOPSTRUCTA shfo;
SHCreateDirectory(NULL,pTempTo);
SHCreateDirectoryExA(NULL, pTempTo, NULL);
PathAddBackslashA(szTempFrom);
strcat(szTempFrom, "*.*");
szTempFrom[strlen(szTempFrom) + 1] = '\0';
......@@ -343,7 +387,7 @@ DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
pFrom += strlen(pFrom) + 1;
}
} else {
while(1) {
while (1) {
if(!pFrom[0]) break;
if(!pTo[0]) break;
TRACE(" From='%s' To='%s'\n", pFrom, pTo);
......@@ -354,7 +398,7 @@ DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
strcpy( pTempTo, pTo );
PathRemoveFileSpecA(pTempTo);
TRACE(" Creating Directory '%s'\n", pTempTo);
SHCreateDirectory(NULL,pTempTo);
SHCreateDirectoryExA(NULL, pTempTo, NULL);
HeapFree(GetProcessHeap(), 0, pTempTo);
}
if (lpFileOp->wFunc == FO_COPY)
......@@ -480,6 +524,6 @@ BOOL WINAPI IsNetDrive(DWORD drive)
{
char root[4];
strcpy(root, "A:\\");
root[0] += drive;
root[0] += (char)drive;
return (GetDriveTypeA(root) == DRIVE_REMOTE);
}
......@@ -498,6 +498,13 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
/****************************************************************************
* SHCreateDirectory API
*/
DWORD WINAPI SHCreateDirectory(HWND, LPCVOID);
DWORD WINAPI SHCreateDirectoryExA(HWND, LPCSTR, LPSECURITY_ATTRIBUTES);
DWORD WINAPI SHCreateDirectoryExW(HWND, LPCWSTR, LPSECURITY_ATTRIBUTES);
/****************************************************************************
* SHGetSpecialFolderLocation API
*/
HRESULT WINAPI SHGetSpecialFolderLocation(HWND, INT, LPITEMIDLIST *);
......
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