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
522b39bb
Commit
522b39bb
authored
Nov 08, 2005
by
Vincent Béron
Committed by
Alexandre Julliard
Nov 08, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unicodify InternetCheckConnection.
Use HeapAlloc'ed buffers where applicable.
parent
c5789f8c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
21 deletions
+27
-21
internet.c
dlls/wininet/internet.c
+27
-21
No files found.
dlls/wininet/internet.c
View file @
522b39bb
...
...
@@ -2460,16 +2460,16 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r
}
/***********************************************************************
* InternetCheckConnection
A
(WININET.@)
* InternetCheckConnection
W
(WININET.@)
*
* Pings a requested host to check internet connection
*
* RETURNS
* TRUE on success and FALSE on failure. If a failure then
* ERROR_NOT_CONNECTED is place
s
d into GetLastError
* ERROR_NOT_CONNECTED is placed into GetLastError
*
*/
BOOL
WINAPI
InternetCheckConnection
A
(
LPC
STR
lpszUrl
,
DWORD
dwFlags
,
DWORD
dwReserved
)
BOOL
WINAPI
InternetCheckConnection
W
(
LPCW
STR
lpszUrl
,
DWORD
dwFlags
,
DWORD
dwReserved
)
{
/*
* this is a kludge which runs the resident ping program and reads the output.
...
...
@@ -2478,8 +2478,11 @@ BOOL WINAPI InternetCheckConnectionA( LPCSTR lpszUrl, DWORD dwFlags, DWORD dwRes
*/
BOOL
rc
=
FALSE
;
char
command
[
1024
];
char
host
[
1024
];
static
const
CHAR
ping
[]
=
"ping -w 1 "
;
static
const
CHAR
redirect
[]
=
" >/dev/null 2>/dev/null"
;
CHAR
*
command
=
NULL
;
WCHAR
hostW
[
1024
];
DWORD
len
;
int
status
=
-
1
;
FIXME
(
"
\n
"
);
...
...
@@ -2501,30 +2504,32 @@ BOOL WINAPI InternetCheckConnectionA( LPCSTR lpszUrl, DWORD dwFlags, DWORD dwRes
}
else
{
URL_COMPONENTS
A
components
;
URL_COMPONENTS
W
components
;
ZeroMemory
(
&
components
,
sizeof
(
URL_COMPONENTS
A
));
components
.
lpszHostName
=
(
LP
STR
)
&
host
;
ZeroMemory
(
&
components
,
sizeof
(
URL_COMPONENTS
W
));
components
.
lpszHostName
=
(
LP
WSTR
)
&
hostW
;
components
.
dwHostNameLength
=
1024
;
if
(
!
InternetCrackUrl
A
(
lpszUrl
,
0
,
0
,
&
components
))
if
(
!
InternetCrackUrl
W
(
lpszUrl
,
0
,
0
,
&
components
))
goto
End
;
TRACE
(
"host name : %s
\n
"
,
components
.
lpszHostName
);
TRACE
(
"host name : %s
\n
"
,
debugstr_w
(
components
.
lpszHostName
)
);
}
/*
* Build our ping command
*/
strcpy
(
command
,
"ping -w 1 "
);
strcat
(
command
,
host
);
strcat
(
command
,
" >/dev/null 2>/dev/null"
);
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
hostW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
command
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
ping
)
+
len
+
strlen
(
redirect
)
);
strcpy
(
command
,
ping
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
hostW
,
-
1
,
command
+
strlen
(
ping
),
len
,
NULL
,
NULL
);
strcat
(
command
,
redirect
);
TRACE
(
"Ping command is : %s
\n
"
,
command
);
status
=
system
(
command
);
TRACE
(
"Ping returned a code of %i
\n
"
,
status
);
TRACE
(
"Ping returned a code of %i
\n
"
,
status
);
/* Ping return code of 0 indicates success */
if
(
status
==
0
)
...
...
@@ -2532,6 +2537,7 @@ BOOL WINAPI InternetCheckConnectionA( LPCSTR lpszUrl, DWORD dwFlags, DWORD dwRes
End:
HeapFree
(
GetProcessHeap
(),
0
,
command
);
if
(
rc
==
FALSE
)
SetLastError
(
ERROR_NOT_CONNECTED
);
...
...
@@ -2540,7 +2546,7 @@ End:
/***********************************************************************
* InternetCheckConnection
W
(WININET.@)
* InternetCheckConnection
A
(WININET.@)
*
* Pings a requested host to check internet connection
*
...
...
@@ -2549,17 +2555,17 @@ End:
* ERROR_NOT_CONNECTED is placed into GetLastError
*
*/
BOOL
WINAPI
InternetCheckConnection
W
(
LPCW
STR
lpszUrl
,
DWORD
dwFlags
,
DWORD
dwReserved
)
BOOL
WINAPI
InternetCheckConnection
A
(
LPC
STR
lpszUrl
,
DWORD
dwFlags
,
DWORD
dwReserved
)
{
CHAR
*
szUrl
;
W
CHAR
*
szUrl
;
INT
len
;
BOOL
rc
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszUrl
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
szUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
CHAR
))))
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszUrl
,
-
1
,
NULL
,
0
);
if
(
!
(
szUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
W
CHAR
))))
return
FALSE
;
WideCharToMultiByte
(
CP_ACP
,
0
,
lpszUrl
,
-
1
,
szUrl
,
len
,
NULL
,
NULL
);
rc
=
InternetCheckConnection
A
((
LPCSTR
)
szUrl
,
dwFlags
,
dwReserved
);
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszUrl
,
-
1
,
szUrl
,
len
);
rc
=
InternetCheckConnection
W
(
szUrl
,
dwFlags
,
dwReserved
);
HeapFree
(
GetProcessHeap
(),
0
,
szUrl
);
return
rc
;
...
...
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