35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
|
35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148
35149
35150
35151
35152
35153
35154
35155
35156
35157
35158
35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
35169
35170
35171
|
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
|
}
#endif
/*
** Convert a UTF-8 filename into whatever form the underlying
** operating system wants filenames in. Space to hold the result
** is obtained from malloc and must be freed by the calling
** function.
** function. When running on NT and zFilename is absolute, the
** resulting path is guaranteed to start with "\\?\".
*/
static void *winConvertFromUtf8Filename(const char *zFilename){
void *zConverted = 0;
if( osIsNT() ){
int nChar;
LPWSTR zWideFilename;
nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);
if( nChar==0 ){
return 0;
}
zWideFilename = sqlite3MallocZero( (nChar*sizeof(zWideFilename[0]))+12 );
if( zWideFilename==0 ){
return 0;
}
if( winIsDirSep(zFilename[0]) && winIsDirSep(zFilename[1]) ){
memcpy(zWideFilename, L"\\\\?\\UNC\\", 16);
nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename+6,
nChar);
}else if( winIsDriveLetterAndColon(zFilename) && winIsDirSep(zFilename[2])) {
memcpy(zWideFilename, L"\\\\?\\", 8);
nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename+4,
nChar);
zWideFilename[6] = '\\';
}else{
nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename,
nChar);
}
if( nChar==0 ){
sqlite3_free(zWideFilename);
zWideFilename = 0;
}
zConverted = winUtf8ToUnicode(zFilename);
zConverted = zWideFilename;
}
#ifdef SQLITE_WIN32_HAS_ANSI
else{
zConverted = sqlite3_win32_utf8_to_mbcs(zFilename);
}
#endif
/* caller will handle out of memory */
|
36059
36060
36061
36062
36063
36064
36065
36066
36067
36068
36069
36070
36071
36072
36073
|
36088
36089
36090
36091
36092
36093
36094
36095
36096
36097
36098
36099
36100
36101
36102
36103
36104
36105
36106
|
+
-
+
+
+
+
|
** for converting the relative path name to an absolute
** one by prepending the data directory and a backslash.
*/
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
sqlite3_data_directory, winGetDirSep(), zRelative);
return SQLITE_OK;
}
if( osIsNT() ){
zConverted = winConvertFromUtf8Filename(zRelative);
zConverted = winUtf8ToUnicode(zRelative);
}else{
zConverted = sqlite3_win32_utf8_to_mbcs(zFilename);;
}
if( zConverted==0 ){
return SQLITE_IOERR_NOMEM;
}
if( osIsNT() ){
LPWSTR zTemp;
nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0);
if( nByte==0 ){
|