View Issue Details

IDProjectCategoryView StatusLast Update
0004513JEDI VCL00 JVCL Componentspublic2008-10-09 09:20
ReporterA7MAssigned ToAHUser 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.36 
Summary0004513: TJvCreateProcess and console application causes EAccessViolation in CB2009
DescriptionI use TJvCreateProcess and tried to read the output of the console
application into TMemo.
However, EAccessViolation occurs and application crashes.

Additional Information1. Create new C++Builder Project.
2. Put to form TMemo and TButton and JvCreateProcess.
3. Describe these event procedures.
4. Build and run application.

----------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  JvCreateProcess1->ConsoleOptions = JvCreateProcess1->ConsoleOptions << coRedirect;
  JvCreateProcess1->CommandLine = "cmd.exe /c dir C:\\windows\\system32";
  JvCreateProcess1->Run();
}

void __fastcall TForm1::JvCreateProcess1Read(TObject *Sender,
    const AnsiString S, const bool StartsOnNewLine)
{
  if (StartsOnNewLine) {
    Memo2->Lines->Add(S);
  } else {
    int Last = Memo2->Lines->Count - 1;
    if (Last < 0) {
      Memo2->Lines->Add(S);
    } else {
      AnsiString ss = Memo2->Lines->Strings[Last];
      ss += S;
      Memo2->Lines->Strings[Last] = ss;
    }
  }
}
----------------------------------------
TagsNo tags attached.

Activities

obones

2008-10-09 05:32

administrator   ~0014793

Please post the zipped sources of a sample application showing this.

2008-10-09 06:15

 

JvCreateProcess1.7z (18,669 bytes)

A7M

2008-10-09 06:17

reporter   ~0014795

This error is caused in Windows Vista x86 and Windows Vista x64.

AHUser

2008-10-09 09:19

developer   ~0014797

The problem is that "CommandLine" is a constant string and CreateProcessW writes to the lpszCommandLine parameter what causes an access violation. CreateProcessA doesn't do that. I've fixed this by using "Copy()" if the string is a constant string.

Issue History

Date Modified Username Field Change
2008-10-09 05:14 A7M New Issue
2008-10-09 05:32 obones Note Added: 0014793
2008-10-09 05:32 obones Status new => feedback
2008-10-09 06:15 A7M File Added: JvCreateProcess1.7z
2008-10-09 06:17 A7M Note Added: 0014795
2008-10-09 09:19 AHUser Status feedback => resolved
2008-10-09 09:19 AHUser Fixed in Version => Daily / SVN
2008-10-09 09:19 AHUser Resolution open => fixed
2008-10-09 09:19 AHUser Assigned To => AHUser
2008-10-09 09:19 AHUser Note Added: 0014797