locked
Cab auto install windows mobile 6.5 during cold boot RRS feed

  • Question

  • Hi, I'm trying to install a cab file automatically when a cold boot happens, i tried to find any information online, but most of it does not really help.

     

    I can't find the wceload.exe file on the device in the windows folder, does it show in there or its hidden or something?

     

    i tried to make a .cpy file and that doesn't copy anything during a cold boot either.

    how would i go about automatically installing a cab file without creating a separate application for autorun.

     

    I use the MC5590 unit.

    Thanks.

     

     

    Tuesday, June 14, 2011 7:42 PM

Answers

  • there are two parts to your question

    1. Install the cab file ONLY on coldboot.

    this you can achieve by determining the last boot sequence, using the following reg keys 

    RegOpenKeyEx(HKEY_CURRENT_USER, _T("Performance"), 0, 0,&hKey);

    RegQueryValueEx(hKey, L"Last Boot Type", 0,&dwType, (LPBYTE)&dwRegData, &dwSize);

    this value is 1 for cold boot, for warm boot this will be non-zero value

    2. you could use the following code piece

            lRet=RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0, 0,&hKey);
            if(ERROR_SUCCESS == lRet)
            {
                dwRegData = 0;
                RegSetValueEx(hKey, _T("UseStartImage"), 0, REG_DWORD,(BYTE*)&dwRegData,sizeof(DWORD));

                wcscpy(szCmdLine, _T("/safe /noui /nouninstall /delete 0 "));
                wcscat(szCmdLine, <name of the cab file>);


                if(::CreateProcess(_T("\\Windows\\wceload.exe"),szCmdLine,NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
                {
                ::WaitForSingleObject(pi.hProcess, INFINITE);

                RegSetValueEx(hKey, _T("Skin"), 0, REG_SZ, (BYTE*)szNew,sizeof(TCHAR) * (wcslen(szNew) + 1));
                RegCloseKey(hKey);
                }
                ::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);

                }
            }

    I tried it and it works,


    Sr.Engineer
    • Proposed as answer by palvk Wednesday, June 15, 2011 9:13 AM
    • Marked as answer by Jesse Jiang Friday, June 24, 2011 8:49 AM
    Wednesday, June 15, 2011 9:12 AM