diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 393cde5a55e..1a92c89463f 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2155,14 +2155,17 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r TRACE( "%s %p 0x%08lx\n", debugstr_w(string), time, reserved ); - if (!string || !time || reserved != 0) return FALSE; + 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 FALSE; + if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; time->wDayOfWeek = 7; for (i = 0; i < 7; i++) @@ -2176,12 +2179,12 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r } } - if (time->wDayOfWeek > 6) return FALSE; + if (time->wDayOfWeek > 6) return TRUE; while (*s && !isdigitW( *s )) s++; time->wDay = strtolW( s, &s, 10 ); while (*s && !isalphaW( *s )) s++; - if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return FALSE; + if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; time->wMonth = 0; for (i = 0; i < 12; i++) @@ -2194,22 +2197,22 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r break; } } - if (time->wMonth == 0) return FALSE; + if (time->wMonth == 0) return TRUE; while (*s && !isdigitW( *s )) s++; - if (*s == '\0') return FALSE; + if (*s == '\0') return TRUE; time->wYear = strtolW( s, &s, 10 ); while (*s && !isdigitW( *s )) s++; - if (*s == '\0') return FALSE; + if (*s == '\0') return TRUE; time->wHour = strtolW( s, &s, 10 ); while (*s && !isdigitW( *s )) s++; - if (*s == '\0') return FALSE; + if (*s == '\0') return TRUE; time->wMinute = strtolW( s, &s, 10 ); while (*s && !isdigitW( *s )) s++; - if (*s == '\0') return FALSE; + if (*s == '\0') return TRUE; time->wSecond = strtolW( s, &s, 10 ); time->wMilliseconds = 0; diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 8821647fe6c..fee29e4beaf 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -427,6 +427,18 @@ static void InternetTimeToSystemTimeW_test() '1','2',' ','0','6',' ','3','5',0 }; static const WCHAR string3[] = { 'F','r',0 }; + ret = InternetTimeToSystemTimeW( NULL, NULL, 0 ); + ok( !ret, "InternetTimeToSystemTimeW succeeded (%ld)\n", GetLastError() ); + + ret = InternetTimeToSystemTimeW( NULL, &time, 0 ); + ok( !ret, "InternetTimeToSystemTimeW succeeded (%ld)\n", GetLastError() ); + + ret = InternetTimeToSystemTimeW( string, NULL, 0 ); + ok( !ret, "InternetTimeToSystemTimeW succeeded (%ld)\n", GetLastError() ); + + ret = InternetTimeToSystemTimeW( string, &time, 1 ); + ok( ret, "InternetTimeToSystemTimeW failed (%ld)\n", GetLastError() ); + ret = InternetTimeToSystemTimeW( string, &time, 0 ); ok( ret, "InternetTimeToSystemTimeW failed (%ld)\n", GetLastError() ); ok( !memcmp( &time, &expect, sizeof(expect) ), @@ -438,9 +450,7 @@ static void InternetTimeToSystemTimeW_test() "InternetTimeToSystemTimeW failed (%ld)\n", GetLastError() ); ret = InternetTimeToSystemTimeW( string3, &time, 0 ); - todo_wine { - ok( ret, "InternetTimeToSystemTimeW succeeds on (%ld), string3='Fr'", GetLastError() ); - } + ok( ret, "InternetTimeToSystemTimeW failed (%ld)\n", GetLastError() ); } START_TEST(http)