locked
VBScript to send soft reset device RRS feed

  • Question

  • I have found the VB.NET script to soft reset a device but I need to include this in my .CAB file as a VBScript to run after the install.  Anyone know of where to go?  I have searched for vbscript soft reset on google, msn, yahoo and no luck.

     

    === Edited by FroggEye @ 30 Jul 2008 3:14 AM UTC===
    Ok so after a few more hours of searching I see it is not possible to do a soft reset in the .CAB file in .NETCF.  What I would like now is some VBScript then to send a soft reset.  Is this possible?  If so I can set my app up after all my .CABs have installed and run that to do a soft reset without the users confirmation.

    Tuesday, July 29, 2008 9:51 PM

Answers

  • You should use C++ for that, e.g. via setup DLL.

     

    Or, better yet, eliminate the need for reset. There should be no reason for you to reset the device.

    Wednesday, July 30, 2008 4:08 AM

All replies

  • You should use C++ for that, e.g. via setup DLL.

     

    Or, better yet, eliminate the need for reset. There should be no reason for you to reset the device.

    Wednesday, July 30, 2008 4:08 AM
  • There is a need to reset after I have installed 4 different .CAB files.  My device has WM6 Classic on it and I need to install .NETCF 3.5, SQLCE Repl, SQLCE Core and my application.  My application does not work until the device has went through a soft reset.  I use a custom tool from Psion Teklogix that allows me to build a custom package and will run a VBScript after all the .CABS have been pushed and installed, which is the reason I am look in for the VBScript to send a soft reset. 

     

    Wednesday, July 30, 2008 12:18 PM
  • Hi
    It is possible to soft reset your device by the use of KernelIoControl API:
      
    Code Snippet

      [DllImport("Coredll.dll")]
            public extern static uint KernelIoControl
            (
                uint dwIoControlCode,
                IntPtr lpInBuf,
                uint nInBufSize,
                IntPtr lpOutBuf,
                uint nOutBufSize,
                ref uint lpBytesReturned
            );


    public const uint FILE_DEVICE_HAL = 0x00000101;
            public const uint FILE_DEVICE_CONSOLE = 0x00000102;
            public const uint FILE_DEVICE_PSL = 0x00000103;
            public const uint METHOD_BUFFERED = 0;
            public const uint METHOD_IN_DIRECT = 1;
            public const uint METHOD_OUT_DIRECT = 2;
            public const uint METHOD_NEITHER = 3;
            public const uint FILE_ANY_ACCESS = 0;
            public const uint FILE_READ_ACCESS = 0x0001;
            public const uint FILE_WRITE_ACCESS = 0x0002;



    And following this topic you can substitute the method CustomInstaller_AfterInstall
    in this way


    Code Snippet

    void CustomInstaller_AfterInstall(object sender, InstallEventArgs e)
    { // Reset the device\emulator
    uint bytesReturned = 0;
      uint IOCTL_HAL_REBOOT = CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS);
      KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesRetur


    have a look to this too.

    Regards
    Hamamdi

    Wednesday, July 30, 2008 2:41 PM
  • Thank you for the tips! 

     

    What I would really like is to not do this from my installer or my program but from a command line i.e. run myScript.vbs.  This would execute the soft reset.

     

    Wednesday, July 30, 2008 3:43 PM
  • No, there's no need to restart. It does not work probably because you're installing NETCF from managed application (or have managed application running) which means NETCF files are in use and cannot be updated.

     

    Depending on whatever's NETCF is in ROM or RAM your installation would either take effect after all managed applications are terminated (so DLLs are unloaded - which you're doing via restart) or it will fail.

     

    You also seem to be confusing VB.Net and VBScript. Last one is a scripting language and it is not even supported on devices at all.

     

    Custom installer code posted above is for desktop and would not work on devices (and so is your VBScript). The only way to do custom actions from the CAB is to use setup DLL written in C++. 

    Wednesday, July 30, 2008 4:43 PM
  • No the NETCF is not being installed from my managed app.  It is being installed just by dropping the .CAB file on the device and executing the .CAB from the device to install.  The desktop app I use to put all these .CAB files into one "package" is from Psion and I have used VBScript to create folders, copy files, delete files, etc on the device (through the Psion app) and it worked just fine.  I have no confusion between VB.NET and VBScript, thank you though.

     

    I trust your expertise stating VBScript is not supported on devices but wonder then, how is the VBScript being converted in the Psion desktop application to make it work on the device?

     

    Either way, I guess my question is answered and I will need to just work around it.

     

    Thanks for all the responses.

     

    Wednesday, July 30, 2008 5:01 PM
  • Your script is probably running on the desktop and accessing device features via, say, RAPI.

    Wednesday, July 30, 2008 7:18 PM