Little problems, it works only partially:
include \masm32\MasmBasic\MasmBasic.inc ; download
uselib WinInet
if 0
URL_COMPONENTSA STRUCT
dwStructSize DWORD ?
lpszScheme LPSTR ?
dwSchemeLength DWORD ?
nScheme DWORD ?
lpszHostName LPSTR ?
dwHostNameLength DWORD ?
nPort INTERNET_PORT <>
lpszUserName LPSTR ?
dwUserNameLength DWORD ?
lpszPassword LPSTR ?
dwPasswordLength DWORD ?
lpszUrlPath LPSTR ?
dwUrlPathLength DWORD ?
lpszExtraInfo LPSTR ?
dwExtraInfoLength DWORD ?
URL_COMPONENTSA ENDS
endif
.data?
UrlComp URL_COMPONENTS <>
HostName db 100 dup(?)
UserName db 100 dup(?)
UrlPath db 1000 dup(?)
ExtraInfo db 100 dup(?)
Init
add UrlComp.dwStructSize, URL_COMPONENTS
mov UrlComp.lpszScheme, Chr$("Whatever suits you")
add UrlComp.dwSchemeLength, c$Len
mov UrlComp.lpszHostName, offset HostName
add UrlComp.dwHostNameLength, 100
add UrlComp.nScheme, INTERNET_SCHEME_UNKNOWN ; INTERNET_SCHEME_DEFAULT
mov UrlComp.lpszUserName, offset UserName
add UrlComp.dwUserNameLength, 100
mov UrlComp.lpszUrlPath, offset UrlPath
add UrlComp.dwUrlPathLength, 1000
mov UrlComp.lpszExtraInfo, offset ExtraInfo
add UrlComp.dwExtraInfoLength, 100
invoke InternetCrackUrl, Chr$("https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetcrackurla"), 0, ICU_DECODE, addr UrlComp
deb 4, "res", eax, $Err$(), $UrlComp.lpszScheme, $offset HostName, $offset UserName, $UrlPath, $ExtraInfo, UrlComp.nPort
invoke InternetCrackUrl, Chr$("http://www.google.com/test.html"), 0, ICU_DECODE, addr UrlComp
deb 4, "res", eax, $Err$(), $UrlComp.lpszScheme, $offset HostName, $offset UserName, $UrlPath, $ExtraInfo, UrlComp.nPort
EndOfCode
res
eax 1
$Err$() Operazione completata.__
$UrlComp.lpszScheme https
$offset HostName docs.microsoft.com
$offset UserName
$UrlPath 470 <not a pointer>
$ExtraInfo 00 <not a pointer>
UrlComp.nPort 443
res
eax 0
$Err$() Area dati passata ad una chiamata al sistema troppo piccola.__
$UrlComp.lpszScheme http
$offset HostName www.google.com
$offset UserName
$UrlPath 470 <not a pointer>
$ExtraInfo 00 <not a pointer>
UrlComp.nPort 80