G
Guest
ok, ive read/implemented and read/implemented and read/implemented...
started w/ the opennetcf implementation and it didnt work and people posted
that it didnt work and i saw no soln that did work. i then implemented the
apis and had the same result.
everything works great as long as you dont use MS cab files; the infinite
wait works fine for cabs ive created for our applications but does not work
w/ either of the following MS cabs:
sqlce.wce4.armv4.CAB
netcf.all.wce4.ARMV4.cab
if i specify a wait time (not w/ the code below) it works but that doesnt do
me any good...
is there something about the MS cabs that make this just not work or what?
has anyone found a workaround for this or am i just missing something?
please help!
code:
public class ProcessInfo
{
public IntPtr hProcess;
public IntPtr hThread;
public Int32 ProcessId;
public Int32 ThreadId;
}
public class runFile
{
[DllImport("CoreDll.DLL", SetLastError=true)]
private extern static
int CreateProcess( String imageName,
String cmdLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
Int32 boolInheritHandles,
Int32 dwCreationFlags,
IntPtr lpEnvironment,
IntPtr lpszCurrentDir,
byte [] si,
ProcessInfo pi );
[DllImport("CoreDll.dll")]
private extern static
Int32 GetLastError();
[DllImport("CoreDll.dll")]
private extern static
Int32 WaitForSingleObject( IntPtr Handle,
Int32 Wait);
public static bool CreateProcess(string ExeName,string CmdLine,
ProcessInfo pi) //, bool waitForever)
{
Int32 INFINITE;
unchecked {INFINITE = (int)0xFFFFFFFF;}
if ( pi == null )
pi = new ProcessInfo();
byte [] si = new byte[128];
CreateProcess(ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero,
0, 0, IntPtr.Zero, IntPtr.Zero, si, pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return true;
}
}
code trying to use above w/ MS cab:
private void button2_Click(object sender, System.EventArgs e)
{
ProcessInfo pi=new ProcessInfo();
string exe;
string arg;
exe="\\windows\\wceload.exe";
//*MUST* use /delete 0, not /nodelete
arg="/delete 0 \"\\program files\\installer\\sqlce.wce4.armv4.CAB\"";
if (runFile.CreateProcess(exe,arg,pi)) //,true))
}
started w/ the opennetcf implementation and it didnt work and people posted
that it didnt work and i saw no soln that did work. i then implemented the
apis and had the same result.
everything works great as long as you dont use MS cab files; the infinite
wait works fine for cabs ive created for our applications but does not work
w/ either of the following MS cabs:
sqlce.wce4.armv4.CAB
netcf.all.wce4.ARMV4.cab
if i specify a wait time (not w/ the code below) it works but that doesnt do
me any good...
is there something about the MS cabs that make this just not work or what?
has anyone found a workaround for this or am i just missing something?
please help!
code:
public class ProcessInfo
{
public IntPtr hProcess;
public IntPtr hThread;
public Int32 ProcessId;
public Int32 ThreadId;
}
public class runFile
{
[DllImport("CoreDll.DLL", SetLastError=true)]
private extern static
int CreateProcess( String imageName,
String cmdLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
Int32 boolInheritHandles,
Int32 dwCreationFlags,
IntPtr lpEnvironment,
IntPtr lpszCurrentDir,
byte [] si,
ProcessInfo pi );
[DllImport("CoreDll.dll")]
private extern static
Int32 GetLastError();
[DllImport("CoreDll.dll")]
private extern static
Int32 WaitForSingleObject( IntPtr Handle,
Int32 Wait);
public static bool CreateProcess(string ExeName,string CmdLine,
ProcessInfo pi) //, bool waitForever)
{
Int32 INFINITE;
unchecked {INFINITE = (int)0xFFFFFFFF;}
if ( pi == null )
pi = new ProcessInfo();
byte [] si = new byte[128];
CreateProcess(ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero,
0, 0, IntPtr.Zero, IntPtr.Zero, si, pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return true;
}
}
code trying to use above w/ MS cab:
private void button2_Click(object sender, System.EventArgs e)
{
ProcessInfo pi=new ProcessInfo();
string exe;
string arg;
exe="\\windows\\wceload.exe";
//*MUST* use /delete 0, not /nodelete
arg="/delete 0 \"\\program files\\installer\\sqlce.wce4.armv4.CAB\"";
if (runFile.CreateProcess(exe,arg,pi)) //,true))
}