>I am executing an Expand command in order to expand a CAB file. This is done
>by calling CreateProcess with the Expand command and then WaitForSingleObject
[quoted text clipped - 8 lines]
>
> Expand error -2
Re: > Has the expand worked in these situations?
No, it failed. However, as this happened at a client site, I could not
investigate its results in time and later the operation was retried and
succeeded.
Therefore I can't get any explanation for this. I wonder if some MS MVP can
contribute here...

Signature
Benzi Eilon
> >I am executing an Expand command in order to expand a CAB file. This is done
> >by calling CreateProcess with the Expand command and then WaitForSingleObject
[quoted text clipped - 24 lines]
>
> Dave
David Lowndes - 07 Aug 2006 22:05 GMT
>No, it failed. However, as this happened at a client site, I could not
>investigate its results in time and later the operation was retried and
>succeeded.
>
>Therefore I can't get any explanation for this. I wonder if some MS MVP can
>contribute here...
I don't think there are any MVPs for the Expand program :)
Unless the error value is just the negative value of the standard
GetLastError value (which is "The system cannot find the file
specified." for #2), I can't offer any further insight.
If you've really got to know, I can only suggest phoning MS support.
Dave
Gary Chang[MSFT] - 08 Aug 2006 07:40 GMT
Hi Benzi,
I agree with David's idea, the exitcode '-2' is issued by the expand.exe
utility, you program is OK. I have also performed some research on that
utility, but unable to find any documentation about its own exit code.
I suggest you can consult the problem on the exitocde of expand.exe in some
windows system specific newsgroup, there may be some community members
familiar with it.
Thanks for your understanding.
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Benzi Eilon - 08 Aug 2006 10:18 GMT
Gary & David,
Thanks for your suggestion (File does not exist) but I don't believe that
this is the case here. The CAB file is copied to the folder where the
Expand.exe looks for it just before the Expand is attempted and the status of
the CopyFile statement is checked and if the copy failed, the Expand is not
executed and a specific message with the result of GetLastError is logged.
Gary, could you suggest a "windows system specific newsgroup where I can
give it another try?
TIA,

Signature
Benzi Eilon
> Hi Benzi,
>
[quoted text clipped - 30 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Carl Daniel [VC++ MVP] - 08 Aug 2006 15:56 GMT
> Gary & David,
>
[quoted text clipped - 7 lines]
> Gary, could you suggest a "windows system specific newsgroup where I
> can give it another try?
I couldn't find a really appropriate windows programming group.
I did do some poking around in expand though, and it looks like the return
value -2 means that the output handle was invalid. Now, as to how you might
get that error, I can only guess: perhaps the destination file of the expand
exists and is unwritable.
-cd
Benzi Eilon - 08 Aug 2006 16:29 GMT
Thanks Carl, I just tried this and definitely if an Expand output file
already exists and is readonly, Expand fails with exit code of -2 (the error
message is: Can't open output file). I'm not sure if this is exactly what
happened in my original case but I will investigate it from here.
Thanks again to all the contributors here.

Signature
Benzi Eilon
> > Gary & David,
> >
[quoted text clipped - 16 lines]
>
> -cd