/ Check-in [5350a658]
Login

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

Overview
Comment:Provide dummy DWORD arguments to output parameters of GetDiskFreeSpace(A|W), NULL causes access violations on Windows NT 4.0 (CVS 6477)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5350a6586cd6504a0724631e4ef46245832435f9
User & Date: chw 2009-04-09 14:27:07
Context
2009-04-09
21:02
Increase the version number to 3.6.13 in preparation for the next release. (CVS 6478) check-in: 9a09a474 user: drh tags: trunk
14:27
Provide dummy DWORD arguments to output parameters of GetDiskFreeSpace(A|W), NULL causes access violations on Windows NT 4.0 (CVS 6477) check-in: 5350a658 user: chw tags: trunk
14:02
Remove misuse detection from the deprecated sqlite3_transfer_bindings() interface. The code was hard to test and was simply taking up space. (CVS 6476) check-in: 4cd82910 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
....
1607
1608
1609
1610
1611
1612
1613
1614

1615
1616

1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631

1632
1633

1634
1635
1636
1637
1638
1639
1640
1641
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.153 2009/03/31 03:41:57 shane Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:
................................................................................
static int getSectorSize(
    sqlite3_vfs *pVfs,
    const char *zRelative     /* UTF-8 file name */
){
  DWORD bytesPerSector = SQLITE_DEFAULT_SECTOR_SIZE;
  char zFullpath[MAX_PATH+1];
  int rc;
  DWORD dwRet = 0;

  /*
  ** We need to get the full path name of the file
  ** to get the drive letter to look up the sector
  ** size.
  */
  rc = winFullPathname(pVfs, zRelative, MAX_PATH, zFullpath);
................................................................................
          if( p[i] == '\\' ){
            i++;
            p[i] = '\0';
            break;
          }
        }
        dwRet = GetDiskFreeSpaceW((WCHAR*)zConverted,
                                  NULL,

                                  &bytesPerSector,
                                  NULL,

                                  NULL);
#if SQLITE_OS_WINCE==0
      }else{
        int i;
        /* trim path to just drive reference */
        CHAR *p = (CHAR *)zConverted;
        for(i=0;i<MAX_PATH;i++){
          if( p[i] == '\\' ){
            i++;
            p[i] = '\0';
            break;
          }
        }
        dwRet = GetDiskFreeSpaceA((CHAR*)zConverted,
                                  NULL,

                                  &bytesPerSector,
                                  NULL,

                                  NULL);
#endif
      }
      free(zConverted);
    }
    if( !dwRet ){
      bytesPerSector = SQLITE_DEFAULT_SECTOR_SIZE;
    }







|







 







|







 







<
>

<
>
|













<
>

<
>
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
....
1607
1608
1609
1610
1611
1612
1613

1614
1615

1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630

1631
1632

1633
1634
1635
1636
1637
1638
1639
1640
1641
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.154 2009/04/09 14:27:07 chw Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:
................................................................................
static int getSectorSize(
    sqlite3_vfs *pVfs,
    const char *zRelative     /* UTF-8 file name */
){
  DWORD bytesPerSector = SQLITE_DEFAULT_SECTOR_SIZE;
  char zFullpath[MAX_PATH+1];
  int rc;
  DWORD dwRet = 0, dwDummy;

  /*
  ** We need to get the full path name of the file
  ** to get the drive letter to look up the sector
  ** size.
  */
  rc = winFullPathname(pVfs, zRelative, MAX_PATH, zFullpath);
................................................................................
          if( p[i] == '\\' ){
            i++;
            p[i] = '\0';
            break;
          }
        }
        dwRet = GetDiskFreeSpaceW((WCHAR*)zConverted,

                                  &dwDummy,
                                  &bytesPerSector,

                                  &dwDummy,
                                  &dwDummy);
#if SQLITE_OS_WINCE==0
      }else{
        int i;
        /* trim path to just drive reference */
        CHAR *p = (CHAR *)zConverted;
        for(i=0;i<MAX_PATH;i++){
          if( p[i] == '\\' ){
            i++;
            p[i] = '\0';
            break;
          }
        }
        dwRet = GetDiskFreeSpaceA((CHAR*)zConverted,

                                  &dwDummy,
                                  &bytesPerSector,

                                  &dwDummy,
                                  &dwDummy);
#endif
      }
      free(zConverted);
    }
    if( !dwRet ){
      bytesPerSector = SQLITE_DEFAULT_SECTOR_SIZE;
    }