From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: insyde.com, ip: 210.71.195.42, mailfrom: tim.lewis@insyde.com) Received: from out03.hibox.biz (out03.hibox.biz [210.71.195.42]) by groups.io with SMTP; Wed, 21 Aug 2019 14:13:51 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2CRAAAXs11d/w00GKxhAx0BAQUBBwU?= =?us-ascii?q?BgVUGAQsBgRVYgRdyEiqEH4g5Q4dtJTUBjkOEEoYIgXsJAQEBAQEBAQEBCCM?= =?us-ascii?q?JAQIBAYQ5BAICgn82Bw4CBQEBBQEBAQEBBgRthGVCDIVKAQENAhkEBiEIMAU?= =?us-ascii?q?GAQ8EBAEBDhoDAhsYFQkJAQQTCwUNBII2TIEdbQ+OfptvfzMaAoQYAYEUhQu?= =?us-ascii?q?BNAGBYoN1iC2BETOFfgQYgUwDBCoRgkSCWASPE4ZSlXAHAokHjVEbgx6KSAO?= =?us-ascii?q?KXYw2iQiQU4FWATGBWHCDPAkKLIIPF4YzhR2CciIwgSEIFQGMCwEB?= X-IronPort-AV: E=Sophos;i="5.64,414,1559491200"; d="scan'208,217";a="22352487" Received: from unknown (HELO hb3-BKT203.hibox.biz) ([172.24.52.13]) by out03.hibox.biz with ESMTP; 22 Aug 2019 05:13:48 +0800 Received: from unknown (HELO hb3-BKT102.hibox.biz) ([172.24.51.12]) by hb3-BKT203.hibox.biz with ESMTP; 22 Aug 2019 05:13:48 +0800 Received: from unknown (HELO hb3-IN02.hibox.biz) ([172.24.12.12]) by hb3-BKT102.hibox.biz with ESMTP; 22 Aug 2019 05:13:49 +0800 X-Remote-IP: 96.230.108.98 X-Remote-Host: static-96-230-108-98.bstnma.fios.verizon.net X-SBRS: -1.7 X-MID: 27163505 X-Auth-ID: tim.lewis@insyde.com X-EnvelopeFrom: tim.lewis@insyde.com hiBox-Sender: 1 Received: from static-96-230-108-98.bstnma.fios.verizon.net (HELO DESKTOPHG9V3E8) ([96.230.108.98]) by hb3-IN02.hibox.biz with ESMTP/TLS/AES256-SHA; 22 Aug 2019 05:13:48 +0800 From: "Tim Lewis" To: Subject: EmulatorPkg does not unload DLL after exit Date: Wed, 21 Aug 2019 14:13:45 -0700 Message-ID: <0ba301d55865$53151750$f93f45f0$@insyde.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-index: AdVYZEsMBrqSFcpgRWispJWjYQ7aWQ== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0BA4_01D5582A.A6B86230" Content-language: en-us ------=_NextPart_000_0BA4_01D5582A.A6B86230 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable When running a shell app twice, I ran into an interesting problem: global v= ariables that had initializers were not initialized to the defaults specifi= ed in the source. Running the same shell app under the old NT32 seems to wo= rk. It turns out that the shell app was not being reloaded, but rather bein= g relaunched. I deduced this from the following behavior: =20 1. The value of the global variables was the same as the last known value = from the previous invocation. 2. The following line in WinHost.c was returning the exact same value for = the DLL being loaded Library =3D LoadLibraryEx (DllFileName, NULL, DONT_RESOLVE_DLL_REFERENCES)= ; (around line 901) 3. The corresponding code in Nt32=E2=80=99s PeCoffExtractionLib had the fo= llowing lines in PeCoffLoaderUnloadImageExtraAction VOID *ModHandle; =20 ASSERT (ImageContext !=3D NULL); ModHandle =3D RemoveModeHandle (ImageContext); if (ModHandle !=3D NULL) { mWinNt->FreeLibrary (ModHandle); } =20 However, the same function in EmulatorPkg=E2=80=99s WinHost.c has: =20 ASSERT (ImageContext !=3D NULL); =20 So it appears that the DLL is never being unloaded and the subsequent invo= cation of the shell app uses the same instance of the DLL, leaving the glob= al variables with the previous values. There are two related functions: Add= ModHandle and RemoveModHandle. =20 Am I missing something? Or heading in the right direction?=20 =20 Thanks, Tim =20 From: devel@edk2.groups.io =20 Sent: Saturday, August 17, 2019 6:30 PM To: devel@edk2.groups.io Subject: [edk2-devel] Upcoming Event: TianoCore Design Meeting - APAC/NAMO= - Thu, 08/22/2019 6:30pm-7:30pm #cal-reminder =20 Reminder: TianoCore Design Meeting - APAC/NAMO When: Thursday, 22 August 2019, 6:30pm to 7:30pm, (GMT-07:00) America/Los = Angeles=20 Where:https://zoom.us/j/969264410 View Event =20 Organizer: Stephano Cetola stephano.cetola@intel.com Description:=20 Join Zoom Meeting https://zoom.us/j/969264410 =20 One tap mobile +16465588656,,969264410# US (New York) +17207072699,,969264410# US =20 Dial by your location +1 646 558 8656 US (New York) +1 720 707 2699 US Meeting ID: 969 264 410 Find your local number: https://zoom.us/u/abOtdJckxL ------=_NextPart_000_0BA4_01D5582A.A6B86230 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

When running a = shell app twice, I ran into an interesting problem: global variables that h= ad initializers were not initialized to the defaults specified in the sourc= e. Running the same shell app under the old NT32 seems to work. It turns ou= t that the shell app was not being reloaded, but rather being relaunched. I= deduced this from the following behavior:

 

    The value of the global variables was the same as the last known value fro= m the previous invocation.
  1. The following line in WinHost= .c was returning the exact same value for the DLL being loaded

Library =3D LoadLibraryEx (DllFileName, NULL, DONT_RESOLVE_DLL= _REFERENCES); (around line 901)

  1. The corresponding code in Nt32=E2=80=99s PeCoffE= xtractionLib had the following lines in PeCoffLoaderUnloadImageExtraAction<= o:p>

=C2=A0 VOID *ModHandle;=

 

=C2=A0 A= SSERT (ImageContext !=3D NULL);

=C2=A0 M= odHandle =3D RemoveModeHandle (ImageContext);

=C2=A0 if (ModHandle !=3D NULL) {

= = =C2=A0=C2=A0=C2=A0 mWinNt->FreeLibrary (ModHandle);

=C2=A0 }

 

However, the same function in EmulatorPkg=E2=80= =99s WinHost.c has:

 

ASSERT (ImageContext !=3D NULL);

 

So it appears that the D= LL is never being unloaded and the subsequent invocation of the shell app u= ses the same instance of the DLL, leaving the global variables with the pre= vious values. There are two related functions: AddModHandle and RemoveModHa= ndle.

 

Am I missing something? Or heading in the right direction?

 

Thank= s,

Tim

 

From: devel@edk2.groups.= io <devel@edk2.groups.io>
Sent: Saturday, August 17, 2019 = 6:30 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] = Upcoming Event: TianoCore Design Meeting - APAC/NAMO - Thu, 08/22/2019 6:30= pm-7:30pm #cal-reminder

 

Reminder:<= /span> TianoCore Design Meeting - APAC/NAMO

When: T= hursday, 22 August 2019, 6:30pm to 7:30pm, (GMT-07:00) America/Los Angeles =

= Where:https://zoom.us/j/969264410

View Event<= /a>

Organizer: Stephano Cetola stephano.cetola@intel.com

Description:

Join Zoom Meeting

https://zoom= .us/j/969264410

 

One tap mobile

+16465588656,,969264410# US (New York)

+17207072699,,969264410# US

 

Dial by your = location

=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 +1 646 558 8656 US (New York)

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0+1 720 707 2699 = US

Meeting ID: 969 264 410

Find your local number: https://zoom.us/u/abOtdJckxL

------=_NextPart_000_0BA4_01D5582A.A6B86230--