Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
250cac32
Commit
250cac32
authored
Aug 15, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement WinHttpTimeFromSystemTime and WinHttpTimeToSystemTime.
parent
877d6c95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
28 deletions
+119
-28
main.c
dlls/winhttp/main.c
+0
-22
session.c
dlls/winhttp/session.c
+113
-0
winhttp.c
dlls/winhttp/tests/winhttp.c
+6
-6
No files found.
dlls/winhttp/main.c
View file @
250cac32
...
...
@@ -165,28 +165,6 @@ BOOL WINAPI WinHttpWriteData (HINTERNET hRequest, LPCVOID lpBuffer,
}
/***********************************************************************
* WinHttpTimeFromSystemTime (winhttp.@)
*/
BOOL
WINAPI
WinHttpTimeFromSystemTime
(
CONST
SYSTEMTIME
*
pst
,
LPWSTR
pwszTime
)
{
FIXME
(
"(%p, %p): stub
\n
"
,
pst
,
pwszTime
);
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
FALSE
;
}
/***********************************************************************
* WinHttpTimeToSystemTime (winhttp.@)
*/
BOOL
WINAPI
WinHttpTimeToSystemTime
(
LPCWSTR
pwszTime
,
SYSTEMTIME
*
pst
)
{
FIXME
(
"(%s, %p): stub
\n
"
,
debugstr_w
(
pwszTime
),
pst
);
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
FALSE
;
}
/***********************************************************************
* WinHttpQueryHeaders (winhttp.@)
*/
BOOL
WINAPI
WinHttpQueryHeaders
(
HINTERNET
hRequest
,
DWORD
dwInfoLevel
,
LPCWSTR
pwszName
,
...
...
dlls/winhttp/session.c
View file @
250cac32
...
...
@@ -391,3 +391,116 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT
release_object
(
hdr
);
return
ret
;
}
static
const
WCHAR
wkday
[
7
][
4
]
=
{{
'S'
,
'u'
,
'n'
,
0
},
{
'M'
,
'o'
,
'n'
,
0
},
{
'T'
,
'u'
,
'e'
,
0
},
{
'W'
,
'e'
,
'd'
,
0
},
{
'T'
,
'h'
,
'u'
,
0
},
{
'F'
,
'r'
,
'i'
,
0
},
{
'S'
,
'a'
,
't'
,
0
}};
static
const
WCHAR
month
[
12
][
4
]
=
{{
'J'
,
'a'
,
'n'
,
0
},
{
'F'
,
'e'
,
'b'
,
0
},
{
'M'
,
'a'
,
'r'
,
0
},
{
'A'
,
'p'
,
'r'
,
0
},
{
'M'
,
'a'
,
'y'
,
0
},
{
'J'
,
'u'
,
'n'
,
0
},
{
'J'
,
'u'
,
'l'
,
0
},
{
'A'
,
'u'
,
'g'
,
0
},
{
'S'
,
'e'
,
'p'
,
0
},
{
'O'
,
'c'
,
't'
,
0
},
{
'N'
,
'o'
,
'v'
,
0
},
{
'D'
,
'e'
,
'c'
,
0
}};
/***********************************************************************
* WinHttpTimeFromSystemTime (WININET.@)
*/
BOOL
WINAPI
WinHttpTimeFromSystemTime
(
const
SYSTEMTIME
*
time
,
LPWSTR
string
)
{
static
const
WCHAR
format
[]
=
{
'%'
,
's'
,
','
,
' '
,
'%'
,
'0'
,
'2'
,
'd'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'4'
,
'd'
,
' '
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
' '
,
'G'
,
'M'
,
'T'
,
0
};
TRACE
(
"%p, %p
\n
"
,
time
,
string
);
if
(
!
time
||
!
string
)
return
FALSE
;
sprintfW
(
string
,
format
,
wkday
[
time
->
wDayOfWeek
],
time
->
wDay
,
month
[
time
->
wMonth
-
1
],
time
->
wYear
,
time
->
wHour
,
time
->
wMinute
,
time
->
wSecond
);
return
TRUE
;
}
/***********************************************************************
* WinHttpTimeToSystemTime (WININET.@)
*/
BOOL
WINAPI
WinHttpTimeToSystemTime
(
LPCWSTR
string
,
SYSTEMTIME
*
time
)
{
unsigned
int
i
;
const
WCHAR
*
s
=
string
;
WCHAR
*
end
;
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
string
),
time
);
if
(
!
string
||
!
time
)
return
FALSE
;
/* Windows does this too */
GetSystemTime
(
time
);
/* Convert an RFC1123 time such as 'Fri, 07 Jan 2005 12:06:35 GMT' into
* a SYSTEMTIME structure.
*/
while
(
*
s
&&
!
isalphaW
(
*
s
))
s
++
;
if
(
s
[
0
]
==
'\0'
||
s
[
1
]
==
'\0'
||
s
[
2
]
==
'\0'
)
return
TRUE
;
time
->
wDayOfWeek
=
7
;
for
(
i
=
0
;
i
<
7
;
i
++
)
{
if
(
toupperW
(
wkday
[
i
][
0
]
)
==
toupperW
(
s
[
0
]
)
&&
toupperW
(
wkday
[
i
][
1
]
)
==
toupperW
(
s
[
1
]
)
&&
toupperW
(
wkday
[
i
][
2
]
)
==
toupperW
(
s
[
2
]
)
)
{
time
->
wDayOfWeek
=
i
;
break
;
}
}
if
(
time
->
wDayOfWeek
>
6
)
return
TRUE
;
while
(
*
s
&&
!
isdigitW
(
*
s
))
s
++
;
time
->
wDay
=
strtolW
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
isalphaW
(
*
s
))
s
++
;
if
(
s
[
0
]
==
'\0'
||
s
[
1
]
==
'\0'
||
s
[
2
]
==
'\0'
)
return
TRUE
;
time
->
wMonth
=
0
;
for
(
i
=
0
;
i
<
12
;
i
++
)
{
if
(
toupperW
(
month
[
i
][
0
])
==
toupperW
(
s
[
0
]
)
&&
toupperW
(
month
[
i
][
1
])
==
toupperW
(
s
[
1
]
)
&&
toupperW
(
month
[
i
][
2
])
==
toupperW
(
s
[
2
]
)
)
{
time
->
wMonth
=
i
+
1
;
break
;
}
}
if
(
time
->
wMonth
==
0
)
return
TRUE
;
while
(
*
s
&&
!
isdigitW
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wYear
=
strtolW
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
isdigitW
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wHour
=
strtolW
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
isdigitW
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wMinute
=
strtolW
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
isdigitW
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wSecond
=
strtolW
(
s
,
&
end
,
10
);
s
=
end
;
time
->
wMilliseconds
=
0
;
return
TRUE
;
}
dlls/winhttp/tests/winhttp.c
View file @
250cac32
...
...
@@ -151,8 +151,8 @@ static void test_WinHttpTimeFromSystemTime(void)
WCHAR
time_string
[
WINHTTP_TIME_FORMAT_BUFSIZE
+
1
];
ret
=
WinHttpTimeFromSystemTime
(
&
time
,
time_string
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpTimeFromSystemTime failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
memcmp
(
time_string
,
expected_string
,
sizeof
(
expected_string
))
==
0
,
ok
(
ret
==
TRUE
,
"WinHttpTimeFromSystemTime failed: %u
\n
"
,
GetLastError
());
ok
(
memcmp
(
time_string
,
expected_string
,
sizeof
(
expected_string
))
==
0
,
"Time string returned did not match expected time string.
\n
"
);
}
...
...
@@ -169,13 +169,13 @@ static void test_WinHttpTimeToSystemTime(void)
'1'
,
'0'
,
' '
,
'0'
,
'5'
,
' '
,
'5'
,
'2'
,
'\n'
,
0
};
ret
=
WinHttpTimeToSystemTime
(
time_string1
,
&
time
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpTimeToSystemTime failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
memcmp
(
&
time
,
&
expected_time
,
sizeof
(
SYSTEMTIME
))
==
0
,
ok
(
ret
==
TRUE
,
"WinHttpTimeToSystemTime failed: %u
\n
"
,
GetLastError
());
ok
(
memcmp
(
&
time
,
&
expected_time
,
sizeof
(
SYSTEMTIME
))
==
0
,
"Returned SYSTEMTIME structure did not match expected SYSTEMTIME structure.
\n
"
);
ret
=
WinHttpTimeToSystemTime
(
time_string2
,
&
time
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpTimeToSystemTime failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
memcmp
(
&
time
,
&
expected_time
,
sizeof
(
SYSTEMTIME
))
==
0
,
ok
(
ret
==
TRUE
,
"WinHttpTimeToSystemTime failed: %u
\n
"
,
GetLastError
());
ok
(
memcmp
(
&
time
,
&
expected_time
,
sizeof
(
SYSTEMTIME
))
==
0
,
"Returned SYSTEMTIME structure did not match expected SYSTEMTIME structure.
\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