Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head> <meta http-equiv=Content-Type content="text/html; charset=us-ascii"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="wiascanr_files/filelist.xml"> <title>wiascanr</title> <!--[if gte mso 9]><xml>
<o:DocumentProperties> <o:Author>Microsoft</o:Author> <o:LastAuthor>Microsoft</o:LastAuthor> <o:Revision>8</o:Revision> <o:TotalTime>353</o:TotalTime> <o:Created>2002-03-07T21:31:00Z</o:Created> <o:LastSaved>2002-03-07T21:37:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>625</o:Words> <o:Characters>3568</o:Characters> <o:Company>Microsoft Corp.</o:Company> <o:Lines>29</o:Lines> <o:Paragraphs>8</o:Paragraphs> <o:CharactersWithSpaces>4185</o:CharactersWithSpaces> <o:Version>10.3501</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument> <w:HideSpellingErrors/> <w:HideGrammaticalErrors/> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <style> <!--
/* 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"; color:black;} h1 {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; mso-outline-level:1; font-size:24.0pt; font-family:"Times New Roman"; color:black; font-weight:bold;} h2 {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; mso-outline-level:2; font-size:18.0pt; font-family:"Times New Roman"; color:black; font-weight:bold;} h3 {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; mso-outline-level:3; font-size:13.5pt; font-family:"Times New Roman"; color:black; font-weight:bold;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:blue; text-decoration:underline; text-underline:single;} p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:black;} pre {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; font-size:10.0pt; font-family:"Courier New"; mso-fareast-font-family:"Courier New"; color:black;} span.SpellE {mso-style-name:""; mso-spl-e:yes;} span.GramE {mso-style-name:""; mso-gram-e:yes;} @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;} /* List Definitions */ @list l0 {mso-list-id:371000526; mso-list-type:hybrid; mso-list-template-ids:619977120 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level2 {mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level3 {mso-level-tab-stop:1.5in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level4 {mso-level-tab-stop:2.0in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level5 {mso-level-tab-stop:2.5in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level6 {mso-level-tab-stop:3.0in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level7 {mso-level-tab-stop:3.5in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level8 {mso-level-tab-stop:4.0in; mso-level-number-position:left; text-indent:-.25in;} @list l0:level9 {mso-level-tab-stop:4.5in; mso-level-number-position:left; text-indent:-.25in;} @list l1 {mso-list-id:566766583; mso-list-type:hybrid; mso-list-template-ids:1578417540 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l1:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level2 {mso-level-number-format:alpha-lower; mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level3 {mso-level-number-format:roman-lower; mso-level-tab-stop:1.5in; mso-level-number-position:right; text-indent:-9.0pt;} @list l1:level4 {mso-level-tab-stop:2.0in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level5 {mso-level-tab-stop:2.5in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level6 {mso-level-tab-stop:3.0in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level7 {mso-level-tab-stop:3.5in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level8 {mso-level-tab-stop:4.0in; mso-level-number-position:left; text-indent:-.25in;} @list l1:level9 {mso-level-tab-stop:4.5in; mso-level-number-position:left; text-indent:-.25in;} @list l2 {mso-list-id:745304408; mso-list-type:hybrid; mso-list-template-ids:501628894 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l2:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level2 {mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level3 {mso-level-tab-stop:1.5in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level4 {mso-level-tab-stop:2.0in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level5 {mso-level-tab-stop:2.5in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level6 {mso-level-tab-stop:3.0in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level7 {mso-level-tab-stop:3.5in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level8 {mso-level-tab-stop:4.0in; mso-level-number-position:left; text-indent:-.25in;} @list l2:level9 {mso-level-tab-stop:4.5in; mso-level-number-position:left; text-indent:-.25in;} @list l3 {mso-list-id:797068354; mso-list-type:hybrid; mso-list-template-ids:2079487468 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l3:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l3:level2 {mso-level-number-format:alpha-lower; mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @list l4 {mso-list-id:1382750078; mso-list-type:hybrid; mso-list-template-ids:-98557440 -1634539084 1364493882 -555997176 1048594918 1907263124 1809221600 353402950 -1899568204 803906870;} @list l4:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level2 {mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level3 {mso-level-tab-stop:1.5in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level4 {mso-level-tab-stop:2.0in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level5 {mso-level-tab-stop:2.5in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level6 {mso-level-tab-stop:3.0in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level7 {mso-level-tab-stop:3.5in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level8 {mso-level-tab-stop:4.0in; mso-level-number-position:left; text-indent:-.25in;} @list l4:level9 {mso-level-tab-stop:4.5in; mso-level-number-position:left; text-indent:-.25in;} @list l5 {mso-list-id:1684744677; mso-list-template-ids:-782180816;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> <!--[if gte mso 10]>
<style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050"/> </xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> </head>
<body bgcolor=white lang=EN-US link=blue vlink=blue style='tab-interval:.5in' leftmargin=8>
<div class=Section1>
<h1><a name=MYSAMPLE>Sample WIA Scanner </a><span class=GramE><span style='mso-bookmark:MYSAMPLE'>Driver</span> :</span></h1>
<h1>(<span class=GramE>flatbed</span> scanner with a document feeder attached) or</h1>
<h1>(<span class=GramE>scanner</span> with a document feeder only that can not determine page length)</h1>
<h1><span style='font-size:14.0pt;mso-bidi-font-size:24.0pt;color:red'>[This is preliminary documentation and subject to change.]<o:p></o:p></span></h1>
<h2>SUMMARY</h2>
<p>This sample shows how to write a Windows Image Acquisition (WIA) user-mode <span class=SpellE>minidriver</span> for a scanner. It simulates scanning by producing a test pattern image. This sample driver is an excellent starting point for your development, but your driver should access the scanner hardware through one of the kernel drivers provided with Windows, <span class=SpellE>Usbscan.sys</span> or <span class=SpellE>Scsiscan.sys</span>, if possible.</p>
<p>This sample will not work on Windows 98 or Windows 2000.</p>
<h3>SAMPLE FEATURES</h3>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l1 level1 lfo2; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Automatic document feeder capabilities</p>
<p style='margin-left:1.0in;text-indent:-.25in;mso-list:l1 level2 lfo2; tab-stops:list 1.0in'><![if !supportLists]><span style='mso-list:Ignore'>a.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>This sample also shows an example of a feeder that can not determine the page length. (formally called a <span class=SpellE>scrollfed</span> scanner)</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l1 level1 lfo2; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Scan, Copy, and Fax button support. (interrupt events only)</p>
<p style='margin-left:1.0in;text-indent:-.25in;mso-list:l1 level2 lfo2; tab-stops:list 1.0in'><![if !supportLists]><span style='mso-list:Ignore'>a.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Run the small application provided with the DDK called <b style='mso-bidi-font-weight: normal'>scanpanl.exe</b> to simulate button presses.</p>
<h3>BUILDING THE SAMPLE (flatbed scanner with document feeder attached)</h3>
<p>To build the <span class=GramE>sample follow</span> these steps:</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>In the Start menu, <span class=GramE>select<span style='mso-spacerun:yes'> </span>"</span>Free Build Environment" or "Checked Build Environment" under "Windows DDK" to open a command window and set basic environment variables needed to build drivers. </p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Change to the directory containing the sample driver source code.</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Execute the "build" command. After the build completes, a driver named wiascanr.dll will be located in a subdirectory.</p>
<h3>BUILDING THE SAMPLE (document feeder only scanner that can not determine page length (formally called a <span class=SpellE>scrollfed</span> scanner))</h3>
<p>To build the <span class=GramE>sample follow</span> these steps:</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l3 level1 lfo10; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>In the Start menu, <span class=GramE>select<span style='mso-spacerun:yes'> </span>"</span>Free Build Environment" or "Checked Build Environment" under "Windows DDK" to open a command window and set basic environment variables needed to build drivers. </p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l3 level1 lfo10; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Change to the directory containing the sample driver source code.</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l3 level1 lfo10; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Edit the <b style='mso-bidi-font-weight:normal'>SOURCES</b> file adding <b style='mso-bidi-font-weight:normal'>/DUNKNOWN_LENGTH_FEEDER_ONLY_SCANNER</b> to the <b style='mso-bidi-font-weight:normal'>C_DEFINES</b> section.</p>
<p style='margin-left:1.0in;text-indent:-.25in;mso-list:l3 level2 lfo10; tab-stops:list 1.0in'><![if !supportLists]><span style='mso-list:Ignore'>a.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Example: <b style='mso-bidi-font-weight:normal'><span style='font-size:10.0pt'>C_DEFINES<span style='mso-spacerun:yes'> </span>=$(C_DEFINES) /DUNKNOWN_LENGTH_FEEDER_ONLY_SCANNER</span></b></p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l3 level1 lfo10; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Execute the "build" command. After the build completes, a driver named wiascanr.dll will be located in a subdirectory. </p>
<p style='margin-left:1.0in;text-indent:-.25in;mso-list:l3 level2 lfo10; tab-stops:list 1.0in'><![if !supportLists]><span style='mso-list:Ignore'>a.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]><span style='color:red'>Important note:</span> This driver is the same .<span class=SpellE>dll</span> as the one built above.<span style='mso-spacerun:yes'> </span>It only contains different functionality. A separate installation is not required or recommended.</p>
<h3>USING THE SAMPLE<o:p></o:p></h3>
<p><! ---------------- Snip Snip ---------------- >To use the driver, first install it following these steps: </p>
<ol start=1 type=1> <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; mso-list:l4 level1 lfo7;tab-stops:list .5in'>Copy wiascanr.dll from the appropriate object subdirectory under <span class=SpellE>wiascanr</span> to a new, empty directory.</li> <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; mso-list:l4 level1 lfo7;tab-stops:list .5in'>Copy <span class=SpellE><span class=GramE>wiascanr.inf</span></span><span class=GramE><span style='mso-spacerun:yes'> </span>to</span> the same directory.</li> <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; mso-list:l4 level1 lfo7;tab-stops:list .5in'>In Windows Me or Windows XP, open the “New Device” icon located in the Scanners and Cameras control panel.</li> <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; mso-list:l4 level1 lfo7;tab-stops:list .5in'>Click the “Have Disk” button and enter the name of the folder created in step 1.</li> <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; mso-list:l4 level1 lfo7;tab-stops:list .5in'>Click OK, Next, or Finish until the wizard is finished.</li> </ol>
<p>Use one of these options to test this driver:</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo9; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>The Scanners and Cameras Wizard accessible from the Start menu or by double-clicking the scanner in Explorer.</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo9; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>The <span class=SpellE>wiatest</span> application provided in this DDK tools directory.</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo9; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Microsoft Paint, a native WIA application.</p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo9; tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Any TWAIN compliant application.</p>
<h3>RESOURCES</h3>
<p>WIA information: <a href="http://www.microsoft.com/hwdev/tech/wia">http://www.microsoft.com/hwdev/tech/wia</a></p>
<p>DDK information: <a href="http://www.microsoft.com/ddk/">http://www.microsoft.com/ddk/</a></p>
<h3>CODE TOUR</h3>
<h3>File Manifest</h3>
<pre>Files<span style='mso-spacerun:yes'> </span>Description</pre><pre>------------ -------------------------------------------------------</pre><pre><span class=SpellE><span class=GramE>istiusd.cpp</span></span><span style='mso-spacerun:yes'> </span>Implements STI <span class=SpellE>minidriver</span> for backward compatibility</pre><pre><span class=SpellE><span class=GramE>iwiaminidrv.cpp</span></span> Implements COM WIA mini-driver functions</pre><pre><span class=SpellE><span class=GramE>makefile</span></span><span style='mso-spacerun:yes'> </span>Used for building the driver--do not modify</pre><pre><span class=SpellE><span class=GramE>pch.h</span></span><span style='mso-spacerun:yes'> </span>Precompiled header</pre><pre><span class=SpellE><span class=GramE>resource.h</span></span><span style='mso-spacerun:yes'> </span>Header file for resources</pre><pre><span class=GramE>sources</span><span style='mso-spacerun:yes'> </span>Controls building of driver</pre><pre><span class=SpellE><span class=GramE>validate.cpp</span></span><span style='mso-spacerun:yes'> </span>Implements property validation helpers</pre><pre><span class=SpellE><span class=GramE>wiaprop.h</span></span><span style='mso-spacerun:yes'> </span>Property header file</pre><pre><span class=SpellE><span class=GramE>wiascanr.cpp</span></span><span style='mso-spacerun:yes'> </span>Implements COM DLL functionality</pre><pre><span class=SpellE><span class=GramE>wiascanr.h</span></span><span style='mso-spacerun:yes'> </span>Main DLL header file</pre><pre><span class=SpellE><span class=GramE>wiascanr.rc</span></span><span style='mso-spacerun:yes'> </span>Resource definitions</pre><pre><span class=SpellE><span class=GramE>wiascanr.rcv</span></span><span style='mso-spacerun:yes'> </span>Version resource definitions</pre><pre><span class=SpellE><span class=GramE>wiascanr.def</span></span><span style='mso-spacerun:yes'> </span>DLL exports file</pre><pre><span class=SpellE><span class=GramE>dlihook.cpp</span></span><span style='mso-spacerun:yes'> </span>delay load module</pre><pre><span class=GramE>wiascanr.htm</span><span style='mso-spacerun:yes'> </span>This <span class=SpellE>readme</span> file</pre><pre><span class=SpellE><span class=GramE>wiascanr.inf</span></span><span style='mso-spacerun:yes'> </span>Installation file for this driver</pre></div>
</body>
</html>
|