/ Check-in [91b50f31]
Login

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

Overview
Comment:Improvements to the xRandomness() method on the default windows VFS. Ticket #2615. (CVS 4374)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 91b50f31e35652a40d51f5d9bf22efce36d515e4
User & Date: drh 2007-09-03 13:06:12
Context
2007-09-03
15:03
Fix a problem in hash.c when replacing entries in tables configured with copyKey==0. (CVS 4375) check-in: a19d3a73 user: danielk1977 tags: trunk
13:06
Improvements to the xRandomness() method on the default windows VFS. Ticket #2615. (CVS 4374) check-in: 91b50f31 user: drh tags: trunk
12:34
Document the fact that xRandomness is only called once from the default VFS. Ticket #2614. (CVS 4373) check-in: e89d4131 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

1417
1418
1419
1420
1421
1422
1423

1424
1425
1426
1427
1428

1429

















1430
1431
1432
1433
1434
1435
1436
#endif


/*
** Write up to nBuf bytes of randomness into zBuf.
*/
static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){

  if( sizeof(LPSYSTEMTIME)>=nBuf ){
    GetSystemTime((LPSYSTEMTIME)zBuf);
    return sizeof(LPSYSTEMTIME);
  }else{
    return 0;

  }

















}


/*
** Sleep for a little while.  Return the amount of time slept.
*/
static int winSleep(sqlite3_vfs *pVfs, int microsec){







>
|
<
|
|
|
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1417
1418
1419
1420
1421
1422
1423
1424
1425

1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
#endif


/*
** Write up to nBuf bytes of randomness into zBuf.
*/
static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  int n = 0;
  if( sizeof(LPSYSTEMTIME)<=nBuf-n ){

    SYSTEMTIME x;
    GetSystemTime(&x);
    memcpy(&zBuf[n], &x, sizeof(x));
    n += sizeof(x);
  }
  if( sizeof(DWORD)<=nBuf-n ){
    DWORD pid = GetCurrentProcessId();
    memcpy(&zBuf[n], &pid, sizeof(pid));
    n += sizeof(pid);
  }
  if( sizeof(DWORD)<=nBuf-n ){
    DWORD cnt = GetTickCount();
    memcpy(&zBuf[n], &cnt, sizeof(cnt));
    n += sizeof(cnt);
  }
  if( sizeof(LARGE_INTEGER)<=nBuf-n ){
    LARGE_INTEGER i;
    QueryPerformanceCounter(&i);
    memcpy(&zBuf[n], &i, sizeof(i));
    n += sizeof(i);
  }
  return n;
}


/*
** Sleep for a little while.  Return the amount of time slept.
*/
static int winSleep(sqlite3_vfs *pVfs, int microsec){