Loading ...
Sorry, an error occurred while loading the content.

[patch] win32 extremely slow opening files on network shares

Expand Messages
  • David Anderson
    Hi, MSDN states: ________________________________________ You cannot use root directories as the lpFileName input string for FindFirstFile—with or without a
    Message 1 of 2 , Aug 24, 2010
    • 0 Attachment
      Hi,

      MSDN states:

      ________________________________________
      You cannot use root directories as the lpFileName input string for FindFirstFile—with or without a trailing backslash. If you want to see files or get the attributes of a root directory, do the following:
      • To see files in a root directory, you can use "C:\*" and step through the directory by using FindNextFile.
      • To get the attributes of a root directory, use GetFileAttributes.
      Note  Prepending the string "\\?\" does not allow access to the root directory.
      On network shares, you can use an lpFileName in the form of the following: "\\server\service\*" but you cannot use an lpFileName that points to the share itself, for example, "\\server\service".
      ________________________________________

      Solution: append ‘\*’ to the search string if searching a directory, server, or network share.

      -David Anderson

      diff -r 073ff46fe397 src/os_win32.c
      --- a/src/os_win32.c Fri Aug 20 11:11:57 2010 +0200
      +++ b/src/os_win32.c Mon Aug 23 19:27:56 2010 -0400
      @@ -2273,6 +2273,7 @@
           int len)
      {
           char szTrueName[_MAX_PATH + 2];
      +    char szTrueNameTemp[_MAX_PATH + 2];
           char *ptrue, *ptruePrev;
           char *porig, *porigPrev;
           int flen;
      @@ -2324,11 +2325,22 @@
      *ptrue = NUL;

      /* Skip "", "." and "..". */
      +        {
      +            int slen;
      +            STRCPY( szTrueNameTemp, szTrueName );
      +            slen = strlen( szTrueNameTemp );
      +            if( *porig == psepc && slen + 2 < _MAX_PATH ) {
      +                szTrueNameTemp[slen+0] = '\\';
      +                szTrueNameTemp[slen+1] = '*';
      +                szTrueNameTemp[slen+2] = 0;
      +            }
      +        }
      +
      if (ptrue > ptruePrev
      && (ptruePrev[0] != '.'
           || (ptruePrev[1] != NUL
      && (ptruePrev[1] != '.' || ptruePrev[2] != NUL)))
      - && (hFind = FindFirstFile(szTrueName, &fb))
      + && (hFind = FindFirstFile(szTrueNameTemp, &fb))
             != INVALID_HANDLE_VALUE)
      {
           c = *porig;

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.