-C Attempt\sto\sdetect\sphysical\ssector\ssizes\son\sWindows\s8\sand\shigher.
-D 2017-01-11T16:52:42.051
+C Attempt\sto\sdetect\sphysical\ssector\ssizes\son\sWindows\sVista\sand\shigher.
+D 2017-01-12T23:37:52.534
F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
F src/os_unix.c 30e2c43e4955db990e5b5a81e901f8aa74cc8820
-F src/os_win.c 036b12e525724d3cbdd931a6e4439dea924b17bf
+F src/os_win.c 9fbb3876ef282302ef6df6471900f283f3e4b13b
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 9dc72d23eebbdf992bd69f2ab954d0d3a27c7340
F src/pager.h d1e944291030351f362a0a7da9b5c3e34e603e39
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P f58f75b5a06f88ba97bd1a02bee621c64691c6f8
-R d576d3178105de663378d6b438b5e84a
-T *branch * winSectorSize
-T *sym-winSectorSize *
-T -sym-trunk *
+P 381fd34b97ffe14f4bb784a9aae74477af699a08
+R 38a73ae0f111c05298e6affd34726ac4
U mistachkin
-Z dade53828d1ccfadec45e309319f8c1a
+Z 05bcbcf820c10856a01bad7c2d3d9e2a
** Define the required Windows SDK version constants if they are not
** already available.
*/
+#ifndef _WIN32_WINNT_VISTA
+# define _WIN32_WINNT_VISTA 0x0600
+#endif
+
#ifndef _WIN32_WINNT_WIN8
# define _WIN32_WINNT_WIN8 0x0602
#endif
#define osFlushViewOfFile \
((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[79].pCurrent)
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ { "DeviceIoControl", (SYSCALL)DeviceIoControl, 0 },
+#else
+ { "DeviceIoControl", (SYSCALL)0, 0 },
+#endif
+
+#define osDeviceIoControl ((BOOL(WINAPI*)( \
+ HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPVOID, \
+ LPOVERLAPPED))aSyscall[80].pCurrent)
+
}; /* End of the overrideable system calls */
/*
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_WIN8
winFile *pFile = (winFile*)id;
FILE_STORAGE_INFO info;
+ memset(&info, 0, sizeof(FILE_STORAGE_INFO));
if( osGetFileInformationByHandleEx(pFile->h, FileStorageInfo,
&info, sizeof(info)) ){
ULONG size = info.FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
}else{
pFile->lastErrno = osGetLastError();
winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
- "winSectorSize", pFile->zPath);
+ "winSectorSize1", pFile->zPath);
+ }
+#elif defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ winFile *pFile = (winFile*)id;
+ if( winIsDriveLetterAndColon(pFile->zPath) ){
+ WCHAR zDisk[] = L"\\\\.\\_:\0"; /* underscore will be drive letter */
+ HANDLE hDisk;
+ zDisk[4] = (WCHAR)pFile->zPath[0]; /* 'A' to 'Z' only, upper/lower case */
+ assert( (zDisk[4]>=L'A' && zDisk[4]<=L'Z')
+ || (zDisk[4]>=L'a' && zDisk[4]<=L'z')
+ );
+ hDisk = osCreateFileW(zDisk, STANDARD_RIGHTS_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if( hDisk!=NULL ){
+ STORAGE_PROPERTY_QUERY query;
+ STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR alignment;
+ DWORD bytes = 0;
+ memset(&query, 0, sizeof(STORAGE_PROPERTY_QUERY));
+ memset(&alignment, 0, sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR));
+ query.QueryType = PropertyStandardQuery;
+ query.PropertyId = StorageAccessAlignmentProperty;
+ if( osDeviceIoControl(hDisk, IOCTL_STORAGE_QUERY_PROPERTY, &query,
+ sizeof(STORAGE_PROPERTY_QUERY), &alignment,
+ sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR),
+ &bytes, NULL) ){
+ DWORD size = alignment.BytesPerPhysicalSector;
+ OSTRACE(("SECTOR file=%p, size=%lu\n", pFile->h, size));
+ if( size>0 && size<=2147483647 ){
+ return (int)size;
+ }
+ }else{
+ pFile->lastErrno = osGetLastError();
+ winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
+ "winSectorSize2", pFile->zPath);
+ }
+ osCloseHandle(hDisk);
+ }else{
+ pFile->lastErrno = osGetLastError();
+ winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
+ "winSectorSize3", pFile->zPath);
+ }
}
#else
(void)id;
/* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */
- assert( ArraySize(aSyscall)==80 );
+ assert( ArraySize(aSyscall)==81 );
/* get memory map allocation granularity */
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));