Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e4a02816
Commit
e4a02816
authored
Oct 01, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Added support for urlcache file name generating.
parent
ee47def0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
urlcache.c
dlls/wininet/urlcache.c
+29
-12
No files found.
dlls/wininet/urlcache.c
View file @
e4a02816
...
...
@@ -2861,13 +2861,13 @@ BOOL WINAPI CreateUrlCacheEntryW(
BYTE
CacheDir
;
LONG
lBufferSize
;
BOOL
bFound
=
FALSE
;
BOOL
generate_name
=
FALSE
;
int
count
;
DWORD
error
;
HANDLE
hFile
;
FILETIME
ft
;
static
const
WCHAR
szWWW
[]
=
{
'w'
,
'w'
,
'w'
,
0
};
static
const
WCHAR
fmt
[]
=
{
'%'
,
'0'
,
'8'
,
'X'
,
'%'
,
's'
,
0
};
TRACE
(
"(%s, 0x%08x, %s, %p, 0x%08x)
\n
"
,
debugstr_w
(
lpszUrlName
),
...
...
@@ -2879,7 +2879,7 @@ BOOL WINAPI CreateUrlCacheEntryW(
if
(
dwReserved
)
FIXME
(
"dwReserved 0x%08x
\n
"
,
dwReserved
);
lpszUrlEnd
=
lpszUrlName
+
strlenW
(
lpszUrlName
);
lpszUrlEnd
=
lpszUrlName
+
strlenW
(
lpszUrlName
);
if
(((
lpszUrlEnd
-
lpszUrlName
)
>
1
)
&&
(
*
(
lpszUrlEnd
-
1
)
==
'/'
||
*
(
lpszUrlEnd
-
1
)
==
'\\'
))
lpszUrlEnd
--
;
...
...
@@ -2917,14 +2917,14 @@ BOOL WINAPI CreateUrlCacheEntryW(
while
(
len
&&
szFile
[
--
len
]
==
'/'
)
szFile
[
len
]
=
'\0'
;
/* FIXME: get rid of illegal characters like \, / and : */
TRACE
(
"File name: %s
\n
"
,
debugstr_a
(
szFile
));
}
else
{
FIXME
(
"need to generate a random filename
\n
"
);
generate_name
=
TRUE
;
szFile
[
0
]
=
0
;
}
TRACE
(
"File name: %s
\n
"
,
debugstr_a
(
szFile
));
error
=
URLCacheContainers_FindContainerW
(
lpszUrlName
,
&
pContainer
);
if
(
error
!=
ERROR_SUCCESS
)
{
...
...
@@ -2978,7 +2978,7 @@ BOOL WINAPI CreateUrlCacheEntryW(
lstrcpyW
(
szExtension
+
1
,
lpszFileExtension
);
}
for
(
i
=
0
;
i
<
255
;
i
++
)
for
(
i
=
0
;
i
<
255
&&
!
generate_name
;
i
++
)
{
static
const
WCHAR
szFormat
[]
=
{
'['
,
'%'
,
'u'
,
']'
,
'%'
,
's'
,
0
};
WCHAR
*
p
;
...
...
@@ -3008,15 +3008,32 @@ BOOL WINAPI CreateUrlCacheEntryW(
}
}
/* Try to generate random name */
GetSystemTimeAsFileTime
(
&
ft
);
wsprintfW
(
lpszFileNameNoPath
+
countnoextension
,
fmt
,
ft
.
dwLowDateTime
,
szExtension
);
strcpyW
(
lpszFileNameNoPath
+
countnoextension
+
8
,
szExtension
);
TRACE
(
"Trying: %s
\n
"
,
debugstr_w
(
lpszFileName
));
hFile
=
CreateFileW
(
lpszFileName
,
GENERIC_READ
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
for
(
i
=
0
;
i
<
255
;
i
++
)
{
CloseHandle
(
hFile
);
return
TRUE
;
int
j
;
ULONGLONG
n
=
ft
.
dwHighDateTime
;
n
<<=
32
;
n
+=
ft
.
dwLowDateTime
;
n
^=
(
ULONGLONG
)
i
<<
48
;
for
(
j
=
0
;
j
<
8
;
j
++
)
{
int
r
=
(
n
%
36
);
n
/=
37
;
lpszFileNameNoPath
[
countnoextension
+
j
]
=
(
r
<
10
?
'0'
+
r
:
'A'
+
r
-
10
);
}
TRACE
(
"Trying: %s
\n
"
,
debugstr_w
(
lpszFileName
));
hFile
=
CreateFileW
(
lpszFileName
,
GENERIC_READ
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hFile
);
return
TRUE
;
}
}
WARN
(
"Could not find a unique filename
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment