Uncertainity of Autorun

G

Guest

Hello there,
Following autorun.exe code is used in ARM4 device (XDAII) with PPC 2003.

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
if (lstrcmpi(lpCmdLine, _T("install")) == 0)
{
int retVal = ::MessageBox(NULL,_T("Do you want to install mSD
Application?/Möchten Sie die mSD-Applikation installieren?"),_T("mSD
installtion wizard"),MB_YESNO|MB_ICONQUESTION);

TCHAR path[100];
int osLang;
if(retVal == IDYES)
{
retVal=0;
TCHAR sqlCab[100];

//get OS language
osLang = GetOSLanguage(); //this function retrieves os language

if(osLang == GERMAN)
wcscpy(path,_T("\\Speicherkarte\\mSD\\"));
else if(osLang == ENGLISH)
wcscpy(path,_T("\\Storage Card\\mSD\\"));

//copy SQLCE CAB to temp directory
wcscpy(sqlCab,path);
wcscat(sqlCab,_T(SQLCE_ARM));

retVal = CopyFile(sqlCab,TEXT(SETUP_CONFIG), false);
if(retVal == 0)
{
int err = GetLastError();
::MessageBox(NULL,_T("Internal error has occurred,Please reset the
device"),_T("Error"),MB_OK);
exit(0);
}


OnCardInsert(path,osLang); // this function copies three cab files in
temp directory and executes from there. And finally starts a configuration
exe, written in C#
}
else
{
exit(0);
}

}

return 0;


}

It behaves little erratically. Some time when I insert card, application
starts automatically some time it does not. When it does not, I tried
different process to appear again. Some time if I put it in cradle and
disconnect again, it works, but not always. Some time it works only after a
hard reset!
Is there any problem in the code? Or in the logic?
Any idea will be a great help.
 
G

Guest

Hi Arindrajit,

I couldn't agree more.
I have an autorun.exe on my SD-card which lists a set of
..cab files to be installed (eg .Net CF libraries, SQL lirbaries,
then my application) and will install them all at the touch of
an "Install" button. This code gets run when you insert the
SD-card into a device.

In theory, it's beautiful.
In reality, some device manufacturers have really messed
up this functionality.

The O2 XDA II device used to work perfectly with Storage Cards.
It'd run them with the correct parameter "install" or "uninstall"
when you inserted/removed the card. I upgraded my device to
the latest firmware at the start of the year, and now, it only
seems to kick off the .exe just after you hard-reset the device.
On my un-upgraded XDA 2, it continues to work perfectly.

One of my customers (who uses a version of the autorun
running on an XDA, Pocket PC 2002) has found that the
device will kick off the "SD-card inserted" code when the device
comes out of the idle state.
I've had to add extra code to prevent my autorun.exe from
appearing if this is the same, to get around this bug.

Then, of course, there are a whole load of devices which,
when you insert an SD-card, attempt to kick off the autorun.exe
in the Permenant Memory Store's 2577 directory (depressed
sigh). Yes, I'm looking at you, brand new IPAQs.

You can get around it by writing a "redirector" autorun.exe
which sits in this directory, and, when it's run with an "install" or
"uninstall", looks for an autorun.exe on any other
\<Temp-Directory>\2577
directories. Messy, but it works most of the time.

It's frustrating, but true.
The whole autorun.exe thing has become a farce, and I wish
manufacturers would sort themselves out !!!


Michael
Bristol, UK






Arindrajit Biswas said:
Hello there,
Following autorun.exe code is used in ARM4 device (XDAII) with PPC 2003.

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
if (lstrcmpi(lpCmdLine, _T("install")) == 0)
{
int retVal = ::MessageBox(NULL,_T("Do you want to install mSD
Application?/Möchten Sie die mSD-Applikation installieren?"),_T("mSD
installtion wizard"),MB_YESNO|MB_ICONQUESTION);

TCHAR path[100];
int osLang;
if(retVal == IDYES)
{
retVal=0;
TCHAR sqlCab[100];

//get OS language
osLang = GetOSLanguage(); //this function retrieves os language

if(osLang == GERMAN)
wcscpy(path,_T("\\Speicherkarte\\mSD\\"));
else if(osLang == ENGLISH)
wcscpy(path,_T("\\Storage Card\\mSD\\"));

//copy SQLCE CAB to temp directory
wcscpy(sqlCab,path);
wcscat(sqlCab,_T(SQLCE_ARM));

retVal = CopyFile(sqlCab,TEXT(SETUP_CONFIG), false);
if(retVal == 0)
{
int err = GetLastError();
::MessageBox(NULL,_T("Internal error has occurred,Please reset the
device"),_T("Error"),MB_OK);
exit(0);
}


OnCardInsert(path,osLang); // this function copies three cab files in
temp directory and executes from there. And finally starts a configuration
exe, written in C#
}
else
{
exit(0);
}

}

return 0;


}

It behaves little erratically. Some time when I insert card, application
starts automatically some time it does not. When it does not, I tried
different process to appear again. Some time if I put it in cradle and
disconnect again, it works, but not always. Some time it works only after a
hard reset!
Is there any problem in the code? Or in the logic?
Any idea will be a great help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top