c++ builder XE4, 10.2 Tokyo > 다른 앱 열기 > access violation이 나왔다 > ZeroMemory() 하면 피할 수 있었다
9436 단어 cppBuilder#migratedappOperation
C++ Builder XE4
Rad Studio 10.2 Tokyo Update 2 (追記: 2017/12/27)
주의
(추기 2018/11/14)
아래에서 사용하는 ZeroMemory는 최적화로 날아가므로 SecureZeroMemory()를 사용하는 것이 좋습니다.
내용
ぃ tp // m / 7 ~ f9 / ms / 95f72 ~ 80 ~ 8807018fb
에서 만든 앱을 childProject.exe로 이름을 바꾸고 다른 앱에서 엽니다.
다른 앱 시작
XE4
try1 > access violation
Unit1.cppvoid __fastcall TParentForm::App_openOther()
{
String param = L"/caption=Test_1_B_C";
String progname = L"childProject.exe";
if (FileExists(progname) == false) {
ShowMessage(L"childProejct.exe not found");
return;
}
TShellExecuteInfo sinfo;
sinfo.cbSize = sizeof(sinfo);
sinfo.hwnd = 0; // Desktop
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT;
sinfo.lpFile = progname.c_str();
sinfo.lpParameters = param.c_str();
sinfo.lpVerb = L"";
sinfo.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sinfo);
// 起動待ち
WaitForInputIdle(sinfo.hProcess, INFINITE);
}
void __fastcall TParentForm::Button1Click(TObject *Sender)
{
App_openOther();
}
//---------------------------------------------------------------------------
ShellExecuteEx(&sinfo);
실행 직후에 다음 오류가 발생합니다. 조사 중.
try2 > no error
h tp // w w. 우세 후루코로. 네 t/2006/12/포 st_34. HTML
가 도움이 되었다.
Unit.cpp__fastcall TParentForm::TParentForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TParentForm::App_openOther()
{
String param = L"/caption=Test_1_B_C";
String progname = L"childProject.exe";
if (FileExists(progname) == false) {
ShowMessage(L"childProejct.exe not found");
return;
}
TShellExecuteInfo sinfo;
#if 1
::ZeroMemory(&sinfo,sizeof(SHELLEXECUTEINFO));
#endif
sinfo.cbSize = sizeof(sinfo);
sinfo.hwnd = 0; // Desktop
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT;
sinfo.lpFile = progname.c_str();
sinfo.lpParameters = param.c_str();
sinfo.lpVerb = L"";
sinfo.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sinfo);
// 起動待ち
WaitForInputIdle(sinfo.hProcess, INFINITE);
}
void __fastcall TParentForm::Button1Click(TObject *Sender)
{
App_openOther();
}
//---------------------------------------------------------------------------
#if 1
로 둘러싸인 부분이 있으면 위의 에러가 아니다.
sinfo의 멤버 변수에 미초기화의 값이 들어가 있어 에러가 되고 있었던 것 같다.
10.2 도쿄
10.2 Tokyo의 경우 try1에서도 access violation이 되지 않았다.
만약을 위해서는 try2의 방법으로 해 두는 것이 좋을 것이다.
Reference
이 문제에 관하여(c++ builder XE4, 10.2 Tokyo > 다른 앱 열기 > access violation이 나왔다 > ZeroMemory() 하면 피할 수 있었다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/7of9/items/7b8e8e5ec4111df6dcf5
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
void __fastcall TParentForm::App_openOther()
{
String param = L"/caption=Test_1_B_C";
String progname = L"childProject.exe";
if (FileExists(progname) == false) {
ShowMessage(L"childProejct.exe not found");
return;
}
TShellExecuteInfo sinfo;
sinfo.cbSize = sizeof(sinfo);
sinfo.hwnd = 0; // Desktop
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT;
sinfo.lpFile = progname.c_str();
sinfo.lpParameters = param.c_str();
sinfo.lpVerb = L"";
sinfo.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sinfo);
// 起動待ち
WaitForInputIdle(sinfo.hProcess, INFINITE);
}
void __fastcall TParentForm::Button1Click(TObject *Sender)
{
App_openOther();
}
//---------------------------------------------------------------------------
__fastcall TParentForm::TParentForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TParentForm::App_openOther()
{
String param = L"/caption=Test_1_B_C";
String progname = L"childProject.exe";
if (FileExists(progname) == false) {
ShowMessage(L"childProejct.exe not found");
return;
}
TShellExecuteInfo sinfo;
#if 1
::ZeroMemory(&sinfo,sizeof(SHELLEXECUTEINFO));
#endif
sinfo.cbSize = sizeof(sinfo);
sinfo.hwnd = 0; // Desktop
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT;
sinfo.lpFile = progname.c_str();
sinfo.lpParameters = param.c_str();
sinfo.lpVerb = L"";
sinfo.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sinfo);
// 起動待ち
WaitForInputIdle(sinfo.hProcess, INFINITE);
}
void __fastcall TParentForm::Button1Click(TObject *Sender)
{
App_openOther();
}
//---------------------------------------------------------------------------
10.2 Tokyo의 경우 try1에서도 access violation이 되지 않았다.
만약을 위해서는 try2의 방법으로 해 두는 것이 좋을 것이다.
Reference
이 문제에 관하여(c++ builder XE4, 10.2 Tokyo > 다른 앱 열기 > access violation이 나왔다 > ZeroMemory() 하면 피할 수 있었다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/7of9/items/7b8e8e5ec4111df6dcf5텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)