Re: Indy 9 on BCB6: What are Username Password limits?

Giganews Newsgroups
Subject: Re: Indy 9 on BCB6: What are Username Password limits?
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 10 Mar 2006

"poojo hackma" <poojo.com/mail> wrote in message
news:F6F78E494BF0E240poojo.com/mail...

> Are their limitations on the username and password fields?

There is no limits on the values themselves.  However, you did not say which
specific Indy component(s) you are actually using.  The protocol(s) that are
implements may have their own limits on how much data can be transmitted.

> *FYI: For those that want to know, the particular process that no longer
> works is below.  It is called when the user changes directories on the
> local PC.  The only thing that has been added to this routine is the "try
...
> catch()" block.  Remember that this had worked just fine earlier:

That code has nothing to do with Indy, and you are not doing anything with
Username/Password values in it.  How does that code actually relate to this
discussion?

On a side note, that code has three memory leaks and a bug:

1) You are not freeing the string that is returned by StringToOleStr()

2) You are not freeing the ITEMIDLIST that ParseDisplayName() returns
(unless SetPath(LPITEMIDLIST) takes ownership of it and frees it later on,
but that is not necessary a good design choice)

3) You are not freeing the IErrorInfo interface.  You must call Release() on
the interface, or else don't call GetErrorInfo() at all since you are not
using the IErrorInfo for anything to begin with.

4) The EOleSysError.ErrorCode property is an int, not a string.  You are
trying to concatenate the int with a char*, which is the wrong way to do it.

Use this code instead:

    void __fastcall TMainForm::SetPath(const AnsiString &Value)
    {

        if( PcShell )
        {
            LPITEMIDLIST list = NULL;
            ULONG eaten = 0;

            HRESULT hRes = PcShell->ParseDisplayName(Application->Handle,
NULL, WideString(Value), &eaten, &list, NULL);
            if( SUCCEEDED(hRes) )
            {
                SetPath(list);
                ::CoTaskMemFree(list);
            }
            else
            {
                AnsiString msg;
                msg.sprintf("ParseDisplayName Error: %d", hRes);
                ::MessageBox(Handle, msg.c_str(), "SetPath Error", MB_OK |
MB_ICONERROR);
            }
        }
    }

> It fails simply with an EOleSysError #80070057: "The parameter
> is incorrect".

That is because your parameters ARE incorrect.

> I tried to get more information on this error's cause using GetErrorInfo()

That will not work.  The Shell does not use the IErrorInfo interface at all.
That is only used by COM objects, which IShellFolder is not.

Gambit

Replies

In response to

Indy 9 on BCB6: What are Username Password limits? posted by poojo hackma on Fri, 10 Mar 2006