Invoking wceload

Hiya,

Im having trouble invoking wceload as part of an automated program for installing cabfiles on my device.

Ive trawled through the web and found the answer to installing cab files programmaticaly was to p/invoke wceload and feed it the path of the cab file.

So...

Dim pi As ProcessInfo

Dim result As Int16

result = CreateProcess("wceload.exe", "\SD Card\netcf.core.ppc3.arm.cab", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)

MessageBox.Show(result.ToString)


The CreateProcess class is defined ive just not listed it here.

This returns a value of result = 1, but doesnt kick in the CAB file installation... :/


Am i doing this wrong or is there an alternate way of doing this

Many thanks

Clint



Answer this question

Invoking wceload

  • FredF

    Since your cab file path contains spaces you need to enclose it in quotes, which fo VB means:-
    result = CreateProcess("wceload.exe", chr(34) & "\SD Card\netcf.core.ppc3.arm.cab" & chr(34), IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, Nothing, pi)

    Also not sure how your CreateProcess is define but you should not be passing a 128 byte array into the psiStartInfo argument - this should be Nothing or IntPtr.Zero or 0 depending on how you defined the P/Invoke.

    Peter


  • Enz0

    Ah, shouldve guessed it needed quotes.

    That works fine now, many thanks!

  • Invoking wceload