- Timestamp:
- Jul 29, 2000, 4:10:09 PM (25 years ago)
- Location:
- trunk/src/wininet
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wininet/ftp.c
r2624 r3898 1 /* 1 /* $Id: ftp.c,v 1.2 2000-07-29 14:10:08 bird Exp $ 2 * 2 3 * WININET - Ftp implementation 3 4 * … … 40 41 typedef enum { 41 42 /* FTP commands with arguments. */ 42 FTP_CMD_ACCT, 43 FTP_CMD_CWD, 44 FTP_CMD_DELE, 45 FTP_CMD_MKD, 46 FTP_CMD_PASS, 47 FTP_CMD_PORT, 48 FTP_CMD_RETR, 49 FTP_CMD_RMD, 50 FTP_CMD_RNFR, 51 FTP_CMD_RNTO, 52 FTP_CMD_STOR, 53 FTP_CMD_TYPE, 54 FTP_CMD_USER, 43 FTP_CMD_ACCT, 44 FTP_CMD_CWD, 45 FTP_CMD_DELE, 46 FTP_CMD_MKD, 47 FTP_CMD_PASS, 48 FTP_CMD_PORT, 49 FTP_CMD_RETR, 50 FTP_CMD_RMD, 51 FTP_CMD_RNFR, 52 FTP_CMD_RNTO, 53 FTP_CMD_STOR, 54 FTP_CMD_TYPE, 55 FTP_CMD_USER, 55 56 56 57 /* FTP commands without arguments. */ … … 58 59 FTP_CMD_LIST, 59 60 FTP_CMD_NLST, 60 FTP_CMD_PWD, 61 FTP_CMD_PWD, 61 62 FTP_CMD_QUIT, 62 } FTP_COMMAND; 63 } FTP_COMMAND; 63 64 64 65 static const char *szFtpCommands[] = { … … 147 148 148 149 /* Accept connection from ftp server */ 149 if (FTP_InitDataSocket(lpwfs, &nDataSocket)) 150 if (FTP_InitDataSocket(lpwfs, &nDataSocket)) 150 151 { 151 152 FTP_SendData(lpwfs, nDataSocket, hFile); … … 159 160 { 160 161 INTERNET_ASYNC_RESULT iar; 161 162 162 163 iar.dwResult = (DWORD)bSuccess; 163 164 iar.dwError = nRC; … … 217 218 { 218 219 INTERNET_ASYNC_RESULT iar; 219 220 220 221 iar.dwResult = (DWORD)bSuccess; 221 222 iar.dwError = nRC; … … 348 349 * 349 350 */ 350 BOOLAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory, 351 BOOLAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory, 351 352 LPDWORD lpdwCurrentDirectory) 352 353 { … … 401 402 { 402 403 INTERNET_ASYNC_RESULT iar; 403 404 404 405 iar.dwResult = (DWORD)bSuccess; 405 406 iar.dwError = bSuccess ? ERROR_SUCCESS : ERROR_SUCCESS; … … 450 451 } 451 452 452 /* Accept connection from server */ 453 if (nSuccess && FTP_InitDataSocket(lpwfs, &nDataSocket)) 453 /* Accept connection from server */ 454 if (nSuccess && FTP_InitDataSocket(lpwfs, &nDataSocket)) 454 455 { 455 456 hFile = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETFILE)); … … 492 493 493 494 /* Ensure we can write to lpszNewfile by opening it */ 494 hFile = CreateFileA(lpszNewFile, GENERIC_WRITE, 0, 0, fFailIfExists ? 495 hFile = CreateFileA(lpszNewFile, GENERIC_WRITE, 0, 0, fFailIfExists ? 495 496 CREATE_NEW : CREATE_ALWAYS, dwLocalFlagsAttribute, 0); 496 497 if (INVALID_HANDLE_VALUE == hFile) … … 505 506 506 507 /* Accept connection from ftp server */ 507 if (FTP_InitDataSocket(lpwfs, &nDataSocket)) 508 if (FTP_InitDataSocket(lpwfs, &nDataSocket)) 508 509 { 509 510 int nResCode; … … 523 524 524 525 if (hFile) 525 CloseHandle(hFile); 526 CloseHandle(hFile); 526 527 return bSuccess; 527 528 } … … 539 540 */ 540 541 541 HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName, 542 HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName, 542 543 INTERNET_PORT nServerPort, LPCSTR lpszUserName, 543 544 LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext) … … 583 584 if (!result) 584 585 { 585 TRACE("Connected to server\n"); 586 TRACE("Connected to server\n"); 586 587 lpwfs = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETFTPSESSIONA)); 587 588 if (NULL == lpwfs) … … 654 655 { 655 656 INTERNET_ASYNC_RESULT iar; 656 657 657 658 iar.dwResult = (DWORD)lpwfs; 658 659 iar.dwError = bSuccess ? ERROR_SUCCESS : ERROR_INTERNET_CANNOT_CONNECT; … … 735 736 return FALSE; 736 737 } 737 sprintf(buf, "%s%s%s%s", szFtpCommands[ftpCmd], bParamHasLen ? " " : "", 738 sprintf(buf, "%s%s%s%s", szFtpCommands[ftpCmd], bParamHasLen ? " " : "", 738 739 bParamHasLen ? lpszParam : "", szCRLF); 739 740 … … 787 788 nRecv = 0; 788 789 } 789 790 790 791 if (nRecv > 0) 791 792 { … … 820 821 if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_PASS, lpwfs->lpszPassword)) 821 822 goto lend; 822 823 823 824 nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, lpwfs->lpszResponseBuffer, MAX_REPLY_LEN); 824 825 if (nResCode) … … 844 845 * FTP_SendAccount (internal) 845 846 * 846 * 847 * 847 848 * 848 849 * RETURNS … … 943 944 lpwfs->lstnSocketAddress.sin_family = AF_INET; 944 945 lpwfs->lstnSocketAddress.sin_port = htons((u_short) 0); 945 lpwfs->lstnSocketAddress.sin_addr.s_addr = htonl(INADDR_ANY); 946 lpwfs->lstnSocketAddress.sin_addr.s_addr = htonl(INADDR_ANY); 946 947 if (SOCKET_ERROR == bind(lpwfs->lstnSocket,&lpwfs->lstnSocketAddress, sizeof(struct sockaddr_in))) 947 948 { … … 1061 1062 * FTP_InitDataSocket (internal) 1062 1063 * 1063 * 1064 * 1064 1065 * 1065 1066 * RETURNS … … 1128 1129 } 1129 1130 1130 nLen = DATA_PACKET_SIZE < nBytesToSend ? 1131 nLen = DATA_PACKET_SIZE < nBytesToSend ? 1131 1132 DATA_PACKET_SIZE : nBytesToSend; 1132 1133 nRC = send(nDataSocket, lpszBuffer, nLen, 0); … … 1145 1146 /* 1146 1147 TRACE( "%d bytes of %d bytes (%d%%) in %d min %d sec estimated remainig time %d sec\t\t\r", 1147 nTotalSent, fi.nFileSizeLow, nTotalSent*100/st.st_size, nSeconds / 60, 1148 nTotalSent, fi.nFileSizeLow, nTotalSent*100/st.st_size, nSeconds / 60, 1148 1149 nSeconds % 60, (st.st_size - nTotalSent) * nSeconds / nTotalSent ); 1149 1150 */ … … 1269 1270 if (nRC == 0) 1270 1271 goto recv_end; 1271 WriteFile(hFile, lpszBuffer, nRC, &nBytesWritten, NULL); 1272 WriteFile(hFile, lpszBuffer, nRC, &nBytesWritten, NULL); 1272 1273 nBytesReceived += nRC; 1273 1274 } 1274 1275 1275 TRACE("%d bytes of %ld (%ld%%)\r", nBytesReceived, nBytes, 1276 TRACE("%d bytes of %ld (%ld%%)\r", nBytesReceived, nBytes, 1276 1277 nBytesReceived * 100 / nBytes); 1277 1278 } … … 1331 1332 BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn) 1332 1333 { 1333 int i; 1334 int i; 1334 1335 1335 1336 for (i = 0; i < lpwfn->size; i++) … … 1367 1368 { 1368 1369 DWORD access = mktime(&lpafp->tmLastModified); 1369 1370 1370 1371 /* Not all fields are filled in */ 1371 1372 lpFindFileData->ftLastAccessTime.dwHighDateTime = HIWORD(access); … … 1384 1385 lpwfn->lpafp = lpafp; 1385 1386 } 1386 } 1387 } 1387 1388 1388 1389 return (HINTERNET)lpwfn; … … 1451 1452 1452 1453 sizeFilePropArray *= 2; 1453 tmpafp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *lpafp, 1454 tmpafp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *lpafp, 1454 1455 sizeof(FILEPROPERTIESA)*sizeFilePropArray); 1455 1456 if (NULL == tmpafp) … … 1542 1543 LPFILEPROPERTIESA tmpafp; 1543 1544 1544 tmpafp = HeapReAlloc(GetProcessHeap(), 0, *lpafp, 1545 tmpafp = HeapReAlloc(GetProcessHeap(), 0, *lpafp, 1545 1546 sizeof(FILEPROPERTIESA)*indexFilePropArray); 1546 1547 if (NULL == tmpafp) … … 1554 1555 } 1555 1556 1556 lend: 1557 lend: 1557 1558 return bSuccess; 1558 1559 } -
trunk/src/wininet/internet.c
r2624 r3898 1 /* 1 /* $Id: internet.c,v 1.2 2000-07-29 14:10:09 bird Exp $ 2 * 2 3 * Wininet 3 4 * … … 70 71 * 71 72 */ 72 INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, 73 INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, 73 74 DWORD dwAccessType, LPCSTR lpszProxy, 74 75 LPCSTR lpszProxyBypass, DWORD dwFlags) … … 199 200 lpFindFileData = (LPWIN32_FIND_DATAA) lpvFindData; 200 201 access = mktime(&lpwh->lpafp[lpwh->index].tmLastModified); 201 202 202 203 /* Not all fields are filled in */ 203 204 lpFindFileData->ftLastAccessTime.dwHighDateTime = HIWORD(access); … … 245 246 retval = FTP_CloseFindNextHandle((LPWININETFINDNEXTA) lpwh); 246 247 break; 247 248 248 249 default: 249 250 break; … … 264 265 * 265 266 */ 266 BOOLAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, 267 BOOLAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, 267 268 LPURL_COMPONENTSA lpUrlComponents) 268 269 { … … 372 373 // [<user>[<:password>]@]<host>[:<port>] 373 374 // First find the user and password if they exist... 374 375 375 376 szHost = strchr( szNetLoc, '@' ); 376 377 if( szHost == NULL ) … … 458 459 * 459 460 * Sets up a callback function which is called as progress is made 460 * during an operation. 461 * during an operation. 461 462 * 462 463 * RETURNS … … 473 474 TRACE("\n"); 474 475 if (lpwai->hdr.htype != WH_HINIT) 475 return INTERNET_INVALID_STATUS_CALLBACK; 476 return INTERNET_INVALID_STATUS_CALLBACK; 476 477 477 478 retVal = lpwai->lpfnStatusCB; … … 485 486 * InternetWriteFile (WININET.138) 486 487 * 487 * Write data to an open internet file 488 * Write data to an open internet file 488 489 * 489 490 * RETURNS … … 506 507 { 507 508 case WH_HHTTPREQ: 508 nSocket = ((LPWININETHTTPREQA)hFile)->nSocketFD; 509 nSocket = ((LPWININETHTTPREQA)hFile)->nSocketFD; 509 510 break; 510 511 … … 533 534 * InternetReadFile (WININET.121) 534 535 * 535 * Read data from an open internet file 536 * Read data from an open internet file 536 537 * 537 538 * RETURNS … … 540 541 * 541 542 */ 542 BOOLAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, 543 BOOLAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, 543 544 DWORD dwNumOfBytesToRead, LPDWORD dwNumOfBytesRead) 544 545 { … … 554 555 { 555 556 case WH_HHTTPREQ: 556 nSocket = ((LPWININETHTTPREQA)hFile)->nSocketFD; 557 nSocket = ((LPWININETHTTPREQA)hFile)->nSocketFD; 557 558 break; 558 559 -
trunk/src/wininet/utility.c
r2624 r3898 1 /* 1 /* $Id: utility.c,v 1.2 2000-07-29 14:10:09 bird Exp $ 2 * 2 3 * Wininet - Utility functions 3 4 * … … 38 39 //Assert that the string is the expected length 39 40 if (tmpChar[TIME_STRING_LEN] != '\0') 40 { 41 { 41 42 tmpChar[TIME_STRING_LEN] = '\0'; 42 43 FIXME("\n"); … … 59 60 SystemTime.tm_min = atoi(tmpChar+20); 60 61 SystemTime.tm_sec = atoi(tmpChar+23); 61 62 62 63 //and month 63 64 tmpChar2 = tmpChar + 8;
Note:
See TracChangeset
for help on using the changeset viewer.