Author: winesync Date: Mon Jan 14 19:50:34 2008 New Revision: 31797
URL: http://svn.reactos.org/svn/reactos?rev=31797&view=rev Log: Autosyncing with Wine HEAD
Modified: trunk/reactos/dll/win32/wininet/ftp.c trunk/reactos/dll/win32/wininet/http.c trunk/reactos/dll/win32/wininet/internet.c trunk/reactos/dll/win32/wininet/urlcache.c trunk/reactos/dll/win32/wininet/wininet.rbuild trunk/reactos/dll/win32/wininet/wininet_ros.diff
Modified: trunk/reactos/dll/win32/wininet/ftp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/ftp.c?rev... ============================================================================== --- trunk/reactos/dll/win32/wininet/ftp.c (original) +++ trunk/reactos/dll/win32/wininet/ftp.c Mon Jan 14 19:50:34 2008 @@ -845,13 +845,12 @@ } } ret = FtpGetCurrentDirectoryW(hFtpSession, lpszCurrentDirectory?dir:NULL, lpdwCurrentDirectory?&len:NULL); - if(lpdwCurrentDirectory) { - *lpdwCurrentDirectory = len; - if(lpszCurrentDirectory) { - WideCharToMultiByte(CP_ACP, 0, dir, len, lpszCurrentDirectory, *lpdwCurrentDirectory, NULL, NULL); - HeapFree(GetProcessHeap(), 0, dir); - } - } + + if (ret && lpszCurrentDirectory) + WideCharToMultiByte(CP_ACP, 0, dir, -1, lpszCurrentDirectory, len, NULL, NULL); + + if (lpdwCurrentDirectory) *lpdwCurrentDirectory = len; + HeapFree(GetProcessHeap(), 0, dir); return ret; }
@@ -886,9 +885,27 @@ TRACE("len(%d)\n", *lpdwCurrentDirectory);
lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hFtpSession ); - if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype) + if (NULL == lpwfs) + { + INTERNET_SetLastError(ERROR_INVALID_HANDLE); + goto lend; + } + + if (WH_HFTPSESSION != lpwfs->hdr.htype) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); + goto lend; + } + + if (!lpdwCurrentDirectory) + { + INTERNET_SetLastError(ERROR_INVALID_PARAMETER); + goto lend; + } + + if (lpszCurrentDirectory == NULL) + { + INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); goto lend; }
@@ -948,8 +965,6 @@ /* Clear any error information */ INTERNET_SetLastError(0);
- ZeroMemory(lpszCurrentDirectory, *lpdwCurrentDirectory); - hIC = lpwfs->lpAppInfo; if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_PWD, NULL, lpwfs->hdr.lpfnStatusCB, &lpwfs->hdr, lpwfs->hdr.dwContext)) @@ -961,7 +976,7 @@ if (nResCode == 257) /* Extract directory name */ { DWORD firstpos, lastpos, len; - LPWSTR lpszResponseBuffer = WININET_strdup_AtoW(INTERNET_GetResponseBuffer()); + LPWSTR lpszResponseBuffer = WININET_strdup_AtoW(INTERNET_GetResponseBuffer());
for (firstpos = 0, lastpos = 0; lpszResponseBuffer[lastpos]; lastpos++) { @@ -971,14 +986,19 @@ firstpos = lastpos; else break; - } + } } - - len = lastpos - firstpos - 1; - lstrcpynW(lpszCurrentDirectory, &lpszResponseBuffer[firstpos+1], *lpdwCurrentDirectory); + len = lastpos - firstpos; + if (*lpdwCurrentDirectory >= len) + { + memcpy(lpszCurrentDirectory, &lpszResponseBuffer[firstpos + 1], len * sizeof(WCHAR)); + lpszCurrentDirectory[len - 1] = 0; + *lpdwCurrentDirectory = len; + bSuccess = TRUE; + } + else INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); + HeapFree(GetProcessHeap(), 0, lpszResponseBuffer); - *lpdwCurrentDirectory = len; - bSuccess = TRUE; } else FTP_SetResponseError(nResCode); @@ -2335,7 +2355,7 @@ if(lpszResponse[3] != '-') break; else - { /* Start of multiline repsonse. Loop until we get "nnn " */ + { /* Start of multiline response. Loop until we get "nnn " */ multiline = TRUE; memcpy(firstprefix, lpszResponse, 3); firstprefix[3] = ' '; @@ -3411,7 +3431,7 @@
TRACE("\n");
- /* Allocate intial file properties array */ + /* Allocate initial file properties array */ *lpafp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FILEPROPERTIESW)*(sizeFilePropArray)); if (!*lpafp) return FALSE; @@ -3443,7 +3463,7 @@
tmpafp = HeapReAlloc(GetProcessHeap(), 0, *lpafp, sizeof(FILEPROPERTIESW)*indexFilePropArray); - if (NULL == tmpafp) + if (NULL != tmpafp) *lpafp = tmpafp; } *dwfp = indexFilePropArray;
Modified: trunk/reactos/dll/win32/wininet/http.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/http.c?re... ============================================================================== --- trunk/reactos/dll/win32/wininet/http.c (original) +++ trunk/reactos/dll/win32/wininet/http.c Mon Jan 14 19:50:34 2008 @@ -264,7 +264,7 @@ LPWSTR requestString; DWORD len, n; LPCWSTR *req; - INT i; + UINT i; LPWSTR p;
static const WCHAR szSpace[] = { ' ',0 }; @@ -283,7 +283,7 @@ req[n++] = path; req[n++] = http1_1 ? g_szHttp1_1 : g_szHttp1_0;
- /* Append custom request heades */ + /* Append custom request headers */ for (i = 0; i < lpwhr->nCustHeaders; i++) { if (lpwhr->pCustHeaders[i].wFlags & HDR_ISREQUEST) @@ -725,7 +725,7 @@ }
/* read any content returned by the server so that the connection can be - * resued */ + * reused */ static void HTTP_DrainContent(LPWININETHTTPREQW lpwhr) { DWORD bytes_read; @@ -1415,7 +1415,7 @@ }
if (NULL != lpszReferrer && strlenW(lpszReferrer)) - HTTP_ProcessHeader(lpwhr, HTTP_REFERER, lpszReferrer, HTTP_ADDHDR_FLAG_COALESCE); + HTTP_ProcessHeader(lpwhr, HTTP_REFERER, lpszReferrer, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ);
if (lpszAcceptTypes) { @@ -1438,22 +1438,7 @@ else if (strlenW(lpszVerb)) lpwhr->lpszVerb = WININET_strdupW(lpszVerb);
- if (NULL != lpszReferrer && strlenW(lpszReferrer)) - { - WCHAR buf[MAXHOSTNAME]; - URL_COMPONENTSW UrlComponents; - - memset( &UrlComponents, 0, sizeof UrlComponents ); - UrlComponents.dwStructSize = sizeof UrlComponents; - UrlComponents.lpszHostName = buf; - UrlComponents.dwHostNameLength = MAXHOSTNAME; - - InternetCrackUrlW(lpszReferrer, 0, 0, &UrlComponents); - if (strlenW(UrlComponents.lpszHostName)) - HTTP_ProcessHeader(lpwhr, szHost, UrlComponents.lpszHostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); - } - else - HTTP_ProcessHeader(lpwhr, szHost, lpwhs->lpszHostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); + HTTP_ProcessHeader(lpwhr, szHost, lpwhs->lpszHostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ);
if (lpwhs->nServerPort == INTERNET_INVALID_PORT_NUMBER) lpwhs->nServerPort = (dwFlags & INTERNET_FLAG_SECURE ? @@ -1785,7 +1770,7 @@ if (index >= 0) lphttpHdr = &lpwhr->pCustHeaders[index];
- /* Ensure header satisifies requested attributes */ + /* Ensure header satisfies requested attributes */ if (!lphttpHdr || ((dwInfoLevel & HTTP_QUERY_FLAG_REQUEST_HEADERS) && (~lphttpHdr->wFlags & HDR_ISREQUEST))) @@ -1797,7 +1782,7 @@ if (lpdwIndex) (*lpdwIndex)++;
- /* coalesce value to reuqested type */ + /* coalesce value to requested type */ if (dwInfoLevel & HTTP_QUERY_FLAG_NUMBER) { *(int *)lpBuffer = atoiW(lphttpHdr->lpszValue); @@ -3032,6 +3017,7 @@ a bit different */ NETCON_recv(&lpwhr->netConnection, buffer, buflen, MSG_PEEK, &rc); #endif + /* * We should first receive 'HTTP/1.x nnn OK' where nnn is the status code. */
Modified: trunk/reactos/dll/win32/wininet/internet.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet.... ============================================================================== --- trunk/reactos/dll/win32/wininet/internet.c (original) +++ trunk/reactos/dll/win32/wininet/internet.c Mon Jan 14 19:50:34 2008 @@ -1070,7 +1070,8 @@
TRACE("(%s %u %x %p)\n", debugstr_a(lpszUrl), dwUrlLength, dwFlags, lpUrlComponents);
- if (!lpszUrl || !*lpszUrl) + if (!lpszUrl || !*lpszUrl || !lpUrlComponents || + lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSA)) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -1088,6 +1089,7 @@ MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
memset(&UCW,0,sizeof(UCW)); + UCW.dwStructSize = sizeof(URL_COMPONENTSW); if(lpUrlComponents->dwHostNameLength!=0) UCW.dwHostNameLength= lpUrlComponents->dwHostNameLength; if(lpUrlComponents->dwUserNameLength!=0) @@ -2329,6 +2331,20 @@ } } break; + case INTERNET_OPTION_VERSION: + { + TRACE("INTERNET_OPTION_VERSION\n"); + if (*lpdwBufferLength < sizeof(INTERNET_VERSION_INFO)) + INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); + else + { + static const INTERNET_VERSION_INFO info = { 6, 0 }; + memcpy(lpBuffer, &info, sizeof(info)); + *lpdwBufferLength = sizeof(info); + bSuccess = TRUE; + } + break; + } default: FIXME("Stub! %d\n", dwOption); break; @@ -2793,7 +2809,7 @@ if (lpszUrl == NULL) { /* - * According to the doc we are supost to use the ip for the next + * According to the doc we are supposed to use the ip for the next * server in the WnInet internal server database. I have * no idea what that is or how to get it. *
Modified: trunk/reactos/dll/win32/wininet/urlcache.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/urlcache.... ============================================================================== --- trunk/reactos/dll/win32/wininet/urlcache.c (original) +++ trunk/reactos/dll/win32/wininet/urlcache.c Mon Jan 14 19:50:34 2008 @@ -113,7 +113,7 @@ /* packing to dword align start of next field */ /* CHAR szSourceUrlName[]; (url) */ /* packing to dword align start of next field */ - /* CHAR szLocalFileName[]; (local file name exluding path) */ + /* CHAR szLocalFileName[]; (local file name excluding path) */ /* packing to dword align start of next field */ /* CHAR szHeaderInfo[]; (header info) */ } URL_CACHEFILE_ENTRY; @@ -171,7 +171,7 @@ LPWSTR path; /* path to url container directory */ HANDLE hMapping; /* handle of file mapping */ DWORD file_size; /* size of file when mapping was opened */ - HANDLE hMutex; /* hande of mutex */ + HANDLE hMutex; /* handle of mutex */ } URLCACHECONTAINER;
@@ -2796,6 +2796,7 @@ LPINTERNET_CACHE_ENTRY_INFOW lpFirstCacheEntryInfo, LPDWORD lpdwFirstCacheEntryInfoBufferSize) { FIXME("(%s, %p, %p): stub\n", debugstr_w(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize); + SetLastError(ERROR_FILE_NOT_FOUND); return 0; }
Modified: trunk/reactos/dll/win32/wininet/wininet.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet.r... ============================================================================== --- trunk/reactos/dll/win32/wininet/wininet.rbuild (original) +++ trunk/reactos/dll/win32/wininet/wininet.rbuild Mon Jan 14 19:50:34 2008 @@ -1,5 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> +<group> <module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" allowwarnings="true"> <autoregister infsection="OleControlDlls" type="DllInstall" /> <importlibrary definition="wininet.spec.def" /> @@ -33,3 +34,4 @@ <file>version.rc</file> <file>wininet.spec</file> </module> +</group>
Modified: trunk/reactos/dll/win32/wininet/wininet_ros.diff URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet_r... ============================================================================== --- trunk/reactos/dll/win32/wininet/wininet_ros.diff (original) +++ trunk/reactos/dll/win32/wininet/wininet_ros.diff Mon Jan 14 19:50:34 2008 @@ -23,7 +23,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
static const WCHAR g_szHttp1_0[] = {' ','H','T','T','P','/','1','.','0',0 }; -@@ -3027,14 +3028,21 @@ +@@ -3010,7 +3011,11 @@ /* * HACK peek at the buffer */ @@ -32,10 +32,10 @@ + a bit different */ NETCON_recv(&lpwhr->netConnection, buffer, buflen, MSG_PEEK, &rc); +#endif + /* * We should first receive 'HTTP/1.x nnn OK' where nnn is the status code. - */ - buflen = MAX_REPLY_LEN; +@@ -3019,6 +3024,9 @@ memset(buffer, 0, MAX_REPLY_LEN); if (!NETCON_getNextLine(&lpwhr->netConnection, bufferA, &buflen)) goto lend; @@ -305,7 +305,7 @@ =================================================================== --- wininet.rbuild (revision 30893) +++ wininet.rbuild (working copy) -@@ -18,6 +18,7 @@ +@@ -19,6 +19,7 @@ <library>ntdll</library> <library>secur32</library> <library>crypt32</library>