Click here to Skip to main content
15,914,323 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General.NET Confusion Pin
vinuk25-Dec-01 16:14
vinuk25-Dec-01 16:14 
GeneralRe: .NET Confusion Pin
Nish Nishant25-Dec-01 17:01
sitebuilderNish Nishant25-Dec-01 17:01 
GeneralRe: .NET Confusion Pin
Hadi Rezaee26-Dec-01 9:47
Hadi Rezaee26-Dec-01 9:47 
GeneralRe: .NET Confusion Pin
Erik Funkenbusch25-Dec-01 20:55
Erik Funkenbusch25-Dec-01 20:55 
GeneralRe: .NET Confusion Pin
Nemanja Trifunovic26-Dec-01 9:58
Nemanja Trifunovic26-Dec-01 9:58 
QuestionI got a HWND of CFileDialog form another program, and get the child HWND named "edit" within this CFileDialog, and SetWindowText(hWnd,"C:\\"); to change the filedialog 's path, but failed, how to do it? Pin
25-Dec-01 14:51
suss25-Dec-01 14:51 
AnswerRe: I got a HWND of CFileDialog form another program, and get the child HWND named "edit" within this CFileDialog, and SetWindowText(hWnd,"C:\\"); to change the filedialog 's path, but failed, how to do it? Pin
567890123425-Dec-01 23:16
567890123425-Dec-01 23:16 
Generalinp() and outp() won't work on NT ?!!! Pin
Hadi Rezaee25-Dec-01 10:32
Hadi Rezaee25-Dec-01 10:32 
Please read below article ...
It mean i can't use inp and outp on NT ?
So, what i can use instead inp() and outp() functions ?

Help me ! Frown | :(


DOC: Port I/O with inp() and outp() Fails on Windows NT
ID: Q112298


--------------------------------------------------------------------------------
The information in this article applies to:

The C Run-Time (CRT), included with:
Microsoft Visual C++, 32-bit Editions, versions 1.0, 2.0

--------------------------------------------------------------------------------


SUMMARY
Attempting to use the port I/O (input/output) functions such as inp() and outp() from within an application for Windows NT running in user mode causes a privileged instruction exception to occur. The sample code provided in the OUTP.C online help sample for the outp() function and related functions can be used to illustrate this behavior.

The documentation regarding the compatibility of the port I/O functions is incomplete. Win32-based applications that call inp(), outp(), and so forth can be successfully compiled and linked. However, these applications will generate the privileged instruction exception because the port I/O functions cannot be called from code running in user mode.

Do not call the following functions from within a Win32-based application executing in user mode:

_inp()
_inpw()
_inpd()
_outp()
_outpw()
_outpd()
NOTE: This documentation error has been corrected for the Visual C++ 4.0 Books Online. The descriptions of the various port I/O functions do not list "Win NT" in the Compatibility section.



MORE INFORMATION
According to the documentation provided with Visual C++ 32-bit Edition, inp(), outp(), and the other port I/O related functions are Win32 and Win32s compatible. However, executing code that uses these functions causes a privileged instruction exception on Win32 on Windows NT. The code that uses inp(), outp(), and so forth will execute correctly on Win32s.

The inp(), outp(), and other I/O port related functions map to privileged processor instructions. For example, on Intel processors, the inp() and outp() functions end up calling the IN and OUT instructions. The privileged instruction exception occurs when these instructions are executed because typical Windows NT applications execute in a nonprivileged (user) mode. Only code executing in kernel mode has the necessary rights to execute privileged instructions. Kernel mode code is typically found in device drivers.

For more information on user mode and kernel mode in Windows NT, refer to the Microsoft Press book "Inside Windows NT" by Helen Custer. For an example of a kernel mode Windows NT device driver that allows user mode applications to access hardware ports, refer to the GENPORT sample provided with the Microsoft Windows NT Device Driver Kit (DDK).





My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html

Hadi Rezaie
GeneralRe: inp() and outp() won't work on NT ?!!! Pin
Ravi Bhavnani25-Dec-01 10:51
professionalRavi Bhavnani25-Dec-01 10:51 
GeneralRe: inp() and outp() won't work on NT ?!!! Pin
Hadi Rezaee26-Dec-01 9:20
Hadi Rezaee26-Dec-01 9:20 
GeneralRe: inp() and outp() won't work on NT ?!!! Pin
Erik Funkenbusch25-Dec-01 21:04
Erik Funkenbusch25-Dec-01 21:04 
GeneralDAO : the memory size increase Pin
Wizard_0125-Dec-01 5:44
Wizard_0125-Dec-01 5:44 
GeneralClass problem ! Pin
Hadi Rezaee25-Dec-01 5:36
Hadi Rezaee25-Dec-01 5:36 
GeneralRe: Class problem ! Pin
Ravi Bhavnani25-Dec-01 6:09
professionalRavi Bhavnani25-Dec-01 6:09 
GeneralRe: Class problem ! Pin
Hadi Rezaee25-Dec-01 10:27
Hadi Rezaee25-Dec-01 10:27 
GeneralRe: Class problem ! Pin
Ravi Bhavnani25-Dec-01 10:47
professionalRavi Bhavnani25-Dec-01 10:47 
GeneralCFtpConnection... Pin
25-Dec-01 4:36
suss25-Dec-01 4:36 
GeneralXP AutoPlay - how to turn it off Pin
567890123425-Dec-01 4:31
567890123425-Dec-01 4:31 
GeneralPlease, ActiveX help ! Pin
25-Dec-01 3:47
suss25-Dec-01 3:47 
GeneralStuid Question Pin
The_Server24-Dec-01 21:58
The_Server24-Dec-01 21:58 
GeneralRe: Stuid Question Pin
l a u r e n25-Dec-01 1:33
l a u r e n25-Dec-01 1:33 
GeneralRe: Stuid Question Pin
The_Server25-Dec-01 23:03
The_Server25-Dec-01 23:03 
GeneralRe: Stuid Question Pin
Tim Smith25-Dec-01 2:32
Tim Smith25-Dec-01 2:32 
GeneralRe: Stuid Question Pin
The_Server25-Dec-01 23:07
The_Server25-Dec-01 23:07 
GeneralRe: Stuid Question Pin
The_Server25-Dec-01 23:17
The_Server25-Dec-01 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.