[WININET] Sync with Wine Staging 1.9.11. CORE-11368
[reactos.git] / reactos / dll / win32 / wininet / internet.h
index 2b16ebb..9567f58 100644 (file)
@@ -89,10 +89,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
 
 extern HMODULE WININET_hModule DECLSPEC_HIDDEN;
 
-#ifndef INET6_ADDRSTRLEN
-#define INET6_ADDRSTRLEN 46
-#endif
-
 typedef struct {
     WCHAR *name;
     INTERNET_PORT port;
@@ -227,6 +223,25 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, UINT max_len)
     return ret;
 }
 
+static inline WCHAR *heap_strndupAtoW(const char *str, int len_a, DWORD *len_w)
+{
+    WCHAR *ret = NULL;
+
+    if(str) {
+        size_t len;
+        if(len_a < 0) len_a = strlen(str);
+        len = MultiByteToWideChar(CP_ACP, 0, str, len_a, NULL, 0);
+        ret = heap_alloc((len+1)*sizeof(WCHAR));
+        if(ret) {
+            MultiByteToWideChar(CP_ACP, 0, str, len_a, ret, len);
+            ret[len] = 0;
+            *len_w = len;
+        }
+    }
+
+    return ret;
+}
+
 static inline WCHAR *heap_strdupAtoW(const char *str)
 {
     LPWSTR ret = NULL;
@@ -257,6 +272,22 @@ static inline char *heap_strdupWtoA(LPCWSTR str)
     return ret;
 }
 
+typedef struct {
+    const WCHAR *str;
+    size_t len;
+} substr_t;
+
+static inline substr_t substr(const WCHAR *str, size_t len)
+{
+    substr_t r = {str, len};
+    return r;
+}
+
+static inline substr_t substrz(const WCHAR *str)
+{
+    return substr(str, strlenW(str));
+}
+
 static inline void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
 {
     dataA->dwFileAttributes = dataW->dwFileAttributes;
@@ -294,6 +325,7 @@ typedef struct
     LONG ref;
     HANDLE file_handle;
     WCHAR *file_name;
+    WCHAR *url;
     BOOL is_committed;
 } req_file_t;
 
@@ -461,7 +493,7 @@ DWORD HTTP_Connect(appinfo_t*,LPCWSTR,
 BOOL GetAddress(const WCHAR*,INTERNET_PORT,SOCKADDR*,int*,char*) DECLSPEC_HIDDEN;
 
 DWORD get_cookie_header(const WCHAR*,const WCHAR*,WCHAR**) DECLSPEC_HIDDEN;
-DWORD set_cookie(const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN;
+DWORD set_cookie(substr_t,substr_t,substr_t,substr_t,DWORD) DECLSPEC_HIDDEN;
 
 void INTERNET_SetLastError(DWORD dwError) DECLSPEC_HIDDEN;
 DWORD INTERNET_GetLastError(void) DECLSPEC_HIDDEN;
@@ -475,7 +507,7 @@ VOID SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,
 VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
                            DWORD dwInternetStatus, LPVOID lpvStatusInfo,
                            DWORD dwStatusInfoLength) DECLSPEC_HIDDEN;
-BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundProxy, DWORD *foundProxyLen) DECLSPEC_HIDDEN;
+WCHAR *INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto) DECLSPEC_HIDDEN;
 
 DWORD create_netconn(BOOL,server_t*,DWORD,BOOL,DWORD,netconn_t**) DECLSPEC_HIDDEN;
 void free_netconn(netconn_t*) DECLSPEC_HIDDEN;
@@ -492,7 +524,7 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC
 int sock_send(int fd, const void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
 int sock_recv(int fd, void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
 
-server_t *get_server(const WCHAR*,INTERNET_PORT,BOOL,BOOL) DECLSPEC_HIDDEN;
+server_t *get_server(substr_t,INTERNET_PORT,BOOL,BOOL) DECLSPEC_HIDDEN;
 
 DWORD create_req_file(const WCHAR*,req_file_t**) DECLSPEC_HIDDEN;
 void req_file_release(req_file_t*) DECLSPEC_HIDDEN;