https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/103950&feed=atom&action=history
Microsoft KB Archive/103950 - Revision history
2024-03-29T05:25:47Z
Revision history for this page on the wiki
MediaWiki 1.39.3
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/103950&diff=264366&oldid=prev
X010: Text replacement - ">" to ">"
2020-07-20T09:17:29Z
<p>Text replacement - ">" to ">"</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en-GB">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 09:17, 20 July 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l65">Line 65:</td>
<td colspan="2" class="diff-lineno">Line 65:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> BOOL bRetVal=TRUE;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> BOOL bRetVal=TRUE;</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>// If the limit is <del style="font-weight: bold; text-decoration: none;">&gt;</del>= 1MB, you need to make the limit a multiple of</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>// If the limit is <ins style="font-weight: bold; text-decoration: none;">></ins>= 1MB, you need to make the limit a multiple of</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>// the page size or DPMISetSelectorLimit will fail.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>// the page size or DPMISetSelectorLimit will fail.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if( dwLimit <del style="font-weight: bold; text-decoration: none;">&gt;</del>= 0x100000 )</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if( dwLimit <ins style="font-weight: bold; text-decoration: none;">></ins>= 0x100000 )</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> dwLimit |= 0x0FFF;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> dwLimit |= 0x0FFF;</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
</table>
X010
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/103950&diff=27356&oldid=prev
X010: 1 revision imported: importing part 1
2020-07-16T18:14:56Z
<p>1 revision imported: importing part 1</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en-GB">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 18:14, 16 July 2020</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en-GB"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
X010
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/103950&diff=27355&oldid=prev
X010: stage1
2020-07-16T17:46:26Z
<p>stage1</p>
<p><b>New page</b></p><div>{|<br />
|width="100%"|<br />
== SetSelectorLimit() Crossing 1 Megabyte Boundary ==<br />
|}<br />
<br />
Q103950<br />
<br />
<br />
-----<br />
<br />
The information in this article applies to:<br /><br />
<br />
<br />
* Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1<br />
<br />
<br />
-----<br />
<br />
<br /><br />
<br />
<br />
== SUMMARY ==<br />
<br />
The SetSelectorLimit() application programming interface (API) function will not properly modify the limit of a selector if the change is to cross the 1 megabyte (MB) (0x100000) boundary. That is, the change is improper going from less than 1 MB to greater than 1 MB and visa versa. In these cases, DPMI function 08h must be used to properly change the limit of a selector.<br />
<br />
<br /><br />
<br />
<br />
== MORE INFORMATION ==<br />
<br />
SetSelectorLimit() does not correctly handle setting segment sizes from less than 1 MB to greater than 1 MB because it will not set the granularity bit. The granularity bit needs to be set to indicate page granularity in the segment descriptor. When the granularity bit is set, the selector limit has the form xxxxxFFFh for page alignment. A page is 4K (4096 bytes).<br /><br />
<br /><br />
Similarly, SetSelectorLimit() does not correctly handle setting segment sizes from greater than 1 MB to less than 1 MB because it will not clear the granularity bit. When the granularity bit is clear, the selector limit has the form xxxxxh for byte alignment.<br /><br />
<br /><br />
DPMI function 08h properly sets or clears the granularity bit when appropriate. The limit must be in the form xxxxxFFFh when changed to greater than 1 MB, and must be in the form xxxxxh when changed to less than 1 MB.<br />
<br />
=== Sample Code ===<br />
<br />
<pre class="CODESAMP"><br />
//********************************************************************<br />
// DPMISetSelectorLimit()<br />
// <br />
// This function sets a selector limit using DPMI Function AX=0008h<br />
//(Set Segment Limit). This function is necessary if the segment size<br />
// is greater than 1 MB because SetSelectorLimit() does not correctly<br />
// set selector sizes greater than 1 MB.<br />
// <br />
// Segments that are larger than 1MB are actually page granular,<br />
// meaning that in the descriptor, the limit field is actually<br />
// stored as the number of 4K pages rather than bytes. When you<br />
// specify a limit greater than 1MB, this function rounds it up<br />
// to the nearest page boundary.<br />
// <br />
// No matter the size of the segment, this function always accepts<br />
// selector limits in number of bytes, never pages. The conversion<br />
// between bytes and pages is handled internally.<br />
// <br />
// Note that this function takes a segment limit, which is one less<br />
// than the number of bytes in the segment.<br />
// <br />
//********************************************************************<br />
<br />
BOOL DPMISetSelectorLimit (UINT selector, DWORD dwLimit)<br />
{<br />
BOOL bRetVal=TRUE;<br />
<br />
// If the limit is &gt;= 1MB, you need to make the limit a multiple of<br />
// the page size or DPMISetSelectorLimit will fail.<br />
<br />
if( dwLimit &gt;= 0x100000 )<br />
dwLimit |= 0x0FFF;<br />
<br />
_asm<br />
{<br />
mov ax, 0008h<br />
mov bx, selector<br />
mov cx, word ptr [dwLimit+2]<br />
mov dx, word ptr [dwLimit]<br />
int 31h<br />
jnc success<br />
mov bRetVal, FALSE<br />
success:<br />
}<br />
<br />
return bRetVal;<br />
} </pre><br />
Additional query words: gp-fault gpf uae gp fault<br />
<br />
Keywords : kb16bitonly<br /><br />
Issue type :<br /><br />
Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK300 kbWinSDK310<br />
<br />
{|<br />
|width="100%"| <br /><br />
Last Reviewed: November 5, 1999<br /><br />
[http://www.microsoft.com/misc/cpyright.htm © 2001 Microsoft Corporation. All rights reserved. Terms of Use.]<br /><br />
|}</div>
X010