Dec 152017
 
Int86 replacement for windows development. Takes long pointers.
File WININT86.ZIP from The Programmer’s Corner in
Category C Source Code
Int86 replacement for windows development. Takes long pointers.
File Name File Size Zip Size Zip Type
GENERIC.C 12553 3679 deflated
GENERIC.DEF 970 511 deflated
GENERIC.H 248 154 deflated
GENERIC.RC 545 298 deflated
INT86Y.ASM 9103 2740 deflated
INT86Y.H 283 168 deflated
MAKEFILE 1371 573 deflated
README.TXT 4601 1639 deflated

Download File WININT86.ZIP Here

Contents of the README.TXT file



INT86Y.ASM DOCUMENTATION
=========================


This .ZIP file contains a module that contains two functions:

zyzInt86y()
zyzInt86yFreeSelector()

The zyzInt86y() function is used as a replacement for int86x()
that is supplied in the C run-time library. It is designed to
work in a .DLL and take FAR pointers to REGS and SREGS structures.

When your application is terminating, you must call:

zyzInt86yFreeSelector()

This is to free up the selector created by zyzInt86y() on its
first invocation.


Below is an article discussing one of the functions used by the
zyzInt86y() function--to create a valid data selector on top of
the code selector.

Enjoy, Curt.




---------------------------------------------------------------------
KB Title: Use PrestoChangoSelector, ChangeSelector Doesn't exist

Summary:

Within Windows 3.00, the function ChangeSelector does not exist. If
you try to use it you'll end up with an unresolved external at link
time.

The functionality that ChangeSelector offered is available by using
the undocumented function PrestoChangoSelector. PrestoChangoSelector
is designed to copy the contents of the Local Descriptor Table pointed
to by the source selector into the Local Descriptor Table pointed to
by the destination selector. After copying this information it
toggles the bit associated with whether or not the selector points to
code or data.

More Information:

If you're planning on using PrestoChangoSelector you'll need to define
a prototype for the function. It should look like:

WORD FAR PASCAL PrestoChangoSelector(WORD wSourceSelector,
WORD wDestSelector);

Following a the format of other functions in the reference
manual PrestoChangoSelector should be documented as follows:

PrestoChangoSelector

Prototype: WORD FAR PASCAL PrestoChangoSelector( WORD, WORD);

Syntax: WORD ChangeSelector(wSourceSelector ,wDestSelector)

Objective: This function generates a code selector that
corresponds to a given data selector, or a data
selector that corresponds to a given code selector.

The wSourceSelector parameter specifies the selector
to be copied and converted; the wDestSelector parameter
is a selector previously allocated by a call to the
AllocSelector function. ChangeSelector modifies the
destination selector to have the same properties as
the source selector, but with the opposite code or
data attribute. This function changes only the
attributes of the selector, not the value of the
selector.

Parameter: Type/Description:
wSourceSelector WORD Specifies the selector to be converted.
wDestSelector WORD Specifies a selector previously allocated
by AllocSelector that receives the converted
selector.

Return Value: undefined

Comments: Windows does not attempt to track changes to
the source selector. Consequently, the application
should use the converted destination selector
immediately after it is returned by this function
before any movement of memory can occur.

NOTE: An application should not use this function unless
it is absolutely necessary. Use of this function
violates preferred Windows programming practices.

Example:

The following code fragment demonstrates how to create a code selector
out of a data selector.

WORD wCopyOfDataSelector; // This will contain a copy of the
// information that in associate with
// DATA_SELECTOR.
WORD wSelectorToCode; // This will be a executable copy of
// wCopyOfDataSelector.

// The variable DATA_SELECTOR should contain the selector
// of the memory block that contains some data that you want
// to execute.

if( (wCopyOfDataSelector = AllocSelector(DATA_SELECTOR))) != 0)
{
if( (wSelectorToCode = PrestoChangoSelector(DATA_SELECTOR,
wCopyOfDataSelector)) != 0)
{
// At this point you can call code pointed to by the
// wSelectorToCode variable.

if(FreeSelector(wCopyOfDataSelector))
return FALSE;
return TRUE; // Everything Worked!
}
}


 December 15, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)