Release 20000326.
[wine/gsoc-2012-control.git] / dlls / shell32 / shlfileop.c
blobf3954ce178757e8e40054e7b58b077f5f48a8850
1 /*
2 * SHFileOperation
3 */
4 #include <string.h>
5 #include "debugtools.h"
6 #include "shellapi.h"
7 #include "shell32_main.h"
8 #include "winversion.h"
10 #include "shlobj.h"
12 DEFAULT_DEBUG_CHANNEL(shell);
14 /**************************************************************************
15 * SHELL_DeleteDirectoryA()
17 * like rm -r
20 BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir)
22 BOOL ret = FALSE;
23 HANDLE hFind;
24 WIN32_FIND_DATAA wfd;
25 char szTemp[MAX_PATH];
27 strcpy(szTemp, pszDir);
28 PathAddBackslashA(szTemp);
29 strcat(szTemp, "*.*");
31 if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd)))
35 if(strcasecmp(wfd.cFileName, ".") && strcasecmp(wfd.cFileName, ".."))
37 strcpy(szTemp, pszDir);
38 PathAddBackslashA(szTemp);
39 strcat(szTemp, wfd.cFileName);
41 if(FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
42 SHELL_DeleteDirectoryA(szTemp);
43 else
44 DeleteFileA(szTemp);
46 } while(FindNextFileA(hFind, &wfd));
48 FindClose(hFind);
49 ret = RemoveDirectoryA(pszDir);
52 return ret;
55 /*************************************************************************
56 * SHCreateDirectory [SHELL32.165]
58 * NOTES
59 * exported by ordinal
60 * not sure about LPSECURITY_ATTRIBUTES
62 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path)
64 DWORD ret;
65 TRACE("(%p,%s)\n",sec,path);
66 if ((ret = CreateDirectoryA(path,sec)))
68 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_PATHA, path, NULL);
70 return ret;
73 /************************************************************************
74 * Win32DeleteFile [SHELL32.164]
76 * Deletes a file. Also triggers a change notify if one exists.
78 * FIXME:
79 * Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be
80 * ANSI. Is this Unicode on NT?
82 */
84 BOOL WINAPI Win32DeleteFile(LPSTR fName)
86 TRACE("%p(%s)\n", fName, fName);
88 DeleteFileA(fName);
89 SHChangeNotifyA(SHCNE_DELETE, SHCNF_PATHA, fName, NULL);
90 return TRUE;
93 /*************************************************************************
94 * SHFileOperationA [SHELL32.243]
96 * NOTES
97 * exported by name
99 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
101 FIXME("(%p):stub.\n", lpFileOp);
102 return 1;
105 /*************************************************************************
106 * SHFileOperationW [SHELL32.244]
108 * NOTES
109 * exported by name
111 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)
113 FIXME("(%p):stub.\n", lpFileOp);
114 return 1;
117 /*************************************************************************
118 * SHFileOperation [SHELL32.242]
121 DWORD WINAPI SHFileOperationAW(LPVOID lpFileOp)
123 if (VERSION_OsIsUnicode())
124 return SHFileOperationW(lpFileOp);
125 return SHFileOperationA(lpFileOp);