Hello everyone, I hope you are all healthy and lucky.
I would like to know if O2 has any way to build a DLL to retrieve content from HTTPS web pages that use more current protocols like TLS-1.3. I had some links that I used, but they stopped working on Win7, and the O2 model also stopped because it uses the Windows access component itself.
I even tried with the help of ChatGPT and Gemini to build a DLL in C or C++. They are somewhat advanced in this area and help a lot, but there is always something that goes wrong with the #include dependencies. I even tried going to a friend's house to use his PC with Windows 10 and use WinHTTP instead of Curl, but for someone who is not in the programming area, something like this is very high level even after reading a lot of forums about it and seeing doubts of people in the area on the same subject.
So I was wondering if the new versions of O2 wouldn't already have an implementation of URL access with more current protocols independently without needing what is incorporated in Windows.
Well, that's it. If not, it's okay, I'll keep using copy and paste here. LOL"
see you later
Thats one of the reasons that i use Purebasic for this stuff, it makes these type of things easy.
I hope O2 will get some of the Purebasic libraries in the future aside of just "Gaming support".
Maybe i could then switch over and make DLL's with it.
Hello Eduardo,
A very simple example using wininet.dll to view the raw content of forum.it-berater.org/index.php via https.
I use Windows 11. I don't know if Windows 7 supports the TLS protocol.
extern lib "wininet.dll"
! InternetOpenA
! InternetOpenUrlA
! InternetCloseHandle
! InternetReadFile
end extern
string buf=nuls 0x20000 '128k
string tbuf
'string url="http://forum.it-berater.org/index.php"
string url="https://forum.it-berater.org/index.php"
int cbytes
sys hInternet
sys hFile
int c
hInternet = InternetOpenA( "o2demo",0,0,0,0 )
hFile = InternetOpenUrlA( hInternet,url,0,0,0,0 )
do
cbytes=0
InternetReadFile( hFile,buf,len(buf),@cbytes )
if cbytes
tbuf+=left(buf,cbytes)
c++
else
exit do
endif
loop
InternetCloseHandle( hFile )
InternetCloseHandle( hInternet )
'print tbuf
putfile( "t.txt",tbuf )
'print c 'count loops
NOTES:
======
'https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetopena
'https://docs.microsoft.com/en-us/cpp/mfc/wininet-basics?view=vs-2019#_core_create_a_very_simple_browser
/*
% INTERNET_OPEN_TYPE_DIRECT 1
% INTERNET_FLAG_ASYNC 0x10000000
*/
/*
extern lib "wininet.dll"
sys InternetOpenA(
LPCSTR lpszAgent,
DWORD dwAccessType,
LPCSTR lpszProxy,
LPCSTR lpszProxyBypass,
DWORD dwFlags
);
BOOLAPI InternetCloseHandle(
HINTERNET hInternet
);
BOOLAPI InternetCanonicalizeUrlA(
LPCSTR lpszUrl,
LPSTR lpszBuffer,
LPDWORD lpdwBufferLength,
DWORD dwFlags
);
sys InternetOpenUrlA(
HINTERNET hInternet,
LPCSTR lpszUrl,
LPCSTR lpszHeaders,
DWORD dwHeadersLength,
DWORD dwFlags,
DWORD_PTR dwContext
);
BOOLAPI InternetReadFile(
HINTERNET hFile,
LPVOID lpBuffer,
DWORD dwNumberOfBytesToRead,
LPDWORD lpdwNumberOfBytesRead
);
BOOLAPI InternetFindNextFileA(
HINTERNET hFind,
LPVOID lpvFindData
);
*/
'#include <afxinet.h>
/*
void DisplayPage(LPCTSTR pszURL)
{
CInternetSession session(_T("My Session"));
CStdioFile* pFile = NULL;
CHAR szBuff[1024];
//use a URL and print a Web page to the console
pFile = session.OpenURL(pszURL);
while (pFile->Read(szBuff, 1024) > 0)
{
printf_s("%1023s", szBuff);
}
delete pFile;
session.Close();
}
*/
Hi Charles, how are you?
Unfortunately, Win7 doesn't have TLS 1.3, only up to 1.2.
Is it possible to get the wininet.dll or winhttp.dll from Win10 and put it in a separate folder to use for O2? How would it work if wininet.dll was in a separate folder?
I've already got them, but I'm going to try to replace the ones in the "C:\Windows\System32" folder. I can't access them to change them in Windows itself, but I also don't know if there will be any errors after changing them.
Theo Gottwald, from what I saw Purebasic also uses the operating system API to connect to the internet, so it works the same as O2 in that regard. It would only be valid if there was a library to be incorporated into the code to make it independent, like the more up-to-date curl or winhttp.h.
I'm okay thanks, Eduardo, but it's cold up here. I wear the winter clothing of a reindeer herder :)
You can run dlls in the same folder as your executable, but you may have to specify the address to be sure they are accessed peferentially.
I found this article discussing Wininet.dll and some of its dependencies.
Under the Hood: WinINet
https://techcommunity.microsoft.com/t5/ask-the-performance-team/under-the-hood-wininet/ba-p/372499
2007 / 2019
hi, charles, I'm glad you're okay,
but wow, I don't think I could handle this kind of cold,
I'm from Rio de Janeiro, Brazil, and it's been very hot here and now that it's cooled down and there are constant storm warnings, the The cold weather it's getting here would probably be like summer for you, well, extremes are always bad.
I would only use it until I had some money left to build a new PC, although I only use the PC to use spreadsheets and visit some internet pages since Firefox and Chrome still work,
There wouldn't even be a need to spend money on it since it's more of a hobby so it's last on the planning list, the most ironic thing is that just this month I've already assembled and configured 2 gaming PCs for other people
At around 11 Centigrade I can protect myself from the chill very effectively, except for my fingertips. There might be a market for heated keyboards..
I see that PureBasic is cross-platform and has around 1600 functions. I looks like a good product. Are there any down-sides to using PureBasic, Theo?
The other PB has rather ominously closed its web site for maintenance over the last few days.
Toes are always a problem in the cold, I worked in a fridge when I was younger and even after I left I still had numb toes for a year.
In the case of using the keyboard, perhaps a hot air blower pointed at it, this way it keeps your fingers away from the cold, although the ideal is a completely heated room, but this can be expensive.
I have used CLAUDE AI and got this:
QuoteTo make the script work with Windows 7 and support TLS 1.2, you can modify it as follows:
....
The main change is the addition of the InternetSetOptionA function call after opening the internet connection. This function is used to set the security flags and enable TLS 1.2 support.
Here's what the added code does:
int dwOption = 0x00003800 sets the option to INTERNET_OPTION_SECURITY_FLAGS, which allows setting security flags.
int dwFlags = 0x00000800 sets the flag to SECURITY_FLAG_IGNORE_UNKNOWN_CA, which ignores unknown certificate authorities. This flag is necessary to enable TLS 1.2 support.
InternetSetOptionA(hInternet, dwOption, @dwFlags, 4) sets the security flags for the internet connection.
With these modifications, the script should now work on Windows 7 and use TLS 1.2 for secure HTTPS connections.
Note: Make sure you have the latest updates and service packs installed on your Windows 7 system to ensure TLS 1.2 support is available.
extern lib "wininet.dll"
InternetOpenA
InternetOpenUrlA
InternetCloseHandle
InternetReadFile
InternetSetOptionA
end extern
string buf=nuls 0x20000 '128k
string tbuf
'string url="http://forum.it-berater.org/index.php"
string url="https://forum.it-berater.org/index.php"
int cbytes
sys hInternet
sys hFile
int c
hInternet = InternetOpenA( "o2demo",0,0,0,0 )
' Enable TLS 1.2
int dwOption = 0x00003800 ' INTERNET_OPTION_SECURITY_FLAGS
int dwFlags = 0x00000800 ' SECURITY_FLAG_IGNORE_UNKNOWN_CA
InternetSetOptionA(hInternet, dwOption, @dwFlags, 4)
hFile = InternetOpenUrlA( hInternet,url,0,0,0,0 )
do
cbytes=0
InternetReadFile( hFile,buf,len(buf),@cbytes )
if cbytes
tbuf+=left(buf,cbytes)
c++
else
exit do
endif
loop
InternetCloseHandle( hFile )
InternetCloseHandle( hInternet )
'print tbuf
putfile( "t.txt",tbuf )
'print c 'count loops
Quote from: Charles Pegge on March 25, 2024, 06:35:54 PMAt around 11 Centigrade I can protect myself from the chill very effectively, except for my fingertips. There might be a market for heated keyboards..
I see that PureBasic is cross-platform and has around 1600 functions. I looks like a good product. Are there any down-sides to using PureBasic, Theo?
The other PB has rather ominously closed its web site for maintenance over the last few days.
Why not just use an electric heater?
Theo, with tls1.2 it works normally on win7, the problem is tls1.3
QuoteWhy not just use an electric heater?
I have many heaters, but an electric blanket is usually all I need in this climate. A small oil radiator under the table is also quite efficient.
PS: The PowerBasic site is still down:
https://www.powerbasic.com/
Quote from: Eduardo Jorge on March 27, 2024, 04:21:02 PMTheo, with tls1.2 it works normally on win7, the problem is tls1.3
I seem not to understand the problem.
Why don't you just hop over to Claude3 (https://console.anthropic.com/workbench)and ask for a solution?