General exception found

Advertisement

Guest

General exception found

// ConsoleApplication5.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#import "WinSCPnet32.tlb" raw_interface_only

using namespace WinSCPnet;

int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = CoInitialize(NULL);
HRESULT hRet = S_FALSE;
_SessionPtr pSession = NULL;
_SessionOptionsPtr Opt = NULL;
_TransferOptionsPtr TOpt = NULL;

hr = pSession.CreateInstance(_uuidof(Session));
hRet = Opt.CreateInstance(_uuidof(SessionOptions));
Opt->_Protocol = Protocol::Protocol_Sftp;
Opt->HostName = "SomeHost";
Opt->UserName = "root";
Opt->Password = "somepassword";
Opt->GiveUpSecurityAndAcceptAnySshHostKey = VARIANT_TRUE;
if (pSession !=NULL)
{
hr = pSession->Open(Opt);

if (hr == S_OK)
{
hr = TOpt.CreateInstance(__uuidof(TransferOptions));
TOpt->_TransferMode = TransferMode::TransferMode_Binary;
_TransferOperationResultPtr tResult = NULL;
tResult = pSession->GetFiles("/root/*", "c:\\", VARIANT_FALSE, TOpt);
try
{
hr = tResult->Check();
if (hr == S_OK)
{
::printf("GetFiles success");
}
}
catch (_com_error ex)
{
ex.ErrorMessage();
pSession->Close();
}
}
}

CoUninitialize();

return 0;
}
When I call Check(), an Exception with error message "general exception" is found. Check the local drive, some files can be downloaded. May I know what's wrongs of my code. Thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: General exception found

"general exception" is not something that WinSCP ever throws.

Please attach a full session and debug log files showing the problem (using the latest version of WinSCP).

To generate the log files, set Session.SessionLogPath and Session.DebugLogPath.

Reply with quote

Advertisement

You can post new topics in this forum