Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004513 [JEDI VCL] 00 JVCL Components crash always 2008-10-09 05:14 2008-10-09 09:20
Reporter A7M View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0004513: TJvCreateProcess and console application causes EAccessViolation in CB2009
Description I use TJvCreateProcess and tried to read the output of the console
application into TMemo.
However, EAccessViolation occurs and application crashes.

Additional Information 1. 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;
    }
  }
}
----------------------------------------
Tags No tags attached.
Attached Files 7z file icon JvCreateProcess1.7z [^] (18,669 bytes) 2008-10-09 06:15

- Relationships

-  Notes
(0014793)
obones (administrator)
2008-10-09 05:32

Please post the zipped sources of a sample application showing this.
(0014795)
A7M (reporter)
2008-10-09 06:17

This error is caused in Windows Vista x86 and Windows Vista x64.
(0014797)
AHUser (developer)
2008-10-09 09:19

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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker