mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 13:45:56 +00:00
[RAPPS] snapshot url support (#2925)
* [RAPPS] add snapshot url support * [RAPPS] fix snapshot prev window won't update if size not changed * [RAPPS] fix crash after cancel download * [RAPPS] show broken-img if failed to create file / make network request * [RAPPS] create a snapshots folder if it does not exist * [RAPPS] add a helper function to perform callback * [RAPPS] check bIsCancelled when handling ERROR_INVALID_HANDLE * [RAPPS] remove W suffix for AsyncInetDownload * [RAPPS] add assert for unknown event * [RAPPS] Improve AsyncInetDownload error handling * [RAPPS] move DisplayFailed to private, fix crash when cancelling * [RAPPS] check for ERROR_INTERNET_OPERATION_CANCELLED * [RAPPS] improve error logging * [RAPPS] remove \r in error logging * [RAPPS] rewrite AsyncInet
This commit is contained in:
parent
fbf119fde1
commit
e506581454
6 changed files with 735 additions and 40 deletions
66
base/applications/rapps/include/asyncinet.h
Normal file
66
base/applications/rapps/include/asyncinet.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
#ifndef ASYNC_INET
|
||||
#define ASYNC_INET
|
||||
|
||||
|
||||
enum ASYNC_EVENT
|
||||
{
|
||||
ASYNCINET_DATA, // wParam is the Data retrieved from the internet, lParam is the length of Data
|
||||
|
||||
ASYNCINET_COMPLETE, // wParam and lParam are not used.
|
||||
// when receiving this, AsyncInet will be free soon and should not used anymore
|
||||
|
||||
ASYNCINET_CANCELLED, // wParam and lParam are not used.
|
||||
// when receiving this, AsyncInet will be free soon and should not used anymore
|
||||
|
||||
ASYNCINET_ERROR // wParam is not used. lParam specify the error code (if there is one).
|
||||
// when receiving this, AsyncInet will be free soon and should not used anymore
|
||||
};
|
||||
|
||||
typedef struct __AsyncInet ASYNCINET, * pASYNCINET;
|
||||
|
||||
typedef int
|
||||
(*ASYNCINET_CALLBACK)(
|
||||
pASYNCINET AsyncInet,
|
||||
ASYNC_EVENT Event,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
VOID* Extension
|
||||
);
|
||||
|
||||
typedef struct __AsyncInet
|
||||
{
|
||||
HINTERNET hInternet;
|
||||
HINTERNET hInetFile;
|
||||
|
||||
HANDLE hEventHandleCreated;
|
||||
|
||||
UINT ReferenceCnt;
|
||||
CRITICAL_SECTION CriticalSection;
|
||||
HANDLE hEventHandleClose;
|
||||
|
||||
BOOL bIsOpenUrlComplete;
|
||||
|
||||
BOOL bCancelled;
|
||||
|
||||
BYTE ReadBuffer[4096];
|
||||
DWORD BytesRead;
|
||||
|
||||
ASYNCINET_CALLBACK Callback;
|
||||
VOID* Extension;
|
||||
} ASYNCINET, * pASYNCINET;
|
||||
|
||||
pASYNCINET AsyncInetDownload(LPCWSTR lpszAgent,
|
||||
DWORD dwAccessType,
|
||||
LPCWSTR lpszProxy,
|
||||
LPCWSTR lpszProxyBypass,
|
||||
LPCWSTR lpszUrl,
|
||||
BOOL bAllowCache,
|
||||
ASYNCINET_CALLBACK Callback,
|
||||
VOID* Extension
|
||||
);
|
||||
|
||||
BOOL AsyncInetCancel(pASYNCINET AsyncInet);
|
||||
|
||||
VOID AsyncInetRelease(pASYNCINET AsyncInet);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue