winetests: new addition

Jakob Eriksson jakov at vmlinux.org
Thu Oct 23 09:48:37 CDT 2003


Rolf Kalbermatter wrote:

>You mean something like this:
>(Stolen shamelessly and a little modified fror SHELL_DeleteDirectory in shlfileop.c)
>
>
>#define IsDotDir(x)     ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
>
>static BOOL removeDir(LPCSTR dir)
>{
>  BOOL ret = TRUE;
>  HANDLE  hFind;
>  WIN32_FIND_DATAA wfd;
>  CHAR path[MAX_PATH];
>
>  /* Make sure the directory exists before going further */
>  PathCombineA(path, dir, "*");
>  hFind = FindFirstFileA(path, &wfd);
>  if (hFind == INVALID_HANDLE_VALUE)
>    return ret;
> 
>  do
>  {
>    LPSTR lp = wfd.cFileName;
>    if (!lp[0])
>      lp = wfd.cAlternateFileName;
>    if (IsDotDir(lp))
>      continue;
>    PathCombineA(path, dir, lp);
>    if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
>    {
>      ret = removeDir(path);
>    }
>    else
>      ret = DeleteFileA(path);
>  } while (ret && FindNextFileA(hFind, &wfd));
>  FindClose(hFind);
>  RemoveDirectoryA(dir);
>  return ret;
>}
>
>  
>

I have set myself up for embarrassment.  :-)
Yes, I tried to clone abovementioned code. Did not even succeed doing that.
Also figured it was silly to clone functionality already in any not 
totally unreasonably
outdated version of Windows.


Jakob




More information about the wine-devel mailing list