hi

sorry if it was already answered, but i can't find it anywhere

problem:
i have prc/pdb file in memory and i need to install it to device. before i had
my own code which parsed prc/pdb file format and created database based on data
from it. it worked but i hoped system will be able to make it faster

so first approach, DmCreateDatabaseFromImage - works only in case when whole
database and only one database is in one memory block. otherwise i get fatal
alert. unfortunately in my case its not what i have, i have memory block (.tar
file) which contains more pdb/prc files and i may have not enough memory to make
copy from each subfile to new block so i don't want to rely on it. the best for
me would be possibility to create 'new memory block' which would map somewhere
else but it sounds terrible even to myself and i am sure no decent memory
manager could support something like this in higher level api...


second approach works better, its this function

bool BeamSend(const char *name, const char *dataptr, const unsigned long length)
{
        ExgSocketType sock;
        Err err;
        unsigned long ofs;
        unsigned long sent;
        char url[256];
        bool ok;


        StrNCopy(url,exgLocalPrefix,255);
        StrNCat(url,name,255);
        url[255]=0;

        MemSet(&sock,sizeof(ExgSocketType),0);

        sock.count=1;
        sock.length=length;
        sock.name=url;
        
        ok=false;
        err=ExgPut(&sock);
        if(!err)
        {
                ofs=0;
                while(ofs<length && err==0)
                {
                        sent=ExgSend(&sock,dataptr+ofs,length-ofs,&err);        
                
                        ofs+=sent;
                }
                err=ExgDisconnect(&sock,err);
                ok=(!err);
        }
        return(ok);
}

but it has also some disadvantages - first file is copied succesfully and for
every other i get error from ExgDisconnect. error is 0x1503 - user cancelled

and also for first file it gives me dialog if i want to accept database to
applications. for one file its acceptable, but when i image that i may have
20-25 of them, it would be pain if it would ask for each one...

so for now i will return to my old function, but if anyone has idea how to get
rid of confirmation dialog of exchange manager and get rid of this user cancel
bug it would be much better. i would rather let system do such stuff for me then
writing and supporting my functions with all possible time bombs...

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to