<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:288441372;
        mso-list-type:hybrid;
        mso-list-template-ids:-895187626 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>When running a shell app twice, I ran into an interesting problem: global variables that had initializers were not initialized to the defaults specified in the source. Running the same shell app under the old NT32 seems to work. It turns out that the shell app was not being reloaded, but rather being relaunched. I deduced this from the following behavior:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><ol style='margin-top:0in' start=1 type=1><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>The value of the global variables was the same as the last known value from the previous invocation.<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>The following line in WinHost.c was returning the exact same value for the DLL being loaded<o:p></o:p></li></ol><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:black'>Library = </span><span style='font-size:9.5pt;font-family:Consolas;color:#6F008A'>LoadLibraryEx</span><span style='font-size:9.5pt;font-family:Consolas;color:black'> (DllFileName, </span><span style='font-size:9.5pt;font-family:Consolas;color:#6F008A'>NULL</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>, </span><span style='font-size:9.5pt;font-family:Consolas;color:#6F008A'>DONT_RESOLVE_DLL_REFERENCES</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>); (around line 901)<o:p></o:p></span></p><ol style='margin-top:0in' start=3 type=1><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>The corresponding code in Nt32’s PeCoffExtractionLib had the following lines in PeCoffLoaderUnloadImageExtraAction<o:p></o:p></li></ol><p class=MsoNormal>  VOID *ModHandle;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>  ASSERT (ImageContext != NULL);<o:p></o:p></p><p class=MsoNormal>  ModHandle = RemoveModeHandle (ImageContext);<o:p></o:p></p><p class=MsoNormal>  if (ModHandle != NULL) {<o:p></o:p></p><p class=MsoNormal>    mWinNt->FreeLibrary (ModHandle);<o:p></o:p></p><p class=MsoNormal>  }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, the same function in EmulatorPkg’s WinHost.c has:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:black'>ASSERT (ImageContext != </span><span style='font-size:9.5pt;font-family:Consolas;color:#6F008A'>NULL</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So it appears that the DLL is never being unloaded and the subsequent invocation of the shell app uses the same instance of the DLL, leaving the global variables with the previous values. There are two related functions: AddModHandle and RemoveModHandle.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Am I missing something? Or heading in the right direction? <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal>Tim<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>From:</b> devel@edk2.groups.io <devel@edk2.groups.io> <br><b>Sent:</b> Saturday, August 17, 2019 6:30 PM<br><b>To:</b> devel@edk2.groups.io<br><b>Subject:</b> [edk2-devel] Upcoming Event: TianoCore Design Meeting - APAC/NAMO - Thu, 08/22/2019 6:30pm-7:30pm #cal-reminder<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p><strong><span style='font-family:"Calibri",sans-serif'>Reminder:</span></strong> TianoCore Design Meeting - APAC/NAMO<o:p></o:p></p><p><strong><span style='font-family:"Calibri",sans-serif'>When:</span></strong> Thursday, 22 August 2019, 6:30pm to 7:30pm, (GMT-07:00) America/Los Angeles <o:p></o:p></p><p><strong><span style='font-family:"Calibri",sans-serif'>Where:</span></strong>https://zoom.us/j/969264410<o:p></o:p></p><p><a href="https://edk2.groups.io/g/devel/viewevent?eventid=470780">View Event</a><o:p></o:p></p><p><strong><span style='font-family:"Calibri",sans-serif'>Organizer:</span></strong> Stephano Cetola <a href="mailto:stephano.cetola@intel.com?subject=Re:%20Event:%20TianoCore%20Design%20Meeting%20-%20APAC%2FNAMO">stephano.cetola@intel.com</a> <o:p></o:p></p><p><strong><span style='font-family:"Calibri",sans-serif'>Description:</span></strong> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>Join Zoom Meeting<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><a href="https://zoom.us/j/969264410">https://zoom.us/j/969264410</a><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>One tap mobile<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>+16465588656,,969264410# US (New York)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>+17207072699,,969264410# US<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>Dial by your location<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>        +1 646 558 8656 US (New York)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>        +1 720 707 2699 US<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>Meeting ID: 969 264 410<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'>Find your local number: <a href="https://zoom.us/u/abOtdJckxL">https://zoom.us/u/abOtdJckxL</a><o:p></o:p></p><div><p class=MsoNormal></o:p></span></p></div></div></body></html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>

You receive all messages sent to this group.


<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/46177">View/Reply Online (#46177)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/32983160/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>