aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormistachkin <mistachkin@noemail.net>2015-01-21 00:48:46 +0000
committermistachkin <mistachkin@noemail.net>2015-01-21 00:48:46 +0000
commite45e0fb21c4987172d8ed8b6d0e71a30878f16fc (patch)
tree43833ac0c4695a738b7e98080ad333ba7b080cda /src
parentfe201effbe35d38fdd198be93b23abe7583b2aa9 (diff)
downloadsqlite-e45e0fb21c4987172d8ed8b6d0e71a30878f16fc.tar.gz
sqlite-e45e0fb21c4987172d8ed8b6d0e71a30878f16fc.zip
Enhancements to entropy generation for the Win32 VFS.
FossilOrigin-Name: 26190b3c63e18f3116deeb59a58d9b5de48e8eea
Diffstat (limited to 'src')
-rw-r--r--src/os_win.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/os_win.c b/src/os_win.c
index c938a4d7d..7463778a2 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -1066,6 +1066,23 @@ static struct win_syscall {
SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent)
#endif /* defined(InterlockedCompareExchange) */
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
+ { "UuidCreate", (SYSCALL)UuidCreate, 0 },
+#else
+ { "UuidCreate", (SYSCALL)0, 0 },
+#endif
+
+#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
+ { "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
+#else
+ { "UuidCreateSequential", (SYSCALL)0, 0 },
+#endif
+
+#define osUuidCreateSequential \
+ ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[78].pCurrent)
+
}; /* End of the overrideable system calls */
/*
@@ -5345,6 +5362,22 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
n += sizeof(i);
}
#endif
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
+ if( sizeof(UUID)<=nBuf-n ){
+ UUID id;
+ memset(&id, 0, sizeof(UUID));
+ osUuidCreate(&id);
+ memcpy(zBuf, &id, sizeof(UUID));
+ n += sizeof(UUID);
+ }
+ if( sizeof(UUID)<=nBuf-n ){
+ UUID id;
+ memset(&id, 0, sizeof(UUID));
+ osUuidCreateSequential(&id);
+ memcpy(zBuf, &id, sizeof(UUID));
+ n += sizeof(UUID);
+ }
+#endif
return n;
}
@@ -5522,7 +5555,7 @@ int sqlite3_os_init(void){
/* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */
- assert( ArraySize(aSyscall)==77 );
+ assert( ArraySize(aSyscall)==79 );
/* get memory map allocation granularity */
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));