aboutsummaryrefslogtreecommitdiff
path: root/src/os_win.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-02-06 15:40:32 +0000
committerdrh <drh@noemail.net>2015-02-06 15:40:32 +0000
commit1ee4a2dd88663517c8dd980926af9e76f37c88fb (patch)
treee0bac01b14814f6505c4fc563bb27376da328908 /src/os_win.c
parent9c2e9f7afa07a7763517f0332d3a81e3f9d01d73 (diff)
parent0e55db1cd8748942e3284eb94e774d825ff223fb (diff)
downloadsqlite-1ee4a2dd88663517c8dd980926af9e76f37c88fb.tar.gz
sqlite-1ee4a2dd88663517c8dd980926af9e76f37c88fb.zip
Merge all the latest enhancements from trunk.
FossilOrigin-Name: ae7eef117f28a5dae7a05805f2d31ac532a9fcc5
Diffstat (limited to 'src/os_win.c')
-rw-r--r--src/os_win.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/os_win.c b/src/os_win.c
index e2f9aecac..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 */
/*
@@ -3814,16 +3831,16 @@ static int winShmMap(
void volatile **pp /* OUT: Mapped memory */
){
winFile *pDbFd = (winFile*)fd;
- winShm *p = pDbFd->pShm;
+ winShm *pShm = pDbFd->pShm;
winShmNode *pShmNode;
int rc = SQLITE_OK;
- if( !p ){
+ if( !pShm ){
rc = winOpenSharedMemory(pDbFd);
if( rc!=SQLITE_OK ) return rc;
- p = pDbFd->pShm;
+ pShm = pDbFd->pShm;
}
- pShmNode = p->pShmNode;
+ pShmNode = pShm->pShmNode;
sqlite3_mutex_enter(pShmNode->mutex);
assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );
@@ -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));