/ Check-in [2dc16d34]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve and update comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winSectorSize
Files: files | file ages | folders
SHA1: 2dc16d345bfb492b2ec69463b6130ff1b62fd291
User & Date: mistachkin 2017-01-18 19:36:10
Context
2017-01-18
23:12
For Windows 8.x and higher, require the SQLITE_WIN32_WIN8_SECTOR_SIZE compile-time option in order to enable sector size determination. (Leaf check-in: 47beb55c user: mistachkin tags: winSectorSize)
19:36
Improve and update comments. (check-in: 2dc16d34 user: mistachkin tags: winSectorSize)
19:06
Minimize the requested permissions when opening the volume on Windows 7 and Vista. (check-in: 8d429a59 user: mistachkin tags: winSectorSize)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

   450    450   static int winMemInit(void *pAppData);
   451    451   static void winMemShutdown(void *pAppData);
   452    452   
   453    453   const sqlite3_mem_methods *sqlite3MemGetWin32(void);
   454    454   #endif /* SQLITE_WIN32_MALLOC */
   455    455   
   456    456   /*
   457         -** The following variable is (normally) set once and never changes
   458         -** thereafter.  It records whether the operating system is Win9x
   459         -** or WinNT.
          457  +** The following variables are (normally) set once and never change
          458  +** thereafter.  They record the major and minor OS version and whether
          459  +** the operating system type is Win9x or WinNT.
   460    460   **
   461         -** 0:   Operating system unknown.
   462         -** 1:   Operating system is Win9x.
   463         -** 2:   Operating system is WinNT.
          461  +** sqlite3_os_type = 0:   Operating system type is unknown.
          462  +** sqlite3_os_type = 1:   Operating system type is Win9x.
          463  +** sqlite3_os_type = 2:   Operating system type is WinNT.
   464    464   **
   465         -** In order to facilitate testing on a WinNT system, the test fixture
          465  +** For the major and minor versions, the following are the "well-known"
          466  +** operating system releases (i.e. the ones that are tested for):
          467  +**
          468  +** sqlite3_os_major.sqlite3_os_minor = 6.0 = Windows Vista
          469  +** sqlite3_os_major.sqlite3_os_minor = 6.2 = Windows 8
          470  +**
          471  +** In order to facilitate testing on WinNT systems, the test fixture
   466    472   ** can manually set this value to 1 to emulate Win98 behavior.
   467    473   */
   468    474   #ifdef SQLITE_TEST
   469    475   LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0;
   470    476   LONG SQLITE_WIN32_VOLATILE sqlite3_os_major = 0;
   471    477   LONG SQLITE_WIN32_VOLATILE sqlite3_os_minor = 0;
   472    478   #else
................................................................................
  3622   3628         return rc;
  3623   3629       }
  3624   3630   #endif
  3625   3631     }
  3626   3632     OSTRACE(("FCNTL file=%p, rc=SQLITE_NOTFOUND\n", pFile->h));
  3627   3633     return SQLITE_NOTFOUND;
  3628   3634   }
         3635  +
         3636  +/*
         3637  +** Same-volume determination for versions of Windows prior to Windows 8
         3638  +** is untested, undocumented, and unsupported.  All such code is omitted
         3639  +** unless the SQLITE_WIN32_VISTA_SECTOR_SIZE define is set at compile-time,
         3640  +** and that compile-time option is off by default and undocumented.  The
         3641  +** following code is for reference only.
         3642  +*/
  3629   3643   
  3630   3644   #if defined(SQLITE_WIN32_VISTA_SECTOR_SIZE) && \
  3631   3645       defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
  3632   3646   /*
  3633   3647   ** This function attempts to determine if the specified file resides on the
  3634   3648   ** same volume as the corresponding root directory.  If not, the specified
  3635   3649   ** file may be impacted by a hard link, symbolic link, or reparse point (e.g.
................................................................................
  3685   3699       }else{
  3686   3700         pFile->lastErrno = osGetLastError();
  3687   3701         winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
  3688   3702                     "winSectorSize1", pFile->zPath);
  3689   3703       }
  3690   3704     }
  3691   3705   #endif
         3706  +
         3707  +/*
         3708  +** Sector-size determination for versions of Windows prior to Windows 8
         3709  +** is untested, undocumented, and unsupported.  All such code is omitted
         3710  +** unless the SQLITE_WIN32_VISTA_SECTOR_SIZE define is set at compile-time,
         3711  +** and that compile-time option is off by default and undocumented.  The
         3712  +** following code is for reference only.
         3713  +*/
  3692   3714   
  3693   3715   #if defined(SQLITE_WIN32_VISTA_SECTOR_SIZE) && \
  3694   3716       defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
  3695   3717     if( osIsVistaPlus() ){
  3696   3718       winFile *pFile = (winFile*)id;
  3697   3719       if( winIsDriveLetterAndColon(pFile->zPath) && winIsOnSameVolume(pFile) ){
  3698   3720         WCHAR zDisk[] = L"\\\\.\\_:\0"; /* underscore will be drive letter */