473,796 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Expand command exit code -2. What does it mean?

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 WaitForSingleOb ject
and checking the process exit code. My C++ code for checking the exit code
looks something like this:

DWORD dwExit = 0;
if ((GetExitCodePr ocess(hProcess, &dwExit)) && (dwExit != 0))
LOG("Expand error %ld", dwExit);

This usually works fine but in several occasions I got in my logs the error:

Expand error -2

Can someone explain what this Expand command exit code -2 means?

TIA,

--
Benzi Eilon
Aug 7 '06 #1
7 10127
>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 WaitForSingleOb ject
and checking the process exit code. My C++ code for checking the exit code
looks something like this:

DWORD dwExit = 0;
if ((GetExitCodePr ocess(hProcess, &dwExit)) && (dwExit != 0))
LOG("Expand error %ld", dwExit);

This usually works fine but in several occasions I got in my logs the error:

Expand error -2
Has the expand worked in these situations?
>Can someone explain what this Expand command exit code -2 means?
Since the value STILL_ACTIVE is the only documented value for
GetExitCodeProc ess, you have to assume that other values are whatever
arbitrary values the spawned process returns. Return values of
commands are rarely documented (I can't see any mention of them in the
Windows Expand command documentation), so other than the normal 0=OK,
you really have no clue as to what it means unless you have access to
the source (or maybe ask MS via phone support). Additionally, if it's
not documented, there's no certainty that the value won't change in
the future.

Dave
Aug 7 '06 #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...
--
Benzi Eilon
"David Lowndes" wrote:
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 WaitForSingleOb ject
and checking the process exit code. My C++ code for checking the exit code
looks something like this:

DWORD dwExit = 0;
if ((GetExitCodePr ocess(hProcess, &dwExit)) && (dwExit != 0))
LOG("Expand error %ld", dwExit);

This usually works fine but in several occasions I got in my logs the error:

Expand error -2

Has the expand worked in these situations?
Can someone explain what this Expand command exit code -2 means?

Since the value STILL_ACTIVE is the only documented value for
GetExitCodeProc ess, you have to assume that other values are whatever
arbitrary values the spawned process returns. Return values of
commands are rarely documented (I can't see any mention of them in the
Windows Expand command documentation), so other than the normal 0=OK,
you really have no clue as to what it means unless you have access to
the source (or maybe ask MS via phone support). Additionally, if it's
not documented, there's no certainty that the value won't change in
the future.

Dave
Aug 7 '06 #3
>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
Aug 7 '06 #4
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/subscripti...ult.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/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 8 '06 #5
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,
--
Benzi Eilon
""Gary Chang[MSFT]"" wrote:
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/subscripti...ult.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/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 8 '06 #6
Benzi Eilon wrote:
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?
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
Aug 8 '06 #7
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.
--
Benzi Eilon
"Carl Daniel [VC++ MVP]" wrote:
Benzi Eilon wrote:
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?

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
Aug 8 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2215
by: Piet | last post by:
Hi there. I have a problem when working with a wxTreeCtrl. I would like to expand all branches of a sepcific position in a tree with a single command. Since there does not appear to be such a command, I tried to write my own recursive function. Here is the code snippet: def OnPopup1(self,event): item = self.Tree.GetSelection() self.parent.msgbox(self,self.Tree.GetItemText(item),"Kein Titel",wxOK) #self.Tree.Expand(item)
1
8527
by: Guinness Mann | last post by:
Pardon me if this is not the optimum newsgroup for this post, but it's the only .NET newsgroup I read and I'm certain someone here can help me. I have a C# program that checks for an error condition and if it finds it it notifies the user with a MessageBox and then on the next line of code (example in a minute) it calls Application.Exit(). To my astonishment, I stepped through the code with the debugger, and watched it call...
4
9897
by: Kartik | last post by:
Hi, I have an ASP.NET application using VB.NET.I am sending a DOS command to a machine on the network to print a file. This is achieved using xp_cmdshell Dim str As String = "xp_cmdshell ""type " & nwkfilepath & " > " & pPrinterName & " """
51
13389
by: WindAndWaves | last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE. I can understand that it may lead to confusing code, but I often use it like this: is this wrong????? Function x select case z
6
2937
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd have better luck here. So here goes! My program ignores any command line arguments, or at least it's supposed to. However, when I pass any command line arguments to the program, the behaviour of one of the functions changes mysteriously. I have...
34
6881
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: 1) get whole string of input line 2) preset table of strings matching <command> 3) preset table of function calls
1
2734
by: AlexZh | last post by:
Hi, I'd like to stop command line build by one project build failed. To do that I've created simple AddIn (see code below), that works fine for IDE and does not work for command line. In the AddIn I have only two non-trivial methods: In OnConnection I add my event handler to OnBuildProjConfigDone, and in the event handler I executed Build.Cancel. In IDE - no problem. When I execute I see that AddIn works and Build.Cancel is called but...
10
6110
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the code below which when executed generates the following error message: 'There is already an open datareader with this command which must be closed first' Private Sub MainMenu_Load(ByVal sender As System.Object, ByVal e As
3
17256
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a query.
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.