Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2007 Apr : Unhandled exception in a call to FtpCommand

www.cryer.info
Managed Newsgroup Archive

Unhandled exception in a call to FtpCommand

Subject:Unhandled exception in a call to FtpCommand
Posted by:"Noël Danjou" (noeld@online.nospam)
Date:Wed, 25 Apr 2007 18:46:53

Windows XP Pro SP2
Internet Explorer 7.0
Visual Studio 2005 Pro SP1
Platform SDK for Windows Server 2003 R2


Hello all,

I am trying to implement a resume feature in a FTP application but when I
call FtpCommand with the RETR command, the debugger breaks in and displays
the following message:

"Unhandled exception at 0x77c42a16 in ftpcmd.exe: 0xC0000005: Access
violation reading location 0x00000001."

The call stack shows that it is related to the VC++ runtime, but I cannot
figure out what's causing the error in my code (see snippet below). Any help
would be very much appreciated. Thank you.

Noël
-----------------------------


  msvcrt.dll!77c42a16()
  [Frames below may be incorrect and/or missing, no symbols loaded for
msvcrt.dll]
  ntdll.dll!7c91b298()
  ntdll.dll!7c9106eb()
  ntdll.dll!7c91b686()
  ntdll.dll!7c91b686()
  ntdll.dll!7c96d6cc()
  ntdll.dll!7c96d886()
  wininet.dll!771d729c()
> wininet.dll!771beb43()
...
-----------------------------

CString strCommand;
strCommand.Format(_T("REST %I64d"), qdwPartialFileSize);

if (!FtpCommand(hConnect, FALSE, FTP_TRANSFER_TYPE_BINARY, strCommand, 0,
NULL))
{
...
return FALSE;
}

...
if (!InternetGetLastResponseInfo(&dwError, pszResponse, &dwLength))
{
...
return FALSE;
}

strCommand.Format(_T("RETR %s"), pszServerFileName);

HINTERNET hRequest = NULL;

// Crashes here >>>>
if (!FtpCommand(hConnect, TRUE, FTP_TRANSFER_TYPE_BINARY, strCommand, 0,
&hRequest))
{
...
return FALSE;
}


-----------------------------

--
Noël
http://noeld.com/

Replies:

www.cryer.info
Managed Newsgroup Archive