Change SHCreateDirectory and Win32DeleteFile to be Unicode or ANSI depending
on OS version. Add ShCreateDirectoryEx API.
This commit is contained in:
parent
c306f35197
commit
d11efe88b9
|
@ -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
|
||||
|
|
|
@ -133,16 +133,44 @@ BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI)
|
|||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
@ -151,11 +179,11 @@ DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path)
|
|||
*
|
||||
* Deletes a file. Also triggers a change notify if one exists.
|
||||
*
|
||||
* FIXME:
|
||||
* 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()
|
||||
*
|
||||
|
@ -270,7 +314,7 @@ DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
|
|||
int lenPTo;
|
||||
if ( ! destisdir) {
|
||||
TRACE(" creating directory %s\n",pTo);
|
||||
SHCreateDirectory(NULL,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);
|
||||
}
|
||||
|
|
|
@ -497,6 +497,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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue