<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Vito Plantamura's Blog - VPC Technologies SRL</title>
    <link>http://www.vitoplantamura.com/blog/</link>
    <description />
    <language>en-us</language>
    <copyright>Vito Plantamura</copyright>
    <lastBuildDate>Thu, 18 Mar 2010 16:59:30 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>planta@vitoplantamura.com</managingEditor>
    <webMaster>planta@vitoplantamura.com</webMaster>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=d0e0224b-8917-409d-aaf7-c0bed8b7aa8e</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,d0e0224b-8917-409d-aaf7-c0bed8b7aa8e.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,d0e0224b-8917-409d-aaf7-c0bed8b7aa8e.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d0e0224b-8917-409d-aaf7-c0bed8b7aa8e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <font size="3">
          <br />
          <a href="http://www.smartrm.com/">SmartRM.com</a> is an venture capital-backed service
(founded by italian people in the USA) that allows to protect user documents and videos,
letting the user to store locally a copy of the encrypted document for easy and secure
distribution via email, USB keys etc.<br /><br />
In order to view the original document, the user needs to login into SmartRM and then
use a <u>proprietary viewer</u> to open the encrypted PDF, in our test case.<br /><br />
The problem is that <u>the viewer can be easily hacked</u> in order to obtain a copy
of the original document, starting from an encrypted version of the document itself. </font>
        <font color="#ff0000" size="3">This
is pretty obvious and easy to accomplish, in any case.</font>
        <font size="3">
          <br />
          <br />
The promises of the service are listed in their homepage, and sum up the nature of
the application:<br /></font>
        <ul>
          <li>
            <font size="3">Alice cannot read the document before tomorrow morning</font>
          </li>
          <li>
            <u>
              <font size="3">Bob can watch the video only once</font>
            </u>
          </li>
          <li>
            <u>
              <font size="3">Everyone can listen to my song for a week</font>
            </u>
          </li>
          <li>
            <font size="3">Everyone can ask me the permission to open my file</font>
          </li>
        </ul>
        <font size="3">Although the first and the last statements remain allegedly true, a
simple viewer hack makes the second and third statements misleading and exposes the
user’s sensitive data to an high risk of leakage.<br /></font>
        <font size="3">
          <br />
          <u>There are 2 “solutions” to this problem:</u>
          <br />
        </font>
        <ul>
          <li>
            <font size="3">“Security through obscurity”, ie by using “tricks” to complicate the
work of an hacker, as Windows Media Player does, for example. But <u>“security through
obscurity” is not security</u>, as someone has said, and is a “solution” <b><font color="#ff0000">doomed
to failure in the short-term</font></b>.</font>
          </li>
          <li>
            <font size="3">Completely redesign the security and application model, considering,
for example, the idea of storing the user data on a central server, and then serving
the content as images or in a streaming way (as SmartRM's competitors do). But in
this case there are </font>
            <font color="#ff0000" size="3">
              <b>
                <u>a lot</u> of other
security problems and considerations</b>
            </font>
            <font size="3"> that need to be taken
into consideration… Out of the scope of this demonstration.</font>
          </li>
        </ul>
        <font size="3">This video demonstrates the simple hack:<br /><br /><iframe src="http://www.vitoplantamura.com/files/public/smartrm/smartrm5.html" width="700px" frameborder="0" height="532px" scrolling="no">
&amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;gt; 
</iframe><br /><br /><b>Technically speaking</b>, the hack proposed in this post is pretty simple: it required <u>only
3 hours</u> to be discovered and developed.<br /><br />
The SmartRM viewer is implemented as a FireFox extension: any time you need to open
a document (currently only PDF files are supported by SmartRM), the extension <font color="#ff0000"><b>decrypts
locally the document</b></font>, calls a third party PDF library (Quick PDF Library
- www.quickpdflibrary.com) <u>passing the original unencrypted version</u> of the
document and then the file is showed to the user as a series of images, that the user
can only view or, eventually, print, if given the appropriate permission. The PDF
rendering job is done by the Quick PDF Library (QuickPDFDLL0717.dll).<br /><br />
The hack, and then the “concept flaw” of the whole idea is simple: it is enough to
“intercept” the call from the SmartRM extension to the Quick PDF Library dll to obtain
an original, unencrypted version of the PDF.<br /><br />
As said before and considering that having the user's encrypted files stored locally
is the main competitive advantage of the service against its competitors, the only
remedy to this problem is employing some form of “security through obscurity”, that,
as you probably know, is a very short-term solution to the problem and, <u>for a company
involved in protecting sensitive data for its clients, is simply a credibility suicide</u>.<br /><br />
As a computer user, some years ago, I remember the case of the live streaming of RealMedia
video files (rtsp protocol). The premise of that technology was to allow an internet
user to gain access to a video file only through live streaming, without the ability
to download and then potentially share the content with other (non-paying) internet
users. The response of the internet community was a very smart tool (Streambox VCR)
which allowed to “record” a rtsp live stream into a file saved into the user’s hard
drive. The response of Real.com was a lawsuit to discontinue the support and distribution
of Streambox, making it one of the most famous “underground” tools of that time: people
started to reverse engineer Streambox in order to make it up-to-date with the changes
in the rtsp protocol… <font color="#ff0000"><b>A lawsuit was the only option</b></font> in
this case for RealMedia and this is the point of the whole discussion.<br /><br />
Another (in)famous case was that of the “Sony Rootkit”, intended for copy protection,
discovered by Mark Russinovich (search Google for more info).<br /><br />
Windows Media Player, for example, <font color="#ff0000">in a typical spirit of “security
through obscurity”</font>, doesn’t allow to play DRM-protected files if a debugger
is attached to the player’s Windows process… <u>This should stop only the very inexperienced
hacker !</u><br /><br />
As it should be clear, it is impossible to guarantee protection of sensitive data
from technological premises like these.<br /><br /><b>How the hack works (and the Proxy Dll hooking trick)</b><br /><br />
As said before, the SmartRM extension calls into the <b>QuickPDFDLL0717.dll</b> through
its exported functions in order to render a PDF page into a GDI Device Context. The
relevant flow of calls into QuickPDFDLL0717.dll is as follow:<br /><br /><font face="Courier New"><font color="#0000ff"><b>QuickPDFCreateLibrary </b></font>:
initializes the library.<br /><font color="#0000ff"><b>QuickPDFUnlockKey </b></font>: unlocks the library.<br /><font color="#0000ff"><b>QuickPDFCreateBuffer </b></font>: creates a “buffer”.<br /><font color="#0000ff"><b>QuickPDFAddToBuffer </b></font>: copies the unencrypted PDF
bytes into the buffer.<br /><font color="#0000ff"><b>QuickPDFRenderPageToDC </b></font>: renders the PDF to a
Device Context.</font><br /><br />
So, simply by intercepting the call to <b><font color="#ff0000">QuickPDFAddToBuffer </font></b>is
enough to get an unencrypted version of the PDF.<br /><br />
As you may already know, there are a lot of systems and tricks to intercept an API
call (take a look at my site). The case in question is the most simple: a DLL calling
into an other DLL through an exported reference… The most simple interception system
is to build a “<font color="#ff0000">proxy dll</font>”, ie a module with the same
name of the one we want to monitor and, above all, with the exact same exports of
the original image (in this case QuickPDFDLL0717.dll), <u>respecting the same calling
convention, function names, number and order of parameters, type of each parameter
and return value of the original module</u>.<br /><br />
So I downloaded the Quick PDF Library (which includes a C++ SDK) and found 2 files
(a source and an header file) that allow to late bind to QuickPDFDLL0717.dll: the
most important information is the declaration of each exported symbol; for example
in the .h file we find a list of type definitions, as this one:<br /><br /><font color="#0000ff" face="Courier New" size="3">typedef char* (__stdcall *QuickPDFFuncType7)(int,
double, double, double, double, char*);</font><br /><br />
and then, in the .cpp file, we discover the association between the type name (QuickPDFFuncType7
in this case) and the exported symbol name:<br /><p><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"></span></p><font color="#0000ff" face="Courier New" size="3">QuickPDFDrawHTMLTextBox = (QuickPDFFuncType7)AttachFunction("QuickPDFDrawHTMLTextBox");</font><br /><br />
By the way, the type name doesn’t directly reflect the function name only for space
saving reasons (many exports share the same prototype).<br /><br />
So, after an hour of “Replace All” and “Quick Macros” I come out with something like
this:<br /><p><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"></span></span></p><font color="#0000ff" face="Courier New" size="3">#define FuncDecl1(fnname) extern
"C" char* __stdcall fnname(int paramEND)<br /><br />
#define FuncParams1 (paramEND)<br /><br />
typedef char* (__stdcall *QuickPDFFuncType1)(int);<br /><br />
HMODULE DllRef = NULL;<br /><br />
#define FuncInit(ord, fnname) \<br />
if ( DllRef == NULL ) DllRef = LoadLibraryA("original_QuickPDFDLL0717.dll"); \<br />
QuickPDFFuncType##ord FnPtr = (QuickPDFFuncType##ord) GetProcAddress( DllRef, #fnname
);<br /><br />
FuncDecl1(QuickPDFFontFamily)<br />
{<br />
FuncInit( 1, QuickPDFFontFamily )<br />
AddToLog( "QuickPDFFontFamily" );<br />
return FnPtr FuncParams1 ;<br />
}</font><br /><br />
These entry points in the proxy DLL simply are dinamically bound to the calling module,
log or do something and then call the original function.<br /><br />
This is only an example of one function: it may seem an huge work, but, a bit of knowledge
of Visual Studio Macros and a bit of “creative editing” (and a good keyboard) is enough
to create a proxy like the one used in this demonstration in about 1 hour.<br /><br />
So, how the SmartRM hack works ? <font color="#ff0000"><b>This is the proxy QuickPDFAddToBuffer</b></font>:<br /><p><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"></span></p><font color="#0000ff" face="Courier New" size="3">FuncDecl28(QuickPDFAddToBuffer)</font><font color="#0000ff" face="Courier New" size="3"><br />
{<br />
FuncInit( 28, QuickPDFAddToBuffer )<br />
AddToLog( "QuickPDFAddToBuffer" );<br />
AddToLog( paramEND );<br /><br />
// save.<br />
FILE* fp = ::fopen( "c:\\unencrypted.pdf", "wb" );<br />
if ( fp )<br />
{<br />
::fwrite( param2, 1, paramEND, fp );<br />
::fclose( fp );<br />
}<br /><br />
return FnPtr FuncParams28 ;<br />
}</font><br /><br />
Th<font size="3">at's it.<br /><br />
To apply the patch, follow these steps:<br /></font></font>
        <ol>
          <li>
            <font size="3">Go to this folder (under Windows 7): <font color="#ff0000" face="Courier New" size="3">C:\Users\&lt;your_name&gt;\AppData\Roaming\Mozilla\Firefox\Profiles\&lt;your_firefox_profile_name&gt;\extensions\smart-rm@smartrm.com\libraries</font></font>
          </li>
          <li>
            <font size="3">Create a folder with name: <font color="#ff0000" face="Courier New" size="3">“test”</font>.</font>
          </li>
          <li>
            <font size="3">Copy (<font color="#ff0000"><b>copy, don’t move!</b></font>) all the
files in the libraries folder (log4cxx.dll, msvcp71.dll, msvcr71.dll, QuickPDFDLL0717.dll,
smartrm_comp.dll, xerces-c_3_0.dll) to the newly created “test” folder.</font>
          </li>
          <li>
            <font size="3">In the libraries folder, <font color="#ff0000">replace QuickPDFDLL0717.dll
with QuickPdfProxy.dll</font> (ie delete the first file and rename the second file
with the name of the first file).</font>
          </li>
        </ol>
        <font size="3">That’s it. <u>From now on SmartRM will save a “plain-text” version
of each opened PDF in c:\unencrypted.pdf</u>.<br /></font>
        <font size="3">
          <font size="3">
            <br />
P.S. Note that the SmartRMInterceptor.exe in the video does just this (replacing </font>
        </font>
        <font size="3">QuickPDFDLL0717.dll
with QuickPdfProxy.dll</font>
        <font size="3">
          <font size="3">).<br /><br /><b>Source codes and DLL available <a href="http://www.vitoplantamura.com/files/public/quickpdfproxy.zip">here</a>.</b><br /></font>
          <br />
        </font>
        <img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=d0e0224b-8917-409d-aaf7-c0bed8b7aa8e" />
      </body>
      <title>SmartRM.com “Concept” Flaw (and the Proxy Dll hooking trick)</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,d0e0224b-8917-409d-aaf7-c0bed8b7aa8e.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2010/03/18/SmartRMcomConceptFlawAndTheProxyDllHookingTrick.aspx</link>
      <pubDate>Thu, 18 Mar 2010 16:59:30 GMT</pubDate>
      <description>
		&lt;font size="3"&gt; 
&lt;br /&gt;
&lt;a href="http://www.smartrm.com/"&gt;SmartRM.com&lt;/a&gt; is an venture capital-backed service
(founded by italian people in the USA) that allows to protect user documents and videos,
letting the user to store locally a copy of the encrypted document for easy and secure
distribution via email, USB keys etc.&lt;br /&gt;
&lt;br /&gt;
In order to view the original document, the user needs to login into SmartRM and then
use a &lt;u&gt;proprietary viewer&lt;/u&gt; to open the encrypted PDF, in our test case.&lt;br /&gt;
&lt;br /&gt;
The problem is that &lt;u&gt;the viewer can be easily hacked&lt;/u&gt; in order to obtain a copy
of the original document, starting from an encrypted version of the document itself. &lt;/font&gt; &lt;font color="#ff0000" size="3"&gt;This
is pretty obvious and easy to accomplish, in any case.&lt;/font&gt; &lt;font size="3"&gt; 
&lt;br /&gt;
&lt;br /&gt;
The promises of the service are listed in their homepage, and sum up the nature of
the application:&lt;br /&gt;
&lt;/font&gt; 
&lt;ul&gt;
&lt;li&gt;
&lt;font size="3"&gt;Alice cannot read the document before tomorrow morning&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt; &lt;font size="3"&gt;Bob can watch the video only once&lt;/font&gt; &lt;/u&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt; &lt;font size="3"&gt;Everyone can listen to my song for a week&lt;/font&gt; &lt;/u&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;Everyone can ask me the permission to open my file&lt;/font&gt; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;font size="3"&gt;Although the first and the last statements remain allegedly true, a
simple viewer hack makes the second and third statements misleading and exposes the
user’s sensitive data to an high risk of leakage.&lt;br /&gt;
&lt;/font&gt; &lt;font size="3"&gt; 
&lt;br /&gt;
&lt;u&gt;There are 2 “solutions” to this problem:&lt;/u&gt; 
&lt;br /&gt;
&lt;/font&gt; 
&lt;ul&gt;
&lt;li&gt;
&lt;font size="3"&gt;“Security through obscurity”, ie by using “tricks” to complicate the
work of an hacker, as Windows Media Player does, for example. But &lt;u&gt;“security through
obscurity” is not security&lt;/u&gt;, as someone has said, and is a “solution” &lt;b&gt;&lt;font color="#ff0000"&gt;doomed
to failure in the short-term&lt;/font&gt;&lt;/b&gt;.&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;Completely redesign the security and application model, considering,
for example, the idea of storing the user data on a central server, and then serving
the content as images or in a streaming way (as SmartRM's competitors do). But in
this case there are &lt;/font&gt; &lt;font color="#ff0000" size="3"&gt; &lt;b&gt; &lt;u&gt;a lot&lt;/u&gt; of other
security problems and considerations&lt;/b&gt; &lt;/font&gt; &lt;font size="3"&gt; that need to be taken
into consideration… Out of the scope of this demonstration.&lt;/font&gt; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;font size="3"&gt;This video demonstrates the simple hack:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe src="http://www.vitoplantamura.com/files/public/smartrm/smartrm5.html" width="700px" frameborder="0" height="532px" scrolling="no"&gt;
&amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;gt; 
&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Technically speaking&lt;/b&gt;, the hack proposed in this post is pretty simple: it required &lt;u&gt;only
3 hours&lt;/u&gt; to be discovered and developed.&lt;br /&gt;
&lt;br /&gt;
The SmartRM viewer is implemented as a FireFox extension: any time you need to open
a document (currently only PDF files are supported by SmartRM), the extension &lt;font color="#ff0000"&gt;&lt;b&gt;decrypts
locally the document&lt;/b&gt;&lt;/font&gt;, calls a third party PDF library (Quick PDF Library
- www.quickpdflibrary.com) &lt;u&gt;passing the original unencrypted version&lt;/u&gt; of the
document and then the file is showed to the user as a series of images, that the user
can only view or, eventually, print, if given the appropriate permission. The PDF
rendering job is done by the Quick PDF Library (QuickPDFDLL0717.dll).&lt;br /&gt;
&lt;br /&gt;
The hack, and then the “concept flaw” of the whole idea is simple: it is enough to
“intercept” the call from the SmartRM extension to the Quick PDF Library dll to obtain
an original, unencrypted version of the PDF.&lt;br /&gt;
&lt;br /&gt;
As said before and considering that having the user's encrypted files stored locally
is the main competitive advantage of the service against its competitors, the only
remedy to this problem is employing some form of “security through obscurity”, that,
as you probably know, is a very short-term solution to the problem and, &lt;u&gt;for a company
involved in protecting sensitive data for its clients, is simply a credibility suicide&lt;/u&gt;.&lt;br /&gt;
&lt;br /&gt;
As a computer user, some years ago, I remember the case of the live streaming of RealMedia
video files (rtsp protocol). The premise of that technology was to allow an internet
user to gain access to a video file only through live streaming, without the ability
to download and then potentially share the content with other (non-paying) internet
users. The response of the internet community was a very smart tool (Streambox VCR)
which allowed to “record” a rtsp live stream into a file saved into the user’s hard
drive. The response of Real.com was a lawsuit to discontinue the support and distribution
of Streambox, making it one of the most famous “underground” tools of that time: people
started to reverse engineer Streambox in order to make it up-to-date with the changes
in the rtsp protocol… &lt;font color="#ff0000"&gt;&lt;b&gt;A lawsuit was the only option&lt;/b&gt;&lt;/font&gt; in
this case for RealMedia and this is the point of the whole discussion.&lt;br /&gt;
&lt;br /&gt;
Another (in)famous case was that of the “Sony Rootkit”, intended for copy protection,
discovered by Mark Russinovich (search Google for more info).&lt;br /&gt;
&lt;br /&gt;
Windows Media Player, for example, &lt;font color="#ff0000"&gt;in a typical spirit of “security
through obscurity”&lt;/font&gt;, doesn’t allow to play DRM-protected files if a debugger
is attached to the player’s Windows process… &lt;u&gt;This should stop only the very inexperienced
hacker !&lt;/u&gt;
&lt;br /&gt;
&lt;br /&gt;
As it should be clear, it is impossible to guarantee protection of sensitive data
from technological premises like these.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How the hack works (and the Proxy Dll hooking trick)&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
As said before, the SmartRM extension calls into the &lt;b&gt;QuickPDFDLL0717.dll&lt;/b&gt; through
its exported functions in order to render a PDF page into a GDI Device Context. The
relevant flow of calls into QuickPDFDLL0717.dll is as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;&lt;b&gt;QuickPDFCreateLibrary &lt;/b&gt;&lt;/font&gt;:
initializes the library.&lt;br /&gt;
&lt;font color="#0000ff"&gt;&lt;b&gt;QuickPDFUnlockKey &lt;/b&gt;&lt;/font&gt;: unlocks the library.&lt;br /&gt;
&lt;font color="#0000ff"&gt;&lt;b&gt;QuickPDFCreateBuffer &lt;/b&gt;&lt;/font&gt;: creates a “buffer”.&lt;br /&gt;
&lt;font color="#0000ff"&gt;&lt;b&gt;QuickPDFAddToBuffer &lt;/b&gt;&lt;/font&gt;: copies the unencrypted PDF
bytes into the buffer.&lt;br /&gt;
&lt;font color="#0000ff"&gt;&lt;b&gt;QuickPDFRenderPageToDC &lt;/b&gt;&lt;/font&gt;: renders the PDF to a
Device Context.&lt;/font&gt;
&lt;br /&gt;
&lt;br /&gt;
So, simply by intercepting the call to &lt;b&gt;&lt;font color="#ff0000"&gt;QuickPDFAddToBuffer &lt;/font&gt;&lt;/b&gt;is
enough to get an unencrypted version of the PDF.&lt;br /&gt;
&lt;br /&gt;
As you may already know, there are a lot of systems and tricks to intercept an API
call (take a look at my site). The case in question is the most simple: a DLL calling
into an other DLL through an exported reference… The most simple interception system
is to build a “&lt;font color="#ff0000"&gt;proxy dll&lt;/font&gt;”, ie a module with the same
name of the one we want to monitor and, above all, with the exact same exports of
the original image (in this case QuickPDFDLL0717.dll), &lt;u&gt;respecting the same calling
convention, function names, number and order of parameters, type of each parameter
and return value of the original module&lt;/u&gt;.&lt;br /&gt;
&lt;br /&gt;
So I downloaded the Quick PDF Library (which includes a C++ SDK) and found 2 files
(a source and an header file) that allow to late bind to QuickPDFDLL0717.dll: the
most important information is the declaration of each exported symbol; for example
in the .h file we find a list of type definitions, as this one:&lt;br /&gt;
&lt;br /&gt;
&lt;font color="#0000ff" face="Courier New" size="3"&gt;typedef char* (__stdcall *QuickPDFFuncType7)(int,
double, double, double, double, char*);&lt;/font&gt;
&lt;br /&gt;
&lt;br /&gt;
and then, in the .cpp file, we discover the association between the type name (QuickPDFFuncType7
in this case) and the exported symbol name:&lt;br /&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;font color="#0000ff" face="Courier New" size="3"&gt;QuickPDFDrawHTMLTextBox = (QuickPDFFuncType7)AttachFunction("QuickPDFDrawHTMLTextBox");&lt;/font&gt;
&lt;br /&gt;
&lt;br /&gt;
By the way, the type name doesn’t directly reflect the function name only for space
saving reasons (many exports share the same prototype).&lt;br /&gt;
&lt;br /&gt;
So, after an hour of “Replace All” and “Quick Macros” I come out with something like
this:&lt;br /&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;font color="#0000ff" face="Courier New" size="3"&gt;#define FuncDecl1(fnname) extern
"C" char* __stdcall fnname(int paramEND)&lt;br /&gt;
&lt;br /&gt;
#define FuncParams1 (paramEND)&lt;br /&gt;
&lt;br /&gt;
typedef char* (__stdcall *QuickPDFFuncType1)(int);&lt;br /&gt;
&lt;br /&gt;
HMODULE DllRef = NULL;&lt;br /&gt;
&lt;br /&gt;
#define FuncInit(ord, fnname) \&lt;br /&gt;
if ( DllRef == NULL ) DllRef = LoadLibraryA("original_QuickPDFDLL0717.dll"); \&lt;br /&gt;
QuickPDFFuncType##ord FnPtr = (QuickPDFFuncType##ord) GetProcAddress( DllRef, #fnname
);&lt;br /&gt;
&lt;br /&gt;
FuncDecl1(QuickPDFFontFamily)&lt;br /&gt;
{&lt;br /&gt;
FuncInit( 1, QuickPDFFontFamily )&lt;br /&gt;
AddToLog( "QuickPDFFontFamily" );&lt;br /&gt;
return FnPtr FuncParams1 ;&lt;br /&gt;
}&lt;/font&gt;
&lt;br /&gt;
&lt;br /&gt;
These entry points in the proxy DLL simply are dinamically bound to the calling module,
log or do something and then call the original function.&lt;br /&gt;
&lt;br /&gt;
This is only an example of one function: it may seem an huge work, but, a bit of knowledge
of Visual Studio Macros and a bit of “creative editing” (and a good keyboard) is enough
to create a proxy like the one used in this demonstration in about 1 hour.&lt;br /&gt;
&lt;br /&gt;
So, how the SmartRM hack works ? &lt;font color="#ff0000"&gt;&lt;b&gt;This is the proxy QuickPDFAddToBuffer&lt;/b&gt;&lt;/font&gt;:&lt;br /&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;font color="#0000ff" face="Courier New" size="3"&gt;FuncDecl28(QuickPDFAddToBuffer)&lt;/font&gt;&lt;font color="#0000ff" face="Courier New" size="3"&gt;
&lt;br /&gt;
{&lt;br /&gt;
FuncInit( 28, QuickPDFAddToBuffer )&lt;br /&gt;
AddToLog( "QuickPDFAddToBuffer" );&lt;br /&gt;
AddToLog( paramEND );&lt;br /&gt;
&lt;br /&gt;
// save.&lt;br /&gt;
FILE* fp = ::fopen( "c:\\unencrypted.pdf", "wb" );&lt;br /&gt;
if ( fp )&lt;br /&gt;
{&lt;br /&gt;
::fwrite( param2, 1, paramEND, fp );&lt;br /&gt;
::fclose( fp );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return FnPtr FuncParams28 ;&lt;br /&gt;
}&lt;/font&gt;
&lt;br /&gt;
&lt;br /&gt;
Th&lt;font size="3"&gt;at's it.&lt;br /&gt;
&lt;br /&gt;
To apply the patch, follow these steps:&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt; 
&lt;ol&gt;
&lt;li&gt;
&lt;font size="3"&gt;Go to this folder (under Windows 7): &lt;font color="#ff0000" face="Courier New" size="3"&gt;C:\Users\&amp;lt;your_name&amp;gt;\AppData\Roaming\Mozilla\Firefox\Profiles\&amp;lt;your_firefox_profile_name&amp;gt;\extensions\smart-rm@smartrm.com\libraries&lt;/font&gt;&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;Create a folder with name: &lt;font color="#ff0000" face="Courier New" size="3"&gt;“test”&lt;/font&gt;.&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;Copy (&lt;font color="#ff0000"&gt;&lt;b&gt;copy, don’t move!&lt;/b&gt;&lt;/font&gt;) all the
files in the libraries folder (log4cxx.dll, msvcp71.dll, msvcr71.dll, QuickPDFDLL0717.dll,
smartrm_comp.dll, xerces-c_3_0.dll) to the newly created “test” folder.&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;In the libraries folder, &lt;font color="#ff0000"&gt;replace QuickPDFDLL0717.dll
with QuickPdfProxy.dll&lt;/font&gt; (ie delete the first file and rename the second file
with the name of the first file).&lt;/font&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;font size="3"&gt;That’s it. &lt;u&gt;From now on SmartRM will save a “plain-text” version
of each opened PDF in c:\unencrypted.pdf&lt;/u&gt;.&lt;br /&gt;
&lt;/font&gt; &lt;font size="3"&gt; &lt;font size="3"&gt; 
&lt;br /&gt;
P.S. Note that the SmartRMInterceptor.exe in the video does just this (replacing &lt;/font&gt; &lt;/font&gt; &lt;font size="3"&gt;QuickPDFDLL0717.dll
with QuickPdfProxy.dll&lt;/font&gt; &lt;font size="3"&gt; &lt;font size="3"&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Source codes and DLL available &lt;a href="http://www.vitoplantamura.com/files/public/quickpdfproxy.zip"&gt;here&lt;/a&gt;.&lt;/b&gt;
&lt;br /&gt;
&lt;/font&gt; 
&lt;br /&gt;
&lt;/font&gt; &lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=d0e0224b-8917-409d-aaf7-c0bed8b7aa8e" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,d0e0224b-8917-409d-aaf7-c0bed8b7aa8e.aspx</comments>
      <category>EN</category>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=187e2245-c857-4e0a-adee-338a30ee2629</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,187e2245-c857-4e0a-adee-338a30ee2629.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,187e2245-c857-4e0a-adee-338a30ee2629.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=187e2245-c857-4e0a-adee-338a30ee2629</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <font size="3">
          <br />
Invece di realizzare una seconda parte per questo post, che probabilmente avrebbe
potuto estendersi all'infinito, ho preferito, nel mese di Gennaio, riprendere seriamente
in mano BugChecker (che, per chi non lo sapesse, è un "clone" del famoso Numega Softice,
oramai "dismesso" da Compuware, interamente sviluppato dal sottoscritto un 6/7 anni
or sono) e quindi portarlo da Windows 2000 SP4 (unica piattaforma supportata fino
al 2009) a Windows XP (tutti i service pack).<br /><br />
La compatibilità con Windows 2000 e Windows XP (tutti i service pack) è ottenuta tramite
una utility (scritta ad-hoc) che permette di scaricare dal symbol server di Microsoft
i file DBG e/o PDB di una data immagine del kernel di Windows, quindi di generare
automaticamente un file di riferimento per il driver kernel del debugger con puntatori
ed offset a funzioni chiave del sistema (necessarie al debugger per intercettare chiamate
interne del kernel per vari scopi, come per esempio mantenere un suo Page Frame Db).<br /><br />
Inoltre ho deciso di "aprire" i codici sorgente di BugChecker, sotto la GNU General
Public License, versione 2, nella speranza che qualche volenteroso si unisca allo
sviluppo per il completamento e la realizzazione di tutte quelle feature che mancano
al tool per renderlo una efficace e "free" (=gratis) alternativa a quello che oggi
è l'unico competitor in commercio, ossia Syser (che non ho mai usato e che, a quanto
pare, è avvolto nell'oscurità, per ciò che concerne l'identità degli sviluppatori
--- il sito è ospitato da un ISP del Texas, mentre l'articolo sulla Wikipedia è stato
recentemente rimosso, poichè troppo "promozionale"). Ovviamente Syser è un software
a pagamento.<br /><br />
Il sito di BugChecker è <a href="http://bugchecker.com/">http://bugchecker.com/</a>:<br /><br /><a href="http://bugchecker.com/"><img src="http://www.vitoplantamura.com/files/public/bcsite.jpg" border="0" /></a><br />
Il mio indirizzo email, per domande o altro, è sempre lo stesso: planta__AT__vitoplantamura.com.<br /><br /></font>
        <img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=187e2245-c857-4e0a-adee-338a30ee2629" />
      </body>
      <title>Un poco di Kernel fa sempre bene (Parte 2)</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,187e2245-c857-4e0a-adee-338a30ee2629.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2010/03/18/UnPocoDiKernelFaSempreBeneParte2.aspx</link>
      <pubDate>Thu, 18 Mar 2010 11:48:52 GMT</pubDate>
      <description>&lt;font size="3"&gt;
&lt;br&gt;
Invece di realizzare una seconda parte per questo post, che probabilmente avrebbe
potuto estendersi all'infinito, ho preferito, nel mese di Gennaio, riprendere seriamente
in mano BugChecker (che, per chi non lo sapesse, è un "clone" del famoso Numega Softice,
oramai "dismesso" da Compuware, interamente sviluppato dal sottoscritto un 6/7 anni
or sono) e quindi portarlo da Windows 2000 SP4 (unica piattaforma supportata fino
al 2009) a Windows XP (tutti i service pack).&lt;br&gt;
&lt;br&gt;
La compatibilità con Windows 2000 e Windows XP (tutti i service pack) è ottenuta tramite
una utility (scritta ad-hoc) che permette di scaricare dal symbol server di Microsoft
i file DBG e/o PDB di una data immagine del kernel di Windows, quindi di generare
automaticamente un file di riferimento per il driver kernel del debugger con puntatori
ed offset a funzioni chiave del sistema (necessarie al debugger per intercettare chiamate
interne del kernel per vari scopi, come per esempio mantenere un suo Page Frame Db).&lt;br&gt;
&lt;br&gt;
Inoltre ho deciso di "aprire" i codici sorgente di BugChecker, sotto la GNU General
Public License, versione 2, nella speranza che qualche volenteroso si unisca allo
sviluppo per il completamento e la realizzazione di tutte quelle feature che mancano
al tool per renderlo una efficace e "free" (=gratis) alternativa a quello che oggi
è l'unico competitor in commercio, ossia Syser (che non ho mai usato e che, a quanto
pare, è avvolto nell'oscurità, per ciò che concerne l'identità degli sviluppatori
--- il sito è ospitato da un ISP del Texas, mentre l'articolo sulla Wikipedia è stato
recentemente rimosso, poichè troppo "promozionale"). Ovviamente Syser è un software
a pagamento.&lt;br&gt;
&lt;br&gt;
Il sito di BugChecker è &lt;a href="http://bugchecker.com/"&gt;http://bugchecker.com/&lt;/a&gt;:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://bugchecker.com/"&gt;&lt;img src="http://www.vitoplantamura.com/files/public/bcsite.jpg" border="0"&gt;&lt;/a&gt;
&lt;br&gt;
Il mio indirizzo email, per domande o altro, è sempre lo stesso: planta__AT__vitoplantamura.com.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=187e2245-c857-4e0a-adee-338a30ee2629" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,187e2245-c857-4e0a-adee-338a30ee2629.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=48a04584-5505-4c68-9ad2-84b46109374b</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,48a04584-5505-4c68-9ad2-84b46109374b.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,48a04584-5505-4c68-9ad2-84b46109374b.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=48a04584-5505-4c68-9ad2-84b46109374b</wfw:commentRss>
      <title>Un poco di Kernel fa sempre bene (Parte 1)</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,48a04584-5505-4c68-9ad2-84b46109374b.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2009/07/12/UnPocoDiKernelFaSempreBeneParte1.aspx</link>
      <pubDate>Sun, 12 Jul 2009 10:38:30 GMT</pubDate>
      <description>&lt;font size="3"&gt;
&lt;br&gt;
Sbirciando dopo quasi 5 anni nel codice sorgente di &lt;a href="http://www.vitoplantamura.com/index.aspx?page=bugchecker"&gt;BugChecker&lt;/a&gt; (un
kernel debugger "alla SoftICE" che ho sviluppato all'epoca con l'intento primario
di approfondire le mie conoscenze del sistema ai più bassi livelli possibili e per
collaudare tecniche di reverse engineering non frequentemente utilizzabili in scenari
quotidiani) mi sono appassionato non poco a ripercorrere l'iter di attivazione del
debugger nel caso di sistemi multiprocessore. Questo è uno screenshot del debugger
al lavoro sul codice del kernel di Windows 2000 --- con supporto per tastiera e mouse
PS/2 (il sistema, un Pentium 3 bi-processore, è bloccato in ogni sua funzione in attesa
di un input alla console di BugChecker):&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.vitoplantamura.com/images/bc_screen1.gif"&gt;
&lt;br&gt;
&lt;br&gt;
Per chi non lo sapesse, un kernel debugger, a differenza di Visual Studio, che è uno
"user mode debugger", per così dire, o del CLR Debugger, permette di "debuggare" (o
più comunemente "analizzare") il codice assembler del sistema a tutti i livelli, sia
quello kernel (dove le componenti core del sistema e parte dei driver risiedono) che
quello user (dove le applicazioni di tutti i giorni vengono caricate ed eseguite).
Il supporto tipico a questa attività sono i file di simboli dei principali moduli
kernel e user del sistema, facilmente scaricabili da una sorta di Web Service di Microsoft
(i dettagli del protocollo web utilizzato dal Symbol Server di Microsoft sono discussi
in &lt;a href="http://www.vitoplantamura.com/index.aspx?page=symretriever"&gt;questo mio
articolo&lt;/a&gt;). Senza i simboli, che danno un nome alle procedure e alle aree di memoria,
l'interpretazione del codice assembler sarebbe estremamente più impegnativa. Come
è risaputo i codici sorgente di Windows sono preclusi ai più, e libri essenziali come
Windows Internals di Russinovich possono soddisfare la curiosità dei più arditi fino
ad un certo punto: poi devono intervenire le capacità personali di analisi e deduzione
dell'individuo, attraverso quella attività che è detta di "reverse engineering". Sviluppare
BugChecker è stata una delle esperienze professionali più divertenti che abbia mai
condotto, poichè l'intera base di conoscenze che sono state presupposto per il suo
sviluppo derivano da una attività sistematica e metodica di reverse engineering di
parte del kernel di Windows 2000 (attraverso SoftICE stesso, IDA, un decompilatore,
e la bibbia già citata di Russinovich).&lt;br&gt;
&lt;br&gt;
Per questa sua caratteristica peculiaria, questo tipo di software viene spesso utilizzato
per "sbirciare" nel codice di applicazioni (per capirne il funzionamento, a fini più
o meno leciti) e nel codice del sistema e delle sue componenti chiave (comunemente
per scoprirne vulnerabilità o simili). Tipicamente, malware come i rootkit nascono
da analisi condotte attraverso strumenti di questo tipo.&lt;br&gt;
&lt;br&gt;
La base di funzionamento di BugChecker (e di SoftICE) è un kernel driver destinato
ad intercettare l'indirizzo di memoria virtuale del framebuffer video e il suo formato,
in modo da poter disegnare la propria interfaccia senza passare dai servizi di sistema
(DDI/GDI). Un driver secondario è richiesto (rispetto al modulo del debugger vero
e proprio) poichè tale driver viene caricato al boot del sistema, prima che avvenga
l'inizializzazione di DirectDraw (e dando la possibilità di intercettare gli entry
point primari in fase di inizializzazione del sottosistema video al fine di intercettare
certe strutture contenenti le informazioni di cui parlavo prima). Un articolo sul
mio sito (&lt;a href="http://www.vitoplantamura.com/index.aspx?page=bcvideo"&gt;qui&lt;/a&gt;)
spiega in dettaglio il funzionamento di questa componente, con codici sorgente e binari
inclusi. Lo sviluppo di questa parte ha richiesto uno studio approfondito di DirectDraw
lato kernel (via MSDN) e lunghe sessioni di "debugging" kernel per capire come in
effetti il sistema funzionava.&lt;br&gt;
&lt;br&gt;
La prima cosa che il debugger fà è allocare memoria. La funzione utilizzata è ExAllocatePool,
col parametro NonPagedPool, che indica al sistema di riservare della memoria virtuale
non paginabile su disco (quindi perennemente associata a della memoria fisica). Questo
è particolarmente importante, poichè il debugger potrebbe trovarsi a fare trace in
codice di sistema ad un IRQL maggiore o uguale a DISPATCH_LEVEL. In parole povere,
l'IRQL (Interrupt Request Level) è un intero assegnato per processore (con costanti
quali DISPATCH_LEVEL) che regola la prioritizzazione degli interrupt per quella CPU.
In sostanza, gli interrupt (ossia eventi software o hardware) che accadono ad un IRQL
minore o uguale a quello attualmente impostato per un processore vengono bloccati
e messi in attesa, mentre interrupt che accadono ad un IRQL maggiore interrompono
l'attività corrente (poichè più prioritari) vengono eseguiti ed una volta completati
viene ripresa l'attività precedente, all'IRQL precedente. Le routine di sistema che
gestiscono lo swap di pagine di memoria nel paging file verso memoria fisica vengono
eseguite ad un IRQL di livello DISPATCH_LEVEL: questo significa che se ci trovassimo
ad un IRQL maggiore e provassimo a leggere/scrivere/eseguire della memoria "non presente",
il sistema non potrebbe leggerla dal disco e si andrebbe direttamente in Blue Screen
(con errore IRQL_NOT_LESS_OR_EQUAL).&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.vitoplantamura.com/blog/images/post_kernel_1_bsod.jpg" alt="post_kernel_1_bsod.jpg" width="481" border="0" height="328"&gt;
&lt;br&gt;
&lt;br&gt;
Una delle cose successive che vengono fatte è determinare l'indirizzo virtuale della
memoria video testo (indirizzo fisico: 0xB8000). Il debugger infatti viene caricato
subito dopo il boot ed è possibile fare trace di codice kernel durante l'avvio del
sistema, quando ancora non si è passati ad una modalità video grafica. Questo può
essere fatto navigando la Page Directory (che tiene traccia del rapporto tra memoria
fisica e virtuale) oppure attraverso l'API di sistema MmMapIoSpace:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/01/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;" lang="EN-US"&gt;#ifdef&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt; USE_PAGETABLE_TO_OBTAIN_TEXTMODE_VIDEOADDRESS&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PhysAddressToLinearAddresses(
&amp;amp; extension-&amp;gt;pvTextVideoBuffer, 1, NULL, 0xB8000 );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;" lang="EN-US"&gt;#else&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PHYSICAL_ADDRESS&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;paPhysAddr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;paPhysAddr.QuadPart
= 0xB8000;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;extension-&amp;gt;dglLayouts.pvTextVideoBuffer
= MmMapIoSpace( paPhysAddr, 1, MmNonCached );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;#endif&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;font size="3"&gt;
&lt;br&gt;
La procedura PhysAddressToLinearAddresses, riportata di seguito, è piuttosto complessa.
Conto in un post successivo di discutere circa i meccanismi di gestione della memoria
virtuale in Windows NT-Vista Kernel: Page Tables, Page Directories, Translation lookaside
buffers, differenze tra x86/PAE/x64/Itanium e quant'altro.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/01/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;NTSTATUS
PhysAddressToLinearAddresses( OUT PVOID* ppvOutputVector, IN ULONG ulOutputVectorSize,
OUT ULONG* pulOutputVectorRetItemsNum, IN DWORD dwPhysAddress )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NTSTATUS&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;nsRetVal
= STATUS_SUCCESS;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwPageDir
= (DWORD*) 0xC0300000;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ULONG&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i,
j;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageDirEntry,
dwPageTblEntry;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwPageTable;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageTblEntryPhysAddress[
2 ];&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ULONG&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ulOutputVectorPos
= 0;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pulOutputVectorRetItemsNum )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*
pulOutputVectorRetItemsNum = 0;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Search in the Page Directory for the Specified Address.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;for&lt;/span&gt; (
i=0; i&amp;lt;1024; i++ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageDirEntry
= pdwPageDir[ i ];&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Check if this Page Table has an Address and if its Present bit is set to 1.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
( dwPageDirEntry &amp;gt;&amp;gt; 12 ) &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(
dwPageDirEntry &amp;amp; 0x1 ) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwPageTable
= (DWORD*) ( (BYTE*) 0xC0000000 + i * 0x1000 );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;for&lt;/span&gt; (
j=0; j&amp;lt;1024; j++ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageTblEntry
= pdwPageTable[ j ];&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Check if this Page Table Entry has an associated Physical Address.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
dwPageTblEntry &amp;gt;&amp;gt; 12 )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Calculate the MIN and MAX Phys Address of the Page Table Entry.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageTblEntryPhysAddress[
0 ] = dwPageTblEntry &amp;amp; 0xFFFFF000;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageTblEntryPhysAddress[
1 ] = dwPageTblEntryPhysAddress[ 0 ] + 0x1000 - 1;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Check if our Address is between the Interval.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
dwPhysAddress &amp;gt;= dwPageTblEntryPhysAddress[ 0 ] &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPhysAddress
&amp;lt;= dwPageTblEntryPhysAddress[ 1 ] )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Add this Linear Address.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
ulOutputVectorPos &amp;lt; ulOutputVectorSize )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ppvOutputVector[
ulOutputVectorPos ++ ] = (PVOID)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;(
i * 0x400000 + j * 0x1000 +&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;(
dwPhysAddress - dwPageTblEntryPhysAddress[ 0 ] ) );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pulOutputVectorRetItemsNum )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*
pulOutputVectorRetItemsNum = ulOutputVectorPos;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; STATUS_SUCCESS;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Return to the Caller.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pulOutputVectorRetItemsNum )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*
pulOutputVectorRetItemsNum = ulOutputVectorPos;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;return&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; nsRetVal;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;font size="3"&gt;
&lt;br&gt;
Passo successivo è il caricamento del file di configurazione del debugger. Questo
viene fatto attraverso la funzione LoadFile, riportata qui di seguito:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/03/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;PVOID
LoadFile( IN PCWSTR pszFileName, IN POOL_TYPE ptPoolType, OUT ULONG* pulSize )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PVOID&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;retval
= NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NTSTATUS&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ntStatus;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;HANDLE&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handle
= NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;OBJECT_ATTRIBUTES&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;attrs;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;UNICODE_STRING&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;unicode_fn;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;IO_STATUS_BLOCK&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;iosb;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FILE_STANDARD_INFORMATION&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;info;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ULONG&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;size
= 0;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PVOID&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mem;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LARGE_INTEGER&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;zeropos;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;memset(
&amp;amp; zeropos, 0, &lt;span style="color: blue;"&gt;sizeof&lt;/span&gt;( zeropos ) );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Load the File.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;RtlInitUnicodeString(
&amp;amp; unicode_fn, pszFileName );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;InitializeObjectAttributes(
&amp;amp; attrs,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
unicode_fn,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;OBJ_CASE_INSENSITIVE,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL
);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ntStatus
= ZwCreateFile( &amp;amp; handle,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FILE_READ_DATA
| GENERIC_READ | SYNCHRONIZE,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
attrs,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
iosb,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FILE_ATTRIBUTE_NORMAL,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FILE_OPEN,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FILE_NON_DIRECTORY_FILE
| FILE_RANDOM_ACCESS | FILE_SYNCHRONOUS_IO_NONALERT,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0
);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
ntStatus == STATUS_SUCCESS &amp;amp;&amp;amp; handle )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ntStatus
= ZwQueryInformationFile(&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handle,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
iosb,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
info,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;sizeof&lt;/span&gt;(
info ),&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FileStandardInformation
);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
ntStatus == STATUS_SUCCESS )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;size
= info.EndOfFile.LowPart;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mem
= ExAllocatePool( ptPoolType, size );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
mem )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ntStatus
= ZwReadFile(&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handle,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
iosb,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mem,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;size,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;
zeropos,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;NULL
);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
ntStatus != STATUS_SUCCESS || iosb.Information != size )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ExFreePool(
mem );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;retval
= mem;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ZwClose(
handle );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Return.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pulSize &amp;amp;&amp;amp; retval )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*
pulSize = size;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; retval;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;font size="3"&gt;
&lt;br&gt;
Successivamente vengono letti e salvati alcuni export del kernel come *MmUserProbeAddress
(indirizzo virtuale che determina l'inizio della memoria riservata al kernel) e *KeNumberProcessors,
che si commenta da solo.&lt;br&gt;
&lt;br&gt;
Il passo successivo, ben più importante, è di scoprire l'indirizzo virtuale della
DriverSection del kernel, ossia del file NtOsKrnl.exe. Per inciso il nome del modulo
del kernel nel CD di installazione del sistema dipende dall'architettura del processore:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size="3"&gt;NTOSKRNL.EXE, single-processor without PAE&lt;/font&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;NTKRNLMP.EXE, multi-processor without PAE&lt;/font&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;NTKRNLPA.EXE, single-processor with PAE&lt;/font&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;font size="3"&gt;NTKRPAMP.EXE, multi-processor with PAE&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;font size="3"&gt;
&lt;br&gt;
Nota: Le Physical Address Extension (PAE) (architettura Intel IA-32) è un meccanismo
che permette a processori IA-32 di indirizzare fino a 64 GB di memoria RAM.&lt;br&gt;
&lt;br&gt;
La DriverSection di un driver kernel è una struttura di tipo _LDR_DATA_TABLE_ENTRY.
Ciascun driver caricato attraverso l'SCM, ha un entry point del tipo:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/05/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;NTSTATUS
DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath )&lt;/span&gt;
&lt;br&gt;
&lt;font size="3"&gt;
&lt;br&gt;
dove DriverObject-&amp;gt;DriverSection punta alla struttura _LDR_DATA_TABLE_ENTRY del
driver sys di BugChecker. La DriverSection, grazie al comando dt di WinDbg, rivela
questi field:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/06/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;lkd&amp;gt;
dt _LDR_DATA_TABLE_ENTRY&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×000
InLoadOrderLinks : _LIST_ENTRY&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×008
InMemoryOrderLinks : _LIST_ENTRY&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×010
InInitializationOrderLinks : _LIST_ENTRY&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×018
DllBase : Ptr32 Void&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×01c
EntryPoint : Ptr32 Void&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×020
SizeOfImage : Uint4B&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×024
FullDllName : _UNICODE_STRING&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×02c
BaseDllName : _UNICODE_STRING&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×034
Flags : Uint4B&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×038
LoadCount : Uint2B&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;+0×03a
TlsIndex : Uint2B&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;.. .. .. .. ..
.. .. .. .. ..&lt;/span&gt;
&lt;br&gt;
&lt;font size="3"&gt;
&lt;br&gt;
Il field che ci interessa è InLoadOrderLinks, che è un nodo alla linked list (di tipo
_LIST_ENTRY) di tutti i moduli mappati nel kernel. Il primo modulo caricato nel kernel
è NtOsKrnl.exe; quindi è ragionevole cercare per la DriverSection di NTOSKRNL in modo
da individuare la "testa" della linked list, e quindi avere una maniera semplice e
veloce per iterare tra tutti i moduli kernel caricati in un dato momento (navigando
la linked list dalla testa verso la coda, per così dire). Questo è fondamentale per
BugChecker e per il suo motore dei simboli: partendo dall'informazione di dove una
specifica posizione di memoria si trova (sia codice che dati), in termini di &lt;b&gt;modulo!section+displacement&lt;/b&gt;,
è possibile estrarre dalle informazioni dei simboli di un dato modulo il nome di una
funzione o di una variabile.&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.vitoplantamura.com/blog/images/post_kernel_1_symloc.gif" alt="post_kernel_1_symloc.gif" width="738" border="0" height="432"&gt;
&lt;br&gt;
&lt;br&gt;
La funzione DiscoverNtoskrnlDriverSection è piuttosto semplice, e riceve come parametro
la DriverSection di BugChecker (o di qualsivoglia driver caricato dall'SCM), ossia
DriverObject-&amp;gt;DriverSection.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/08/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;" lang="EN-US"&gt;static&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt; CHAR&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;g_szDiscoverNtoskrnlDriverSectionTempBuffer[
2 * 1024 ]; &lt;span style="color: green;"&gt;// NOTE: sizeof &amp;lt; sizeof( System Page Size
)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;VOID*
DiscoverNtoskrnlDriverSection( IN VOID* pvDriverSection )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LIST_ENTRY*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pleListNodePtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pwImageNameLengthPtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WORD&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;wImageNameLength;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pwImageNameUnicodePtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwImageNameUnicodePtrPtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pwWordPtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CHAR*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pcCharPtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ULONG&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ulI;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Do the Requested Operation.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pleListNodePtr
= (LIST_ENTRY*) pvDriverSection;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;while&lt;/span&gt;(
TRUE )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Get the Pointer to the Previous Node.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pleListNodePtr == NULL ||&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IsPagePresent_DWORD(
(DWORD*) ( ( (BYTE*) pleListNodePtr ) + FIELD_OFFSET( LIST_ENTRY, Blink ) ) ) == FALSE
)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pleListNodePtr
= pleListNodePtr-&amp;gt;Blink;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pleListNodePtr == NULL ||&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pleListNodePtr
== (LIST_ENTRY*) pvDriverSection ||&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IsPagePresent(
pleListNodePtr ) == FALSE )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Get the Name of the Module.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pwImageNameLengthPtr
= (WORD*) ( ( (BYTE*) pleListNodePtr ) + MACRO_IMAGENAME_FIELDOFFSET_IN_DRVSEC );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
IsPagePresent_WORD( pwImageNameLengthPtr ) == FALSE )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;wImageNameLength
= * pwImageNameLengthPtr / &lt;span style="color: blue;"&gt;sizeof&lt;/span&gt;( WORD );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
wImageNameLength == 0 ||&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;wImageNameLength
&amp;gt; &lt;span style="color: blue;"&gt;sizeof&lt;/span&gt;( g_szDiscoverNtoskrnlDriverSectionTempBuffer
) - 1 )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwImageNameUnicodePtrPtr
= (DWORD*) ( ( (BYTE*) pleListNodePtr ) +&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MACRO_IMAGENAME_FIELDOFFSET_IN_DRVSEC
+ FIELD_OFFSET( UNICODE_STRING, Buffer ) );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
IsPagePresent_DWORD( pdwImageNameUnicodePtrPtr ) == FALSE )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pwImageNameUnicodePtr
= (WORD*) * pdwImageNameUnicodePtrPtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
pwImageNameUnicodePtr == NULL ||&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IsPagePresent(
pwImageNameUnicodePtr ) == FALSE )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
IsPagePresent_WORD( pwImageNameUnicodePtr + wImageNameLength - 1 ) == FALSE )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; NULL;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pwWordPtr
= pwImageNameUnicodePtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pcCharPtr
= g_szDiscoverNtoskrnlDriverSectionTempBuffer;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;for&lt;/span&gt; (
ulI = 0; ulI &amp;lt; wImageNameLength; ulI ++ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*
pcCharPtr ++ = (CHAR) ( ( * pwWordPtr ++ ) &amp;amp; 0xFF );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*
pcCharPtr = &lt;span style="color: maroon;"&gt;'\0'&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_strupr(
g_szDiscoverNtoskrnlDriverSectionTempBuffer );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Check for the Presence of the NTOSKRNL Module Name.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
strstr( g_szDiscoverNtoskrnlDriverSectionTempBuffer, MACRO_NTOSKRNL_MODULENAME_UPPERCASE
) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;return&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; pleListNodePtr;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;font size="3"&gt;
&lt;br&gt;
La funzione DiscoverBytePointerPosInModules è utilizzata appunto per risalire all'informazione
modulo!section+displacement partendo da un indirizzo virtuale (che può essere il primo
byte disassemblato della finestra di debug, oppure l'Instruction Pointer attuale).
In base alla "posizione" del byte di memoria richiesto (se kernel o user, in base
all'export *MmUserProbeAddress) vengono adottati due approcci diversi. Nel caso della
memoria kernel, viene utilizzata la linked list della DriverSection dell'NTOSKRNL.EXE.
In sostanza, percorrendo la linked list da sinistra verso destra (partendo dalla driver
section di NtOsKrnl), seguendo i vari puntatori forward della struttura LIST_ENTRY,
è possibile avere un riferimento a tutti i moduli caricati nel kernel. La struttura
IMAGE_DOS_HEADER di ciascun modulo caricato nel kernel (che sia .sys, .exe o .dll)
si trova ad uno specifico offset di byte rispetto alla stessa struttura LIST_ENTRY.
Questo permette facilmente di avere accesso al modulo, alla relativa sezione con la
lista delle "section" (tipo .text o .data) e quindi di determinare se una posizione
di memoria virtuale "cade" all'interno del modulo, in quale section, e con quale displacement
rispetto alla base della section stessa. Questa informazione (modulo!section+displacement)
è la chiave di lookup nei file di simboli per ottenere in fase di debugging nomi di
funzioni, variabili e quant'altro (questo vale anche per le applicazioni user e relativi
PDB).&lt;br&gt;
&lt;br&gt;
Se il byte di memoria "cade" nello spazio user, il discorso è un poco diverso. In
questo caso, viene analizzato il VAS (Virtual Address Space) associato al processo
attualmente attivo nel sistema, per risalire alle stesse informazioni di modulo!section+displacement
necessarie per ottenere le info di debug. Il VAS è una risorsa di sistema che rappresenta
la memoria allocata da un dato processo attraverso le API VirtualAlloc* e VirtualFree*,
che stanno alla base di ogni operazione su memoria virtuale user in Windows (dal malloc/free
di C ai memory mapped files). Il VAS si basa su una struttura ad albero di descrittori
VAD (Virtual Address Descriptor) che rappresentano le caratteristiche di una determinata
area di memoria virtuale in quello specifico processo (per inciso, ad ogni processo
Windows corrisponde un unico specifico VAS, che a sua volta gestisce un albero dettagliato
di descrittori VAD per rappresentare lo stato della memoria virtuale in quel dato
processo). Un descrittore VAD ha questo formato:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/09/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;" lang="EN-US"&gt;#pragma&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt; &lt;span style="color: blue;"&gt;pack&lt;/span&gt;(&lt;span style="color: blue;"&gt;push&lt;/span&gt;,
1)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;typedef&lt;/span&gt; &lt;span style="color: blue;"&gt;struct&lt;/span&gt; _VAD&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;VOID*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pvStartingAddress;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;VOID*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pvEndingAddress;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;struct&lt;/span&gt; _VAD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pvadParentLink;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;struct&lt;/span&gt; _VAD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pvadLeftLink;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;struct&lt;/span&gt; _VAD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pvadRightLink;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwFlags;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwUndocumented_DWORD;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}
VAD, *PVAD;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;" lang="EN-US"&gt;#pragma&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt; &lt;span style="color: blue;"&gt;pack&lt;/span&gt;(&lt;span style="color: blue;"&gt;pop&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;font size="3"&gt;
&lt;br&gt;
La struttura ad albero risultante è facilmente intuibile. Il codice sorgente della
funzione DiscoverBytePointerPosInModules è visionabile qui:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.vitoplantamura.com/files/blog/DiscoverBytePointerPosInModules.htm"&gt;&lt;img src="http://www.vitoplantamura.com/blog/images/post_kernel_1_dbpim.gif" alt="post_kernel_1_dbpim.gif" width="550" border="0" height="402"&gt;&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
La funzione non è particolarmente complessa: prima viene determinata al "zona" del
puntatore in input, se kernel o user. Nel caso di puntatore user, viene chiamata la
funzione VadTreeWalk che in maniera ricorsiva determina, se presente, un descrittore
VAD facente riferimento alla memoria che stiamo cercando. La seconda parte della procedura,
quella relativa alla ricerca nello spazio kernel, fa ciò che ho illustrato precedentemente,
in buona sostanza (ricerca del modulo partendo da NtOsKrnl). Particolare interessante
è l'utilizzo estensivo della funzione IsPagePresent:&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;link rel="File-List" href="file:///F:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msoclip1/01/clip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:HyphenationZone&gt;14&lt;/w:HyphenationZone&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;//====================================&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;//
IsPagePresent Function Definition.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;//====================================&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;BOOLEAN
IsPagePresent( IN PVOID pvVirtAddress )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwPageDir
= (DWORD*) 0xC0300000;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageDirEntry;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD*&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pdwPageTables
= (DWORD*) 0xC0000000;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DWORD&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageTableEntry;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Check the Page Tables.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageDirEntry
= pdwPageDir[ ( (DWORD) pvVirtAddress ) / 0x400000 ];&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
( dwPageDirEntry &amp;gt;&amp;gt; 12 ) &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(
dwPageDirEntry &amp;amp; 0x1 ) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
dwPageDirEntry &amp;amp; (1&amp;lt;&amp;lt;7) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; TRUE;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dwPageTableEntry
= pdwPageTables[ ( (DWORD) pvVirtAddress ) / 0x1000 ];&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (
( dwPageTableEntry &amp;gt;&amp;gt; 12 ) &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(
dwPageTableEntry &amp;amp; 0x1 ) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; TRUE;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//
Return to the Caller.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;" lang="EN-US"&gt;
&lt;!--[if !supportEmptyParas]--&gt;&amp;nbsp;&lt;!--[endif]--&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;return&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; FALSE;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style=""&gt;
&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;font size="3"&gt;
&lt;br&gt;
Lo scopo di questa funzione e delle sue varianti è di verificare (nella Page Directory)
se una zona di memoria è "presente", cioè se è fisicamente accessibile in lettura.
Considerando che il codice del debugger deve funzionare a qualsiasi IRQL (vedi discorso
di prima su NonPagedPool) ogni lettura esterna alle strutture del debugger deve essere
prima verificata per evitare STOP di tipo IRQL_NOT_LESS_OR_EQUAL.&lt;br&gt;
&lt;br&gt;
- fine prima parte - &lt;/font&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=48a04584-5505-4c68-9ad2-84b46109374b" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,48a04584-5505-4c68-9ad2-84b46109374b.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=0a22a513-86d7-41ab-865f-d86309ca0590</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,0a22a513-86d7-41ab-865f-d86309ca0590.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,0a22a513-86d7-41ab-865f-d86309ca0590.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0a22a513-86d7-41ab-865f-d86309ca0590</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <font size="3">
          <br />
Ultimamente sto avendo parecchi problemi nel debug di una grossa applicazione .NET
2.0 scritta in VB.NET che conta più di 70 progetti. Molto frequentemente, quando attivo
di debugger di Visual Studio oppure provo ad "attaccarmi" al processo di ASP.NET (aspnet_wp.exe)
l'operazione fallisce miseramente con un dialog del tipo:<br /><br /><img src="http://www.vitoplantamura.com/blog/images/error.GIF" alt="error.GIF" border="0" height="113" width="704" /><br /><br />
Questo molte volte provoca il crash dell'IDE più l'abort del thread ASP.NET dell'applicazione
che cercavo di analizzare. Il tutto alla fine si traduce in una enorme perdita di
tempo.<br /><br />
Per risolvere il problema ho individuato due soluzioni:<br /><br /><b>1)</b> Riavvio di Visual Studio prima del debug + IISRESET + Riavvio del servizio
"Machine Debug Manager" (che si occupa direttamente dei debug locali e remoti).<br /><br />
Partendo da questa situazione "pulita" 1 volta su 2 riesco a debuggare, fissare breakpoint
e fare trace nella succitata applicazione. Immagino che il problema origini dal fatto
che l'enorme complessità e vastità di tale applicazione determini una quantità di
simboli da caricare in fase di debug non indifferente, e per una ragione o per l'altra
(out of memory, probabilmente) qualcosa va storto.<br /><br /><b>2)</b> Soluzione più sicura e con maggiore percentuale di successo (100% per il
momento) è di installare ed utilizzare per i soli debug il <font color="#ff0000">Microsoft
CLR Debugger</font>, tool decisamente più snello e veloce di Visual Studio per questo
genere di cose.<br /><br />
Attaccarsi al processo di ASP.NET è una operazione veloce e senza problemi, e fare
trace nel codice è particolarmente veloce. Ovviamente è possibile ispezionare il contenuto
di oggetti live (Watch) e di posizionare breakpoint nel codice (anche condizionali).
A tale scopo, è sufficiente aprire un file di codice relativo alla build che si sta
debuggando, quindi inserire il breakpoint dove si vuole. Questo è dovuto al fatto
che nei file di simboli (.PDB) i riferimenti alle path dei file sorgente sono sempre
assoluti.<br /><br />
Il Microsoft CLR Debugger è incluso nel .NET Framework 2.0 Software Development Kit
(SDK), scaricabile <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec">qui</a>.<br /></font>
        <p>
        </p>
        <img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=0a22a513-86d7-41ab-865f-d86309ca0590" />
      </body>
      <title>Quando Visual Studio non si lascia più governare...</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,0a22a513-86d7-41ab-865f-d86309ca0590.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2009/07/08/QuandoVisualStudioNonSiLasciaPi%c3%b9Governare.aspx</link>
      <pubDate>Wed, 08 Jul 2009 19:20:13 GMT</pubDate>
      <description>&lt;font size="3"&gt;
&lt;br&gt;
Ultimamente sto avendo parecchi problemi nel debug di una grossa applicazione .NET
2.0 scritta in VB.NET che conta più di 70 progetti. Molto frequentemente, quando attivo
di debugger di Visual Studio oppure provo ad "attaccarmi" al processo di ASP.NET (aspnet_wp.exe)
l'operazione fallisce miseramente con un dialog del tipo:&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.vitoplantamura.com/blog/images/error.GIF" alt="error.GIF" border="0" height="113" width="704"&gt;
&lt;br&gt;
&lt;br&gt;
Questo molte volte provoca il crash dell'IDE più l'abort del thread ASP.NET dell'applicazione
che cercavo di analizzare. Il tutto alla fine si traduce in una enorme perdita di
tempo.&lt;br&gt;
&lt;br&gt;
Per risolvere il problema ho individuato due soluzioni:&lt;br&gt;
&lt;br&gt;
&lt;b&gt;1)&lt;/b&gt; Riavvio di Visual Studio prima del debug + IISRESET + Riavvio del servizio
"Machine Debug Manager" (che si occupa direttamente dei debug locali e remoti).&lt;br&gt;
&lt;br&gt;
Partendo da questa situazione "pulita" 1 volta su 2 riesco a debuggare, fissare breakpoint
e fare trace nella succitata applicazione. Immagino che il problema origini dal fatto
che l'enorme complessità e vastità di tale applicazione determini una quantità di
simboli da caricare in fase di debug non indifferente, e per una ragione o per l'altra
(out of memory, probabilmente) qualcosa va storto.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;2)&lt;/b&gt; Soluzione più sicura e con maggiore percentuale di successo (100% per il
momento) è di installare ed utilizzare per i soli debug il &lt;font color="#ff0000"&gt;Microsoft
CLR Debugger&lt;/font&gt;, tool decisamente più snello e veloce di Visual Studio per questo
genere di cose.&lt;br&gt;
&lt;br&gt;
Attaccarsi al processo di ASP.NET è una operazione veloce e senza problemi, e fare
trace nel codice è particolarmente veloce. Ovviamente è possibile ispezionare il contenuto
di oggetti live (Watch) e di posizionare breakpoint nel codice (anche condizionali).
A tale scopo, è sufficiente aprire un file di codice relativo alla build che si sta
debuggando, quindi inserire il breakpoint dove si vuole. Questo è dovuto al fatto
che nei file di simboli (.PDB) i riferimenti alle path dei file sorgente sono sempre
assoluti.&lt;br&gt;
&lt;br&gt;
Il Microsoft CLR Debugger è incluso nel .NET Framework 2.0 Software Development Kit
(SDK), scaricabile &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec"&gt;qui&lt;/a&gt;.&lt;br&gt;
&lt;/font&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=0a22a513-86d7-41ab-865f-d86309ca0590" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,0a22a513-86d7-41ab-865f-d86309ca0590.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=da6f8e20-a955-488e-8c52-501f98d67325</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,da6f8e20-a955-488e-8c52-501f98d67325.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,da6f8e20-a955-488e-8c52-501f98d67325.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=da6f8e20-a955-488e-8c52-501f98d67325</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>2 Miei Articoli su UGIdotNET</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,da6f8e20-a955-488e-8c52-501f98d67325.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2008/03/12/2MieiArticoliSuUGIdotNET.aspx</link>
      <pubDate>Wed, 12 Mar 2008 13:43:12 GMT</pubDate>
      <description>&lt;p&gt;
&lt;span lang=IT style="mso-ansi-language: IT"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;Ho scritto
due articoli su due tecnologie recenti e molto interessanti di Microsoft, su &lt;a href="http://www.ugidotnet.org"&gt;UGIdotNET&lt;/a&gt;:&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span lang=IT style="mso-ansi-language: IT"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
&lt;o:p&gt;
&lt;font color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span lang=IT style="mso-ansi-language: IT"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;font color=#000000 size=3&gt;&lt;a href="https://www.ugidotnet.org/autore/11435/Vito-Plantamura"&gt;Microsoft
Software Licensing and Protection Services&lt;/a&gt;&lt;/font&gt;
&lt;/div&gt;
&lt;li&gt;
&lt;div class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;font color=#000000 size=3&gt;&lt;a href="https://www.ugidotnet.org/autore/11435/Vito-Plantamura"&gt;Windows
CardSpace e ASP.NET 2.0&lt;/a&gt;&lt;/font&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span lang=IT style="mso-ansi-language: IT"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;E’ necessario
registrarsi al sito prima di poter accedere ai contenuti all’interno.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span lang=IT style="mso-ansi-language: IT"&gt;&lt;font color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span lang=IT style="mso-ansi-language: IT"&gt;&lt;font color=#000000 size=3&gt;Buona Lettura
!&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=da6f8e20-a955-488e-8c52-501f98d67325" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,da6f8e20-a955-488e-8c52-501f98d67325.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=445654cb-f99f-4361-9dd6-e20ea2545e27</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,445654cb-f99f-4361-9dd6-e20ea2545e27.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,445654cb-f99f-4361-9dd6-e20ea2545e27.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=445654cb-f99f-4361-9dd6-e20ea2545e27</wfw:commentRss>
      <title>Una classe per fare Inter-Process Communication tra processi Win32 (C++)</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,445654cb-f99f-4361-9dd6-e20ea2545e27.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2008/02/17/UnaClassePerFareInterProcessCommunicationTraProcessiWin32C.aspx</link>
      <pubDate>Sun, 17 Feb 2008 15:12:38 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font size=3&gt;Per poter fare Inter-Process Communication tra processi Win32, storicamente,
sono disponibili i seguenti strumenti:&lt;/font&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size=3&gt;Clipboard &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;COM&lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Data Copy &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;DDE &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;File Mapping &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Mailslots &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Pipes&lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;RPC &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Windows Sockets&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font size=3&gt;Ognuno di essi ha dei pro, dei contro e delle applicazioni specifiche:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;Clipboard&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Probabilmente si tratta del meccanismo meno idoneo per scambiare dati
tra processi. La clipboard è condivisa da tutta la sessione Windows corrente e soprattutto
l'utente nè ha accesso trasparente quando fà copia ed incolla da un semplice textbox,
per esempio.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Inoltre manca la possibilità di specificare criteri di sicurezza associati
al canale e/o ai dati trasferiti.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;COM&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;OLE (basato su COM) supporta i "compound documents", dove è possibile
edittare parti di documenti provenienti e associati ad applicazioni (processi) Win32
differenti.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;DCOM&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;DCOM permette di avere client e server distribuiti su processi Win32/64
diversi, ed anche su macchine diverse.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Il vantaggio (trasparente) del Marshalling di parametri tra processi
diversi rispetto al COM tradizionale permette di oltrepassare i "limiti" del processo
corrente.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Inoltre, il sofisticato modello di sicurezza implementato permette che
solamente parti autorizzate possano connettersi ad un server DCOM.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;Data Copy &lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Si tratta di un sistema di comunicazione basato sul messaggio Windows
"&lt;u&gt;WM_COPYDATA&lt;/u&gt;".&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Il problema principale con questo sistema è la sicurezza: non è possibile
(in modo semplice) determinare l'identità di chi sta tendando di inviare messaggi
ad un recipient WM_COPYDATA.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Un mio articolo (in inglese) su una classe che implementa questo meccanismo
di IPC è reperibile qui:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.vitoplantamura.com/index.aspx?page=wmcopydata"&gt;&lt;font size=3&gt;http://www.vitoplantamura.com/index.aspx?page=wmcopydata&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;&lt;strong&gt;DDE&lt;/strong&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;DDE è di solito utilizzato per supportare vecchie applicazioni legacy
che possono farne uso.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;In soluzioni di nuova implementazione si preferisce usare uno degli altri
meccanismi di IPC disponibili.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;Mailslots&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Nella mia esperienza di sviluppatore, ho avuto (veramente) poco a che
fare con le Mailslot.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Solitamente vengono utilizzate per fare "broadcast" di piccoli messaggi
tra computer nel contesto di un dominio di rete.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;&lt;strong&gt;Pipes&lt;/strong&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Tra gli strumenti ed il software Microsoft (per Windows NT e superiori),
le Named Pipe sono il secondo meccanismo di elezione per realizzare infrastrutture
di Interprocess Communication tra processi Win32/64 (dopo i File Mapping, come detto
sopra).&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Una mia classe (e relativo articoletto in inglese) che utilizza le Named
Pipe per fare Interprocess Communication è presente negli Archivi del mio sito qui:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.vitoplantamura.com/index.aspx?page=namedpipes"&gt;&lt;font size=3&gt;http://www.vitoplantamura.com/index.aspx?page=namedpipes&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;&lt;strong&gt;RPC&lt;/strong&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;RPC permette di chiamare funzioni remote, in maniera estremamente performante
(in un altro processo sullo stesso computer o anche in un'altra macchina nella rete
locale)&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Per queste caratteristiche di velocità, l'RPC è utilizzato estensivamente
a livello di sistema su piattaforma Windows NT e superiori.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;Windows Sockets&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;I Windows Sockets sono lo strumento di elezione per l'IPC tra computer
in una stessa rete (LAN, WAN o Internet), ma raramente sono utilizzati come meccanismo
unico di comunicazione tra 2 o più processi sulla stessa macchina.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=3&gt;File Mapping, e la classe C++ qui presentata:&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Il File Mapping è uno dei meccanismi più utilizzati per scambiare dati
tra processi sulla stessa macchina, e, sicuramente, uno dei preferiti nelle stesse
applicazioni sviluppate da Microsoft.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;In sostanza, il File Mapping permette di trattare un file come se fosse
una regione di memoria virtuale mappata nello spazio di indirizzamento del processo
corrente. L'opportunità di IPC si presenta quando un secondo processo apre un oggetto
di File Mapping oppure quando lo eredita dal processo padre, come accade nella classe
associata a questo post.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Windows, internamente, mappa la regione di memoria virtuale associata
al File Mapping nel primo processo alla stessa memoria fisica (o posizione nel Paging
File) anche nel secondo processo: il risultato è che quando si scrive o legge da tale
memoria (sia nel primo che nel secondo processo) internamente si sta accedendo alla
stessa memoria fisica della macchina.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;E' possibile associare delle informazioni di sicurezza all'oggetto di
File Mapping tramite la struttura &lt;u&gt;SECURITY_ATTRIBUTES&lt;/u&gt;, così come accade quando
si crea un file, per esempio.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Nel caso specifico della classe qui presentata, l'handle all'oggetto
di File Mapping viene passato al secondo processo tramite command line dal primo processo
(ossia il processo "padre", tramite una chiamata a &lt;u&gt;CreateProcess&lt;/u&gt;). Per rendere
ciò possibile è necessario specificare esplicitamente che gli oggetti kernel che si
stanno creando (nel primo processo) possono essere ereditati da tutti i processi "figli".
Questo impostando un bit nella struttura &lt;u&gt;SECURITY_ATTRIBUTES&lt;/u&gt;, passata poi alle
funzioni "&lt;u&gt;CreateFileMapping&lt;/u&gt;" e "&lt;u&gt;CreateEvent&lt;/u&gt;":&lt;/font&gt;
&lt;/p&gt;
&lt;font size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;font color=#0000ff&gt;SECURITY_ATTRIBUTES&lt;/font&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt; sa;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;::memset(
&amp;amp; sa, 0, &lt;/font&gt;&lt;span style="COLOR: blue"&gt;sizeof&lt;/span&gt;&lt;font color=#000000&gt;( sa
) );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;sa.bInheritHandle
= TRUE;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;m_hDataAvailEvent
= ::&lt;font color=#0000ff&gt;CreateEvent&lt;/font&gt;( &amp;amp; sa, FALSE, FALSE, NULL );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;m_hDataReceivedEvent
= ::&lt;font color=#0000ff&gt;CreateEvent&lt;/font&gt;( &amp;amp; sa, FALSE, FALSE, NULL );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;m_hFileMapping
= ::&lt;font color=#0000ff&gt;CreateFileMapping&lt;/font&gt;( INVALID_HANDLE_VALUE, &amp;amp; sa,
PAGE_READWRITE, 0, m_dwFileMappingDim, NULL );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;span lang=EN-GB style="mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;font face="Times New Roman"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/font&gt;&lt;font size=3&gt;La classe ha due costruttori, a seconda se si è nel primo o nel
secondo processo:&lt;/font&gt;&gt;
&lt;font size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;CSharedMemoryChannel( &lt;font color=#0000ff&gt;DWORD&lt;/font&gt; dwFileMappingDim
)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;CSharedMemoryChannel( &lt;font color=#0000ff&gt;charstring&amp;amp;&lt;/font&gt; csInitParams
)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/font&gt;&lt;font size=3&gt;Il primo processo chiama il primo costruttore, specificando semplicemente
la dimensione della Shared Section da creare.&lt;/font&gt;&gt;
&lt;p&gt;
&lt;font size=3&gt;Il secondo processo, invece, passa una stringa (eventualmente estratta
dalla propria Command Line) con un formato di questo tipo:&lt;/font&gt;
&lt;/p&gt;
&lt;font color=#000000 size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp; &lt;font color=#0000ff&gt;handle
al File Mapping&lt;/font&gt; [PIPE] &lt;font color=#0000ff&gt;dimensione del File Mapping&lt;/font&gt; [PIPE] &lt;font color=#0000ff&gt;handle
al primo Evento (DataAvailEvent)&lt;/font&gt; [PIPE] &lt;font color=#0000ff&gt;handle al secondo
Evento (DataReceivedEvent)&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/font&gt; 
&lt;p&gt;
&lt;font size=3&gt;L'applicazione può chiamare il metodo "&lt;u&gt;GetSharedMemoryDataString&lt;/u&gt;"
per ottenere in automatico questa stringa.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Come per le altre classi di IPC simili presenti nella sezione Archivi
del mio sito, due tipi di puntatore a funzione sono definiti per permettere al consumer
della mia classe di ricevere notifica quando nuovi dati sono presenti oppure quando
l'altra parte si è "disconnessa":&lt;/font&gt;
&lt;/p&gt;
&lt;font size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;typedef&lt;/span&gt;&lt;font color=#000000&gt; VOID
( &lt;/font&gt;&lt;span style="COLOR: blue"&gt;__cdecl&lt;/span&gt;&lt;font color=#000000&gt; * PFNSMCRECV
)( IN DWORD dwParam, IN LPVOID pvBuffer, IN LONG lBufferSize );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;typedef&lt;/span&gt;&lt;font color=#000000&gt; VOID
( &lt;/font&gt;&lt;span style="COLOR: blue"&gt;__cdecl&lt;/span&gt;&lt;font color=#000000&gt; * PFNSMCDISCONNECT
)( IN DWORD dwParam );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;/font&gt;&lt;font size=3&gt;&lt;/font&gt;&amp;nbsp;&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;font size=3&gt;Tali puntatori vengono specificati chiamando l'API "&lt;u&gt;SetRecvFunction&lt;/u&gt;":&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
&lt;font size=3&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;font size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;font color=#0000ff&gt;BOOL&lt;/font&gt; SetRecvFunction
( &lt;font color=#0000ff&gt;PFNSMCRECV&lt;/font&gt; pfnRecv, &lt;font color=#0000ff&gt;PFNSMCDISCONNECT&lt;/font&gt; pfnDisconnect, &lt;font color=#0000ff&gt;DWORD&lt;/font&gt; dwRecvParam
)&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;/font&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font face=Verdana color=#000000 size=3&gt;La
classe è scaricabile qui: &lt;/font&gt;&lt;/span&gt;&lt;a href="http://www.vitoplantamura.com/blog/content/binary/SharedMemoryChannel.h"&gt;&lt;font size=3&gt;SharedMemoryChannel.h
(10,19 KB)&lt;/font&gt;&lt;/a&gt;.&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=445654cb-f99f-4361-9dd6-e20ea2545e27" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,445654cb-f99f-4361-9dd6-e20ea2545e27.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=82b5a323-9b33-4a49-9e34-2432e8c87204</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,82b5a323-9b33-4a49-9e34-2432e8c87204.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,82b5a323-9b33-4a49-9e34-2432e8c87204.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=82b5a323-9b33-4a49-9e34-2432e8c87204</wfw:commentRss>
      <title>Un controllino di “Auto-Completion” semplice semplice</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,82b5a323-9b33-4a49-9e34-2432e8c87204.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2008/01/31/UnControllinoDiAutoCompletionSempliceSemplice.aspx</link>
      <pubDate>Thu, 31 Jan 2008 16:04:11 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font size=3&gt;Nel tentativo di aggiornare questo blog quanto più frequentemente possibile,
mi piacerebbe postare qui del codice che ho scritto qualche tempo fà allo scopo di
implementare qualcosa di simile all’effetto di menù a tendina fatto conoscere al grande
pubblico (se non sbaglio) da &lt;/font&gt;&lt;a href="http://www.google.com/webhp?complete=1&amp;amp;hl=en"&gt;&lt;font size=3&gt;Google
Suggest&lt;/font&gt;&lt;/a&gt;&lt;font size=3&gt; qualche anno orsono:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/1.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Dunque, immagino che su internet si possano trovare decine di esempi
simili (anche su &lt;/font&gt;&lt;a href="http://www.codeproject.com/"&gt;&lt;font size=3&gt;CodeProject&lt;/font&gt;&lt;/a&gt;&lt;font size=3&gt;,
probabilmente) ma ritengo che la bellezza della mia soluzione consista nel fatto che:&lt;/font&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size=3&gt;L’intera implementazione è veramente esigua. Questo significa che è possibile,
per chi si sta avvicinando adesso ad AJAX, di capire un poco di più di che cosa si
tratti, da un punto di vista molto di “basso livello”, se così si può dire. Nella
mia esperienza di consulente e formatore, noto sempre più spesso la carenza di competenze
Javascript (anche nei più abili programmatori ASP.NET !!) e contemporaneamente come
tali competenze siano sempre più richieste dal mercato (vedi ad esempio la miriade
di siti, anche italiani, recentemente usciti o rifatti, dove popup e menù a tendina
come quello in oggetto sono ovunque). &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;In virtù del punto precedente, eventuali “customizzazioni” al mio lavoro
risultano estremamente semplici da implementare: in altri controlli simili al mio
che ho visto in giro (anche blasonati), tale semplicità si perde molto spesso in una
miriade di eventi client o server nei quali il programmatore medio (e non) tende ad
affogare (senza alla fine raggiungere il risultato desiderato).&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font size=3&gt;Di contro però, c’è da dire che il codice che segue è stato espressamente
scritto per Internet Explorer (quindi ideale per una applicazione di tipo intranet
dove i requisiti dei client sono prefissati e conosciuti). Comunque, adeguare questo
codice affinchè funzioni anche con altri browser è cosa assai semplice.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Per cominciare c’è la parte HTML. Questo markup permette di renderizzare
un editbox predisposto a visualizzare il menù di Auto-Completion quando si preme un
tasto, per esempio:&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;div&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;="position:
relative;"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;input&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="ctrlAcSearchBox"&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;id&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="ctrlAcSearchBox"&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="text"&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;autocomplete&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="off"&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;Style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="width:
250px;"&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;onkeydown&lt;/span&gt;&lt;span style="COLOR: blue"&gt;='&lt;/span&gt;&lt;font color=#000000&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;=
"AutoCompletion_onEditBoxKey(\"" + "ctrlAcSearchBox" + "\", event.keyCode);" &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;'&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;onkeyup&lt;/span&gt;&lt;span style="COLOR: blue"&gt;='&lt;/span&gt;&lt;font color=#000000&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;=
"AutoCompletion_onEditBoxKeyChange(\"http://localhost/folder/AutoCompletionInterface.aspx\",
\"" + "ctrlAcSearchBox" + "\", event.keyCode);" &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;'&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;ondeactivate&lt;/span&gt;&lt;span style="COLOR: blue"&gt;='&lt;/span&gt;&lt;font color=#000000&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;=
"document.getElementById( \"" + "ctrlAcSearchBox" + "\" + \"div\" ).style.display
= \"none\";" &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;'&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;div&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;id&lt;/span&gt;&lt;span style="COLOR: blue"&gt;='&lt;/span&gt;&lt;font color=#000000&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;=
"ctrlAcSearchBox" + "div" &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;'&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="position:
absolute; top: 23px;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;left:
0px; width: 250px; display: none;"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;div&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;div&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;La
presenza qui delle due DIV è fondamentale: infatti la seconda DIV (ossia quella innestata),
con l’attributo di stile “position: absolute” permette di visualizzare il box di Auto-Completion
esattamente sotto l’editbox: infatti la direttiva “absolute”, che normalmente renderizzerebbe
il contenuto della DIV rispetto all’angolo superiore-sinistro della fine&lt;font color=#000000&gt;stra
di browsing, qui viene invece riferita alla posizione della prima DIV, che possiede
un attributo di stile di tipo “position: relative”. Togliendo infatti la prima DIV,
si ottiene l’effetto di vedere il box di Auto-Completion nell’angolo superiore-sinistro
della finestra, confermando quindi questa regola dell’HTML.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;font face=Verdana color=#000000 size=3&gt;Il
controllo INPUT TYPE=”TEXT” gestisce una serie di eventi che permettono al box di
Auto-Completion di apparire e scomparire all’occorrenza (onkeydown, onkeyup, ondeactivate).
Ricordo che da Code-Behind è possibile leggere il valore inserito nell’editbox scrivendo
del codice come questo:&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt; 
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font color=#0000ff&gt;Request&lt;/font&gt;.Form[“&lt;font color=#ff0000&gt;ctrlAcSearchBox&lt;/font&gt;”]&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face=Verdana size=3&gt;Inoltre
in una posizione idonea della pagina è necessario includere il file .js che di fatto
implementa il box di Auto-Completion lato-client:&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; 
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;script&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="text/javascript"&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;src&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="http://localhost/folder/AutoCompletion.js"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;script&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="COLOR: blue"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;E’
possibile scaricare tale file da questo indirizzo: &lt;/font&gt;&lt;a href="http://www.vitoplantamura.com/blog/content/binary/AutoCompletion.js"&gt;&lt;font size=3&gt;AutoCompletion.js
(3,43 KB)&lt;/font&gt;&lt;/a&gt;&lt;font size=3&gt;. In ogni caso, di seguito, è riportato integralmente:&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="COLOR: blue"&gt;&lt;font face=Verdana color=#000000&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="COLOR: blue"&gt; 
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_getSelection
(n, def)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;for&lt;/span&gt;&lt;font color=#000000&gt;(
i=0; i&amp;lt;10; i ++ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; tr
= document.getElementById( n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"tr"&lt;/span&gt;&lt;font color=#000000&gt; +
i );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
tr == &lt;/font&gt;&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;&lt;font color=#000000&gt; )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; def;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;else&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
tr.style.color == &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"#ffffff"&lt;/span&gt;&lt;font color=#000000&gt; )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; i;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; def;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_putSelection
(n, s)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;for&lt;/span&gt;&lt;font color=#000000&gt;(
i=0; i&amp;lt;10; i ++ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; tr
= document.getElementById( n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"tr"&lt;/span&gt;&lt;font color=#000000&gt; +
i );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
tr == &lt;/font&gt;&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;&lt;font color=#000000&gt; )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
s == i )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tr.style.backgroundColor
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"#0040D0"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tr.style.color
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"#ffffff"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;else&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tr.style.backgroundColor
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"#ffffff"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tr.style.color
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"#000000"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_getNum
(n)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; i;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;for&lt;/span&gt;&lt;font color=#000000&gt;(
i=0; i&amp;lt;10; i ++ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; tr
= document.getElementById( n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"tr"&lt;/span&gt;&lt;font color=#000000&gt; +
i );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
tr == &lt;/font&gt;&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;&lt;font color=#000000&gt; )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; i;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; i;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_processResponse
(n)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; req
= document.getElementById( n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"div"&lt;/span&gt;&lt;font color=#000000&gt; ).req;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
req.readyState == 4 &amp;amp;&amp;amp; req.status == 200 )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"div"&lt;/span&gt;&lt;font color=#000000&gt; ).style.display
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"block"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"div"&lt;/span&gt;&lt;font color=#000000&gt; ).innerHTML
= req.responseText;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_setEditText
(n)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; sel
= AutoCompletion_getSelection (n);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
sel == &lt;/font&gt;&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;&lt;font color=#000000&gt; )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n ).value = document.getElementById( n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"span"&lt;/span&gt;&lt;font color=#000000&gt; +
sel ).innerHTML;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"div"&lt;/span&gt;&lt;font color=#000000&gt; ).style.display
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"none"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n ).focus ();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_onEditBoxKey
(n, key)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
key == 27 ) &lt;/font&gt;&lt;span style="COLOR: green"&gt;// esc.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"div"&lt;/span&gt;&lt;font color=#000000&gt; ).style.display
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"none"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;event&lt;/span&gt;&lt;font color=#000000&gt;.returnValue
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
key == 38 ) &lt;/font&gt;&lt;span style="COLOR: green"&gt;// up.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; s
= AutoCompletion_getSelection (n, 0) - 1;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
s &amp;lt; 0 )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= AutoCompletion_getNum(n) - 1;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AutoCompletion_putSelection(
n, s );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;event&lt;/span&gt;&lt;font color=#000000&gt;.returnValue
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;else&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
key == 40 ) &lt;/font&gt;&lt;span style="COLOR: green"&gt;// down.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; s
= AutoCompletion_getSelection (n, AutoCompletion_getNum(n)-1) + 1;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
s &amp;gt;= AutoCompletion_getNum (n) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= 0;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AutoCompletion_putSelection(
n, s );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;event&lt;/span&gt;&lt;font color=#000000&gt;.returnValue
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;else&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
key == 13 ) &lt;/font&gt;&lt;span style="COLOR: green"&gt;// enter.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AutoCompletion_setEditText
(n);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;event&lt;/span&gt;&lt;font color=#000000&gt;.returnValue
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; encodeHtml
( s )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= escape(s);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= s.replace(/\&lt;/font&gt;&lt;span style="COLOR: green"&gt;//g,"%2F");&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= s.replace(/\?/g,&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"%3F"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= s.replace(/=/g,&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"%3D"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= s.replace(/&amp;amp;/g,&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"%26"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s
= s.replace(/@/g,&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"%40"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; s;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;} 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; AutoCompletion_onEditBoxKeyChange
(base, n, key)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (
key == 8 || (key &amp;gt;= 32 &amp;amp;&amp;amp; key != 38 &amp;amp;&amp;amp; key != 40) )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; url
= base + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"?str="&lt;/span&gt;&lt;font color=#000000&gt; +
encodeHtml( document.getElementById( n ).value ) + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"&amp;amp;rnd="&lt;/span&gt;&lt;font color=#000000&gt; +
Math.floor(Math.random()*1000000000) + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"&amp;amp;n="&lt;/span&gt;&lt;font color=#000000&gt; +
n;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; req
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt; ActiveXObject(&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Microsoft.XMLHTTP"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;document.getElementById(
n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"div"&lt;/span&gt;&lt;font color=#000000&gt; ).req = req;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;req.onreadystatechange
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt; Function ( &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"AutoCompletion_processResponse('"&lt;/span&gt;&lt;font color=#000000&gt; +
n + &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"');"&lt;/span&gt;&lt;font color=#000000&gt; );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;req.open
( &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"GET"&lt;/span&gt;&lt;font color=#000000&gt;, url, &lt;/font&gt;&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;&lt;font color=#000000&gt; );&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;req.send
();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;Di &lt;font color=#000000&gt;seguito
è riportata una descrizione di ciascuna funzione JS:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_getSelection&lt;/strong&gt;:
semplicemente ritorna l’indice dell’elemento attualmente selezionato nel box.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_putSelection&lt;/strong&gt;:
seleziona un elemento nel box.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_getNum&lt;/strong&gt;:
restituisce la dimensione del box, come numero di item attualmente visualizzati.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_setEditText&lt;/strong&gt;:
in base alla selezione corrente nel box, popola l’editbox opportunamente.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_onEditBoxKey&lt;/strong&gt; (associata
all’evento “onkeydown” dell’editbox): gestisce la pressione dei tasti quando il focus
appartiene all’editbox (tasti: esc, su, giù, enter).&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_onEditBoxKeyChange&lt;/strong&gt; (associata
all’evento “onkeyup” dell’editbox): scatena una richiesta GET al server (attraverso
l’oggetto "Microsoft.XMLHTTP") alla pressione di un tasto nell’editbox. Come specificato
nell’evento “onreadystatechange”, la gestione della risposta da parte del server è
demandata alla funzione JS con nome “AutoCompletion_processResponse”.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;&lt;strong&gt;AutoCompletion_processResponse&lt;/strong&gt;:
questa funzione riceve la risposta del server. In questo caso, il server restituisce
HTML (direttamente il contenuto del box di Auto-Completion). In altri casi è frequente
trovare l’oggetto "Microsoft.XMLHTTP” coinvolto nello scambio di markup XML tra server
e client (questo argomento, però, esula dagli obiettivi di questo post).&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;Dietro
le quinte, una pagina ASPX si occupa di restituire il markup HTML che costituisce
il box di Auto-Completion visualizzato. L’URL di tale pagina ASPX è fornito alla funzione
“AutoCompletion_onEditBoxKeyChange” nel gestore dell’evento “onkeyup” del nostro INPUT
TYPE=”TEXT” (ossia dell’editbox).&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000&gt;&lt;font size=3&gt;Il
codice di questa pagina è scaricabile qui (&lt;/font&gt;&lt;a href="http://www.vitoplantamura.com/blog/content/binary/AutoCompletionInterface.aspx.txt"&gt;&lt;font size=3&gt;AutoCompletionInterface.aspx
(0,45 KB)&lt;/font&gt;&lt;/a&gt;&lt;font size=3&gt;&amp;nbsp;+ &lt;/font&gt;&lt;a href="http://www.vitoplantamura.com/blog/content/binary/AutoCompletionInterface.aspx.cs.txt"&gt;&lt;font size=3&gt;AutoCompletionInterface.aspx.cs
(2,4 KB)&lt;/font&gt;&lt;/a&gt;&lt;font size=3&gt;). Il markup della pagina ASPX è trascurabile. La
struttura del file di Code-Behind, invece, è molto intuitiva: nel gestore della Page_Load,
viene generato dell’HTML secondo la stringa di ricerca passata (ossia ciò che l’utente
ha inserito nell’editbox) quindi il markup risultante viene restituito come risposta
alla GET della parte JS.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font face=Verdana color=#000000 size=3&gt;Tale
markup verrà quindi visualizzato nella seconda DIV di cui sopra, mostrando il box
di Auto-Completion:&lt;/font&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&gt;
&lt;p&gt;
&lt;/span&gt;&lt;/span&gt;&lt;img src="http://www.vitoplantamura.com/blog/content/binary/2.gif" border=0&gt;&gt;
&lt;p&gt;
&lt;font color=#000000 size=3&gt;Nel file di Code-Behind di esempio, viene chiamata una
Stored Procedure che potrebbe essere qualcosa del genere:&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;SELECT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TOP&lt;/span&gt;&lt;font color=#000000&gt; 10&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;u&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;nome_cognome&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;FROM&lt;/span&gt;&lt;font color=#000000&gt; Utenti
u&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;WHERE&lt;/span&gt;&lt;font color=#000000&gt; u&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;nome_cognome &lt;/font&gt;&lt;span style="COLOR: gray"&gt;like&lt;/span&gt;&lt;font color=#000000&gt; @Nome_Cognome &lt;/font&gt;&lt;span style="COLOR: gray"&gt;+&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: red"&gt;'%'&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;ORDER&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;BY&lt;/span&gt;&lt;font color=#000000&gt; u&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;nome_cognome&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=82b5a323-9b33-4a49-9e34-2432e8c87204" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,82b5a323-9b33-4a49-9e34-2432e8c87204.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=28c85b7f-9966-4e22-ab43-e99dc56f575e</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,28c85b7f-9966-4e22-ab43-e99dc56f575e.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,28c85b7f-9966-4e22-ab43-e99dc56f575e.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=28c85b7f-9966-4e22-ab43-e99dc56f575e</wfw:commentRss>
      <title>File di Style Sheet specificati al runtime.</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,28c85b7f-9966-4e22-ab43-e99dc56f575e.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2007/12/15/FileDiStyleSheetSpecificatiAlRuntime.aspx</link>
      <pubDate>Sat, 15 Dec 2007 14:23:42 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;G&lt;/font&gt;&lt;font color=#000000&gt;iusto un piccolo update
al Blog, in modo da poter dimostrare di essere ancora vivo ed "attivo"... :-)&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;Dunque un pò di tempo fà mi sono imbattuto nella necessità
di dover aggiungere al run-time un file di Style Sheet (tipicamente con estensione
".css") ad una pagina ".aspx" (ASP.NET 2.0). Tipicamente le direttive al browser circa
quali file css caricare vengono specificate nella sezione "&amp;lt;head&amp;gt;" di una pagina
html: poichè il contesto nel quale mi trovavo era una webpart per DotNetNuke (ossia
un controllo ".ascx") e poichè il file ".css" da tirare sù dipendeva da diverse variabili
che potevo conoscere solo al run-time, ho dovuto trovare una soluzione al problema,
forse un poco fuori dagli schemi.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000&gt;&lt;font size=3&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;Dunque, il codice è il seguente:&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control
page = &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control
c = Parent;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; (c
!= &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;page
= c;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;c
= c.Parent;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;HtmlLink
stylesheet = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; HtmlLink();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;stylesheet.Href
= &lt;span style="COLOR: maroon"&gt;"http://www.someserver.com/stylesheet.css"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;stylesheet.Attributes[&lt;span style="COLOR: maroon"&gt;"rel"&lt;/span&gt;]
= &lt;span style="COLOR: maroon"&gt;"stylesheet"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;stylesheet.Attributes[&lt;span style="COLOR: maroon"&gt;"text"&lt;/span&gt;]
= &lt;span style="COLOR: maroon"&gt;"text/css"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;((System.Web.UI.Page)page).Header.Controls.Add(stylesheet);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;/font&gt;&amp;nbsp;&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;In sostanza, nella prima parte viene ottenuta una reference
alla pagina principale (.ASPX), mentre nella seconda si procede alla specificazione
del file .CSS da caricare sul client.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;L'esigenza di fare una cosa del genere potrebbe sembrare
piuttosto remota, ma, al contrario, se si pensa per esempio alla necessità di incorporare
un controllo di terze parti in una webpart per DotNetNuke (come nel mio caso) che
magari sia closed-source e che magari richieda un particolare foglio di stile per
funzionare correttamente, il codice sopra potrebbe essere di fondamentale aiuto...&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000 size=3&gt;Se qualcuno dovesse conoscere una soluzione più semplice
per ottenere lo stesso risultato, si senta libero di postarla qui come risposta.&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=28c85b7f-9966-4e22-ab43-e99dc56f575e" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,28c85b7f-9966-4e22-ab43-e99dc56f575e.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=b5b64f9e-ee07-4ed3-a7dd-91fed524df48</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,b5b64f9e-ee07-4ed3-a7dd-91fed524df48.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,b5b64f9e-ee07-4ed3-a7dd-91fed524df48.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b5b64f9e-ee07-4ed3-a7dd-91fed524df48</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Per un mio grosso cliente di Milano, sto dirigendo tecnologicamente lo sviluppo di
un portale basato su ASP.NET 2.0, dove, funzionalmente, è richiesta l'integrazione
di certe logiche di workflowing nella gestione dei loro processi aziendali.
</p>
        <p>
A tale scopo ho proposto l'utilizzo di <strong>Windows Workflow Foundation</strong>,
in modo da poter testare sul campo (aldilà di semplici applicazioni di prova), nel
contesto dello sviluppo di un grosso progetto di classe enterprise questa nuova interessante
tecnologia di Microsoft.
</p>
        <p>
Dopo qualche ora di ricerca sono riuscito ad accumulare abbastanza conoscenza per
mettere sù un proof of concept al fine di collaudare le idee ed ipotesi che avevo
maturato. Allegata a questo post, c'è una applicazione ASP.NET di esempio derivata
da quel mio primo prototipo.
</p>
        <p>
          <strong>
            <font size="4">La Web Application di Esempio</font>
          </strong>
        </p>
        <p>
E' possibile scaricare l'applicazione di esempio qui: <a href="http://www.vitoplantamura.com/blog/content/binary/WwfExample.rar">WwfExample.rar
(386,08 KB)</a>.
</p>
        <p>
L'applicazione (la solution) consta di due progetti: la <strong>Web Application</strong> ed
il progetto <strong>Workflows</strong>, che racchiude tutto il codice specifico che
consuma i servizi di Workflow Foundation (WF).
</p>
        <p>
Prima di poter utilizzare l'applicazione in questione, è necessario "attaccare" il
file di database fornito alla istanza di SQL Server 2005 Express presente sulla macchina
di sviluppo.
</p>
        <p>
L'applicazione utilizza tre tabelle per mantenere il suo stato:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_db_1.gif" border="0" />
        </p>
        <p>
La tabella <strong>Users</strong> mantiene una lista di tutti gli utenti abilitati
ad utilizzare l'applicazione, con relativi ruoli separati da virgola. La tabella <strong>WorkflowsList</strong> mantiene
una lista di tutti i workflow che l'applicazione è abilitata a far partire, con, annesse,
informazioni circa quali utenti e quali gruppi hanno tale privilegio e, soprattutto,
indicazioni circa il tipo .NET e l'assembly dal quale recuperare la definizione della
classe di Workflow. La tabella <strong>UserActivities</strong> mantiene uno stato
della applicazione "parallelo" a quello del Workflow ed è la tebella che viene consultata
dal sistema per capire in quale stato si trova l'intera applicazione. I record in
questa tabella vengono aggiunti direttamente dalle <font face="Courier New" color="#ff0000">Activity</font> del
Workflow ed essa è una prima ma importante forma di comunicazione tra codice ASP.NET
e codice di Workflow Foundation.
</p>
        <p>
Sono inoltre presenti anche queste due tabelle:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_db_2.gif" border="0" />
        </p>
        <p>
In particolare, la tabella <strong>InstanceState</strong> viene utilizzata da Workflow
Foundation (specificatamente dal servizio <font face="Courier New" color="#ff0000">SqlWorkflowPersistenceService</font>)
per persistere lo stato di un determinato Workflow: il Workflow viene serializzato
attraverso il <font face="Courier New" color="#ff0000">BinaryFormatter</font>, poi
compresso, quindi depositato nel campo blob <strong>state</strong> di questa tabella.
Per creare queste due tabelle, e relative stored procedure, è necessario recuperare
ed eseguire gli script presenti tipicamente qui:
</p>
        <p>
          <strong>C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Schema.sql</strong>
        </p>
        <p>
          <strong>C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Logic.sql</strong>
        </p>
        <p>
          <u>NOTA</u>: nel file di db incluso in questo esempio, le tabelle e le stored procedure
di WF sono già presenti.
</p>
        <p>
Fatta partire, l'applicazione mostra una semplice mascherina di login:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_form_1.gif" border="0" />
        </p>
        <p>
Dove viene appurato il nome dell'utente e, soprattutto, i ruoli a lui assegnati (tramite
lookup su db). Verificata la veridicità delle credenziali, viene creato un <font face="Courier New" color="#ff0000">FormsAuthenticationTicket</font> contenente
le informazioni di interesse applicativo sull'utente.
</p>
        <p>
Immediatamente dopo si accede alla form principale dell'applicazione di esempio:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_form_2.gif" border="0" />
        </p>
        <p>
Questa form permette di avviare un dato workflow (se si dispone delle autorizzazioni
necessarie per poterlo fare) e di gestire attività pendenti (sempre se si è autorizzati
a farlo). La griglia delle attività pendenti (la seconda) viene popolata attraverso
la tabella <strong>UserActivities</strong> su database, che a sua volta viene popolata
dal codice del Workflow avviato e gestito dall'applicazione ASP.NET, con nome <strong>WorkflowExample.cs</strong>:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_wf.gif" border="0" />
        </p>
        <p>
Questo semplice workflow sequenziale definisce una serie di form ASP.NET da visualizzare
una dopo l'altra. A ciascuna form sono associati diritti a livello di utente e ruolo,
in modo che soltanto gli utenti abilitati abbiano modo di accedervi. E' naturalmente
possibile definire workflow di una complessità molto superiore rispetto a quella del
workflow qui rappresentato. Nella fattispecie, è possibile inserire qualsiasi tipo
di <font face="Courier New" color="#ff0000">Activity</font> nel flusso di esecuzione
del workflow: se necessario, è possibile definire uno stato privato al workflow aggiungendo
proprietà (eventualmente bindabili) nel file <strong>WorkflowExample.cs</strong>.
La proprietà bindabile <font face="Courier New" color="#ff0000">DataSet</font> nella
classe <font face="Courier New" color="#ff0000">Workflows.UserActivity</font>, come
spiegato sotto, può essere utilizzata per scambiare dati tra il workflow e l'applicazione
ASP.NET.
</p>
        <p>
Da interfaccia utente, in Visual Studio (ossia dal <strong>Workflow Designer</strong>)
è possibile, per ciascuna form, definire proprietà salienti, tra le quali quelle di
autorizzazione appena descritte:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_props.gif" border="0" />
        </p>
        <p>
La proprietà <font face="Courier New" color="#ff0000">DataSet</font> (quando bindata)
permette di passare informazioni da una <font face="Courier New" color="#ff0000">Activity</font> ad
un'altra, passando dal codice ASP.NET, nel nostro caso specifico: il sistema, infatti,
serializza di volta in volta il contenuto di questa proprietà della Activity nel campo <strong>DetailsXml</strong> della
tabella <strong>UserActivities</strong>; questo permette al codice della pagina web
di modificare il dataset, che poi, trasparentemente, viene ripassato alla Activity
del Workflow, in modo che lo stato della proprietà bindabile sia aggiornato opportunamente.
</p>
        <p>
Cliccando su una attività pendente, si accede ad una form di gestione:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_form_3.gif" border="0" />
        </p>
        <p>
Il link <strong>Complete Activity</strong> scatena il codice che realizza l'interoperabilità
con Workflow Foundation: in questo caso e per il nostro Workflow di esempio, l'attività
"<strong>Form2</strong>" viene chiusa e si passa all'attività "<strong>Form3</strong>",
che è giusto la successiva nel nostro workflow sequenziale.
</p>
        <p>
Il funzionamento dell'intera applicazione è piuttosto semplice, se si intendono i
meccanismi di intercomunicazione di WF (vedi code di item, o <font face="Courier New" color="#ff0000">WorkflowQueue</font>).
Questo schema dovrebbe riassumere a grandi linee ciò che accade:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_schema.gif" border="0" />
        </p>
        <p>
La discussione seguente è un poco più complessa, poichè tratta specificatamente dei
problemi di interoperabilità tra ASP.NET e WF e delle soluzioni che ho ricercato e
deciso di adottare caso per caso.
</p>
        <p>
          <strong>
            <font color="#000000" size="4">Threading</font>
          </strong>
        </p>
        <p>
Normalmente, Workflow Foundation utilizza le caratteristiche del servizio <font face="Courier New" color="#ff0000">DefaultWorkflowSchedulerService</font> per
creare e coordinare i thread responsabili dell’esecuzione di tutti i workflow associati
ad uno stesso runtime (<font face="Courier New" color="#ff0000">WorkflowRuntime</font>).
Nella fattispecie, questo implica l’esecuzione asincrona delle istanze di workflow
gestite da un runtime, che vengono opportunamente e trasparentemente messe nella coda
di esecuzione del thread pool .NET associato all’applicazione host.
</p>
        <p>
Nel contesto di una applicazione ASP.NET, questo, generalmente, non è desiderabile.
Infatti, il <font face="Courier New" color="#ff0000">DefaultWorkflowSchedulerService</font>,
quando utilizzato in una applicazione web, và ad impegnare un thread aggiuntivo per
ciascuna richiesta HTTP che il server di IIS, in un dato momento, sta processando
e che richiede le funzionalità di Workflow Foundation. Per indirizzare questo problema,
è necessario specificare il servizio <font face="Courier New" color="#ff0000">ManualWorkflowSchedulerService</font>,
quando si inizializza una istanza del <font face="Courier New" color="#ff0000">WorkflowRuntime</font>:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Runtime <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> WorkflowRuntime();<br /><br /><font color="#deb887" size="4"><strong>[...]</strong></font><br /><br />
Runtime.AddService(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ManualWorkflowSchedulerService(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>));<br /><br /><font color="#deb887" size="4"><strong>[...]</strong></font><br /><br /></span>
        </p>
        <p>
Questo permette di controllare l’esecuzione di un dato workflow, di coordinarla rispetto
al thread che sta servendo la richiesta HTTP e di disimpegnare un thread dal thread
pool dell’applicazione host, poichè WF và ad eseguire le nostre activity nel contesto
dello stesso thread che sta eseguendo la pagina ASP.NET.
</p>
        <p>
Quanto detto è possibile evincerlo empiricamente andando a sbirciare nel call stack
.NET durante l’esecuzione dell’applicazione di esempio allegata a questo post:
</p>
        <p>
          <img src="http://www.vitoplantamura.com/blog/content/binary/img_callstack.gif" border="0" />
        </p>
        <p>
          <font face="Courier New" color="#ff0000">UserActivity.Execute</font> è il nostro codice
applicativo che implementa la nostra Activity (il primo contesto evidenziato in blu). <font face="Courier New" color="#ff0000">API.CompleteActivity</font> (il
secondo contesto in blu) è un nostro metodo chiamato direttamente da un gestore eventi
di un pulsante di una webform, che chiama l’API <font face="Courier New" color="#ff0000">ManualWorkflowSchedulerService.RunWorkflow</font>,
che provoca l’esecuzione immediata del workflow il cui ID passiamo come parametro.
Come anticipato, sia il codice della pagina web che quello del workflow vengono eseguiti
nel contesto dello stesso thread.
</p>
        <p>
          <strong>
            <font size="4">Transazionalità e Persistenza</font>
          </strong>
        </p>
        <p>
La classe <font face="Courier New" color="#ff0000">TransactionScope</font> (<font face="Courier New" color="#ff0000">System.Transactions</font>)
permette di definire contesti transazionali in codice .NET 2.0 e 3.0 in maniera semplice
ed immediata. Specialmente se si utilizza SQL Server 2005, l’uso della classe <font face="Courier New" color="#ff0000">TransactionScope</font> diviene
ancora più semplice, poichè si viene liberati del tutto da tutte quelle considerazioni
di cui tener conto circa eventuali, inutili e costosi coinvolgimenti del MSDTC per
transazioni puramente locali, importanti invece quando si lavora, per esempio, con
SQL Server 2000. Sorvolando sulle specifiche caratteristiche della classe <font face="Courier New" color="#ff0000">TransactionScope</font> (fuori
dagli obiettivi di questo post), nell’esempio fornito viene usata questa nuova funzionalità
di .NET 2.0 per la scrittura di codice transazionale che scrive su SQL Server.
</p>
        <p>
Uno dei requisiti principali per realizzare una consistente interoperabilità tra WF
e ASP.NET è la corretta gestione della persistenza dei workflow su database. Per comunicare
a Workflow Foundation di persistere tutti i workflow relativi ad uno stesso <font face="Courier New" color="#ff0000">WorkflowRuntime</font> su
database, è necessario registrare il servizio <font face="Courier New" color="#ff0000">SqlWorkflowPersistenceService</font> all’atto
della inizializzazione dell’istanza del <font face="Courier New" color="#ff0000">WorkflowRuntime</font>:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Runtime <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> WorkflowRuntime();<br /><br /><strong><font color="#deb887" size="4">[...]</font></strong><br /><br />
NameValueCollection parameters <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> NameValueCollection();<br />
parameters.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"ConnectionString"</span>,
connectionString);<br />
parameters.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"UnloadOnIdle"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"false"</span>);<br />
Runtime.AddService(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> SqlWorkflowPersistenceService(parameters));<br /><br /><strong><font color="#deb887" size="4">[...]</font></strong><br /></span>
        </p>
        <p>
Come parametri, specifichiamo la stringa di connessione al database ed indichiamo
al servizio di NON persistere un workflow su database quando questo è inattivo (parametro <font face="Courier New" color="#ff0000">UnloadOnIdle</font>):
infatti, per un maggiore controllo e per ragioni di consistenza transazionale che
vedremo tra poco, ci preoccupiamo noi di chiamare il metodo <font face="Courier New" color="#ff0000">WorkflowInstance.Unload</font> quando
intendiamo persistere una istanza di Workflow su db.
</p>
        <p>
Infatti uno dei maggiori problemi quando si intende integrare della logica che accede
ad un db in una istanza di Workflow con della logica dello stesso tipo eseguita esternamente
nel contesto dell’applicazione host (in questo caso ASP.NET) è che WF, per ragioni
di design, impedisce alla transazione ambientale associata al thread di esecuzione
nel momento in cui si esegue il workflow (<font face="Courier New" color="#ff0000">ManualWorkflowSchedulerService.RunWorkflow</font>)
di propagarsi fino al contesto di esecuzione nel quale vengono eseguite le Activity
del workflow. Questo è possibile evincerlo empiricamente, per esempio, debuggando
l’applicazione di esempio di questo post: prima di chiamare l’API <font face="Courier New" color="#ff0000">ManualWorkflowSchedulerService.RunWorkflow</font>,
la proprietà statica <font face="Courier New" color="#ff0000">System.Transactions.Transaction.Current</font> è
correttamente valorizzata, poichè siamo in uno scope transazionale definito da un
costrutto <font face="Courier New" color="#ff0000">TransactionScope</font>. Al contrario,
all’interno del metodo <font face="Courier New" color="#ff0000">UserActivity.Execute</font> (che
implementa la nostra activity) tale proprietà statica ha valore nullo, benchè la chiamata
al metodo <font face="Courier New" color="#ff0000">UserActivity.Execute</font> sia
originata a partire da del codice configurato per essere transazionale.
</p>
        <p>
Volendo approfondire la questione ed i motivi di tale comportamento, è necessario
ritornare al call stack rappresentato all’inizio di questo post: nella fattispecie,
in una delle 9 chiamate che separano il codice host dal codice della Activity, WF
ha intenzionalmente “soppresso” la nostra transazione ambientale. Alla fine, come
risultato, questo ci impedisce di associare del codice che accede al db in una Activity
di un Workflow ad una transazione iniziata dall’host.
</p>
        <p>
Volendo scendere nel merito, magari utilizzando l’ottimo <strong>.NET Reflector di
Roeder</strong> e spulciando rapidamente in quei 9 metodi di cui sopra, è possibile
trovare la spiegazione di questo comportamento nel metodo <font face="Courier New" color="#ff0000">System.Workflow.Runtime.WorkflowExecutor.RunSome</font>,
che, decompilato, appare così:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">internal</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> RunSome(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> ignored)<br />
{<br />
   <font color="#deb887" size="4"><strong>[...]</strong></font><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   using</span> (TransactionScope
scope <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> TransactionScope(TransactionScopeOption.Suppress))<br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      try</span><br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         this</span>.FireWorkflowExecutionEvent(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>,
WorkflowEventInternal.Executing);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         this</span>.RunScheduler();<br />
      }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      catch</span> (Exception
exception)<br />
      {<br /><br />
         <font color="#deb887" size="4"><strong>[...]</strong></font><br /><br />
      }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      finally</span><br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         this</span>.FireWorkflowExecutionEvent(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>,
WorkflowEventInternal.NotExecuting);<br />
      }<br /><br />
      scope.Complete();<br />
   }<br /><br />
   <font color="#deb887" size="4"><strong>[...]</strong></font><br />
}<br /><br /></span>
        </p>
        <p>
Questo ci obbliga a trovare nuove soluzioni per scrivere sul database in maniera consistente.
</p>
        <p>
La soluzione che ho ricercato ed adottato sfrutta i meccanismi di serializzazione
di .NET, per mettere “in coda” una o più operazioni che è necessario associare ad
una transazione controllata dal codice host (ossia da noi). Per ottenere l’effetto
desiderato, bisogna, per prima cosa, creare una coda di Workflow dove andare ad aggiungere
istanze di un nostro tipo custom (con nome <font face="Courier New" color="#ff0000">DbAccessCallDetails</font>),
che rappresenta una chiamata ad un metodo di qualsiasi tipo che interagisce col db.
L’idea di base è di registrare semplicemente l’operazione di interazione col db in
questa coda (quando si è all’interno di una Activity), quindi, andare a chiamare il
metodo che implementa tale operazione in un secondo momento, per esempio all’atto
della serializzazione del Workflow su database. Considerando che la coda di Workflow
(<font face="Courier New" color="#ff0000">WorkflowQueue</font>) è un oggetto che appartiene
al Workflow e che le nostre istanze di <font face="Courier New" color="#ff0000">DbAccessCallDetails</font> si
trovano depositate in tale coda, quando il servizio <font face="Courier New" color="#ff0000">SqlWorkflowPersistenceService</font>,
tramite il <font face="Courier New" color="#ff0000">BinaryFormatter</font>, andrà
a serializzare, quindi comprimere e persistere su db il nostro Workflow, noi avremo
l’occasione che aspettiamo per svuotare la nostra coda e quindi eseguire quei metodi
di cui avevamo procrastinato l’esecuzione.
</p>
        <p>
La classe <font face="Courier New" color="#ff0000">DbAccessCallDetails</font> si presenta
semplicemente così:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[Serializable()]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> DbAccessCallDetails
: ISerializable<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
constructor(s).</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span> DbAccessCallDetails(Delegate
fnParam, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span>[]
psParam)<br />
   {<br />
      fn <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> fnParam;<br />
      ps <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> psParam;<br />
   }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span> DbAccessCallDetails(SerializationInfo
info, StreamingContext context)<br />
   {<br />
   }<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
data.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span> Delegate
fn <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span>[]
ps <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
ISerializable stuff.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   void</span> ISerializable.GetObjectData(SerializationInfo
info, StreamingContext context)<br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      //
call the method.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      if</span> (fn
!<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)<br />
         fn.DynamicInvoke(ps);<br />
   }<br />
}<br /><br /></span>
        </p>
        <p>
In breve, quando si cerca di serializzare una istanza di questa classe, viene chiamato
il metodo <font face="Courier New" color="#ff0000">ISerializable.GetObjectData</font>,
che semplicemente invoca il metodo ad essa associato. Questo metodo inserisce dei
record su db, nel caso del mio esempio (tabella <strong>UserActivities</strong>).
</p>
        <p>
Come detto precedentemente, la serializzazione del Workflow avviene all’atto della
chiamata al metodo <font face="Courier New" color="#ff0000">WorkflowInstance.Unload</font>.
Come emerge da vari documenti e testimonianze su internet, e come può essere approfondito
direttamente attraverso Reflector, questo metodo (intenzionalmente) è l’unico pezzo
di codice di WF che non sopprime attivamente la transazione ambientale del thread
che lo sta chiamando. Questo significa che è possibile associare ad una stessa transazione
ambientale gestita dall’host sia la persistenza dell’istanza del Workflow su database,
sia il codice rappresentato dalle varie istanze di <font face="Courier New" color="#ff0000">DbAccessCallDetails</font> eventualmente
presenti nella coda del Workflow. Questo “trucco” ci permette di avere sul database
uno stato dei dati di interoperabilità tra la nostra applicazione e Workflow Foundation
sempre consistenti:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> CompleteActivity(Guid
workflowGuid, Guid activityGuid, DataSet activityData, System.Web.HttpRequest Request,
System.Web.HttpResponse resp)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
notify the completion to the wf.</span><br />
   WorkflowInstance wi <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Runtime.GetWorkflow(workflowGuid);<br />
   wi.EnqueueItem(<br />
      activityGuid.ToString(),<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      new</span> ActivityCompletedEventArgs(activityData),<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      null</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
tell the workflow to progress.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   string</span> redirectUrl <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   using</span> (TransactionScope
scope <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> TransactionScope())<br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      //
complete on the db.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      using</span> (Workflows.DataTableAdapters.UserActivitiesTableAdapter
ta <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Workflows.DataTableAdapters.UserActivitiesTableAdapter())<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         //
complete on the db.</span><br />
         ta.CompleteActivity(activityGuid.ToString());<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         //
get the redirect page url.</span><br />
         redirectUrl <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>)ta.GetDataByActivityGuid(activityGuid.ToString()).Rows[0][<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"ReturnPageUrl"</span>];<br />
         redirectUrl <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"/"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> (Request.ApplicationPath <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"/"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> redirectUrl).Trim('<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/</span>');<br />
      }<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      //
call the workflow.</span><br />
      Runtime.GetService&lt;ManualWorkflowSchedulerService&gt;().RunWorkflow(workflowGuid);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      //
persist the workflow on the db.</span><br />
      wi.Unload();<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      //
commit.</span><br />
      scope.Complete();<br />
   }<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
redirect.</span><br />
   resp.Redirect(redirectUrl);<br />
}<br /></span>
        </p>
        <p>
Il metodo <font face="Courier New" color="#ff0000">CompleteActivity</font> permette
di chiudere l’Activity attualmente aperta, di avanzare nell’esecuzione del Workflow
(quindi eseguendo le Activity successive) e soprattutto di aggiornare lo stato sul
db. Questo avviene all’atto della chiamata al metodo <font face="Courier New" color="#ff0000">wi.Unload()</font>,
che, secondo quanto detto in precedenza, persiste il workflow su db ed esegue le varie
istanze di <font face="Courier New" color="#ff0000">DbAccessCallDetails</font>, tutto
quanto associato alla stessa <font face="Courier New" color="#ff0000">System.Transactions.Transaction </font>(<font face="Courier New" color="#ff0000">TransactionScope</font>).
</p>
        <img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=b5b64f9e-ee07-4ed3-a7dd-91fed524df48" />
      </body>
      <title>Windows Workflow Foundation e ASP.NET 2.0</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,b5b64f9e-ee07-4ed3-a7dd-91fed524df48.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2007/08/27/WindowsWorkflowFoundationEASPNET20.aspx</link>
      <pubDate>Mon, 27 Aug 2007 00:08:22 GMT</pubDate>
      <description>&lt;p&gt;
Per un mio grosso cliente di Milano, sto dirigendo tecnologicamente lo sviluppo di
un portale basato su ASP.NET 2.0, dove, funzionalmente, è richiesta l'integrazione
di certe logiche di workflowing nella gestione dei loro processi aziendali.
&lt;/p&gt;
&lt;p&gt;
A tale scopo ho proposto l'utilizzo di &lt;strong&gt;Windows Workflow Foundation&lt;/strong&gt;,
in modo da poter testare sul campo (aldilà di semplici applicazioni di prova), nel
contesto dello sviluppo di un grosso progetto di classe enterprise questa nuova interessante
tecnologia di Microsoft.
&lt;/p&gt;
&lt;p&gt;
Dopo qualche ora di ricerca sono riuscito ad accumulare abbastanza conoscenza per
mettere sù un proof of concept al fine di collaudare le idee ed ipotesi che avevo
maturato. Allegata a questo post, c'è una applicazione ASP.NET di esempio derivata
da quel mio primo prototipo.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=4&gt;La Web Application di Esempio&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
E' possibile scaricare l'applicazione di esempio qui: &lt;a href="http://www.vitoplantamura.com/blog/content/binary/WwfExample.rar"&gt;WwfExample.rar
(386,08 KB)&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
L'applicazione (la solution) consta di due progetti: la &lt;strong&gt;Web Application&lt;/strong&gt; ed
il progetto &lt;strong&gt;Workflows&lt;/strong&gt;, che racchiude tutto il codice specifico che
consuma i servizi di Workflow Foundation (WF).
&lt;/p&gt;
&lt;p&gt;
Prima di poter utilizzare l'applicazione in questione, è necessario "attaccare" il
file di database fornito alla istanza di SQL Server 2005 Express presente sulla macchina
di sviluppo.
&lt;/p&gt;
&lt;p&gt;
L'applicazione utilizza tre tabelle per mantenere il suo stato:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_db_1.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
La tabella &lt;strong&gt;Users&lt;/strong&gt; mantiene una lista di tutti gli utenti abilitati
ad utilizzare l'applicazione, con relativi ruoli separati da virgola. La tabella &lt;strong&gt;WorkflowsList&lt;/strong&gt; mantiene
una lista di tutti i workflow che l'applicazione è abilitata a far partire, con, annesse,
informazioni circa quali utenti e quali gruppi hanno tale privilegio e, soprattutto,
indicazioni circa il tipo .NET e l'assembly dal quale recuperare la definizione della
classe di Workflow. La tabella &lt;strong&gt;UserActivities&lt;/strong&gt; mantiene uno stato
della applicazione "parallelo" a quello del Workflow ed è la tebella che viene consultata
dal sistema per capire in quale stato si trova l'intera applicazione. I record in
questa tabella vengono aggiunti direttamente dalle &lt;font face="Courier New" color=#ff0000&gt;Activity&lt;/font&gt; del
Workflow ed essa è una prima ma importante forma di comunicazione tra codice ASP.NET
e codice di Workflow Foundation.
&lt;/p&gt;
&lt;p&gt;
Sono inoltre presenti anche queste due tabelle:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_db_2.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
In particolare, la tabella &lt;strong&gt;InstanceState&lt;/strong&gt; viene utilizzata da Workflow
Foundation (specificatamente dal servizio &lt;font face="Courier New" color=#ff0000&gt;SqlWorkflowPersistenceService&lt;/font&gt;)
per persistere lo stato di un determinato Workflow: il Workflow viene serializzato
attraverso il &lt;font face="Courier New" color=#ff0000&gt;BinaryFormatter&lt;/font&gt;, poi compresso,
quindi depositato nel campo blob &lt;strong&gt;state&lt;/strong&gt; di questa tabella. Per creare
queste due tabelle, e relative stored procedure, è necessario recuperare ed eseguire
gli script presenti tipicamente qui:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Schema.sql&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Logic.sql&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;NOTA&lt;/u&gt;: nel file di db incluso in questo esempio, le tabelle e le stored procedure
di WF sono già presenti.
&lt;/p&gt;
&lt;p&gt;
Fatta partire, l'applicazione mostra una semplice mascherina di login:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_form_1.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Dove viene appurato il nome dell'utente e, soprattutto, i ruoli a lui assegnati (tramite
lookup su db). Verificata la veridicità delle credenziali, viene creato un &lt;font face="Courier New" color=#ff0000&gt;FormsAuthenticationTicket&lt;/font&gt; contenente
le informazioni di interesse applicativo sull'utente.
&lt;/p&gt;
&lt;p&gt;
Immediatamente dopo si accede alla form principale dell'applicazione di esempio:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_form_2.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Questa form permette di avviare un dato workflow (se si dispone delle autorizzazioni
necessarie per poterlo fare) e di gestire attività pendenti (sempre se si è autorizzati
a farlo). La griglia delle attività pendenti (la seconda) viene popolata attraverso
la tabella &lt;strong&gt;UserActivities&lt;/strong&gt; su database, che a sua volta viene popolata
dal codice del Workflow avviato e gestito dall'applicazione ASP.NET, con nome &lt;strong&gt;WorkflowExample.cs&lt;/strong&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_wf.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Questo semplice workflow sequenziale definisce una serie di form ASP.NET da visualizzare
una dopo l'altra. A ciascuna form sono associati diritti a livello di utente e ruolo,
in modo che soltanto gli utenti abilitati abbiano modo di accedervi. E' naturalmente
possibile definire workflow di una complessità molto superiore rispetto a quella del
workflow qui rappresentato. Nella fattispecie, è possibile inserire qualsiasi tipo
di &lt;font face="Courier New" color=#ff0000&gt;Activity&lt;/font&gt; nel flusso di esecuzione
del workflow: se necessario, è possibile definire uno stato privato al workflow aggiungendo
proprietà (eventualmente bindabili) nel file &lt;strong&gt;WorkflowExample.cs&lt;/strong&gt;.
La proprietà bindabile &lt;font face="Courier New" color=#ff0000&gt;DataSet&lt;/font&gt; nella
classe &lt;font face="Courier New" color=#ff0000&gt;Workflows.UserActivity&lt;/font&gt;, come
spiegato sotto, può essere utilizzata per scambiare dati tra il workflow e l'applicazione
ASP.NET.
&lt;/p&gt;
&lt;p&gt;
Da interfaccia utente, in Visual Studio (ossia dal &lt;strong&gt;Workflow Designer&lt;/strong&gt;)
è possibile, per ciascuna form, definire proprietà salienti, tra le quali quelle di
autorizzazione appena descritte:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_props.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
La proprietà &lt;font face="Courier New" color=#ff0000&gt;DataSet&lt;/font&gt; (quando bindata)
permette di passare informazioni da una &lt;font face="Courier New" color=#ff0000&gt;Activity&lt;/font&gt; ad
un'altra, passando dal codice ASP.NET, nel nostro caso specifico: il sistema, infatti,
serializza di volta in volta il contenuto di questa proprietà della Activity nel campo &lt;strong&gt;DetailsXml&lt;/strong&gt; della
tabella &lt;strong&gt;UserActivities&lt;/strong&gt;; questo permette al codice della pagina web
di modificare il dataset, che poi, trasparentemente, viene ripassato alla Activity
del Workflow, in modo che lo stato della proprietà bindabile sia aggiornato opportunamente.
&lt;/p&gt;
&lt;p&gt;
Cliccando su una attività pendente, si accede ad una form di gestione:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_form_3.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Il link &lt;strong&gt;Complete Activity&lt;/strong&gt; scatena il codice che realizza l'interoperabilità
con Workflow Foundation: in questo caso e per il nostro Workflow di esempio, l'attività
"&lt;strong&gt;Form2&lt;/strong&gt;" viene chiusa e si passa all'attività "&lt;strong&gt;Form3&lt;/strong&gt;",
che è giusto la successiva nel nostro workflow sequenziale.
&lt;/p&gt;
&lt;p&gt;
Il funzionamento dell'intera applicazione è piuttosto semplice, se si intendono i
meccanismi di intercomunicazione di WF (vedi code di item, o &lt;font face="Courier New" color=#ff0000&gt;WorkflowQueue&lt;/font&gt;).
Questo schema dovrebbe riassumere a grandi linee ciò che accade:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_schema.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
La discussione seguente è un poco più complessa, poichè tratta specificatamente dei
problemi di interoperabilità tra ASP.NET e WF e delle soluzioni che ho ricercato e
deciso di adottare caso per caso.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font color=#000000 size=4&gt;Threading&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Normalmente, Workflow Foundation utilizza le caratteristiche del servizio &lt;font face="Courier New" color=#ff0000&gt;DefaultWorkflowSchedulerService&lt;/font&gt; per
creare e coordinare i thread responsabili dell’esecuzione di tutti i workflow associati
ad uno stesso runtime (&lt;font face="Courier New" color=#ff0000&gt;WorkflowRuntime&lt;/font&gt;).
Nella fattispecie, questo implica l’esecuzione asincrona delle istanze di workflow
gestite da un runtime, che vengono opportunamente e trasparentemente messe nella coda
di esecuzione del thread pool .NET associato all’applicazione host.
&lt;/p&gt;
&lt;p&gt;
Nel contesto di una applicazione ASP.NET, questo, generalmente, non è desiderabile.
Infatti, il &lt;font face="Courier New" color=#ff0000&gt;DefaultWorkflowSchedulerService&lt;/font&gt;,
quando utilizzato in una applicazione web, và ad impegnare un thread aggiuntivo per
ciascuna richiesta HTTP che il server di IIS, in un dato momento, sta processando
e che richiede le funzionalità di Workflow Foundation. Per indirizzare questo problema,
è necessario specificare il servizio &lt;font face="Courier New" color=#ff0000&gt;ManualWorkflowSchedulerService&lt;/font&gt;,
quando si inizializza una istanza del &lt;font face="Courier New" color=#ff0000&gt;WorkflowRuntime&lt;/font&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Runtime &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; WorkflowRuntime();&lt;br&gt;
&lt;br&gt;
&lt;font color=#deb887 size=4&gt;&lt;strong&gt;[...]&lt;/strong&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
Runtime.AddService(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ManualWorkflowSchedulerService(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;));&lt;br&gt;
&lt;br&gt;
&lt;font color=#deb887 size=4&gt;&lt;strong&gt;[...]&lt;/strong&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Questo permette di controllare l’esecuzione di un dato workflow, di coordinarla rispetto
al thread che sta servendo la richiesta HTTP e di disimpegnare un thread dal thread
pool dell’applicazione host, poichè WF và ad eseguire le nostre activity nel contesto
dello stesso thread che sta eseguendo la pagina ASP.NET.
&lt;/p&gt;
&lt;p&gt;
Quanto detto è possibile evincerlo empiricamente andando a sbirciare nel call stack
.NET durante l’esecuzione dell’applicazione di esempio allegata a questo post:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.vitoplantamura.com/blog/content/binary/img_callstack.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New" color=#ff0000&gt;UserActivity.Execute&lt;/font&gt; è il nostro codice
applicativo che implementa la nostra Activity (il primo contesto evidenziato in blu). &lt;font face="Courier New" color=#ff0000&gt;API.CompleteActivity&lt;/font&gt; (il
secondo contesto in blu) è un nostro metodo chiamato direttamente da un gestore eventi
di un pulsante di una webform, che chiama l’API &lt;font face="Courier New" color=#ff0000&gt;ManualWorkflowSchedulerService.RunWorkflow&lt;/font&gt;,
che provoca l’esecuzione immediata del workflow il cui ID passiamo come parametro.
Come anticipato, sia il codice della pagina web che quello del workflow vengono eseguiti
nel contesto dello stesso thread.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font size=4&gt;Transazionalità e Persistenza&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
La classe &lt;font face="Courier New" color=#ff0000&gt;TransactionScope&lt;/font&gt; (&lt;font face="Courier New" color=#ff0000&gt;System.Transactions&lt;/font&gt;)
permette di definire contesti transazionali in codice .NET 2.0 e 3.0 in maniera semplice
ed immediata. Specialmente se si utilizza SQL Server 2005, l’uso della classe &lt;font face="Courier New" color=#ff0000&gt;TransactionScope&lt;/font&gt; diviene
ancora più semplice, poichè si viene liberati del tutto da tutte quelle considerazioni
di cui tener conto circa eventuali, inutili e costosi coinvolgimenti del MSDTC per
transazioni puramente locali, importanti invece quando si lavora, per esempio, con
SQL Server 2000. Sorvolando sulle specifiche caratteristiche della classe &lt;font face="Courier New" color=#ff0000&gt;TransactionScope&lt;/font&gt; (fuori
dagli obiettivi di questo post), nell’esempio fornito viene usata questa nuova funzionalità
di .NET 2.0 per la scrittura di codice transazionale che scrive su SQL Server.
&lt;/p&gt;
&lt;p&gt;
Uno dei requisiti principali per realizzare una consistente interoperabilità tra WF
e ASP.NET è la corretta gestione della persistenza dei workflow su database. Per comunicare
a Workflow Foundation di persistere tutti i workflow relativi ad uno stesso &lt;font face="Courier New" color=#ff0000&gt;WorkflowRuntime&lt;/font&gt; su
database, è necessario registrare il servizio &lt;font face="Courier New" color=#ff0000&gt;SqlWorkflowPersistenceService&lt;/font&gt; all’atto
della inizializzazione dell’istanza del &lt;font face="Courier New" color=#ff0000&gt;WorkflowRuntime&lt;/font&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Runtime &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; WorkflowRuntime();&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;font color=#deb887 size=4&gt;[...]&lt;/font&gt;&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;
NameValueCollection parameters &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; NameValueCollection();&lt;br&gt;
parameters.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"ConnectionString"&lt;/span&gt;,
connectionString);&lt;br&gt;
parameters.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"UnloadOnIdle"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"false"&lt;/span&gt;);&lt;br&gt;
Runtime.AddService(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; SqlWorkflowPersistenceService(parameters));&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;font color=#deb887 size=4&gt;[...]&lt;/font&gt;&lt;/strong&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Come parametri, specifichiamo la stringa di connessione al database ed indichiamo
al servizio di NON persistere un workflow su database quando questo è inattivo (parametro &lt;font face="Courier New" color=#ff0000&gt;UnloadOnIdle&lt;/font&gt;):
infatti, per un maggiore controllo e per ragioni di consistenza transazionale che
vedremo tra poco, ci preoccupiamo noi di chiamare il metodo &lt;font face="Courier New" color=#ff0000&gt;WorkflowInstance.Unload&lt;/font&gt; quando
intendiamo persistere una istanza di Workflow su db.
&lt;/p&gt;
&lt;p&gt;
Infatti uno dei maggiori problemi quando si intende integrare della logica che accede
ad un db in una istanza di Workflow con della logica dello stesso tipo eseguita esternamente
nel contesto dell’applicazione host (in questo caso ASP.NET) è che WF, per ragioni
di design, impedisce alla transazione ambientale associata al thread di esecuzione
nel momento in cui si esegue il workflow (&lt;font face="Courier New" color=#ff0000&gt;ManualWorkflowSchedulerService.RunWorkflow&lt;/font&gt;)
di propagarsi fino al contesto di esecuzione nel quale vengono eseguite le Activity
del workflow. Questo è possibile evincerlo empiricamente, per esempio, debuggando
l’applicazione di esempio di questo post: prima di chiamare l’API &lt;font face="Courier New" color=#ff0000&gt;ManualWorkflowSchedulerService.RunWorkflow&lt;/font&gt;,
la proprietà statica &lt;font face="Courier New" color=#ff0000&gt;System.Transactions.Transaction.Current&lt;/font&gt; è
correttamente valorizzata, poichè siamo in uno scope transazionale definito da un
costrutto &lt;font face="Courier New" color=#ff0000&gt;TransactionScope&lt;/font&gt;. Al contrario,
all’interno del metodo &lt;font face="Courier New" color=#ff0000&gt;UserActivity.Execute&lt;/font&gt; (che
implementa la nostra activity) tale proprietà statica ha valore nullo, benchè la chiamata
al metodo &lt;font face="Courier New" color=#ff0000&gt;UserActivity.Execute&lt;/font&gt; sia originata
a partire da del codice configurato per essere transazionale.
&lt;/p&gt;
&lt;p&gt;
Volendo approfondire la questione ed i motivi di tale comportamento, è necessario
ritornare al call stack rappresentato all’inizio di questo post: nella fattispecie,
in una delle 9 chiamate che separano il codice host dal codice della Activity, WF
ha intenzionalmente “soppresso” la nostra transazione ambientale. Alla fine, come
risultato, questo ci impedisce di associare del codice che accede al db in una Activity
di un Workflow ad una transazione iniziata dall’host.
&lt;/p&gt;
&lt;p&gt;
Volendo scendere nel merito, magari utilizzando l’ottimo &lt;strong&gt;.NET Reflector di
Roeder&lt;/strong&gt; e spulciando rapidamente in quei 9 metodi di cui sopra, è possibile
trovare la spiegazione di questo comportamento nel metodo &lt;font face="Courier New" color=#ff0000&gt;System.Workflow.Runtime.WorkflowExecutor.RunSome&lt;/font&gt;,
che, decompilato, appare così:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;internal&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; RunSome(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; ignored)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#deb887 size=4&gt;&lt;strong&gt;[...]&lt;/strong&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/span&gt; (TransactionScope
scope &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; TransactionScope(TransactionScopeOption.Suppress))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;try&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this&lt;/span&gt;.FireWorkflowExecutionEvent(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;,
WorkflowEventInternal.Executing);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this&lt;/span&gt;.RunScheduler();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;catch&lt;/span&gt; (Exception
exception)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#deb887 size=4&gt;&lt;strong&gt;[...]&lt;/strong&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;finally&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this&lt;/span&gt;.FireWorkflowExecutionEvent(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;,
WorkflowEventInternal.NotExecuting);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;scope.Complete();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#deb887 size=4&gt;&lt;strong&gt;[...]&lt;/strong&gt;&lt;/font&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Questo ci obbliga a trovare nuove soluzioni per scrivere sul database in maniera consistente.
&lt;/p&gt;
&lt;p&gt;
La soluzione che ho ricercato ed adottato sfrutta i meccanismi di serializzazione
di .NET, per mettere “in coda” una o più operazioni che è necessario associare ad
una transazione controllata dal codice host (ossia da noi). Per ottenere l’effetto
desiderato, bisogna, per prima cosa, creare una coda di Workflow dove andare ad aggiungere
istanze di un nostro tipo custom (con nome &lt;font face="Courier New" color=#ff0000&gt;DbAccessCallDetails&lt;/font&gt;),
che rappresenta una chiamata ad un metodo di qualsiasi tipo che interagisce col db.
L’idea di base è di registrare semplicemente l’operazione di interazione col db in
questa coda (quando si è all’interno di una Activity), quindi, andare a chiamare il
metodo che implementa tale operazione in un secondo momento, per esempio all’atto
della serializzazione del Workflow su database. Considerando che la coda di Workflow
(&lt;font face="Courier New" color=#ff0000&gt;WorkflowQueue&lt;/font&gt;) è un oggetto che appartiene
al Workflow e che le nostre istanze di &lt;font face="Courier New" color=#ff0000&gt;DbAccessCallDetails&lt;/font&gt; si
trovano depositate in tale coda, quando il servizio &lt;font face="Courier New" color=#ff0000&gt;SqlWorkflowPersistenceService&lt;/font&gt;,
tramite il &lt;font face="Courier New" color=#ff0000&gt;BinaryFormatter&lt;/font&gt;, andrà a
serializzare, quindi comprimere e persistere su db il nostro Workflow, noi avremo
l’occasione che aspettiamo per svuotare la nostra coda e quindi eseguire quei metodi
di cui avevamo procrastinato l’esecuzione.
&lt;/p&gt;
&lt;p&gt;
La classe &lt;font face="Courier New" color=#ff0000&gt;DbAccessCallDetails&lt;/font&gt; si presenta
semplicemente così:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[Serializable()]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; DbAccessCallDetails
: ISerializable&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
constructor(s).&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; DbAccessCallDetails(Delegate
fnParam, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt;[]
psParam)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fn &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; fnParam;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ps &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; psParam;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; DbAccessCallDetails(SerializationInfo
info, StreamingContext context)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
data.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; Delegate
fn &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt;[]
ps &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
ISerializable stuff.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;void&lt;/span&gt; ISerializable.GetObjectData(SerializationInfo
info, StreamingContext context)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
call the method.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/span&gt; (fn
!&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fn.DynamicInvoke(ps);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
In breve, quando si cerca di serializzare una istanza di questa classe, viene chiamato
il metodo &lt;font face="Courier New" color=#ff0000&gt;ISerializable.GetObjectData&lt;/font&gt;,
che semplicemente invoca il metodo ad essa associato. Questo metodo inserisce dei
record su db, nel caso del mio esempio (tabella &lt;strong&gt;UserActivities&lt;/strong&gt;).
&lt;/p&gt;
&lt;p&gt;
Come detto precedentemente, la serializzazione del Workflow avviene all’atto della
chiamata al metodo &lt;font face="Courier New" color=#ff0000&gt;WorkflowInstance.Unload&lt;/font&gt;.
Come emerge da vari documenti e testimonianze su internet, e come può essere approfondito
direttamente attraverso Reflector, questo metodo (intenzionalmente) è l’unico pezzo
di codice di WF che non sopprime attivamente la transazione ambientale del thread
che lo sta chiamando. Questo significa che è possibile associare ad una stessa transazione
ambientale gestita dall’host sia la persistenza dell’istanza del Workflow su database,
sia il codice rappresentato dalle varie istanze di &lt;font face="Courier New" color=#ff0000&gt;DbAccessCallDetails&lt;/font&gt; eventualmente
presenti nella coda del Workflow. Questo “trucco” ci permette di avere sul database
uno stato dei dati di interoperabilità tra la nostra applicazione e Workflow Foundation
sempre consistenti:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; CompleteActivity(Guid
workflowGuid, Guid activityGuid, DataSet activityData, System.Web.HttpRequest Request,
System.Web.HttpResponse resp)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
notify the completion to the wf.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;WorkflowInstance wi &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Runtime.GetWorkflow(workflowGuid);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;wi.EnqueueItem(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;activityGuid.ToString(),&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&lt;/span&gt; ActivityCompletedEventArgs(activityData),&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;null&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
tell the workflow to progress.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string&lt;/span&gt; redirectUrl &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/span&gt; (TransactionScope
scope &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; TransactionScope())&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
complete on the db.&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/span&gt; (Workflows.DataTableAdapters.UserActivitiesTableAdapter
ta &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Workflows.DataTableAdapters.UserActivitiesTableAdapter())&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
complete on the db.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ta.CompleteActivity(activityGuid.ToString());&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
get the redirect page url.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;redirectUrl &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;)ta.GetDataByActivityGuid(activityGuid.ToString()).Rows[0][&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"ReturnPageUrl"&lt;/span&gt;];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;redirectUrl &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"/"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; (Request.ApplicationPath &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"/"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; redirectUrl).Trim('&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/&lt;/span&gt;');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
call the workflow.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Runtime.GetService&amp;lt;ManualWorkflowSchedulerService&amp;gt;().RunWorkflow(workflowGuid);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
persist the workflow on the db.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wi.Unload();&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
commit.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;scope.Complete();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
redirect.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.Redirect(redirectUrl);&lt;br&gt;
}&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Il metodo &lt;font face="Courier New" color=#ff0000&gt;CompleteActivity&lt;/font&gt; permette
di chiudere l’Activity attualmente aperta, di avanzare nell’esecuzione del Workflow
(quindi eseguendo le Activity successive) e soprattutto di aggiornare lo stato sul
db. Questo avviene all’atto della chiamata al metodo &lt;font face="Courier New" color=#ff0000&gt;wi.Unload()&lt;/font&gt;,
che, secondo quanto detto in precedenza, persiste il workflow su db ed esegue le varie
istanze di &lt;font face="Courier New" color=#ff0000&gt;DbAccessCallDetails&lt;/font&gt;, tutto
quanto associato alla stessa &lt;font face="Courier New" color=#ff0000&gt;System.Transactions.Transaction &lt;/font&gt;(&lt;font face="Courier New" color=#ff0000&gt;TransactionScope&lt;/font&gt;).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=b5b64f9e-ee07-4ed3-a7dd-91fed524df48" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,b5b64f9e-ee07-4ed3-a7dd-91fed524df48.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.vitoplantamura.com/blog/Trackback.aspx?guid=0be0ecc8-250c-4bf0-923a-5a9d1842b5b0</trackback:ping>
      <pingback:server>http://www.vitoplantamura.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.vitoplantamura.com/blog/PermaLink,guid,0be0ecc8-250c-4bf0-923a-5a9d1842b5b0.aspx</pingback:target>
      <dc:creator>Vito Plantamura</dc:creator>
      <wfw:comment>http://www.vitoplantamura.com/blog/CommentView,guid,0be0ecc8-250c-4bf0-923a-5a9d1842b5b0.aspx</wfw:comment>
      <wfw:commentRss>http://www.vitoplantamura.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0be0ecc8-250c-4bf0-923a-5a9d1842b5b0</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font size="3">Salve, mi chiamo Vito Plantamura. Come è abitudine in tutti i blog
che si rispettino, il primo post deve essere di tipo introduttivo.</font>
        </p>
        <p>
          <font size="3">Come potete intuire dalla natura del sito, questo blog conterrà principalmente
informazioni, notizie ed esperienze di tipo tecnico. Le tecnologie che saranno coperte
coincidono sostanzialmente con quelle che sono le mie specializzazioni professionali:</font>
        </p>
        <ul>
          <li>
            <font size="3">.NET Framework / C# / Sviluppo di applicazioni Enterprise. </font>
          </li>
          <li>
            <font size="3">ASP.NET / HTML / Javascript. </font>
          </li>
          <li>
            <font size="3">Win32 / MFC / COM (+) / C++. </font>
          </li>
          <li>
            <font size="3">.NET Framework 3.0 / WinFX. </font>
          </li>
          <li>
            <font size="3">Assembler IA32 / IA64 / X64 e sviluppo di driver per Windows NT. </font>
          </li>
          <li>
            <font size="3">Argomenti relativi alla sicurezza internet e Windows di ogni tipo.</font>
          </li>
        </ul>
        <p>
          <font size="3">Personalmente, potete trovare informazioni dettagliate su alcuni dei
miei prodotti e tecnologie che ho sviluppato e "ricercato" negli anni proprio in questo
sito (</font>
          <a href="http://www.VitoPlantamura.com">
            <font size="3">www.VitoPlantamura.com</font>
          </a>
          <font size="3">).
Mi sento di consigliare di provare GoToTerminal, il nostro servizio di connettività
remota basata su Terminal Services e VNC, NDIS Monitor, un packer sniffer sviluppato
mistamente con .NET ed il DDK di Windows, BugChecker, un prodotto di ricerca sviluppato
interamente dalla mia azienda ricalcato sul modello del famoso kernel debugger SoftICE,
MapGen, un editor di tipo CSG di classe professionale, sviluppato diversi anni fà
dal sottoscritto per la creazione di contenuto di gioco per un motore tridimensionale
alla Quake3.</font>
        </p>
        <p>
          <font size="3">Concludendo, al momento mi occupo di consulenza sulle tecnologie sopra
elencate (attraverso la mia azienda: VPC Technologies) e parallelamente seguo lo sviluppo
tecnologico e commerciale dei miei prodotti. Se intendete ottenere maggiori informazioni
sulle nostre attività di consulenza e sul nostro/mio curriculum, vi pregherei di contattarmi
direttamente al mio indirizzo personale (o, alternativamente, attraverso il sito della
mia company).</font>
        </p>
        <p>
          <font size="3">Inoltre spero di poter replicare quanto prima questo blog (inizialmente
solo in italiano) anche in inglese, in modo che anche i miei amici/colleghi/clienti
non italiani possano seguirmi in questa nuova avventura... :-) :-) :-)</font>
        </p>
        <p>
          <font size="3">Detto questo, posso solo augurarvi una buona lettura... :-)</font>
        </p>
        <p>
          <font size="3">vito</font>
        </p>
        <img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=0be0ecc8-250c-4bf0-923a-5a9d1842b5b0" />
      </body>
      <title>Benvenuti al mio blog !</title>
      <guid isPermaLink="false">http://www.vitoplantamura.com/blog/PermaLink,guid,0be0ecc8-250c-4bf0-923a-5a9d1842b5b0.aspx</guid>
      <link>http://www.vitoplantamura.com/blog/2007/08/26/BenvenutiAlMioBlog.aspx</link>
      <pubDate>Sun, 26 Aug 2007 21:33:59 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font size=3&gt;Salve, mi chiamo Vito Plantamura. Come è abitudine in tutti i blog che
si rispettino, il primo post deve essere di tipo introduttivo.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Come potete intuire dalla natura del sito, questo blog conterrà principalmente
informazioni, notizie ed esperienze di tipo tecnico. Le tecnologie che saranno coperte
coincidono sostanzialmente con quelle che sono le mie specializzazioni professionali:&lt;/font&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size=3&gt;.NET Framework / C# / Sviluppo di applicazioni Enterprise. &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;ASP.NET / HTML / Javascript. &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Win32 / MFC / COM (+) / C++. &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;.NET Framework 3.0 / WinFX. &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Assembler IA32 / IA64 / X64 e sviluppo di driver per Windows NT. &lt;/font&gt; 
&lt;li&gt;
&lt;font size=3&gt;Argomenti relativi alla sicurezza internet e Windows di ogni tipo.&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font size=3&gt;Personalmente, potete trovare informazioni dettagliate su alcuni dei
miei prodotti e tecnologie che ho sviluppato e "ricercato" negli anni proprio in questo
sito (&lt;/font&gt;&lt;a href="http://www.VitoPlantamura.com"&gt;&lt;font size=3&gt;www.VitoPlantamura.com&lt;/font&gt;&lt;/a&gt;&lt;font size=3&gt;).
Mi sento di consigliare di provare GoToTerminal, il nostro servizio di connettività
remota basata su Terminal Services e VNC, NDIS Monitor, un packer sniffer sviluppato
mistamente con .NET ed il DDK di Windows, BugChecker, un prodotto di ricerca sviluppato
interamente dalla mia azienda ricalcato sul modello del famoso kernel debugger SoftICE,
MapGen, un editor di tipo CSG di classe professionale, sviluppato diversi anni fà
dal sottoscritto per la creazione di contenuto di gioco per un motore tridimensionale
alla Quake3.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Concludendo, al momento mi occupo di consulenza sulle tecnologie sopra
elencate (attraverso la mia azienda: VPC Technologies) e parallelamente seguo lo sviluppo
tecnologico e commerciale dei miei prodotti. Se intendete ottenere maggiori informazioni
sulle nostre attività di consulenza e sul nostro/mio curriculum, vi pregherei di contattarmi
direttamente al mio indirizzo personale (o, alternativamente, attraverso il sito della
mia company).&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Inoltre spero di poter replicare quanto prima questo blog (inizialmente
solo in italiano) anche in inglese, in modo che anche i miei amici/colleghi/clienti
non italiani possano seguirmi in questa nuova avventura... :-) :-) :-)&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;Detto questo, posso solo augurarvi una buona lettura... :-)&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=3&gt;vito&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vitoplantamura.com/blog/aggbug.ashx?id=0be0ecc8-250c-4bf0-923a-5a9d1842b5b0" /&gt;</description>
      <comments>http://www.vitoplantamura.com/blog/CommentView,guid,0be0ecc8-250c-4bf0-923a-5a9d1842b5b0.aspx</comments>
    </item>
  </channel>
</rss>