Commit d792a6af authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Added/improved TRACEing.

parent 62cd1e03
...@@ -450,15 +450,9 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, ...@@ -450,15 +450,9 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
FE(INTERNET_OPEN_TYPE_PROXY), FE(INTERNET_OPEN_TYPE_PROXY),
FE(INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY) FE(INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY)
}; };
static const wininet_flag_info flag[] = {
FE(INTERNET_FLAG_ASYNC),
FE(INTERNET_FLAG_FROM_CACHE),
FE(INTERNET_FLAG_OFFLINE)
};
#undef FE #undef FE
DWORD i; DWORD i;
const char *access_type_str = "Unknown"; const char *access_type_str = "Unknown";
DWORD flag_val = dwFlags;
TRACE("(%s, %li, %s, %s, %li)\n", debugstr_w(lpszAgent), dwAccessType, TRACE("(%s, %li, %s, %s, %li)\n", debugstr_w(lpszAgent), dwAccessType,
debugstr_w(lpszProxy), debugstr_w(lpszProxyBypass), dwFlags); debugstr_w(lpszProxy), debugstr_w(lpszProxyBypass), dwFlags);
...@@ -470,14 +464,7 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, ...@@ -470,14 +464,7 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
} }
TRACE(" access type : %s\n", access_type_str); TRACE(" access type : %s\n", access_type_str);
TRACE(" flags :"); TRACE(" flags :");
for (i = 0; i < (sizeof(flag) / sizeof(flag[0])); i++) { dump_INTERNET_FLAGS(dwFlags);
if (flag[i].val & flag_val) {
DPRINTF(" %s", flag[i].name);
flag_val &= ~flag[i].val;
}
}
if (flag_val) DPRINTF(" Unknown flags (%08lx)", flag_val);
DPRINTF("\n");
} }
/* Clear any error information */ /* Clear any error information */
...@@ -2182,7 +2169,7 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlW(LPWININETAPPINFOW hIC, LPCWSTR lpszUr ...@@ -2182,7 +2169,7 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlW(LPWININETAPPINFOW hIC, LPCWSTR lpszUr
WCHAR password[1024], path[2048], extra[1024]; WCHAR password[1024], path[2048], extra[1024];
HINTERNET client = NULL, client1 = NULL; HINTERNET client = NULL, client1 = NULL;
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders), TRACE("(%p, %s, %s, %08lx, %08lx, %08lx)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
dwHeadersLength, dwFlags, dwContext); dwHeadersLength, dwFlags, dwContext);
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW); urlComponents.dwStructSize = sizeof(URL_COMPONENTSW);
...@@ -2268,9 +2255,13 @@ HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, ...@@ -2268,9 +2255,13 @@ HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
HINTERNET ret = NULL; HINTERNET ret = NULL;
LPWININETAPPINFOW hIC = NULL; LPWININETAPPINFOW hIC = NULL;
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders), if (TRACE_ON(wininet)) {
dwHeadersLength, dwFlags, dwContext); TRACE("(%p, %s, %s, %08lx, %08lx, %08lx)\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
dwHeadersLength, dwFlags, dwContext);
TRACE(" flags :");
dump_INTERNET_FLAGS(dwFlags);
}
hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet ); hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
if (NULL == hIC || hIC->hdr.htype != WH_HINIT) { if (NULL == hIC || hIC->hdr.htype != WH_HINIT) {
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
...@@ -3040,3 +3031,58 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, ...@@ -3040,3 +3031,58 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
FIXME("\n"); FIXME("\n");
return FALSE; return FALSE;
} }
/***********************************************************************
* dump_INTERNET_FLAGS
*
* Helper function to DPRINTF the internet flags.
*
* RETURNS
* None
*
*/
void dump_INTERNET_FLAGS(DWORD dwFlags)
{
#define FE(x) { x, #x }
static const wininet_flag_info flag[] = {
FE(INTERNET_FLAG_RELOAD),
FE(INTERNET_FLAG_RAW_DATA),
FE(INTERNET_FLAG_EXISTING_CONNECT),
FE(INTERNET_FLAG_ASYNC),
FE(INTERNET_FLAG_PASSIVE),
FE(INTERNET_FLAG_NO_CACHE_WRITE),
FE(INTERNET_FLAG_MAKE_PERSISTENT),
FE(INTERNET_FLAG_FROM_CACHE),
FE(INTERNET_FLAG_SECURE),
FE(INTERNET_FLAG_KEEP_CONNECTION),
FE(INTERNET_FLAG_NO_AUTO_REDIRECT),
FE(INTERNET_FLAG_READ_PREFETCH),
FE(INTERNET_FLAG_NO_COOKIES),
FE(INTERNET_FLAG_NO_AUTH),
FE(INTERNET_FLAG_CACHE_IF_NET_FAIL),
FE(INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP),
FE(INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS),
FE(INTERNET_FLAG_IGNORE_CERT_DATE_INVALID),
FE(INTERNET_FLAG_IGNORE_CERT_CN_INVALID),
FE(INTERNET_FLAG_RESYNCHRONIZE),
FE(INTERNET_FLAG_HYPERLINK),
FE(INTERNET_FLAG_NO_UI),
FE(INTERNET_FLAG_PRAGMA_NOCACHE),
FE(INTERNET_FLAG_CACHE_ASYNC),
FE(INTERNET_FLAG_FORMS_SUBMIT),
FE(INTERNET_FLAG_NEED_FILE),
FE(INTERNET_FLAG_TRANSFER_ASCII),
FE(INTERNET_FLAG_TRANSFER_BINARY)
};
#undef FE
int i;
for (i = 0; i < (sizeof(flag) / sizeof(flag[0])); i++) {
if (flag[i].val & dwFlags) {
DPRINTF(" %s", flag[i].name);
dwFlags &= ~flag[i].val;
}
}
if (dwFlags) DPRINTF(" Unknown flags (%08lx)", dwFlags);
DPRINTF("\n");
}
...@@ -478,4 +478,6 @@ typedef struct ...@@ -478,4 +478,6 @@ typedef struct
const char* name; const char* name;
} wininet_flag_info; } wininet_flag_info;
extern void dump_INTERNET_FLAGS(DWORD dwFlags) ;
#endif /* _WINE_INTERNET_H_ */ #endif /* _WINE_INTERNET_H_ */
...@@ -200,12 +200,7 @@ static const char *get_callback_name(DWORD dwInternetStatus) { ...@@ -200,12 +200,7 @@ static const char *get_callback_name(DWORD dwInternetStatus) {
FE(INTERNET_STATUS_PRIVACY_IMPACTED), FE(INTERNET_STATUS_PRIVACY_IMPACTED),
FE(INTERNET_STATUS_P3P_HEADER), FE(INTERNET_STATUS_P3P_HEADER),
FE(INTERNET_STATUS_P3P_POLICYREF), FE(INTERNET_STATUS_P3P_POLICYREF),
FE(INTERNET_STATUS_COOKIE_HISTORY), FE(INTERNET_STATUS_COOKIE_HISTORY)
FE(INTERNET_STATE_CONNECTED),
FE(INTERNET_STATE_DISCONNECTED),
FE(INTERNET_STATE_DISCONNECTED_BY_USER),
FE(INTERNET_STATE_IDLE),
FE(INTERNET_STATE_BUSY)
#undef FE #undef FE
}; };
DWORD i; DWORD i;
...@@ -231,11 +226,11 @@ VOID SendSyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext, ...@@ -231,11 +226,11 @@ VOID SendSyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
if( !dwContext ) if( !dwContext )
return; return;
TRACE("--> Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
hHttpSession = WININET_FindHandle( hdr ); hHttpSession = WININET_FindHandle( hdr );
if( !hHttpSession ) if( !hHttpSession ) {
TRACE(" Could not convert header '%p' into a handle !\n", hdr);
return; return;
}
lpvNewInfo = lpvStatusInfo; lpvNewInfo = lpvStatusInfo;
if(!(hdr->dwInternalFlags & INET_CALLBACKW)) { if(!(hdr->dwInternalFlags & INET_CALLBACKW)) {
...@@ -246,13 +241,19 @@ VOID SendSyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext, ...@@ -246,13 +241,19 @@ VOID SendSyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
lpvNewInfo = WININET_strdup_WtoA(lpvStatusInfo); lpvNewInfo = WININET_strdup_WtoA(lpvStatusInfo);
} }
} }
TRACE(" callback(%p) (%08lx (%p), %08lx, %ld (%s), %p, %ld)\n",
hdr->lpfnStatusCB, (DWORD) hHttpSession, hdr, dwContext, dwInternetStatus, get_callback_name(dwInternetStatus),
lpvNewInfo, dwStatusInfoLength);
hdr->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus, hdr->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus,
lpvNewInfo, dwStatusInfoLength); lpvNewInfo, dwStatusInfoLength);
TRACE(" end callback().\n");
if(lpvNewInfo != lpvStatusInfo) if(lpvNewInfo != lpvStatusInfo)
HeapFree(GetProcessHeap(), 0, lpvNewInfo); HeapFree(GetProcessHeap(), 0, lpvNewInfo);
TRACE("<-- Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
WININET_Release( hdr ); WININET_Release( hdr );
} }
...@@ -262,26 +263,31 @@ VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext, ...@@ -262,26 +263,31 @@ VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
DWORD dwInternetStatus, LPVOID lpvStatusInfo, DWORD dwInternetStatus, LPVOID lpvStatusInfo,
DWORD dwStatusInfoLength) DWORD dwStatusInfoLength)
{ {
TRACE("Send Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus)); TRACE("(%p, %08lx, %ld (%s), %p, %ld): %sasync call with callback %p\n",
hdr, dwContext, dwInternetStatus, get_callback_name(dwInternetStatus),
if (!(hdr->lpfnStatusCB)) lpvStatusInfo, dwStatusInfoLength,
return; hdr->dwFlags & INTERNET_FLAG_ASYNC ? "" : "non ",
if (hdr->dwFlags & INTERNET_FLAG_ASYNC) hdr->lpfnStatusCB);
{
WORKREQUEST workRequest; if (!(hdr->lpfnStatusCB))
struct WORKREQ_SENDCALLBACK *req; return;
workRequest.asyncall = SENDCALLBACK; if (hdr->dwFlags & INTERNET_FLAG_ASYNC)
workRequest.hdr = WININET_AddRef( hdr ); {
req = &workRequest.u.SendCallback; WORKREQUEST workRequest;
req->dwContext = dwContext; struct WORKREQ_SENDCALLBACK *req;
req->dwInternetStatus = dwInternetStatus;
req->lpvStatusInfo = lpvStatusInfo; workRequest.asyncall = SENDCALLBACK;
req->dwStatusInfoLength = dwStatusInfoLength; workRequest.hdr = WININET_AddRef( hdr );
req = &workRequest.u.SendCallback;
INTERNET_AsyncCall(&workRequest); req->dwContext = dwContext;
} req->dwInternetStatus = dwInternetStatus;
else req->lpvStatusInfo = lpvStatusInfo;
SendSyncCallback(hdr, dwContext, dwInternetStatus, req->dwStatusInfoLength = dwStatusInfoLength;
lpvStatusInfo, dwStatusInfoLength);
INTERNET_AsyncCall(&workRequest);
}
else
SendSyncCallback(hdr, dwContext, dwInternetStatus,
lpvStatusInfo, dwStatusInfoLength);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment