mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-23 21:49:02 +03:00
On Windows, use only GetSystemTimeAsFileTime() and not GetSystemTime().
Also add a TCL script that will renumber the systemcall thunk for Windows. FossilOrigin-Name: 4b7f0130d68c7a0b98e87d09d0a661c85554215cb111478305307960deab3921
This commit is contained in:
15
manifest
15
manifest
@@ -1,5 +1,5 @@
|
||||
C Modify\s[2990dd27dd]\sto\suse\ssetlocale(LC_CTYPE)\sinstead\sof\ssetlocale(LC_ALL).\sSame\seffect\sbut\shypothetically\sa\ssmaller\sscope.
|
||||
D 2026-05-13T12:12:54.638
|
||||
C On\sWindows,\suse\sonly\sGetSystemTimeAsFileTime()\sand\snot\sGetSystemTime().\nAlso\sadd\sa\sTCL\sscript\sthat\swill\srenumber\sthe\ssystemcall\sthunk\sfor\sWindows.
|
||||
D 2026-05-13T13:55:31.932
|
||||
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
@@ -722,7 +722,7 @@ F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e
|
||||
F src/os_kv.c e7d96727db5b67e39d590a68cc61c86daf4c093c36c011a09ebfb521182ec28d
|
||||
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
|
||||
F src/os_unix.c a07dce662f6c4e18098f6faa9f7ec7cf311f56ee9151bed2aad4dcd55852c9e2
|
||||
F src/os_win.c 61393d1aa4f0c18103c6adb80d344d89996ee17b9ad73f9619fce40de50546de
|
||||
F src/os_win.c 908bde3c5d029a5f338db5e21c9dca0979060390c4a8616cee786955f6c43603
|
||||
F src/os_win.h c06ccc3a090cf54202ea58981c298817f3309d4c9e4d52ad0a02927346493721
|
||||
F src/pager.c fbec9063ea139dfa5d94ce540671752b89f8e8dc38f8a1f614bab1aa04a2dd40
|
||||
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
|
||||
@@ -2169,6 +2169,7 @@ F tool/omittest-msvc.tcl d6b8f501ac1d7798c4126065030f89812379012cad98a1735d6d722
|
||||
F tool/omittest.tcl 436b7072e00e25e9b77145a9f67aa8e0eeabd186168827435fd03f8f981aac32
|
||||
F tool/opcodesum.tcl 740ed206ba8c5040018988129abbf3089a0ccf4a
|
||||
F tool/pagesig.c f98909b4168d9cac11a2de7f031adea0e2f3131faa7515a72807c03ec58eafeb
|
||||
F tool/renumber-win-thunk.tcl 19a06c1bd66fa9f0c58de6ee051aad1f6b956f020d71387ccbe456f048c12e8c
|
||||
F tool/replace.tcl 511c61acfe563dfb58675efb4628bb158a13d48ff8322123ac447e9d25a82d9a
|
||||
F tool/restore_jrnl.tcl 1079ecba47cc82fa82115b81c1f68097ab1f956f357ee8da5fc4b2589af6bd98
|
||||
F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5
|
||||
@@ -2204,8 +2205,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
|
||||
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
|
||||
P 2990dd27dda4333e8ccf9225ff5af690d4062276dd2ad60ee7df922aa6be99ee
|
||||
R 4ab90ff9ef1f9418395398ad50e37f83
|
||||
U stephan
|
||||
Z 2465d551c9087e163d89675a8bcf820b
|
||||
P 8be57f96f6a72753fd983d7b6b9924c3b60f57c5664eeb7dfe7a0799739597c0
|
||||
R 6bce906e3e36ec3e997e4af868126bac
|
||||
U drh
|
||||
Z 9580b0800b750e87c90fb5dc45800b49
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1 +1 @@
|
||||
8be57f96f6a72753fd983d7b6b9924c3b60f57c5664eeb7dfe7a0799739597c0
|
||||
4b7f0130d68c7a0b98e87d09d0a661c85554215cb111478305307960deab3921
|
||||
|
||||
107
src/os_win.c
107
src/os_win.c
@@ -436,47 +436,44 @@ static struct win_syscall {
|
||||
{ "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
|
||||
#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[15].pCurrent)
|
||||
|
||||
{ "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
|
||||
#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[16].pCurrent)
|
||||
|
||||
{ "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 },
|
||||
#define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \
|
||||
LPFILETIME))aSyscall[17].pCurrent)
|
||||
LPFILETIME))aSyscall[16].pCurrent)
|
||||
|
||||
{ "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
|
||||
#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[18].pCurrent)
|
||||
#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[17].pCurrent)
|
||||
|
||||
{ "GetTickCount64", (SYSCALL)GetTickCount64, 0 },
|
||||
#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[19].pCurrent)
|
||||
#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[18].pCurrent)
|
||||
|
||||
{ "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
|
||||
#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
|
||||
SIZE_T))aSyscall[20].pCurrent)
|
||||
SIZE_T))aSyscall[19].pCurrent)
|
||||
|
||||
{ "HeapCreate", (SYSCALL)HeapCreate, 0 },
|
||||
#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
|
||||
SIZE_T))aSyscall[21].pCurrent)
|
||||
SIZE_T))aSyscall[20].pCurrent)
|
||||
|
||||
{ "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
|
||||
#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[22].pCurrent)
|
||||
#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[21].pCurrent)
|
||||
|
||||
{ "HeapFree", (SYSCALL)HeapFree, 0 },
|
||||
#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[23].pCurrent)
|
||||
#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[22].pCurrent)
|
||||
|
||||
{ "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 },
|
||||
#define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \
|
||||
SIZE_T))aSyscall[24].pCurrent)
|
||||
SIZE_T))aSyscall[23].pCurrent)
|
||||
|
||||
{ "HeapSize", (SYSCALL)HeapSize, 0 },
|
||||
#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
|
||||
LPCVOID))aSyscall[25].pCurrent)
|
||||
LPCVOID))aSyscall[24].pCurrent)
|
||||
|
||||
{ "HeapValidate", (SYSCALL)HeapValidate, 0 },
|
||||
#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
|
||||
LPCVOID))aSyscall[26].pCurrent)
|
||||
LPCVOID))aSyscall[25].pCurrent)
|
||||
|
||||
{ "HeapCompact", (SYSCALL)HeapCompact, 0 },
|
||||
#define osHeapCompact ((UINT(WINAPI*)(HANDLE,DWORD))aSyscall[27].pCurrent)
|
||||
#define osHeapCompact ((UINT(WINAPI*)(HANDLE,DWORD))aSyscall[26].pCurrent)
|
||||
|
||||
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||
@@ -484,14 +481,14 @@ static struct win_syscall {
|
||||
#else
|
||||
{ "LoadLibraryW", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[28].pCurrent)
|
||||
#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[27].pCurrent)
|
||||
|
||||
{ "LocalFree", (SYSCALL)LocalFree, 0 },
|
||||
#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[29].pCurrent)
|
||||
#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[28].pCurrent)
|
||||
|
||||
{ "LockFileEx", (SYSCALL)LockFileEx, 0 },
|
||||
#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
|
||||
LPOVERLAPPED))aSyscall[30].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[29].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
|
||||
{ "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
|
||||
@@ -499,62 +496,62 @@ static struct win_syscall {
|
||||
{ "MapViewOfFile", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
|
||||
SIZE_T))aSyscall[31].pCurrent)
|
||||
SIZE_T))aSyscall[30].pCurrent)
|
||||
|
||||
{ "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 },
|
||||
#define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \
|
||||
int))aSyscall[32].pCurrent)
|
||||
int))aSyscall[31].pCurrent)
|
||||
|
||||
{ "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 },
|
||||
#define osQueryPerformanceCounter ((BOOL(WINAPI*)( \
|
||||
LARGE_INTEGER*))aSyscall[33].pCurrent)
|
||||
LARGE_INTEGER*))aSyscall[32].pCurrent)
|
||||
|
||||
{ "ReadFile", (SYSCALL)ReadFile, 0 },
|
||||
#define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \
|
||||
LPOVERLAPPED))aSyscall[34].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[33].pCurrent)
|
||||
|
||||
{ "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 },
|
||||
#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[35].pCurrent)
|
||||
#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[34].pCurrent)
|
||||
|
||||
{ "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
|
||||
#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
|
||||
DWORD))aSyscall[36].pCurrent)
|
||||
DWORD))aSyscall[35].pCurrent)
|
||||
|
||||
{ "Sleep", (SYSCALL)Sleep, 0 },
|
||||
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[37].pCurrent)
|
||||
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[36].pCurrent)
|
||||
|
||||
{ "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 },
|
||||
#define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
|
||||
LPOVERLAPPED))aSyscall[38].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[37].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
|
||||
{ "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 },
|
||||
#else
|
||||
{ "UnmapViewOfFile", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[39].pCurrent)
|
||||
#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[38].pCurrent)
|
||||
|
||||
{ "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 },
|
||||
#define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \
|
||||
LPCSTR,LPBOOL))aSyscall[40].pCurrent)
|
||||
LPCSTR,LPBOOL))aSyscall[39].pCurrent)
|
||||
|
||||
{ "WriteFile", (SYSCALL)WriteFile, 0 },
|
||||
#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
|
||||
LPOVERLAPPED))aSyscall[41].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[40].pCurrent)
|
||||
|
||||
{ "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 },
|
||||
#define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \
|
||||
DWORD))aSyscall[42].pCurrent)
|
||||
DWORD))aSyscall[41].pCurrent)
|
||||
|
||||
{ "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 },
|
||||
#define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
|
||||
BOOL))aSyscall[43].pCurrent)
|
||||
BOOL))aSyscall[42].pCurrent)
|
||||
|
||||
{ "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 },
|
||||
#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
|
||||
#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[43].pCurrent)
|
||||
|
||||
{ "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
|
||||
#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[45].pCurrent)
|
||||
#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[44].pCurrent)
|
||||
|
||||
/*
|
||||
** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
|
||||
@@ -567,7 +564,7 @@ static struct win_syscall {
|
||||
#else
|
||||
{ "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 },
|
||||
#define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG volatile*,\
|
||||
LONG,LONG))aSyscall[46].pCurrent)
|
||||
LONG,LONG))aSyscall[45].pCurrent)
|
||||
#endif /* defined(InterlockedCompareExchange) */
|
||||
|
||||
#if SQLITE_WIN32_USE_UUID
|
||||
@@ -575,7 +572,7 @@ static struct win_syscall {
|
||||
#else
|
||||
{ "UuidCreate", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[47].pCurrent)
|
||||
#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[46].pCurrent)
|
||||
|
||||
#if SQLITE_WIN32_USE_UUID
|
||||
{ "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
|
||||
@@ -583,7 +580,7 @@ static struct win_syscall {
|
||||
{ "UuidCreateSequential", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osUuidCreateSequential \
|
||||
((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[48].pCurrent)
|
||||
((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[47].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_NO_SYNC) && SQLITE_MAX_MMAP_SIZE>0
|
||||
{ "FlushViewOfFile", (SYSCALL)FlushViewOfFile, 0 },
|
||||
@@ -591,59 +588,57 @@ static struct win_syscall {
|
||||
{ "FlushViewOfFile", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osFlushViewOfFile \
|
||||
((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[49].pCurrent)
|
||||
((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[48].pCurrent)
|
||||
|
||||
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
|
||||
{ "CreateEvent", (SYSCALL)CreateEvent, 0 },
|
||||
#else
|
||||
{ "CreateEvent", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osCreateEvent ( \
|
||||
(HANDLE(WINAPI*) (LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR)) \
|
||||
aSyscall[50].pCurrent \
|
||||
)
|
||||
#define osCreateEvent ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \
|
||||
BOOL,LPCSTR))aSyscall[49].pCurrent)
|
||||
|
||||
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
|
||||
{ "CancelIo", (SYSCALL)CancelIo, 0 },
|
||||
#else
|
||||
{ "CancelIo", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[51].pCurrent)
|
||||
#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[50].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "getenv", (SYSCALL)getenv, 0 },
|
||||
#else
|
||||
{ "getenv", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osGetenv ((const char *(*)(const char *))aSyscall[52].pCurrent)
|
||||
#define osGetenv ((const char *(*)(const char *))aSyscall[51].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "getcwd", (SYSCALL)getcwd, 0 },
|
||||
#else
|
||||
{ "getcwd", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osGetcwd ((char*(*)(char*,size_t))aSyscall[53].pCurrent)
|
||||
#define osGetcwd ((char*(*)(char*,size_t))aSyscall[52].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "readlink", (SYSCALL)readlink, 0 },
|
||||
#else
|
||||
{ "readlink", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[54].pCurrent)
|
||||
#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[53].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "lstat", (SYSCALL)lstat, 0 },
|
||||
#else
|
||||
{ "lstat", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osLstat ((int(*)(const char*,struct stat*))aSyscall[55].pCurrent)
|
||||
#define osLstat ((int(*)(const char*,struct stat*))aSyscall[54].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "__errno", (SYSCALL)__errno, 0 },
|
||||
#else
|
||||
{ "__errno", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osErrno (*((int*(*)(void))aSyscall[56].pCurrent)())
|
||||
#define osErrno (*((int*(*)(void))aSyscall[55].pCurrent)())
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "cygwin_conv_path", (SYSCALL)cygwin_conv_path, 0 },
|
||||
@@ -651,7 +646,7 @@ static struct win_syscall {
|
||||
{ "cygwin_conv_path", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
#define osCygwin_conv_path ((size_t(*)(unsigned int, \
|
||||
const void *, void *, size_t))aSyscall[57].pCurrent)
|
||||
const void *, void *, size_t))aSyscall[56].pCurrent)
|
||||
|
||||
}; /* End of the overrideable system calls */
|
||||
|
||||
@@ -4986,9 +4981,9 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
||||
e.nXor = 0;
|
||||
e.i = 0;
|
||||
{
|
||||
SYSTEMTIME x;
|
||||
osGetSystemTime(&x);
|
||||
xorMemory(&e, (unsigned char*)&x, sizeof(SYSTEMTIME));
|
||||
FILETIME x;
|
||||
osGetSystemTimeAsFileTime(&x);
|
||||
xorMemory(&e, (unsigned char*)&x, sizeof(FILETIME));
|
||||
}
|
||||
{
|
||||
DWORD pid = osGetCurrentProcessId();
|
||||
@@ -5230,11 +5225,15 @@ int sqlite3_os_init(void){
|
||||
|
||||
/* Double-check that the aSyscall[] array has been constructed
|
||||
** correctly. See ticket [bb3a86e890c8e96ab] */
|
||||
assert( ArraySize(aSyscall)==58 );
|
||||
assert( ArraySize(aSyscall)==57 );
|
||||
assert( strcmp(aSyscall[0].zName,"AreFileApisANSI")==0 );
|
||||
assert( strcmp(aSyscall[20].zName,"HeapAlloc")==0 );
|
||||
assert( strcmp(aSyscall[40].zName,"WideCharToMultiByte")==0 );
|
||||
assert( strcmp(aSyscall[57].zName,"cygwin_conv_path")==0 );
|
||||
assert( strcmp(aSyscall[8].zName,"GetCurrentProcessId")==0 );
|
||||
assert( strcmp(aSyscall[16].zName,"GetSystemTimeAsFileTime")==0 );
|
||||
assert( strcmp(aSyscall[24].zName,"HeapSize")==0 );
|
||||
assert( strcmp(aSyscall[32].zName,"QueryPerformanceCounter")==0 );
|
||||
assert( strcmp(aSyscall[40].zName,"WriteFile")==0 );
|
||||
assert( strcmp(aSyscall[48].zName,"FlushViewOfFile")==0 );
|
||||
assert( strcmp(aSyscall[56].zName,"cygwin_conv_path")==0 );
|
||||
|
||||
/* get memory map allocation granularity */
|
||||
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
|
||||
|
||||
50
tool/renumber-win-thunk.tcl
Normal file
50
tool/renumber-win-thunk.tcl
Normal file
@@ -0,0 +1,50 @@
|
||||
# Run this TCL script to renumber the entries in the
|
||||
# aSyscall[] thunk of the src/os_win.c file. There should
|
||||
# be one argument which is the filename of the src/os_win.c
|
||||
# file. Ex:
|
||||
#
|
||||
# tclsh tool/renumber-win-thunk.tcl src/os_win.c
|
||||
#
|
||||
if {[llength $argv]!=1} {
|
||||
puts stderr "Usage: tclsh [info script] FILENAME"
|
||||
exit 1
|
||||
}
|
||||
set FILENAME [lindex $argv 0]
|
||||
set fd [open $FILENAME rb]
|
||||
set newtext {}
|
||||
set ctr 0
|
||||
set entryPending 0
|
||||
while {![eof $fd]} {
|
||||
set line [gets $fd]
|
||||
if {$line eq "" && [eof $fd]} break
|
||||
if {[regexp {^#define os([A-Z][_a-zA-Z0-9]+) } $line all nm]} {
|
||||
if {[regexp {^Cygwin} $nm]} {set nm [string tolower $nm]}
|
||||
set syscall_name($ctr) $nm
|
||||
set syscall_idx($nm) $ctr
|
||||
set entryPending 1
|
||||
}
|
||||
if {$entryPending && [regexp {aSyscall\[(\d+)\]\.pCurrent} $line all n]} {
|
||||
regsub {aSyscall\[\d+\]\.pCurrent} $line "aSyscall\[$ctr\].pCurrent" line
|
||||
if {$n!=$ctr} {puts "$n -> $ctr"}
|
||||
incr ctr
|
||||
set entryPending 0
|
||||
}
|
||||
if {[regexp {ArraySize\(aSyscall\)==\d+} $line]} {
|
||||
regsub {ArraySize\(aSyscall\)==\d+} $line "ArraySize(aSyscall)==$ctr" line
|
||||
append newtext $line\n
|
||||
for {set i 0} {$i<$ctr} {incr i 8} {
|
||||
set nm $syscall_name($i)
|
||||
append newtext \
|
||||
" assert( strcmp(aSyscall\[$i\].zName,\"$nm\")==0 );\n"
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if {[regexp {^ assert\( strcmp\(aSyscall\[(\d+)\].zName,} $line n]} {
|
||||
continue
|
||||
}
|
||||
append newtext $line\n
|
||||
}
|
||||
close $fd
|
||||
set fd [open $FILENAME wb]
|
||||
puts -nonewline $fd $newtext
|
||||
close $fd
|
||||
Reference in New Issue
Block a user